blob: d94441c14d8cb7ebedff18c986aa0710ffd6d31a [file] [log] [blame]
Felipe Balbi72246da2011-08-19 18:10:58 +03001/**
2 * io.h - DesignWare USB3 DRD IO Header
3 *
4 * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com
Felipe Balbi72246da2011-08-19 18:10:58 +03005 *
6 * Authors: Felipe Balbi <balbi@ti.com>,
7 * Sebastian Andrzej Siewior <bigeasy@linutronix.de>
8 *
Felipe Balbi5945f782013-06-30 14:15:11 +03009 * 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.
Felipe Balbi72246da2011-08-19 18:10:58 +030012 *
Felipe Balbi5945f782013-06-30 14:15:11 +030013 * 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.
Felipe Balbi72246da2011-08-19 18:10:58 +030017 */
18
19#ifndef __DRIVERS_USB_DWC3_IO_H
20#define __DRIVERS_USB_DWC3_IO_H
21
Felipe Balbi25b8ff62011-11-04 12:32:47 +020022#include <linux/io.h>
Felipe Balbi72246da2011-08-19 18:10:58 +030023
Ido Shayevitz51249dc2012-04-24 14:18:39 +030024#include "core.h"
25
Felipe Balbi72246da2011-08-19 18:10:58 +030026static inline u32 dwc3_readl(void __iomem *base, u32 offset)
27{
Ido Shayevitz51249dc2012-04-24 14:18:39 +030028 /*
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));
Felipe Balbi72246da2011-08-19 18:10:58 +030034}
35
36static inline void dwc3_writel(void __iomem *base, u32 offset, u32 value)
37{
Ido Shayevitz51249dc2012-04-24 14:18:39 +030038 /*
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));
Felipe Balbi72246da2011-08-19 18:10:58 +030044}
45
46#endif /* __DRIVERS_USB_DWC3_IO_H */