Skip to content

Commit fbd918a

Browse files
committed
Merge branch 'for-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata
Pull libata updates from Tejun Heo: "Support for some new embedded controllers. A couple late (<= a week) fixes have stable cc'd and one patch ("SATA: MV: Add support for the optional PHYs") got committed yesterday because otherwise the resulting kernel would fail boot on an embedded board due to interdependent changes in its platform tree. Other than that, nothing too noteworthy" * 'for-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: SATA: MV: Add support for the optional PHYs sata-highbank: Remove unnecessary ahci_platform.h include libata: disable LPM for some WD SATA-I devices ARM: mvebu: update the SATA compatible string for Armada 370/XP ata: sata_mv: fix disk hotplug for Armada 370/XP SoCs ata: sata_mv: introduce compatible string "marvell, armada-370-sata" ata: pata_samsung_cf: Remove unused macros ata: pata_samsung_cf: Use devm_ioremap_resource() ata: pata_samsung_cf: Merge pata_samsung_cf.h into pata_samsung_cf.c ata: pata_samsung_cf: Move plat/regs-ata.h to drivers/ata drivers: ata: Mark the function as static in libahci.c drivers: ata: Mark the function ahci_init_interrupts() as static in ahci.c ahci: imx: fix the error handling in imx_ahci_probe() ahci: imx: ahci_imx_softreset() can be static ahci: imx: Add i.MX53 support ahci: imx: Pull out the clock enable/disable calls libata, dt: Document sata_rcar bindings sata_rcar: Add R-Car Gen2 SATA PHY support ahci: mcp89: enter AHCI mode under Apple BIOS emulation ata: libata-eh: Remove unnecessary snprintf arithmetic
2 parents f075e0f + b7db4f2 commit fbd918a

16 files changed

Lines changed: 458 additions & 201 deletions

File tree

‎Documentation/devicetree/bindings/ata/marvell.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
* Marvell Orion SATA
22

33
Required Properties:
4-
- compatibility : "marvell,orion-sata"
4+
- compatibility : "marvell,orion-sata" or "marvell,armada-370-sata"
55
- reg : Address range of controller
66
- interrupts : Interrupt controller is using
77
- nr-ports : Number of SATA ports in use.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
* Renesas R-Car SATA
2+
3+
Required properties:
4+
- compatible : should contain one of the following:
5+
- "renesas,sata-r8a7779" for R-Car H1
6+
- "renesas,sata-r8a7790" for R-Car H2
7+
- "renesas,sata-r8a7791" for R-Car M2
8+
- reg : address and length of the SATA registers;
9+
- interrupts : must consist of one interrupt specifier.
10+
11+
Example:
12+
13+
sata: sata@fc600000 {
14+
compatible = "renesas,sata-r8a7779";
15+
reg = <0xfc600000 0x2000>;
16+
interrupt-parent = <&gic>;
17+
interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>;
18+
};

‎arch/arm/boot/dts/armada-370-xp.dtsi‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
};
153153

154154
sata@a0000 {
155-
compatible = "marvell,orion-sata";
155+
compatible = "marvell,armada-370-sata";
156156
reg = <0xa0000 0x5000>;
157157
interrupts = <55>;
158158
clocks = <&gateclk 15>, <&gateclk 30>;

‎arch/arm/plat-samsung/include/plat/regs-ata.h‎

Lines changed: 0 additions & 56 deletions
This file was deleted.

‎drivers/ata/ahci.c‎

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ enum board_ids {
8383
static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
8484
static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
8585
unsigned long deadline);
86+
static void ahci_mcp89_apple_enable(struct pci_dev *pdev);
87+
static bool is_mcp89_apple(struct pci_dev *pdev);
8688
static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,
8789
unsigned long deadline);
8890
#ifdef CONFIG_PM
@@ -664,6 +666,10 @@ static int ahci_pci_device_resume(struct pci_dev *pdev)
664666
if (rc)
665667
return rc;
666668

