From patchwork Thu Jul 9 14:13:33 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Pedanekar X-Patchwork-Id: 34816 Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n69EFVMm015322 for ; Thu, 9 Jul 2009 14:15:32 GMT Received: from dlep35.itg.ti.com ([157.170.170.118]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id n69EDcXi023183; Thu, 9 Jul 2009 09:13:44 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id n69EDciE005530; Thu, 9 Jul 2009 09:13:38 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 853B180627; Thu, 9 Jul 2009 09:13:37 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dbdp31.itg.ti.com (dbdp31.itg.ti.com [172.24.170.98]) by linux.omap.com (Postfix) with ESMTP id 5980880626 for ; Thu, 9 Jul 2009 09:13:35 -0500 (CDT) Received: from psplinux051.india.ti.com (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id n69EDXoO029114; Thu, 9 Jul 2009 19:43:33 +0530 (IST) Received: from psplinux051.india.ti.com (localhost [127.0.0.1]) by psplinux051.india.ti.com (8.13.1/8.13.1) with ESMTP id n69EDXGa016444; Thu, 9 Jul 2009 19:43:33 +0530 Received: (from a0393588@localhost) by psplinux051.india.ti.com (8.13.1/8.13.1/Submit) id n69EDXoX016441; Thu, 9 Jul 2009 19:43:33 +0530 From: Hemant Pedanekar To: davinci-linux-open-source@linux.davincidsp.com Date: Thu, 9 Jul 2009 19:43:33 +0530 Message-Id: <1247148813-16412-1-git-send-email-hemantp@ti.com> X-Mailer: git-send-email 1.6.2.4 Cc: Subject: [PATCH v2 2/2] davinci: dm646x-evm: Add support for IDE X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.4 Precedence: list List-Id: davinci-linux-open-source.linux.davincidsp.com List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com 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 --- arch/arm/mach-davinci/board-dm646x-evm.c | 69 ++++++++++++++++++++++++++++++ 1 files changed, 69 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c index 575c6ca..86419fb 100644 --- a/arch/arm/mach-davinci/board-dm646x-evm.c +++ b/arch/arm/mach-davinci/board-dm646x-evm.c @@ -49,6 +49,13 @@ #include #include +#if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \ + defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE) +#define HAS_ATA 1 +#else +#define HAS_ATA 0 +#endif + #define DM646X_EVM_PHY_MASK (0x2) #define DM646X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */ @@ -56,6 +63,61 @@ static struct davinci_uart_config uart_config __initdata = { .enabled_uarts = (1 << 0), }; +/* CPLD Register 0: used for I/O Control */ +static struct i2c_client *cpld_reg0_client; + +static int cpld_reg0_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + cpld_reg0_client = client; + + if (HAS_ATA) { + u8 data; + struct i2c_msg msg[2] = { + { + .addr = cpld_reg0_client->addr, + .flags = I2C_M_RD, + .len = 1, + .buf = &data, + }, + { + .addr = cpld_reg0_client->addr, + .flags = 0, + .len = 1, + .buf = &data, + }, + }; + + /* + * Set ATA_RSTn (bit-0) and ATA_PWD (bit-1) to '0' for ATA + * operation. + */ + i2c_transfer(cpld_reg0_client->adapter, msg, 1); + data &= ~3; + i2c_transfer(cpld_reg0_client->adapter, msg + 1, 1); + } + + return 0; +} + +static int cpld_reg0_remove(struct i2c_client *client) +{ + cpld_reg0_client = NULL; + return 0; +} + +static const struct i2c_device_id cpld_reg_ids[] = { + { "cpld_reg0", 0, }, + { }, +}; + +static struct i2c_driver dm6467evm_cpld_driver = { + .driver.name = "cpld_reg0", + .id_table = cpld_reg_ids, + .probe = cpld_reg0_probe, + .remove = cpld_reg0_remove, +}; + /* LEDS */ static struct gpio_led evm_leds[] = { @@ -247,6 +309,9 @@ static struct i2c_board_info __initdata i2c_info[] = { I2C_BOARD_INFO("pcf8574a", 0x38), .platform_data = &pcf_data, }, + { + I2C_BOARD_INFO("cpld_reg0", 0x3a), + }, }; static struct davinci_i2c_platform_data i2c_pdata = { @@ -257,6 +322,7 @@ static struct davinci_i2c_platform_data i2c_pdata = { static void __init evm_init_i2c(void) { davinci_init_i2c(&i2c_pdata); + i2c_add_driver(&dm6467evm_cpld_driver); i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info)); } @@ -274,6 +340,9 @@ static __init void evm_init(void) dm646x_init_mcasp0(&dm646x_evm_snd_data[0]); dm646x_init_mcasp1(&dm646x_evm_snd_data[1]); + if (HAS_ATA) + dm646x_init_ide(); + soc_info->emac_pdata->phy_mask = DM646X_EVM_PHY_MASK; soc_info->emac_pdata->mdio_max_freq = DM646X_EVM_MDIO_FREQUENCY; }