Skip to content

Commit 4bfb53e

Browse files
FlyGoatarndb
authored andcommitted
mips: add <asm-generic/io.h> including
With the adding, some default ioremap_xx methods defined in asm-generic/io.h can be used. E.g the default ioremap_uc() returning NULL. We also massaged various headers to avoid nested includes. Signed-off-by: Baoquan He <[email protected]> Signed-off-by: Jiaxun Yang <[email protected]> [[email protected]: Massage more headers, fix ioport defines] Reviewed-by: Arnd Bergmann <[email protected]> Acked-by: Thomas Bogendoerfer <[email protected]> Cc: Thomas Bogendoerfer <[email protected]> Cc: Huacai Chen <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Arnd Bergmann <[email protected]>
1 parent b85ea95 commit 4bfb53e

File tree

6 files changed

+75
-35
lines changed

6 files changed

+75
-35
lines changed

arch/mips/include/asm/io.h

Lines changed: 68 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#define _ASM_IO_H
1414

1515
#include <linux/compiler.h>
16-
#include <linux/kernel.h>
1716
#include <linux/types.h>
1817
#include <linux/irqflags.h>
1918

@@ -25,7 +24,6 @@
2524
#include <asm/cpu-features.h>
2625
#include <asm/page.h>
2726
#include <asm/pgtable-bits.h>
28-
#include <asm/processor.h>
2927
#include <asm/string.h>
3028
#include <mangle-port.h>
3129

@@ -41,6 +39,11 @@
4139
# define __raw_ioswabq(a, x) (x)
4240
# define ____raw_ioswabq(a, x) (x)
4341

42+
# define _ioswabb ioswabb
43+
# define _ioswabw ioswabw
44+
# define _ioswabl ioswabl
45+
# define _ioswabq ioswabq
46+
4447
# define __relaxed_ioswabb ioswabb
4548
# define __relaxed_ioswabw ioswabw
4649
# define __relaxed_ioswabl ioswabl
@@ -126,6 +129,7 @@ static inline phys_addr_t virt_to_phys(const volatile void *x)
126129
* almost all conceivable cases a device driver should not be using
127130
* this function
128131
*/
132+
#define phys_to_virt phys_to_virt
129133
static inline void * phys_to_virt(unsigned long address)
130134
{
131135
return __va(address);
@@ -296,9 +300,9 @@ static inline type pfx##read##bwlq(const volatile void __iomem *mem) \
296300
return pfx##ioswab##bwlq(__mem, __val); \
297301
}
298302

299-
#define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, barrier, relax, p) \
303+
#define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, barrier, relax) \
300304
\
301-
static inline void pfx##out##bwlq##p(type val, unsigned long port) \
305+
static inline void pfx##out##bwlq(type val, unsigned long port) \
302306
{ \
303307
volatile type *__addr; \
304308
type __val; \
@@ -318,7 +322,7 @@ static inline void pfx##out##bwlq##p(type val, unsigned long port) \
318322
*__addr = __val; \
319323
} \
320324
\
321-
static inline type pfx##in##bwlq##p(unsigned long port) \
325+
static inline type pfx##in##bwlq(unsigned long port) \
322326
{ \
323327
volatile type *__addr; \
324328
type __val; \
@@ -360,11 +364,10 @@ __BUILD_MEMORY_PFX(__mem_, q, u64, 0)
360364
#endif
361365

362366
#define __BUILD_IOPORT_PFX(bus, bwlq, type) \
363-
__BUILD_IOPORT_SINGLE(bus, bwlq, type, 1, 0,) \
364-
__BUILD_IOPORT_SINGLE(bus, bwlq, type, 1, 0, _p)
367+
__BUILD_IOPORT_SINGLE(bus, bwlq, type, 1, 0)
365368

366369
#define BUILDIO_IOPORT(bwlq, type) \
367-
__BUILD_IOPORT_PFX(, bwlq, type) \
370+
__BUILD_IOPORT_PFX(_, bwlq, type) \
368371
__BUILD_IOPORT_PFX(__mem_, bwlq, type)
369372

370373
BUILDIO_IOPORT(b, u8)
@@ -412,14 +415,6 @@ __BUILDIO(q, u64)
412415
#define writeq_be(val, addr) \
413416
__raw_writeq(cpu_to_be64((val)), (__force unsigned *)(addr))
414417

415-
/*
416-
* Some code tests for these symbols
417-
*/
418-
#ifdef CONFIG_64BIT
419-
#define readq readq
420-
#define writeq writeq
421-
#endif
422-
423418
#define __BUILD_MEMORY_STRING(bwlq, type) \
424419
\
425420
static inline void writes##bwlq(volatile void __iomem *mem, \
@@ -480,18 +475,6 @@ BUILDSTRING(l, u32)
480475
BUILDSTRING(q, u64)
481476
#endif
482477

483-
static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
484-
{
485-
memset((void __force *) addr, val, count);
486-
}
487-
static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count)
488-
{
489-
memcpy(dst, (void __force *) src, count);
490-
}
491-
static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count)
492-
{
493-
memcpy((void __force *) dst, src, count);
494-
}
495478

