#include <linux/phy.h>
#include <linux/platform_device.h>
#include <asm/ar7/ar7.h>
-#include <asm/gpio.h>
+#include <gpio.h>
MODULE_AUTHOR("Eugene Konev");
MODULE_DESCRIPTION("TI AR7 ethernet driver (CPMAC)");
static int cpmac_stop(struct net_device *dev);
static int cpmac_open(struct net_device *dev);
+#undef CPMAC_DEBUG
#define CPMAC_LOW_THRESH 32
#define CPMAC_ALLOC_SIZE 64
#define CPMAC_SKB_SIZE 1518
}
printk("\n");
}
+
+static const char *cpmac_dump_buf(const uint8_t * buf, unsigned size)
+{
+ static char buffer[3 * 25 + 1];
+ char *p = &buffer[0];
+ if (size > 20)
+ size = 20;
+ while (size-- > 0) {
+ p += sprintf(p, " %02x", *buf++);
+ }
+ return buffer;
+}
#endif
static int cpmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
desc = priv->rx_head;
dma_cache_inv((u32)desc, 16);
-
+#ifdef CPMAC_DEBUG
+ printk(KERN_DEBUG "%s: len=%d, %s\n", __func__, pkt->datalen,
+ cpmac_dump_buf(data, pkt->datalen));
+#endif
+
while ((desc->dataflags & CPMAC_OWN) == 0) {
skb = cpmac_rx_one(dev, priv, desc);
if (likely(skb)) {
struct cpmac_priv *priv = netdev_priv(dev);
len = skb->len;
+#ifdef CPMAC_DEBUG
+ printk(KERN_DEBUG "%s: len=%d\n", __func__, len); //cpmac_dump_buf(const uint8_t * buf, unsigned size)
+#endif
if (unlikely(len < ETH_ZLEN)) {
if (unlikely(skb_padto(skb, ETH_ZLEN))) {
if (printk_ratelimit())
priv->regs->mac_eoi_vector = 0;
if (unlikely(status & (INTST_HOST | INTST_STATUS))) {
- printk(KERN_ERR "%s: hw error, resetting...\n", dev->name);
+ if (printk_ratelimit()) {
+ printk(KERN_ERR "%s: hw error, resetting...\n", dev->name);
+ }
spin_lock(&priv->lock);
phy_stop(priv->phy);
cpmac_reset(dev);
#warning FIXME: unhardcode gpio&reset bits
ar7_gpio_disable(26);
ar7_gpio_disable(27);
- ar7_device_reset(17);
- ar7_device_reset(21);
- ar7_device_reset(26);
+ ar7_device_reset(AR7_RESET_BIT_CPMAC_LO);
+ ar7_device_reset(AR7_RESET_BIT_CPMAC_HI);
+ ar7_device_reset(AR7_RESET_BIT_EPHY);
cpmac_mii.reset(&cpmac_mii);