Skip to content

Commit 51562cb

Browse files
committed
Merge tag 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
Pull libata changes from Jeff Garzik: "Minor libata updates, nothing notable. 1) Apply -- and then revert -- the FUA feature. Caused disk corruption in linux-next, proving it cannot be turned on by default. Net effect to upstream tree: zero 2) New AHCI platform driver sata_highbank 3) Improve SCSI MODE SENSE handling; support MODE SELECT 4) AHCI: support aggressive device sleep (power mgmt) 5) sata_fsl: minor fix 6) pata_arasan: clk support" * tag 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev: sata_mv: Fix warnings when no PCI [libata] Makefile: Fix build error in sata_highbank [libata] export ata_dev_set_feature() libata-core: use ATA_LBA in ata_build_rw_tf() ata/ahci_platform: Add clock framework support pata_arasan: add Device Tree probing capability pata_arasan: Add clk_{un}prepare() support ata: add platform driver for Calxeda AHCI controller sata_fsl: add workaround for data length mismatch on freescale V2 controller ahci: implement aggressive SATA device sleep support ata: define enum constants for IDENTIFY DEVICE Revert "libata: enable SATA disk fua detection on default" [libata] scsi: implement MODE SELECT command [libata] scsi: support MODE SENSE request for changeable and default parameters [libata] scsi: Remove unlikely() from FUA check libata: enable SATA disk fua detection on default
2 parents 7fe0b14 + 13b7408 commit 51562cb

File tree

19 files changed

+1025
-60
lines changed

19 files changed

+1025
-60
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Calxeda Highbank Combination Phys for SATA
2+
3+
Properties:
4+
- compatible : Should be "calxeda,hb-combophy"
5+
- #phy-cells: Should be 1.
6+
- reg : Address and size for Combination Phy registers.
7+
- phydev: device ID for programming the combophy.
8+
9+
Example:
10+
11+
combophy5: combo-phy@fff5d000 {
12+
compatible = "calxeda,hb-combophy";
13+
#phy-cells = <1>;
14+
reg = <0xfff5d000 0x1000>;
15+
phydev = <31>;
16+
};
17+

Documentation/devicetree/bindings/ata/ahci-platform.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,17 @@ Required properties:
88
- interrupts : <interrupt mapping for SATA IRQ>
99
- reg : <registers mapping>
1010

11+
Optional properties:
12+
- calxeda,port-phys: phandle-combophy and lane assignment, which maps each
13+
SATA port to a combophy and a lane within that
14+
combophy
15+
1116
Example:
1217
sata@ffe08000 {
1318
compatible = "calxeda,hb-ahci";
1419
reg = <0xffe08000 0x1000>;
1520
interrupts = <115>;
21+
calxeda,port-phys = <&combophy5 0 &combophy0 0 &combophy0 1
22+
&combophy0 2 &combophy0 3>;
23+
1624
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
* ARASAN PATA COMPACT FLASH CONTROLLER
2+
3+
Required properties:
4+
- compatible: "arasan,cf-spear1340"
5+
- reg: Address range of the CF registers
6+
- interrupt-parent: Should be the phandle for the interrupt controller
7+
that services interrupts for this device
8+
- interrupt: Should contain the CF interrupt number
9+
10+
Example:
11+
12+
cf@fc000000 {
13+
compatible = "arasan,cf-spear1340";
14+
reg = <0xfc000000 0x1000>;
15+
interrupt-parent = <&vic1>;
16+
interrupts = <12>;
17+
};

arch/arm/boot/dts/highbank.dts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@
121121
compatible = "calxeda,hb-ahci";
122122
reg = <0xffe08000 0x10000>;
123123
interrupts = <0 83 4>;
124+
calxeda,port-phys = <&combophy5 0 &combophy0 0
125+
&combophy0 1 &combophy0 2
126+
&combophy0 3>;
124127
};
125128

126129
sdhci@ffe0e000 {
@@ -306,5 +309,19 @@
306309
reg = <0xfff51000 0x1000>;
307310
interrupts = <0 80 4 0 81 4 0 82 4>;
308311
};
312+
313+
combophy0: combo-phy@fff58000 {
314+
compatible = "calxeda,hb-combophy";
315+
#phy-cells = <1>;
316+
reg = <0xfff58000 0x1000>;
317+
phydev = <5>;
318+
};
319+
320+
combophy5: combo-phy@fff5d000 {
321+
compatible = "calxeda,hb-combophy";
322+
#phy-cells = <1>;
323+
reg = <0xfff5d000 0x1000>;
324+
phydev = <31>;
325+
};
309326
};
310327
};

drivers/ata/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,14 @@ config SATA_DWC_VDEBUG
214214
help
215215
This option enables the taskfile dumping and NCQ debugging.
216216

