diff options
author | Horia Geantă <horia.geanta@nxp.com> | 2016-05-19 11:10:56 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-05-31 04:41:50 -0400 |
commit | 9e44fb1816dba8f283809a25c29ff7969a3acb99 (patch) | |
tree | 944aa133322f24d2e5514cb1b3f17de5444da323 | |
parent | 7a1aedba7061948eee4d188740e24ffb20ff7ab7 (diff) |
asm-generic/io.h: add io{read,write}64 accessors
This will allow device drivers to consistently use io{read,write}XX
also for 64-bit accesses.
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | include/asm-generic/io.h | 63 | ||||
-rw-r--r-- | include/asm-generic/iomap.h | 8 |
2 files changed, 71 insertions, 0 deletions
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index 325c8908f6de..7ef015eb3403 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h | |||
@@ -585,6 +585,16 @@ static inline u32 ioread32(const volatile void __iomem *addr) | |||
585 | } | 585 | } |
586 | #endif | 586 | #endif |
587 | 587 | ||
588 | #ifdef CONFIG_64BIT | ||
589 | #ifndef ioread64 | ||
590 | #define ioread64 ioread64 | ||
591 | static inline u64 ioread64(const volatile void __iomem *addr) | ||
592 | { | ||
593 | return readq(addr); | ||
594 | } | ||
595 | #endif | ||
596 | #endif /* CONFIG_64BIT */ | ||
597 | |||
588 | #ifndef iowrite8 | 598 | #ifndef iowrite8 |
589 | #define iowrite8 iowrite8 | 599 | #define iowrite8 iowrite8 |
590 | static inline void iowrite8(u8 value, volatile void __iomem *addr) | 600 | static inline void iowrite8(u8 value, volatile void __iomem *addr) |
@@ -609,6 +619,16 @@ static inline void iowrite32(u32 value, volatile void __iomem *addr) | |||
609 | } | 619 | } |
610 | #endif | 620 | #endif |
611 | 621 | ||
622 | #ifdef CONFIG_64BIT | ||
623 | #ifndef iowrite64 | ||
624 | #define iowrite64 iowrite64 | ||
625 | static inline void iowrite64(u64 value, volatile void __iomem *addr) | ||
626 | { | ||
627 | writeq(value, addr); | ||
628 | } | ||
629 | #endif | ||
630 | #endif /* CONFIG_64BIT */ | ||
631 | |||
612 | #ifndef ioread16be | 632 | #ifndef ioread16be |
613 | #define ioread16be ioread16be | 633 | #define ioread16be ioread16be |
614 | static inline u16 ioread16be(const volatile void __iomem *addr) | 634 | static inline u16 ioread16be(const volatile void __iomem *addr) |
@@ -625,6 +645,16 @@ static inline u32 ioread32be(const volatile void __iomem *addr) | |||
625 | } | 645 | } |
626 | #endif | 646 | #endif |
627 | 647 | ||
648 | #ifdef CONFIG_64BIT | ||
649 | #ifndef ioread64be | ||
650 | #define ioread64be ioread64be | ||
651 | static inline u64 ioread64be(const volatile void __iomem *addr) | ||
652 | { | ||
653 | return swab64(readq(addr)); | ||
654 | } | ||
655 | #endif | ||
656 | #endif /* CONFIG_64BIT */ | ||
657 | |||
628 | #ifndef iowrite16be | 658 | #ifndef iowrite16be |
629 | #define iowrite16be iowrite16be | 659 | #define iowrite16be iowrite16be |
630 | static inline void iowrite16be(u16 value, void volatile __iomem *addr) | 660 | static inline void iowrite16be(u16 value, void volatile __iomem *addr) |
@@ -641,6 +671,16 @@ static inline void iowrite32be(u32 value, volatile void __iomem *addr) | |||
641 | } | 671 | } |
642 | #endif | 672 | #endif |
643 | 673 | ||
674 | #ifdef CONFIG_64BIT | ||
675 | #ifndef iowrite64be | ||
676 | #define iowrite64be iowrite64be | ||
677 | static inline void iowrite64be(u64 value, volatile void __iomem *addr) | ||
678 | { | ||
679 | writeq(swab64(value), addr); | ||
680 | } | ||
681 | #endif | ||
682 | #endif /* CONFIG_64BIT */ | ||
683 | |||
644 | #ifndef ioread8_rep | 684 | #ifndef ioread8_rep |
645 | #define ioread8_rep ioread8_rep | 685 | #define ioread8_rep ioread8_rep |
646 | static inline void ioread8_rep(const volatile void __iomem *addr, void *buffer, | 686 | static inline void ioread8_rep(const volatile void __iomem *addr, void *buffer, |
@@ -668,6 +708,17 @@ static inline void ioread32_rep(const volatile void __iomem *addr, | |||
668 | } | 708 | } |
669 | #endif | 709 | #endif |
670 | 710 | ||
711 | #ifdef CONFIG_64BIT | ||
712 | #ifndef ioread64_rep | ||
713 | #define ioread64_rep ioread64_rep | ||
714 | static inline void ioread64_rep(const volatile void __iomem *addr, | ||
715 | void *buffer, unsigned int count) | ||
716 | { | ||
717 | readsq(addr, buffer, count); | ||
718 | } | ||
719 | #endif | ||
720 | #endif /* CONFIG_64BIT */ | ||
721 | |||
671 | #ifndef iowrite8_rep | 722 | #ifndef iowrite8_rep |
672 | #define iowrite8_rep iowrite8_rep | 723 | #define iowrite8_rep iowrite8_rep |
673 | static inline void iowrite8_rep(volatile void __iomem *addr, | 724 | static inline void iowrite8_rep(volatile void __iomem *addr, |
@@ -697,6 +748,18 @@ static inline void iowrite32_rep(volatile void __iomem *addr, | |||
697 | writesl(addr, buffer, count); | 748 | writesl(addr, buffer, count); |
698 | } | 749 | } |
699 | #endif | 750 | #endif |
751 | |||
752 | #ifdef CONFIG_64BIT | ||
753 | #ifndef iowrite64_rep | ||
754 | #define iowrite64_rep iowrite64_rep | ||
755 | static inline void iowrite64_rep(volatile void __iomem *addr, | ||
756 | const void *buffer, | ||
757 | unsigned int count) | ||
758 | { | ||
759 | writesq(addr, buffer, count); | ||
760 | } | ||
761 | #endif | ||
762 | #endif /* CONFIG_64BIT */ | ||
700 | #endif /* CONFIG_GENERIC_IOMAP */ | 763 | #endif /* CONFIG_GENERIC_IOMAP */ |
701 | 764 | ||
702 | #ifdef __KERNEL__ | 765 | #ifdef __KERNEL__ |
diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h index d8f8622fa044..650fede33c25 100644 --- a/include/asm-generic/iomap.h +++ b/include/asm-generic/iomap.h | |||
@@ -30,12 +30,20 @@ extern unsigned int ioread16(void __iomem *); | |||
30 | extern unsigned int ioread16be(void __iomem *); | 30 | extern unsigned int ioread16be(void __iomem *); |
31 | extern unsigned int ioread32(void __iomem *); | 31 | extern unsigned int ioread32(void __iomem *); |
32 | extern unsigned int ioread32be(void __iomem *); | 32 | extern unsigned int ioread32be(void __iomem *); |
33 | #ifdef CONFIG_64BIT | ||
34 | extern u64 ioread64(void __iomem *); | ||
35 | extern u64 ioread64be(void __iomem *); | ||
36 | #endif | ||
33 | 37 | ||
34 | extern void iowrite8(u8, void __iomem *); | 38 | extern void iowrite8(u8, void __iomem *); |
35 | extern void iowrite16(u16, void __iomem *); | 39 | extern void iowrite16(u16, void __iomem *); |
36 | extern void iowrite16be(u16, void __iomem *); | 40 | extern void iowrite16be(u16, void __iomem *); |
37 | extern void iowrite32(u32, void __iomem *); | 41 | extern void iowrite32(u32, void __iomem *); |
38 | extern void iowrite32be(u32, void __iomem *); | 42 | extern void iowrite32be(u32, void __iomem *); |
43 | #ifdef CONFIG_64BIT | ||
44 | extern void iowrite64(u64, void __iomem *); | ||
45 | extern void iowrite64be(u64, void __iomem *); | ||
46 | #endif | ||
39 | 47 | ||
40 | /* | 48 | /* |
41 | * "string" versions of the above. Note that they | 49 | * "string" versions of the above. Note that they |