summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-davinci/board-dm644x-evm.c37
-rw-r--r--arch/arm/mach-davinci/board-dm646x-evm.c17
-rw-r--r--arch/arm/mach-davinci/board-sffsdr.c11
-rw-r--r--arch/arm/mach-davinci/dm644x.c19
-rw-r--r--arch/arm/mach-davinci/dm646x.c57
-rw-r--r--arch/arm/mach-davinci/include/mach/dm644x.h2
-rw-r--r--arch/arm/mach-davinci/include/mach/dm646x.h9
-rw-r--r--arch/arm/mach-davinci/include/mach/emac.h36
8 files changed, 161 insertions, 27 deletions
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index 9c3ce311d5d7..02e7cdaf8daa 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -16,12 +16,11 @@
#include <linux/gpio.h>
#include <linux/leds.h>
#include <linux/memory.h>
-#include <linux/etherdevice.h>
#include <linux/i2c.h>
#include <linux/i2c/pcf857x.h>
#include <linux/i2c/at24.h>
-
+#include <linux/etherdevice.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
@@ -39,6 +38,7 @@
#include <mach/dm644x.h>
#include <mach/common.h>
+#include <mach/emac.h>
#include <mach/i2c.h>
#include <mach/serial.h>
#include <mach/mux.h>
@@ -60,6 +60,11 @@
#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 */
{
@@ -441,15 +446,15 @@ static struct memory_accessor *at24_mem_acc;
static void at24_setup(struct memory_accessor *mem_acc, void *context)
{
- DECLARE_MAC_BUF(mac_str);
- char mac_addr[6];
+ char mac_addr[ETH_ALEN];
at24_mem_acc = mem_acc;
/* Read MAC addr from EEPROM */
- if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x7f00, 6) == 6) {
- printk(KERN_INFO "Read MAC addr from EEPROM: %s\n",
- print_mac(mac_str, mac_addr));
+ 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);
}
}
@@ -460,22 +465,6 @@ static struct at24_platform_data eeprom_info = {
.setup = at24_setup,
};
-int dm6446evm_eeprom_read(void *buf, off_t off, size_t count)
-{
- if (at24_mem_acc)
- return at24_mem_acc->read(at24_mem_acc, buf, off, count);
- return -ENODEV;
-}
-EXPORT_SYMBOL(dm6446evm_eeprom_read);
-
-int dm6446evm_eeprom_write(void *buf, off_t off, size_t count)
-{
- if (at24_mem_acc)
- return at24_mem_acc->write(at24_mem_acc, buf, off, count);
- return -ENODEV;
-}
-EXPORT_SYMBOL(dm6446evm_eeprom_write);
-
/*
* MSP430 supports RTC, card detection, input from IR remote, and
* a bit more. It triggers interrupts on GPIO(7) from pressing
@@ -697,6 +686,8 @@ static __init void davinci_evm_init(void)
davinci_serial_init(&uart_config);
+ dm644x_init_emac(&dm644x_evm_emac_pdata);
+
/* Register the fixup for PHY on DaVinci */
phy_register_fixup_for_uid(LXT971_PHY_ID, LXT971_PHY_MASK,
davinci_phy_fixup);
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index 94cb623b1ec9..aedde3cdb82f 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -45,6 +45,16 @@
#include <mach/psc.h>
#include <mach/serial.h>
#include <mach/i2c.h>
+#include <mach/mmc.h>
+#include <mach/emac.h>
+
+#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),
@@ -196,14 +206,16 @@ static struct memory_accessor *at24_mem_acc;
static void at24_setup(struct memory_accessor *mem_acc, void *context)
{
- char mac_addr[6];
+ char mac_addr[ETH_ALEN];
at24_mem_acc = mem_acc;
/* Read MAC addr from EEPROM */
if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x7f00, ETH_ALEN) ==
- 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);
+ }
}
static struct at24_platform_data eeprom_info = {
@@ -261,6 +273,7 @@ static __init void evm_init(void)
{
evm_init_i2c();
davinci_serial_init(&uart_config);
+ dm646x_init_emac(&dm646x_evm_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 c6525e43ea33..913dad93540b 100644
--- a/arch/arm/mach-davinci/board-sffsdr.c
+++ b/arch/arm/mach-davinci/board-sffsdr.c
@@ -48,11 +48,15 @@
#include <mach/dm644x.h>
#include <mach/common.h>
+#include <mach/emac.h>
#include <mach/i2c.h>
#include <mach/serial.h>
#include <mach/psc.h>
#include <mach/mux.h>
+#define SFFSDR_PHY_MASK (0x2)
+#define SFFSDR_MDIO_FREQUENCY (2200000) /* PHY bus frequency */
+
#define DAVINCI_ASYNC_EMIF_CONTROL_BASE 0x01e00000
#define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE 0x02000000
@@ -104,8 +108,10 @@ static struct platform_device davinci_sffsdr_nandflash_device = {
.resource = davinci_sffsdr_nandflash_resource,
};
-/* Get Ethernet address from kernel boot params */
-static u8 mac_addr[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+static struct emac_platform_data sffsdr_emac_pdata = {
+ .phy_mask = SFFSDR_PHY_MASK,
+ .mdio_max_freq = SFFSDR_MDIO_FREQUENCY,
+};
static struct at24_platform_data eeprom_info = {
.byte_len = (64*1024) / 8,
@@ -156,6 +162,7 @@ static __init void davinci_sffsdr_init(void)
ARRAY_SIZE(davinci_sffsdr_devices));
sffsdr_init_i2c();
davinci_serial_init(&uart_config);
+ dm644x_init_emac(&sffsdr_emac_pdata);
setup_usb(0, 0); /* We support only peripheral mode. */
/* mux VLYNQ pins */
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index d428ef192eac..0419d571bdca 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -444,6 +444,25 @@ 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
+
void __init dm644x_init(void)
{
davinci_clk_init(dm644x_clks);
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 93443a6637ea..975ed062ce24 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -279,6 +279,44 @@ struct davinci_clk dm646x_clks[] = {
CLK(NULL, NULL, NULL),
};
+#if defined(CONFIG_TI_DAVINCI_EMAC) || defined(CONFIG_TI_DAVINCI_EMAC_MODULE)
+static struct resource dm646x_emac_resources[] = {
+ {
+ .start = DM646X_EMAC_BASE,
+ .end = DM646X_EMAC_BASE + 0x47ff,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = IRQ_DM646X_EMACRXTHINT,
+ .end = IRQ_DM646X_EMACRXTHINT,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = IRQ_DM646X_EMACRXINT,
+ .end = IRQ_DM646X_EMACRXINT,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = IRQ_DM646X_EMACTXINT,
+ .end = IRQ_DM646X_EMACTXINT,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = IRQ_DM646X_EMACMISCINT,
+ .end = IRQ_DM646X_EMACMISCINT,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device dm646x_emac_device = {
+ .name = "davinci_emac",
+ .id = 1,
+ .num_resources = ARRAY_SIZE(dm646x_emac_resources),
+ .resource = dm646x_emac_resources,
+};
+
+#endif
+
/*
* Device specific mux setup
*
@@ -385,6 +423,25 @@ 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
+
void __init dm646x_init(void)
{
davinci_clk_init(dm646x_clks);
diff --git a/arch/arm/mach-davinci/include/mach/dm644x.h b/arch/arm/mach-davinci/include/mach/dm644x.h
index 3dcb9f4e58b4..ace167aec460 100644
--- a/arch/arm/mach-davinci/include/mach/dm644x.h
+++ b/arch/arm/mach-davinci/include/mach/dm644x.h
@@ -24,6 +24,7 @@
#include <linux/platform_device.h>
#include <mach/hardware.h>
+#include <mach/emac.h>
#define DM644X_EMAC_BASE (0x01C80000)
#define DM644X_EMAC_CNTRL_OFFSET (0x0000)
@@ -33,5 +34,6 @@
#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 d917939af158..ea7b28e112f6 100644
--- a/arch/arm/mach-davinci/include/mach/dm646x.h
+++ b/arch/arm/mach-davinci/include/mach/dm646x.h
@@ -12,7 +12,16 @@
#define __ASM_ARCH_DM646X_H
#include <mach/hardware.h>
+#include <mach/emac.h>
+
+#define DM646X_EMAC_BASE (0x01C80000)
+#define DM646X_EMAC_CNTRL_OFFSET (0x0000)
+#define DM646X_EMAC_CNTRL_MOD_OFFSET (0x1000)
+#define DM646X_EMAC_CNTRL_RAM_OFFSET (0x2000)
+#define DM646X_EMAC_MDIO_OFFSET (0x4000)
+#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 */
diff --git a/arch/arm/mach-davinci/include/mach/emac.h b/arch/arm/mach-davinci/include/mach/emac.h
new file mode 100644
index 000000000000..549fcced2175
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/emac.h
@@ -0,0 +1,36 @@
+/*
+ * TI DaVinci EMAC platform support
+ *
+ * Author: Kevin Hilman, Deep Root Systems, LLC
+ *
+ * 2007 (c) Deep Root Systems, LLC. This file is licensed under
+ * the terms of the GNU General Public License version 2. This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+#ifndef _MACH_DAVINCI_EMAC_H
+#define _MACH_DAVINCI_EMAC_H
+
+#include <linux/if_ether.h>
+
+struct emac_platform_data {
+ char mac_addr[ETH_ALEN];
+ u32 ctrl_reg_offset;
+ u32 ctrl_mod_reg_offset;
+ u32 ctrl_ram_offset;
+ u32 mdio_reg_offset;
+ u32 ctrl_ram_size;
+ u32 phy_mask;
+ u32 mdio_max_freq;
+ u8 rmii_en;
+ u8 version;
+};
+
+enum {
+ EMAC_VERSION_1, /* DM644x */
+ EMAC_VERSION_2, /* DM646x */
+};
+void davinci_init_emac(struct emac_platform_data *pdata);
+#endif
+
+