Re: [PATCH 14/14] arm/include/asm/io.h : added macros to read/write big/little endian register

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 31, 2011 at 1:05 PM, Sebastian Andrzej Siewior
<bigeasy@xxxxxxxxxxxxx> wrote:
> * Pratyush Anand | 2011-08-30 17:28:01 [+0530]:
>
>>diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
>>index 815efa2..32282b4 100644
>>--- a/arch/arm/include/asm/io.h
>>+++ b/arch/arm/include/asm/io.h
>>@@ -297,6 +297,14 @@ extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
>> extern int devmem_is_allowed(unsigned long pfn);
>> #endif
>>
>>+/* Big Endian */
>>+#define out_be32(a, v) writel(__cpu_to_be32(v), a)
>>+#define in_be32(a) __be32_to_cpu(readl(a))
>>+
>>+/* Little endian */
>>+#define out_le32(a, v) writel(__cpu_to_le32(v), a)
>>+#define in_le32(a) __le32_to_cpu(readl(a))
>
> In LE-mode __le32_to_cpu() is NOP and you get a LE value.
> In BE-mode readl() will swap a and le32_to_cpu will swap a again. So you
> get a BE value. Is this what you want?
>

There can be some peripheral like dwc-otg, whose registers will be
either in LE or in BE
depending on the RTL configuration selected by a implementor.
Software always expects a LE value when it will call "in_" and will
provide a LE value when "out_".
It expects beacuse , it wants to do same bit wise operation for both
configurations.



>>+
>
> Please split this patch out and get it accepterd by ARM community. USB
> people won't merge this.
>

Ok, will send it to ARM mailing list.

Regards
Pratyush

> Sebastian
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux