* [U-Boot] [PATCH 0/3] Add generic ioremap / iounmap defines
@ 2016-06-27 8:32 Masahiro Yamada
2016-06-27 8:32 ` [U-Boot] [PATCH 1/3] types.h: move and redefine resource_size_t Masahiro Yamada
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Masahiro Yamada @ 2016-06-27 8:32 UTC (permalink / raw)
To: u-boot
I ran Buildman for the whole series, and I did not see any regression.
01: Merge branch 'master' of git://git.denx.de/u-boot-uniphier
openrisc: + openrisc-generic
arc: + tb100 axs101 axs103
blackfin: + bf533-stamp cm-bf527
arm: + socfpga_is1
powerpc: + P1022DS_36BIT_NAND T2080QDS_SPIFLASH T1042RDB_PI_SPIFLASH P1010RDB-PA_36BIT_NAND P1010RDB-PB_SDCARD T1042D4RDB_NAND T4240RDB_SDCARD P1010RDB-PB_36BIT_NAND P1022DS_36BIT_SDCARD P1010RDB-PB_36BIT_SDCARD P1022DS_NAND T4160QDS_NAND T1042RDB_PI_NAND T2080RDB_NAND P1022DS_SDCARD T1042RDB_PI_SDCARD T2081QDS_NAND T4160QDS_SDCARD T2080QDS_SDCARD T4240QDS_SDCARD P1010RDB-PA_SPIFLASH T1040RDB_SDCARD B4860QDS_NAND P1010RDB-PA_36BIT_SDCARD T1040D4RDB_SDCARD T1040D4RDB_SPIFLASH T2080QDS_NAND T1040D4RDB_NAND P1010RDB-PB_SPIFLASH P1010RDB-PA_NAND T1040RDB_SPIFLASH kmcoge4 T2081QDS_SDCARD T2081QDS_SPIFLASH T4240QDS_NAND B4420QDS_NAND T1040RDB_NAND P1010RDB-PA_SDCARD T2080RDB_SPIFLASH P1010RDB-PB_NAND T1042D4RDB_SPIFLASH P1022DS_SPIFLASH T1042D4RDB_SDCARD kmlion1 P1022DS_36BIT_SPIFLASH P1010RDB-PB_36BIT_SPIFLASH T2080RDB_SDCARD P1010RDB-PA_36BIT_SPIFLASH
[snip lots of error messages we have in the mainline]
02: types.h: move and redefine resource_size_t
03: arm, nds32, sh: remove useless ioremap()/iounmap() defines
04: linux/io.h: add generic ioremap()/iounmap() defines
Masahiro Yamada (3):
types.h: move and redefine resource_size_t
arm, nds32, sh: remove useless ioremap()/iounmap() defines
linux/io.h: add generic ioremap()/iounmap() defines
arch/arm/include/asm/io.h | 34 ----------------------------------
arch/arm/include/asm/types.h | 1 -
arch/nds32/include/asm/io.h | 34 ----------------------------------
arch/sh/include/asm/io.h | 33 ---------------------------------
include/linux/io.h | 16 ++++++++++++++++
include/linux/types.h | 4 ++++
6 files changed, 20 insertions(+), 102 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 6+ messages in thread* [U-Boot] [PATCH 1/3] types.h: move and redefine resource_size_t 2016-06-27 8:32 [U-Boot] [PATCH 0/3] Add generic ioremap / iounmap defines Masahiro Yamada @ 2016-06-27 8:32 ` Masahiro Yamada 2016-06-27 8:32 ` [U-Boot] [PATCH 2/3] arm, nds32, sh: remove useless ioremap()/iounmap() defines Masahiro Yamada 2016-06-27 8:32 ` [U-Boot] [PATCH 3/3] linux/io.h: add generic " Masahiro Yamada 2 siblings, 0 replies; 6+ messages in thread From: Masahiro Yamada @ 2016-06-27 8:32 UTC (permalink / raw) To: u-boot Currently, this is only defined in arch/arm/include/asm/types.h, so move it to include/linux/types.h to make it available for all architectures. I defined it with phys_addr_t as Linux does. I needed to surround the define with #ifdef __KERNEL__ ... #endif to avoid build errors in tools building. (Host tools should not include <linux/types.h> in the first place, but this is already messy in U-Boot...) Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> --- arch/arm/include/asm/types.h | 1 - include/linux/types.h | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h index d108915..9af7353 100644 --- a/arch/arm/include/asm/types.h +++ b/arch/arm/include/asm/types.h @@ -71,5 +71,4 @@ typedef u32 dma_addr_t; #endif /* __KERNEL__ */ -typedef unsigned long resource_size_t; #endif diff --git a/include/linux/types.h b/include/linux/types.h index 6f75be4..416fa66 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -124,6 +124,10 @@ typedef __UINT64_TYPE__ u_int64_t; typedef __INT64_TYPE__ int64_t; #endif +#ifdef __KERNEL__ +typedef phys_addr_t resource_size_t; +#endif + /* * Below are truly Linux-specific types that should never collide with * any application/library that wants linux/types.h. -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 2/3] arm, nds32, sh: remove useless ioremap()/iounmap() defines 2016-06-27 8:32 [U-Boot] [PATCH 0/3] Add generic ioremap / iounmap defines Masahiro Yamada 2016-06-27 8:32 ` [U-Boot] [PATCH 1/3] types.h: move and redefine resource_size_t Masahiro Yamada @ 2016-06-27 8:32 ` Masahiro Yamada 2016-06-27 8:32 ` [U-Boot] [PATCH 3/3] linux/io.h: add generic " Masahiro Yamada 2 siblings, 0 replies; 6+ messages in thread From: Masahiro Yamada @ 2016-06-27 8:32 UTC (permalink / raw) To: u-boot These defines are valid only when iomem_valid_addr is defined, but I do not see such defines anywhere. Remove. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> --- arch/arm/include/asm/io.h | 34 ---------------------------------- arch/nds32/include/asm/io.h | 34 ---------------------------------- arch/sh/include/asm/io.h | 33 --------------------------------- 3 files changed, 101 deletions(-) diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index 9d185a6..6121f1d 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -292,40 +292,6 @@ static inline void __raw_readsl(unsigned long addr, void *data, int longlen) #define readsb(a, d, s) __raw_readsb((unsigned long)a, d, s) /* - * ioremap and friends. - * - * ioremap takes a PCI memory address, as specified in - * linux/Documentation/IO-mapping.txt. If you want a - * physical address, use __ioremap instead. - */ -extern void * __ioremap(unsigned long offset, size_t size, unsigned long flags); -extern void __iounmap(void *addr); - -/* - * Generic ioremap support. - * - * Define: - * iomem_valid_addr(off,size) - * iomem_to_phys(off) - */ -#ifdef iomem_valid_addr -#define __arch_ioremap(off,sz,nocache) \ - ({ \ - unsigned long _off = (off), _size = (sz); \ - void *_ret = (void *)0; \ - if (iomem_valid_addr(_off, _size)) \ - _ret = __ioremap(iomem_to_phys(_off),_size,nocache); \ - _ret; \ - }) - -#define __arch_iounmap __iounmap -#endif - -#define ioremap(off,sz) __arch_ioremap((off),(sz),0) -#define ioremap_nocache(off,sz) __arch_ioremap((off),(sz),1) -#define iounmap(_addr) __arch_iounmap(_addr) - -/* * DMA-consistent mapping functions. These allocate/free a region of * uncached, unwrite-buffered mapped memory space for use with DMA * devices. This is the "generic" version. The PCI specific version diff --git a/arch/nds32/include/asm/io.h b/arch/nds32/include/asm/io.h index 04708e9..b2c4d0e 100644 --- a/arch/nds32/include/asm/io.h +++ b/arch/nds32/include/asm/io.h @@ -344,40 +344,6 @@ static inline void writesl(unsigned int *addr, const void * data, int longlen) #define insl_p(port, to, len) insl(port, to, len) /* - * ioremap and friends. - * - * ioremap takes a PCI memory address, as specified in - * linux/Documentation/IO-mapping.txt. If you want a - * physical address, use __ioremap instead. - */ -extern void *__ioremap(unsigned long offset, size_t size, unsigned long flags); -extern void __iounmap(void *addr); - -/* - * Generic ioremap support. - * - * Define: - * iomem_valid_addr(off,size) - * iomem_to_phys(off) - */ -#ifdef iomem_valid_addr -#define __arch_ioremap(off, sz, nocache) \ -({ \ - unsigned long _off = (off), _size = (sz); \ - void *_ret = (void *)0; \ - if (iomem_valid_addr(_off, _size)) \ - _ret = __ioremap(iomem_to_phys(_off), _size, 0); \ - _ret; \ -}) - -#define __arch_iounmap __iounmap -#endif - -#define ioremap(off, sz) __arch_ioremap((off), (sz), 0) -#define ioremap_nocache(off, sz) __arch_ioremap((off), (sz), 1) -#define iounmap(_addr) __arch_iounmap(_addr) - -/* * DMA-consistent mapping functions. These allocate/free a region of * uncached, unwrite-buffered mapped memory space for use with DMA * devices. This is the "generic" version. The PCI specific version diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h index 0a00db3..5dc27be 100644 --- a/arch/sh/include/asm/io.h +++ b/arch/sh/include/asm/io.h @@ -128,39 +128,6 @@ extern void __raw_readsl(unsigned int addr, void *data, int longlen); #define in_8(port) inb(port) #define in_le16(port) inw(port) #define in_le32(port) inl(port) -/* - * ioremap and friends. - * - * ioremap takes a PCI memory address, as specified in - * linux/Documentation/IO-mapping.txt. If you want a - * physical address, use __ioremap instead. - */ -extern void *__ioremap(unsigned long offset, size_t size, unsigned long flags); -extern void __iounmap(void *addr); - -/* - * Generic ioremap support. - * - * Define: - * iomem_valid_addr(off,size) - * iomem_to_phys(off) - */ -#ifdef iomem_valid_addr -#define __arch_ioremap(off, sz, nocache) \ -({ \ - unsigned long _off = (off), _size = (sz); \ - void *_ret = (void *)0; \ - if (iomem_valid_addr(_off, _size)) \ - _ret = __ioremap(iomem_to_phys(_off), _size, 0); \ - _ret; \ -}) - -#define __arch_iounmap __iounmap -#endif - -#define ioremap(off, sz) __arch_ioremap((off), (sz), 0) -#define ioremap_nocache(off, sz) __arch_ioremap((off), (sz), 1) -#define iounmap(_addr) __arch_iounmap(_addr) /* * DMA-consistent mapping functions. These allocate/free a region of -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 3/3] linux/io.h: add generic ioremap()/iounmap() defines 2016-06-27 8:32 [U-Boot] [PATCH 0/3] Add generic ioremap / iounmap defines Masahiro Yamada 2016-06-27 8:32 ` [U-Boot] [PATCH 1/3] types.h: move and redefine resource_size_t Masahiro Yamada 2016-06-27 8:32 ` [U-Boot] [PATCH 2/3] arm, nds32, sh: remove useless ioremap()/iounmap() defines Masahiro Yamada @ 2016-06-27 8:32 ` Masahiro Yamada 2016-06-27 9:57 ` Daniel Schwierzeck 2 siblings, 1 reply; 6+ messages in thread From: Masahiro Yamada @ 2016-06-27 8:32 UTC (permalink / raw) To: u-boot For most of architectures in U-Boot, virtual address is straight mapped to physical address. So, it makes sense to have generic defines of ioremap and friends in <linux/io.h>. All of them are just empty and will disappear at compile time, but they will be helpful to implement drivers which are counterparts of Linux ones. I notice MIPS already has its own implementation, so I surrounded the defines with #ifndef CONFIG_MIPS ... #endif. I guess Sandbox will need its own implementation as well. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> --- include/linux/io.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/linux/io.h b/include/linux/io.h index 1b36a22..ca23caa 100644 --- a/include/linux/io.h +++ b/include/linux/io.h @@ -5,6 +5,22 @@ #ifndef _LINUX_IO_H #define _LINUX_IO_H +#include <linux/compiler.h> +#include <linux/types.h> #include <asm/io.h> +#ifndef CONFIG_MIPS +static inline void __iomem *ioremap(resource_size_t offset, + resource_size_t size) +{ + return (void __iomem *)(unsigned long)offset; +} + +static inline void iounmap(void __iomem *addr) +{ +} + +#define devm_ioremap(dev, offset, size) ioremap(offset, size) +#endif + #endif /* _LINUX_IO_H */ -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 3/3] linux/io.h: add generic ioremap()/iounmap() defines 2016-06-27 8:32 ` [U-Boot] [PATCH 3/3] linux/io.h: add generic " Masahiro Yamada @ 2016-06-27 9:57 ` Daniel Schwierzeck 2016-06-28 1:34 ` Masahiro Yamada 0 siblings, 1 reply; 6+ messages in thread From: Daniel Schwierzeck @ 2016-06-27 9:57 UTC (permalink / raw) To: u-boot Am 27.06.2016 um 10:32 schrieb Masahiro Yamada: > For most of architectures in U-Boot, virtual address is straight > mapped to physical address. So, it makes sense to have generic > defines of ioremap and friends in <linux/io.h>. > > All of them are just empty and will disappear at compile time, but > they will be helpful to implement drivers which are counterparts of > Linux ones. > > I notice MIPS already has its own implementation, so I surrounded > the defines with #ifndef CONFIG_MIPS ... #endif. I guess Sandbox > will need its own implementation as well. > how about introducing a Kconfig symbol like CONFIG_HAVE_ARCH_IOREMAP which MIPS and Sandbox can select? -- - Daniel -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 473 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160627/d656f15c/attachment.sig> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 3/3] linux/io.h: add generic ioremap()/iounmap() defines 2016-06-27 9:57 ` Daniel Schwierzeck @ 2016-06-28 1:34 ` Masahiro Yamada 0 siblings, 0 replies; 6+ messages in thread From: Masahiro Yamada @ 2016-06-28 1:34 UTC (permalink / raw) To: u-boot Hi Daniel, 2016-06-27 18:57 GMT+09:00 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>: > > > Am 27.06.2016 um 10:32 schrieb Masahiro Yamada: >> For most of architectures in U-Boot, virtual address is straight >> mapped to physical address. So, it makes sense to have generic >> defines of ioremap and friends in <linux/io.h>. >> >> All of them are just empty and will disappear at compile time, but >> they will be helpful to implement drivers which are counterparts of >> Linux ones. >> >> I notice MIPS already has its own implementation, so I surrounded >> the defines with #ifndef CONFIG_MIPS ... #endif. I guess Sandbox >> will need its own implementation as well. >> > > how about introducing a Kconfig symbol like CONFIG_HAVE_ARCH_IOREMAP > which MIPS and Sandbox can select? Good idea! I will do so in v2. -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-06-28 1:34 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-06-27 8:32 [U-Boot] [PATCH 0/3] Add generic ioremap / iounmap defines Masahiro Yamada 2016-06-27 8:32 ` [U-Boot] [PATCH 1/3] types.h: move and redefine resource_size_t Masahiro Yamada 2016-06-27 8:32 ` [U-Boot] [PATCH 2/3] arm, nds32, sh: remove useless ioremap()/iounmap() defines Masahiro Yamada 2016-06-27 8:32 ` [U-Boot] [PATCH 3/3] linux/io.h: add generic " Masahiro Yamada 2016-06-27 9:57 ` Daniel Schwierzeck 2016-06-28 1:34 ` Masahiro Yamada
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox