ARM64: hisi: SoC driver updates for 5.8

- Generate consistent behaviour for logic_pio by defining and using
   generic _inX() and _outX() in asm-generic/io.h which have per-arch
   overrideable barriers.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJevjd1AAoJEAvIV27ZiWZcyoUQAIDN4NeFM7lIpjDCNgS3P7W6
 WG+5EP/BHdnnCBarRYqaZR2B2pnwiTkHKMkDpe8aoaE51udT9bJA8dp162V2eEy0
 j/0rOOxR14k2Nj+BoNpsHbJllPQLVPkXehOpwsUhm1qGiE5w8nwZ4iG/BaW97Nbj
 TcPYnesviuRf1ghNLNyjYmkuT2zou7shJqCpKHt58o+O3S3RT7c+fbbfBy+DVSmx
 3yBersTVOklHQIqCuGPFzy/+qtMQh1iAiRVefkrYG/WOyare4Rc8DZfs0hf8Ljdr
 AJdIGBB/12H+jPUn3wdpdi0vrJ6ClUaacRvGz3Ba30eMDRFsH9ZStwWZXIO8Zoz9
 wl7kOFwX8UaHO881jvF/LTSYm+7cs/FfCV4MLCHQBx2zepxxQwM3/LAvV5zgVUA0
 ZUqgUVeEOTS/WTEE8420oHtL7p/zidG1K1cZSZoh727xoBsC9r5aGw14ceLK+Y9j
 FknxIhqITdO9BRp5vkBgQwBMDDK5SkBFdB3ZT2oZkXYzJzFxD2BHQAsFNcR7oaio
 zyQVPL7RdK40EN/WASF69m/SB4uefPPxvvSUvP77ucjMdvF006CPE+H8oS+OWZPr
 HUhp0rLZNP3bgYv2R4Ln+1CzOS8Llfb8o+tqg/C0qWFp5kadW6469xitkvlppBJA
 uBLmjjElHLg4mWG9vhvf
 =kbAg
 -----END PGP SIGNATURE-----

Merge tag 'hisi-drivers-for-5.8' of git://github.com/hisilicon/linux-hisi into arm/drivers

ARM64: hisi: SoC driver updates for 5.8

- Generate consistent behaviour for logic_pio by defining and using
  generic _inX() and _outX() in asm-generic/io.h which have per-arch
  overrideable barriers.

* tag 'hisi-drivers-for-5.8' of git://github.com/hisilicon/linux-hisi:
  logic_pio: Use _inX() and _outX()
  logic_pio: Improve macro argument name
  io: Provide _inX() and _outX()
This commit is contained in:
Arnd Bergmann 2020-05-26 00:32:10 +02:00
commit e1d908a761
2 changed files with 55 additions and 31 deletions

View File

