Source
// SPDX-License-Identifier: GPL-2.0+
/*
* Cirrus Logic CS8900A Ethernet
*
* (C) 2009 Ben Warren , biggerbadderben@gmail.com
* Converted to use CONFIG_NET_MULTI API
*
* (C) 2003 Wolfgang Denk, wd@denx.de
* Extension to synchronize ethaddr environment variable
* against value in EEPROM
*
* (C) Copyright 2002
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
* Marius Groeger <mgroeger@sysgo.de>
*
* Copyright (C) 1999 Ben Williamson <benw@pobox.com>
*
* This program is loaded into SRAM in bootstrap mode, where it waits
* for commands on UART1 to read and write memory, jump to code etc.
* A design goal for this program is to be entirely independent of the
* target board. Anything with a CL-PS7111 or EP7211 should be able to run
* this code in bootstrap mode. All the board specifics can be handled on
* the host.
*/
/* packet page register access functions */
/* we don't need 16 bit initialisation on 32 bit bus */
static u16 get_reg_init_bus(struct eth_device *dev, int regno)
{
/* force 16 bit busmode */
struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv);
uint8_t volatile * const iob = (uint8_t volatile * const)dev->iobase;
readb(iob);
readb(iob + 1);
readb(iob);
readb(iob + 1);
readb(iob);
REG_WRITE(regno, &priv->regs->pptr);
return REG_READ(&priv->regs->pdata);
}
static u16 get_reg(struct eth_device *dev, int regno)
{
struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv);
REG_WRITE(regno, &priv->regs->pptr);
return REG_READ(&priv->regs->pdata);
}
static void put_reg(struct eth_device *dev, int regno, u16 val)
{
struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv);
REG_WRITE(regno, &priv->regs->pptr);
REG_WRITE(val, &priv->regs->pdata);
}
static void cs8900_reset(struct eth_device *dev)
{
int tmo;
u16 us;
/* reset NIC */
put_reg(dev, PP_SelfCTL, get_reg(dev, PP_SelfCTL) | PP_SelfCTL_Reset);
/* wait for 200ms */
udelay(200000);
/* Wait until the chip is reset */