diff mbox series

[U-Boot,01/14] mips: Add in_le32(), out_le32() etc IO accessor functions

Message ID 20181009065916.31977-1-sr@denx.de
State Superseded
Delegated to: Daniel Schwierzeck
Headers show
Series [U-Boot,01/14] mips: Add in_le32(), out_le32() etc IO accessor functions | expand

Commit Message

Stefan Roese Oct. 9, 2018, 6:59 a.m. UTC
in_le32() and out_le32() are needed for the bootcounter support.
So lets implement these accessor functions for MIPS as well.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
---
 arch/mips/include/asm/io.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Comments

Anatolij Gustschin Oct. 9, 2018, 5:38 p.m. UTC | #1
Hi Stefan,

On Tue,  9 Oct 2018 08:59:03 +0200
Stefan Roese sr@denx.de wrote:

> in_le32() and out_le32() are needed for the bootcounter support.
> So lets implement these accessor functions for MIPS as well.
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> ---
>  arch/mips/include/asm/io.h | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)

There is a similar patch pending:

  http://patchwork.ozlabs.org/patch/978674/

Thanks,
Anatolij
Stefan Roese Oct. 10, 2018, 5:57 a.m. UTC | #2
Hi Anatolij,

On 09.10.2018 19:38, Anatolij Gustschin wrote:
> Hi Stefan,
> 
> On Tue,  9 Oct 2018 08:59:03 +0200
> Stefan Roese sr@denx.de wrote:
> 
>> in_le32() and out_le32() are needed for the bootcounter support.
>> So lets implement these accessor functions for MIPS as well.
>>
>> Signed-off-by: Stefan Roese <sr@denx.de>
>> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
>> ---
>>   arch/mips/include/asm/io.h | 21 +++++++++++++++++++++
>>   1 file changed, 21 insertions(+)
> 
> There is a similar patch pending:
> 
>    http://patchwork.ozlabs.org/patch/978674/

Yes, thanks. Looks pretty identical. Please go ahead with this
one from Mario and my patch can be dropped from this series then.

Thanks,
Stefan
diff mbox series

Patch

diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index 957442effd..a750f6c0e4 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -391,6 +391,27 @@  __BUILDIO(q, u64)
 #define readq				readq
 #define writeq				writeq
 
+/* in_le32(), out_le32() and friends */
+#define out_arch(type,endian,a,v)	__raw_write##type(cpu_to_##endian(v),a)
+#define in_arch(type,endian,a)		endian##_to_cpu(__raw_read##type(a))
+
+#define out_le64(a,v)	out_arch(q,le64,a,v)
+#define out_le32(a,v)	out_arch(l,le32,a,v)
+#define out_le16(a,v)	out_arch(w,le16,a,v)
+
+#define in_le64(a)	in_arch(q,le64,a)
+#define in_le32(a)	in_arch(l,le32,a)
+#define in_le16(a)	in_arch(w,le16,a)
+
+#define out_be32(a,v)	out_arch(l,be32,a,v)
+#define out_be16(a,v)	out_arch(w,be16,a,v)
+
+#define in_be32(a)	in_arch(l,be32,a)
+#define in_be16(a)	in_arch(w,be16,a)
+
+#define out_8(a,v)	__raw_writeb(v,a)
+#define in_8(a)		__raw_readb(a)
+
 #define __BUILD_MEMORY_STRING(bwlq, type)				\
 									\
 static inline void writes##bwlq(volatile void __iomem *mem,		\