forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/drivers/ata/ahci_mvebu.c
....@@ -30,6 +30,7 @@
3030
3131 struct ahci_mvebu_plat_data {
3232 int (*plat_config)(struct ahci_host_priv *hpriv);
33
+ unsigned int flags;
3334 };
3435
3536 static void ahci_mvebu_mbus_config(struct ahci_host_priv *hpriv,
....@@ -80,6 +81,19 @@
8081 ahci_mvebu_regret_option(hpriv);
8182
8283 return rc;
84
+}
85
+
86
+static int ahci_mvebu_armada_3700_config(struct ahci_host_priv *hpriv)
87
+{
88
+ u32 reg;
89
+
90
+ writel(0, hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_ADDR);
91
+
92
+ reg = readl(hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_DATA);
93
+ reg |= BIT(6);
94
+ writel(reg, hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_DATA);
95
+
96
+ return 0;
8397 }
8498
8599 /**
....@@ -148,8 +162,7 @@
148162 struct ahci_host_priv *hpriv = host->private_data;
149163 const struct ahci_mvebu_plat_data *pdata = hpriv->plat_data;
150164
151
- if (pdata->plat_config)
152
- pdata->plat_config(hpriv);
165
+ pdata->plat_config(hpriv);
153166
154167 return ahci_platform_resume_host(&pdev->dev);
155168 }
....@@ -183,6 +196,7 @@
183196 if (IS_ERR(hpriv))
184197 return PTR_ERR(hpriv);
185198
199
+ hpriv->flags |= pdata->flags;
186200 hpriv->plat_data = (void *)pdata;
187201
188202 rc = ahci_platform_enable_resources(hpriv);
....@@ -191,12 +205,9 @@
191205
192206 hpriv->stop_engine = ahci_mvebu_stop_engine;
193207
194
- pdata = hpriv->plat_data;
195
- if (pdata->plat_config) {
196
- rc = pdata->plat_config(hpriv);
197
- if (rc)
198
- goto disable_resources;
199
- }
208
+ rc = pdata->plat_config(hpriv);
209
+ if (rc)
210
+ goto disable_resources;
200211
201212 rc = ahci_platform_init_host(pdev, hpriv, &ahci_mvebu_port_info,
202213 &ahci_platform_sht);
....@@ -215,7 +226,8 @@
215226 };
216227
217228 static const struct ahci_mvebu_plat_data ahci_mvebu_armada_3700_plat_data = {
218
- .plat_config = NULL,
229
+ .plat_config = ahci_mvebu_armada_3700_config,
230
+ .flags = AHCI_HFLAG_SUSPEND_PHYS | AHCI_HFLAG_IGN_NOTSUPP_POWER_ON,
219231 };
220232
221233 static const struct of_device_id ahci_mvebu_of_match[] = {
....@@ -231,11 +243,6 @@
231243 };
232244 MODULE_DEVICE_TABLE(of, ahci_mvebu_of_match);
233245
234
-/*
235
- * We currently don't provide power management related operations,
236
- * since there is no suspend/resume support at the platform level for
237
- * Armada 38x for the moment.
238
- */
239246 static struct platform_driver ahci_mvebu_driver = {
240247 .probe = ahci_mvebu_probe,
241248 .remove = ata_platform_remove_one,