summaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-07-09 08:21:18 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-07-09 08:21:18 +0200
commit1f3af633e28876c2a9649bce59747b3b23990e16 (patch)
tree282f4595f769db6a67ea65829e1687041184fd70 /arch/mips
parent64c720391a0c127dba33d1ae8aeba30b6a3c692d (diff)
parent5500987a54b2f01ffcb94d96335453388314566e (diff)
downloadbarebox-1f3af633e28876c2a9649bce59747b3b23990e16.tar.gz
barebox-1f3af633e28876c2a9649bce59747b3b23990e16.tar.xz
Merge branch 'for-next/mips'
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/dts/ar9331-dptechnics-dpt-module.dts11
-rw-r--r--arch/mips/dts/ar9344-tl-wdr4300-v1.7.dts11
-rw-r--r--arch/mips/dts/dlink-dir-320.dts8
-rw-r--r--arch/mips/dts/img-ci20.dts2
-rw-r--r--arch/mips/dts/jz4755.dtsi5
-rw-r--r--arch/mips/dts/jz4780.dtsi5
-rw-r--r--arch/mips/dts/loongson-ls1b.dts3
-rw-r--r--arch/mips/dts/ls1b.dtsi5
-rw-r--r--arch/mips/dts/qemu-malta.dts8
-rw-r--r--arch/mips/dts/rzx50.dts3
-rw-r--r--arch/mips/dts/skeleton.dtsi13
-rw-r--r--arch/mips/include/asm/pbl_macros.h4
-rw-r--r--arch/mips/mach-ath79/Makefile1
-rw-r--r--arch/mips/mach-ath79/art.c112
14 files changed, 160 insertions, 31 deletions
diff --git a/arch/mips/dts/ar9331-dptechnics-dpt-module.dts b/arch/mips/dts/ar9331-dptechnics-dpt-module.dts
index 103d889b0e..f0de46315c 100644
--- a/arch/mips/dts/ar9331-dptechnics-dpt-module.dts
+++ b/arch/mips/dts/ar9331-dptechnics-dpt-module.dts
@@ -11,6 +11,12 @@
compatible = "barebox,environment";
device-path = &spiflash, "partname:barebox-environment";
};
+
+ art@0 {
+ compatible = "qca,art-ar9331", "qca,art";
+ device-path = &spiflash_art;
+ barebox,provide-mac-address = <&mac0>;
+ };
};
leds {
@@ -30,6 +36,11 @@
label = "barebox-environment";
reg = <0x80000 0x10000>;
};
+
+ spiflash_art: partition@7f0000 {
+ label = "art";
+ reg = <0x7f0000 0x10000>;
+ };
};
&mac0 {
diff --git a/arch/mips/dts/ar9344-tl-wdr4300-v1.7.dts b/arch/mips/dts/ar9344-tl-wdr4300-v1.7.dts
index dd9d33b2da..82daabbdd4 100644
--- a/arch/mips/dts/ar9344-tl-wdr4300-v1.7.dts
+++ b/arch/mips/dts/ar9344-tl-wdr4300-v1.7.dts
@@ -26,6 +26,12 @@
compatible = "barebox,environment";
device-path = &spiflash, "partname:barebox-environment";
};
+
+ art@0 {
+ compatible = "qca,art-ar9344", "qca,art";
+ device-path = &spiflash_art;
+ barebox,provide-mac-address = <&mac0>;
+ };
};
};
@@ -63,6 +69,11 @@
label = "barebox-environment";
reg = <0x80000 0x10000>;
};
+
+ spiflash_art: partition@7f0000 {
+ label = "art";
+ reg = <0x7f0000 0x10000>;
+ };
};
};
diff --git a/arch/mips/dts/dlink-dir-320.dts b/arch/mips/dts/dlink-dir-320.dts
index b961c9dca3..d19c3087d0 100644
--- a/arch/mips/dts/dlink-dir-320.dts
+++ b/arch/mips/dts/dlink-dir-320.dts
@@ -1,12 +1,14 @@
/dts-v1/;
-#include "skeleton.dtsi"
-
/ {
model = "D-Link DIR-320";
compatible = "dlink,dir320";
- memory {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ memory@0 {
+ device_type = "memory";
reg = <0x00000000 0x2000000>;
};
diff --git a/arch/mips/dts/img-ci20.dts b/arch/mips/dts/img-ci20.dts
index da2a5bf625..d985666020 100644
--- a/arch/mips/dts/img-ci20.dts
+++ b/arch/mips/dts/img-ci20.dts
@@ -24,7 +24,7 @@
model = "MIPS Creator CI20";
compatible = "img,ci20";
- memory {
+ memory@0 {
device_type = "memory";
reg = <0x0 0x10000000>;
};
diff --git a/arch/mips/dts/jz4755.dtsi b/arch/mips/dts/jz4755.dtsi
index 137156df7e..5d929c5d83 100644
--- a/arch/mips/dts/jz4755.dtsi
+++ b/arch/mips/dts/jz4755.dtsi
@@ -1,6 +1,7 @@
-#include "skeleton.dtsi"
-
/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
soc {
compatible = "simple-bus";
model = "Ingenic JZ4755";
diff --git a/arch/mips/dts/jz4780.dtsi b/arch/mips/dts/jz4780.dtsi
index 9f0de5d1ae..fbffe814bb 100644
--- a/arch/mips/dts/jz4780.dtsi
+++ b/arch/mips/dts/jz4780.dtsi
@@ -1,6 +1,7 @@
-#include "skeleton.dtsi"
-
/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
soc {
model = "Ingenic JZ4780";
#address-cells = <1>;
diff --git a/arch/mips/dts/loongson-ls1b.dts b/arch/mips/dts/loongson-ls1b.dts
index b81a951dc7..6b53311982 100644
--- a/arch/mips/dts/loongson-ls1b.dts
+++ b/arch/mips/dts/loongson-ls1b.dts
@@ -6,7 +6,8 @@
model = "Loongson Tech LS1B Demo Board";
compatible = "loongson,ls1b";
- memory {
+ memory@0 {
+ device_type = "memory";
reg = <0x00000000 0x4000000>;
};
};
diff --git a/arch/mips/dts/ls1b.dtsi b/arch/mips/dts/ls1b.dtsi
index af7119f1d0..cb85814af4 100644
--- a/arch/mips/dts/ls1b.dtsi
+++ b/arch/mips/dts/ls1b.dtsi
@@ -1,6 +1,7 @@
-#include "skeleton.dtsi"
-
/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
soc {
#address-cells = <1>;
#size-cells = <1>;
diff --git a/arch/mips/dts/qemu-malta.dts b/arch/mips/dts/qemu-malta.dts
index 5a392f97a7..32e473cac0 100644
--- a/arch/mips/dts/qemu-malta.dts
+++ b/arch/mips/dts/qemu-malta.dts
@@ -1,11 +1,12 @@
/dts-v1/;
-/include/ "skeleton.dtsi"
-
/ {
model = "qemu malta";
compatible = "qemu,malta";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
chosen {
environment {
compatible = "barebox,environment";
@@ -13,7 +14,8 @@
};
};
- memory {
+ memory@0 {
+ device_type = "memory";
reg = <0x00000000 0x10000000>;
};
diff --git a/arch/mips/dts/rzx50.dts b/arch/mips/dts/rzx50.dts
index 7ec3352666..bd3631f7c4 100644
--- a/arch/mips/dts/rzx50.dts
+++ b/arch/mips/dts/rzx50.dts
@@ -6,7 +6,8 @@
model = "Ritmix RZX-50";
compatible = "ritmix,rzx50";
- memory {
+ memory@0 {
+ device_type = "memory";
reg = <0x00000000 0x4000000>;
};
diff --git a/arch/mips/dts/skeleton.dtsi b/arch/mips/dts/skeleton.dtsi
deleted file mode 100644
index b41d241de2..0000000000
--- a/arch/mips/dts/skeleton.dtsi
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Skeleton device tree; the bare minimum needed to boot; just include and
- * add a compatible value. The bootloader will typically populate the memory
- * node.
- */
-
-/ {
- #address-cells = <1>;
- #size-cells = <1>;
- chosen { };
- aliases { };
- memory { device_type = "memory"; reg = <0 0>; };
-};
diff --git a/arch/mips/include/asm/pbl_macros.h b/arch/mips/include/asm/pbl_macros.h
index 18115c8489..bb3182cda9 100644
--- a/arch/mips/include/asm/pbl_macros.h
+++ b/arch/mips/include/asm/pbl_macros.h
@@ -25,8 +25,6 @@
#include <asm/mipsregs.h>
#include <asm/asm.h>
#include <asm-generic/memory_layout.h>
-#include <generated/compile.h>
-#include <generated/utsrelease.h>
#include <asm/addrspace.h>
#include <asm/cacheops.h>
@@ -174,7 +172,7 @@ copy_loop_exit:
nop
.org 0x10
- .ascii "barebox " UTS_RELEASE " " UTS_VERSION
+ .ascii "barebox"
.byte 0
.align 4
diff --git a/arch/mips/mach-ath79/Makefile b/arch/mips/mach-ath79/Makefile
index 3772daebad..b827b363cf 100644
--- a/arch/mips/mach-ath79/Makefile
+++ b/arch/mips/mach-ath79/Makefile
@@ -1,2 +1,3 @@
obj-y += reset.o
obj-y += bbu.o
+obj-y += art.o
diff --git a/arch/mips/mach-ath79/art.c b/arch/mips/mach-ath79/art.c
new file mode 100644
index 0000000000..984d087363
--- /dev/null
+++ b/arch/mips/mach-ath79/art.c
@@ -0,0 +1,112 @@
+// SPDX-License-Identifier: GPL-2.
+/*
+ * Copyright (c) 2018 Oleksij Rempel <linux@rempel-privat.de>
+ */
+
+#include <common.h>
+#include <fcntl.h>
+#include <init.h>
+#include <libfile.h>
+#include <net.h>
+#include <unistd.h>
+
+#define AR93000_EPPROM_OFFSET 0x1000
+
+struct ar9300_eeprom {
+ u8 eeprom_version;
+ u8 template_version;
+ u8 mac_addr[6];
+};
+
+static int art_set_mac(struct device_d *dev, struct ar9300_eeprom *eeprom)
+{
+ struct device_node *node = dev->device_node;
+ struct device_node *rnode;
+
+ if (!node)
+ return -ENOENT;
+
+ rnode = of_parse_phandle_from(node, NULL,
+ "barebox,provide-mac-address", 0);
+ if (!rnode)
+ return -ENOENT;
+
+ of_eth_register_ethaddr(rnode, &eeprom->mac_addr[0]);
+
+ return 0;
+}
+
+static int art_read_mac(struct device_d *dev, const char *file)
+{
+ int fd, rbytes;
+ struct ar9300_eeprom eeprom;
+
+ fd = open_and_lseek(file, O_RDONLY, AR93000_EPPROM_OFFSET);
+ if (fd < 0) {
+ dev_err(dev, "Failed to open eeprom path %s %d\n",
+ file, fd);
+ return fd;
+ }
+
+ rbytes = read_full(fd, &eeprom, sizeof(eeprom));
+ close(fd);
+ if (rbytes < sizeof(eeprom)) {
+ dev_err(dev, "Failed to read %s\n", file);
+ return rbytes < 0 ? rbytes : -EIO;
+ }
+
+ dev_dbg(dev, "ART version: %x.%x\n",
+ eeprom.eeprom_version, eeprom.template_version);
+ dev_dbg(dev, "mac: %02x:%02x:%02x:%02x:%02x:%02x\n",
+ eeprom.mac_addr[0],
+ eeprom.mac_addr[1],
+ eeprom.mac_addr[2],
+ eeprom.mac_addr[3],
+ eeprom.mac_addr[4],
+ eeprom.mac_addr[5]);
+
+ if (!is_valid_ether_addr(&eeprom.mac_addr[0])) {
+ dev_err(dev, "bad MAC addr\n");
+ return -EILSEQ;
+ }
+
+ return art_set_mac(dev, &eeprom);
+}
+
+static int art_probe(struct device_d *dev)
+{
+ char *path;
+ int ret;
+
+ dev_dbg(dev, "found ART partition\n");
+
+ ret = of_find_path(dev->device_node, "device-path", &path, 0);
+ if (ret) {
+ dev_err(dev, "can't find path\n");
+ return ret;
+ }
+
+ return art_read_mac(dev, path);
+}
+
+static struct of_device_id art_dt_ids[] = {
+ {
+ .compatible = "qca,art",
+ }, {
+ /* sentinel */
+ }
+};
+
+static struct driver_d art_driver = {
+ .name = "qca-art",
+ .probe = art_probe,
+ .of_compatible = art_dt_ids,
+};
+
+static int art_of_driver_init(void)
+{
+ platform_driver_register(&art_driver);
+
+ return 0;
+}
+late_initcall(art_of_driver_init);