diff mbox

[U-Boot,04/10] net: axi_emac: Put iobase to private structure

Message ID 535c50823c3d2c6ece00d0706b09ee17912d1f00.1449835152.git.michal.simek@xilinx.com
State Accepted
Commit 6609f35b9386f54af1c2ea43a4eb75fce3dc648f
Delegated to: Michal Simek
Headers show

Commit Message

Michal Simek Dec. 11, 2015, 11:59 a.m. UTC
Saving iobase directly to private structure helps with moving to DM.
There is an option to load iobase from pdata but it is additional load.
Pointer to private structure is available all the time.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 drivers/net/xilinx_axi_emac.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Joe Hershberger Dec. 15, 2015, 8:12 p.m. UTC | #1
On Fri, Dec 11, 2015 at 5:59 AM, Michal Simek <michal.simek@xilinx.com> wrote:
> Saving iobase directly to private structure helps with moving to DM.
> There is an option to load iobase from pdata but it is additional load.
> Pointer to private structure is available all the time.

As long as the information is still coming from the pdata or device
tree that should be fine.

> Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
diff mbox

Patch

diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c
index 071e0a85b582..3c980657729e 100644
--- a/drivers/net/xilinx_axi_emac.c
+++ b/drivers/net/xilinx_axi_emac.c
@@ -86,7 +86,7 @@  struct axidma_priv {
 	struct axidma_reg *dmatx;
 	struct axidma_reg *dmarx;
 	int phyaddr;
-
+	struct axi_regs *iobase;
 	struct phy_device *phydev;
 	struct mii_dev *bus;
 };
@@ -223,7 +223,7 @@  static int setup_phy(struct eth_device *dev)
 	u16 phyreg;
 	u32 i, speed, emmc_reg, ret;
 	struct axidma_priv *priv = dev->priv;
-	struct axi_regs *regs = (struct axi_regs *)dev->iobase;
+	struct axi_regs *regs = priv->iobase;
 	struct phy_device *phydev;
 
 	u32 supported = SUPPORTED_10baseT_Half |
@@ -629,6 +629,7 @@  int xilinx_axiemac_initialize(bd_t *bis, unsigned long base_addr,
 	sprintf(dev->name, "aximac.%lx", base_addr);
 
 	dev->iobase = base_addr;
+	priv->iobase = (struct axi_regs *)base_addr;
 	priv->dmatx = (struct axidma_reg *)dma_addr;
 	/* RX channel offset is 0x30 */
 	priv->dmarx = (struct axidma_reg *)(dma_addr + 0x30);