aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorMark A. Greer <mgreer@mvista.com>2009-04-15 15:40:56 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2009-05-28 18:17:45 -0400
commit972412b648dcf0c4303dca7e515d5c24ce3cd1d5 (patch)
tree2531253bcc50ef71665405ad1aa0f8f2f035f41f /arch/arm
parent65e866a9741126c678e6dcd5d4fa8c9eca18e945 (diff)
davinci: Move emac platform_data to SoC-specific files
Since most of the emac platform_data is really SoC specific and not board specific, move it to the SoC-specific files. Put a pointer to the platform_data in the soc_info structure so the board-specific code can set some of the platform_data if it needs to. Signed-off-by: Mark A. Greer <mgreer@mvista.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-davinci/board-dm644x-evm.c14
-rw-r--r--arch/arm/mach-davinci/board-dm646x-evm.c15
-rw-r--r--arch/arm/mach-davinci/board-sffsdr.c6
-rw-r--r--arch/arm/mach-davinci/devices.c5
-rw-r--r--arch/arm/mach-davinci/dm644x.c34
-rw-r--r--arch/arm/mach-davinci/dm646x.c36
-rw-r--r--arch/arm/mach-davinci/include/mach/common.h1
-rw-r--r--arch/arm/mach-davinci/include/mach/dm644x.h1
-rw-r--r--arch/arm/mach-davinci/include/mach/dm646x.h1
9 files changed, 46 insertions, 67 deletions
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index cfe89c409735..987d27fcacb0 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -38,7 +38,6 @@
38 38
39#include <mach/dm644x.h> 39#include <mach/dm644x.h>
40#include <mach/common.h> 40#include <mach/common.h>
41#include <mach/emac.h>
42#include <mach/i2c.h> 41#include <mach/i2c.h>
43#include <mach/serial.h> 42#include <mach/serial.h>
44#include <mach/mux.h> 43#include <mach/mux.h>
@@ -61,11 +60,6 @@
61#define LXT971_PHY_ID (0x001378e2) 60#define LXT971_PHY_ID (0x001378e2)
62#define LXT971_PHY_MASK (0xfffffff0) 61#define LXT971_PHY_MASK (0xfffffff0)
63 62
64static struct emac_platform_data dm644x_evm_emac_pdata = {
65 .phy_mask = DM644X_EVM_PHY_MASK,
66 .mdio_max_freq = DM644X_EVM_MDIO_FREQUENCY,
67};
68
69static struct mtd_partition davinci_evm_norflash_partitions[] = { 63static struct mtd_partition davinci_evm_norflash_partitions[] = {
70 /* bootloader (UBL, U-Boot, etc) in first 5 sectors */ 64 /* bootloader (UBL, U-Boot, etc) in first 5 sectors */
71 { 65 {
@@ -448,6 +442,7 @@ static struct memory_accessor *at24_mem_acc;
448static void at24_setup(struct memory_accessor *mem_acc, void *context) 442static void at24_setup(struct memory_accessor *mem_acc, void *context)
449{ 443{
450 char mac_addr[ETH_ALEN]; 444 char mac_addr[ETH_ALEN];
445 struct davinci_soc_info *soc_info = &davinci_soc_info;
451 446
452 at24_mem_acc = mem_acc; 447 at24_mem_acc = mem_acc;
453 448
@@ -455,7 +450,7 @@ static void at24_setup(struct memory_accessor *mem_acc, void *context)
455 if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x7f00, ETH_ALEN) == 450 if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x7f00, ETH_ALEN) ==
456 ETH_ALEN) { 451 ETH_ALEN) {
457 printk(KERN_INFO "Read MAC addr from EEPROM: %pM\n", mac_addr); 452 printk(KERN_INFO "Read MAC addr from EEPROM: %pM\n", mac_addr);
458 memcpy(dm644x_evm_emac_pdata.mac_addr, mac_addr, ETH_ALEN); 453 memcpy(soc_info->emac_pdata->mac_addr, mac_addr, ETH_ALEN);
459 } 454 }
460} 455}
461 456
@@ -650,6 +645,7 @@ static int davinci_phy_fixup(struct phy_device *phydev)
650static __init void davinci_evm_init(void) 645static __init void davinci_evm_init(void)
651{ 646{
652 struct clk *aemif_clk; 647 struct clk *aemif_clk;
648 struct davinci_soc_info *soc_info = &davinci_soc_info;
653 649
654 aemif_clk = clk_get(NULL, "aemif"); 650 aemif_clk = clk_get(NULL, "aemif");
655 clk_enable(aemif_clk); 651 clk_enable(aemif_clk);
@@ -686,7 +682,9 @@ static __init void davinci_evm_init(void)
686 682
687 davinci_serial_init(&uart_config); 683 davinci_serial_init(&uart_config);
688 684
689 dm644x_init_emac(&dm644x_evm_emac_pdata); 685 soc_info->emac_pdata->phy_mask = DM644X_EVM_PHY_MASK;
686 soc_info->emac_pdata->mdio_max_freq = DM644X_EVM_MDIO_FREQUENCY;
687 dm644x_init_emac(soc_info->emac_pdata);
690 688
691 /* Register the fixup for PHY on DaVinci */ 689 /* Register the fixup for PHY on DaVinci */
692 phy_register_fixup_for_uid(LXT971_PHY_ID, LXT971_PHY_MASK, 690 phy_register_fixup_for_uid(LXT971_PHY_ID, LXT971_PHY_MASK,
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index becae51d6dd1..0de0637aed5e 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -52,11 +52,6 @@
52#define DM646X_EVM_PHY_MASK (0x2) 52#define DM646X_EVM_PHY_MASK (0x2)
53#define DM646X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */ 53#define DM646X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */
54 54
55static struct emac_platform_data dm646x_evm_emac_pdata = {
56 .phy_mask = DM646X_EVM_PHY_MASK,
57 .mdio_max_freq = DM646X_EVM_MDIO_FREQUENCY,
58};
59
60static struct davinci_uart_config uart_config __initdata = { 55static struct davinci_uart_config uart_config __initdata = {
61 .enabled_uarts = (1 << 0), 56 .enabled_uarts = (1 << 0),
62}; 57};
@@ -208,6 +203,7 @@ static struct memory_accessor *at24_mem_acc;
208static void at24_setup(struct memory_accessor *mem_acc, void *context) 203static void at24_setup(struct memory_accessor *mem_acc, void *context)
209{ 204{
210 char mac_addr[ETH_ALEN]; 205 char mac_addr[ETH_ALEN];
206 struct davinci_soc_info *soc_info = &davinci_soc_info;
211 207
212 at24_mem_acc = mem_acc; 208 at24_mem_acc = mem_acc;
213 209
@@ -215,7 +211,7 @@ static void at24_setup(struct memory_accessor *mem_acc, void *context)
215 if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x7f00, ETH_ALEN) == 211 if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x7f00, ETH_ALEN) ==
216 ETH_ALEN) { 212 ETH_ALEN) {
217 pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr); 213 pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr);
218 memcpy(dm646x_evm_emac_pdata.mac_addr, mac_addr, ETH_ALEN); 214 memcpy(soc_info->emac_pdata->mac_addr, mac_addr, ETH_ALEN);
219 } 215 }
220} 216}
221 217
@@ -271,9 +267,14 @@ static void __init davinci_map_io(void)
271 267
272static __init void evm_init(void) 268static __init void evm_init(void)
273{ 269{
270 struct davinci_soc_info *soc_info = &davinci_soc_info;
271
274 evm_init_i2c(); 272 evm_init_i2c();
275 davinci_serial_init(&uart_config); 273 davinci_serial_init(&uart_config);
276 dm646x_init_emac(&dm646x_evm_emac_pdata); 274
275 soc_info->emac_pdata->phy_mask = DM646X_EVM_PHY_MASK;
276 soc_info->emac_pdata->mdio_max_freq = DM646X_EVM_MDIO_FREQUENCY;
277 dm646x_init_emac(soc_info->emac_pdata);
277} 278}
278 279
279static __init void davinci_dm646x_evm_irq_init(void) 280static __init void davinci_dm646x_evm_irq_init(void)
diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c
index 938b4467809e..748a8e48541e 100644
--- a/arch/arm/mach-davinci/board-sffsdr.c
+++ b/arch/arm/mach-davinci/board-sffsdr.c
@@ -48,7 +48,6 @@
48 48
49#include <mach/dm644x.h> 49#include <mach/dm644x.h>
50#include <mach/common.h> 50#include <mach/common.h>
51#include <mach/emac.h>
52#include <mach/i2c.h> 51#include <mach/i2c.h>
53#include <mach/serial.h> 52#include <mach/serial.h>
54#include <mach/psc.h> 53#include <mach/psc.h>
@@ -158,11 +157,14 @@ static void __init davinci_sffsdr_map_io(void)
158 157
159static __init void davinci_sffsdr_init(void) 158static __init void davinci_sffsdr_init(void)
160{ 159{
160 struct davinci_soc_info *soc_info = &davinci_soc_info;
161
161 platform_add_devices(davinci_sffsdr_devices, 162 platform_add_devices(davinci_sffsdr_devices,
162 ARRAY_SIZE(davinci_sffsdr_devices)); 163 ARRAY_SIZE(davinci_sffsdr_devices));
163 sffsdr_init_i2c(); 164 sffsdr_init_i2c();
164 davinci_serial_init(&uart_config); 165 davinci_serial_init(&uart_config);
165 dm644x_init_emac(&sffsdr_emac_pdata); 166 soc_info->emac_pdata->phy_mask = SFFSDR_PHY_MASK;
167 soc_info->emac_pdata->mdio_max_freq = SFFSDR_MDIO_FREQUENCY;
166 setup_usb(0, 0); /* We support only peripheral mode. */ 168 setup_usb(0, 0); /* We support only peripheral mode. */
167 169
168 /* mux VLYNQ pins */ 170 /* mux VLYNQ pins */
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c
index 7ebf6713f6a2..c0195cd3a2cd 100644
--- a/arch/arm/mach-davinci/devices.c
+++ b/arch/arm/mach-davinci/devices.c
@@ -260,11 +260,6 @@ void davinci_init_emac(struct emac_platform_data *pdata)
260{ 260{
261 DECLARE_MAC_BUF(buf); 261 DECLARE_MAC_BUF(buf);
262 262
263 if (cpu_is_davinci_dm644x())
264 dm644x_init_emac(pdata);
265 else if (cpu_is_davinci_dm646x())
266 dm646x_init_emac(pdata);
267
268 /* if valid MAC exists, don't re-register */ 263 /* if valid MAC exists, don't re-register */
269 if (is_valid_ether_addr(pdata->mac_addr)) 264 if (is_valid_ether_addr(pdata->mac_addr))
270 return; 265 return;
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index a5629864d029..3844fc34cbb5 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -319,7 +319,14 @@ struct davinci_clk dm644x_clks[] = {
319 CLK(NULL, NULL, NULL), 319 CLK(NULL, NULL, NULL),
320}; 320};
321 321
322#if defined(CONFIG_TI_DAVINCI_EMAC) || defined(CONFIG_TI_DAVINCI_EMAC_MODULE) 322static struct emac_platform_data dm644x_emac_pdata = {
323 .ctrl_reg_offset = DM644X_EMAC_CNTRL_OFFSET,
324 .ctrl_mod_reg_offset = DM644X_EMAC_CNTRL_MOD_OFFSET,
325 .ctrl_ram_offset = DM644X_EMAC_CNTRL_RAM_OFFSET,
326 .mdio_reg_offset = DM644X_EMAC_MDIO_OFFSET,
327 .ctrl_ram_size = DM644X_EMAC_CNTRL_RAM_SIZE,
328 .version = EMAC_VERSION_1,
329};
323 330
324static struct resource dm644x_emac_resources[] = { 331static struct resource dm644x_emac_resources[] = {
325 { 332 {
@@ -337,12 +344,13 @@ static struct resource dm644x_emac_resources[] = {
337static struct platform_device dm644x_emac_device = { 344static struct platform_device dm644x_emac_device = {
338 .name = "davinci_emac", 345 .name = "davinci_emac",
339 .id = 1, 346 .id = 1,
347 .dev = {
348 .platform_data = &dm644x_emac_pdata,
349 },
340 .num_resources = ARRAY_SIZE(dm644x_emac_resources), 350 .num_resources = ARRAY_SIZE(dm644x_emac_resources),
341 .resource = dm644x_emac_resources, 351 .resource = dm644x_emac_resources,
342}; 352};
343 353
344#endif
345
346/* 354/*
347 * Device specific mux setup 355 * Device specific mux setup
348 * 356 *
@@ -520,24 +528,6 @@ static struct platform_device dm644x_edma_device = {
520}; 528};
521 529
522/*----------------------------------------------------------------------*/ 530/*----------------------------------------------------------------------*/
523#if defined(CONFIG_TI_DAVINCI_EMAC) || defined(CONFIG_TI_DAVINCI_EMAC_MODULE)
524
525void dm644x_init_emac(struct emac_platform_data *pdata)
526{
527 pdata->ctrl_reg_offset = DM644X_EMAC_CNTRL_OFFSET;
528 pdata->ctrl_mod_reg_offset = DM644X_EMAC_CNTRL_MOD_OFFSET;
529 pdata->ctrl_ram_offset = DM644X_EMAC_CNTRL_RAM_OFFSET;
530 pdata->mdio_reg_offset = DM644X_EMAC_MDIO_OFFSET;
531 pdata->ctrl_ram_size = DM644X_EMAC_CNTRL_RAM_SIZE;
532 pdata->version = EMAC_VERSION_1;
533 dm644x_emac_device.dev.platform_data = pdata;
534 platform_device_register(&dm644x_emac_device);
535}
536#else
537
538void dm644x_init_emac(struct emac_platform_data *unused) {}
539
540#endif
541 531
542static struct map_desc dm644x_io_desc[] = { 532static struct map_desc dm644x_io_desc[] = {
543 { 533 {
@@ -635,6 +625,7 @@ static struct davinci_soc_info davinci_soc_info_dm644x = {
635 .gpio_num = 71, 625 .gpio_num = 71,
636 .gpio_irq = IRQ_GPIOBNK0, 626 .gpio_irq = IRQ_GPIOBNK0,
637 .serial_dev = &dm644x_serial_device, 627 .serial_dev = &dm644x_serial_device,
628 .emac_pdata = &dm644x_emac_pdata,
638}; 629};
639 630
640void __init dm644x_init(void) 631void __init dm644x_init(void)
@@ -648,6 +639,7 @@ static int __init dm644x_init_devices(void)
648 return 0; 639 return 0;
649 640
650 platform_device_register(&dm644x_edma_device); 641 platform_device_register(&dm644x_edma_device);
642 platform_device_register(&dm644x_emac_device);
651 return 0; 643 return 0;
652} 644}
653postcore_initcall(dm644x_init_devices); 645postcore_initcall(dm644x_init_devices);
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 544658e58854..5185ad55fc50 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -286,7 +286,15 @@ struct davinci_clk dm646x_clks[] = {
286 CLK(NULL, NULL, NULL), 286 CLK(NULL, NULL, NULL),
287}; 287};
288 288
289#if defined(CONFIG_TI_DAVINCI_EMAC) || defined(CONFIG_TI_DAVINCI_EMAC_MODULE) 289static struct emac_platform_data dm646x_emac_pdata = {
290 .ctrl_reg_offset = DM646X_EMAC_CNTRL_OFFSET,
291 .ctrl_mod_reg_offset = DM646X_EMAC_CNTRL_MOD_OFFSET,
292 .ctrl_ram_offset = DM646X_EMAC_CNTRL_RAM_OFFSET,
293 .mdio_reg_offset = DM646X_EMAC_MDIO_OFFSET,
294 .ctrl_ram_size = DM646X_EMAC_CNTRL_RAM_SIZE,
295 .version = EMAC_VERSION_2,
296};
297
290static struct resource dm646x_emac_resources[] = { 298static struct resource dm646x_emac_resources[] = {
291 { 299 {
292 .start = DM646X_EMAC_BASE, 300 .start = DM646X_EMAC_BASE,
@@ -318,12 +326,13 @@ static struct resource dm646x_emac_resources[] = {
318static struct platform_device dm646x_emac_device = { 326static struct platform_device dm646x_emac_device = {
319 .name = "davinci_emac", 327 .name = "davinci_emac",
320 .id = 1, 328 .id = 1,
329 .dev = {
330 .platform_data = &dm646x_emac_pdata,
331 },
321 .num_resources = ARRAY_SIZE(dm646x_emac_resources), 332 .num_resources = ARRAY_SIZE(dm646x_emac_resources),
322 .resource = dm646x_emac_resources, 333 .resource = dm646x_emac_resources,
323}; 334};
324 335
325#endif
326
327/* 336/*
328 * Device specific mux setup 337 * Device specific mux setup
329 * 338 *
@@ -499,25 +508,6 @@ static struct platform_device dm646x_edma_device = {
499 508
500/*----------------------------------------------------------------------*/ 509/*----------------------------------------------------------------------*/
501 510
502#if defined(CONFIG_TI_DAVINCI_EMAC) || defined(CONFIG_TI_DAVINCI_EMAC_MODULE)
503
504void dm646x_init_emac(struct emac_platform_data *pdata)
505{
506 pdata->ctrl_reg_offset = DM646X_EMAC_CNTRL_OFFSET;
507 pdata->ctrl_mod_reg_offset = DM646X_EMAC_CNTRL_MOD_OFFSET;
508 pdata->ctrl_ram_offset = DM646X_EMAC_CNTRL_RAM_OFFSET;
509 pdata->mdio_reg_offset = DM646X_EMAC_MDIO_OFFSET;
510 pdata->ctrl_ram_size = DM646X_EMAC_CNTRL_RAM_SIZE;
511 pdata->version = EMAC_VERSION_2;
512 dm646x_emac_device.dev.platform_data = pdata;
513 platform_device_register(&dm646x_emac_device);
514}
515#else
516
517void dm646x_init_emac(struct emac_platform_data *unused) {}
518
519#endif
520
521static struct map_desc dm646x_io_desc[] = { 511static struct map_desc dm646x_io_desc[] = {
522 { 512 {
523 .virtual = IO_VIRT, 513 .virtual = IO_VIRT,
@@ -614,6 +604,7 @@ static struct davinci_soc_info davinci_soc_info_dm646x = {
614 .gpio_num = 43, /* Only 33 usable */ 604 .gpio_num = 43, /* Only 33 usable */
615 .gpio_irq = IRQ_DM646X_GPIOBNK0, 605 .gpio_irq = IRQ_DM646X_GPIOBNK0,
616 .serial_dev = &dm646x_serial_device, 606 .serial_dev = &dm646x_serial_device,
607 .emac_pdata = &dm646x_emac_pdata,
617}; 608};
618 609
619void __init dm646x_init(void) 610void __init dm646x_init(void)
@@ -627,6 +618,7 @@ static int __init dm646x_init_devices(void)
627 return 0; 618 return 0;
628 619
629 platform_device_register(&dm646x_edma_device); 620 platform_device_register(&dm646x_edma_device);
621 platform_device_register(&dm646x_emac_device);
630 return 0; 622 return 0;
631} 623}
632postcore_initcall(dm646x_init_devices); 624postcore_initcall(dm646x_init_devices);
diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h
index 9624e0382536..b773d92e7379 100644
--- a/arch/arm/mach-davinci/include/mach/common.h
+++ b/arch/arm/mach-davinci/include/mach/common.h
@@ -62,6 +62,7 @@ struct davinci_soc_info {
62 unsigned gpio_num; 62 unsigned gpio_num;
63 unsigned gpio_irq; 63 unsigned gpio_irq;
64 struct platform_device *serial_dev; 64 struct platform_device *serial_dev;
65 struct emac_platform_data *emac_pdata;
65}; 66};
66 67
67extern struct davinci_soc_info davinci_soc_info; 68extern struct davinci_soc_info davinci_soc_info;
diff --git a/arch/arm/mach-davinci/include/mach/dm644x.h b/arch/arm/mach-davinci/include/mach/dm644x.h
index ace167aec460..15d42b92a8c9 100644
--- a/arch/arm/mach-davinci/include/mach/dm644x.h
+++ b/arch/arm/mach-davinci/include/mach/dm644x.h
@@ -34,6 +34,5 @@
34#define DM644X_EMAC_CNTRL_RAM_SIZE (0x2000) 34#define DM644X_EMAC_CNTRL_RAM_SIZE (0x2000)
35 35
36void __init dm644x_init(void); 36void __init dm644x_init(void);
37void dm644x_init_emac(struct emac_platform_data *pdata);
38 37
39#endif /* __ASM_ARCH_DM644X_H */ 38#endif /* __ASM_ARCH_DM644X_H */
diff --git a/arch/arm/mach-davinci/include/mach/dm646x.h b/arch/arm/mach-davinci/include/mach/dm646x.h
index ea7b28e112f6..1fc764c8646e 100644
--- a/arch/arm/mach-davinci/include/mach/dm646x.h
+++ b/arch/arm/mach-davinci/include/mach/dm646x.h
@@ -22,6 +22,5 @@
22#define DM646X_EMAC_CNTRL_RAM_SIZE (0x2000) 22#define DM646X_EMAC_CNTRL_RAM_SIZE (0x2000)
23 23
24void __init dm646x_init(void); 24void __init dm646x_init(void);
25void dm646x_init_emac(struct emac_platform_data *pdata);
26 25
27#endif /* __ASM_ARCH_DM646X_H */ 26#endif /* __ASM_ARCH_DM646X_H */