217+
config SATA_HIGHBANK
218+
tristate "Calxeda Highbank SATA support"
219+
help
220+
This option enables support for the Calxeda Highbank SoC's
221+
onboard SATA.
222+
223+
If unsure, say N.
224+
217225
config SATA_MV
218226
tristate "Marvell SATA support"
219227
help

drivers/ata/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ obj-$(CONFIG_SATA_FSL) += sata_fsl.o
99
obj-$(CONFIG_SATA_INIC162X) += sata_inic162x.o
1010
obj-$(CONFIG_SATA_SIL24) += sata_sil24.o
1111
obj-$(CONFIG_SATA_DWC) += sata_dwc_460ex.o
12+
obj-$(CONFIG_SATA_HIGHBANK) += sata_highbank.o libahci.o
1213

1314
# SFF w/ custom DMA
1415
obj-$(CONFIG_PDC_ADMA) += pdc_adma.o

drivers/ata/ahci.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#ifndef _AHCI_H
3636
#define _AHCI_H
3737

38+
#include <linux/clk.h>
3839
#include <linux/libata.h>
3940

4041
/* Enclosure Management Control */
@@ -115,6 +116,9 @@ enum {
115116
HOST_CAP2_BOH = (1 << 0), /* BIOS/OS handoff supported */
116117
HOST_CAP2_NVMHCI = (1 << 1), /* NVMHCI supported */
117118
HOST_CAP2_APST = (1 << 2), /* Automatic partial to slumber */
119+
HOST_CAP2_SDS = (1 << 3), /* Support device sleep */
120+
HOST_CAP2_SADM = (1 << 4), /* Support aggressive DevSlp */
121+
HOST_CAP2_DESO = (1 << 5), /* DevSlp from slumber only */
118122

119123
/* registers for each SATA port */
120124
PORT_LST_ADDR = 0x00, /* command list DMA addr */
@@ -133,6 +137,7 @@ enum {
133137
PORT_SCR_ACT = 0x34, /* SATA phy register: SActive */
134138
PORT_SCR_NTF = 0x3c, /* SATA phy register: SNotification */
135139
PORT_FBS = 0x40, /* FIS-based Switching */
140+
PORT_DEVSLP = 0x44, /* device sleep */
136141

137142
/* PORT_IRQ_{STAT,MASK} bits */
138143
PORT_IRQ_COLD_PRES = (1 << 31), /* cold presence detect */
@@ -186,6 +191,7 @@ enum {
186191
PORT_CMD_ICC_PARTIAL = (0x2 << 28), /* Put i/f in partial state */
187192
PORT_CMD_ICC_SLUMBER = (0x6 << 28), /* Put i/f in slumber state */
188193

194+
/* PORT_FBS bits */
189195
PORT_FBS_DWE_OFFSET = 16, /* FBS device with error offset */
190196
PORT_FBS_ADO_OFFSET = 12, /* FBS active dev optimization offset */
191197
PORT_FBS_DEV_OFFSET = 8, /* FBS device to issue offset */
@@ -194,6 +200,15 @@ enum {
194200
PORT_FBS_DEC = (1 << 1), /* FBS device error clear */
195201
PORT_FBS_EN = (1 << 0), /* Enable FBS */
196202

203+
/* PORT_DEVSLP bits */
204+
PORT_DEVSLP_DM_OFFSET = 25, /* DITO multiplier offset */
205+
PORT_DEVSLP_DM_MASK = (0xf << 25), /* DITO multiplier mask */
206+
PORT_DEVSLP_DITO_OFFSET = 15, /* DITO offset */
207+
PORT_DEVSLP_MDAT_OFFSET = 10, /* Minimum assertion time */
208+
PORT_DEVSLP_DETO_OFFSET = 2, /* DevSlp exit timeout */
209+
PORT_DEVSLP_DSP = (1 << 1), /* DevSlp present */
210+
PORT_DEVSLP_ADSE = (1 << 0), /* Aggressive DevSlp enable */
211+
197212
/* hpriv->flags bits */
198213

199214
#define AHCI_HFLAGS(flags) .private_data = (void *)(flags)
@@ -302,6 +317,7 @@ struct ahci_host_priv {
302317
u32 em_loc; /* enclosure management location */
303318
u32 em_buf_sz; /* EM buffer size in byte */
304319
u32 em_msg_type; /* EM message type */
320+
struct clk *clk; /* Only for platforms supporting clk */
305321
};
306322

307323
extern int ahci_ignore_sss;

drivers/ata/ahci_platform.c

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* any later version.
1313
*/
1414

15+
#include <linux/clk.h>
1516
#include <linux/kernel.h>
1617
#include <linux/gfp.h>
1718
#include <linux/module.h>
@@ -118,6 +119,17 @@ static int __init ahci_probe(struct platform_device *pdev)
118119
return -ENOMEM;
119120
}
120121

122+
hpriv->clk = clk_get(dev, NULL);
123+
if (IS_ERR(hpriv->clk)) {
124+
dev_err(dev, "can't get clock\n");
125+
} else {
126+
rc = clk_prepare_enable(hpriv->clk);
127+
if (rc) {
128+
dev_err(dev, "clock prepare enable failed");
129+
goto free_clk;
130+
}
131+
}
132+
121133
/*
122134
* Some platforms might need to prepare for mmio region access,
123135
* which could be done in the following init call. So, the mmio
@@ -127,7 +139,7 @@ static int __init ahci_probe(struct platform_device *pdev)
127139
if (pdata && pdata->init) {
128140
rc = pdata->init(dev, hpriv->mmio);
129141
if (rc)
130-
return rc;
142+
goto disable_unprepare_clk;
131143
}
132144

133145
ahci_save_initial_config(dev, hpriv,
@@ -153,7 +165,7 @@ static int __init ahci_probe(struct platform_device *pdev)
153165
host = ata_host_alloc_pinfo(dev, ppi, n_ports);
154166
if (!host) {
155167
rc = -ENOMEM;
156-
goto err0;
168+
goto pdata_exit;
157169
}
158170

159171
host->private_data = hpriv;
@@ -183,20 +195,26 @@ static int __init ahci_probe(struct platform_device *pdev)
183195

184196
rc = ahci_reset_controller(host);
185197
if (rc)
186-
goto err0;
198+
goto pdata_exit;
187199

188200
ahci_init_controller(host);
189201
ahci_print_info(host, "platform");
190202

191203
rc = ata_host_activate(host, irq, ahci_interrupt, IRQF_SHARED,
192204
&ahci_platform_sht);
193205
if (rc)
194-
goto err0;
206+
goto pdata_exit;
195207

196208
return 0;
197-
err0:
209+
pdata_exit:
198210
if (pdata && pdata->exit)
199211
pdata->exit(dev);
212+
disable_unprepare_clk:
213+
if (!IS_ERR(hpriv->clk))
214+
clk_disable_unprepare(hpriv->clk);
215+
free_clk:
216+
if (!IS_ERR(hpriv->clk))
217+
clk_put(hpriv->clk);
200218
return rc;
201219
}
202220

@@ -205,12 +223,18 @@ static int __devexit ahci_remove(struct platform_device *pdev)
205223
struct device *dev = &pdev->dev;
206224
struct ahci_platform_data *pdata = dev_get_platdata(dev);
207225
struct ata_host *host = dev_get_drvdata(dev);
226+
struct ahci_host_priv *hpriv = host->private_data;
208227

209228
ata_host_detach(host);
210229

211230
if (pdata && pdata->exit)
212231
pdata->exit(dev);
213232

233+
if (!IS_ERR(hpriv->clk)) {
234+
clk_disable_unprepare(hpriv->clk);
235+
clk_put(hpriv->clk);
236+
}
237+
214238
return 0;
215239
}
216240

@@ -245,39 +269,57 @@ static int ahci_suspend(struct device *dev)
245269

246270
if (pdata && pdata->suspend)
247271
return pdata->suspend(dev);
272+
273+
if (!IS_ERR(hpriv->clk))
274+
clk_disable_unprepare(hpriv->clk);
275+
248276
return 0;
249277
}
250278

251279
static int ahci_resume(struct device *dev)
252280
{
253281
struct ahci_platform_data *pdata = dev_get_platdata(dev);
254282
struct ata_host *host = dev_get_drvdata(dev);
283+
struct ahci_host_priv *hpriv = host->private_data;
255284
int rc;
256285

286+
if (!IS_ERR(hpriv->clk)) {
287+
rc = clk_prepare_enable(hpriv->clk);
288+
if (rc) {
289+
dev_err(dev, "clock prepare enable failed");
290+
return rc;
291+
}
292+
}
293+
257294
if (pdata && pdata->resume) {
258295
rc = pdata->resume(dev);
259296
if (rc)
260-
return rc;
297+
goto disable_unprepare_clk;
261298
}
262299

263300
if (dev->power.power_state.event == PM_EVENT_SUSPEND) {
264301
rc = ahci_reset_controller(host);
265302
if (rc)
266-
return rc;
303+
goto disable_unprepare_clk;
267304

268305
ahci_init_controller(host);
269306
}
270307

271308
ata_host_resume(host);
272309

273310
return 0;
311+
312+
disable_unprepare_clk:
313+
if (!IS_ERR(hpriv->clk))
314+
clk_disable_unprepare(hpriv->clk);
315+
316+
return rc;
274317
}
275318
#endif
276319

277320
SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_suspend, ahci_resume);
278321

279322
static const struct of_device_id ahci_of_match[] = {
280-
{ .compatible = "calxeda,hb-ahci", },
281323
{ .compatible = "snps,spear-ahci", },
282324
{},
283325
};

0 commit comments

Comments
 (0)