diff options
author | Sandeep Paulraj <s-paulraj@ti.com> | 2009-06-20 12:23:39 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2009-08-26 03:56:58 -0400 |
commit | 8ed0a9d4e7cfff439f95d08c882841f25a12bf54 (patch) | |
tree | c516207140f5d91b9e45863fd168622ed779dda9 | |
parent | 9f5131538368b299aabcc790f1cece0439e65a5e (diff) |
davinci: dm365: EMAC support for SoC and dm365 EVM
The patch adds Support for EMAC in the DM365 SOC and
the DM365 EVM board.
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
-rw-r--r-- | arch/arm/mach-davinci/board-dm365-evm.c | 66 | ||||
-rw-r--r-- | arch/arm/mach-davinci/dm365.c | 58 |
2 files changed, 122 insertions, 2 deletions
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c index 08c2f12d03d1..9dda3999c8f3 100644 --- a/arch/arm/mach-davinci/board-dm365-evm.c +++ b/arch/arm/mach-davinci/board-dm365-evm.c | |||
@@ -19,12 +19,12 @@ | |||
19 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | #include <linux/clk.h> | 21 | #include <linux/clk.h> |
22 | 22 | #include <linux/i2c/at24.h> | |
23 | #include <asm/setup.h> | 23 | #include <asm/setup.h> |
24 | #include <asm/mach-types.h> | 24 | #include <asm/mach-types.h> |
25 | #include <asm/mach/arch.h> | 25 | #include <asm/mach/arch.h> |
26 | #include <asm/mach/map.h> | 26 | #include <asm/mach/map.h> |
27 | 27 | #include <mach/mux.h> | |
28 | #include <mach/hardware.h> | 28 | #include <mach/hardware.h> |
29 | #include <mach/dm365.h> | 29 | #include <mach/dm365.h> |
30 | #include <mach/psc.h> | 30 | #include <mach/psc.h> |
@@ -34,14 +34,69 @@ | |||
34 | #include <mach/serial.h> | 34 | #include <mach/serial.h> |
35 | #include <mach/common.h> | 35 | #include <mach/common.h> |
36 | 36 | ||
37 | #define DM365_EVM_PHY_MASK (0x2) | ||
38 | #define DM365_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */ | ||
39 | |||
40 | static struct at24_platform_data eeprom_info = { | ||
41 | .byte_len = (256*1024) / 8, | ||
42 | .page_size = 64, | ||
43 | .flags = AT24_FLAG_ADDR16, | ||
44 | .setup = davinci_get_mac_addr, | ||
45 | .context = (void *)0x7f00, | ||
46 | }; | ||
47 | |||
48 | static struct i2c_board_info i2c_info[] = { | ||
49 | { | ||
50 | I2C_BOARD_INFO("24c256", 0x50), | ||
51 | .platform_data = &eeprom_info, | ||
52 | }, | ||
53 | }; | ||
54 | |||
37 | static struct davinci_i2c_platform_data i2c_pdata = { | 55 | static struct davinci_i2c_platform_data i2c_pdata = { |
38 | .bus_freq = 400 /* kHz */, | 56 | .bus_freq = 400 /* kHz */, |
39 | .bus_delay = 0 /* usec */, | 57 | .bus_delay = 0 /* usec */, |
40 | }; | 58 | }; |
41 | 59 | ||
60 | static void dm365evm_emac_configure(void) | ||
61 | { | ||
62 | /* | ||
63 | * EMAC pins are multiplexed with GPIO and UART | ||
64 | * Further details are available at the DM365 ARM | ||
65 | * Subsystem Users Guide(sprufg5.pdf) pages 125 - 127 | ||
66 | */ | ||
67 | davinci_cfg_reg(DM365_EMAC_TX_EN); | ||
68 | davinci_cfg_reg(DM365_EMAC_TX_CLK); | ||
69 | davinci_cfg_reg(DM365_EMAC_COL); | ||
70 | davinci_cfg_reg(DM365_EMAC_TXD3); | ||
71 | davinci_cfg_reg(DM365_EMAC_TXD2); | ||
72 | davinci_cfg_reg(DM365_EMAC_TXD1); | ||
73 | davinci_cfg_reg(DM365_EMAC_TXD0); | ||
74 | davinci_cfg_reg(DM365_EMAC_RXD3); | ||
75 | davinci_cfg_reg(DM365_EMAC_RXD2); | ||
76 | davinci_cfg_reg(DM365_EMAC_RXD1); | ||
77 | davinci_cfg_reg(DM365_EMAC_RXD0); | ||
78 | davinci_cfg_reg(DM365_EMAC_RX_CLK); | ||
79 | davinci_cfg_reg(DM365_EMAC_RX_DV); | ||
80 | davinci_cfg_reg(DM365_EMAC_RX_ER); | ||
81 | davinci_cfg_reg(DM365_EMAC_CRS); | ||
82 | davinci_cfg_reg(DM365_EMAC_MDIO); | ||
83 | davinci_cfg_reg(DM365_EMAC_MDCLK); | ||
84 | |||
85 | /* | ||
86 | * EMAC interrupts are multiplexed with GPIO interrupts | ||
87 | * Details are available at the DM365 ARM | ||
88 | * Subsystem Users Guide(sprufg5.pdf) pages 133 - 134 | ||
89 | */ | ||
90 | davinci_cfg_reg(DM365_INT_EMAC_RXTHRESH); | ||
91 | davinci_cfg_reg(DM365_INT_EMAC_RXPULSE); | ||
92 | davinci_cfg_reg(DM365_INT_EMAC_TXPULSE); | ||
93 | davinci_cfg_reg(DM365_INT_EMAC_MISCPULSE); | ||
94 | } | ||
95 | |||
42 | static void __init evm_init_i2c(void) | 96 | static void __init evm_init_i2c(void) |
43 | { | 97 | { |
44 | davinci_init_i2c(&i2c_pdata); | 98 | davinci_init_i2c(&i2c_pdata); |
99 | i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info)); | ||
45 | } | 100 | } |
46 | 101 | ||
47 | static struct davinci_uart_config uart_config __initdata = { | 102 | static struct davinci_uart_config uart_config __initdata = { |
@@ -55,8 +110,15 @@ static void __init dm365_evm_map_io(void) | |||
55 | 110 | ||
56 | static __init void dm365_evm_init(void) | 111 | static __init void dm365_evm_init(void) |
57 | { | 112 | { |
113 | struct davinci_soc_info *soc_info = &davinci_soc_info; | ||
114 | |||
58 | evm_init_i2c(); | 115 | evm_init_i2c(); |
59 | davinci_serial_init(&uart_config); | 116 | davinci_serial_init(&uart_config); |
117 | |||
118 | dm365evm_emac_configure(); | ||
119 | |||
120 | soc_info->emac_pdata->phy_mask = DM365_EVM_PHY_MASK; | ||
121 | soc_info->emac_pdata->mdio_max_freq = DM365_EVM_MDIO_FREQUENCY; | ||
60 | } | 122 | } |
61 | 123 | ||
62 | static __init void dm365_evm_irq_init(void) | 124 | static __init void dm365_evm_irq_init(void) |
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c index c9ae97a476a4..9d615db4463c 100644 --- a/arch/arm/mach-davinci/dm365.c +++ b/arch/arm/mach-davinci/dm365.c | |||
@@ -546,6 +546,52 @@ INT_CFG(DM365, INT_EMAC_MISCPULSE, 17, 1, 1, false) | |||
546 | #endif | 546 | #endif |
547 | }; | 547 | }; |
548 | 548 | ||
549 | static struct emac_platform_data dm365_emac_pdata = { | ||
550 | .ctrl_reg_offset = DM365_EMAC_CNTRL_OFFSET, | ||
551 | .ctrl_mod_reg_offset = DM365_EMAC_CNTRL_MOD_OFFSET, | ||
552 | .ctrl_ram_offset = DM365_EMAC_CNTRL_RAM_OFFSET, | ||
553 | .mdio_reg_offset = DM365_EMAC_MDIO_OFFSET, | ||
554 | .ctrl_ram_size = DM365_EMAC_CNTRL_RAM_SIZE, | ||
555 | .version = EMAC_VERSION_2, | ||
556 | }; | ||
557 | |||
558 | static struct resource dm365_emac_resources[] = { | ||
559 | { | ||
560 | .start = DM365_EMAC_BASE, | ||
561 | .end = DM365_EMAC_BASE + 0x47ff, | ||
562 | .flags = IORESOURCE_MEM, | ||
563 | }, | ||
564 | { | ||
565 | .start = IRQ_DM365_EMAC_RXTHRESH, | ||
566 | .end = IRQ_DM365_EMAC_RXTHRESH, | ||
567 | .flags = IORESOURCE_IRQ, | ||
568 | }, | ||
569 | { | ||
570 | .start = IRQ_DM365_EMAC_RXPULSE, | ||
571 | .end = IRQ_DM365_EMAC_RXPULSE, | ||
572 | .flags = IORESOURCE_IRQ, | ||
573 | }, | ||
574 | { | ||
575 | .start = IRQ_DM365_EMAC_TXPULSE, | ||
576 | .end = IRQ_DM365_EMAC_TXPULSE, | ||
577 | .flags = IORESOURCE_IRQ, | ||
578 | }, | ||
579 | { | ||
580 | .start = IRQ_DM365_EMAC_MISCPULSE, | ||
581 | .end = IRQ_DM365_EMAC_MISCPULSE, | ||
582 | .flags = IORESOURCE_IRQ, | ||
583 | }, | ||
584 | }; | ||
585 | |||
586 | static struct platform_device dm365_emac_device = { | ||
587 | .name = "davinci_emac", | ||
588 | .id = 1, | ||
589 | .dev = { | ||
590 | .platform_data = &dm365_emac_pdata, | ||
591 | }, | ||
592 | .num_resources = ARRAY_SIZE(dm365_emac_resources), | ||
593 | .resource = dm365_emac_resources, | ||
594 | }; | ||
549 | 595 | ||
550 | static u8 dm365_default_priorities[DAVINCI_N_AINTC_IRQ] = { | 596 | static u8 dm365_default_priorities[DAVINCI_N_AINTC_IRQ] = { |
551 | [IRQ_VDINT0] = 2, | 597 | [IRQ_VDINT0] = 2, |
@@ -702,6 +748,7 @@ static struct davinci_soc_info davinci_soc_info_dm365 = { | |||
702 | .gpio_num = 104, | 748 | .gpio_num = 104, |
703 | .gpio_irq = 44, | 749 | .gpio_irq = 44, |
704 | .serial_dev = &dm365_serial_device, | 750 | .serial_dev = &dm365_serial_device, |
751 | .emac_pdata = &dm365_emac_pdata, | ||
705 | .sram_dma = 0x00010000, | 752 | .sram_dma = 0x00010000, |
706 | .sram_len = SZ_32K, | 753 | .sram_len = SZ_32K, |
707 | }; | 754 | }; |
@@ -710,3 +757,14 @@ void __init dm365_init(void) | |||
710 | { | 757 | { |
711 | davinci_common_init(&davinci_soc_info_dm365); | 758 | davinci_common_init(&davinci_soc_info_dm365); |
712 | } | 759 | } |
760 | |||
761 | static int __init dm365_init_devices(void) | ||
762 | { | ||
763 | if (!cpu_is_davinci_dm365()) | ||
764 | return 0; | ||
765 | |||
766 | platform_device_register(&dm365_emac_device); | ||
767 | |||
768 | return 0; | ||
769 | } | ||
770 | postcore_initcall(dm365_init_devices); | ||