* [U-Boot] [PATCH v2 0/3] Add generic ioremap / iounmap defines
@ 2016-06-28 1:48 Masahiro Yamada
2016-06-28 1:48 ` [U-Boot] [PATCH v2 1/3] types.h: move and redefine resource_size_t Masahiro Yamada
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Masahiro Yamada @ 2016-06-28 1:48 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
Changes in v2:
- Use #ifndef CONFIG_HAVE_ARCH_IOREMAP instead of #ifndef CONFIG_MIPS
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/Kconfig | 4 ++++
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 ++++
7 files changed, 24 insertions(+), 102 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH v2 1/3] types.h: move and redefine resource_size_t
2016-06-28 1:48 [U-Boot] [PATCH v2 0/3] Add generic ioremap / iounmap defines Masahiro Yamada
@ 2016-06-28 1:48 ` Masahiro Yamada
2016-06-29 3:28 ` Simon Glass
2016-07-16 13:48 ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-06-28 1:48 ` [U-Boot] [PATCH v2 2/3] arm, nds32, sh: remove useless ioremap()/iounmap() defines Masahiro Yamada
2016-06-28 1:48 ` [U-Boot] [PATCH v2 3/3] linux/io.h: add generic " Masahiro Yamada
2 siblings, 2 replies; 9+ messages in thread
From: Masahiro Yamada @ 2016-06-28 1:48 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>
---
Changes in v2: None
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] 9+ messages in thread
* [U-Boot] [PATCH v2 2/3] arm, nds32, sh: remove useless ioremap()/iounmap() defines
2016-06-28 1:48 [U-Boot] [PATCH v2 0/3] Add generic ioremap / iounmap defines Masahiro Yamada
2016-06-28 1:48 ` [U-Boot] [PATCH v2 1/3] types.h: move and redefine resource_size_t Masahiro Yamada
@ 2016-06-28 1:48 ` Masahiro Yamada
2016-07-16 13:48 ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-06-28 1:48 ` [U-Boot] [PATCH v2 3/3] linux/io.h: add generic " Masahiro Yamada
2 siblings, 1 reply; 9+ messages in thread
From: Masahiro Yamada @ 2016-06-28 1:48 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>
---
Changes in v2: None
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] 9+ messages in thread
* [U-Boot] [PATCH v2 3/3] linux/io.h: add generic ioremap()/iounmap() defines
2016-06-28 1:48 [U-Boot] [PATCH v2 0/3] Add generic ioremap / iounmap defines Masahiro Yamada
2016-06-28 1:48 ` [U-Boot] [PATCH v2 1/3] types.h: move and redefine resource_size_t Masahiro Yamada
2016-06-28 1:48 ` [U-Boot] [PATCH v2 2/3] arm, nds32, sh: remove useless ioremap()/iounmap() defines Masahiro Yamada
@ 2016-06-28 1:48 ` Masahiro Yamada
2016-06-28 12:07 ` Daniel Schwierzeck
2016-07-16 13:48 ` [U-Boot] [U-Boot, v2, " Tom Rini
2 siblings, 2 replies; 9+ messages in thread
From: Masahiro Yamada @ 2016-06-28 1:48 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 added a
Kconfig symbol CONFIG_HAVE_ARCH_IOREMAP which MIPS (and maybe
Sandbox as well) can select.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
Changes in v2:
- Use #ifndef CONFIG_HAVE_ARCH_IOREMAP instead of #ifndef CONFIG_MIPS
arch/Kconfig | 4 ++++
include/linux/io.h | 16 ++++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/arch/Kconfig b/arch/Kconfig
index 566f044..8090a45 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -1,6 +1,9 @@
config CREATE_ARCH_SYMLINK
bool
+config HAVE_ARCH_IOREMAP
+ bool
+
choice
prompt "Architecture select"
default SANDBOX
@@ -33,6 +36,7 @@ config MICROBLAZE
config MIPS
bool "MIPS architecture"
+ select HAVE_ARCH_IOREMAP
select HAVE_PRIVATE_LIBGCC
select SUPPORT_OF_CONTROL
diff --git a/include/linux/io.h b/include/linux/io.h
index 1b36a22..a104b7e 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_HAVE_ARCH_IOREMAP
+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] 9+ messages in thread
* [U-Boot] [PATCH v2 3/3] linux/io.h: add generic ioremap()/iounmap() defines
2016-06-28 1:48 ` [U-Boot] [PATCH v2 3/3] linux/io.h: add generic " Masahiro Yamada
@ 2016-06-28 12:07 ` Daniel Schwierzeck
2016-07-16 13:48 ` [U-Boot] [U-Boot, v2, " Tom Rini
1 sibling, 0 replies; 9+ messages in thread
From: Daniel Schwierzeck @ 2016-06-28 12:07 UTC (permalink / raw)
To: u-boot
Am 28.06.2016 um 03:48 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 added a
> Kconfig symbol CONFIG_HAVE_ARCH_IOREMAP which MIPS (and maybe
> Sandbox as well) can select.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
--
- 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/20160628/4ea5e196/attachment.sig>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH v2 1/3] types.h: move and redefine resource_size_t
2016-06-28 1:48 ` [U-Boot] [PATCH v2 1/3] types.h: move and redefine resource_size_t Masahiro Yamada
@ 2016-06-29 3:28 ` Simon Glass
2016-07-16 13:48 ` [U-Boot] [U-Boot, v2, " Tom Rini
1 sibling, 0 replies; 9+ messages in thread
From: Simon Glass @ 2016-06-29 3:28 UTC (permalink / raw)
To: u-boot
On 27 June 2016 at 18:48, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> 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>
> ---
>
> Changes in v2: None
>
> arch/arm/include/asm/types.h | 1 -
> include/linux/types.h | 4 ++++
> 2 files changed, 4 insertions(+), 1 deletion(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [U-Boot, v2, 1/3] types.h: move and redefine resource_size_t
2016-06-28 1:48 ` [U-Boot] [PATCH v2 1/3] types.h: move and redefine resource_size_t Masahiro Yamada
2016-06-29 3:28 ` Simon Glass
@ 2016-07-16 13:48 ` Tom Rini
1 sibling, 0 replies; 9+ messages in thread
From: Tom Rini @ 2016-07-16 13:48 UTC (permalink / raw)
To: u-boot
On Tue, Jun 28, 2016 at 10:48:40AM +0900, Masahiro Yamada wrote:
> 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>
> Reviewed-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160716/82c07046/attachment.sig>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [U-Boot, v2, 2/3] arm, nds32, sh: remove useless ioremap()/iounmap() defines
2016-06-28 1:48 ` [U-Boot] [PATCH v2 2/3] arm, nds32, sh: remove useless ioremap()/iounmap() defines Masahiro Yamada
@ 2016-07-16 13:48 ` Tom Rini
0 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2016-07-16 13:48 UTC (permalink / raw)
To: u-boot
On Tue, Jun 28, 2016 at 10:48:41AM +0900, Masahiro Yamada wrote:
> 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>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160716/7a3a63a4/attachment.sig>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [U-Boot, v2, 3/3] linux/io.h: add generic ioremap()/iounmap() defines
2016-06-28 1:48 ` [U-Boot] [PATCH v2 3/3] linux/io.h: add generic " Masahiro Yamada
2016-06-28 12:07 ` Daniel Schwierzeck
@ 2016-07-16 13:48 ` Tom Rini
1 sibling, 0 replies; 9+ messages in thread
From: Tom Rini @ 2016-07-16 13:48 UTC (permalink / raw)
To: u-boot
On Tue, Jun 28, 2016 at 10:48:42AM +0900, Masahiro Yamada wrote:
> 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 added a
> Kconfig symbol CONFIG_HAVE_ARCH_IOREMAP which MIPS (and maybe
> Sandbox as well) can select.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160716/6e063730/attachment.sig>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-07-16 13:48 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-28 1:48 [U-Boot] [PATCH v2 0/3] Add generic ioremap / iounmap defines Masahiro Yamada
2016-06-28 1:48 ` [U-Boot] [PATCH v2 1/3] types.h: move and redefine resource_size_t Masahiro Yamada
2016-06-29 3:28 ` Simon Glass
2016-07-16 13:48 ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-06-28 1:48 ` [U-Boot] [PATCH v2 2/3] arm, nds32, sh: remove useless ioremap()/iounmap() defines Masahiro Yamada
2016-07-16 13:48 ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-06-28 1:48 ` [U-Boot] [PATCH v2 3/3] linux/io.h: add generic " Masahiro Yamada
2016-06-28 12:07 ` Daniel Schwierzeck
2016-07-16 13:48 ` [U-Boot] [U-Boot, v2, " Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox