Revert "Use stable MAC address for rpi boards with ethernet"
This reverts commit 0ffad22231
.
This commit is contained in:
parent
0ffad22231
commit
292e197a03
|
@ -1,105 +0,0 @@
|
|||
From 60aa7209a0e3194208ae6d58145c28e3c951ca50 Mon Sep 17 00:00:00 2001
|
||||
From: Lubomir Rintel <lkundrak@v3.sk>
|
||||
Date: Wed, 3 Feb 2016 14:12:54 +0100
|
||||
Subject: [PATCH 2/4] ARM: bcm2835: dt: Add the ethernet to the device trees
|
||||
|
||||
The hub and the ethernet in its port 1 are hardwired on the board.
|
||||
|
||||
Compared to the adapters that can be plugged into the USB ports, this
|
||||
one has no serial EEPROM to store its MAC. Nevertheless, the Raspberry Pi
|
||||
has the MAC address for this adapter in its ROM, accessible from its
|
||||
firmware.
|
||||
|
||||
U-Boot can read out the address and set the local-mac-address property of the
|
||||
node with "ethernet" alias. Let's add the node so that U-Boot can do its
|
||||
business.
|
||||
|
||||
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
|
||||
---
|
||||
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 18 ++++++++++++++++++
|
||||
arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts | 18 ++++++++++++++++++
|
||||
arch/arm/boot/dts/bcm283x.dtsi | 2 ++
|
||||
3 files changed, 38 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
|
||||
index 57d313b..160ac85 100644
|
||||
--- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
|
||||
+++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
|
||||
@@ -6,6 +6,10 @@
|
||||
compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
|
||||
model = "Raspberry Pi Model B+";
|
||||
|
||||
+ aliases {
|
||||
+ ethernet = ðernet;
|
||||
+ };
|
||||
+
|
||||
leds {
|
||||
act {
|
||||
gpios = <&gpio 47 0>;
|
||||
@@ -33,3 +37,17 @@
|
||||
&hdmi {
|
||||
hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
+
|
||||
+&usb {
|
||||
+ usb1@01 {
|
||||
+ compatible = "usb0424,9514";
|
||||
+ reg = <01>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ ethernet: usbether@01 {
|
||||
+ compatible = "usb0424,ec00";
|
||||
+ reg = <01>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
|
||||
index cf2774e..081dc56 100644
|
||||
--- a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
|
||||
+++ b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
|
||||
@@ -6,6 +6,10 @@
|
||||
compatible = "raspberrypi,model-b-rev2", "brcm,bcm2835";
|
||||
model = "Raspberry Pi Model B rev2";
|
||||
|
||||
+ aliases {
|
||||
+ ethernet = ðernet;
|
||||
+ };
|
||||
+
|
||||
leds {
|
||||
act {
|
||||
gpios = <&gpio 16 1>;
|
||||
@@ -26,3 +30,17 @@
|
||||
&hdmi {
|
||||
hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
+
|
||||
+&usb {
|
||||
+ usb1@01 {
|
||||
+ compatible = "usb0424,9512";
|
||||
+ reg = <01>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ ethernet: usbether@01 {
|
||||
+ compatible = "usb0424,ec00";
|
||||
+ reg = <01>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi
|
||||
index 31cc2f2..2f1e7de 100644
|
||||
--- a/arch/arm/boot/dts/bcm283x.dtsi
|
||||
+++ b/arch/arm/boot/dts/bcm283x.dtsi
|
||||
@@ -267,6 +267,8 @@
|
||||
compatible = "brcm,bcm2835-usb";
|
||||
reg = <0x7e980000 0x10000>;
|
||||
interrupts = <1 9>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
};
|
||||
|
||||
v3d: v3d@7ec00000 {
|
||||
--
|
||||
2.5.5
|
||||
|
|
@ -1,186 +0,0 @@
|
|||
From 5ab960c506a1cd60fe3079ec5c234605388fd166 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Chen <peter.chen@freescale.com>
|
||||
Date: Mon, 25 Jan 2016 07:24:39 +0100
|
||||
Subject: [PATCH 3/4] USB: core: let USB device know device node
|
||||
|
||||
Although most of USB devices are hot-plug's, there are still some devices
|
||||
are hard wired on the board, eg, for HSIC and SSIC interface USB devices.
|
||||
If these kinds of USB devices are multiple functions, and they can supply
|
||||
other interfaces like i2c, gpios for other devices, we may need to
|
||||
describe these at device tree.
|
||||
|
||||
In this commit, it uses "reg" in dts as physical port number to match
|
||||
the phyiscal port number decided by USB core, if they are the same,
|
||||
then the device node is for the device we are creating for USB core.
|
||||
|
||||
Signed-off-by: Peter Chen <peter.chen@freescale.com>
|
||||
---
|
||||
.../devicetree/bindings/usb/usb-device.txt | 25 ++++++++++++
|
||||
drivers/usb/core/Makefile | 2 +-
|
||||
drivers/usb/core/of.c | 47 ++++++++++++++++++++++
|
||||
drivers/usb/core/usb.c | 14 ++++++-
|
||||
include/linux/usb/of.h | 7 ++++
|
||||
5 files changed, 92 insertions(+), 3 deletions(-)
|
||||
create mode 100644 Documentation/devicetree/bindings/usb/usb-device.txt
|
||||
create mode 100644 drivers/usb/core/of.c
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/usb/usb-device.txt b/Documentation/devicetree/bindings/usb/usb-device.txt
|
||||
new file mode 100644
|
||||
index 0000000..c702885
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/usb/usb-device.txt
|
||||
@@ -0,0 +1,25 @@
|
||||
+Generic USB Device Properties
|
||||
+
|
||||
+Usually, we only use device tree for hard wired USB device.
|
||||
+The reference binding doc is from:
|
||||
+http://www.firmware.org/1275/bindings/usb/usb-1_0.ps
|
||||
+
|
||||
+Required properties:
|
||||
+- compatible: usbVID,PID
|
||||
+- reg: the port number which this device is connecting to, the range
|
||||
+ is 1-31.
|
||||
+
|
||||
+
|
||||
+Example:
|
||||
+
|
||||
+&usb1 {
|
||||
+ status = "okay";
|
||||
+
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ hub: genesys@1 {
|
||||
+ compatible = "usb05e3,0608";
|
||||
+ reg = <0x1>;
|
||||
+ };
|
||||
+}
|
||||
diff --git a/drivers/usb/core/Makefile b/drivers/usb/core/Makefile
|
||||
index 2f6f932..9780877 100644
|
||||
--- a/drivers/usb/core/Makefile
|
||||
+++ b/drivers/usb/core/Makefile
|
||||
@@ -5,7 +5,7 @@
|
||||
usbcore-y := usb.o hub.o hcd.o urb.o message.o driver.o
|
||||
usbcore-y += config.o file.o buffer.o sysfs.o endpoint.o
|
||||
usbcore-y += devio.o notify.o generic.o quirks.o devices.o
|
||||
-usbcore-y += port.o
|
||||
+usbcore-y += port.o of.o
|
||||
|
||||
usbcore-$(CONFIG_PCI) += hcd-pci.o
|
||||
usbcore-$(CONFIG_ACPI) += usb-acpi.o
|
||||
diff --git a/drivers/usb/core/of.c b/drivers/usb/core/of.c
|
||||
new file mode 100644
|
||||
index 0000000..2289700
|
||||
--- /dev/null
|
||||
+++ b/drivers/usb/core/of.c
|
||||
@@ -0,0 +1,47 @@
|
||||
+/*
|
||||
+ * of.c The helpers for hcd device tree support
|
||||
+ *
|
||||
+ * Copyright (C) 2016 Freescale Semiconductor, Inc.
|
||||
+ * Author: Peter Chen <peter.chen@freescale.com>
|
||||
+ *
|
||||
+ * This program is free software: you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License version 2 of
|
||||
+ * the License as published by the Free Software Foundation.
|
||||
+ *
|
||||
+ * 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, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/of.h>
|
||||
+
|
||||
+/**
|
||||
+ * usb_of_get_child_node - Find the device node match port number
|
||||
+ * @parent: the parent device node
|
||||
+ * @portnum: the port number which device is connecting
|
||||
+ *
|
||||
+ * Find the node from device tree according to its port number.
|
||||
+ *
|
||||
+ * Return: On success, a pointer to the device node, %NULL on failure.
|
||||
+ */
|
||||
+struct device_node *usb_of_get_child_node(struct device_node *parent,
|
||||
+ int portnum)
|
||||
+{
|
||||
+ struct device_node *node;
|
||||
+ u32 port;
|
||||
+
|
||||
+ for_each_child_of_node(parent, node) {
|
||||
+ if (!of_property_read_u32(node, "reg", &port)) {
|
||||
+ if (port == portnum)
|
||||
+ return node;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(usb_of_get_child_node);
|
||||
+
|
||||
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
|
||||
index ebb29ca..25d9770 100644
|
||||
--- a/drivers/usb/core/usb.c
|
||||
+++ b/drivers/usb/core/usb.c
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/debugfs.h>
|
||||
+#include <linux/usb/of.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <linux/scatterlist.h>
|
||||
@@ -508,11 +509,20 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent,
|
||||
dev->connect_time = jiffies;
|
||||
dev->active_duration = -jiffies;
|
||||
#endif
|
||||
- if (root_hub) /* Root hub always ok [and always wired] */
|
||||
+ if (root_hub) { /* Root hub always ok [and always wired] */
|
||||
dev->authorized = 1;
|
||||
- else {
|
||||
+ dev->dev.of_node = bus->controller->of_node;
|
||||
+ } else {
|
||||
dev->authorized = !!HCD_DEV_AUTHORIZED(usb_hcd);
|
||||
dev->wusb = usb_bus_is_wusb(bus) ? 1 : 0;
|
||||
+
|
||||
+ if (dev->dev.parent->parent == bus->controller)
|
||||
+ /* device under root hub's port */
|
||||
+ port1 = usb_hcd_find_raw_port_number(usb_hcd,
|
||||
+ port1);
|
||||
+
|
||||
+ dev->dev.of_node = usb_of_get_child_node(parent->dev.of_node,
|
||||
+ port1);
|
||||
}
|
||||
return dev;
|
||||
}
|
||||
diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
|
||||
index 974bce9..de3237f 100644
|
||||
--- a/include/linux/usb/of.h
|
||||
+++ b/include/linux/usb/of.h
|
||||
@@ -16,6 +16,8 @@ enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np);
|
||||
bool of_usb_host_tpl_support(struct device_node *np);
|
||||
int of_usb_update_otg_caps(struct device_node *np,
|
||||
struct usb_otg_caps *otg_caps);
|
||||
+struct device_node *usb_of_get_child_node(struct device_node *parent,
|
||||
+ int portnum);
|
||||
#else
|
||||
static inline enum usb_dr_mode
|
||||
of_usb_get_dr_mode_by_phy(struct device_node *phy_np)
|
||||
@@ -31,6 +33,11 @@ static inline int of_usb_update_otg_caps(struct device_node *np,
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
+static inline struct device_node *usb_of_get_child_node
|
||||
+ (struct device_node *parent, int portnum)
|
||||
+{
|
||||
+ return NULL;
|
||||
+}
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT)
|
||||
--
|
||||
2.5.5
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
From 6c9337a5cc4e9a980a14ed99da756670898c72f3 Mon Sep 17 00:00:00 2001
|
||||
From: Arnd Bergmann <arnd@arndb.de>
|
||||
Date: Sun, 31 Jan 2016 12:58:56 +0100
|
||||
Subject: [PATCH 4/4] net/smscx5xx: use the device tree for mac address
|
||||
|
||||
This takes the MAC address for smsc75xx/smsc95xx USB network devices
|
||||
from a the device tree. This is required to get a usable persistent
|
||||
address on the popular beagleboard, whose hardware designers
|
||||
accidentally forgot that an ethernet device really requires an a
|
||||
MAC address to be functional.
|
||||
|
||||
The Raspberry Pi also ships smsc9514 without a serial EEPROM, stores the MAC
|
||||
address in ROM accessible via VC4 firmware.
|
||||
|
||||
The smsc75xx and smsc95xx drivers are just two copies of the
|
||||
same code, so better fix both.
|
||||
|
||||
[lkundrak@v3.sk: updated to use of_get_property() as per suggestion from Arnd,
|
||||
reworded the message and comments a bit]
|
||||
|
||||
Tested-by: Lubomir Rintel <lkundrak@v3.sk>
|
||||
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
|
||||
---
|
||||
drivers/net/usb/smsc75xx.c | 12 +++++++++++-
|
||||
drivers/net/usb/smsc95xx.c | 12 +++++++++++-
|
||||
2 files changed, 22 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
|
||||
index 30033db..8266e27 100644
|
||||
--- a/drivers/net/usb/smsc75xx.c
|
||||
+++ b/drivers/net/usb/smsc75xx.c
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <linux/crc32.h>
|
||||
#include <linux/usb/usbnet.h>
|
||||
#include <linux/slab.h>
|
||||
+#include <linux/of_net.h>
|
||||
#include "smsc75xx.h"
|
||||
|
||||
#define SMSC_CHIPNAME "smsc75xx"
|
||||
@@ -761,6 +762,8 @@ static int smsc75xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
|
||||
|
||||
static void smsc75xx_init_mac_address(struct usbnet *dev)
|
||||
{
|
||||
+ const u8 *mac_addr;
|
||||
+
|
||||
/* try reading mac address from EEPROM */
|
||||
if (smsc75xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
|
||||
dev->net->dev_addr) == 0) {
|
||||
@@ -772,7 +775,14 @@ static void smsc75xx_init_mac_address(struct usbnet *dev)
|
||||
}
|
||||
}
|
||||
|
||||
- /* no eeprom, or eeprom values are invalid. generate random MAC */
|
||||
+ /* maybe the boot loader passed the MAC address in devicetree */
|
||||
+ mac_addr = of_get_mac_address (dev->udev->dev.of_node);
|
||||
+ if (mac_addr) {
|
||||
+ memcpy(dev->net->dev_addr, mac_addr, ETH_ALEN);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* no useful static MAC address found. generate a random one */
|
||||
eth_hw_addr_random(dev->net);
|
||||
netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n");
|
||||
}
|
||||
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
|
||||
index 66b3ab9..623bb2e 100644
|
||||
--- a/drivers/net/usb/smsc95xx.c
|
||||
+++ b/drivers/net/usb/smsc95xx.c
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <linux/crc32.h>
|
||||
#include <linux/usb/usbnet.h>
|
||||
#include <linux/slab.h>
|
||||
+#include <linux/of_net.h>
|
||||
#include "smsc95xx.h"
|
||||
|
||||
#define SMSC_CHIPNAME "smsc95xx"
|
||||
@@ -765,6 +766,8 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
|
||||
|
||||
static void smsc95xx_init_mac_address(struct usbnet *dev)
|
||||
{
|
||||
+ const u8 *mac_addr;
|
||||
+
|
||||
/* try reading mac address from EEPROM */
|
||||
if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
|
||||
dev->net->dev_addr) == 0) {
|
||||
@@ -775,7 +778,14 @@ static void smsc95xx_init_mac_address(struct usbnet *dev)
|
||||
}
|
||||
}
|
||||
|
||||
- /* no eeprom, or eeprom values are invalid. generate random MAC */
|
||||
+ /* maybe the boot loader passed the MAC address in devicetree */
|
||||
+ mac_addr = of_get_mac_address (dev->udev->dev.of_node);
|
||||
+ if (mac_addr) {
|
||||
+ memcpy(dev->net->dev_addr, mac_addr, ETH_ALEN);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* no useful static MAC address found. generate a random one */
|
||||
eth_hw_addr_random(dev->net);
|
||||
netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n");
|
||||
}
|
||||
--
|
||||
2.5.5
|
||||
|
|
@ -658,9 +658,6 @@ Patch702: x86-build-Build-compressed-x86-kernels-as-PIE.patch
|
|||
Patch703: ipv4-fib-don-t-warn-when-primary-address-is-missing-.patch
|
||||
|
||||
Patch66601: 0001-ARM-bcm2835-dt-Add-Raspberry-Pi-Zero.patch
|
||||
Patch66602: 0002-ARM-bcm2835-dt-Add-the-ethernet-to-the-device-trees.patch
|
||||
Patch66603: 0003-USB-core-let-USB-device-know-device-node.patch
|
||||
Patch66604: 0004-net-smscx5xx-use-the-device-tree-for-mac-address.patch
|
||||
|
||||
# END OF PATCH DEFINITIONS
|
||||
|
||||
|
@ -2186,7 +2183,6 @@ fi
|
|||
* Tue Apr 26 2016 Lubomir Rintel <lkundrak@v3.sk> - 4.5.1-300.pi1
|
||||
- Build for bcm2835/rpi
|
||||
- Add Raspberry Pi Zero dts
|
||||
- Use stable MAC address for rpi boards with ethernet
|
||||
|
||||
* Tue Apr 26 2016 Justin M. Forbes <jforbes@fedoraproject.org>
|
||||
- Change CONFIG_DW_DMAC to built-in to fix sound on some intel platforms
|
||||
|
|
Loading…
Reference in New Issue