From patchwork Thu Jan 31 17:33:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Pisati X-Patchwork-Id: 217223 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id C552C2C0079 for ; Fri, 1 Feb 2013 04:33:59 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1U0y1J-0003Ls-Dn; Thu, 31 Jan 2013 17:33:53 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1U0y1G-0003LU-HV for kernel-team@lists.ubuntu.com; Thu, 31 Jan 2013 17:33:50 +0000 Received: from 2-230-238-136.ip204.fastwebnet.it ([2.230.238.136] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1U0y1G-0007KM-Db for kernel-team@lists.ubuntu.com; Thu, 31 Jan 2013 17:33:50 +0000 From: Paolo Pisati To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/2] SAUCE: imx6: dts: Add IMX6Q AHCI support Date: Thu, 31 Jan 2013 18:33:47 +0100 Message-Id: <1359653627-14310-3-git-send-email-paolo.pisati@canonical.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359653627-14310-1-git-send-email-paolo.pisati@canonical.com> References: <1359653627-14310-1-git-send-email-paolo.pisati@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Allen Ibara Adds device tree node and ahci_platform bits to make AHCI work on sabrelite IMX6Q board. Signed-off-by: Allen Ibara Signed-off-by: Paolo Pisati --- arch/arm/boot/dts/imx6q-sabrelite.dts | 5 +++++ arch/arm/boot/dts/imx6q.dtsi | 8 ++++++++ drivers/ata/ahci_platform.c | 28 +++++++++++++++++++++------- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/arch/arm/boot/dts/imx6q-sabrelite.dts b/arch/arm/boot/dts/imx6q-sabrelite.dts index d152328..5740885 100644 --- a/arch/arm/boot/dts/imx6q-sabrelite.dts +++ b/arch/arm/boot/dts/imx6q-sabrelite.dts @@ -131,6 +131,11 @@ }; }; }; + + ahci@0x02200000 { /* AHCI SATA */ + status = "okay"; + }; + }; regulators { diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi index d6265ca..e0ca764 100644 --- a/arch/arm/boot/dts/imx6q.dtsi +++ b/arch/arm/boot/dts/imx6q.dtsi @@ -1056,5 +1056,13 @@ clocks = <&clks 133>, <&clks 134>, <&clks 137>; clock-names = "bus", "di0", "di1"; }; + + ahci@0x02200000 { /* AHCI SATA */ + compatible = "fsl,imx6q-ahci"; + reg = <0x02200000 0x4000>; + interrupts = <0 39 0x04>; + clocks = <&clks 154>; + status = "disabled"; + }; }; }; diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 7a8a284..7d22da2 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -23,6 +23,9 @@ #include #include #include +#include +#include +#include #include "ahci.h" static void ahci_host_stop(struct ata_host *host); @@ -30,6 +33,7 @@ static void ahci_host_stop(struct ata_host *host); enum ahci_type { AHCI, /* standard platform ahci */ IMX53_AHCI, /* ahci on i.mx53 */ + IMX6Q_AHCI, /* ahci on i.mx6q */ STRICT_AHCI, /* delayed DMA engine start */ }; @@ -41,6 +45,10 @@ static struct platform_device_id ahci_devtype[] = { .name = "imx53-ahci", .driver_data = IMX53_AHCI, }, { + }, { + .name = "imx6q-ahci", + .driver_data = IMX53_AHCI, + }, { .name = "strict-ahci", .driver_data = STRICT_AHCI, }, { @@ -86,12 +94,24 @@ static struct scsi_host_template ahci_platform_sht = { AHCI_SHT("ahci_platform"), }; +static const struct of_device_id ahci_of_match[] = { + { .compatible = "calxeda,hb-ahci", .data = &ahci_devtype[AHCI],}, + { .compatible = "fsl,imx6q-ahci", .data = &ahci_devtype[IMX6Q_AHCI],}, + { .compatible = "snps,spear-ahci", }, + {}, +}; +MODULE_DEVICE_TABLE(of, ahci_of_match); + static int ahci_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct ahci_platform_data *pdata = dev_get_platdata(dev); + const struct of_device_id *of_id = + of_match_device(ahci_of_match, &pdev->dev); + const struct platform_device_id *id_entry = of_id->data; const struct platform_device_id *id = platform_get_device_id(pdev); - struct ata_port_info pi = ahci_port_info[id ? id->driver_data : 0]; + struct ata_port_info pi = ahci_port_info[id ? id->driver_data : \ + id_entry->driver_data]; const struct ata_port_info *ppi[] = { &pi, NULL }; struct ahci_host_priv *hpriv; struct ata_host *host; @@ -325,12 +345,6 @@ disable_unprepare_clk: static SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_suspend, ahci_resume); -static const struct of_device_id ahci_of_match[] = { - { .compatible = "snps,spear-ahci", }, - {}, -}; -MODULE_DEVICE_TABLE(of, ahci_of_match); - static struct platform_driver ahci_driver = { .probe = ahci_probe, .remove = ata_platform_remove_one,