Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * io.h - DesignWare USB3 DRD IO Header
0004  *
0005  * Copyright (C) 2010-2011 Texas Instruments Incorporated - https://www.ti.com
0006  *
0007  * Authors: Felipe Balbi <balbi@ti.com>,
0008  *      Sebastian Andrzej Siewior <bigeasy@linutronix.de>
0009  */
0010 
0011 #ifndef __DRIVERS_USB_DWC3_IO_H
0012 #define __DRIVERS_USB_DWC3_IO_H
0013 
0014 #include <linux/io.h>
0015 #include "trace.h"
0016 #include "debug.h"
0017 #include "core.h"
0018 
0019 static inline u32 dwc3_readl(void __iomem *base, u32 offset)
0020 {
0021     u32 value;
0022 
0023     /*
0024      * We requested the mem region starting from the Globals address
0025      * space, see dwc3_probe in core.c.
0026      * However, the offsets are given starting from xHCI address space.
0027      */
0028     value = readl(base + offset - DWC3_GLOBALS_REGS_START);
0029 
0030     /*
0031      * When tracing we want to make it easy to find the correct address on
0032      * documentation, so we revert it back to the proper addresses, the
0033      * same way they are described on SNPS documentation
0034      */
0035     trace_dwc3_readl(base - DWC3_GLOBALS_REGS_START, offset, value);
0036 
0037     return value;
0038 }
0039 
0040 static inline void dwc3_writel(void __iomem *base, u32 offset, u32 value)
0041 {
0042     /*
0043      * We requested the mem region starting from the Globals address
0044      * space, see dwc3_probe in core.c.
0045      * However, the offsets are given starting from xHCI address space.
0046      */
0047     writel(value, base + offset - DWC3_GLOBALS_REGS_START);
0048 
0049     /*
0050      * When tracing we want to make it easy to find the correct address on
0051      * documentation, so we revert it back to the proper addresses, the
0052      * same way they are described on SNPS documentation
0053      */
0054     trace_dwc3_writel(base - DWC3_GLOBALS_REGS_START, offset, value);
0055 }
0056 
0057 #endif /* __DRIVERS_USB_DWC3_IO_H */