@ -448,17 +448,15 @@ static inline void writesq(volatile void __iomem *addr, const void *buffer,
#define IO_SPACE_LIMIT 0xffff #define IO_SPACE_LIMIT 0xffff
#endif #endif
#include <linux/logic_pio.h>
/* /*
* {in,out}{b,w,l}() access little endian I/O. {in,out}{b,w,l}_p() can be * {in,out}{b,w,l}() access little endian I/O. {in,out}{b,w,l}_p() can be
* implemented on hardware that needs an additional delay for I/O accesses to * implemented on hardware that needs an additional delay for I/O accesses to
* take effect. * take effect.
*/ */
#ifndef inb #if !defined(inb) && !defined(_inb)
#define inb inb #define _inb _inb
static inline u8 inb(unsigned long addr) static inline u16 _inb(unsigned long addr)
{ {
u8 val; u8 val;
@ -469,9 +467,9 @@ static inline u8 inb(unsigned long addr)
} }
#endif #endif
#ifndef inw #if !defined(inw) && !defined(_inw)
#define inw inw #define _inw _inw
static inline u16 inw(unsigned long addr) static inline u16 _inw(unsigned long addr)
{ {
u16 val; u16 val;
@ -482,9 +480,9 @@ static inline u16 inw(unsigned long addr)
} }
#endif #endif
#ifndef inl #if !defined(inl) && !defined(_inl)
#define inl inl #define _inl _inl
static inline u32 inl(unsigned long addr) static inline u16 _inl(unsigned long addr)
{ {
u32 val; u32 val;
@ -495,9 +493,9 @@ static inline u32 inl(unsigned long addr)
} }
#endif #endif
#ifndef outb #if !defined(outb) && !defined(_outb)
#define outb outb #define _outb _outb
static inline void outb(u8 value, unsigned long addr) static inline void _outb(u8 value, unsigned long addr)
{ {
__io_pbw(); __io_pbw();
__raw_writeb(value, PCI_IOBASE + addr); __raw_writeb(value, PCI_IOBASE + addr);
@ -505,9 +503,9 @@ static inline void outb(u8 value, unsigned long addr)
} }
#endif #endif
#ifndef outw #if !defined(outw) && !defined(_outw)
#define outw outw #define _outw _outw
static inline void outw(u16 value, unsigned long addr) static inline void _outw(u16 value, unsigned long addr)
{ {
__io_pbw(); __io_pbw();
__raw_writew(cpu_to_le16(value), PCI_IOBASE + addr); __raw_writew(cpu_to_le16(value), PCI_IOBASE + addr);
@ -515,9 +513,9 @@ static inline void outw(u16 value, unsigned long addr)
} }
#endif #endif
#ifndef outl #if !defined(outl) && !defined(_outl)
#define outl outl #define _outl _outl
static inline void outl(u32 value, unsigned long addr) static inline void _outl(u32 value, unsigned long addr)
{ {
__io_pbw(); __io_pbw();
__raw_writel(cpu_to_le32(value), PCI_IOBASE + addr); __raw_writel(cpu_to_le32(value), PCI_IOBASE + addr);
@ -525,6 +523,32 @@ static inline void outl(u32 value, unsigned long addr)
} }
#endif #endif
#include <linux/logic_pio.h>
#ifndef inb
#define inb _inb
#endif
#ifndef inw
#define inw _inw
#endif
#ifndef inl
#define inl _inl
#endif
#ifndef outb
#define outb _outb
#endif
#ifndef outw
#define outw _outw
#endif
#ifndef outl
#define outl _outl
#endif
#ifndef inb_p #ifndef inb_p
#define inb_p inb_p #define inb_p inb_p
static inline u8 inb_p(unsigned long addr) static inline u8 inb_p(unsigned long addr)

View File

@ -229,13 +229,13 @@ unsigned long logic_pio_trans_cpuaddr(resource_size_t addr)
} }
#if defined(CONFIG_INDIRECT_PIO) && defined(PCI_IOBASE) #if defined(CONFIG_INDIRECT_PIO) && defined(PCI_IOBASE)
#define BUILD_LOGIC_IO(bw, type) \ #define BUILD_LOGIC_IO(bwl, type) \
type logic_in##bw(unsigned long addr) \ type logic_in##bwl(unsigned long addr) \
{ \ { \
type ret = (type)~0; \ type ret = (type)~0; \
\ \
if (addr < MMIO_UPPER_LIMIT) { \ if (addr < MMIO_UPPER_LIMIT) { \
ret = read##bw(PCI_IOBASE + addr); \ ret = _in##bwl(addr); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \ } else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \ struct logic_pio_hwaddr *entry = find_io_range(addr); \
\ \
@ -248,10 +248,10 @@ type logic_in##bw(unsigned long addr) \
return ret; \ return ret; \
} \ } \
\ \
void logic_out##bw(type value, unsigned long addr) \ void logic_out##bwl(type value, unsigned long addr) \
{ \ { \
if (addr < MMIO_UPPER_LIMIT) { \ if (addr < MMIO_UPPER_LIMIT) { \
write##bw(value, PCI_IOBASE + addr); \ _out##bwl(value, addr); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \ } else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \ struct logic_pio_hwaddr *entry = find_io_range(addr); \
\ \
@ -263,11 +263,11 @@ void logic_out##bw(type value, unsigned long addr) \
} \ } \
} \ } \
\ \
void logic_ins##bw(unsigned long addr, void *buffer, \ void logic_ins##bwl(unsigned long addr, void *buffer, \
unsigned int count) \ unsigned int count) \
{ \ { \
if (addr < MMIO_UPPER_LIMIT) { \ if (addr < MMIO_UPPER_LIMIT) { \
reads##bw(PCI_IOBASE + addr, buffer, count); \ reads##bwl(PCI_IOBASE + addr, buffer, count); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \ } else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \ struct logic_pio_hwaddr *entry = find_io_range(addr); \
\ \
@ -280,11 +280,11 @@ void logic_ins##bw(unsigned long addr, void *buffer, \
\ \
} \ } \
\ \
void logic_outs##bw(unsigned long addr, const void *buffer, \ void logic_outs##bwl(unsigned long addr, const void *buffer, \
unsigned int count) \ unsigned int count) \
{ \ { \
if (addr < MMIO_UPPER_LIMIT) { \ if (addr < MMIO_UPPER_LIMIT) { \
writes##bw(PCI_IOBASE + addr, buffer, count); \ writes##bwl(PCI_IOBASE + addr, buffer, count); \
} else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \ } else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) { \
struct logic_pio_hwaddr *entry = find_io_range(addr); \ struct logic_pio_hwaddr *entry = find_io_range(addr); \
\ \