atheros[ar231x-eth]: pass PHY I/O memory via device resources
[15.05/openwrt.git] / target / linux / atheros / patches-3.10 / 100-board.patch
index b9a88a1..4fdf435 100644 (file)
 +}
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar231x_platform.h
-@@ -0,0 +1,84 @@
+@@ -0,0 +1,83 @@
 +#ifndef __AR531X_PLATFORM_H
 +#define __AR531X_PLATFORM_H
 +
 +      void (*reset_clear)(u32);
 +      u32 reset_mac;
 +      u32 reset_phy;
-+      u32 phy_base;
 +      struct ar231x_board_config *config;
 +      char *macaddr;
 +};
 +#endif /* __ASM_MIPS_MACH_ATHEROS_WAR_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar2315_regs.h
-@@ -0,0 +1,614 @@
+@@ -0,0 +1,617 @@
 +/*
 + * Register definitions for AR2315+
 + *
 +#define AR2315_SPI_MMR          0x11300000      /* SPI FLASH MMR */
 +#define AR2315_PCIEXT           0x80000000      /* pci external */
 +
++/* MII registers offset inside Ethernet MMR region */
++#define AR2315_ENET0_MII      (AR2315_ENET0 + 0x14)
++
 +/*
 + * Reset Register
 + */
 +#endif /* __AR2315_REG_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar5312_regs.h
-@@ -0,0 +1,249 @@
+@@ -0,0 +1,253 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
 +#define AR5212_AR5312_REV7      0x0057          /* AR5312 WMAC (AP30-040) */
 +#define AR5212_AR2313_REV8      0x0058          /* AR2313 WMAC (AP43-030) */
 +
++/* MII registers offset inside Ethernet MMR region */
++#define AR531X_ENET0_MII      (AR531X_ENET0 + 0x14)
++#define AR531X_ENET1_MII      (AR531X_ENET1 + 0x14)
++
 +/*
 + * AR531X_NUM_WMAC defines the number of Wireless MACs that\
 + * should be considered available.
 +      .reset_clear = ar5312_device_reset_clear,
 +      .reset_mac = AR531X_RESET_ENET0,
 +      .reset_phy = AR531X_RESET_EPHY0,
-+      .phy_base = AR531X_ENET0,
 +      .config = &ar231x_board,
 +};
 +
 +      .reset_clear = ar5312_device_reset_clear,
 +      .reset_mac = AR531X_RESET_ENET1,
 +      .reset_phy = AR531X_RESET_EPHY1,
-+      .phy_base = AR531X_ENET1,
 +      .config = &ar231x_board,
 +};
 +
 +      switch (ar231x_devtype) {
 +      case DEV_TYPE_AR5312:
 +              ar5312_eth0_data.macaddr = config->enet0_mac;
-+              ar231x_add_ethernet(0, AR531X_ENET0, AR5312_IRQ_ENET0_INTRS,
++              ar231x_add_ethernet(0, AR531X_ENET0, "eth0_mii",
++                                  AR531X_ENET0_MII, AR5312_IRQ_ENET0_INTRS,
 +                                  &ar5312_eth0_data);
 +
 +              ar5312_eth1_data.macaddr = config->enet1_mac;
-+              ar231x_add_ethernet(1, AR531X_ENET1, AR5312_IRQ_ENET1_INTRS,
++              ar231x_add_ethernet(1, AR531X_ENET1, "eth1_mii",
++                                  AR531X_ENET1_MII, AR5312_IRQ_ENET1_INTRS,
 +                                  &ar5312_eth1_data);
 +
 +              if (!ar231x_board.radio)
 +       */
 +      case DEV_TYPE_AR2312:
 +      case DEV_TYPE_AR2313:
-+              ar5312_eth1_data.phy_base = ar5312_eth0_data.phy_base;
 +              ar5312_eth1_data.reset_phy = ar5312_eth0_data.reset_phy;
 +              ar5312_eth1_data.macaddr = config->enet0_mac;
