From patchwork Fri Jul 17 22:17:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 36133 Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6HMOpdP007500 for ; Fri, 17 Jul 2009 22:24:52 GMT Received: from dlep35.itg.ti.com ([157.170.170.118]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id n6HMNDqk029547; Fri, 17 Jul 2009 17:23:18 -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 n6HMNCms020195; Fri, 17 Jul 2009 17:23:12 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id A093F8079A; Fri, 17 Jul 2009 17:22:55 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id 172608062A for ; Fri, 17 Jul 2009 17:19:12 -0500 (CDT) Received: from neches.ext.ti.com (localhost [127.0.0.1]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id n6HMJBU3005599 for ; Fri, 17 Jul 2009 17:19:11 -0500 (CDT) Received: from mail157-wa4-R.bigfish.com (mail-wa4.bigfish.com [216.32.181.114]) by neches.ext.ti.com (8.13.7/8.13.7) with ESMTP id n6HMJ6BZ011437 for ; Fri, 17 Jul 2009 17:19:11 -0500 Received: from mail157-wa4 (localhost.localdomain [127.0.0.1]) by mail157-wa4-R.bigfish.com (Postfix) with ESMTP id 70C7417C819A for ; Fri, 17 Jul 2009 22:19:06 +0000 (UTC) X-SpamScore: 0 X-BigFish: vps0(zzzz1202hzzz2dh62h) X-Spam-TCS-SCL: 1:0 X-MS-Exchange-Organization-Antispam-Report: OrigIP: 209.85.221.174; Service: EHS Received: by mail157-wa4 (MessageSwitch) id 1247869116545997_32410; Fri, 17 Jul 2009 22:18:36 +0000 (UCT) Received: from mail-qy0-f174.google.com (mail-qy0-f174.google.com [209.85.221.174]) by mail157-wa4.bigfish.com (Postfix) with ESMTP id 5EE737A0051 for ; Fri, 17 Jul 2009 22:18:29 +0000 (UTC) Received: by mail-qy0-f174.google.com with SMTP id 4so947622qyk.4 for ; Fri, 17 Jul 2009 15:18:29 -0700 (PDT) Received: by 10.224.45.137 with SMTP id e9mr1088337qaf.347.1247869109218; Fri, 17 Jul 2009 15:18:29 -0700 (PDT) Received: from localhost (deeprooted.net [216.254.16.51]) by mx.google.com with ESMTPS id 26sm2365594qwa.57.2009.07.17.15.18.27 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 17 Jul 2009 15:18:28 -0700 (PDT) From: Kevin Hilman To: linux-arm-kernel@lists.arm.linux.org.uk Date: Fri, 17 Jul 2009 15:17:38 -0700 Message-Id: <1247869060-10719-16-git-send-email-khilman@deeprootsystems.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1247869060-10719-15-git-send-email-khilman@deeprootsystems.com> References: <1247869060-10719-1-git-send-email-khilman@deeprootsystems.com> <1247869060-10719-2-git-send-email-khilman@deeprootsystems.com> <1247869060-10719-3-git-send-email-khilman@deeprootsystems.com> <1247869060-10719-4-git-send-email-khilman@deeprootsystems.com> <1247869060-10719-5-git-send-email-khilman@deeprootsystems.com> <1247869060-10719-6-git-send-email-khilman@deeprootsystems.com> <1247869060-10719-7-git-send-email-khilman@deeprootsystems.com> <1247869060-10719-8-git-send-email-khilman@deeprootsystems.com> <1247869060-10719-9-git-send-email-khilman@deeprootsystems.com> <1247869060-10719-10-git-send-email-khilman@deeprootsystems.com> <1247869060-10719-11-git-send-email-khilman@deeprootsystems.com> <1247869060-10719-12-git-send-email-khilman@deeprootsystems.com> <1247869060-10719-13-git-send-email-khilman@deeprootsystems.com> <1247869060-10719-14-git-send-email-khilman@deeprootsystems.com> <1247869060-10719-15-git-send-email-khilman@deeprootsystems.com> Cc: davinci-linux-open-source@linux.davincidsp.com Subject: [PATCH 15/17] 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 From: Hemant Pedanekar 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 Signed-off-by: Kevin Hilman --- arch/arm/mach-davinci/board-dm646x-evm.c | 59 ++++++++++++++++++++++++++++++ 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 575c6ca..240fd4b 100644 --- a/arch/arm/mach-davinci/board-dm646x-evm.c +++ b/arch/arm/mach-davinci/board-dm646x-evm.c @@ -49,6 +49,17 @@ #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 + +/* CPLD Register 0 bits to control ATA */ +#define DM646X_EVM_ATA_RST BIT(0) +#define DM646X_EVM_ATA_PWD BIT(1) + #define DM646X_EVM_PHY_MASK (0x2) #define DM646X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */ @@ -56,6 +67,47 @@ static struct davinci_uart_config uart_config __initdata = { .enabled_uarts = (1 << 0), }; +/* CPLD Register 0 Client: used for I/O Control */ +static int cpld_reg0_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + if (HAS_ATA) { + u8 data; + struct i2c_msg msg[2] = { + { + .addr = client->addr, + .flags = I2C_M_RD, + .len = 1, + .buf = &data, + }, + { + .addr = client->addr, + .flags = 0, + .len = 1, + .buf = &data, + }, + }; + + /* Clear ATA_RSTn and ATA_PWD bits to enable ATA operation. */ + i2c_transfer(client->adapter, msg, 1); + data &= ~(DM646X_EVM_ATA_RST | DM646X_EVM_ATA_PWD); + i2c_transfer(client->adapter, msg + 1, 1); + } + + 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, +}; + /* LEDS */ static struct gpio_led evm_leds[] = { @@ -247,6 +299,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 +312,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 +330,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; }