On 2014-07-12 17:16, Sergey Ryazanov wrote: > 2014-07-12 18:37 GMT+04:00 Felix Fietkau <[email protected]>: >> On 2014-07-12 15:33, Sergey Ryazanov wrote: >>> Pass PHY I/O memory region via platform resources and remap them >>> unconditionally. >>> >>> Signed-off-by: Sergey Ryazanov <[email protected]> >> >>> diff --git a/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch >>> b/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch >>> index 0e158d4..a9dcab2 100644 >>> --- a/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch >>> +++ b/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch >>> @@ -266,17 +266,19 @@ >>> + /** >>> + * When there's only one MAC, PHY regs are typically on ENET0, >>> + * even though the MAC might be on ENET1. >>> -+ * Needto remap PHY regs separately in this case >>> ++ * So remap PHY regs separately. >>> + */ >>> -+ if (ar_eth_base == sp->cfg->phy_base) >>> -+ sp->phy_regs = sp->eth_regs; >>> -+ else { >>> -+ sp->phy_regs = ioremap_nocache(sp->cfg->phy_base, >>> -+ sizeof(*sp->phy_regs)); >>> -+ if (!sp->phy_regs) { >>> -+ printk("Can't remap phy registers\n"); >>> -+ return -ENXIO; >>> -+ } >>> ++ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "eth0_mii"); >>> ++ if (!res) { >>> ++ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, >>> ++ "eth1_mii"); >>> ++ if (!res) >>> ++ return -ENODEV; >> Wouldn't it be better to remove the eth0_/eth1_ prefix from the resource >> names instead of making the driver search for both? >> > Yes, I know this code is ugly, but I can't find better solution and > prefer to keep this one for two reasons. > > First, AR5312 SoC have two ethernet blocks and arch code register > devices for each of them, so we need different names. > > Second reason is nicer /proc/iomem look: > > * for ar2315 based board: > root@OpenWrt:~# cat /proc/iomem | grep eth > 10500000-10501fff : eth0_membase > 10500014-1050001b : eth0_mii > > * for ar2313 based board: > root@OpenWrt:~# cat /proc/iomem | grep eth > 18100014-1810001b : eth0_mii > 18200000-18201fff : eth1_membase Makes sense, thanks for the explanation.
- Felix _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
