From patchwork Wed Aug 26 11:05:15 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Subbrathnam, Swaminathan" X-Patchwork-Id: 43961 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 n7QActR5017312 for ; Wed, 26 Aug 2009 10:38:55 GMT Received: from dlep34.itg.ti.com ([157.170.170.115]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id n7QAadJs007878; Wed, 26 Aug 2009 05:36:44 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id n7QAadjO015733; Wed, 26 Aug 2009 05:36:39 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 6A85080627; Wed, 26 Aug 2009 05:36: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 DF38D80626 for ; Wed, 26 Aug 2009 05:36:34 -0500 (CDT) Received: from localhost.localdomain (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id n7QAaWUV025335; Wed, 26 Aug 2009 16:06:33 +0530 (IST) From: Swaminathan S To: davinci-linux-open-source@linux.davincidsp.com Date: Wed, 26 Aug 2009 16:35:15 +0530 Message-Id: <1251284715-14676-1-git-send-email-swami.iyer@ti.com> X-Mailer: git-send-email 1.6.0.rc1.64.g61192 Cc: Subject: [PATCH] Add platform Support for DM646x USB. 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 This patch adds platform support for USB controller on DM6467 platform. The patch sets up the clock, memory map, USB VBUS control logic. Signed-off-by: Swaminathan S --- arch/arm/mach-davinci/board-dm646x-evm.c | 34 ++++++++++++++++++++++++++++++ arch/arm/mach-davinci/dm646x.c | 7 ++++++ 2 files changed, 41 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c index 8c88fd0..aeb4641 100644 --- a/arch/arm/mach-davinci/board-dm646x-evm.c +++ b/arch/arm/mach-davinci/board-dm646x-evm.c @@ -59,6 +59,7 @@ /* CPLD Register 0 bits to control ATA */ #define DM646X_EVM_ATA_RST BIT(0) #define DM646X_EVM_ATA_PWD BIT(1) +#define DM646X_EVM_USB_VBUS BIT(7) #define DM646X_EVM_PHY_MASK (0x2) #define DM646X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */ @@ -80,10 +81,13 @@ static struct davinci_uart_config uart_config __initdata = { .enabled_uarts = (1 << 0), }; +static struct i2c_client *cpld_reg0_client; + /* CPLD Register 0 Client: used for I/O Control */ 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] = { @@ -107,9 +111,39 @@ static int cpld_reg0_probe(struct i2c_client *client, i2c_transfer(client->adapter, msg + 1, 1); } + setup_usb(500, 8); + return 0; } +void usb_vbus_control(u8 on) +{ + 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, + }, + }; + + i2c_transfer(cpld_reg0_client->adapter, msg, 1); + if (on) + data |= DM646X_EVM_USB_VBUS; + else + data &= ~DM646X_EVM_USB_VBUS; + + i2c_transfer(cpld_reg0_client->adapter, msg + 1, 1); +} +EXPORT_SYMBOL(usb_vbus_control); + static const struct i2c_device_id cpld_reg_ids[] = { { "cpld_reg0", 0, }, { }, diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c index a9b20e5..edfc22f 100644 --- a/arch/arm/mach-davinci/dm646x.c +++ b/arch/arm/mach-davinci/dm646x.c @@ -315,6 +315,12 @@ static struct clk vpif1_clk = { .flags = ALWAYS_ENABLED, }; +static struct clk usb_clk = { + .name = "usb", + .parent = &pll1_sysclk3, + .lpsc = DAVINCI_LPSC_USB, +}; + struct davinci_clk dm646x_clks[] = { CLK(NULL, "ref", &ref_clk), CLK(NULL, "aux", &aux_clkin), @@ -355,6 +361,7 @@ struct davinci_clk dm646x_clks[] = { CLK("palm_bk3710", NULL, &ide_clk), CLK(NULL, "vpif0", &vpif0_clk), CLK(NULL, "vpif1", &vpif1_clk), + CLK(NULL, "usb", &usb_clk), CLK(NULL, NULL, NULL), };