FreeBSD Bugzilla – Attachment 233863 Details for
Bug 261355
dwc(4) fails to attach on BananaPi A20
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
aw_if_dwc tx clock detection v2
aw_if_dwc.patch (text/plain), 2.53 KB, created by
Mitchell Horne
on 2022-05-11 18:38:28 UTC
(
hide
)
Description:
aw_if_dwc tx clock detection v2
Filename:
MIME Type:
Creator:
Mitchell Horne
Created:
2022-05-11 18:38:28 UTC
Size:
2.53 KB
patch
obsolete
>commit f2aa85a2c9842b568b0bcbae0866c32f43f00ad3 >Author: Mitchell Horne <mhorne@FreeBSD.org> >Date: Wed May 11 11:48:08 2022 -0300 > > dwc: recognize additional rgmii phy-modes on A20 > > Per the report, the BananaPi A20 now describes the desired phy-mode as > "rgmii-id". We still want the same tx clock name in this case. Use the > standard helper function mii_fdt_get_contype() instead of manual string > comparison. > > PR: 261355 > Reported by: Maren <marentoy@protonmail.com> > >diff --git a/sys/arm/allwinner/aw_if_dwc.c b/sys/arm/allwinner/aw_if_dwc.c >index 98ff55c6755a..067afbdbd9c4 100644 >--- a/sys/arm/allwinner/aw_if_dwc.c >+++ b/sys/arm/allwinner/aw_if_dwc.c >@@ -62,40 +62,43 @@ a20_if_dwc_probe(device_t dev) > static int > a20_if_dwc_init(device_t dev) > { >+ struct dwc_softc *sc; > const char *tx_parent_name; >- char *phy_type; > clk_t clk_tx, clk_tx_parent; > regulator_t reg; >- phandle_t node; > int error; > >- node = ofw_bus_get_node(dev); >+ sc = device_get_softc(dev); > > /* Configure PHY for MII or RGMII mode */ >- if (OF_getprop_alloc(node, "phy-mode", (void **)&phy_type)) { >- error = clk_get_by_ofw_name(dev, 0, "allwinner_gmac_tx", &clk_tx); >- if (error != 0) { >- device_printf(dev, "could not get tx clk\n"); >- return (error); >- } >- >- if (strcmp(phy_type, "rgmii") == 0) >- tx_parent_name = "gmac_int_tx"; >- else >- tx_parent_name = "mii_phy_tx"; >- >- error = clk_get_by_name(dev, tx_parent_name, &clk_tx_parent); >- if (error != 0) { >- device_printf(dev, "could not get clock '%s'\n", >- tx_parent_name); >- return (error); >- } >+ switch(sc->phy_mode) { >+ case PHY_MODE_RGMII: >+ tx_parent_name = "gmac_int_tx"; >+ break; >+ case PHY_MODE_MII: >+ tx_parent_name = "mii_phy_tx"; >+ break; >+ default: >+ device_printf(dev, "unsupported PHY connection type: %d", >+ sc->phy_mode); >+ return (ENXIO); >+ } > >- error = clk_set_parent_by_clk(clk_tx, clk_tx_parent); >- if (error != 0) { >- device_printf(dev, "could not set tx clk parent\n"); >- return (error); >- } >+ error = clk_get_by_ofw_name(dev, 0, "allwinner_gmac_tx", &clk_tx); >+ if (error != 0) { >+ device_printf(dev, "could not get tx clk\n"); >+ return (error); >+ } >+ error = clk_get_by_name(dev, tx_parent_name, &clk_tx_parent); >+ if (error != 0) { >+ device_printf(dev, "could not get clock '%s'\n", >+ tx_parent_name); >+ return (error); >+ } >+ error = clk_set_parent_by_clk(clk_tx, clk_tx_parent); >+ if (error != 0) { >+ device_printf(dev, "could not set tx clk parent\n"); >+ return (error); > } > > /* Enable PHY regulator if applicable */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 261355
:
233862
| 233863