1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * MUSB OTG driver register I/O 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * Copyright 2005 Mentor Graphics Corporation 6*4882a593Smuzhiyun * Copyright (C) 2005-2006 by Texas Instruments 7*4882a593Smuzhiyun * Copyright (C) 2006-2007 Nokia Corporation 8*4882a593Smuzhiyun */ 9*4882a593Smuzhiyun 10*4882a593Smuzhiyun #ifndef __MUSB_LINUX_PLATFORM_ARCH_H__ 11*4882a593Smuzhiyun #define __MUSB_LINUX_PLATFORM_ARCH_H__ 12*4882a593Smuzhiyun 13*4882a593Smuzhiyun #include <linux/io.h> 14*4882a593Smuzhiyun 15*4882a593Smuzhiyun #define musb_ep_select(_mbase, _epnum) musb->io.ep_select((_mbase), (_epnum)) 16*4882a593Smuzhiyun 17*4882a593Smuzhiyun /** 18*4882a593Smuzhiyun * struct musb_io - IO functions for MUSB 19*4882a593Smuzhiyun * @ep_offset: platform specific function to get end point offset 20*4882a593Smuzhiyun * @ep_select: platform specific function to select end point 21*4882a593Smuzhiyun * @fifo_offset: platform specific function to get fifo offset 22*4882a593Smuzhiyun * @read_fifo: platform specific function to read fifo 23*4882a593Smuzhiyun * @write_fifo: platform specific function to write fifo 24*4882a593Smuzhiyun * @busctl_offset: platform specific function to get busctl offset 25*4882a593Smuzhiyun * @get_toggle: platform specific function to get toggle 26*4882a593Smuzhiyun * @set_toggle: platform specific function to set toggle 27*4882a593Smuzhiyun */ 28*4882a593Smuzhiyun struct musb_io { 29*4882a593Smuzhiyun u32 (*ep_offset)(u8 epnum, u16 offset); 30*4882a593Smuzhiyun void (*ep_select)(void __iomem *mbase, u8 epnum); 31*4882a593Smuzhiyun u32 (*fifo_offset)(u8 epnum); 32*4882a593Smuzhiyun void (*read_fifo)(struct musb_hw_ep *hw_ep, u16 len, u8 *buf); 33*4882a593Smuzhiyun void (*write_fifo)(struct musb_hw_ep *hw_ep, u16 len, const u8 *buf); 34*4882a593Smuzhiyun u32 (*busctl_offset)(u8 epnum, u16 offset); 35*4882a593Smuzhiyun u16 (*get_toggle)(struct musb_qh *qh, int is_out); 36*4882a593Smuzhiyun u16 (*set_toggle)(struct musb_qh *qh, int is_out, struct urb *urb); 37*4882a593Smuzhiyun }; 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun /* Do not add new entries here, add them the struct musb_io instead */ 40*4882a593Smuzhiyun extern u8 (*musb_readb)(void __iomem *addr, u32 offset); 41*4882a593Smuzhiyun extern void (*musb_writeb)(void __iomem *addr, u32 offset, u8 data); 42*4882a593Smuzhiyun extern u8 (*musb_clearb)(void __iomem *addr, u32 offset); 43*4882a593Smuzhiyun extern u16 (*musb_readw)(void __iomem *addr, u32 offset); 44*4882a593Smuzhiyun extern void (*musb_writew)(void __iomem *addr, u32 offset, u16 data); 45*4882a593Smuzhiyun extern u16 (*musb_clearw)(void __iomem *addr, u32 offset); 46*4882a593Smuzhiyun extern u32 musb_readl(void __iomem *addr, u32 offset); 47*4882a593Smuzhiyun extern void musb_writel(void __iomem *addr, u32 offset, u32 data); 48*4882a593Smuzhiyun 49*4882a593Smuzhiyun #endif 50