xref: /linux/drivers/usb/dwc3/io.h (revision ffee921033e64edf8579a3b21c7f15d1a6c3ef71)
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 
19 #ifndef __DRIVERS_USB_DWC3_IO_H
20 #define __DRIVERS_USB_DWC3_IO_H
21 
22 #include <linux/io.h>
23 
24 #include "core.h"
25 
26 static inline u32 dwc3_readl(void __iomem *base, u32 offset)
27 {
28 	/*
29 	 * We requested the mem region starting from the Globals address
30 	 * space, see dwc3_probe in core.c.
31 	 * However, the offsets are given starting from xHCI address space.
32 	 */
33 	return readl(base + (offset - DWC3_GLOBALS_REGS_START));
34 }
35 
36 static inline void dwc3_writel(void __iomem *base, u32 offset, u32 value)
37 {
38 	/*
39 	 * We requested the mem region starting from the Globals address
40 	 * space, see dwc3_probe in core.c.
41 	 * However, the offsets are given starting from xHCI address space.
42 	 */
43 	writel(value, base + (offset - DWC3_GLOBALS_REGS_START));
44 }
45 
46 #endif /* __DRIVERS_USB_DWC3_IO_H */
47