io.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * io.h - DesignWare USB3 DRD IO Header
  3. *
  4. * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com
  5. *
  6. * Authors: Felipe Balbi <balbi@ti.com>,
  7. * Sebastian Andrzej Siewior <bigeasy@linutronix.de>
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 of
  11. * the License as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. */
  18. #ifndef __DRIVERS_USB_DWC3_IO_H
  19. #define __DRIVERS_USB_DWC3_IO_H
  20. #include <linux/io.h>
  21. #include "core.h"
  22. static inline u32 dwc3_readl(void __iomem *base, u32 offset)
  23. {
  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. return readl(base + (offset - DWC3_GLOBALS_REGS_START));
  30. }
  31. static inline void dwc3_writel(void __iomem *base, u32 offset, u32 value)
  32. {
  33. /*
  34. * We requested the mem region starting from the Globals address
  35. * space, see dwc3_probe in core.c.
  36. * However, the offsets are given starting from xHCI address space.
  37. */
  38. writel(value, base + (offset - DWC3_GLOBALS_REGS_START));
  39. }
  40. #endif /* __DRIVERS_USB_DWC3_IO_H */