aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorHemant Pedanekar <hemantp@ti.com>2009-07-17 14:00:36 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2009-08-26 04:55:47 -0400
commit548197bdf02882db39b7563d26975e7549e6af03 (patch)
tree91eb24de0050eadc8ababbbb0124eb7b9cbeba3e /arch
parent10a1af384e8157fa2e3275d68346cceff1ad06ca (diff)
davinci: dm646x-evm: Add support for IDE
Controls ATA_RSTn and ATA_PWD through CPLD register 0 to enable ATA. An I2C driver is added for the same. Calls ide init if enabled in configuration. Signed-off-by: Hemant Pedanekar <hemantp@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-davinci/board-dm646x-evm.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index 0aa18df4110f..fa91520532ac 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -48,6 +48,17 @@
48#include <mach/mmc.h> 48#include <mach/mmc.h>
49#include <mach/emac.h> 49#include <mach/emac.h>
50 50
51#if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \
52 defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE)
53#define HAS_ATA 1
54#else
55#define HAS_ATA 0
56#endif
57
58/* CPLD Register 0 bits to control ATA */
59#define DM646X_EVM_ATA_RST BIT(0)
60#define DM646X_EVM_ATA_PWD BIT(1)
61
51#define DM646X_EVM_PHY_MASK (0x2) 62#define DM646X_EVM_PHY_MASK (0x2)
52#define DM646X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */ 63#define DM646X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */
53 64
@@ -55,6 +66,47 @@ static struct davinci_uart_config uart_config __initdata = {
55 .enabled_uarts = (1 << 0), 66 .enabled_uarts = (1 << 0),
56}; 67};
57 68
69/* CPLD Register 0 Client: used for I/O Control */
70static int cpld_reg0_probe(struct i2c_client *client,
71 const struct i2c_device_id *id)
72{
73 if (HAS_ATA) {
74 u8 data;
75 struct i2c_msg msg[2] = {
76 {
77 .addr = client->addr,
78 .flags = I2C_M_RD,
79 .len = 1,
80 .buf = &data,
81 },
82 {
83 .addr = client->addr,
84 .flags = 0,
85 .len = 1,
86 .buf = &data,
87 },
88 };
89
90 /* Clear ATA_RSTn and ATA_PWD bits to enable ATA operation. */
91 i2c_transfer(client->adapter, msg, 1);
92 data &= ~(DM646X_EVM_ATA_RST | DM646X_EVM_ATA_PWD);
93 i2c_transfer(client->adapter, msg + 1, 1);
94 }
95
96 return 0;
97}
98
99static const struct i2c_device_id cpld_reg_ids[] = {
100 { "cpld_reg0", 0, },
101 { },
102};
103
104static struct i2c_driver dm6467evm_cpld_driver = {
105 .driver.name = "cpld_reg0",
106 .id_table = cpld_reg_ids,
107 .probe = cpld_reg0_probe,
108};
109
58/* LEDS */ 110/* LEDS */
59 111
60static struct gpio_led evm_leds[] = { 112static struct gpio_led evm_leds[] = {
@@ -246,6 +298,9 @@ static struct i2c_board_info __initdata i2c_info[] = {
246 I2C_BOARD_INFO("pcf8574a", 0x38), 298 I2C_BOARD_INFO("pcf8574a", 0x38),
247 .platform_data = &pcf_data, 299 .platform_data = &pcf_data,
248 }, 300 },
301 {
302 I2C_BOARD_INFO("cpld_reg0", 0x3a),
303 },
249}; 304};
250 305
251static struct davinci_i2c_platform_data i2c_pdata = { 306static struct davinci_i2c_platform_data i2c_pdata = {
@@ -256,6 +311,7 @@ static struct davinci_i2c_platform_data i2c_pdata = {
256static void __init evm_init_i2c(void) 311static void __init evm_init_i2c(void)
257{ 312{
258 davinci_init_i2c(&i2c_pdata); 313 davinci_init_i2c(&i2c_pdata);
314 i2c_add_driver(&dm6467evm_cpld_driver);
259 i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info)); 315 i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info));
260} 316}
261 317
@@ -273,6 +329,9 @@ static __init void evm_init(void)
273 dm646x_init_mcasp0(&dm646x_evm_snd_data[0]); 329 dm646x_init_mcasp0(&dm646x_evm_snd_data[0]);
274 dm646x_init_mcasp1(&dm646x_evm_snd_data[1]); 330 dm646x_init_mcasp1(&dm646x_evm_snd_data[1]);
275 331
332 if (HAS_ATA)
333 dm646x_init_ide();
334
276 soc_info->emac_pdata->phy_mask = DM646X_EVM_PHY_MASK; 335 soc_info->emac_pdata->phy_mask = DM646X_EVM_PHY_MASK;
277 soc_info->emac_pdata->mdio_max_freq = DM646X_EVM_MDIO_FREQUENCY; 336 soc_info->emac_pdata->mdio_max_freq = DM646X_EVM_MDIO_FREQUENCY;
278} 337}