summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-05-09 14:17:05 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-05-09 14:17:05 +0200
commit531c25972ed2bfa7e2eb3cf7ac5f7cd068b8b01b (patch)
tree4d35fa0d9341538e7d598bafab5cdb5caa166e90
parentff47ec5d8793b1b1fa8aa9d856d81cac117918df (diff)
parent92bcd861b8f60c3315abbdfc254cccac7b20ae27 (diff)
downloadbarebox-531c25972ed2bfa7e2eb3cf7ac5f7cd068b8b01b.tar.gz
Merge branch 'for-next/net'
-rw-r--r--Documentation/user/networking.rst4
-rw-r--r--drivers/net/phy/micrel.c1
-rw-r--r--net/ifup.c21
3 files changed, 25 insertions, 1 deletions
diff --git a/Documentation/user/networking.rst b/Documentation/user/networking.rst
index 5822165..6bb99b0 100644
--- a/Documentation/user/networking.rst
+++ b/Documentation/user/networking.rst
@@ -51,6 +51,10 @@ device:
| global.net.nameserver | ipv4 address | The DNS server used for resolving host names. |
| | | May be set by DHCP |
+------------------------------+--------------+------------------------------------------------+
+| global.net.ifup_force_detect | boolean | Set to true if your network device is not |
+| | | detected automatically during start (i.e. for |
+| | | USB network adapters) |
++------------------------------+--------------+------------------------------------------------+
The first step for networking is configuring the network device. The network
device is usually ``eth0``. The current configuration can be viewed with the
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 0ca359b..fe71bfd 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -293,6 +293,7 @@ static int ksz9031_read_status(struct phy_device *phydev)
if ((regval & 0xff) == 0xff) {
phy_init_hw(phydev);
phydev->link = 0;
+ phy_wait_aneg_done(phydev);
}
return 0;
diff --git a/net/ifup.c b/net/ifup.c
index 827c5c0..d550f82 100644
--- a/net/ifup.c
+++ b/net/ifup.c
@@ -28,6 +28,9 @@
#include <globalvar.h>
#include <string.h>
#include <driver.h>
+#include <init.h>
+#include <globalvar.h>
+#include <magicvar.h>
#include <linux/stat.h>
static int eth_discover(char *file)
@@ -245,6 +248,8 @@ int ifup(const char *ethname, unsigned flags)
return ifup_edev(edev, flags);
}
+static int net_ifup_force_detect;
+
int ifup_all(unsigned flags)
{
struct eth_device *edev;
@@ -266,7 +271,9 @@ int ifup_all(unsigned flags)
closedir(dir);
- device_detect_all();
+ if ((flags & IFUP_FLAG_FORCE) || net_ifup_force_detect ||
+ list_empty(&netdev_list))
+ device_detect_all();
for_each_netdev(edev)
ifup_edev(edev, flags);
@@ -274,6 +281,18 @@ int ifup_all(unsigned flags)
return 0;
}
+static int ifup_all_init(void)
+{
+ globalvar_add_simple_bool("net.ifup_force_detect", &net_ifup_force_detect);
+
+ return 0;
+}
+late_initcall(ifup_all_init);
+
+BAREBOX_MAGICVAR_NAMED(global_net_ifup_force_detect,
+ global.net.ifup_force_detect,
+ "net: force detection of devices on ifup -a");
+
#if IS_ENABLED(CONFIG_NET_CMD_IFUP)
static int do_ifup(int argc, char *argv[])