aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyril Chemparathy <cyril@ti.com>2010-09-15 10:11:22 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2010-09-24 10:40:29 -0400
commitd22960c8bbb8f685c2d8c4051e1f335ab13dca24 (patch)
tree7e0dd3bc31197293ef242180100f5c7093e3fbb0
parentf20136eb03a1dbdfb04f3c62fd11c0d02d02b726 (diff)
davinci: add mdio platform devices
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>
-rw-r--r--arch/arm/mach-davinci/devices-da8xx.c29
-rw-r--r--arch/arm/mach-davinci/dm365.c22
-rw-r--r--arch/arm/mach-davinci/dm644x.c22
-rw-r--r--arch/arm/mach-davinci/dm646x.c21
-rw-r--r--arch/arm/mach-davinci/include/mach/dm365.h1
-rw-r--r--arch/arm/mach-davinci/include/mach/dm644x.h1
-rw-r--r--arch/arm/mach-davinci/include/mach/dm646x.h1
7 files changed, 92 insertions, 5 deletions
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index caeb7f4a3a6d..9039221649d4 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -352,7 +352,7 @@ int __init da8xx_register_watchdog(void)
352static struct resource da8xx_emac_resources[] = { 352static struct resource da8xx_emac_resources[] = {
353 { 353 {
354 .start = DA8XX_EMAC_CPPI_PORT_BASE, 354 .start = DA8XX_EMAC_CPPI_PORT_BASE,
355 .end = DA8XX_EMAC_CPPI_PORT_BASE + 0x5000 - 1, 355 .end = DA8XX_EMAC_CPPI_PORT_BASE + SZ_16K - 1,
356 .flags = IORESOURCE_MEM, 356 .flags = IORESOURCE_MEM,
357 }, 357 },
358 { 358 {
@@ -396,9 +396,34 @@ static struct platform_device da8xx_emac_device = {
396 .resource = da8xx_emac_resources, 396 .resource = da8xx_emac_resources,
397}; 397};
398 398
399static struct resource da8xx_mdio_resources[] = {
400 {
401 .start = DA8XX_EMAC_MDIO_BASE,
402 .end = DA8XX_EMAC_MDIO_BASE + SZ_4K - 1,
403 .flags = IORESOURCE_MEM,
404 },
405};
406
407static struct platform_device da8xx_mdio_device = {
408 .name = "davinci_mdio",
409 .id = 0,
410 .num_resources = ARRAY_SIZE(da8xx_mdio_resources),
411 .resource = da8xx_mdio_resources,
412};
413
399int __init da8xx_register_emac(void) 414int __init da8xx_register_emac(void)
400{ 415{
401 return platform_device_register(&da8xx_emac_device); 416 int ret;
417
418 ret = platform_device_register(&da8xx_mdio_device);
419 if (ret < 0)
420 return ret;
421 ret = platform_device_register(&da8xx_emac_device);
422 if (ret < 0)
423 return ret;
424 ret = clk_add_alias(NULL, dev_name(&da8xx_mdio_device.dev),
425 NULL, &da8xx_emac_device.dev);
426 return ret;
402} 427}
403 428
404static struct resource da830_mcasp1_resources[] = { 429static struct resource da830_mcasp1_resources[] = {
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 6b6f4c643709..71f0f9d5c56a 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -699,7 +699,7 @@ static struct emac_platform_data dm365_emac_pdata = {
699static struct resource dm365_emac_resources[] = { 699static struct resource dm365_emac_resources[] = {
700 { 700 {
701 .start = DM365_EMAC_BASE, 701 .start = DM365_EMAC_BASE,
702 .end = DM365_EMAC_BASE + 0x47ff, 702 .end = DM365_EMAC_BASE + SZ_16K - 1,
703 .flags = IORESOURCE_MEM, 703 .flags = IORESOURCE_MEM,
704 }, 704 },
705 { 705 {
@@ -734,6 +734,21 @@ static struct platform_device dm365_emac_device = {
734 .resource = dm365_emac_resources, 734 .resource = dm365_emac_resources,
735}; 735};
736 736
737static struct resource dm365_mdio_resources[] = {
738 {
739 .start = DM365_EMAC_MDIO_BASE,
740 .end = DM365_EMAC_MDIO_BASE + SZ_4K - 1,
741 .flags = IORESOURCE_MEM,
742 },
743};
744
745static struct platform_device dm365_mdio_device = {
746 .name = "davinci_mdio",
747 .id = 0,
748 .num_resources = ARRAY_SIZE(dm365_mdio_resources),
749 .resource = dm365_mdio_resources,
750};
751
737static u8 dm365_default_priorities[DAVINCI_N_AINTC_IRQ] = { 752static u8 dm365_default_priorities[DAVINCI_N_AINTC_IRQ] = {
738 [IRQ_VDINT0] = 2, 753 [IRQ_VDINT0] = 2,
739 [IRQ_VDINT1] = 6, 754 [IRQ_VDINT1] = 6,
@@ -1220,7 +1235,12 @@ static int __init dm365_init_devices(void)
1220 1235
1221 davinci_cfg_reg(DM365_INT_EDMA_CC); 1236 davinci_cfg_reg(DM365_INT_EDMA_CC);
1222 platform_device_register(&dm365_edma_device); 1237 platform_device_register(&dm365_edma_device);
1238
1239 platform_device_register(&dm365_mdio_device);
1223 platform_device_register(&dm365_emac_device); 1240 platform_device_register(&dm365_emac_device);
1241 clk_add_alias(NULL, dev_name(&dm365_mdio_device.dev),
1242 NULL, &dm365_emac_device.dev);
1243
1224 /* Add isif clock alias */ 1244 /* Add isif clock alias */
1225 clk_add_alias("master", dm365_isif_dev.name, "vpss_master", NULL); 1245 clk_add_alias("master", dm365_isif_dev.name, "vpss_master", NULL);
1226 platform_device_register(&dm365_vpss_device); 1246 platform_device_register(&dm365_vpss_device);
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 40fec315c99a..c103b2c8caff 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -330,7 +330,7 @@ static struct emac_platform_data dm644x_emac_pdata = {
330static struct resource dm644x_emac_resources[] = { 330static struct resource dm644x_emac_resources[] = {
331 { 331 {
332 .start = DM644X_EMAC_BASE, 332 .start = DM644X_EMAC_BASE,
333 .end = DM644X_EMAC_BASE + 0x47ff, 333 .end = DM644X_EMAC_BASE + SZ_16K - 1,
334 .flags = IORESOURCE_MEM, 334 .flags = IORESOURCE_MEM,
335 }, 335 },
336 { 336 {
@@ -350,6 +350,21 @@ static struct platform_device dm644x_emac_device = {
350 .resource = dm644x_emac_resources, 350 .resource = dm644x_emac_resources,
351}; 351};
352 352
353static struct resource dm644x_mdio_resources[] = {
354 {
355 .start = DM644X_EMAC_MDIO_BASE,
356 .end = DM644X_EMAC_MDIO_BASE + SZ_4K - 1,
357 .flags = IORESOURCE_MEM,
358 },
359};
360
361static struct platform_device dm644x_mdio_device = {
362 .name = "davinci_mdio",
363 .id = 0,
364 .num_resources = ARRAY_SIZE(dm644x_mdio_resources),
365 .resource = dm644x_mdio_resources,
366};
367
353/* 368/*
354 * Device specific mux setup 369 * Device specific mux setup
355 * 370 *
@@ -777,7 +792,12 @@ static int __init dm644x_init_devices(void)
777 clk_add_alias("master", dm644x_ccdc_dev.name, "vpss_master", NULL); 792 clk_add_alias("master", dm644x_ccdc_dev.name, "vpss_master", NULL);
778 clk_add_alias("slave", dm644x_ccdc_dev.name, "vpss_slave", NULL); 793 clk_add_alias("slave", dm644x_ccdc_dev.name, "vpss_slave", NULL);
779 platform_device_register(&dm644x_edma_device); 794 platform_device_register(&dm644x_edma_device);
795
796 platform_device_register(&dm644x_mdio_device);
780 platform_device_register(&dm644x_emac_device); 797 platform_device_register(&dm644x_emac_device);
798 clk_add_alias(NULL, dev_name(&dm644x_mdio_device.dev),
799 NULL, &dm644x_emac_device.dev);
800
781 platform_device_register(&dm644x_vpss_device); 801 platform_device_register(&dm644x_vpss_device);
782 platform_device_register(&dm644x_ccdc_dev); 802 platform_device_register(&dm644x_ccdc_dev);
783 platform_device_register(&vpfe_capture_dev); 803 platform_device_register(&vpfe_capture_dev);
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index e4a3df1872ac..8da886bc6df5 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -366,7 +366,7 @@ static struct emac_platform_data dm646x_emac_pdata = {
366static struct resource dm646x_emac_resources[] = { 366static struct resource dm646x_emac_resources[] = {
367 { 367 {
368 .start = DM646X_EMAC_BASE, 368 .start = DM646X_EMAC_BASE,
369 .end = DM646X_EMAC_BASE + 0x47ff, 369 .end = DM646X_EMAC_BASE + SZ_16K - 1,
370 .flags = IORESOURCE_MEM, 370 .flags = IORESOURCE_MEM,
371 }, 371 },
372 { 372 {
@@ -401,6 +401,21 @@ static struct platform_device dm646x_emac_device = {
401 .resource = dm646x_emac_resources, 401 .resource = dm646x_emac_resources,
402}; 402};
403 403
404static struct resource dm646x_mdio_resources[] = {
405 {
406 .start = DM646X_EMAC_MDIO_BASE,
407 .end = DM646X_EMAC_MDIO_BASE + SZ_4K - 1,
408 .flags = IORESOURCE_MEM,
409 },
410};
411
412static struct platform_device dm646x_mdio_device = {
413 .name = "davinci_mdio",
414 .id = 0,
415 .num_resources = ARRAY_SIZE(dm646x_mdio_resources),
416 .resource = dm646x_mdio_resources,
417};
418
404/* 419/*
405 * Device specific mux setup 420 * Device specific mux setup
406 * 421 *
@@ -897,7 +912,11 @@ static int __init dm646x_init_devices(void)
897 if (!cpu_is_davinci_dm646x()) 912 if (!cpu_is_davinci_dm646x())
898 return 0; 913 return 0;
899 914
915 platform_device_register(&dm646x_mdio_device);
900 platform_device_register(&dm646x_emac_device); 916 platform_device_register(&dm646x_emac_device);
917 clk_add_alias(NULL, dev_name(&dm646x_mdio_device.dev),
918 NULL, &dm646x_emac_device.dev);
919
901 return 0; 920 return 0;
902} 921}
903postcore_initcall(dm646x_init_devices); 922postcore_initcall(dm646x_init_devices);
diff --git a/arch/arm/mach-davinci/include/mach/dm365.h b/arch/arm/mach-davinci/include/mach/dm365.h
index ea5df3b49ec4..dbb5052b6c85 100644
--- a/arch/arm/mach-davinci/include/mach/dm365.h
+++ b/arch/arm/mach-davinci/include/mach/dm365.h
@@ -21,6 +21,7 @@
21#include <media/davinci/vpfe_capture.h> 21#include <media/davinci/vpfe_capture.h>
22 22
23#define DM365_EMAC_BASE (0x01D07000) 23#define DM365_EMAC_BASE (0x01D07000)
24#define DM365_EMAC_MDIO_BASE (DM365_EMAC_BASE + 0x4000)
24#define DM365_EMAC_CNTRL_OFFSET (0x0000) 25#define DM365_EMAC_CNTRL_OFFSET (0x0000)
25#define DM365_EMAC_CNTRL_MOD_OFFSET (0x3000) 26#define DM365_EMAC_CNTRL_MOD_OFFSET (0x3000)
26#define DM365_EMAC_CNTRL_RAM_OFFSET (0x1000) 27#define DM365_EMAC_CNTRL_RAM_OFFSET (0x1000)
diff --git a/arch/arm/mach-davinci/include/mach/dm644x.h b/arch/arm/mach-davinci/include/mach/dm644x.h
index 6fca568a0fd2..515911711a29 100644
--- a/arch/arm/mach-davinci/include/mach/dm644x.h
+++ b/arch/arm/mach-davinci/include/mach/dm644x.h
@@ -28,6 +28,7 @@
28#include <media/davinci/vpfe_capture.h> 28#include <media/davinci/vpfe_capture.h>
29 29
30#define DM644X_EMAC_BASE (0x01C80000) 30#define DM644X_EMAC_BASE (0x01C80000)
31#define DM644X_EMAC_MDIO_BASE (DM644X_EMAC_BASE + 0x4000)
31#define DM644X_EMAC_CNTRL_OFFSET (0x0000) 32#define DM644X_EMAC_CNTRL_OFFSET (0x0000)
32#define DM644X_EMAC_CNTRL_MOD_OFFSET (0x1000) 33#define DM644X_EMAC_CNTRL_MOD_OFFSET (0x1000)
33#define DM644X_EMAC_CNTRL_RAM_OFFSET (0x2000) 34#define DM644X_EMAC_CNTRL_RAM_OFFSET (0x2000)
diff --git a/arch/arm/mach-davinci/include/mach/dm646x.h b/arch/arm/mach-davinci/include/mach/dm646x.h
index 0a27ee9a70e1..1c4dca924ac0 100644
--- a/arch/arm/mach-davinci/include/mach/dm646x.h
+++ b/arch/arm/mach-davinci/include/mach/dm646x.h
@@ -19,6 +19,7 @@
19#include <linux/davinci_emac.h> 19#include <linux/davinci_emac.h>
20 20
21#define DM646X_EMAC_BASE (0x01C80000) 21#define DM646X_EMAC_BASE (0x01C80000)
22#define DM646X_EMAC_MDIO_BASE (DM646X_EMAC_BASE + 0x4000)
22#define DM646X_EMAC_CNTRL_OFFSET (0x0000) 23#define DM646X_EMAC_CNTRL_OFFSET (0x0000)
23#define DM646X_EMAC_CNTRL_MOD_OFFSET (0x1000) 24#define DM646X_EMAC_CNTRL_MOD_OFFSET (0x1000)
24#define DM646X_EMAC_CNTRL_RAM_OFFSET (0x2000) 25#define DM646X_EMAC_CNTRL_RAM_OFFSET (0x2000)