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: 112440 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A666FB6F67 for ; Wed, 31 Aug 2011 13:50:56 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752300Ab1HaDu4 (ORCPT ); Tue, 30 Aug 2011 23:50:56 -0400 Received: from ch1ehsobe002.messaging.microsoft.com ([216.32.181.182]:33589 "EHLO ch1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752202Ab1HaDuz (ORCPT ); Tue, 30 Aug 2011 23:50:55 -0400 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 Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org 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)