-+              ar231x_add_ethernet(0, AR531X_ENET1,
-+                      AR5312_IRQ_ENET1_INTRS, &ar5312_eth1_data);
++              ar231x_add_ethernet(1, AR531X_ENET1, "eth0_mii",
++                                  AR531X_ENET0_MII, AR5312_IRQ_ENET1_INTRS,
++                                  &ar5312_eth1_data);
 +
 +              if (!ar231x_board.radio)
 +                      return 0;
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar2315.c
-@@ -0,0 +1,557 @@
+@@ -0,0 +1,556 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
 +      .reset_clear = ar2315_device_reset_clear,
 +      .reset_mac = AR2315_RESET_ENET0,
 +      .reset_phy = AR2315_RESET_EPHY0,
-+      .phy_base = AR2315_ENET0,
 +      .config = &ar231x_board,
 +};
 +
 +      ar2315_init_gpio_leds();
 +      platform_device_register(&ar2315_wdt);
 +      platform_device_register(&ar2315_spiflash);
-+      ar231x_add_ethernet(0, AR2315_ENET0, AR2315_IRQ_ENET0_INTRS,
-+                          &ar2315_eth_data);
++      ar231x_add_ethernet(0, AR2315_ENET0, "eth0_mii", AR2315_ENET0_MII,
++                          AR2315_IRQ_ENET0_INTRS, &ar2315_eth_data);
 +      ar231x_add_wmac(0, AR2315_WLAN0, AR2315_IRQ_WLAN0_INTRS);
 +
 +      return 0;
 +#endif
 --- /dev/null
 +++ b/arch/mips/ar231x/devices.h
-@@ -0,0 +1,37 @@
+@@ -0,0 +1,38 @@
 +#ifndef __AR231X_DEVICES_H
 +#define __AR231X_DEVICES_H
 +
 +extern int ar231x_find_config(u8 *flash_limit);
 +extern void ar231x_serial_setup(u32 mapbase, int irq, unsigned int uartclk);
 +extern int ar231x_add_wmac(int nr, u32 base, int irq);
-+extern int ar231x_add_ethernet(int nr, u32 base, int irq, void *pdata);
++extern int ar231x_add_ethernet(int nr, u32 base, const char *mii_name,
++                             u32 mii_base, int irq, void *pdata);
 +
 +static inline bool is_2315(void)
 +{
 +#endif
 --- /dev/null
 +++ b/arch/mips/ar231x/devices.c
-@@ -0,0 +1,168 @@
+@@ -0,0 +1,181 @@
 +#include <linux/kernel.h>
 +#include <linux/init.h>
 +#include <linux/serial.h>
 +              .flags = IORESOURCE_MEM,
 +      },
 +      {
++              .name = "eth0_mii",
++              .flags = IORESOURCE_MEM,
++      },
++      {
 +              .name = "eth0_irq",
 +              .flags = IORESOURCE_IRQ,
 +      }
 +              .flags = IORESOURCE_MEM,
 +      },
 +      {
++              .name = "eth1_mii",
++              .flags = IORESOURCE_MEM,
++      },
++      {
 +              .name = "eth1_irq",
 +              .flags = IORESOURCE_IRQ,
 +      }
 +
 +
 +int __init
-+ar231x_add_ethernet(int nr, u32 base, int irq, void *pdata)
++ar231x_add_ethernet(int nr, u32 base, const char *mii_name, u32 mii_base,
++                  int irq, void *pdata)
 +{
 +      struct resource *res;
 +
 +      res->start = base;
 +      res->end = base + 0x2000 - 1;
 +      res++;
++      res->name = mii_name;
++      res->start = mii_base;
++      res->end = mii_base + 8 - 1;
++      res++;
 +      res->start = irq;
 +      res->end = irq;
 +      return platform_device_register(&ar231x_eth[nr]);