Skip to contentSkip to conversation

of: make of_alias_get work on all types of DT paths

PATCH Applied Lucas Stach 2 participants 12 messages Mar 3, 2015 – Mar 4, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/11 of: make of_alias_get work on all types of DT paths

of_alias_get assumed that a DT path is always the full node path, whic is not necessarily the case, as there are other valid path descriptions. All of them are handled by of_find_node_by_path.

As there is already a preparsed list with all DT aliases that handles this case properly we can simply reuse that one.

---
 drivers/of/base.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/of/base.c +4 -4
index af10fd1..b77d879 100644
@@ -227,11 +227,11 @@ EXPORT_SYMBOL_GPL(of_alias_get_id);
 
 const char *of_alias_get(struct device_node *np)
 {
-	struct property *pp;
+	struct alias_prop *app;
 
-	list_for_each_entry(pp, &of_aliases->properties, list) {
-		if (!of_node_cmp(np->full_name, pp->value))
-			return pp->name;
+	list_for_each_entry(app, &aliases_lookup, link) {
+		if (np == app->np)
+			return app->alias;
 	}
 
 	return NULL;
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 2/11 ARM: tegra20: add mmc aliases

---
 arch/arm/dts/tegra20-colibri.dtsi | 1 +
 arch/arm/dts/tegra20.dtsi         | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
arch/arm/dts/tegra20-colibri.dtsi +1 -0
index 96da8a4..e931c07 100644
@@ -1 +1,2 @@
 #include <arm/tegra20-colibri-512.dtsi>
+#include "tegra20.dtsi"
arch/arm/dts/tegra20.dtsi +8 -1
index ce7d322..995eee4 100644
@@ -1 +1,8 @@
-#include <arm/tegra20.dtsi>
+/ {
+	aliases {
+		mmc0 = "/sdhci@c8000000/";
+		mmc1 = "/sdhci@c8000200/";
+		mmc2 = "/sdhci@c8000400/";
+		mmc3 = "/sdhci@c8000600/";
+	};
+};
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 3/11 ARM: tegra30: add mmc aliases

In reply to Lucas Stach
---
 arch/arm/dts/tegra30-beaver.dts | 1 +
 arch/arm/dts/tegra30.dtsi       | 8 ++++++++
 2 files changed, 9 insertions(+)
 create mode 100644 arch/arm/dts/tegra30.dtsi
arch/arm/dts/tegra30-beaver.dts +1 -0
index 5879353..91e1354 100644
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include <arm/tegra30.dtsi>
+#include "tegra30.dtsi"
 
 / {
 	model = "NVIDIA Tegra30 Beaver evaluation board";
arch/arm/dts/tegra30.dtsi new file +8 -0
new file mode 100644
index 0000000..90bd08b
@@ -0,0 +1,8 @@
+/ {
+	aliases {
+		mmc0 = "/sdhci@78000000/";
+		mmc1 = "/sdhci@78000200/";
+		mmc2 = "/sdhci@78000400/";
+		mmc3 = "/sdhci@78000600/";
+	};
+};
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH 4/11 ARM: tegra124: add mmc aliases

In reply to Lucas Stach
---
 arch/arm/dts/tegra124.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/tegra124.dtsi +4 -0
index c795811..cd515a2 100644
@@ -4,5 +4,9 @@
 		serial1 = "/serial@0,70006040/";
 		serial2 = "/serial@0,70006200/";
 		serial3 = "/serial@0,70006300/";
+		mmc0 = "/sdhci@0,700b0000/";
+		mmc1 = "/sdhci@0,700b0200/";
+		mmc2 = "/sdhci@0,700b0400/";
+		mmc3 = "/sdhci@0,700b0600/";
 	};
 };
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH 5/11 mci: tegra: handle mmc aliases

In reply to Lucas Stach

This allows to have fixed device names for the SDMMC controllers.

---
 drivers/mci/tegra-sdmmc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mci/tegra-sdmmc.c +3 -0
index 0e23d6f..c8924ed 100644
@@ -409,7 +409,10 @@ static int tegra_sdmmc_detect(struct device_d *dev)
 static void tegra_sdmmc_parse_dt(struct tegra_sdmmc_host *host)
 {
 	struct device_node *np = host->mci.hw_dev->device_node;
+	const char *alias = of_alias_get(np);
 
+	if (alias)
+		host->mci.devname = xstrdup(alias);
 	host->gpio_cd = of_get_named_gpio(np, "cd-gpios", 0);
 	host->gpio_pwr = of_get_named_gpio(np, "power-gpios", 0);
 	mci_of_parse(&host->mci);
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

PATCH 6/11 bbu: include necessary headers

In reply to Lucas Stach

Fixes compile errors due to undefined symbols.

---
 include/bbu.h | 2 ++
 1 file changed, 2 insertions(+)
include/bbu.h +2 -0
index adb52b0..4a3d35e 100644
@@ -2,6 +2,8 @@
 #define __INCLUDE_BBU_H
 
 #include <asm-generic/errno.h>
+#include <linux/list.h>
+#include <linux/types.h>
 
 struct bbu_data {
 #define BBU_FLAG_FORCE	(1 << 0)
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw

PATCH 7/11 bbu: make bbu confirm a bit more verbose

In reply to Lucas Stach

It is a lot more user friendly if we give a bit more feedback.

---
 common/bbu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
common/bbu.c +3 -1
index e31f645..7fb154a 100644
@@ -65,8 +65,10 @@ int bbu_confirm(struct bbu_data *data)
 
 	key = read_key();
 
-	if (key == 'y')
+	if (key == 'y') {
+		printf("updating barebox...\n");
 		return 0;
+	}
 
 	return -EINTR;
 }
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw

PATCH 8/11 ARM: tegra: add eMMC barebox update handler

In reply to Lucas Stach
---
 arch/arm/mach-tegra/Makefile                 |  1 +
 arch/arm/mach-tegra/include/mach/tegra-bbu.h | 28 +++++++++++
 arch/arm/mach-tegra/tegra-bbu.c              | 74 ++++++++++++++++++++++++++++
 3 files changed, 103 insertions(+)
 create mode 100644 arch/arm/mach-tegra/include/mach/tegra-bbu.h
 create mode 100644 arch/arm/mach-tegra/tegra-bbu.c
arch/arm/mach-tegra/Makefile +1 -0
index e68156a..7c4c1fd 100644
@@ -13,3 +13,4 @@ lwl-y += tegra_maincomplex_init.o
 obj-y += tegra20.o
 obj-y += tegra20-pmc.o
 obj-y += tegra20-timer.o
+obj-$(CONFIG_BAREBOX_UPDATE) += tegra-bbu.o
arch/arm/mach-tegra/include/mach/tegra-bbu.h new file +28 -0
new file mode 100644
index 0000000..32e2861
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2015 Lucas Stach <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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 <bbu.h>
+
+#ifdef CONFIG_BAREBOX_UPDATE
+int tegra_bbu_register_emmc_handler(const char *name, char *devicefile,
+				    unsigned long flags);
+#else
+static int tegra_bbu_register_emmc_handler(const char *name, char *devicefile,
+				    unsigned long flags)
+{
+	return 0;
+};
+#endif
arch/arm/mach-tegra/tegra-bbu.c new file +74 -0

74 lines not on this page · raw message

Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#8 lore raw

PATCH 9/11 ARM: tegra: add barebox update handler to Beaver board

In reply to Lucas Stach
---
 arch/arm/boards/nvidia-beaver/board.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/boards/nvidia-beaver/board.c +4 -0
index d270301..bab0238 100644
@@ -19,6 +19,7 @@
 #include <gpio.h>
 #include <i2c/i2c.h>
 #include <init.h>
+#include <mach/tegra-bbu.h>
 
 static int nvidia_beaver_fs_init(void)
 {
@@ -53,6 +54,9 @@ static int nvidia_beaver_device_init(void)
 
 	barebox_set_hostname("beaver");
 
+	tegra_bbu_register_emmc_handler("eMMC", "/dev/mmc3.boot0",
+					BBU_HANDLER_FLAG_DEFAULT);
+
 	return 0;
 }
 device_initcall(nvidia_beaver_device_init);
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#9 lore raw

PATCH 10/11 ARM: tegra: add barebox update handler to Jetson board

In reply to Lucas Stach
---
 arch/arm/boards/nvidia-jetson-tk1/board.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/boards/nvidia-jetson-tk1/board.c +4 -0
index 564e6a0..939d184 100644
@@ -19,6 +19,7 @@
 #include <gpio.h>
 #include <i2c/i2c.h>
 #include <init.h>
+#include <mach/tegra-bbu.h>
 
 #define AS3722_SD_VOLTAGE(n)	(0x00 + (n))
 #define AS3722_GPIO_CONTROL(n)	(0x08 + (n))
@@ -56,6 +57,9 @@ static int nvidia_jetson_tk1_device_init(void)
 
 	barebox_set_hostname("jetson-tk1");
 
+	tegra_bbu_register_emmc_handler("eMMC", "/dev/mmc3.boot0",
+					BBU_HANDLER_FLAG_DEFAULT);
+
 	return 0;
 }
 device_initcall(nvidia_jetson_tk1_device_init);
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#10 lore raw

PATCH 11/11 ARM: tegra: enable barebox update in defconfig

In reply to Lucas Stach
---
 arch/arm/configs/tegra_v7_defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/configs/tegra_v7_defconfig +1 -0
index 47e594b..c7b59ac 100644
@@ -36,6 +36,7 @@ CONFIG_CMD_TIMEOUT=y
 CONFIG_CMD_CLK=y
 CONFIG_CMD_DETECT=y
 CONFIG_CMD_GPIO=y
+CONFIG_CMD_BAREBOX_UPDATE=y
 CONFIG_CMD_OFTREE=y
 CONFIG_NET=y
 CONFIG_OF_BAREBOX_DRIVERS=y
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#11 lore raw
In reply to Lucas Stach
Quoted 11 lines · Lucas Stach

of_alias_get assumed that a DT path is always the full node path, whic is not necessarily the case, as there are other valid path descriptions. All of them are handled by of_find_node_by_path.

As there is already a preparsed list with all DT aliases that handles this case properly we can simply reuse that one.

---
 drivers/of/base.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Applied all, thanks

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox