diff mbox series

[U-Boot,v3,8/8] ata: ahci: Don't forget to clear upper address regs.

Message ID 20190806150852.5527-9-frank-w@public-files.de
State Changes Requested
Delegated to: Tom Rini
Headers show
Series add PCIe, its PHY and AHCI support for mt7623 | expand

Commit Message

Frank Wunderlich Aug. 6, 2019, 3:08 p.m. UTC
From: Oleksandr Rybalko <ray@ddteam.net>

In 32bits mode upper bits need to be set to 0, otherwise controller will
try to DMA into not existing memory and stops with error.

changes since v2: none

Tested-by: Frank Wunderlich <frank-w@public-files.de>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Signed-off-by: Oleksandr Rybalko <ray@ddteam.net>
---
 drivers/ata/ahci.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--
2.17.1

Comments

Tom Rini Aug. 20, 2019, 4:19 p.m. UTC | #1
On Tue, Aug 06, 2019 at 05:08:52PM +0200, Frank Wunderlich wrote:

> From: Oleksandr Rybalko <ray@ddteam.net>
> 
> In 32bits mode upper bits need to be set to 0, otherwise controller will
> try to DMA into not existing memory and stops with error.
> 
> changes since v2: none
> 
> Tested-by: Frank Wunderlich <frank-w@public-files.de>
> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
> Signed-off-by: Oleksandr Rybalko <ray@ddteam.net>

This introduces a warning:
       x86:  w+   qemu-x86_64
+(qemu-x86_64)   writel_with_flush((u32)pp->cmd_slot, port_mmio + PORT_LST_ADDR);
+(qemu-x86_64)                     ^
+(qemu-x86_64) arch/x86/include/asm/io.h:71:53: note: in definition of macro 'writel'
+(qemu-x86_64)  #define writel(b, addr) (*(volatile u32 *)(addr) = (b))
+(qemu-x86_64)                                                      ^
+(qemu-x86_64) drivers/ata/ahci.c:596:2: note: in expansion of macro 'writel_with_flush'
+(qemu-x86_64)   ^~~~~~~~~~~~~~~~~
w+(qemu-x86_64) drivers/ata/ahci.c: In function 'ahci_port_start':
w+(qemu-x86_64) drivers/ata/ahci.c:596:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
diff mbox series

Patch

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index e3135bb75f..716f9c1c7e 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -593,10 +593,15 @@  static int ahci_port_start(struct ahci_uc_priv *uc_priv, u8 port)
 	pp->cmd_tbl_sg =
 			(struct ahci_sg *)(uintptr_t)virt_to_phys((void *)mem);

-	writel_with_flush((unsigned long)pp->cmd_slot,
-			  port_mmio + PORT_LST_ADDR);
+	writel_with_flush((u32)pp->cmd_slot, port_mmio + PORT_LST_ADDR);
+#ifndef CONFIG_PHYS_64BIT
+	writel_with_flush(0, port_mmio + PORT_LST_ADDR_HI);
+#endif

 	writel_with_flush(pp->rx_fis, port_mmio + PORT_FIS_ADDR);
+#ifndef CONFIG_PHYS_64BIT
+	writel_with_flush(0, port_mmio + PORT_FIS_ADDR_HI);
+#endif

 #ifdef CONFIG_SUNXI_AHCI
 	sunxi_dma_init(port_mmio);