Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Copyright 2006 PathScale, Inc.  All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <linux/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <linux/io.h>
^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)  * __iowrite32_copy - copy data to MMIO space, in 32-bit units
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)  * @to: destination, in MMIO space (must be 32-bit aligned)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  * @from: source (must be 32-bit aligned)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)  * @count: number of 32-bit quantities to copy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  * Copy data from kernel space to MMIO space, in units of 32 bits at a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)  * time.  Order of access is not guaranteed, nor is a memory barrier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)  * performed afterwards.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) void __attribute__((weak)) __iowrite32_copy(void __iomem *to,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 					    const void *from,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 					    size_t count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	u32 __iomem *dst = to;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	const u32 *src = from;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	const u32 *end = src + count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	while (src < end)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 		__raw_writel(*src++, dst++);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) EXPORT_SYMBOL_GPL(__iowrite32_copy);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)  * __ioread32_copy - copy data from MMIO space, in 32-bit units
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)  * @to: destination (must be 32-bit aligned)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)  * @from: source, in MMIO space (must be 32-bit aligned)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)  * @count: number of 32-bit quantities to copy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)  * Copy data from MMIO space to kernel space, in units of 32 bits at a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)  * time.  Order of access is not guaranteed, nor is a memory barrier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)  * performed afterwards.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) void __ioread32_copy(void *to, const void __iomem *from, size_t count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	u32 *dst = to;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	const u32 __iomem *src = from;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	const u32 __iomem *end = src + count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	while (src < end)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 		*dst++ = __raw_readl(src++);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) EXPORT_SYMBOL_GPL(__ioread32_copy);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)  * __iowrite64_copy - copy data to MMIO space, in 64-bit or 32-bit units
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)  * @to: destination, in MMIO space (must be 64-bit aligned)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)  * @from: source (must be 64-bit aligned)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)  * @count: number of 64-bit quantities to copy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)  * Copy data from kernel space to MMIO space, in units of 32 or 64 bits at a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)  * time.  Order of access is not guaranteed, nor is a memory barrier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)  * performed afterwards.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) void __attribute__((weak)) __iowrite64_copy(void __iomem *to,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 					    const void *from,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 					    size_t count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #ifdef CONFIG_64BIT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 	u64 __iomem *dst = to;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	const u64 *src = from;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	const u64 *end = src + count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 	while (src < end)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 		__raw_writeq(*src++, dst++);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 	__iowrite32_copy(to, from, count * 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) EXPORT_SYMBOL_GPL(__iowrite64_copy);