Greg Kroah-Hartman | 5fd54ac | 2017-11-03 11:28:30 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Felipe Balbi | 550a737 | 2008-07-24 12:27:36 +0300 | [diff] [blame] | 2 | /* |
| 3 | * MUSB OTG driver register I/O |
| 4 | * |
| 5 | * Copyright 2005 Mentor Graphics Corporation |
| 6 | * Copyright (C) 2005-2006 by Texas Instruments |
| 7 | * Copyright (C) 2006-2007 Nokia Corporation |
Felipe Balbi | 550a737 | 2008-07-24 12:27:36 +0300 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #ifndef __MUSB_LINUX_PLATFORM_ARCH_H__ |
| 11 | #define __MUSB_LINUX_PLATFORM_ARCH_H__ |
| 12 | |
| 13 | #include <linux/io.h> |
| 14 | |
Tony Lindgren | d026e9c | 2014-11-24 11:05:03 -0800 | [diff] [blame] | 15 | #define musb_ep_select(_mbase, _epnum) musb->io.ep_select((_mbase), (_epnum)) |
| 16 | |
Tony Lindgren | 5450ac8 | 2014-11-24 11:04:59 -0800 | [diff] [blame] | 17 | /** |
| 18 | * struct musb_io - IO functions for MUSB |
Tony Lindgren | 5450ac8 | 2014-11-24 11:04:59 -0800 | [diff] [blame] | 19 | * @ep_offset: platform specific function to get end point offset |
| 20 | * @ep_select: platform specific function to select end point |
| 21 | * @fifo_offset: platform specific function to get fifo offset |
| 22 | * @read_fifo: platform specific function to read fifo |
| 23 | * @write_fifo: platform specific function to write fifo |
Hans de Goede | 6cc2af6 | 2015-03-20 20:11:12 +0100 | [diff] [blame] | 24 | * @busctl_offset: platform specific function to get busctl offset |
Min Guo | fe3bbd6 | 2020-01-15 07:25:42 -0600 | [diff] [blame] | 25 | * @get_toggle: platform specific function to get toggle |
| 26 | * @set_toggle: platform specific function to set toggle |
Tony Lindgren | 5450ac8 | 2014-11-24 11:04:59 -0800 | [diff] [blame] | 27 | */ |
| 28 | struct musb_io { |
Tony Lindgren | 5450ac8 | 2014-11-24 11:04:59 -0800 | [diff] [blame] | 29 | u32 (*ep_offset)(u8 epnum, u16 offset); |
| 30 | void (*ep_select)(void __iomem *mbase, u8 epnum); |
| 31 | u32 (*fifo_offset)(u8 epnum); |
| 32 | void (*read_fifo)(struct musb_hw_ep *hw_ep, u16 len, u8 *buf); |
| 33 | 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] | 34 | u32 (*busctl_offset)(u8 epnum, u16 offset); |
Min Guo | fe3bbd6 | 2020-01-15 07:25:42 -0600 | [diff] [blame] | 35 | u16 (*get_toggle)(struct musb_qh *qh, int is_out); |
| 36 | u16 (*set_toggle)(struct musb_qh *qh, int is_out, struct urb *urb); |
Tony Lindgren | 5450ac8 | 2014-11-24 11:04:59 -0800 | [diff] [blame] | 37 | }; |
| 38 | |
Tony Lindgren | 1b40fc5 | 2014-11-24 11:05:02 -0800 | [diff] [blame] | 39 | /* Do not add new entries here, add them the struct musb_io instead */ |
Min Guo | 9c93d7f | 2020-01-15 07:25:44 -0600 | [diff] [blame] | 40 | extern u8 (*musb_readb)(void __iomem *addr, u32 offset); |
| 41 | extern void (*musb_writeb)(void __iomem *addr, u32 offset, u8 data); |
| 42 | extern u8 (*musb_clearb)(void __iomem *addr, u32 offset); |
| 43 | extern u16 (*musb_readw)(void __iomem *addr, u32 offset); |
| 44 | extern void (*musb_writew)(void __iomem *addr, u32 offset, u16 data); |
| 45 | extern u16 (*musb_clearw)(void __iomem *addr, u32 offset); |
| 46 | extern u32 musb_readl(void __iomem *addr, u32 offset); |
| 47 | extern void musb_writel(void __iomem *addr, u32 offset, u32 data); |
Bryan Wu | 2c557a4 | 2008-12-02 21:33:46 +0200 | [diff] [blame] | 48 | |
Felipe Balbi | 550a737 | 2008-07-24 12:27:36 +0300 | [diff] [blame] | 49 | #endif |