io.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * io.h - DesignWare USB3 DRD IO Header
  3. *
  4. * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
  5. *
  6. * Authors: Felipe Balbi <balbi@ti.com>,
  7. * Sebastian Andrzej Siewior <bigeasy@linutronix.de>
  8. *
  9. * Taken from Linux Kernel v3.19-rc1 (drivers/usb/dwc3/io.h) and ported
  10. * to uboot.
  11. *
  12. * commit 2c4cbe6e5a : usb: dwc3: add tracepoints to aid debugging
  13. *
  14. * SPDX-License-Identifier: GPL-2.0
  15. *
  16. */
  17. #ifndef __DRIVERS_USB_DWC3_IO_H
  18. #define __DRIVERS_USB_DWC3_IO_H
  19. #include <asm/io.h>
  20. static inline u32 dwc3_readl(void __iomem *base, u32 offset)
  21. {
  22. u32 offs = offset - DWC3_GLOBALS_REGS_START;
  23. u32 value;
  24. /*
  25. * We requested the mem region starting from the Globals address
  26. * space, see dwc3_probe in core.c.
  27. * However, the offsets are given starting from xHCI address space.
  28. */
  29. value = readl(base + offs);
  30. return value;
  31. }
  32. static inline void dwc3_writel(void __iomem *base, u32 offset, u32 value)
  33. {
  34. u32 offs = offset - DWC3_GLOBALS_REGS_START;
  35. /*
  36. * We requested the mem region starting from the Globals address
  37. * space, see dwc3_probe in core.c.
  38. * However, the offsets are given starting from xHCI address space.
  39. */
  40. writel(value, base + offs);
  41. }
  42. #endif /* __DRIVERS_USB_DWC3_IO_H */