162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * MUSB OTG driver register I/O
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright 2005 Mentor Graphics Corporation
662306a36Sopenharmony_ci * Copyright (C) 2005-2006 by Texas Instruments
762306a36Sopenharmony_ci * Copyright (C) 2006-2007 Nokia Corporation
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#ifndef __MUSB_LINUX_PLATFORM_ARCH_H__
1162306a36Sopenharmony_ci#define __MUSB_LINUX_PLATFORM_ARCH_H__
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#include <linux/io.h>
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#define musb_ep_select(_mbase, _epnum)	musb->io.ep_select((_mbase), (_epnum))
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci/**
1862306a36Sopenharmony_ci * struct musb_io - IO functions for MUSB
1962306a36Sopenharmony_ci * @ep_offset:	platform specific function to get end point offset
2062306a36Sopenharmony_ci * @ep_select:	platform specific function to select end point
2162306a36Sopenharmony_ci * @fifo_offset: platform specific function to get fifo offset
2262306a36Sopenharmony_ci * @read_fifo:	platform specific function to read fifo
2362306a36Sopenharmony_ci * @write_fifo:	platform specific function to write fifo
2462306a36Sopenharmony_ci * @busctl_offset: platform specific function to get busctl offset
2562306a36Sopenharmony_ci * @get_toggle: platform specific function to get toggle
2662306a36Sopenharmony_ci * @set_toggle: platform specific function to set toggle
2762306a36Sopenharmony_ci */
2862306a36Sopenharmony_cistruct musb_io {
2962306a36Sopenharmony_ci	u32	(*ep_offset)(u8 epnum, u16 offset);
3062306a36Sopenharmony_ci	void	(*ep_select)(void __iomem *mbase, u8 epnum);
3162306a36Sopenharmony_ci	u32	(*fifo_offset)(u8 epnum);
3262306a36Sopenharmony_ci	void	(*read_fifo)(struct musb_hw_ep *hw_ep, u16 len, u8 *buf);
3362306a36Sopenharmony_ci	void	(*write_fifo)(struct musb_hw_ep *hw_ep, u16 len, const u8 *buf);
3462306a36Sopenharmony_ci	u32	(*busctl_offset)(u8 epnum, u16 offset);
3562306a36Sopenharmony_ci	u16	(*get_toggle)(struct musb_qh *qh, int is_out);
3662306a36Sopenharmony_ci	u16	(*set_toggle)(struct musb_qh *qh, int is_out, struct urb *urb);
3762306a36Sopenharmony_ci};
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci/* Do not add new entries here, add them the struct musb_io instead */
4062306a36Sopenharmony_ciextern u8 (*musb_readb)(void __iomem *addr, u32 offset);
4162306a36Sopenharmony_ciextern void (*musb_writeb)(void __iomem *addr, u32 offset, u8 data);
4262306a36Sopenharmony_ciextern u8 (*musb_clearb)(void __iomem *addr, u32 offset);
4362306a36Sopenharmony_ciextern u16 (*musb_readw)(void __iomem *addr, u32 offset);
4462306a36Sopenharmony_ciextern void (*musb_writew)(void __iomem *addr, u32 offset, u16 data);
4562306a36Sopenharmony_ciextern u16 (*musb_clearw)(void __iomem *addr, u32 offset);
4662306a36Sopenharmony_ciextern u32 musb_readl(void __iomem *addr, u32 offset);
4762306a36Sopenharmony_ciextern void musb_writel(void __iomem *addr, u32 offset, u32 data);
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci#endif
50