aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-09-07 01:41:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-07 01:41:21 -0400
commit3b9f8ed25dbe5f858b1331588929f2a766aef55f (patch)
treee577ceebaef76c7c6a38b471af19f8a3fd8cb659
parent608c1d3c17e9e0e87dae69b9bb78f0556006ee6e (diff)
parent795ef788145ed2fa023efdf11e8d5d7bedc21462 (diff)
Merge branch 'for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata
Pull libata updates from Tejun Heo: "Except for the ahci fix that fixes a boot issue, nothing major in this pull request. Some new platform controller support and device specific changes" * 'for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: libata: zpodd: make arrays cdb static, reduces object code size ahci: don't use MSI for devices with the silly Intel NVMe remapping scheme dt-bindings: ata: add DT bindings for MediaTek SATA controller ata: mediatek: add support for MediaTek SATA controller pata_octeon_cf: use of_property_read_{bool|u32}() cs5536: add support for IDE controller variant ata: sata_gemini: Introduce explicit IDE pin control ata: sata_gemini: Retire custom pin control ata: ahci_platform: Add shutdown handler ata: sata_gemini: explicitly request exclusive reset control ata: Drop unnecessary static ata: Convert to using %pOF instead of full_name
-rw-r--r--Documentation/devicetree/bindings/ata/ahci-mtk.txt51
-rw-r--r--drivers/ata/Kconfig10
-rw-r--r--drivers/ata/Makefile1
-rw-r--r--drivers/ata/ahci.c9
-rw-r--r--drivers/ata/ahci_mtk.c196
-rw-r--r--drivers/ata/ahci_platform.c1
-rw-r--r--drivers/ata/libahci_platform.c34
-rw-r--r--drivers/ata/libata-zpodd.c4
-rw-r--r--drivers/ata/pata_amd.c1
-rw-r--r--drivers/ata/pata_cs5536.c1
-rw-r--r--drivers/ata/pata_octeon_cf.c10
-rw-r--r--drivers/ata/sata_gemini.c67
-rw-r--r--drivers/ata/sata_svw.c2
-rw-r--r--include/linux/ahci_platform.h2
-rw-r--r--include/linux/pci_ids.h1
15 files changed, 347 insertions, 43 deletions
diff --git a/Documentation/devicetree/bindings/ata/ahci-mtk.txt b/Documentation/devicetree/bindings/ata/ahci-mtk.txt
new file mode 100644
index 000000000000..d2aa696b161b
--- /dev/null
+++ b/Documentation/devicetree/bindings/ata/ahci-mtk.txt
@@ -0,0 +1,51 @@
1MediaTek Serial ATA controller
2
3Required properties:
4 - compatible : Must be "mediatek,<chip>-ahci", "mediatek,mtk-ahci".
5 When using "mediatek,mtk-ahci" compatible strings, you
6 need SoC specific ones in addition, one of:
7 - "mediatek,mt7622-ahci"
8 - reg : Physical base addresses and length of register sets.
9 - interrupts : Interrupt associated with the SATA device.
10 - interrupt-names : Associated name must be: "hostc".
11 - clocks : A list of phandle and clock specifier pairs, one for each
12 entry in clock-names.
13 - clock-names : Associated names must be: "ahb", "axi", "asic", "rbc", "pm".
14 - phys : A phandle and PHY specifier pair for the PHY port.
15 - phy-names : Associated name must be: "sata-phy".
16 - ports-implemented : See ./ahci-platform.txt for details.
17
18Optional properties:
19 - power-domains : A phandle and power domain specifier pair to the power
20 domain which is responsible for collapsing and restoring
21 power to the peripheral.
22 - resets : Must contain an entry for each entry in reset-names.
23 See ../reset/reset.txt for details.
24 - reset-names : Associated names must be: "axi", "sw", "reg".
25 - mediatek,phy-mode : A phandle to the system controller, used to enable
26 SATA function.
27
28Example:
29
30 sata: sata@1a200000 {
31 compatible = "mediatek,mt7622-ahci",
32 "mediatek,mtk-ahci";
33 reg = <0 0x1a200000 0 0x1100>;
34 interrupts = <GIC_SPI 233 IRQ_TYPE_LEVEL_HIGH>;
35 interrupt-names = "hostc";
36 clocks = <&pciesys CLK_SATA_AHB_EN>,
37 <&pciesys CLK_SATA_AXI_EN>,
38 <&pciesys CLK_SATA_ASIC_EN>,
39 <&pciesys CLK_SATA_RBC_EN>,
40 <&pciesys CLK_SATA_PM_EN>;
41 clock-names = "ahb", "axi", "asic", "rbc", "pm";
42 phys = <&u3port1 PHY_TYPE_SATA>;
43 phy-names = "sata-phy";
44 ports-implemented = <0x1>;
45 power-domains = <&scpsys MT7622_POWER_DOMAIN_HIF0>;
46 resets = <&pciesys MT7622_SATA_AXI_BUS_RST>,
47 <&pciesys MT7622_SATA_PHY_SW_RST>,
48 <&pciesys MT7622_SATA_PHY_REG_RST>;
49 reset-names = "axi", "sw", "reg";
50 mediatek,phy-mode = <&pciesys>;
51 };
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 363fc5330c21..488c93724220 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -153,6 +153,16 @@ config AHCI_CEVA
153 153
154 If unsure, say N. 154 If unsure, say N.
155 155
156config AHCI_MTK
157 tristate "MediaTek AHCI SATA support"
158 depends on ARCH_MEDIATEK
159 select MFD_SYSCON
160 help
161 This option enables support for the MediaTek SoC's
162 onboard AHCI SATA controller.
163
164 If unsure, say N.
165
156config AHCI_MVEBU 166config AHCI_MVEBU
157 tristate "Marvell EBU AHCI SATA support" 167 tristate "Marvell EBU AHCI SATA support"
158 depends on ARCH_MVEBU 168 depends on ARCH_MVEBU
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index a26ef5a93919..ff9cd2e37458 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_AHCI_CEVA) += ahci_ceva.o libahci.o libahci_platform.o
17obj-$(CONFIG_AHCI_DA850) += ahci_da850.o libahci.o libahci_platform.o 17obj-$(CONFIG_AHCI_DA850) += ahci_da850.o libahci.o libahci_platform.o
18obj-$(CONFIG_AHCI_DM816) += ahci_dm816.o libahci.o libahci_platform.o 18obj-$(CONFIG_AHCI_DM816) += ahci_dm816.o libahci.o libahci_platform.o
19obj-$(CONFIG_AHCI_IMX) += ahci_imx.o libahci.o libahci_platform.o 19obj-$(CONFIG_AHCI_IMX) += ahci_imx.o libahci.o libahci_platform.o
20obj-$(CONFIG_AHCI_MTK) += ahci_mtk.o libahci.o libahci_platform.o
20obj-$(CONFIG_AHCI_MVEBU) += ahci_mvebu.o libahci.o libahci_platform.o 21obj-$(CONFIG_AHCI_MVEBU) += ahci_mvebu.o libahci.o libahci_platform.o
21obj-$(CONFIG_AHCI_OCTEON) += ahci_octeon.o 22obj-$(CONFIG_AHCI_OCTEON) += ahci_octeon.o
22obj-$(CONFIG_AHCI_SUNXI) += ahci_sunxi.o libahci.o libahci_platform.o 23obj-$(CONFIG_AHCI_SUNXI) += ahci_sunxi.o libahci.o libahci_platform.o
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 5a5fd0b404eb..cb9b0e9090e3 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1469,7 +1469,14 @@ static void ahci_remap_check(struct pci_dev *pdev, int bar,
1469 return; 1469 return;
1470 1470
1471 dev_warn(&pdev->dev, "Found %d remapped NVMe devices.\n", count); 1471 dev_warn(&pdev->dev, "Found %d remapped NVMe devices.\n", count);
1472 dev_warn(&pdev->dev, "Switch your BIOS from RAID to AHCI mode to use them.\n"); 1472 dev_warn(&pdev->dev,
1473 "Switch your BIOS from RAID to AHCI mode to use them.\n");
1474
1475 /*
1476 * Don't rely on the msi-x capability in the remap case,
1477 * share the legacy interrupt across ahci and remapped devices.
1478 */
1479 hpriv->flags |= AHCI_HFLAG_NO_MSI;
1473} 1480}
1474 1481
1475static int ahci_get_irq_vector(struct ata_host *host, int port) 1482static int ahci_get_irq_vector(struct ata_host *host, int port)
diff --git a/drivers/ata/ahci_mtk.c b/drivers/ata/ahci_mtk.c
new file mode 100644
index 000000000000..80854f71559a
--- /dev/null
+++ b/drivers/ata/ahci_mtk.c
@@ -0,0 +1,196 @@
1/*
2 * MeidaTek AHCI SATA driver
3 *
4 * Copyright (c) 2017 MediaTek Inc.
5 * Author: Ryder Lee <ryder.lee@mediatek.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <linux/ahci_platform.h>
18#include <linux/kernel.h>
19#include <linux/libata.h>
20#include <linux/mfd/syscon.h>
21#include <linux/module.h>
22#include <linux/platform_device.h>
23#include <linux/pm.h>
24#include <linux/regmap.h>
25#include <linux/reset.h>
26#include "ahci.h"
27
28#define DRV_NAME "ahci"
29
30#define SYS_CFG 0x14
31#define SYS_CFG_SATA_MSK GENMASK(31, 30)
32#define SYS_CFG_SATA_EN BIT(31)
33
34struct mtk_ahci_plat {
35 struct regmap *mode;
36 struct reset_control *axi_rst;
37 struct reset_control *sw_rst;
38 struct reset_control *reg_rst;
39};
40
41static const struct ata_port_info ahci_port_info = {
42 .flags = AHCI_FLAG_COMMON,
43 .pio_mask = ATA_PIO4,
44 .udma_mask = ATA_UDMA6,
45 .port_ops = &ahci_platform_ops,
46};
47
48static struct scsi_host_template ahci_platform_sht = {
49 AHCI_SHT(DRV_NAME),
50};
51
52static int mtk_ahci_platform_resets(struct ahci_host_priv *hpriv,
53 struct device *dev)
54{
55 struct mtk_ahci_plat *plat = hpriv->plat_data;
56 int err;
57
58 /* reset AXI bus and PHY part */
59 plat->axi_rst = devm_reset_control_get_optional_exclusive(dev, "axi");
60 if (PTR_ERR(plat->axi_rst) == -EPROBE_DEFER)
61 return PTR_ERR(plat->axi_rst);
62
63 plat->sw_rst = devm_reset_control_get_optional_exclusive(dev, "sw");
64 if (PTR_ERR(plat->sw_rst) == -EPROBE_DEFER)
65 return PTR_ERR(plat->sw_rst);
66
67 plat->reg_rst = devm_reset_control_get_optional_exclusive(dev, "reg");
68 if (PTR_ERR(plat->reg_rst) == -EPROBE_DEFER)
69 return PTR_ERR(plat->reg_rst);
70
71 err = reset_control_assert(plat->axi_rst);
72 if (err) {
73 dev_err(dev, "failed to assert AXI bus\n");
74 return err;
75 }
76
77 err = reset_control_assert(plat->sw_rst);
78 if (err) {
79 dev_err(dev, "failed to assert PHY digital part\n");
80 return err;
81 }
82
83 err = reset_control_assert(plat->reg_rst);
84 if (err) {
85 dev_err(dev, "failed to assert PHY register part\n");
86 return err;
87 }
88
89 err = reset_control_deassert(plat->reg_rst);
90 if (err) {
91 dev_err(dev, "failed to deassert PHY register part\n");
92 return err;
93 }
94
95 err = reset_control_deassert(plat->sw_rst);
96 if (err) {
97 dev_err(dev, "failed to deassert PHY digital part\n");
98 return err;
99 }
100
101 err = reset_control_deassert(plat->axi_rst);
102 if (err) {
103 dev_err(dev, "failed to deassert AXI bus\n");
104 return err;
105 }
106
107 return 0;
108}
109
110static int mtk_ahci_parse_property(struct ahci_host_priv *hpriv,
111 struct device *dev)
112{
113 struct mtk_ahci_plat *plat = hpriv->plat_data;
114 struct device_node *np = dev->of_node;
115
116 /* enable SATA function if needed */
117 if (of_find_property(np, "mediatek,phy-mode", NULL)) {
118 plat->mode = syscon_regmap_lookup_by_phandle(
119 np, "mediatek,phy-mode");
120 if (IS_ERR(plat->mode)) {
121 dev_err(dev, "missing phy-mode phandle\n");
122 return PTR_ERR(plat->mode);
123 }
124
125 regmap_update_bits(plat->mode, SYS_CFG, SYS_CFG_SATA_MSK,
126 SYS_CFG_SATA_EN);
127 }
128
129 of_property_read_u32(np, "ports-implemented", &hpriv->force_port_map);
130
131 return 0;
132}
133
134static int mtk_ahci_probe(struct platform_device *pdev)
135{
136 struct device *dev = &pdev->dev;
137 struct mtk_ahci_plat *plat;
138 struct ahci_host_priv *hpriv;
139 int err;
140
141 plat = devm_kzalloc(dev, sizeof(*plat), GFP_KERNEL);
142 if (!plat)
143 return -ENOMEM;
144
145 hpriv = ahci_platform_get_resources(pdev);
146 if (IS_ERR(hpriv))
147 return PTR_ERR(hpriv);
148
149 hpriv->plat_data = plat;
150
151 err = mtk_ahci_parse_property(hpriv, dev);
152 if (err)
153 return err;
154
155 err = mtk_ahci_platform_resets(hpriv, dev);
156 if (err)
157 return err;
158
159 err = ahci_platform_enable_resources(hpriv);
160 if (err)
161 return err;
162
163 err = ahci_platform_init_host(pdev, hpriv, &ahci_port_info,
164 &ahci_platform_sht);
165 if (err)
166 goto disable_resources;
167
168 return 0;
169
170disable_resources:
171 ahci_platform_disable_resources(hpriv);
172 return err;
173}
174
175static SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_platform_suspend,
176 ahci_platform_resume);
177
178static const struct of_device_id ahci_of_match[] = {
179 { .compatible = "mediatek,mtk-ahci", },
180 {},
181};
182MODULE_DEVICE_TABLE(of, ahci_of_match);
183
184static struct platform_driver mtk_ahci_driver = {
185 .probe = mtk_ahci_probe,
186 .remove = ata_platform_remove_one,
187 .driver = {
188 .name = DRV_NAME,
189 .of_match_table = ahci_of_match,
190 .pm = &ahci_pm_ops,
191 },
192};
193module_platform_driver(mtk_ahci_driver);
194
195MODULE_DESCRIPTION("MeidaTek SATA AHCI Driver");
196MODULE_LICENSE("GPL v2");
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index 62a04c8fb5c9..99f9a895a459 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -93,6 +93,7 @@ MODULE_DEVICE_TABLE(acpi, ahci_acpi_match);
93static struct platform_driver ahci_driver = { 93static struct platform_driver ahci_driver = {
94 .probe = ahci_probe, 94 .probe = ahci_probe,
95 .remove = ata_platform_remove_one, 95 .remove = ata_platform_remove_one,
96 .shutdown = ahci_platform_shutdown,
96 .driver = { 97 .driver = {
97 .name = DRV_NAME, 98 .name = DRV_NAME,
98 .of_match_table = ahci_of_match, 99 .of_match_table = ahci_of_match,
diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
index cd2eab6aa92e..a270a1173c8c 100644
--- a/drivers/ata/libahci_platform.c
+++ b/drivers/ata/libahci_platform.c
@@ -602,6 +602,40 @@ static void ahci_host_stop(struct ata_host *host)
602 ahci_platform_disable_resources(hpriv); 602 ahci_platform_disable_resources(hpriv);
603} 603}
604 604
605/**
606 * ahci_platform_shutdown - Disable interrupts and stop DMA for host ports
607 * @dev: platform device pointer for the host
608 *
609 * This function is called during system shutdown and performs the minimal
610 * deconfiguration required to ensure that an ahci_platform host cannot
611 * corrupt or otherwise interfere with a new kernel being started with kexec.
612 */
613void ahci_platform_shutdown(struct platform_device *pdev)
614{
615 struct ata_host *host = platform_get_drvdata(pdev);
616 struct ahci_host_priv *hpriv = host->private_data;
617 void __iomem *mmio = hpriv->mmio;
618 int i;
619
620 for (i = 0; i < host->n_ports; i++) {
621 struct ata_port *ap = host->ports[i];
622
623 /* Disable port interrupts */
624 if (ap->ops->freeze)
625 ap->ops->freeze(ap);
626
627 /* Stop the port DMA engines */
628 if (ap->ops->port_stop)
629 ap->ops->port_stop(ap);
630 }
631
632 /* Disable and clear host interrupts */
633 writel(readl(mmio + HOST_CTL) & ~HOST_IRQ_EN, mmio + HOST_CTL);
634 readl(mmio + HOST_CTL); /* flush */
635 writel(GENMASK(host->n_ports, 0), mmio + HOST_IRQ_STAT);
636}
637EXPORT_SYMBOL_GPL(ahci_platform_shutdown);
638
605#ifdef CONFIG_PM_SLEEP 639#ifdef CONFIG_PM_SLEEP
606/** 640/**
607 * ahci_platform_suspend_host - Suspend an ahci-platform host 641 * ahci_platform_suspend_host - Suspend an ahci-platform host
diff --git a/drivers/ata/libata-zpodd.c b/drivers/ata/libata-zpodd.c
index 8a01d09ac4db..23a62e4015d0 100644
--- a/drivers/ata/libata-zpodd.c
+++ b/drivers/ata/libata-zpodd.c
@@ -34,7 +34,7 @@ struct zpodd {
34static int eject_tray(struct ata_device *dev) 34static int eject_tray(struct ata_device *dev)
35{ 35{
36 struct ata_taskfile tf; 36 struct ata_taskfile tf;
37 const char cdb[] = { GPCMD_START_STOP_UNIT, 37 static const char cdb[] = { GPCMD_START_STOP_UNIT,
38 0, 0, 0, 38 0, 0, 0,
39 0x02, /* LoEj */ 39 0x02, /* LoEj */
40 0, 0, 0, 0, 0, 0, 0, 40 0, 0, 0, 0, 0, 0, 0,
@@ -55,7 +55,7 @@ static enum odd_mech_type zpodd_get_mech_type(struct ata_device *dev)
55 unsigned int ret; 55 unsigned int ret;
56 struct rm_feature_desc *desc = (void *)(buf + 8); 56 struct rm_feature_desc *desc = (void *)(buf + 8);
57 struct ata_taskfile tf; 57 struct ata_taskfile tf;
58 char cdb[] = { GPCMD_GET_CONFIGURATION, 58 static const char cdb[] = { GPCMD_GET_CONFIGURATION,
59 2, /* only 1 feature descriptor requested */ 59 2, /* only 1 feature descriptor requested */
60 0, 3, /* 3, removable medium feature */ 60 0, 3, /* 3, removable medium feature */
61 0, 0, 0,/* reserved */ 61 0, 0, 0,/* reserved */
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c
index 8d4d959a821c..8706533db57b 100644
--- a/drivers/ata/pata_amd.c
+++ b/drivers/ata/pata_amd.c
@@ -616,6 +616,7 @@ static const struct pci_device_id amd[] = {
616 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE), 8 }, 616 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE), 8 },
617 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE), 8 }, 617 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE), 8 },
618 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CS5536_IDE), 9 }, 618 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CS5536_IDE), 9 },
619 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CS5536_DEV_IDE), 9 },
619 620
620 { }, 621 { },
621}; 622};
diff --git a/drivers/ata/pata_cs5536.c b/drivers/ata/pata_cs5536.c
index 6c15a554efbe..dc1255294628 100644
--- a/drivers/ata/pata_cs5536.c
+++ b/drivers/ata/pata_cs5536.c
@@ -289,6 +289,7 @@ static int cs5536_init_one(struct pci_dev *dev, const struct pci_device_id *id)
289 289
290static const struct pci_device_id cs5536[] = { 290static const struct pci_device_id cs5536[] = {
291 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CS5536_IDE), }, 291 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CS5536_IDE), },
292 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CS5536_DEV_IDE), },
292 { }, 293 { },
293}; 294};
294 295
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
index 1ba03d6df951..d3d851b014a3 100644
--- a/drivers/ata/pata_octeon_cf.c
+++ b/drivers/ata/pata_octeon_cf.c
@@ -840,7 +840,6 @@ static int octeon_cf_probe(struct platform_device *pdev)
840 struct property *reg_prop; 840 struct property *reg_prop;
841 int n_addr, n_size, reg_len; 841 int n_addr, n_size, reg_len;
842 struct device_node *node; 842 struct device_node *node;
843 const void *prop;
844 void __iomem *cs0; 843 void __iomem *cs0;
845 void __iomem *cs1 = NULL; 844 void __iomem *cs1 = NULL;
846 struct ata_host *host; 845 struct ata_host *host;
@@ -850,7 +849,7 @@ static int octeon_cf_probe(struct platform_device *pdev)
850 void __iomem *base; 849 void __iomem *base;
851 struct octeon_cf_port *cf_port; 850 struct octeon_cf_port *cf_port;
852 int rv = -ENOMEM; 851 int rv = -ENOMEM;
853 852 u32 bus_width;
854 853
855 node = pdev->dev.of_node; 854 node = pdev->dev.of_node;
856 if (node == NULL) 855 if (node == NULL)
@@ -860,11 +859,10 @@ static int octeon_cf_probe(struct platform_device *pdev)
860 if (!cf_port) 859 if (!cf_port)
861 return -ENOMEM; 860 return -ENOMEM;
862 861
863 cf_port->is_true_ide = (of_find_property(node, "cavium,true-ide", NULL) != NULL); 862 cf_port->is_true_ide = of_property_read_bool(node, "cavium,true-ide");
864 863
865 prop = of_get_property(node, "cavium,bus-width", NULL); 864 if (of_property_read_u32(node, "cavium,bus-width", &bus_width) == 0)
866 if (prop) 865 is_16bit = (bus_width == 16);
867 is_16bit = (be32_to_cpup(prop) == 16);
868 else 866 else
869 is_16bit = false; 867 is_16bit = false;
870 868
diff --git a/drivers/ata/sata_gemini.c b/drivers/ata/sata_gemini.c
index 8c704523bae7..46950e0267e0 100644
--- a/drivers/ata/sata_gemini.c
+++ b/drivers/ata/sata_gemini.c
@@ -15,6 +15,7 @@
15#include <linux/of_device.h> 15#include <linux/of_device.h>
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/pinctrl/consumer.h>
18#include "sata_gemini.h" 19#include "sata_gemini.h"
19 20
20#define DRV_NAME "gemini_sata_bridge" 21#define DRV_NAME "gemini_sata_bridge"
@@ -43,17 +44,6 @@ struct sata_gemini {
43 struct clk *sata1_pclk; 44 struct clk *sata1_pclk;
44}; 45};
45 46
46/* Global IDE PAD Skew Control Register */
47#define GEMINI_GLOBAL_IDE_SKEW_CTRL 0x18
48#define GEMINI_IDE1_HOST_STROBE_DELAY_SHIFT 28
49#define GEMINI_IDE1_DEVICE_STROBE_DELAY_SHIFT 24
50#define GEMINI_IDE1_OUTPUT_IO_SKEW_SHIFT 20
51#define GEMINI_IDE1_INPUT_IO_SKEW_SHIFT 16
52#define GEMINI_IDE0_HOST_STROBE_DELAY_SHIFT 12
53#define GEMINI_IDE0_DEVICE_STROBE_DELAY_SHIFT 8
54#define GEMINI_IDE0_OUTPUT_IO_SKEW_SHIFT 4
55#define GEMINI_IDE0_INPUT_IO_SKEW_SHIFT 0
56
57/* Miscellaneous Control Register */ 47/* Miscellaneous Control Register */
58#define GEMINI_GLOBAL_MISC_CTRL 0x30 48#define GEMINI_GLOBAL_MISC_CTRL 0x30
59/* 49/*
@@ -91,8 +81,6 @@ struct sata_gemini {
91#define GEMINI_IDE_IOMUX_MODE2 (2 << 24) 81#define GEMINI_IDE_IOMUX_MODE2 (2 << 24)
92#define GEMINI_IDE_IOMUX_MODE3 (3 << 24) 82#define GEMINI_IDE_IOMUX_MODE3 (3 << 24)
93#define GEMINI_IDE_IOMUX_SHIFT (24) 83#define GEMINI_IDE_IOMUX_SHIFT (24)
94#define GEMINI_IDE_PADS_ENABLE BIT(4)
95#define GEMINI_PFLASH_PADS_DISABLE BIT(1)
96 84
97/* 85/*
98 * Registers directly controlling the PATA<->SATA adapters 86 * Registers directly controlling the PATA<->SATA adapters
@@ -274,14 +262,14 @@ static int gemini_sata_bridge_init(struct sata_gemini *sg)
274 return ret; 262 return ret;
275 } 263 }
276 264
277 sg->sata0_reset = devm_reset_control_get(dev, "sata0"); 265 sg->sata0_reset = devm_reset_control_get_exclusive(dev, "sata0");
278 if (IS_ERR(sg->sata0_reset)) { 266 if (IS_ERR(sg->sata0_reset)) {
279 dev_err(dev, "no SATA0 reset controller\n"); 267 dev_err(dev, "no SATA0 reset controller\n");
280 clk_disable_unprepare(sg->sata1_pclk); 268 clk_disable_unprepare(sg->sata1_pclk);
281 clk_disable_unprepare(sg->sata0_pclk); 269 clk_disable_unprepare(sg->sata0_pclk);
282 return PTR_ERR(sg->sata0_reset); 270 return PTR_ERR(sg->sata0_reset);
283 } 271 }
284 sg->sata1_reset = devm_reset_control_get(dev, "sata1"); 272 sg->sata1_reset = devm_reset_control_get_exclusive(dev, "sata1");
285 if (IS_ERR(sg->sata1_reset)) { 273 if (IS_ERR(sg->sata1_reset)) {
286 dev_err(dev, "no SATA1 reset controller\n"); 274 dev_err(dev, "no SATA1 reset controller\n");
287 clk_disable_unprepare(sg->sata1_pclk); 275 clk_disable_unprepare(sg->sata1_pclk);
@@ -300,17 +288,39 @@ static int gemini_sata_bridge_init(struct sata_gemini *sg)
300 return 0; 288 return 0;
301} 289}
302 290
291static int gemini_setup_ide_pins(struct device *dev)
292{
293 struct pinctrl *p;
294 struct pinctrl_state *ide_state;
295 int ret;
296
297 p = devm_pinctrl_get(dev);
298 if (IS_ERR(p))
299 return PTR_ERR(p);
300
301 ide_state = pinctrl_lookup_state(p, "ide");
302 if (IS_ERR(ide_state))
303 return PTR_ERR(ide_state);
304
305 ret = pinctrl_select_state(p, ide_state);
306 if (ret) {
307 dev_err(dev, "could not select IDE state\n");
308 return ret;
309 }
310
311 return 0;
312}
313
303static int gemini_sata_probe(struct platform_device *pdev) 314static int gemini_sata_probe(struct platform_device *pdev)
304{ 315{
305 struct device *dev = &pdev->dev; 316 struct device *dev = &pdev->dev;
306 struct device_node *np = dev->of_node; 317 struct device_node *np = dev->of_node;
307 struct sata_gemini *sg; 318 struct sata_gemini *sg;
308 static struct regmap *map; 319 struct regmap *map;
309 struct resource *res; 320 struct resource *res;
310 enum gemini_muxmode muxmode; 321 enum gemini_muxmode muxmode;
311 u32 gmode; 322 u32 gmode;
312 u32 gmask; 323 u32 gmask;
313 u32 val;
314 int ret; 324 int ret;
315 325
316 sg = devm_kzalloc(dev, sizeof(*sg), GFP_KERNEL); 326 sg = devm_kzalloc(dev, sizeof(*sg), GFP_KERNEL);
@@ -362,16 +372,6 @@ static int gemini_sata_probe(struct platform_device *pdev)
362 gmask = GEMINI_IDE_IOMUX_MASK; 372 gmask = GEMINI_IDE_IOMUX_MASK;
363 gmode = (muxmode << GEMINI_IDE_IOMUX_SHIFT); 373 gmode = (muxmode << GEMINI_IDE_IOMUX_SHIFT);
364 374
365 /*
366 * If we mux out the IDE, parallel flash must be disabled.
367 * SATA0 and SATA1 have dedicated pins and may coexist with
368 * parallel flash.
369 */
370 if (sg->ide_pins)
371 gmode |= GEMINI_IDE_PADS_ENABLE | GEMINI_PFLASH_PADS_DISABLE;
372 else
373 gmask |= GEMINI_IDE_PADS_ENABLE;
374
375 ret = regmap_update_bits(map, GEMINI_GLOBAL_MISC_CTRL, gmask, gmode); 375 ret = regmap_update_bits(map, GEMINI_GLOBAL_MISC_CTRL, gmask, gmode);
376 if (ret) { 376 if (ret) {
377 dev_err(dev, "unable to set up IDE muxing\n"); 377 dev_err(dev, "unable to set up IDE muxing\n");
@@ -379,14 +379,15 @@ static int gemini_sata_probe(struct platform_device *pdev)
379 goto out_unprep_clk; 379 goto out_unprep_clk;
380 } 380 }
381 381
382 /* FIXME: add more elaborate IDE skew control handling */ 382 /*
383 * Route out the IDE pins if desired.
384 * This is done by looking up a special pin control state called
385 * "ide" that will route out the IDE pins.
386 */
383 if (sg->ide_pins) { 387 if (sg->ide_pins) {
384 ret = regmap_read(map, GEMINI_GLOBAL_IDE_SKEW_CTRL, &val); 388 ret = gemini_setup_ide_pins(dev);
385 if (ret) { 389 if (ret)
386 dev_err(dev, "cannot read IDE skew control register\n");
387 return ret; 390 return ret;
388 }
389 dev_info(dev, "IDE skew control: %08x\n", val);
390 } 391 }
391 392
392 dev_info(dev, "set up the Gemini IDE/SATA nexus\n"); 393 dev_info(dev, "set up the Gemini IDE/SATA nexus\n");
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
index 0fd6ac7e57ba..a9d692c6c182 100644
--- a/drivers/ata/sata_svw.c
+++ b/drivers/ata/sata_svw.c
@@ -339,7 +339,7 @@ static int k2_sata_show_info(struct seq_file *m, struct Scsi_Host *shost)
339 if (!reg) 339 if (!reg)
340 continue; 340 continue;
341 if (index == *reg) { 341 if (index == *reg) {
342 seq_printf(m, "devspec: %s\n", np->full_name); 342 seq_printf(m, "devspec: %pOF\n", np);
343 break; 343 break;
344 } 344 }
345 } 345 }
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h
index a270f25ee7c7..1b0a17b22cd3 100644
--- a/include/linux/ahci_platform.h
+++ b/include/linux/ahci_platform.h
@@ -36,6 +36,8 @@ int ahci_platform_init_host(struct platform_device *pdev,
36 const struct ata_port_info *pi_template, 36 const struct ata_port_info *pi_template,
37 struct scsi_host_template *sht); 37 struct scsi_host_template *sht);
38 38
39void ahci_platform_shutdown(struct platform_device *pdev);
40
39int ahci_platform_suspend_host(struct device *dev); 41int ahci_platform_suspend_host(struct device *dev);
40int ahci_platform_resume_host(struct device *dev); 42int ahci_platform_resume_host(struct device *dev);
41int ahci_platform_suspend(struct device *dev); 43int ahci_platform_suspend(struct device *dev);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index c71e532da458..4adf6161ec77 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -576,6 +576,7 @@
576#define PCI_DEVICE_ID_AMD_CS5536_EHC 0x2095 576#define PCI_DEVICE_ID_AMD_CS5536_EHC 0x2095
577#define PCI_DEVICE_ID_AMD_CS5536_UDC 0x2096 577#define PCI_DEVICE_ID_AMD_CS5536_UDC 0x2096
578#define PCI_DEVICE_ID_AMD_CS5536_UOC 0x2097 578#define PCI_DEVICE_ID_AMD_CS5536_UOC 0x2097
579#define PCI_DEVICE_ID_AMD_CS5536_DEV_IDE 0x2092
579#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A 580#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A
580#define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081 581#define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081
581#define PCI_DEVICE_ID_AMD_LX_AES 0x2082 582#define PCI_DEVICE_ID_AMD_LX_AES 0x2082