#ifndef __LINUX_UHCI_HCD_H
#define __LINUX_UHCI_HCD_H
#include <linux/list.h>
#include <linux/usb.h>
#include <linux/clk.h>
#define usb_packetid(pipe) …
#define PIPE_DEVEP_MASK …
#define USBCMD …
#define USBCMD_RS …
#define USBCMD_HCRESET …
#define USBCMD_GRESET …
#define USBCMD_EGSM …
#define USBCMD_FGR …
#define USBCMD_SWDBG …
#define USBCMD_CF …
#define USBCMD_MAXP …
#define USBSTS …
#define USBSTS_USBINT …
#define USBSTS_ERROR …
#define USBSTS_RD …
#define USBSTS_HSE …
#define USBSTS_HCPE …
#define USBSTS_HCH …
#define USBINTR …
#define USBINTR_TIMEOUT …
#define USBINTR_RESUME …
#define USBINTR_IOC …
#define USBINTR_SP …
#define USBFRNUM …
#define USBFLBASEADD …
#define USBSOF …
#define USBSOF_DEFAULT …
#define USBPORTSC1 …
#define USBPORTSC2 …
#define USBPORTSC3 …
#define USBPORTSC4 …
#define USBPORTSC_CCS …
#define USBPORTSC_CSC …
#define USBPORTSC_PE …
#define USBPORTSC_PEC …
#define USBPORTSC_DPLUS …
#define USBPORTSC_DMINUS …
#define USBPORTSC_RD …
#define USBPORTSC_RES1 …
#define USBPORTSC_LSDA …
#define USBPORTSC_PR …
#define USBPORTSC_OC …
#define USBPORTSC_OCC …
#define USBPORTSC_SUSP …
#define USBPORTSC_RES2 …
#define USBPORTSC_RES3 …
#define USBPORTSC_RES4 …
#define USBLEGSUP …
#define USBLEGSUP_DEFAULT …
#define USBLEGSUP_RWC …
#define USBLEGSUP_RO …
#define USBRES_INTEL …
#define USBPORT1EN …
#define USBPORT2EN …
#define UHCI_PTR_BITS(uhci) …
#define UHCI_PTR_TERM(uhci) …
#define UHCI_PTR_QH(uhci) …
#define UHCI_PTR_DEPTH(uhci) …
#define UHCI_PTR_BREADTH(uhci) …
#define UHCI_NUMFRAMES …
#define UHCI_MAX_SOF_NUMBER …
#define CAN_SCHEDULE_FRAMES …
#define MAX_PHASE …
#define FSBR_OFF_DELAY …
#define QH_WAIT_TIMEOUT …
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_DESC
typedef __u32 __bitwise __hc32;
typedef __u16 __bitwise __hc16;
#else
#define __hc32 …
#define __hc16 …
#endif
#define QH_STATE_IDLE …
#define QH_STATE_UNLINKING …
#define QH_STATE_ACTIVE …
struct uhci_qh { … } __attribute__((aligned …));
#define qh_element(qh) …
#define LINK_TO_QH(uhci, qh) …
#define TD_CTRL_SPD …
#define TD_CTRL_C_ERR_MASK …
#define TD_CTRL_C_ERR_SHIFT …
#define TD_CTRL_LS …
#define TD_CTRL_IOS …
#define TD_CTRL_IOC …
#define TD_CTRL_ACTIVE …
#define TD_CTRL_STALLED …
#define TD_CTRL_DBUFERR …
#define TD_CTRL_BABBLE …
#define TD_CTRL_NAK …
#define TD_CTRL_CRCTIMEO …
#define TD_CTRL_BITSTUFF …
#define TD_CTRL_ACTLEN_MASK …
#define uhci_maxerr(err) …
#define uhci_status_bits(ctrl_sts) …
#define uhci_actual_length(ctrl_sts) …
#define td_token(uhci, td) …
#define TD_TOKEN_DEVADDR_SHIFT …
#define TD_TOKEN_TOGGLE_SHIFT …
#define TD_TOKEN_TOGGLE …
#define TD_TOKEN_EXPLEN_SHIFT …
#define TD_TOKEN_EXPLEN_MASK …
#define TD_TOKEN_PID_MASK …
#define uhci_explen(len) …
#define uhci_expected_length(token) …
#define uhci_toggle(token) …
#define uhci_endpoint(token) …
#define uhci_devaddr(token) …
#define uhci_devep(token) …
#define uhci_packetid(token) …
#define uhci_packetout(token) …
#define uhci_packetin(token) …
struct uhci_td { … } __attribute__((aligned …));
#define td_status(uhci, td) …
#define LINK_TO_TD(uhci, td) …
#define UHCI_NUM_SKELQH …
#define SKEL_UNLINK …
#define skel_unlink_qh …
#define SKEL_ISO …
#define skel_iso_qh …
#define SKEL_INDEX(exponent) …
#define SKEL_ASYNC …
#define skel_async_qh …
#define SKEL_TERM …
#define skel_term_qh …
#define SKEL_LS_CONTROL …
#define SKEL_FS_CONTROL …
#define SKEL_FSBR …
#define SKEL_BULK …
enum uhci_rh_state { … };
struct uhci_hcd { … };
static inline struct uhci_hcd *hcd_to_uhci(struct usb_hcd *hcd)
{ … }
static inline struct usb_hcd *uhci_to_hcd(struct uhci_hcd *uhci)
{ … }
#define uhci_dev(u) …
#define uhci_frame_before_eq(f1, f2) …
struct urb_priv { … };
#define PCI_VENDOR_ID_GENESYS …
#define PCI_DEVICE_ID_GL880S_UHCI …
static inline bool uhci_is_aspeed(const struct uhci_hcd *uhci)
{ … }
#ifdef CONFIG_HAS_IOPORT
#define UHCI_IN …
#define UHCI_OUT …
#else
#define UHCI_IN …
#define UHCI_OUT …
#endif
#ifndef CONFIG_USB_UHCI_SUPPORT_NON_PCI_HC
static inline u32 uhci_readl(const struct uhci_hcd *uhci, int reg)
{ … }
static inline void uhci_writel(const struct uhci_hcd *uhci, u32 val, int reg)
{ … }
static inline u16 uhci_readw(const struct uhci_hcd *uhci, int reg)
{ … }
static inline void uhci_writew(const struct uhci_hcd *uhci, u16 val, int reg)
{ … }
static inline u8 uhci_readb(const struct uhci_hcd *uhci, int reg)
{ … }
static inline void uhci_writeb(const struct uhci_hcd *uhci, u8 val, int reg)
{ … }
#else
#if defined(CONFIG_USB_PCI) && defined(HAS_IOPORT)
#define uhci_has_pci_registers …
#else
#define uhci_has_pci_registers …
#endif
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
#define uhci_big_endian_mmio …
#else
#define uhci_big_endian_mmio …
#endif
static inline int uhci_aspeed_reg(unsigned int reg)
{
switch (reg) {
case USBCMD:
return 00;
case USBSTS:
return 0x04;
case USBINTR:
return 0x08;
case USBFRNUM:
return 0x80;
case USBFLBASEADD:
return 0x0c;
case USBSOF:
return 0x84;
case USBPORTSC1:
return 0x88;
case USBPORTSC2:
return 0x8c;
case USBPORTSC3:
return 0x90;
case USBPORTSC4:
return 0x94;
default:
pr_warn("UHCI: Unsupported register 0x%02x on Aspeed\n", reg);
return 0x10;
}
}
static inline u32 uhci_readl(const struct uhci_hcd *uhci, int reg)
{
if (uhci_has_pci_registers(uhci))
return UHCI_IN(inl(uhci->io_addr + reg));
else if (uhci_is_aspeed(uhci))
return readl(uhci->regs + uhci_aspeed_reg(reg));
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
else if (uhci_big_endian_mmio(uhci))
return readl_be(uhci->regs + reg);
#endif
else
return readl(uhci->regs + reg);
}
static inline void uhci_writel(const struct uhci_hcd *uhci, u32 val, int reg)
{
if (uhci_has_pci_registers(uhci))
UHCI_OUT(outl(val, uhci->io_addr + reg));
else if (uhci_is_aspeed(uhci))
writel(val, uhci->regs + uhci_aspeed_reg(reg));
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
else if (uhci_big_endian_mmio(uhci))
writel_be(val, uhci->regs + reg);
#endif
else
writel(val, uhci->regs + reg);
}
static inline u16 uhci_readw(const struct uhci_hcd *uhci, int reg)
{
if (uhci_has_pci_registers(uhci))
return UHCI_IN(inw(uhci->io_addr + reg));
else if (uhci_is_aspeed(uhci))
return readl(uhci->regs + uhci_aspeed_reg(reg));
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
else if (uhci_big_endian_mmio(uhci))
return readw_be(uhci->regs + reg);
#endif
else
return readw(uhci->regs + reg);
}
static inline void uhci_writew(const struct uhci_hcd *uhci, u16 val, int reg)
{
if (uhci_has_pci_registers(uhci))
UHCI_OUT(outw(val, uhci->io_addr + reg));
else if (uhci_is_aspeed(uhci))
writel(val, uhci->regs + uhci_aspeed_reg(reg));
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
else if (uhci_big_endian_mmio(uhci))
writew_be(val, uhci->regs + reg);
#endif
else
writew(val, uhci->regs + reg);
}
static inline u8 uhci_readb(const struct uhci_hcd *uhci, int reg)
{
if (uhci_has_pci_registers(uhci))
return UHCI_IN(inb(uhci->io_addr + reg));
else if (uhci_is_aspeed(uhci))
return readl(uhci->regs + uhci_aspeed_reg(reg));
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
else if (uhci_big_endian_mmio(uhci))
return readb_be(uhci->regs + reg);
#endif
else
return readb(uhci->regs + reg);
}
static inline void uhci_writeb(const struct uhci_hcd *uhci, u8 val, int reg)
{
if (uhci_has_pci_registers(uhci))
UHCI_OUT(outb(val, uhci->io_addr + reg));
else if (uhci_is_aspeed(uhci))
writel(val, uhci->regs + uhci_aspeed_reg(reg));
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
else if (uhci_big_endian_mmio(uhci))
writeb_be(val, uhci->regs + reg);
#endif
else
writeb(val, uhci->regs + reg);
}
#endif
#undef UHCI_IN
#undef UHCI_OUT
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_DESC
#define uhci_big_endian_desc …
static inline __hc32 cpu_to_hc32(const struct uhci_hcd *uhci, const u32 x)
{
return uhci_big_endian_desc(uhci)
? (__force __hc32)cpu_to_be32(x)
: (__force __hc32)cpu_to_le32(x);
}
static inline u32 hc32_to_cpu(const struct uhci_hcd *uhci, const __hc32 x)
{
return uhci_big_endian_desc(uhci)
? be32_to_cpu((__force __be32)x)
: le32_to_cpu((__force __le32)x);
}
#else
static inline __hc32 cpu_to_hc32(const struct uhci_hcd *uhci, const u32 x)
{ … }
static inline u32 hc32_to_cpu(const struct uhci_hcd *uhci, const __hc32 x)
{ … }
#endif
#endif