diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2015-09-22 14:27:16 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-09-23 15:33:15 -0700 |
commit | 06e60e5912c0373b15143cc52e4a11fafeaafff3 (patch) | |
tree | 3a42dbd67edfbdd0d4169fb398828b418b24b256 /drivers/net/ethernet/ethoc.c | |
parent | 1bb6aa56bb388ac4f7dba226aa55142fa8c65361 (diff) | |
download | linux-stable-06e60e5912c0373b15143cc52e4a11fafeaafff3.tar.gz linux-stable-06e60e5912c0373b15143cc52e4a11fafeaafff3.tar.bz2 linux-stable-06e60e5912c0373b15143cc52e4a11fafeaafff3.zip |
net/ethoc: support big-endian register layout
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ethoc.c')
-rw-r--r-- | drivers/net/ethernet/ethoc.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c index a2c96fd88393..ff665493ca97 100644 --- a/drivers/net/ethernet/ethoc.c +++ b/drivers/net/ethernet/ethoc.c @@ -201,6 +201,7 @@ struct ethoc { void __iomem *membase; int dma_alloc; resource_size_t io_region_size; + bool big_endian; unsigned int num_bd; unsigned int num_tx; @@ -236,12 +237,18 @@ struct ethoc_bd { static inline u32 ethoc_read(struct ethoc *dev, loff_t offset) { - return ioread32(dev->iobase + offset); + if (dev->big_endian) + return ioread32be(dev->iobase + offset); + else + return ioread32(dev->iobase + offset); } static inline void ethoc_write(struct ethoc *dev, loff_t offset, u32 data) { - iowrite32(data, dev->iobase + offset); + if (dev->big_endian) + iowrite32be(data, dev->iobase + offset); + else + iowrite32(data, dev->iobase + offset); } static inline void ethoc_read_bd(struct ethoc *dev, int index, @@ -1106,6 +1113,9 @@ static int ethoc_probe(struct platform_device *pdev) priv->dma_alloc = buffer_size; } + priv->big_endian = pdata ? pdata->big_endian : + of_device_is_big_endian(pdev->dev.of_node); + /* calculate the number of TX/RX buffers, maximum 128 supported */ num_bd = min_t(unsigned int, 128, (netdev->mem_end - netdev->mem_start + 1) / ETHOC_BUFSIZ); |