* (C) Copyright 2009 Faraday Technology
* Po-Yu Chuang <ratbert@faraday-tech.com>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * SPDX-License-Identifier: GPL-2.0+
*/
#include <config.h>
#define ETH_ZLEN 60
struct ftmac100_data {
- volatile struct ftmac100_txdes txdes[1];
- volatile struct ftmac100_rxdes rxdes[PKTBUFSRX];
+ struct ftmac100_txdes txdes[1];
+ struct ftmac100_rxdes rxdes[PKTBUFSRX];
int rx_index;
};
{
struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
struct ftmac100_data *priv = dev->priv;
- volatile struct ftmac100_txdes *txdes = priv->txdes;
- volatile struct ftmac100_rxdes *rxdes = priv->rxdes;
+ struct ftmac100_txdes *txdes = priv->txdes;
+ struct ftmac100_rxdes *rxdes = priv->rxdes;
unsigned int maccr;
int i;
for (i = 0; i < PKTBUFSRX; i++) {
/* RXBUF_BADR */
- rxdes[i].rxdes2 = (unsigned int)NetRxPackets[i];
+ rxdes[i].rxdes2 = (unsigned int)net_rx_packets[i];
rxdes[i].rxdes1 |= FTMAC100_RXDES1_RXBUF_SIZE (PKTSIZE_ALIGN);
rxdes[i].rxdes0 = FTMAC100_RXDES0_RXDMA_OWN;
}
static int ftmac100_recv (struct eth_device *dev)
{
struct ftmac100_data *priv = dev->priv;
- volatile struct ftmac100_rxdes *curr_des;
+ struct ftmac100_rxdes *curr_des;
unsigned short rxlen;
curr_des = &priv->rxdes[priv->rx_index];
/* pass the packet up to the protocol layers. */
- NetReceive ((void *)curr_des->rxdes2, rxlen);
+ net_process_received_packet((void *)curr_des->rxdes2, rxlen);
/* release buffer to DMA */
/*
* Send a data block via Ethernet
*/
-static int
-ftmac100_send (struct eth_device *dev, volatile void *packet, int length)
+static int ftmac100_send(struct eth_device *dev, void *packet, int length)
{
struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
struct ftmac100_data *priv = dev->priv;
- volatile struct ftmac100_txdes *curr_des = priv->txdes;
- int tmo;
+ struct ftmac100_txdes *curr_des = priv->txdes;
+ ulong start;
if (curr_des->txdes0 & FTMAC100_TXDES0_TXDMA_OWN) {
debug ("%s(): no TX descriptor available\n", __func__);
/* wait for transfer to succeed */
- tmo = get_timer (0) + 5 * CONFIG_SYS_HZ;
+ start = get_timer(0);
while (curr_des->txdes0 & FTMAC100_TXDES0_TXDMA_OWN) {
- if (get_timer (0) >= tmo) {
+ if (get_timer(start) >= 5) {
debug ("%s(): timed out\n", __func__);
return -1;
}
memset (dev, 0, sizeof (*dev));
memset (priv, 0, sizeof (*priv));
- sprintf (dev->name, "FTMAC100");
+ strcpy(dev->name, "FTMAC100");
dev->iobase = CONFIG_FTMAC100_BASE;
dev->init = ftmac100_init;
dev->halt = ftmac100_halt;