[OpenWrt-Devel] [PATCH 14/17] atheros[ar231x-eth]: pass PHY I/O memory via device resources

Felix Fietkau nbd at openwrt.org
Sat Jul 12 10:37:11 EDT 2014


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 <ryazanov.s.a at gmail.com>

> 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?

- Felix
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list