]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Merge branch 'master' of git://git.denx.de/u-boot-net
authorTom Rini <trini@ti.com>
Sat, 31 Jan 2015 17:40:26 +0000 (12:40 -0500)
committerTom Rini <trini@ti.com>
Sat, 31 Jan 2015 17:40:26 +0000 (12:40 -0500)
drivers/net/designware.c
drivers/net/phy/micrel.c
drivers/net/smc91111.h
drivers/net/tsec.c

index 9ded8950b83d22aa6021ed8e81ee4141e6d85a23..c03e935e2fb7df54771bf6222b7ce816c53209b3 100644 (file)
@@ -236,8 +236,10 @@ static int dw_eth_init(struct eth_device *dev, bd_t *bis)
 
        start = get_timer(0);
        while (readl(&dma_p->busmode) & DMAMAC_SRST) {
-               if (get_timer(start) >= CONFIG_MACRESET_TIMEOUT)
+               if (get_timer(start) >= CONFIG_MACRESET_TIMEOUT) {
+                       printf("DMA reset timeout\n");
                        return -1;
+               }
 
                mdelay(100);
        };
index 507b9a368be72e6d24fea6da9f169cbc2c4cb579..1815b2900ddb2ad1ec80cb9d521bda1ddaa323de 100644 (file)
@@ -22,6 +22,63 @@ static struct phy_driver KSZ804_driver = {
        .shutdown = &genphy_shutdown,
 };
 
+/**
+ * KSZ8895
+ */
+
+static unsigned short smireg_to_phy(unsigned short reg)
+{
+       return ((reg & 0xc0) >> 3) + 0x06 + ((reg & 0x20) >> 5);
+}
+
+static unsigned short smireg_to_reg(unsigned short reg)
+{
+       return reg & 0x1F;
+}
+
+static void ksz8895_write_smireg(struct phy_device *phydev, int smireg, int val)
+{
+       phydev->bus->write(phydev->bus, smireg_to_phy(smireg), MDIO_DEVAD_NONE,
+                                               smireg_to_reg(smireg), val);
+}
+
+#if 0
+static int ksz8895_read_smireg(struct phy_device *phydev, int smireg)
+{
+       return phydev->bus->read(phydev->bus, smireg_to_phy(smireg),
+                                       MDIO_DEVAD_NONE, smireg_to_reg(smireg));
+}
+#endif
+
+int ksz8895_config(struct phy_device *phydev)
+{
+       /* we are connected directly to the switch without
+        * dedicated PHY. SCONF1 == 001 */
+       phydev->link = 1;
+       phydev->duplex = DUPLEX_FULL;
+       phydev->speed = SPEED_100;
+
+       /* Force the switch to start */
+       ksz8895_write_smireg(phydev, 1, 1);
+
+       return 0;
+}
+
+static int ksz8895_startup(struct phy_device *phydev)
+{
+       return 0;
+}
+
+static struct phy_driver ksz8895_driver = {
+       .name = "Micrel KSZ8895/KSZ8864",
+       .uid  = 0x221450,
+       .mask = 0xffffe1,
+       .features = PHY_BASIC_FEATURES,
+       .config   = &ksz8895_config,
+       .startup  = &ksz8895_startup,
+       .shutdown = &genphy_shutdown,
+};
+
 #ifndef CONFIG_PHY_MICREL_KSZ9021
 /*
  * I can't believe Micrel used the exact same part number
@@ -221,5 +278,6 @@ int phy_micrel_init(void)
        phy_register(&KS8721_driver);
 #endif
        phy_register(&ksz9031_driver);
+       phy_register(&ksz8895_driver);
        return 0;
 }
index d9135cb57dfa5b6058a1cc03a8fdc16b81fba92f..e19c491cbce7c00d3f429f9b7d009172bd0b66b5 100644 (file)
@@ -236,7 +236,36 @@ struct smc91111_priv{
                                          *(__b2 + __i) = SMC_inb((a),(r));  \
                                        };  \
                                }while(0)
-
+#elif defined(CONFIG_MS7206SE)
+#define SWAB7206(x) ({ word __x = x; ((__x << 8)|(__x >> 8)); })
+#define SMC_inw(a, r) *((volatile word*)((a)->iobase + (r)))
+#define SMC_inb(a, r) (*((volatile byte*)((a)->iobase + ((r) ^ 0x01))))
+#define SMC_insw(a, r, b, l) \
+       do { \
+               int __i; \
+               word *__b2 = (word *)(b);                 \
+               for (__i = 0; __i < (l); __i++) { \
+                       *__b2++ = SWAB7206(SMC_inw(a, r));      \
+               } \
+       } while (0)
+#define        SMC_outw(a, d, r)       (*((volatile word *)((a)->iobase+(r))) = d)
+#define        SMC_outb(a, d, r)       ({      word __d = (byte)(d);  \
+                               word __w = SMC_inw((a), ((r)&(~1)));    \
+                               if (((r) & 1)) \
+                                       __w = (__w & 0x00ff) | (__d << 8); \
+                               else \
+                                       __w = (__w & 0xff00) | (__d); \
+                               SMC_outw((a), __w, ((r)&(~1)));       \
+                       })
+#define SMC_outsw(a, r, b, l) \
+       do { \
+               int __i; \
+               word *__b2 = (word *)(b);                 \
+               for (__i = 0; __i < (l); __i++) { \
+                       SMC_outw(a, SWAB7206(*__b2), r);          \
+                       __b2++; \
+               } \
+       } while (0)
 #else                  /* if not CONFIG_CPU_PXA25X and not CONFIG_LEON */
 
 #ifndef CONFIG_SMC_USE_IOFUNCS /* these macros don't work on some boards */
index 79d656133adb4d50a7a28dfb529f81121db708ac..dcdba4ea827190759ea9ab0de43239a02024a096 100644 (file)
@@ -597,6 +597,8 @@ static int init_phy(struct eth_device *dev)
                tsec_configure_serdes(priv);
 
        phydev = phy_connect(priv->bus, priv->phyaddr, dev, priv->interface);
+       if (!phydev)
+               return 0;
 
        phydev->supported &= supported;
        phydev->advertising = phydev->supported;