2 * io.h - DesignWare USB3 DRD IO Header
4 * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com
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.
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.
19 #ifndef __DRIVERS_USB_DWC3_IO_H
20 #define __DRIVERS_USB_DWC3_IO_H
27 static inline u32 dwc3_readl(void __iomem *base, u32 offset)
32 * We requested the mem region starting from the Globals address
33 * space, see dwc3_probe in core.c.
34 * However, the offsets are given starting from xHCI address space.
36 value = readl(base + offset - DWC3_GLOBALS_REGS_START);
39 * When tracing we want to make it easy to find the correct address on
40 * documentation, so we revert it back to the proper addresses, the
41 * same way they are described on SNPS documentation
43 trace_dwc3_readl(base - DWC3_GLOBALS_REGS_START, offset, value);
48 static inline void dwc3_writel(void __iomem *base, u32 offset, u32 value)
51 * We requested the mem region starting from the Globals address
52 * space, see dwc3_probe in core.c.
53 * However, the offsets are given starting from xHCI address space.
55 writel(value, base + offset - DWC3_GLOBALS_REGS_START);
58 * When tracing we want to make it easy to find the correct address on
59 * documentation, so we revert it back to the proper addresses, the
60 * same way they are described on SNPS documentation
62 trace_dwc3_writel(base - DWC3_GLOBALS_REGS_START, offset, value);
65 #endif /* __DRIVERS_USB_DWC3_IO_H */