]>
git.ipfire.org Git - people/ms/u-boot.git/blob - drivers/usb/musb-new/musb_io.h
76682120f48cba82a756058aae93a4821b616da0
2 * MUSB OTG driver register I/O
4 * Copyright 2005 Mentor Graphics Corporation
5 * Copyright (C) 2005-2006 by Texas Instruments
6 * Copyright (C) 2006-2007 Nokia Corporation
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.
12 * SPDX-License-Identifier: GPL-2.0
15 #ifndef __MUSB_LINUX_PLATFORM_ARCH_H__
16 #define __MUSB_LINUX_PLATFORM_ARCH_H__
24 #if !defined(CONFIG_ARM) && !defined(CONFIG_SUPERH) \
25 && !defined(CONFIG_AVR32) && !defined(CONFIG_PPC32) \
26 && !defined(CONFIG_PPC64) && !defined(CONFIG_MIPS) \
27 && !defined(CONFIG_M68K)
28 static inline void readsl(const void __iomem
*addr
, void *buf
, int len
)
29 { insl((unsigned long)addr
, buf
, len
); }
30 static inline void readsw(const void __iomem
*addr
, void *buf
, int len
)
31 { insw((unsigned long)addr
, buf
, len
); }
32 static inline void readsb(const void __iomem
*addr
, void *buf
, int len
)
33 { insb((unsigned long)addr
, buf
, len
); }
35 static inline void writesl(const void __iomem
*addr
, const void *buf
, int len
)
36 { outsl((unsigned long)addr
, buf
, len
); }
37 static inline void writesw(const void __iomem
*addr
, const void *buf
, int len
)
38 { outsw((unsigned long)addr
, buf
, len
); }
39 static inline void writesb(const void __iomem
*addr
, const void *buf
, int len
)
40 { outsb((unsigned long)addr
, buf
, len
); }
44 /* NOTE: these offsets are all in bytes */
46 static inline u16
musb_readw(const void __iomem
*addr
, unsigned offset
)
47 { return __raw_readw(addr
+ offset
); }
49 static inline u32
musb_readl(const void __iomem
*addr
, unsigned offset
)
50 { return __raw_readl(addr
+ offset
); }
53 static inline void musb_writew(void __iomem
*addr
, unsigned offset
, u16 data
)
54 { __raw_writew(data
, addr
+ offset
); }
56 static inline void musb_writel(void __iomem
*addr
, unsigned offset
, u32 data
)
57 { __raw_writel(data
, addr
+ offset
); }
60 #if defined(CONFIG_USB_MUSB_TUSB6010) || defined (CONFIG_USB_MUSB_TUSB6010_MODULE)
63 * TUSB6010 doesn't allow 8-bit access; 16-bit access is the minimum.
65 static inline u8
musb_readb(const void __iomem
*addr
, unsigned offset
)
70 tmp
= __raw_readw(addr
+ (offset
& ~1));
79 static inline void musb_writeb(void __iomem
*addr
, unsigned offset
, u8 data
)
83 tmp
= __raw_readw(addr
+ (offset
& ~1));
85 tmp
= (data
<< 8) | (tmp
& 0xff);
87 tmp
= (tmp
& 0xff00) | data
;
89 __raw_writew(tmp
, addr
+ (offset
& ~1));
94 static inline u8
musb_readb(const void __iomem
*addr
, unsigned offset
)
95 { return __raw_readb(addr
+ offset
); }
97 static inline void musb_writeb(void __iomem
*addr
, unsigned offset
, u8 data
)
98 { __raw_writeb(data
, addr
+ offset
); }
100 #endif /* CONFIG_USB_MUSB_TUSB6010 */