Merge branch 'davinci-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[~shefty/rdma-dev.git] / arch / arm / mach-omap2 / board-am3517evm.c
index d547036aff3f2cb640da7905cf75ec8f22f6aff7..e1f8dda62799683c82986dd61a286340c78cca85 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/clk.h>
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
 #include <linux/i2c/pca953x.h>
 
 #include "mux.h"
 
-#define AM35XX_EVM_PHY_MASK            (0xF)
 #define AM35XX_EVM_MDIO_FREQUENCY      (1000000)
 
+static struct mdio_platform_data am3517_evm_mdio_pdata = {
+       .bus_freq       = AM35XX_EVM_MDIO_FREQUENCY,
+};
+
+static struct resource am3517_mdio_resources[] = {
+       {
+               .start  = AM35XX_IPSS_EMAC_BASE + AM35XX_EMAC_MDIO_OFFSET,
+               .end    = AM35XX_IPSS_EMAC_BASE + AM35XX_EMAC_MDIO_OFFSET +
+                         SZ_4K - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device am3517_mdio_device = {
+       .name           = "davinci_mdio",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(am3517_mdio_resources),
+       .resource       = am3517_mdio_resources,
+       .dev.platform_data = &am3517_evm_mdio_pdata,
+};
+
 static struct emac_platform_data am3517_evm_emac_pdata = {
-       .phy_mask       = AM35XX_EVM_PHY_MASK,
-       .mdio_max_freq  = AM35XX_EVM_MDIO_FREQUENCY,
        .rmii_en        = 1,
 };
 
 static struct resource am3517_emac_resources[] = {
        {
                .start  = AM35XX_IPSS_EMAC_BASE,
-               .end    = AM35XX_IPSS_EMAC_BASE + 0x3FFFF,
+               .end    = AM35XX_IPSS_EMAC_BASE + 0x2FFFF,
                .flags  = IORESOURCE_MEM,
        },
        {
@@ -113,7 +132,6 @@ void am3517_evm_ethernet_init(struct emac_platform_data *pdata)
        pdata->ctrl_reg_offset          = AM35XX_EMAC_CNTRL_OFFSET;
        pdata->ctrl_mod_reg_offset      = AM35XX_EMAC_CNTRL_MOD_OFFSET;
        pdata->ctrl_ram_offset          = AM35XX_EMAC_CNTRL_RAM_OFFSET;
-       pdata->mdio_reg_offset          = AM35XX_EMAC_MDIO_OFFSET;
        pdata->ctrl_ram_size            = AM35XX_EMAC_CNTRL_RAM_SIZE;
        pdata->version                  = EMAC_VERSION_2;
        pdata->hw_ram_addr              = AM35XX_EMAC_HW_RAM_ADDR;
@@ -121,6 +139,9 @@ void am3517_evm_ethernet_init(struct emac_platform_data *pdata)
        pdata->interrupt_disable        = am3517_disable_ethernet_int;
        am3517_emac_device.dev.platform_data    = pdata;
        platform_device_register(&am3517_emac_device);
+       platform_device_register(&am3517_mdio_device);
+       clk_add_alias(NULL, dev_name(&am3517_mdio_device.dev),
+                     NULL, &am3517_emac_device.dev);
 
        regval = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
        regval = regval & (~(AM35XX_CPGMACSS_SW_RST));