#include <mach/dm644x.h>
#include <mach/common.h>
-#include <mach/emac.h>
#include <mach/i2c.h>
#include <mach/serial.h>
#include <mach/mux.h>
#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 */
{
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;
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);
}
}
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);
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,
#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),
};
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;
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);
}
}
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)
#include <mach/dm644x.h>
#include <mach/common.h>
-#include <mach/emac.h>
#include <mach/i2c.h>
#include <mach/serial.h>
#include <mach/psc.h>
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 */
{
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;
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[] = {
{
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
*
};
/*----------------------------------------------------------------------*/
-#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[] = {
{
.gpio_num = 71,
.gpio_irq = IRQ_GPIOBNK0,
.serial_dev = &dm644x_serial_device,
+ .emac_pdata = &dm644x_emac_pdata,
};
void __init dm644x_init(void)
return 0;
platform_device_register(&dm644x_edma_device);
+ platform_device_register(&dm644x_emac_device);
return 0;
}
postcore_initcall(dm644x_init_devices);
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,
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
*
/*----------------------------------------------------------------------*/
-#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,
.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)
return 0;
platform_device_register(&dm646x_edma_device);
+ platform_device_register(&dm646x_emac_device);
return 0;
}
postcore_initcall(dm646x_init_devices);
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;
#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 */
#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 */