aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/lantiq/patches-4.9/0101-find_active_root.patch
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2017-02-11 15:52:41 +0100
committerHauke Mehrtens <hauke@hauke-m.de>2017-02-11 23:44:13 +0100
commit863e79f8d5544a8a884375d7e867f350fddca9b9 (patch)
tree6c95efffd7d7db4df17dbfae7d108fdd20b99926 /target/linux/lantiq/patches-4.9/0101-find_active_root.patch
parentca9b9969fb3f3853f7c6beb43bd496d90c7efe80 (diff)
downloadupstream-863e79f8d5544a8a884375d7e867f350fddca9b9.tar.gz
upstream-863e79f8d5544a8a884375d7e867f350fddca9b9.tar.bz2
upstream-863e79f8d5544a8a884375d7e867f350fddca9b9.zip
lantiq: add support for kernel 4.9
The following patches were dropped because they are already applied upstream: 0012-pinctrl-lantiq-fix-up-pinmux.patch 0013-MTD-lantiq-xway-fix-invalid-operator.patch 0014-MTD-lantiq-xway-the-latched-command-should-be-persis.patch 0015-MTD-lantiq-xway-remove-endless-loop.patch 0016-MTD-lantiq-xway-add-missing-write_buf-and-read_buf-t.patch 0017-MTD-xway-fix-nand-locking.patch 0044-pinctrl-lantiq-introduce-new-dedicated-devicetree-bi.patch 0045-pinctrl-lantiq-Fix-GPIO-Setup-of-GPIO-Port3.patch 0046-pinctrl-lantiq-2-pins-have-the-wrong-mux-list.patch 0047-irq-fixes.patch 0047-mtd-plat-nand-pass-of-node.patch 0060-usb-dwc2-Add-support-for-Lantiq-ARX-and-XRX-SoCs.patch 0120-MIPS-lantiq-add-support-for-device-tree-file-from-bo.patch 0121-MIPS-lantiq-make-it-possible-to-build-in-no-device-t.patch 122-MIPS-store-the-appended-dtb-address-in-a-variable.patch The PHY driver was reduced to the code adding the LED configuration, the rest is already upstream: 0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch The SPI driver was replaced with the version pending for upstream inclusion: New driver: 0090-spi-add-transfer_status-callback.patch 0091-spi-lantiq-ssc-add-support-for-Lantiq-SSC-SPI-controller.patch Old driver: 0100-spi-add-support-for-Lantiq-SPI-controller.patch Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'target/linux/lantiq/patches-4.9/0101-find_active_root.patch')
-rw-r--r--target/linux/lantiq/patches-4.9/0101-find_active_root.patch93
1 files changed, 93 insertions, 0 deletions
diff --git a/target/linux/lantiq/patches-4.9/0101-find_active_root.patch b/target/linux/lantiq/patches-4.9/0101-find_active_root.patch
new file mode 100644
index 0000000000..2faec3478b
--- /dev/null
+++ b/target/linux/lantiq/patches-4.9/0101-find_active_root.patch
@@ -0,0 +1,93 @@
+--- a/drivers/mtd/ofpart.c
++++ b/drivers/mtd/ofpart.c
+@@ -25,6 +25,38 @@ static bool node_has_compatible(struct d
+ return of_get_property(pp, "compatible", NULL);
+ }
+
++static uint8_t * brnboot_get_selected_root_part(struct mtd_info *master,
++ loff_t offset)
++{
++ static uint8_t root_id;
++ int err, len;
++
++ err = mtd_read(master, offset, 0x01, &len, &root_id);
++
++ if (mtd_is_bitflip(err) || !err)
++ return &root_id;
++
++ return NULL;
++}
++
++static void brnboot_set_active_root_part(struct mtd_partition *pparts,
++ struct device_node **part_nodes,
++ int nr_parts,
++ uint8_t *root_id)
++{
++ int i;
++
++ for (i = 0; i < nr_parts; i++) {
++ int part_root_id;
++
++ if (!of_property_read_u32(part_nodes[i], "brnboot,root-id", &part_root_id)
++ && part_root_id == *root_id) {
++ pparts[i].name = "firmware";
++ break;
++ }
++ }
++}
++
+ static int parse_ofpart_partitions(struct mtd_info *master,
+ const struct mtd_partition **pparts,
+ struct mtd_part_parser_data *data)
+@@ -36,7 +68,8 @@ static int parse_ofpart_partitions(struc
+ struct device_node *pp;
+ int nr_parts, i, ret = 0;
+ bool dedicated = true;
+-
++ uint8_t *proot_id = NULL;
++ struct device_node **part_nodes;
+
+ /* Pull of_node from the master device node */
+ mtd_node = mtd_get_of_node(master);
+@@ -72,7 +105,9 @@ static int parse_ofpart_partitions(struc
+ return 0;
+
+ parts = kzalloc(nr_parts * sizeof(*parts), GFP_KERNEL);
+- if (!parts)
++ part_nodes = kzalloc(nr_parts * sizeof(*part_nodes), GFP_KERNEL);
++
++ if (!parts || !part_nodes)
+ return -ENOMEM;
+
+ i = 0;
+@@ -120,12 +155,22 @@ static int parse_ofpart_partitions(struc
+ if (of_get_property(pp, "lock", &len))
+ parts[i].mask_flags |= MTD_POWERUP_LOCK;
+
++ if (!proot_id && of_device_is_compatible(pp, "brnboot,root-selector"))
++ proot_id = brnboot_get_selected_root_part(master, parts[i].offset);
++
++ part_nodes[i] = pp;
++
+ i++;
+ }
+
+ if (!nr_parts)
+ goto ofpart_none;
+
++ if (proot_id)
++ brnboot_set_active_root_part(parts, part_nodes, nr_parts, proot_id);
++
++ kfree(part_nodes);
++
+ *pparts = parts;
+ return nr_parts;
+
+@@ -136,6 +181,7 @@ ofpart_fail:
+ ofpart_none:
+ of_node_put(pp);
+ kfree(parts);
++ kfree(part_nodes);
+ return ret;
+ }
+