From patchwork Wed Aug 31 03:50:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Zhu X-Patchwork-Id: 3807 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id A0D5923F36 for ; Wed, 31 Aug 2011 03:50:57 +0000 (UTC) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 9074EA18230 for ; Wed, 31 Aug 2011 03:50:57 +0000 (UTC) Received: by mail-bw0-f52.google.com with SMTP id zs2so508213bkb.11 for ; Tue, 30 Aug 2011 20:50:57 -0700 (PDT) Received: by 10.223.4.133 with SMTP id 5mr10098052far.81.1314762657314; Tue, 30 Aug 2011 20:50:57 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.11.8 with SMTP id m8cs5542lab; Tue, 30 Aug 2011 20:50:56 -0700 (PDT) Received: by 10.220.116.13 with SMTP id k13mr1701656vcq.245.1314762655973; Tue, 30 Aug 2011 20:50:55 -0700 (PDT) Received: from ch1outboundpool.messaging.microsoft.com (ch1ehsobe005.messaging.microsoft.com [216.32.181.185]) by mx.google.com with ESMTPS id k5si4112785vck.95.2011.08.30.20.50.55 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 30 Aug 2011 20:50:55 -0700 (PDT) Received-SPF: neutral (google.com: 216.32.181.185 is neither permitted nor denied by best guess record for domain of richard.zhu@linaro.org) client-ip=216.32.181.185; Authentication-Results: mx.google.com; spf=neutral (google.com: 216.32.181.185 is neither permitted nor denied by best guess record for domain of richard.zhu@linaro.org) smtp.mail=richard.zhu@linaro.org Received: from mail172-ch1-R.bigfish.com (216.32.181.173) by CH1EHSOBE003.bigfish.com (10.43.70.53) with Microsoft SMTP Server id 14.1.225.22; Wed, 31 Aug 2011 03:50:55 +0000 Received: from mail172-ch1 (localhost.localdomain [127.0.0.1]) by mail172-ch1-R.bigfish.com (Postfix) with ESMTP id 0C1961C68128; Wed, 31 Aug 2011 03:50:55 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275dhz2dh87h2a8h668h839h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-FB-DOMAIN-IP-MATCH: fail Received: from mail172-ch1 (localhost.localdomain [127.0.0.1]) by mail172-ch1 (MessageSwitch) id 1314762654803975_29615; Wed, 31 Aug 2011 03:50:54 +0000 (UTC) Received: from CH1EHSMHS002.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.251]) by mail172-ch1.bigfish.com (Postfix) with ESMTP id BCC5D84804B; Wed, 31 Aug 2011 03:50:54 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS002.bigfish.com (10.43.70.2) with Microsoft SMTP Server (TLS) id 14.1.225.22; Wed, 31 Aug 2011 03:50:54 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server id 14.1.323.2; Tue, 30 Aug 2011 22:50:53 -0500 Received: from x-VirtualBox.ap.freescale.net (x-VirtualBox.ap.freescale.net [10.192.242.136]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id p7V3oY5d019818; Tue, 30 Aug 2011 22:50:50 -0500 (CDT) From: Richard Zhu To: CC: , , , , , , Richard Zhu Subject: [PATCH V7 5/5] MX53 Enable the AHCI SATA on MX53 SMD board Date: Wed, 31 Aug 2011 11:50:35 +0800 Message-ID: <1314762635-3923-6-git-send-email-richard.zhu@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1314762635-3923-1-git-send-email-richard.zhu@linaro.org> References: <1314762635-3923-1-git-send-email-richard.zhu@linaro.org> MIME-Version: 1.0 X-OriginatorOrg: sigmatel.com Signed-off-by: Richard Zhu --- arch/arm/mach-mx5/board-mx53_smd.c | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-mx5/board-mx53_smd.c b/arch/arm/mach-mx5/board-mx53_smd.c index bc02894..3005c7c 100644 --- a/arch/arm/mach-mx5/board-mx53_smd.c +++ b/arch/arm/mach-mx5/board-mx53_smd.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -35,6 +36,7 @@ #include "devices-imx53.h" #define SMD_FEC_PHY_RST IMX_GPIO_NR(7, 6) +#define MX53_SMD_SATA_PWR_EN IMX_GPIO_NR(3, 3) static iomux_v3_cfg_t mx53_smd_pads[] = { MX53_PAD_CSI0_DAT10__UART1_TXD_MUX, @@ -111,6 +113,35 @@ static const struct imxi2c_platform_data mx53_smd_i2c_data __initconst = { .bitrate = 100000, }; +static int mx53_smd_sata_init(struct device *dev, void __iomem *addr) +{ + int ret; + + /* Enable SATA PWR */ + ret = gpio_request(MX53_SMD_SATA_PWR_EN, "ahci-sata-pwr"); + if (ret) { + printk(KERN_ERR "failed to get SATA_PWR_EN: %d\n", ret); + return ret; + } + gpio_direction_output(MX53_SMD_SATA_PWR_EN, 1); + + return sata_init(dev, addr); +} + +void mx53_smd_sata_exit(struct device *dev) +{ + sata_exit(dev); + + /* Disable SATA PWR */ + gpio_direction_output(MX53_SMD_SATA_PWR_EN, 0); + gpio_free(MX53_SMD_SATA_PWR_EN); +} + +static struct ahci_platform_data sata_data = { + .init = mx53_smd_sata_init, + .exit = mx53_smd_sata_exit, +}; + static void __init mx53_smd_board_init(void) { imx53_soc_init(); @@ -125,6 +156,7 @@ static void __init mx53_smd_board_init(void) imx53_add_sdhci_esdhc_imx(0, NULL); imx53_add_sdhci_esdhc_imx(1, NULL); imx53_add_sdhci_esdhc_imx(2, NULL); + imx53_add_ahci_imx(0, &sata_data); } static void __init mx53_smd_timer_init(void)