xref: /openbmc/u-boot/arch/mips/include/asm/mach-generic/mangle-port.h (revision 83d290c56fab2d38cd1ab4c4cc7099559c1d5046)
1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0 */
223ff8633SDaniel Schwierzeck /*
323ff8633SDaniel Schwierzeck  * Copyright (C) 2003, 2004 Ralf Baechle
423ff8633SDaniel Schwierzeck  */
523ff8633SDaniel Schwierzeck #ifndef __ASM_MACH_GENERIC_MANGLE_PORT_H
623ff8633SDaniel Schwierzeck #define __ASM_MACH_GENERIC_MANGLE_PORT_H
723ff8633SDaniel Schwierzeck 
823ff8633SDaniel Schwierzeck #define __swizzle_addr_b(port)	(port)
923ff8633SDaniel Schwierzeck #define __swizzle_addr_w(port)	(port)
1023ff8633SDaniel Schwierzeck #define __swizzle_addr_l(port)	(port)
1123ff8633SDaniel Schwierzeck #define __swizzle_addr_q(port)	(port)
1223ff8633SDaniel Schwierzeck 
1323ff8633SDaniel Schwierzeck /*
1423ff8633SDaniel Schwierzeck  * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware;
1523ff8633SDaniel Schwierzeck  * less sane hardware forces software to fiddle with this...
1623ff8633SDaniel Schwierzeck  *
1723ff8633SDaniel Schwierzeck  * Regardless, if the host bus endianness mismatches that of PCI/ISA, then
1823ff8633SDaniel Schwierzeck  * you can't have the numerical value of data and byte addresses within
1923ff8633SDaniel Schwierzeck  * multibyte quantities both preserved at the same time.  Hence two
2023ff8633SDaniel Schwierzeck  * variations of functions: non-prefixed ones that preserve the value
2123ff8633SDaniel Schwierzeck  * and prefixed ones that preserve byte addresses.  The latters are
2223ff8633SDaniel Schwierzeck  * typically used for moving raw data between a peripheral and memory (cf.
2323ff8633SDaniel Schwierzeck  * string I/O functions), hence the "__mem_" prefix.
2423ff8633SDaniel Schwierzeck  */
2523ff8633SDaniel Schwierzeck #if defined(CONFIG_SWAP_IO_SPACE)
2623ff8633SDaniel Schwierzeck 
2723ff8633SDaniel Schwierzeck # define ioswabb(a, x)		(x)
2823ff8633SDaniel Schwierzeck # define __mem_ioswabb(a, x)	(x)
2923ff8633SDaniel Schwierzeck # define ioswabw(a, x)		le16_to_cpu(x)
3023ff8633SDaniel Schwierzeck # define __mem_ioswabw(a, x)	(x)
3123ff8633SDaniel Schwierzeck # define ioswabl(a, x)		le32_to_cpu(x)
3223ff8633SDaniel Schwierzeck # define __mem_ioswabl(a, x)	(x)
3323ff8633SDaniel Schwierzeck # define ioswabq(a, x)		le64_to_cpu(x)
3423ff8633SDaniel Schwierzeck # define __mem_ioswabq(a, x)	(x)
3523ff8633SDaniel Schwierzeck 
3623ff8633SDaniel Schwierzeck #else
3723ff8633SDaniel Schwierzeck 
3823ff8633SDaniel Schwierzeck # define ioswabb(a, x)		(x)
3923ff8633SDaniel Schwierzeck # define __mem_ioswabb(a, x)	(x)
4023ff8633SDaniel Schwierzeck # define ioswabw(a, x)		(x)
4123ff8633SDaniel Schwierzeck # define __mem_ioswabw(a, x)	cpu_to_le16(x)
4223ff8633SDaniel Schwierzeck # define ioswabl(a, x)		(x)
4323ff8633SDaniel Schwierzeck # define __mem_ioswabl(a, x)	cpu_to_le32(x)
4423ff8633SDaniel Schwierzeck # define ioswabq(a, x)		(x)
4523ff8633SDaniel Schwierzeck # define __mem_ioswabq(a, x)	cpu_to_le32(x)
4623ff8633SDaniel Schwierzeck 
4723ff8633SDaniel Schwierzeck #endif
4823ff8633SDaniel Schwierzeck 
4923ff8633SDaniel Schwierzeck #endif /* __ASM_MACH_GENERIC_MANGLE_PORT_H */
50