Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / drivers / usb / host / ohci.h
index db0924c943a19fab809449035313febc9cdbb217..a38cd25eb85fc0d24a13b07a58aeaac13232ce16 100644 (file)
  * e.g. PCI controllers need this
  */
 
+#include <asm/cache.h>
 #include <asm/io.h>
 
 #ifdef CONFIG_SYS_OHCI_SWAP_REG_ACCESS
-# define ohci_readl(a) __swap_32(readl(a))
-# define ohci_writel(v, a) writel(__swap_32(v), a)
+# define ohci_readl(a) __swap_32(in_be32((u32 *)a))
+# define ohci_writel(a, b) out_be32((u32 *)b, __swap_32(a))
 #else
 # define ohci_readl(a) readl(a)
 # define ohci_writel(v, a) writel(v, a)
@@ -27,7 +28,7 @@
 #define ED_ALIGNMENT 16
 #endif
 
-#if defined CONFIG_DM_USB && ARCH_DMA_MINALIGN > 32
+#if CONFIG_IS_ENABLED(DM_USB) && ARCH_DMA_MINALIGN > 32
 #define TD_ALIGNMENT ARCH_DMA_MINALIGN
 #else
 #define TD_ALIGNMENT 32
@@ -115,9 +116,7 @@ struct td {
        __u32 hwNextTD;         /* Next TD Pointer */
        __u32 hwBE;             /* Memory Buffer End Pointer */
 
-/* #ifndef CONFIG_MPC5200 /\* this seems wrong *\/ */
        __u16 hwPSW[MAXPSW];
-/* #endif */
        __u8 unused;
        __u8 index;
        struct ed *ed;
@@ -141,13 +140,8 @@ typedef struct td td_t;
 #define NUM_INTS 32    /* part of the OHCI standard */
 struct ohci_hcca {
        __u32   int_table[NUM_INTS];    /* Interrupt ED table */
-#if defined(CONFIG_MPC5200)
-       __u16   pad1;                   /* set to 0 on each frame_no change */
-       __u16   frame_no;               /* current frame number */
-#else
        __u16   frame_no;               /* current frame number */
        __u16   pad1;                   /* set to 0 on each frame_no change */
-#endif
        __u32   done_head;              /* info returned for an interrupt */
        u8              reserved_for_hc[116];
 } __attribute__((aligned(256)));
@@ -366,7 +360,7 @@ typedef struct
 } urb_priv_t;
 #define URB_DEL 1
 
-#define NUM_EDS              /* num of preallocated endpoint descriptors */
+#define NUM_EDS 32             /* num of preallocated endpoint descriptors */
 
 #define NUM_TD 64              /* we need more TDs than EDs */
 
@@ -413,7 +407,7 @@ typedef struct ohci {
        const char      *slot_name;
 } ohci_t;
 
-#ifdef CONFIG_DM_USB
+#if CONFIG_IS_ENABLED(DM_USB)
 extern struct dm_usb_ops ohci_usb_ops;
 
 int ohci_register(struct udevice *dev, struct ohci_regs *regs);