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