mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-19 05:31:32 +00:00
net: macb: Fix check for little-endian system in gmac_configure_dma()
Instead of depending on CONFIG_SYS_LITTLE_ENDIAN, we check at runtime whether underlying system is little-endian or big-endian. This way we are not dependent on any U-Boot specific OR compiler specific macro to check system endianness. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
parent
d0a04db6af
commit
eff0e0c76f
1 changed files with 7 additions and 4 deletions
|
@ -91,6 +91,8 @@ struct macb_dma_desc {
|
||||||
struct macb_device {
|
struct macb_device {
|
||||||
void *regs;
|
void *regs;
|
||||||
|
|
||||||
|
bool is_big_endian;
|
||||||
|
|
||||||
const struct macb_config *config;
|
const struct macb_config *config;
|
||||||
|
|
||||||
unsigned int rx_tail;
|
unsigned int rx_tail;
|
||||||
|
@ -754,11 +756,10 @@ static void gmac_configure_dma(struct macb_device *macb)
|
||||||
dmacfg |= GEM_BIT(TXPBMS) | GEM_BF(RXBMS, -1L);
|
dmacfg |= GEM_BIT(TXPBMS) | GEM_BF(RXBMS, -1L);
|
||||||
dmacfg &= ~GEM_BIT(ENDIA_PKT);
|
dmacfg &= ~GEM_BIT(ENDIA_PKT);
|
||||||
|
|
||||||
#ifdef CONFIG_SYS_LITTLE_ENDIAN
|
if (macb->is_big_endian)
|
||||||
dmacfg &= ~GEM_BIT(ENDIA_DESC);
|
|
||||||
#else
|
|
||||||
dmacfg |= GEM_BIT(ENDIA_DESC); /* CPU in big endian */
|
dmacfg |= GEM_BIT(ENDIA_DESC); /* CPU in big endian */
|
||||||
#endif
|
else
|
||||||
|
dmacfg &= ~GEM_BIT(ENDIA_DESC);
|
||||||
|
|
||||||
dmacfg &= ~GEM_BIT(ADDR64);
|
dmacfg &= ~GEM_BIT(ADDR64);
|
||||||
gem_writel(macb, DMACFG, dmacfg);
|
gem_writel(macb, DMACFG, dmacfg);
|
||||||
|
@ -1239,6 +1240,8 @@ static int macb_eth_probe(struct udevice *dev)
|
||||||
|
|
||||||
macb->regs = (void *)pdata->iobase;
|
macb->regs = (void *)pdata->iobase;
|
||||||
|
|
||||||
|
macb->is_big_endian = (cpu_to_be32(0x12345678) == 0x12345678);
|
||||||
|
|
||||||
macb->config = (struct macb_config *)dev_get_driver_data(dev);
|
macb->config = (struct macb_config *)dev_get_driver_data(dev);
|
||||||
if (!macb->config)
|
if (!macb->config)
|
||||||
macb->config = &default_gem_config;
|
macb->config = &default_gem_config;
|
||||||
|
|
Loading…
Add table
Reference in a new issue