diff options
author | Mark A. Greer <mgreer@mvista.com> | 2009-04-15 12:40:56 -0700 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2009-05-28 15:17:45 -0700 |
commit | 972412b648dcf0c4303dca7e515d5c24ce3cd1d5 (patch) | |
tree | 2531253bcc50ef71665405ad1aa0f8f2f035f41f /arch/arm/mach-davinci | |
parent | 65e866a9741126c678e6dcd5d4fa8c9eca18e945 (diff) | |
download | op-kernel-dev-972412b648dcf0c4303dca7e515d5c24ce3cd1d5.zip op-kernel-dev-972412b648dcf0c4303dca7e515d5c24ce3cd1d5.tar.gz |
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/mach-davinci')
-rw-r--r-- | arch/arm/mach-davinci/board-dm644x-evm.c | 14 | ||||
-rw-r--r-- | arch/arm/mach-davinci/board-dm646x-evm.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-davinci/board-sffsdr.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-davinci/devices.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-davinci/dm644x.c | 34 | ||||
-rw-r--r-- | arch/arm/mach-davinci/dm646x.c | 36 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/common.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/dm644x.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/dm646x.h | 1 |
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 cfe89c4..987d27f 100644 --- a/arch/arm/mach-davinci/board-dm644x-evm.c +++ b/arch/arm/mach-davinci/board-dm644x-evm.c @@ -38,7 +38,6 @@ #include <mach/dm644x.h> #include <mach/common.h> -#include <mach/emac.h> #include <mach/i2c.h> #include <mach/serial.h> #include <mach/mux.h> @@ -61,11 +60,6 @@ #define LXT971_PHY_ID (0x001378e2) #define LXT971_PHY_MASK (0xfffffff0) -static struct emac_platform_data dm644x_evm_emac_pdata = { - .phy_mask = DM644X_EVM_PHY_MASK, - .mdio_max_freq = DM644X_EVM_MDIO_FREQUENCY, -}; - static struct mtd_partition davinci_evm_norflash_partitions[] = { /* bootloader (UBL, U-Boot, etc) in first 5 sectors */ { @@ -448,6 +442,7 @@ static struct memory_accessor *at24_mem_acc; static void at24_setup(struct memory_accessor *mem_acc, void *context) { char mac_addr[ETH_ALEN]; + struct davinci_soc_info *soc_info = &davinci_soc_info; at24_mem_acc = mem_acc; @@ -455,7 +450,7 @@ static void at24_setup(struct memory_accessor *mem_acc, void *context) if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x7f00, ETH_ALEN) == ETH_ALEN) { printk(KERN_INFO "Read MAC addr from EEPROM: %pM\n", mac_addr); - memcpy(dm644x_evm_emac_pdata.mac_addr, mac_addr, ETH_ALEN); + memcpy(soc_info->emac_pdata->mac_addr, mac_addr, ETH_ALEN); } } @@ -650,6 +645,7 @@ static int davinci_phy_fixup(struct phy_device *phydev) static __init void davinci_evm_init(void) { struct clk *aemif_clk; + struct davinci_soc_info *soc_info = &davinci_soc_info; aemif_clk = clk_get(NULL, "aemif"); clk_enable(aemif_clk); @@ -686,7 +682,9 @@ static __init void davinci_evm_init(void) davinci_serial_init(&uart_config); - dm644x_init_emac(&dm644x_evm_emac_pdata); + soc_info->emac_pdata->phy_mask = DM644X_EVM_PHY_MASK; + soc_info->emac_pdata->mdio_max_freq = DM644X_EVM_MDIO_FREQUENCY; + dm644x_init_emac(soc_info->emac_pdata); /* Register the fixup for PHY on DaVinci */ 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 becae51..0de0637 100644 --- a/arch/arm/mach-davinci/board-dm646x-evm.c +++ b/arch/arm/mach-davinci/board-dm646x-evm.c @@ -52,11 +52,6 @@ #define DM646X_EVM_PHY_MASK (0x2) #define DM646X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */ -static struct emac_platform_data dm646x_evm_emac_pdata = { - .phy_mask = DM646X_EVM_PHY_MASK, - .mdio_max_freq = DM646X_EVM_MDIO_FREQUENCY, -}; - static struct davinci_uart_config uart_config __initdata = { .enabled_uarts = (1 << 0), }; @@ -208,6 +203,7 @@ static struct memory_accessor *at24_mem_acc; static void at24_setup(struct memory_accessor *mem_acc, void *context) { char mac_addr[ETH_ALEN]; + struct davinci_soc_info *soc_info = &davinci_soc_info; at24_mem_acc = mem_acc; @@ -215,7 +211,7 @@ static void at24_setup(struct memory_accessor *mem_acc, void *context) if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x7f00, ETH_ALEN) == ETH_ALEN) { pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr); - memcpy(dm646x_evm_emac_pdata.mac_addr, mac_addr, ETH_ALEN); + memcpy(soc_info->emac_pdata->mac_addr, mac_addr, ETH_ALEN); } } @@ -271,9 +267,14 @@ static void __init davinci_map_io(void) static __init void evm_init(void) { + struct davinci_soc_info *soc_info = &davinci_soc_info; + evm_init_i2c(); davinci_serial_init(&uart_config); - dm646x_init_emac(&dm646x_evm_emac_pdata); + + soc_info->emac_pdata->phy_mask = DM646X_EVM_PHY_MASK; + soc_info->emac_pdata->mdio_max_freq = DM646X_EVM_MDIO_FREQUENCY; + dm646x_init_emac(soc_info->emac_pdata); } static __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 938b446..748a8e4 100644 --- a/arch/arm/mach-davinci/board-sffsdr.c +++ b/arch/arm/mach-davinci/board-sffsdr.c @@ -48,7 +48,6 @@ #include <mach/dm644x.h> #include <mach/common.h> -#include <mach/emac.h> #include <mach/i2c.h> #include <mach/serial.h> #include <mach/psc.h> @@ -158,11 +157,14 @@ static void __init davinci_sffsdr_map_io(void) static __init void davinci_sffsdr_init(void) { + struct davinci_soc_info *soc_info = &davinci_soc_info; + platform_add_devices(davinci_sffsdr_devices, ARRAY_SIZE(davinci_sffsdr_devices)); sffsdr_init_i2c(); davinci_serial_init(&uart_config); - dm644x_init_emac(&sffsdr_emac_pdata); + soc_info->emac_pdata->phy_mask = SFFSDR_PHY_MASK; + soc_info->emac_pdata->mdio_max_freq = SFFSDR_MDIO_FREQUENCY; setup_usb(0, 0); /* We support only peripheral mode. */ /* mux VLYNQ pins */ diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c index 7ebf671..c0195cd 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) { DECLARE_MAC_BUF(buf); - if (cpu_is_davinci_dm644x()) - dm644x_init_emac(pdata); - else if (cpu_is_davinci_dm646x()) - dm646x_init_emac(pdata); - /* if valid MAC exists, don't re-register */ if (is_valid_ether_addr(pdata->mac_addr)) return; diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c index a562986..3844fc3 100644 --- a/arch/arm/mach-davinci/dm644x.c +++ b/arch/arm/mach-davinci/dm644x.c @@ -319,7 +319,14 @@ struct davinci_clk dm644x_clks[] = { CLK(NULL, NULL, NULL), }; -#if defined(CONFIG_TI_DAVINCI_EMAC) || defined(CONFIG_TI_DAVINCI_EMAC_MODULE) +static struct emac_platform_data dm644x_emac_pdata = { + .ctrl_reg_offset = DM644X_EMAC_CNTRL_OFFSET, + .ctrl_mod_reg_offset = DM644X_EMAC_CNTRL_MOD_OFFSET, + .ctrl_ram_offset = DM644X_EMAC_CNTRL_RAM_OFFSET, + .mdio_reg_offset = DM644X_EMAC_MDIO_OFFSET, + .ctrl_ram_size = DM644X_EMAC_CNTRL_RAM_SIZE, + .version = EMAC_VERSION_1, +}; static struct resource dm644x_emac_resources[] = { { @@ -337,12 +344,13 @@ static struct resource dm644x_emac_resources[] = { static struct platform_device dm644x_emac_device = { .name = "davinci_emac", .id = 1, + .dev = { + .platform_data = &dm644x_emac_pdata, + }, .num_resources = ARRAY_SIZE(dm644x_emac_resources), .resource = dm644x_emac_resources, }; -#endif - /* * Device specific mux setup * @@ -520,24 +528,6 @@ static struct platform_device dm644x_edma_device = { }; /*----------------------------------------------------------------------*/ -#if defined(CONFIG_TI_DAVINCI_EMAC) || defined(CONFIG_TI_DAVINCI_EMAC_MODULE) - -void dm644x_init_emac(struct emac_platform_data *pdata) -{ - pdata->ctrl_reg_offset = DM644X_EMAC_CNTRL_OFFSET; - pdata->ctrl_mod_reg_offset = DM644X_EMAC_CNTRL_MOD_OFFSET; - pdata->ctrl_ram_offset = DM644X_EMAC_CNTRL_RAM_OFFSET; - pdata->mdio_reg_offset = DM644X_EMAC_MDIO_OFFSET; - pdata->ctrl_ram_size = DM644X_EMAC_CNTRL_RAM_SIZE; - pdata->version = EMAC_VERSION_1; - dm644x_emac_device.dev.platform_data = pdata; - platform_device_register(&dm644x_emac_device); -} -#else - -void dm644x_init_emac(struct emac_platform_data *unused) {} - -#endif static struct map_desc dm644x_io_desc[] = { { @@ -635,6 +625,7 @@ static struct davinci_soc_info davinci_soc_info_dm644x = { .gpio_num = 71, .gpio_irq = IRQ_GPIOBNK0, .serial_dev = &dm644x_serial_device, + .emac_pdata = &dm644x_emac_pdata, }; void __init dm644x_init(void) @@ -648,6 +639,7 @@ static int __init dm644x_init_devices(void) return 0; platform_device_register(&dm644x_edma_device); + platform_device_register(&dm644x_emac_device); return 0; } postcore_initcall(dm644x_init_devices); diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c index 544658e..5185ad5 100644 --- a/arch/arm/mach-davinci/dm646x.c +++ b/arch/arm/mach-davinci/dm646x.c @@ -286,7 +286,15 @@ struct davinci_clk dm646x_clks[] = { CLK(NULL, NULL, NULL), }; -#if defined(CONFIG_TI_DAVINCI_EMAC) || defined(CONFIG_TI_DAVINCI_EMAC_MODULE) +static struct emac_platform_data dm646x_emac_pdata = { + .ctrl_reg_offset = DM646X_EMAC_CNTRL_OFFSET, + .ctrl_mod_reg_offset = DM646X_EMAC_CNTRL_MOD_OFFSET, + .ctrl_ram_offset = DM646X_EMAC_CNTRL_RAM_OFFSET, + .mdio_reg_offset = DM646X_EMAC_MDIO_OFFSET, + .ctrl_ram_size = DM646X_EMAC_CNTRL_RAM_SIZE, + .version = EMAC_VERSION_2, +}; + static struct resource dm646x_emac_resources[] = { { .start = DM646X_EMAC_BASE, @@ -318,12 +326,13 @@ static struct resource dm646x_emac_resources[] = { static struct platform_device dm646x_emac_device = { .name = "davinci_emac", .id = 1, + .dev = { + .platform_data = &dm646x_emac_pdata, + }, .num_resources = ARRAY_SIZE(dm646x_emac_resources), .resource = dm646x_emac_resources, }; -#endif - /* * Device specific mux setup * @@ -499,25 +508,6 @@ static struct platform_device dm646x_edma_device = { /*----------------------------------------------------------------------*/ -#if defined(CONFIG_TI_DAVINCI_EMAC) || defined(CONFIG_TI_DAVINCI_EMAC_MODULE) - -void dm646x_init_emac(struct emac_platform_data *pdata) -{ - pdata->ctrl_reg_offset = DM646X_EMAC_CNTRL_OFFSET; - pdata->ctrl_mod_reg_offset = DM646X_EMAC_CNTRL_MOD_OFFSET; - pdata->ctrl_ram_offset = DM646X_EMAC_CNTRL_RAM_OFFSET; - pdata->mdio_reg_offset = DM646X_EMAC_MDIO_OFFSET; - pdata->ctrl_ram_size = DM646X_EMAC_CNTRL_RAM_SIZE; - pdata->version = EMAC_VERSION_2; - dm646x_emac_device.dev.platform_data = pdata; - platform_device_register(&dm646x_emac_device); -} -#else - -void dm646x_init_emac(struct emac_platform_data *unused) {} - -#endif - static struct map_desc dm646x_io_desc[] = { { .virtual = IO_VIRT, @@ -614,6 +604,7 @@ static struct davinci_soc_info davinci_soc_info_dm646x = { .gpio_num = 43, /* Only 33 usable */ .gpio_irq = IRQ_DM646X_GPIOBNK0, .serial_dev = &dm646x_serial_device, + .emac_pdata = &dm646x_emac_pdata, }; void __init dm646x_init(void) @@ -627,6 +618,7 @@ static int __init dm646x_init_devices(void) return 0; platform_device_register(&dm646x_edma_device); + platform_device_register(&dm646x_emac_device); return 0; } postcore_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 9624e03..b773d92 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 { unsigned gpio_num; unsigned gpio_irq; struct platform_device *serial_dev; + struct emac_platform_data *emac_pdata; }; extern 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 ace167a..15d42b9 100644 --- a/arch/arm/mach-davinci/include/mach/dm644x.h +++ b/arch/arm/mach-davinci/include/mach/dm644x.h @@ -34,6 +34,5 @@ #define DM644X_EMAC_CNTRL_RAM_SIZE (0x2000) void __init dm644x_init(void); -void dm644x_init_emac(struct emac_platform_data *pdata); #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 ea7b28e..1fc764c 100644 --- a/arch/arm/mach-davinci/include/mach/dm646x.h +++ b/arch/arm/mach-davinci/include/mach/dm646x.h @@ -22,6 +22,5 @@ #define DM646X_EMAC_CNTRL_RAM_SIZE (0x2000) void __init dm646x_init(void); -void dm646x_init_emac(struct emac_platform_data *pdata); #endif /* __ASM_ARCH_DM646X_H */ |