hc
2024-05-10 ee930fffee469d076998274a2ca55e13dc1efb67
kernel/drivers/ata/ahci_imx.c
....@@ -1,20 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * copyright (c) 2013 Freescale Semiconductor, Inc.
34 * Freescale IMX AHCI SATA platform driver
45 *
56 * based on the AHCI SATA platform driver by Jeff Garzik and Anton Vorontsov
6
- *
7
- * This program is free software; you can redistribute it and/or modify it
8
- * under the terms and conditions of the GNU General Public License,
9
- * version 2, as published by the Free Software Foundation.
10
- *
11
- * This program is distributed in the hope it will be useful, but WITHOUT
12
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14
- * more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along with
17
- * this program. If not, see <http://www.gnu.org/licenses/>.
187 */
198
209 #include <linux/kernel.h>
....@@ -22,8 +11,8 @@
2211 #include <linux/platform_device.h>
2312 #include <linux/regmap.h>
2413 #include <linux/ahci_platform.h>
14
+#include <linux/gpio/consumer.h>
2515 #include <linux/of_device.h>
26
-#include <linux/of_gpio.h>
2716 #include <linux/mfd/syscon.h>
2817 #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
2918 #include <linux/libata.h>
....@@ -111,7 +100,7 @@
111100 struct clk *phy_pclk0;
112101 struct clk *phy_pclk1;
113102 void __iomem *phy_base;
114
- int clkreq_gpio;
103
+ struct gpio_desc *clkreq_gpiod;
115104 struct regmap *gpr;
116105 bool no_device;
117106 bool first_time;
....@@ -793,7 +782,7 @@
793782 struct ata_host *host = dev_get_drvdata(ap->dev);
794783 struct ahci_host_priv *hpriv = host->private_data;
795784 struct imx_ahci_priv *imxpriv = hpriv->plat_data;
796
- int ret = -EIO;
785
+ int ret;
797786
798787 if (imxpriv->type == AHCI_IMX53)
799788 ret = ahci_pmp_retry_srst_ops.softreset(link, class, deadline);
....@@ -991,7 +980,6 @@
991980
992981 static int imx8_sata_probe(struct device *dev, struct imx_ahci_priv *imxpriv)
993982 {
994
- int ret;
995983 struct resource *phy_res;
996984 struct platform_device *pdev = imxpriv->ahci_pdev;
997985 struct device_node *np = dev->of_node;
....@@ -1044,20 +1032,12 @@
10441032 }
10451033
10461034 /* Fetch GPIO, then enable the external OSC */
1047
- imxpriv->clkreq_gpio = of_get_named_gpio(np, "clkreq-gpio", 0);
1048
- if (gpio_is_valid(imxpriv->clkreq_gpio)) {
1049
- ret = devm_gpio_request_one(dev, imxpriv->clkreq_gpio,
1050
- GPIOF_OUT_INIT_LOW,
1051
- "SATA CLKREQ");
1052
- if (ret == -EBUSY) {
1053
- dev_info(dev, "clkreq had been initialized.\n");
1054
- } else if (ret) {
1055
- dev_err(dev, "%d unable to get clkreq.\n", ret);
1056
- return ret;
1057
- }
1058
- } else if (imxpriv->clkreq_gpio == -EPROBE_DEFER) {
1059
- return imxpriv->clkreq_gpio;
1060
- }
1035
+ imxpriv->clkreq_gpiod = devm_gpiod_get_optional(dev, "clkreq",
1036
+ GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);
1037
+ if (IS_ERR(imxpriv->clkreq_gpiod))
1038
+ return PTR_ERR(imxpriv->clkreq_gpiod);
1039
+ if (imxpriv->clkreq_gpiod)
1040
+ gpiod_set_consumer_name(imxpriv->clkreq_gpiod, "SATA CLKREQ");
10611041
10621042 return 0;
10631043 }
....@@ -1250,4 +1230,4 @@
12501230 MODULE_DESCRIPTION("Freescale i.MX AHCI SATA platform driver");
12511231 MODULE_AUTHOR("Richard Zhu <Hong-Xing.Zhu@freescale.com>");
12521232 MODULE_LICENSE("GPL");
1253
-MODULE_ALIAS("ahci:imx");
1233
+MODULE_ALIAS("platform:" DRV_NAME);