496479
/*
497480
* The caches on some architectures aren't dma-coherent and have need to
@@ -548,6 +531,61 @@ extern void (*_dma_cache_inv)(unsigned long start, unsigned long size);
548531
#define csr_out32(v, a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST) = (v))
549532
#define csr_in32(a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST))
550533

534+
535+
#define __raw_readb __raw_readb
536+
#define __raw_readw __raw_readw
537+
#define __raw_readl __raw_readl
538+
#ifdef CONFIG_64BIT
539+
#define __raw_readq __raw_readq
540+
#endif
541+
#define __raw_writeb __raw_writeb
542+
#define __raw_writew __raw_writew
543+
#define __raw_writel __raw_writel
544+
#ifdef CONFIG_64BIT
545+
#define __raw_writeq __raw_writeq
546+
#endif
547+
548+
#define readb readb
549+
#define readw readw
550+
#define readl readl
551+
#ifdef CONFIG_64BIT
552+
#define readq readq
553+
#endif
554+
#define writeb writeb
555+
#define writew writew
556+
#define writel writel
557+
#ifdef CONFIG_64BIT
558+
#define writeq writeq
559+
#endif
560+
561+
#define readsb readsb
562+
#define readsw readsw
563+
#define readsl readsl
564+
#ifdef CONFIG_64BIT
565+
#define readsq readsq
566+
#endif
567+
#define writesb writesb
568+
#define writesw writesw
569+
#define writesl writesl
570+
#ifdef CONFIG_64BIT
571+
#define writesq writesq
572+
#endif
573+
574+
#define _inb _inb
575+
#define _inw _inw
576+
#define _inl _inl
577+
#define insb insb
578+
#define insw insw
579+
#define insl insl
580+
581+
#define _outb _outb
582+
#define _outw _outw
583+
#define _outl _outl
584+
#define outsb outsb
585+
#define outsw outsw
586+
#define outsl outsl
587+
588+
551589
/*
552590
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
553591
* access
@@ -557,4 +595,6 @@ extern void (*_dma_cache_inv)(unsigned long start, unsigned long size);
557595

558596
void __ioread64_copy(void *to, const void __iomem *from, size_t count);
559597

598+
#include <asm-generic/io.h>
599+
560600
#endif /* _ASM_IO_H */

arch/mips/include/asm/mmiowb.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#ifndef _ASM_MMIOWB_H
33
#define _ASM_MMIOWB_H
44

5-
#include <asm/io.h>
5+
#include <asm/barrier.h>
66

7-
#define mmiowb() iobarrier_w()
7+
#define mmiowb() wmb()
88

99
#include <asm-generic/mmiowb.h>
1010

arch/mips/include/asm/smp-ops.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
#include <linux/errno.h>
1515

16-
#include <asm/mips-cps.h>
17-
1816
#ifdef CONFIG_SMP
1917

2018
#include <linux/cpumask.h>

arch/mips/include/asm/smp.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@
1111
#ifndef __ASM_SMP_H
1212
#define __ASM_SMP_H
1313

14-
#include <linux/bitops.h>
14+
#include <linux/compiler.h>
1515
#include <linux/linkage.h>
16-
#include <linux/smp.h>
1716
#include <linux/threads.h>
1817
#include <linux/cpumask.h>
1918

20-
#include <linux/atomic.h>
2119
#include <asm/smp-ops.h>
2220

2321
extern int smp_num_siblings;

arch/mips/kernel/setup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include <asm/sections.h>
4343
#include <asm/setup.h>
4444
#include <asm/smp-ops.h>
45+
#include <asm/mips-cps.h>
4546
#include <asm/prom.h>
4647
#include <asm/fw/fw.h>
4748

arch/mips/pci/pci-ip27.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
* Copyright (C) 1999, 2000, 04 Ralf Baechle ([email protected])
88
* Copyright (C) 1999, 2000 Silicon Graphics, Inc.
99
*/
10+
11+
#include <linux/io.h>
12+
1013
#include <asm/sn/addrs.h>
1114
#include <asm/sn/types.h>
1215
#include <asm/sn/klconfig.h>

0 commit comments

Comments
 (0)