mirror of https://gitee.com/openkylin/linux.git
ARM64: hisi: SoC driver updates for 5.5
- check the LOGIC_PIO_INDIRECT region ops at registration instead of in the IO port accessors to optimise the lib/ligic_pio.c - add the hisi LPC driver to the build test for the other architectures except ALPHA, C6X, HEXAGON and PARISC as they do not define {read,write}sb by updating the hisi LPC Kconfig and adding a dummy PIO_INDIRECT_SIZE - clean the sparse complains of the hisi LPC driver - build logic_pio into a lib to avoid including in the vmlinux when not referenced -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJdxlsEAAoJEAvIV27ZiWZcyDgQALKLwwaieN5SGV/hhpilSEdh rCJapgBBHFLHM9UpornXzOtUg1HVzgL1zJq0nFHX0QTaHV24axOSvETAbPW/ip6j pDu1soh8dRcK+izLgx/yswuqmwbAtgt0lXQWraBzBVJ/67IjUBQoE29mCZ/6i5fY t89f4FHAlrOtEjjEBcgN7K3pHbekltM2BeF62thtwdFain3cC/VJEGlKM+JK3uQ8 T0GVv+gTxS4AfWxFvoTyXeIV3Vk396jBF2xPKisrOfJwjcjqVnEHXLdK6BPtkIl8 Dh9JjPCx0CYHukQEHYBnv3BPMUkmeeGCKG4BVmdnbGZzp+OSeeBsj+9I/xPXtAFF uCbYEGeCivzseGnNTFWX8/eZ3ZvrawllalaxwrvyIz+NJ1c+UDpYBWLZC+p1KZgU Y1QlU3kecIdsXhwJSaehhFvZ0ZIIEMUm96L69SpX0mjZ7O79ccD4gYtWBFd5tyME R55vF/U2jJMUxYImKfaPh9jDBaGTNfNxxUdSgYxI5x64k5mJyEWz4EtbjTEAZznS lkYtQsC+59TdOtz12RlNIPFkwRJwtf9zATzPweOaJ0Jr4/DlbYE7tcPqYSfiM8A0 X1RbRtqj1Uf//mqjiw8A7D8qlC2mtYYX0DKdDaSO16FlDRW00EYoEw5debp/vyYc G91g635uatkrbBFCSjQ8 =9R8Z -----END PGP SIGNATURE----- Merge tag 'hisi-drivers-for-5.5' of git://github.com/hisilicon/linux-hisi into arm/drivers ARM64: hisi: SoC driver updates for 5.5 - check the LOGIC_PIO_INDIRECT region ops at registration instead of in the IO port accessors to optimise the lib/ligic_pio.c - add the hisi LPC driver to the build test for the other architectures except ALPHA, C6X, HEXAGON and PARISC as they do not define {read,write}sb by updating the hisi LPC Kconfig and adding a dummy PIO_INDIRECT_SIZE - clean the sparse complains of the hisi LPC driver - build logic_pio into a lib to avoid including in the vmlinux when not referenced * tag 'hisi-drivers-for-5.5' of git://github.com/hisilicon/linux-hisi: logic_pio: Build into a library bus: hisi_lpc: Expand build test coverage bus: hisi_lpc: Clean some types logic_pio: Define PIO_INDIRECT_SIZE for !CONFIG_INDIRECT_PIO lib: logic_pio: Enforce LOGIC_PIO_INDIRECT region ops are set at registration Link: https://lore.kernel.org/r/5DC959B9.80301@hisilicon.com Signed-off-by: Olof Johansson <olof@lixom.net>
This commit is contained in:
commit
13c1eff175
|
@ -41,8 +41,9 @@ config MOXTET
|
|||
|
||||
config HISILICON_LPC
|
||||
bool "Support for ISA I/O space on HiSilicon Hip06/7"
|
||||
depends on ARM64 && (ARCH_HISI || COMPILE_TEST)
|
||||
select INDIRECT_PIO
|
||||
depends on (ARM64 && ARCH_HISI) || (COMPILE_TEST && !ALPHA && !HEXAGON && !PARISC && !C6X)
|
||||
depends on HAS_IOMEM
|
||||
select INDIRECT_PIO if ARM64
|
||||
help
|
||||
Driver to enable I/O access to devices attached to the Low Pin
|
||||
Count bus on the HiSilicon Hip06/7 SoC.
|
||||
|
|
|
@ -74,7 +74,7 @@ struct hisi_lpc_dev {
|
|||
/* About 10us. This is specific for single IO operations, such as inb */
|
||||
#define LPC_PEROP_WAITCNT 100
|
||||
|
||||
static int wait_lpc_idle(unsigned char *mbase, unsigned int waitcnt)
|
||||
static int wait_lpc_idle(void __iomem *mbase, unsigned int waitcnt)
|
||||
{
|
||||
u32 status;
|
||||
|
||||
|
@ -209,7 +209,7 @@ static u32 hisi_lpc_comm_in(void *hostdata, unsigned long pio, size_t dwidth)
|
|||
struct hisi_lpc_dev *lpcdev = hostdata;
|
||||
struct lpc_cycle_para iopara;
|
||||
unsigned long addr;
|
||||
u32 rd_data = 0;
|
||||
__le32 rd_data = 0;
|
||||
int ret;
|
||||
|
||||
if (!lpcdev || !dwidth || dwidth > LPC_MAX_DWIDTH)
|
||||
|
@ -244,13 +244,12 @@ static void hisi_lpc_comm_out(void *hostdata, unsigned long pio,
|
|||
struct lpc_cycle_para iopara;
|
||||
const unsigned char *buf;
|
||||
unsigned long addr;
|
||||
__le32 _val = cpu_to_le32(val);
|
||||
|
||||
if (!lpcdev || !dwidth || dwidth > LPC_MAX_DWIDTH)
|
||||
return;
|
||||
|
||||
val = cpu_to_le32(val);
|
||||
|
||||
buf = (const unsigned char *)&val;
|
||||
buf = (const unsigned char *)&_val;
|
||||
addr = hisi_lpc_pio_to_addr(lpcdev, pio);
|
||||
|
||||
iopara.opflags = FG_INCRADDR_LPC;
|
||||
|
|
|
@ -108,10 +108,10 @@ void logic_outsl(unsigned long addr, const void *buffer, unsigned int count);
|
|||
* area by redefining the macro below.
|
||||
*/
|
||||
#define PIO_INDIRECT_SIZE 0x4000
|
||||
#define MMIO_UPPER_LIMIT (IO_SPACE_LIMIT - PIO_INDIRECT_SIZE)
|
||||
#else
|
||||
#define MMIO_UPPER_LIMIT IO_SPACE_LIMIT
|
||||
#define PIO_INDIRECT_SIZE 0
|
||||
#endif /* CONFIG_INDIRECT_PIO */
|
||||
#define MMIO_UPPER_LIMIT (IO_SPACE_LIMIT - PIO_INDIRECT_SIZE)
|
||||
|
||||
struct logic_pio_hwaddr *find_io_range_by_fwnode(struct fwnode_handle *fwnode);
|
||||
unsigned long logic_pio_trans_hwaddr(struct fwnode_handle *fwnode,
|
||||
|
|
|
@ -108,7 +108,7 @@ obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o
|
|||
obj-$(CONFIG_CHECK_SIGNATURE) += check_signature.o
|
||||
obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o
|
||||
|
||||
obj-y += logic_pio.o
|
||||
lib-y += logic_pio.o
|
||||
|
||||
obj-$(CONFIG_GENERIC_HWEIGHT) += hweight.o
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* Copyright (C) 2017 HiSilicon Limited, All Rights Reserved.
|
||||
* Author: Gabriele Paoloni <gabriele.paoloni@huawei.com>
|
||||
* Author: Zhichang Yuan <yuanzhichang@hisilicon.com>
|
||||
* Author: John Garry <john.garry@huawei.com>
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "LOGIC PIO: " fmt
|
||||
|
@ -39,7 +40,8 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range)
|
|||
resource_size_t iio_sz = MMIO_UPPER_LIMIT;
|
||||
int ret = 0;
|
||||
|
||||
if (!new_range || !new_range->fwnode || !new_range->size)
|
||||
if (!new_range || !new_range->fwnode || !new_range->size ||
|
||||
(new_range->flags == LOGIC_PIO_INDIRECT && !new_range->ops))
|
||||
return -EINVAL;
|
||||
|
||||
start = new_range->hw_start;
|
||||
|
@ -237,7 +239,7 @@ type logic_in##bw(unsigned long addr) \
|
|||
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
|
||||
struct logic_pio_hwaddr *entry = find_io_range(addr); \
|
||||
\
|
||||
if (entry && entry->ops) \
|
||||
if (entry) \
|
||||
ret = entry->ops->in(entry->hostdata, \
|
||||
addr, sizeof(type)); \
|
||||
else \
|
||||
|
@ -253,7 +255,7 @@ void logic_out##bw(type value, unsigned long addr) \
|
|||
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
|
||||
struct logic_pio_hwaddr *entry = find_io_range(addr); \
|
||||
\
|
||||
if (entry && entry->ops) \
|
||||
if (entry) \
|
||||
entry->ops->out(entry->hostdata, \
|
||||
addr, value, sizeof(type)); \
|
||||
else \
|
||||
|
@ -261,7 +263,7 @@ void logic_out##bw(type value, unsigned long addr) \
|
|||
} \
|
||||
} \
|
||||
\
|
||||
void logic_ins##bw(unsigned long addr, void *buffer, \
|
||||
void logic_ins##bw(unsigned long addr, void *buffer, \
|
||||
unsigned int count) \
|
||||
{ \
|
||||
if (addr < MMIO_UPPER_LIMIT) { \
|
||||
|
@ -269,7 +271,7 @@ void logic_ins##bw(unsigned long addr, void *buffer, \
|
|||
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
|
||||
struct logic_pio_hwaddr *entry = find_io_range(addr); \
|
||||
\
|
||||
if (entry && entry->ops) \
|
||||
if (entry) \
|
||||
entry->ops->ins(entry->hostdata, \
|
||||
addr, buffer, sizeof(type), count); \
|
||||
else \
|
||||
|
@ -286,7 +288,7 @@ void logic_outs##bw(unsigned long addr, const void *buffer, \
|
|||
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
|
||||
struct logic_pio_hwaddr *entry = find_io_range(addr); \
|
||||
\
|
||||
if (entry && entry->ops) \
|
||||
if (entry) \
|
||||
entry->ops->outs(entry->hostdata, \
|
||||
addr, buffer, sizeof(type), count); \
|
||||
else \
|
||||
|
|
Loading…
Reference in New Issue