X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=drivers%2Fusb%2Fhost%2Fohci.h;h=f9f02cb09c5f379cfdf33d311e52d58f17ea27b5;hb=ff8c23e784f57a7098e91a200ed7f5a48612b653;hp=f52b4c1bb535e60d92be11528ff0fdef202e46d4;hpb=02ffb580e6ab7aaa7f6703ed35f489e97439cb65;p=oweals%2Fu-boot.git diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index f52b4c1bb5..f9f02cb09c 100644 --- a/drivers/usb/host/ohci.h +++ b/drivers/usb/host/ohci.h @@ -10,21 +10,24 @@ /* * e.g. PCI controllers need this */ + +#include + #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 defined CONFIG_DM_USB && ARCH_DMA_MINALIGN > 16 +#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 +#if CONFIG_IS_ENABLED(DM_USB) && ARCH_DMA_MINALIGN > 32 #define TD_ALIGNMENT ARCH_DMA_MINALIGN #else #define TD_ALIGNMENT 32 @@ -112,9 +115,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; @@ -138,13 +139,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))); @@ -363,14 +359,17 @@ typedef struct } urb_priv_t; #define URB_DEL 1 -#define NUM_EDS 8 /* num of preallocated endpoint descriptors */ +#define NUM_EDS 32 /* num of preallocated endpoint descriptors */ #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(ED_ALIGNMENT); td_t tds[NUM_TD] __aligned(TD_ALIGNMENT); int ed_cnt; + int devnum; } ohci_dev_t; /* @@ -384,6 +383,7 @@ typedef struct ohci_device { typedef struct ohci { /* this allocates EDs for all possible endpoints */ 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;*/ @@ -405,3 +405,10 @@ typedef struct ohci { const char *slot_name; } ohci_t; + +#if CONFIG_IS_ENABLED(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