summaryrefslogtreecommitdiff
path: root/drivers/usb/host/ohci.h
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2016-10-21 02:24:29 +0100
committerMarek Vasut <marex@denx.de>2016-10-29 19:45:40 +0200
commit57faca19a82fc9b43a227824c30aeb76a43d1957 (patch)
treed8db13a5988005dd9922cbf6e6c85b7b594d3419 /drivers/usb/host/ohci.h
parent9eea45f532301376af4498a131246ff1e130a63a (diff)
drivers: USB: OHCI: allow compilation for 64-bit targets
OHCI has a known limitation of allowing only 32-bit DMA buffer addresses, so we have a lot of u32 variables around, which are assigned to pointers and vice versa. This obviously creates issues with 64-bit systems, so the compiler complains here and there. To allow compilation for 64-bit boards which use only memory below 4GB anyway (and to avoid more invasive fixes), adjust some casts and types and assume that the EDs and TDs are all located in the lower 4GB. This fixes compilation of the OHCI driver for the Pine64. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/usb/host/ohci.h')
-rw-r--r--drivers/usb/host/ohci.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index 9b0c4a2bd9..db0924c943 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -10,12 +10,15 @@
/*
* e.g. PCI controllers need this
*/
+
+#include <asm/io.h>
+
#ifdef CONFIG_SYS_OHCI_SWAP_REG_ACCESS
-# define ohci_readl(a) __swap_32(*((volatile u32 *)(a)))
-# define ohci_writel(a, b) (*((volatile u32 *)(b)) = __swap_32((volatile u32)a))
+# define ohci_readl(a) __swap_32(readl(a))
+# define ohci_writel(v, a) writel(__swap_32(v), a)
#else
-# define ohci_readl(a) (*((volatile u32 *)(a)))
-# define ohci_writel(a, b) (*((volatile u32 *)(b)) = ((volatile u32)a))
+# define ohci_readl(a) readl(a)
+# define ohci_writel(v, a) writel(v, a)
#endif /* CONFIG_SYS_OHCI_SWAP_REG_ACCESS */
#if ARCH_DMA_MINALIGN > 16