From patchwork Tue Aug 30 09:56:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Zhu X-Patchwork-Id: 3790 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 2B67F23F18 for ; Tue, 30 Aug 2011 09:58:28 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id 1FBD4A187C7 for ; Tue, 30 Aug 2011 09:58:28 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id 18so7692383fxd.11 for ; Tue, 30 Aug 2011 02:58:28 -0700 (PDT) Received: by 10.223.24.21 with SMTP id t21mr8687151fab.24.1314698308017; Tue, 30 Aug 2011 02:58:28 -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 m8cs129118lab; Tue, 30 Aug 2011 02:58:27 -0700 (PDT) Received: by 10.227.36.227 with SMTP id u35mr4825836wbd.83.1314698307515; Tue, 30 Aug 2011 02:58:27 -0700 (PDT) Received: from AM1EHSOBE002.bigfish.com (am1ehsobe002.messaging.microsoft.com [213.199.154.205]) by mx.google.com with ESMTPS id 1si11883925wbw.3.2011.08.30.02.58.27 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 30 Aug 2011 02:58:27 -0700 (PDT) Received-SPF: neutral (google.com: 213.199.154.205 is neither permitted nor denied by best guess record for domain of richard.zhu@linaro.org) client-ip=213.199.154.205; Authentication-Results: mx.google.com; spf=neutral (google.com: 213.199.154.205 is neither permitted nor denied by best guess record for domain of richard.zhu@linaro.org) smtp.mail=richard.zhu@linaro.org Received: from mail34-am1-R.bigfish.com (10.3.201.247) by AM1EHSOBE002.bigfish.com (10.3.204.22) with Microsoft SMTP Server id 14.1.225.22; Tue, 30 Aug 2011 09:58:26 +0000 Received: from mail34-am1 (localhost.localdomain [127.0.0.1]) by mail34-am1-R.bigfish.com (Postfix) with ESMTP id 8795D7081CA; Tue, 30 Aug 2011 09:58:26 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275dhz2dh87h2a8h668h839h62h) X-Spam-TCS-SCL: 1: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 mail34-am1 (localhost.localdomain [127.0.0.1]) by mail34-am1 (MessageSwitch) id 1314698271637106_4698; Tue, 30 Aug 2011 09:57:51 +0000 (UTC) Received: from AM1EHSMHS005.bigfish.com (unknown [10.3.201.251]) by mail34-am1.bigfish.com (Postfix) with ESMTP id E7C6EF980A7; Tue, 30 Aug 2011 09:56:34 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by AM1EHSMHS005.bigfish.com (10.3.207.105) with Microsoft SMTP Server (TLS) id 14.1.225.22; Tue, 30 Aug 2011 09:56:30 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server id 14.1.323.2; Tue, 30 Aug 2011 04:56:28 -0500 Received: from x-VirtualBox.ap.freescale.net (x-VirtualBox.ap.freescale.net [10.192.242.136]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id p7U9uC6w014049; Tue, 30 Aug 2011 04:56:25 -0500 (CDT) From: Richard Zhu To: CC: , , , , , , Richard Zhu Subject: [PATCH V7 5/5] MX53 Enable the AHCI SATA on MX53 SMD board Date: Tue, 30 Aug 2011 17:56:10 +0800 Message-ID: <1314698171-7937-5-git-send-email-richard.zhu@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1314698171-7937-1-git-send-email-richard.zhu@linaro.org> References: <1314698171-7937-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)