Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06e60e59 authored by Max Filippov's avatar Max Filippov Committed by David S. Miller
Browse files

net/ethoc: support big-endian register layout

parent 1bb6aa56
Loading
Loading
Loading
Loading
+12 −2
Original line number Original line Diff line number Diff line
@@ -201,6 +201,7 @@ struct ethoc {
	void __iomem *membase;
	void __iomem *membase;
	int dma_alloc;
	int dma_alloc;
	resource_size_t io_region_size;
	resource_size_t io_region_size;
	bool big_endian;


	unsigned int num_bd;
	unsigned int num_bd;
	unsigned int num_tx;
	unsigned int num_tx;
@@ -236,11 +237,17 @@ struct ethoc_bd {


static inline u32 ethoc_read(struct ethoc *dev, loff_t offset)
static inline u32 ethoc_read(struct ethoc *dev, loff_t offset)
{
{
	if (dev->big_endian)
		return ioread32be(dev->iobase + offset);
	else
		return ioread32(dev->iobase + offset);
		return ioread32(dev->iobase + offset);
}
}


static inline void ethoc_write(struct ethoc *dev, loff_t offset, u32 data)
static inline void ethoc_write(struct ethoc *dev, loff_t offset, u32 data)
{
{
	if (dev->big_endian)
		iowrite32be(data, dev->iobase + offset);
	else
		iowrite32(data, dev->iobase + offset);
		iowrite32(data, dev->iobase + offset);
}
}


@@ -1106,6 +1113,9 @@ static int ethoc_probe(struct platform_device *pdev)
		priv->dma_alloc = buffer_size;
		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 */
	/* calculate the number of TX/RX buffers, maximum 128 supported */
	num_bd = min_t(unsigned int,
	num_bd = min_t(unsigned int,
		128, (netdev->mem_end - netdev->mem_start + 1) / ETHOC_BUFSIZ);
		128, (netdev->mem_end - netdev->mem_start + 1) / ETHOC_BUFSIZ);
+1 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@ struct ethoc_platform_data {
	u8 hwaddr[IFHWADDRLEN];
	u8 hwaddr[IFHWADDRLEN];
	s8 phy_id;
	s8 phy_id;
	u32 eth_clkfreq;
	u32 eth_clkfreq;
	bool big_endian;
};
};


#endif /* !LINUX_NET_ETHOC_H */
#endif /* !LINUX_NET_ETHOC_H */