]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
davinci: add mdio platform devices
authorCyril Chemparathy <cyril@ti.com>
Wed, 15 Sep 2010 14:11:22 +0000 (10:11 -0400)
committerKevin Hilman <khilman@deeprootsystems.com>
Fri, 24 Sep 2010 14:40:29 +0000 (07:40 -0700)
This patch adds mdio platform devices on SoCs that have the necessary
hardware.  Clock lookup entries (aliases) have also been added, so that the
MDIO and EMAC drivers can independently enable/disable a shared underlying
clock.  Further, the EMAC MMR region has been split down into separate MDIO
and EMAC regions.

Signed-off-by: Cyril Chemparathy <cyril@ti.com>
Acked-by: David S. Miller <davem@davemloft.net>
Tested-by: Michael Williamson <michael.williamson@criticallink.com>
Tested-by: Caglar Akyuz <caglarakyuz@gmail.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
arch/arm/mach-davinci/devices-da8xx.c
arch/arm/mach-davinci/dm365.c
arch/arm/mach-davinci/dm644x.c
arch/arm/mach-davinci/dm646x.c
arch/arm/mach-davinci/include/mach/dm365.h
arch/arm/mach-davinci/include/mach/dm644x.h
arch/arm/mach-davinci/include/mach/dm646x.h

