]> git.sur5r.net Git - u-boot/blobdiff - drivers/usb/host/ohci.h
Merge branch 'master' of git://git.denx.de/u-boot
[u-boot] / drivers / usb / host / ohci.h
index 24f5e4e3e82057c5668fa1c26c4783c1063dea6b..db0924c943a19fab809449035313febc9cdbb217 100644 (file)
 /*
  * 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
+#define ED_ALIGNMENT ARCH_DMA_MINALIGN
+#else
+#define ED_ALIGNMENT 16
+#endif
+
+#if defined CONFIG_DM_USB && ARCH_DMA_MINALIGN > 32
+#define TD_ALIGNMENT ARCH_DMA_MINALIGN
+#else
+#define TD_ALIGNMENT 32
+#endif
+
 /* functions for doing board or CPU specific setup/cleanup */
 int usb_board_stop(void);
 
@@ -52,7 +67,7 @@ struct ed {
        struct usb_device *usb_dev;
        void *purb;
        __u32 unused[2];
-} __attribute__((aligned(16)));
+} __attribute__((aligned(ED_ALIGNMENT)));
 typedef struct ed ed_t;
 
 
@@ -112,7 +127,7 @@ struct td {
        __u32 data;
 
        __u32 unused2[2];
-} __attribute__((aligned(32)));
+} __attribute__((aligned(TD_ALIGNMENT)));
 typedef struct td td_t;
 
 #define OHCI_ED_SKIP   (1 << 14)
@@ -355,10 +370,13 @@ typedef struct
 
 #define NUM_TD 64              /* we need more TDs than EDs */
 
+#define NUM_INT_DEVS 8         /* num of ohci_dev structs for int endpoints */
+
 typedef struct ohci_device {
-       ed_t ed[NUM_EDS] __aligned(16);
-       td_t tds[NUM_TD] __aligned(32);
+       ed_t ed[NUM_EDS] __aligned(ED_ALIGNMENT);
+       td_t tds[NUM_TD] __aligned(TD_ALIGNMENT);
        int ed_cnt;
+       int devnum;
 } ohci_dev_t;
 
 /*
@@ -371,7 +389,8 @@ typedef struct ohci_device {
 
 typedef struct ohci {
        /* this allocates EDs for all possible endpoints */
-       struct ohci_device ohci_dev __aligned(32);
+       struct ohci_device ohci_dev __aligned(TD_ALIGNMENT);
+       struct ohci_device int_dev[NUM_INT_DEVS] __aligned(TD_ALIGNMENT);
        struct ohci_hcca *hcca;         /* hcca */
        /*dma_addr_t hcca_dma;*/
 
@@ -393,3 +412,10 @@ typedef struct ohci {
 
        const char      *slot_name;
 } ohci_t;
+
+#ifdef CONFIG_DM_USB
+extern struct dm_usb_ops ohci_usb_ops;
+
+int ohci_register(struct udevice *dev, struct ohci_regs *regs);
+int ohci_deregister(struct udevice *dev);
+#endif