Felipe Balbi | 550a737 | 2008-07-24 12:27:36 +0300 | [diff] [blame] | 1 | /* |
| 2 | * MUSB OTG driver register I/O |
| 3 | * |
| 4 | * Copyright 2005 Mentor Graphics Corporation |
| 5 | * Copyright (C) 2005-2006 by Texas Instruments |
| 6 | * Copyright (C) 2006-2007 Nokia Corporation |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License |
| 10 | * version 2 as published by the Free Software Foundation. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 20 | * 02110-1301 USA |
| 21 | * |
| 22 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN |
| 25 | * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
| 28 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
| 29 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 32 | * |
| 33 | */ |
| 34 | |
| 35 | #ifndef __MUSB_LINUX_PLATFORM_ARCH_H__ |
| 36 | #define __MUSB_LINUX_PLATFORM_ARCH_H__ |
| 37 | |
| 38 | #include <linux/io.h> |
| 39 | |
Tony Lindgren | d026e9c | 2014-11-24 11:05:03 -0800 | [diff] [blame] | 40 | #define musb_ep_select(_mbase, _epnum) musb->io.ep_select((_mbase), (_epnum)) |
| 41 | |
Tony Lindgren | 5450ac8 | 2014-11-24 11:04:59 -0800 | [diff] [blame] | 42 | /** |
| 43 | * struct musb_io - IO functions for MUSB |
| 44 | * @quirks: platform specific flags |
| 45 | * @ep_offset: platform specific function to get end point offset |
| 46 | * @ep_select: platform specific function to select end point |
| 47 | * @fifo_offset: platform specific function to get fifo offset |
| 48 | * @read_fifo: platform specific function to read fifo |
| 49 | * @write_fifo: platform specific function to write fifo |
Hans de Goede | 6cc2af6 | 2015-03-20 20:11:12 +0100 | [diff] [blame] | 50 | * @busctl_offset: platform specific function to get busctl offset |
Tony Lindgren | 5450ac8 | 2014-11-24 11:04:59 -0800 | [diff] [blame] | 51 | */ |
| 52 | struct musb_io { |
| 53 | u32 quirks; |
| 54 | u32 (*ep_offset)(u8 epnum, u16 offset); |
| 55 | void (*ep_select)(void __iomem *mbase, u8 epnum); |
| 56 | u32 (*fifo_offset)(u8 epnum); |
| 57 | void (*read_fifo)(struct musb_hw_ep *hw_ep, u16 len, u8 *buf); |
| 58 | void (*write_fifo)(struct musb_hw_ep *hw_ep, u16 len, const u8 *buf); |
Hans de Goede | 6cc2af6 | 2015-03-20 20:11:12 +0100 | [diff] [blame] | 59 | u32 (*busctl_offset)(u8 epnum, u16 offset); |
Tony Lindgren | 5450ac8 | 2014-11-24 11:04:59 -0800 | [diff] [blame] | 60 | }; |
| 61 | |
Tony Lindgren | 1b40fc5 | 2014-11-24 11:05:02 -0800 | [diff] [blame] | 62 | /* Do not add new entries here, add them the struct musb_io instead */ |
| 63 | extern u8 (*musb_readb)(const void __iomem *addr, unsigned offset); |
| 64 | extern void (*musb_writeb)(void __iomem *addr, unsigned offset, u8 data); |
| 65 | extern u16 (*musb_readw)(const void __iomem *addr, unsigned offset); |
| 66 | extern void (*musb_writew)(void __iomem *addr, unsigned offset, u16 data); |
| 67 | extern u32 (*musb_readl)(const void __iomem *addr, unsigned offset); |
| 68 | extern void (*musb_writel)(void __iomem *addr, unsigned offset, u32 data); |
Bryan Wu | 2c557a4 | 2008-12-02 21:33:46 +0200 | [diff] [blame] | 69 | |
Felipe Balbi | 550a737 | 2008-07-24 12:27:36 +0300 | [diff] [blame] | 70 | #endif |