index caeb7f4a3a6df717b65cb982c72a41a7f3d09994..9039221649d4d9587cf27c465e0b8786cc2d90a7 100644 (file)
@@ -352,7 +352,7 @@ int __init da8xx_register_watchdog(void)
 static struct resource da8xx_emac_resources[] = {
        {
                .start  = DA8XX_EMAC_CPPI_PORT_BASE,
-               .end    = DA8XX_EMAC_CPPI_PORT_BASE + 0x5000 - 1,
+               .end    = DA8XX_EMAC_CPPI_PORT_BASE + SZ_16K - 1,
                .flags  = IORESOURCE_MEM,
        },
        {
@@ -396,9 +396,34 @@ static struct platform_device da8xx_emac_device = {
        .resource       = da8xx_emac_resources,
 };
 
+static struct resource da8xx_mdio_resources[] = {
+       {
+               .start  = DA8XX_EMAC_MDIO_BASE,
+               .end    = DA8XX_EMAC_MDIO_BASE + SZ_4K - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device da8xx_mdio_device = {
+       .name           = "davinci_mdio",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(da8xx_mdio_resources),
+       .resource       = da8xx_mdio_resources,
+};
+
 int __init da8xx_register_emac(void)
 {
-       return platform_device_register(&da8xx_emac_device);
+       int ret;
+
+       ret = platform_device_register(&da8xx_mdio_device);
+       if (ret < 0)
+               return ret;
+       ret = platform_device_register(&da8xx_emac_device);
+       if (ret < 0)
+               return ret;
+       ret = clk_add_alias(NULL, dev_name(&da8xx_mdio_device.dev),
+                           NULL, &da8xx_emac_device.dev);
+       return ret;
 }
 
 static struct resource da830_mcasp1_resources[] = {
index 6b6f4c643709c7d14a4b2baf168464ad772be4ce..71f0f9d5c56a38c36a5ba079a907cb6a66099350 100644 (file)
@@ -699,7 +699,7 @@ static struct emac_platform_data dm365_emac_pdata = {
 static struct resource dm365_emac_resources[] = {
        {
                .start  = DM365_EMAC_BASE,
-               .end    = DM365_EMAC_BASE + 0x47ff,
+               .end    = DM365_EMAC_BASE + SZ_16K - 1,
                .flags  = IORESOURCE_MEM,
        },
        {
@@ -734,6 +734,21 @@ static struct platform_device dm365_emac_device = {
        .resource       = dm365_emac_resources,
 };
 
+static struct resource dm365_mdio_resources[] = {
+       {
+               .start  = DM365_EMAC_MDIO_BASE,
+               .end    = DM365_EMAC_MDIO_BASE + SZ_4K - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device dm365_mdio_device = {
+       .name           = "davinci_mdio",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(dm365_mdio_resources),
+       .resource       = dm365_mdio_resources,
+};
+
 static u8 dm365_default_priorities[DAVINCI_N_AINTC_IRQ] = {
        [IRQ_VDINT0]                    = 2,
        [IRQ_VDINT1]                    = 6,
@@ -1220,7 +1235,12 @@ static int __init dm365_init_devices(void)
 
        davinci_cfg_reg(DM365_INT_EDMA_CC);
        platform_device_register(&dm365_edma_device);
+
+       platform_device_register(&dm365_mdio_device);
        platform_device_register(&dm365_emac_device);
+       clk_add_alias(NULL, dev_name(&dm365_mdio_device.dev),
+                     NULL, &dm365_emac_device.dev);
+
        /* Add isif clock alias */
        clk_add_alias("master", dm365_isif_dev.name, "vpss_master", NULL);
        platform_device_register(&dm365_vpss_device);
index 40fec315c99a192826d7530d43c6406726ecbcff..c103b2c8caff28ad4cc7cc2012a10bd9d19aa9a7 100644 (file)
@@ -330,7 +330,7 @@ static struct emac_platform_data dm644x_emac_pdata = {
 static struct resource dm644x_emac_resources[] = {
        {
                .start  = DM644X_EMAC_BASE,
-               .end    = DM644X_EMAC_BASE + 0x47ff,
+               .end    = DM644X_EMAC_BASE + SZ_16K - 1,
                .flags  = IORESOURCE_MEM,
        },
        {
@@ -350,6 +350,21 @@ static struct platform_device dm644x_emac_device = {
        .resource       = dm644x_emac_resources,
 };
 
+static struct resource dm644x_mdio_resources[] = {
+       {
+               .start  = DM644X_EMAC_MDIO_BASE,
+               .end    = DM644X_EMAC_MDIO_BASE + SZ_4K - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device dm644x_mdio_device = {
+       .name           = "davinci_mdio",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(dm644x_mdio_resources),
+       .resource       = dm644x_mdio_resources,
+};
+
 /*
  * Device specific mux setup
  *
@@ -777,7 +792,12 @@ static int __init dm644x_init_devices(void)
        clk_add_alias("master", dm644x_ccdc_dev.name, "vpss_master", NULL);
        clk_add_alias("slave", dm644x_ccdc_dev.name, "vpss_slave", NULL);
        platform_device_register(&dm644x_edma_device);
+
+       platform_device_register(&dm644x_mdio_device);
        platform_device_register(&dm644x_emac_device);
+       clk_add_alias(NULL, dev_name(&dm644x_mdio_device.dev),
+                     NULL, &dm644x_emac_device.dev);
+
        platform_device_register(&dm644x_vpss_device);
        platform_device_register(&dm644x_ccdc_dev);
        platform_device_register(&vpfe_capture_dev);
index e4a3df1872aca89404899034ebbe920d453e7f66..8da886bc6df5fd86ae72b0e8a8d7af7e07d3e5b2 100644 (file)
@@ -366,7 +366,7 @@ static struct emac_platform_data dm646x_emac_pdata = {
 static struct resource dm646x_emac_resources[] = {
        {
                .start  = DM646X_EMAC_BASE,
-               .end    = DM646X_EMAC_BASE + 0x47ff,
+               .end    = DM646X_EMAC_BASE + SZ_16K - 1,
                .flags  = IORESOURCE_MEM,
        },
        {
@@ -401,6 +401,21 @@ static struct platform_device dm646x_emac_device = {
        .resource       = dm646x_emac_resources,
 };
 
+static struct resource dm646x_mdio_resources[] = {
+       {
+               .start  = DM646X_EMAC_MDIO_BASE,
+               .end    = DM646X_EMAC_MDIO_BASE + SZ_4K - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device dm646x_mdio_device = {
+       .name           = "davinci_mdio",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(dm646x_mdio_resources),
+       .resource       = dm646x_mdio_resources,
+};
+
 /*
  * Device specific mux setup
  *
@@ -897,7 +912,11 @@ static int __init dm646x_init_devices(void)
        if (!cpu_is_davinci_dm646x())
                return 0;
 
+       platform_device_register(&dm646x_mdio_device);
        platform_device_register(&dm646x_emac_device);
+       clk_add_alias(NULL, dev_name(&dm646x_mdio_device.dev),
+                     NULL, &dm646x_emac_device.dev);
+
        return 0;
 }
 postcore_initcall(dm646x_init_devices);
index ea5df3b49ec4ec1f936ee2acd9be6c0776dd494d..dbb5052b6c85f796071e4178359c622a21c48e31 100644 (file)
@@ -21,6 +21,7 @@
 #include <media/davinci/vpfe_capture.h>
 
 #define DM365_EMAC_BASE                        (0x01D07000)
+#define DM365_EMAC_MDIO_BASE           (DM365_EMAC_BASE + 0x4000)
 #define DM365_EMAC_CNTRL_OFFSET                (0x0000)
 #define DM365_EMAC_CNTRL_MOD_OFFSET    (0x3000)
 #define DM365_EMAC_CNTRL_RAM_OFFSET    (0x1000)
index 6fca568a0fd25c2e01a86f9416b337f3e1ac1f6c..515911711a29bffbf8b43e6ce67ec16e75f922c6 100644 (file)
@@ -28,6 +28,7 @@
 #include <media/davinci/vpfe_capture.h>
 
 #define DM644X_EMAC_BASE               (0x01C80000)
+#define DM644X_EMAC_MDIO_BASE          (DM644X_EMAC_BASE + 0x4000)
 #define DM644X_EMAC_CNTRL_OFFSET       (0x0000)
 #define DM644X_EMAC_CNTRL_MOD_OFFSET   (0x1000)
 #define DM644X_EMAC_CNTRL_RAM_OFFSET   (0x2000)
index 0a27ee9a70e1de39448898da62090eb981096e11..1c4dca924ac0b8d2b55570255c505e8df082f742 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/davinci_emac.h>
 
 #define DM646X_EMAC_BASE               (0x01C80000)
+#define DM646X_EMAC_MDIO_BASE          (DM646X_EMAC_BASE + 0x4000)
 #define DM646X_EMAC_CNTRL_OFFSET       (0x0000)
 #define DM646X_EMAC_CNTRL_MOD_OFFSET   (0x1000)
 #define DM646X_EMAC_CNTRL_RAM_OFFSET   (0x2000)