669+
/* Apple BIOS helpfully mangles the registers on resume */
670+
if (is_mcp89_apple(pdev))
671+
ahci_mcp89_apple_enable(pdev);
672+
667673
if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
668674
rc = ahci_pci_reset_controller(host);
669675
if (rc)
@@ -780,6 +786,48 @@ static void ahci_p5wdh_workaround(struct ata_host *host)
780786
}
781787
}
782788

789+
/*
790+
* Macbook7,1 firmware forcibly disables MCP89 AHCI and changes PCI ID when
791+
* booting in BIOS compatibility mode. We restore the registers but not ID.
792+
*/
793+
static void ahci_mcp89_apple_enable(struct pci_dev *pdev)
794+
{
795+
u32 val;
796+
797+
printk(KERN_INFO "ahci: enabling MCP89 AHCI mode\n");
798+
799+
pci_read_config_dword(pdev, 0xf8, &val);
800+
val |= 1 << 0x1b;
801+
/* the following changes the device ID, but appears not to affect function */
802+
/* val = (val & ~0xf0000000) | 0x80000000; */
803+
pci_write_config_dword(pdev, 0xf8, val);
804+
805+
pci_read_config_dword(pdev, 0x54c, &val);
806+
val |= 1 << 0xc;
807+
pci_write_config_dword(pdev, 0x54c, val);
808+
809+
pci_read_config_dword(pdev, 0x4a4, &val);
810+
val &= 0xff;
811+
val |= 0x01060100;
812+
pci_write_config_dword(pdev, 0x4a4, val);
813+
814+
pci_read_config_dword(pdev, 0x54c, &val);
815+
val &= ~(1 << 0xc);
816+
pci_write_config_dword(pdev, 0x54c, val);
817+
818+
pci_read_config_dword(pdev, 0xf8, &val);
819+
val &= ~(1 << 0x1b);
820+
pci_write_config_dword(pdev, 0xf8, val);
821+
}
822+
823+
static bool is_mcp89_apple(struct pci_dev *pdev)
824+
{
825+
return pdev->vendor == PCI_VENDOR_ID_NVIDIA &&
826+
pdev->device == PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA &&
827+
pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE &&
828+
pdev->subsystem_device == 0xcb89;
829+
}
830+
783831
/* only some SB600 ahci controllers can do 64bit DMA */
784832
static bool ahci_sb600_enable_64bit(struct pci_dev *pdev)
785833
{
@@ -1100,7 +1148,7 @@ static inline void ahci_gtf_filter_workaround(struct ata_host *host)
11001148
{}
11011149
#endif
11021150

1103-
int ahci_init_interrupts(struct pci_dev *pdev, struct ahci_host_priv *hpriv)
1151+
static int ahci_init_interrupts(struct pci_dev *pdev, struct ahci_host_priv *hpriv)
11041152
{
11051153
int rc;
11061154
unsigned int maxvec;
@@ -1212,15 +1260,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
12121260
if (pdev->vendor == PCI_VENDOR_ID_MARVELL && !marvell_enable)
12131261
return -ENODEV;
12141262

1215-
/*
1216-
* For some reason, MCP89 on MacBook 7,1 doesn't work with
1217-
* ahci, use ata_generic instead.
1218-
*/
1219-
if (pdev->vendor == PCI_VENDOR_ID_NVIDIA &&
1220-
pdev->device == PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA &&
1221-
pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE &&
1222-
pdev->subsystem_device == 0xcb89)
1223-
return -ENODEV;
1263+
/* Apple BIOS on MCP89 prevents us using AHCI */
1264+
if (is_mcp89_apple(pdev))
1265+
ahci_mcp89_apple_enable(pdev);
12241266

12251267
/* Promise's PDC42819 is a SAS/SATA controller that has an AHCI mode.
12261268
* At the moment, we can only use the AHCI mode. Let the users know

0 commit comments

Comments
 (0)