aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci/board-dm644x-evm.c
diff options
context:
space:
mode:
authorKevin Hilman <khilman@deeprootsystems.com>2009-05-07 09:19:40 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2009-05-26 10:18:16 -0400
commitac7b75b5bbbfd60b752869a22daa3be99b5b4f99 (patch)
treedac2408210f9e815f98f67c7c6e32216db99fa73 /arch/arm/mach-davinci/board-dm644x-evm.c
parent2dbf56aeb7986b54651c93ed171877e8179289bc (diff)
davinci: EMAC platform support
Add SoC and platform-specific data and init for DaVinci EMAC network driver. Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci/board-dm644x-evm.c')
-rw-r--r--arch/arm/mach-davinci/board-dm644x-evm.c37
1 files changed, 14 insertions, 23 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 @@
16#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <linux/leds.h> 17#include <linux/leds.h>
18#include <linux/memory.h> 18#include <linux/memory.h>
19#include <linux/etherdevice.h>
20 19
21#include <linux/i2c.h> 20#include <linux/i2c.h>
22#include <linux/i2c/pcf857x.h> 21#include <linux/i2c/pcf857x.h>
23#include <linux/i2c/at24.h> 22#include <linux/i2c/at24.h>
24 23#include <linux/etherdevice.h>
25#include <linux/mtd/mtd.h> 24#include <linux/mtd/mtd.h>
26#include <linux/mtd/nand.h> 25#include <linux/mtd/nand.h>
27#include <linux/mtd/partitions.h> 26#include <linux/mtd/partitions.h>
@@ -39,6 +38,7 @@
39 38
40#include <mach/dm644x.h> 39#include <mach/dm644x.h>
41#include <mach/common.h> 40#include <mach/common.h>
41#include <mach/emac.h>
42#include <mach/i2c.h> 42#include <mach/i2c.h>
43#include <mach/serial.h> 43#include <mach/serial.h>
44#include <mach/mux.h> 44#include <mach/mux.h>
@@ -60,6 +60,11 @@
60#define LXT971_PHY_ID (0x001378e2) 60#define LXT971_PHY_ID (0x001378e2)
61#define LXT971_PHY_MASK (0xfffffff0) 61#define LXT971_PHY_MASK (0xfffffff0)
62 62
63static struct emac_platform_data dm644x_evm_emac_pdata = {
64 .phy_mask = DM644X_EVM_PHY_MASK,
65 .mdio_max_freq = DM644X_EVM_MDIO_FREQUENCY,
66};
67
63static struct mtd_partition davinci_evm_norflash_partitions[] = { 68static struct mtd_partition davinci_evm_norflash_partitions[] = {
64 /* bootloader (UBL, U-Boot, etc) in first 5 sectors */ 69 /* bootloader (UBL, U-Boot, etc) in first 5 sectors */
65 { 70 {
@@ -441,15 +446,15 @@ static struct memory_accessor *at24_mem_acc;
441 446
442static void at24_setup(struct memory_accessor *mem_acc, void *context) 447static void at24_setup(struct memory_accessor *mem_acc, void *context)
443{ 448{
444 DECLARE_MAC_BUF(mac_str); 449 char mac_addr[ETH_ALEN];
445 char mac_addr[6];
446 450
447 at24_mem_acc = mem_acc; 451 at24_mem_acc = mem_acc;
448 452
449 /* Read MAC addr from EEPROM */ 453 /* Read MAC addr from EEPROM */
450 if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x7f00, 6) == 6) { 454 if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x7f00, ETH_ALEN) ==
451 printk(KERN_INFO "Read MAC addr from EEPROM: %s\n", 455 ETH_ALEN) {
452 print_mac(mac_str, mac_addr)); 456 printk(KERN_INFO "Read MAC addr from EEPROM: %pM\n", mac_addr);
457 memcpy(dm644x_evm_emac_pdata.mac_addr, mac_addr, ETH_ALEN);
453 } 458 }
454} 459}
455 460
@@ -460,22 +465,6 @@ static struct at24_platform_data eeprom_info = {
460 .setup = at24_setup, 465 .setup = at24_setup,
461}; 466};
462 467
463int dm6446evm_eeprom_read(void *buf, off_t off, size_t count)
464{
465 if (at24_mem_acc)
466 return at24_mem_acc->read(at24_mem_acc, buf, off, count);
467 return -ENODEV;
468}
469EXPORT_SYMBOL(dm6446evm_eeprom_read);
470
471int dm6446evm_eeprom_write(void *buf, off_t off, size_t count)
472{
473 if (at24_mem_acc)
474 return at24_mem_acc->write(at24_mem_acc, buf, off, count);
475 return -ENODEV;
476}
477EXPORT_SYMBOL(dm6446evm_eeprom_write);
478
479/* 468/*
480 * MSP430 supports RTC, card detection, input from IR remote, and 469 * MSP430 supports RTC, card detection, input from IR remote, and
481 * a bit more. It triggers interrupts on GPIO(7) from pressing 470 * a bit more. It triggers interrupts on GPIO(7) from pressing
@@ -697,6 +686,8 @@ static __init void davinci_evm_init(void)
697 686
698 davinci_serial_init(&uart_config); 687 davinci_serial_init(&uart_config);
699 688
689 dm644x_init_emac(&dm644x_evm_emac_pdata);
690
700 /* Register the fixup for PHY on DaVinci */ 691 /* Register the fixup for PHY on DaVinci */
701 phy_register_fixup_for_uid(LXT971_PHY_ID, LXT971_PHY_MASK, 692 phy_register_fixup_for_uid(LXT971_PHY_ID, LXT971_PHY_MASK,
702 davinci_phy_fixup); 693 davinci_phy_fixup);