mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-09-28 09:11:34 +02:00
net: ftmac100: simplify priv->iobase casting
Replace 'phys_addr_t iobase' with 'struct ftmac100 *ftmac100' in struct ftmac100_data. It allows to remove casting in a number of places. Since priv->iobase is phys_addr_t, use phys_to_virt() to make a pointer from it. Signed-off-by: Sergei Antonov <saproj@gmail.com> Reviewed-by: Rick Chen <rick@andestech.com>
This commit is contained in:
parent
e9a1d8bfc9
commit
9628c3e8b1
@ -28,7 +28,7 @@ struct ftmac100_data {
|
|||||||
struct ftmac100_rxdes rxdes[PKTBUFSRX];
|
struct ftmac100_rxdes rxdes[PKTBUFSRX];
|
||||||
int rx_index;
|
int rx_index;
|
||||||
const char *name;
|
const char *name;
|
||||||
phys_addr_t iobase;
|
struct ftmac100 *ftmac100;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -36,7 +36,7 @@ struct ftmac100_data {
|
|||||||
*/
|
*/
|
||||||
static void ftmac100_reset(struct ftmac100_data *priv)
|
static void ftmac100_reset(struct ftmac100_data *priv)
|
||||||
{
|
{
|
||||||
struct ftmac100 *ftmac100 = (struct ftmac100 *)(uintptr_t)priv->iobase;
|
struct ftmac100 *ftmac100 = priv->ftmac100;
|
||||||
|
|
||||||
debug ("%s()\n", __func__);
|
debug ("%s()\n", __func__);
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ static void ftmac100_reset(struct ftmac100_data *priv)
|
|||||||
static void ftmac100_set_mac(struct ftmac100_data *priv ,
|
static void ftmac100_set_mac(struct ftmac100_data *priv ,
|
||||||
const unsigned char *mac)
|
const unsigned char *mac)
|
||||||
{
|
{
|
||||||
struct ftmac100 *ftmac100 = (struct ftmac100 *)(uintptr_t)priv->iobase;
|
struct ftmac100 *ftmac100 = priv->ftmac100;
|
||||||
unsigned int maddr = mac[0] << 8 | mac[1];
|
unsigned int maddr = mac[0] << 8 | mac[1];
|
||||||
unsigned int laddr = mac[2] << 24 | mac[3] << 16 | mac[4] << 8 | mac[5];
|
unsigned int laddr = mac[2] << 24 | mac[3] << 16 | mac[4] << 8 | mac[5];
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ static void ftmac100_set_mac(struct ftmac100_data *priv ,
|
|||||||
*/
|
*/
|
||||||
static void _ftmac100_halt(struct ftmac100_data *priv)
|
static void _ftmac100_halt(struct ftmac100_data *priv)
|
||||||
{
|
{
|
||||||
struct ftmac100 *ftmac100 = (struct ftmac100 *)(uintptr_t)priv->iobase;
|
struct ftmac100 *ftmac100 = priv->ftmac100;
|
||||||
debug ("%s()\n", __func__);
|
debug ("%s()\n", __func__);
|
||||||
writel (0, &ftmac100->maccr);
|
writel (0, &ftmac100->maccr);
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ static void _ftmac100_halt(struct ftmac100_data *priv)
|
|||||||
*/
|
*/
|
||||||
static int _ftmac100_init(struct ftmac100_data *priv, unsigned char enetaddr[6])
|
static int _ftmac100_init(struct ftmac100_data *priv, unsigned char enetaddr[6])
|
||||||
{
|
{
|
||||||
struct ftmac100 *ftmac100 = (struct ftmac100 *)(uintptr_t)priv->iobase;
|
struct ftmac100 *ftmac100 = priv->ftmac100;
|
||||||
struct ftmac100_txdes *txdes = priv->txdes;
|
struct ftmac100_txdes *txdes = priv->txdes;
|
||||||
struct ftmac100_rxdes *rxdes = priv->rxdes;
|
struct ftmac100_rxdes *rxdes = priv->rxdes;
|
||||||
unsigned int maccr;
|
unsigned int maccr;
|
||||||
@ -187,7 +187,7 @@ static int __ftmac100_recv(struct ftmac100_data *priv)
|
|||||||
*/
|
*/
|
||||||
static int _ftmac100_send(struct ftmac100_data *priv, void *packet, int length)
|
static int _ftmac100_send(struct ftmac100_data *priv, void *packet, int length)
|
||||||
{
|
{
|
||||||
struct ftmac100 *ftmac100 = (struct ftmac100 *)(uintptr_t)priv->iobase;
|
struct ftmac100 *ftmac100 = priv->ftmac100;
|
||||||
struct ftmac100_txdes *curr_des = priv->txdes;
|
struct ftmac100_txdes *curr_des = priv->txdes;
|
||||||
ulong start;
|
ulong start;
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ static int ftmac100_of_to_plat(struct udevice *dev)
|
|||||||
struct eth_pdata *pdata = dev_get_plat(dev);
|
struct eth_pdata *pdata = dev_get_plat(dev);
|
||||||
const char *mac;
|
const char *mac;
|
||||||
pdata->iobase = dev_read_addr(dev);
|
pdata->iobase = dev_read_addr(dev);
|
||||||
priv->iobase = pdata->iobase;
|
priv->ftmac100 = phys_to_virt(pdata->iobase);
|
||||||
mac = dtbmacaddr(0);
|
mac = dtbmacaddr(0);
|
||||||
if (mac)
|
if (mac)
|
||||||
memcpy(pdata->enetaddr , mac , 6);
|
memcpy(pdata->enetaddr , mac , 6);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user