]> git.sur5r.net Git - u-boot/commitdiff
Merge branch 'master' of git://git.denx.de/u-boot-net
authorTom Rini <trini@konsulko.com>
Wed, 30 Sep 2015 22:51:51 +0000 (18:51 -0400)
committerTom Rini <trini@konsulko.com>
Wed, 30 Sep 2015 22:51:51 +0000 (18:51 -0400)
common/bootm.c
configs/Bananapi_defconfig
configs/Bananapro_defconfig
drivers/net/netconsole.c
drivers/net/phy/phy.c
include/net.h
net/Kconfig
net/eth.c

index 667c93471be5fdb8984c5f6da5a0e033e70de1b5..c0d0d09411f0df2886db4fcec75a11ffae6ca23a 100644 (file)
@@ -474,7 +474,9 @@ ulong bootm_disable_interrupts(void)
 #ifdef CONFIG_NETCONSOLE
        /* Stop the ethernet stack if NetConsole could have left it up */
        eth_halt();
+# ifndef CONFIG_DM_ETH
        eth_unregister(eth_get_dev());
+# endif
 #endif
 
 #if defined(CONFIG_CMD_USB)
index 794b727e505dba1f754f200fbf40e3e8b5ba5d4b..898631d963245cd80bcb5980bb7ba521f299308c 100644 (file)
@@ -11,5 +11,6 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHC
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
+CONFIG_NETCONSOLE=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
index e56ca71ca27d81c608e669aa446df8969a3e20a8..e9909d97c1b5e30fa237f78eff66eb4e1ba05428 100644 (file)
@@ -13,5 +13,6 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHC
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
+CONFIG_NETCONSOLE=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
index 31042a6b6ba76566a0c74bd99918b710e8f516af..bf972dc39b9214b6ba3003a03bbc6a3e0b19ed82 100644 (file)
@@ -170,7 +170,11 @@ int nc_input_packet(uchar *pkt, struct in_addr src_ip, unsigned dest_port,
 
 static void nc_send_packet(const char *buf, int len)
 {
+#ifdef CONFIG_DM_ETH
+       struct udevice *eth;
+#else
        struct eth_device *eth;
+#endif
        int inited = 0;
        uchar *pkt;
        uchar *ether;
@@ -183,7 +187,7 @@ static void nc_send_packet(const char *buf, int len)
                return;
 
        if (!memcmp(nc_ether, net_null_ethaddr, 6)) {
-               if (eth->state == ETH_STATE_ACTIVE)
+               if (eth_is_active(eth))
                        return; /* inside net loop */
                output_packet = buf;
                output_packet_len = len;
@@ -194,7 +198,7 @@ static void nc_send_packet(const char *buf, int len)
                return;
        }
 
-       if (eth->state != ETH_STATE_ACTIVE) {
+       if (!eth_is_active(eth)) {
                if (eth_is_on_demand_init()) {
                        if (eth_init() < 0)
                                return;
@@ -292,7 +296,11 @@ static int nc_stdio_getc(struct stdio_dev *dev)
 
 static int nc_stdio_tstc(struct stdio_dev *dev)
 {
+#ifdef CONFIG_DM_ETH
+       struct udevice *eth;
+#else
        struct eth_device *eth;
+#endif
 
        if (input_recursion)
                return 0;
@@ -301,7 +309,7 @@ static int nc_stdio_tstc(struct stdio_dev *dev)
                return 1;
 
        eth = eth_get_dev();
-       if (eth && eth->state == ETH_STATE_ACTIVE)
+       if (eth_is_active(eth))
                return 0;       /* inside net loop */
 
        input_recursion = 1;
index 65c731afb64ef7ab9eaa7247dab14feea872a989..a6023f1033ecc879eff43b7719b1ca66cb6f2157 100644 (file)
@@ -571,7 +571,7 @@ static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
        memset(dev, 0, sizeof(*dev));
 
        dev->duplex = -1;
-       dev->link = 1;
+       dev->link = 0;
        dev->interface = interface;
 
        dev->autoneg = AUTONEG_ENABLE;
index f1671e38deaf745224901ec9d252cccf62b179bd..3a787cc4e981da86040f243bee07bef5d6ec9ff0 100644 (file)
@@ -149,7 +149,9 @@ struct udevice *eth_get_dev(void); /* get the current device */
  */
 struct udevice *eth_get_dev_by_name(const char *devname);
 unsigned char *eth_get_ethaddr(void); /* get the current device MAC */
+
 /* Used only when NetConsole is enabled */
+int eth_is_active(struct udevice *dev); /* Test device for active state */
 int eth_init_state_only(void); /* Set active state */
 void eth_halt_state_only(void); /* Set passive state */
 #endif
@@ -195,6 +197,8 @@ static inline unsigned char *eth_get_ethaddr(void)
        return NULL;
 }
 
+/* Used only when NetConsole is enabled */
+int eth_is_active(struct eth_device *dev); /* Test device for active state */
 /* Set active state */
 static inline __attribute__((always_inline)) int eth_init_state_only(void)
 {
index 915371df91274f51701950a0ff0543cf887d8dda..77a2f7e07e012b75bd72f1b48cf1e37a0117f320 100644 (file)
@@ -16,4 +16,10 @@ config NET_RANDOM_ETHADDR
          A new MAC address will be generated on every boot and it will
          not be added to the environment.
 
+config NETCONSOLE
+       bool "NetConsole support"
+       help
+         Support the 'nc' input/output device for networked console.
+         See README.NetConsole for details.
+
 endif   # if NET
index 26520d303885ea1e77e396b7f175d13f0299417b..2e24b55726be8a63846c835b5d3688c7d74bf670 100644 (file)
--- a/net/eth.c
+++ b/net/eth.c
@@ -389,6 +389,17 @@ void eth_halt(void)
        priv->state = ETH_STATE_PASSIVE;
 }
 
+int eth_is_active(struct udevice *dev)
+{
+       struct eth_device_priv *priv;
+
+       if (!dev || !device_active(dev))
+               return 0;
+
+       priv = dev_get_uclass_priv(dev);
+       return priv->state == ETH_STATE_ACTIVE;
+}
+
 int eth_send(void *packet, int length)
 {
        struct udevice *current;
@@ -580,7 +591,7 @@ UCLASS_DRIVER(eth) = {
        .per_device_auto_alloc_size = sizeof(struct eth_device_priv),
        .flags          = DM_UC_FLAG_SEQ_ALIAS,
 };
-#endif
+#endif /* #ifdef CONFIG_DM_ETH */
 
 #ifndef CONFIG_DM_ETH
 
@@ -918,6 +929,11 @@ void eth_halt(void)
        eth_current->state = ETH_STATE_PASSIVE;
 }
 
+int eth_is_active(struct eth_device *dev)
+{
+       return dev && dev->state == ETH_STATE_ACTIVE;
+}
+
 int eth_send(void *packet, int length)
 {
        if (!eth_current)