[U-Boot] [PATCH v7 9/9] net: macb: Fix check for little-endian system in gmac_configure_dma()

Daniel Schwierzeck daniel.schwierzeck at gmail.com
Mon Jun 24 13:02:16 UTC 2019


On Mon, Jun 24, 2019 at 2:51 PM Ramon Fried <rfried.dev at gmail.com> wrote:
>
>
> On 6/24/19 3:32 PM, Bin Meng wrote:
> > Hi Ramon,
> >
> > On Mon, Jun 24, 2019 at 8:22 PM Ramon Fried <rfried.dev at gmail.com> wrote:
> >>
> >> On 6/24/19 8:03 AM, Bin Meng wrote:
> >>
> >> On Mon, Jun 24, 2019 at 12:03 PM Anup Patel <Anup.Patel at wdc.com> wrote:
> >>
> >> We should depend on __LITTLE_ENDIAN pre-defined compiler macro for
> >> little-endian system instead of U-Boot specific CONFIG_SYS_LITTLE_ENDIAN
> >> macro.
> >>
> >> Signed-off-by: Anup Patel <anup.patel at wdc.com>
> >> ---
> >>  drivers/net/macb.c | 7 ++++---
> >>  1 file changed, 4 insertions(+), 3 deletions(-)
> >>
> >> Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
> >>
> >> Hi.
> >> I don't like this approach, each platform should configure it's
> >> endianess, this is stated in README in root folder.
> >> relying on a specific GCC preprocessor extension is limiting us only to use GCC.
> >> The RISCV issue with MACB can be easily resolved by defining the
> >> CONFIG_SYS_LITTLE_ENDIAN config.
> > OK, but a system wide CONFIG_SYS_LITTLE_ENDIAN may bring side effects
> > to other drivers, as not all devices are using the same endianness
> > even in the same system. Maybe we can do something by parsing some
> > property in device tree?
> >
> > Regards,
> > Bin
>
> Hey Bin
>
> I grep'ed for all instances of CONFIG_SYS_LITTLE_ENDIAN and I don't see any place
> where something might brake. can you elaborate ?
>

can't you simply remove the non-DM part of the driver and add a
device-tree property for the endianess?

If that's not possible short-term, than maybe add a Kconfig symbol like this:

config MACB_BIG_ENDIAN
    bool "...."
    depends on MACB
    default y if SYS_BIG_ENDIAN
    default n

this way it's automatically sync'ed with
CONFIG_SYS_LITTLE_ENDIAN/CONFIG_SYS_BIG_ENDIAN, but a board config
could still override this setting.

-- 
- Daniel


More information about the U-Boot mailing list