mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/4] ARM: stm32mp: dk2: support barebox_update and env
@ 2019-10-14  6:39 Ahmad Fatoum
  2019-10-14  6:39 ` [PATCH 1/5] fs: devfs-core: have device_find_partition search symlinks Ahmad Fatoum
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2019-10-14  6:39 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

When booting from SD-Card, the BootROM and first-stage bootloader both
assume the subsequent bootloader to be a STM32 image in a specially named
GPT partition. Add support to barebox to have environment and
barebox_update operate on their respective GPT partitions as well.

Needs Oleksij's "mci: add support for stm32mp sd/mmc controller"[1] to work.

[1]: http://lists.infradead.org/pipermail/barebox/2019-October/039532.html

Ahmad Fatoum (4):
  fs: devfs-core: have device_find_partition search symlinks
  ARM: stm32mp: dk2: rename function according to init level
  ARM: stm32mp: dk2: add barebox SD-Card update handler
  Documentation: boards: stm32mp: document environment partition

Oleksij Rempel (1):
  ARM: dts: stm32mp: add barebox-enviroment on DK boards

 Documentation/boards/stm32mp.rst         |  4 ++++
 arch/arm/boards/stm32mp157c-dk2/board.c  | 18 ++++++++++++++++--
 arch/arm/dts/stm32mp157a-dk1.dtsi        |  7 +++++++
 arch/arm/mach-stm32mp/include/mach/bbu.h | 14 ++++++++++++++
 fs/devfs-core.c                          | 21 +++++++++++++++++++++
 5 files changed, 62 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-stm32mp/include/mach/bbu.h

-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/5] fs: devfs-core: have device_find_partition search symlinks
  2019-10-14  6:39 [PATCH 0/4] ARM: stm32mp: dk2: support barebox_update and env Ahmad Fatoum
@ 2019-10-14  6:39 ` Ahmad Fatoum
  2019-10-14  6:39 ` [PATCH 2/5] ARM: dts: stm32mp: add barebox-enviroment on DK boards Ahmad Fatoum
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2019-10-14  6:39 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The barebox,environment binding documentation notes following for
the device-path property's second string:
> <partname> can be the label for MTD partitions, the number for DOS
> partitions (beginning with 0) or the name for GPT partitions.

This doesn't work currently because the named partitions are realized as
symlinks and those aren't searched by device_find_partition.

Fix this by having symlinks feature an appropriate partname if the cdev
they link at has one and then have device_find_partition search those as
well.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 fs/devfs-core.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/fs/devfs-core.c b/fs/devfs-core.c
index 2b93a951f269..258bb2dbaaee 100644
--- a/fs/devfs-core.c
+++ b/fs/devfs-core.c
@@ -122,10 +122,17 @@ struct cdev *device_find_partition(struct device_d *dev, const char *name)
 	struct device_d *child;
 
 	list_for_each_entry(cdev, &dev->cdevs, devices_list) {
+		struct cdev *cdevl;
+
 		if (!cdev->partname)
 			continue;
 		if (!strcmp(cdev->partname, name))
 			return cdev;
+
+		list_for_each_entry(cdevl, &cdev->links, link_entry) {
+			if (!strcmp(cdevl->partname, name))
+				return cdev_readlink(cdevl);
+		}
 	}
 
 	device_for_each_child(dev, child) {
@@ -252,6 +259,20 @@ int devfs_create_link(struct cdev *cdev, const char *name)
 	new = xzalloc(sizeof(*new));
 	new->name = xstrdup(name);
 	new->link = cdev;
+
+	if (cdev->partname) {
+		size_t partnameoff = 0;
+
+		if (cdev->master) {
+			size_t masterlen = strlen(cdev->master->name);
+
+			if (!strncmp(name, cdev->master->name, masterlen))
+				partnameoff += masterlen + 1;
+		}
+
+		new->partname = xstrdup(name + partnameoff);
+	}
+
 	INIT_LIST_HEAD(&new->links);
 	list_add_tail(&new->list, &cdev_list);
 	list_add_tail(&new->link_entry, &cdev->links);
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/5] ARM: dts: stm32mp: add barebox-enviroment on DK boards
  2019-10-14  6:39 [PATCH 0/4] ARM: stm32mp: dk2: support barebox_update and env Ahmad Fatoum
  2019-10-14  6:39 ` [PATCH 1/5] fs: devfs-core: have device_find_partition search symlinks Ahmad Fatoum
@ 2019-10-14  6:39 ` Ahmad Fatoum
  2019-10-14  6:39 ` [PATCH 3/5] ARM: stm32mp: dk2: rename function according to init level Ahmad Fatoum
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2019-10-14  6:39 UTC (permalink / raw)
  To: barebox; +Cc: Oleksij Rempel

From: Oleksij Rempel <o.rempel@pengutronix.de>

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 arch/arm/dts/stm32mp157a-dk1.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/dts/stm32mp157a-dk1.dtsi b/arch/arm/dts/stm32mp157a-dk1.dtsi
index cd3d614d4623..f7fbdcd1749a 100644
--- a/arch/arm/dts/stm32mp157a-dk1.dtsi
+++ b/arch/arm/dts/stm32mp157a-dk1.dtsi
@@ -8,6 +8,13 @@
 #include <dt-bindings/gpio/gpio.h>
 
 / {
+	chosen {
+		environment {
+			compatible = "barebox,environment";
+			device-path = &sdmmc1, "partname:barebox-environment";
+		};
+	};
+
 	led {
 		red {
 			label = "error";
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 3/5] ARM: stm32mp: dk2: rename function according to init level
  2019-10-14  6:39 [PATCH 0/4] ARM: stm32mp: dk2: support barebox_update and env Ahmad Fatoum
  2019-10-14  6:39 ` [PATCH 1/5] fs: devfs-core: have device_find_partition search symlinks Ahmad Fatoum
  2019-10-14  6:39 ` [PATCH 2/5] ARM: dts: stm32mp: add barebox-enviroment on DK boards Ahmad Fatoum
@ 2019-10-14  6:39 ` Ahmad Fatoum
  2019-10-14  6:39 ` [PATCH 4/5] ARM: stm32mp: dk2: add barebox SD-Card update handler Ahmad Fatoum
  2019-10-14  6:39 ` [PATCH 5/5] Documentation: boards: stm32mp: document environment partition Ahmad Fatoum
  4 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2019-10-14  6:39 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

dk2_postcore_init is not at postcore init level like the name would
suggest, but at mem init level. Rename it accordingly.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/stm32mp157c-dk2/board.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boards/stm32mp157c-dk2/board.c b/arch/arm/boards/stm32mp157c-dk2/board.c
index cbfe21db6a8c..9cb861af85d8 100644
--- a/arch/arm/boards/stm32mp157c-dk2/board.c
+++ b/arch/arm/boards/stm32mp157c-dk2/board.c
@@ -5,7 +5,7 @@
 #include <asm/memory.h>
 #include <mach/stm32.h>
 
-static int dk2_postcore_init(void)
+static int dk2_mem_init(void)
 {
 	if (!of_machine_is_compatible("st,stm32mp157c-dk2"))
 		return 0;
@@ -14,4 +14,4 @@ static int dk2_postcore_init(void)
 
 	return 0;
 }
-mem_initcall(dk2_postcore_init);
+mem_initcall(dk2_mem_init);
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 4/5] ARM: stm32mp: dk2: add barebox SD-Card update handler
  2019-10-14  6:39 [PATCH 0/4] ARM: stm32mp: dk2: support barebox_update and env Ahmad Fatoum
                   ` (2 preceding siblings ...)
  2019-10-14  6:39 ` [PATCH 3/5] ARM: stm32mp: dk2: rename function according to init level Ahmad Fatoum
@ 2019-10-14  6:39 ` Ahmad Fatoum
  2019-10-14 12:51   ` Sascha Hauer
  2019-10-14  6:39 ` [PATCH 5/5] Documentation: boards: stm32mp: document environment partition Ahmad Fatoum
  4 siblings, 1 reply; 10+ messages in thread
From: Ahmad Fatoum @ 2019-10-14  6:39 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Now with the SD/MMC controller supported, lets add a bbu handler, so we
can use it to update the second stage boot loader partition.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/stm32mp157c-dk2/board.c  | 14 ++++++++++++++
 arch/arm/mach-stm32mp/include/mach/bbu.h | 14 ++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 arch/arm/mach-stm32mp/include/mach/bbu.h

diff --git a/arch/arm/boards/stm32mp157c-dk2/board.c b/arch/arm/boards/stm32mp157c-dk2/board.c
index 9cb861af85d8..23eb6728b15a 100644
--- a/arch/arm/boards/stm32mp157c-dk2/board.c
+++ b/arch/arm/boards/stm32mp157c-dk2/board.c
@@ -4,6 +4,7 @@
 #include <init.h>
 #include <asm/memory.h>
 #include <mach/stm32.h>
+#include <mach/bbu.h>
 
 static int dk2_mem_init(void)
 {
@@ -15,3 +16,16 @@ static int dk2_mem_init(void)
 	return 0;
 }
 mem_initcall(dk2_mem_init);
+
+static int dk2_postcore_init(void)
+{
+	if (!of_machine_is_compatible("st,stm32mp157c-dk2"))
+		return 0;
+
+	stm32mp_bbu_mmc_register_handler("sd", "/dev/disk0.ssbl",
+					 BBU_HANDLER_FLAG_DEFAULT);
+
+	return 0;
+}
+
+postcore_initcall(dk2_postcore_init);
diff --git a/arch/arm/mach-stm32mp/include/mach/bbu.h b/arch/arm/mach-stm32mp/include/mach/bbu.h
new file mode 100644
index 000000000000..8b9504400e9e
--- /dev/null
+++ b/arch/arm/mach-stm32mp/include/mach/bbu.h
@@ -0,0 +1,14 @@
+#ifndef MACH_STM32MP_BBU_H_
+#define MACH_STM32MP_BBU_H_
+
+#include <bbu.h>
+
+static inline int stm32mp_bbu_mmc_register_handler(const char *name,
+						   const char *devicefile,
+						   unsigned long flags)
+{
+	return bbu_register_std_file_update(name, flags, devicefile,
+					    filetype_stm32_image_v1);
+}
+
+#endif /* MACH_STM32MP_BBU_H_ */
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 5/5] Documentation: boards: stm32mp: document environment partition
  2019-10-14  6:39 [PATCH 0/4] ARM: stm32mp: dk2: support barebox_update and env Ahmad Fatoum
                   ` (3 preceding siblings ...)
  2019-10-14  6:39 ` [PATCH 4/5] ARM: stm32mp: dk2: add barebox SD-Card update handler Ahmad Fatoum
@ 2019-10-14  6:39 ` Ahmad Fatoum
  4 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2019-10-14  6:39 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We have barebox get its environment out of a "barebox-environment"
partition. The BootROM and first stage bootloader both select partitions
on name not UUID, so we're following suit.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 Documentation/boards/stm32mp.rst | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/boards/stm32mp.rst b/Documentation/boards/stm32mp.rst
index 24cf8859db8d..774ede6e560f 100644
--- a/Documentation/boards/stm32mp.rst
+++ b/Documentation/boards/stm32mp.rst
@@ -60,6 +60,10 @@ An appropriate image for the boot media can be generated with following
           image = "barebox-@STM32MP_BOARD@.img"
           size = 1M
       }
+      partition barebox-environment {
+          image = "/dev/null"
+          size = 1M
+      }
   }
 
 Image can then be flashed on e.g. a SD-Card.
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/5] ARM: stm32mp: dk2: add barebox SD-Card update handler
  2019-10-14  6:39 ` [PATCH 4/5] ARM: stm32mp: dk2: add barebox SD-Card update handler Ahmad Fatoum
@ 2019-10-14 12:51   ` Sascha Hauer
  2019-10-15  6:58     ` Ahmad Fatoum
  0 siblings, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2019-10-14 12:51 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Oct 14, 2019 at 08:39:21AM +0200, Ahmad Fatoum wrote:
> Now with the SD/MMC controller supported, lets add a bbu handler, so we
> can use it to update the second stage boot loader partition.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/arm/boards/stm32mp157c-dk2/board.c  | 14 ++++++++++++++
>  arch/arm/mach-stm32mp/include/mach/bbu.h | 14 ++++++++++++++
>  2 files changed, 28 insertions(+)
>  create mode 100644 arch/arm/mach-stm32mp/include/mach/bbu.h
> 
> diff --git a/arch/arm/boards/stm32mp157c-dk2/board.c b/arch/arm/boards/stm32mp157c-dk2/board.c
> index 9cb861af85d8..23eb6728b15a 100644
> --- a/arch/arm/boards/stm32mp157c-dk2/board.c
> +++ b/arch/arm/boards/stm32mp157c-dk2/board.c
> @@ -4,6 +4,7 @@
>  #include <init.h>
>  #include <asm/memory.h>
>  #include <mach/stm32.h>
> +#include <mach/bbu.h>
>  
>  static int dk2_mem_init(void)
>  {
> @@ -15,3 +16,16 @@ static int dk2_mem_init(void)
>  	return 0;
>  }
>  mem_initcall(dk2_mem_init);
> +
> +static int dk2_postcore_init(void)
> +{
> +	if (!of_machine_is_compatible("st,stm32mp157c-dk2"))
> +		return 0;
> +
> +	stm32mp_bbu_mmc_register_handler("sd", "/dev/disk0.ssbl",
> +					 BBU_HANDLER_FLAG_DEFAULT);

You should create an alias in dt for the sd device node (might exist
already, don't know) and use mci_of_parse_node() in the SD driver. With
this you get consistent names. "disk0" will be different devices
depending on probe order.

Sascha

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/5] ARM: stm32mp: dk2: add barebox SD-Card update handler
  2019-10-14 12:51   ` Sascha Hauer
@ 2019-10-15  6:58     ` Ahmad Fatoum
  2019-10-15  7:59       ` Sascha Hauer
  0 siblings, 1 reply; 10+ messages in thread
From: Ahmad Fatoum @ 2019-10-15  6:58 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hello,

On 10/14/19 2:51 PM, Sascha Hauer wrote:
> On Mon, Oct 14, 2019 at 08:39:21AM +0200, Ahmad Fatoum wrote:
>> Now with the SD/MMC controller supported, lets add a bbu handler, so we
>> can use it to update the second stage boot loader partition.
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>> ---
>>  arch/arm/boards/stm32mp157c-dk2/board.c  | 14 ++++++++++++++
>>  arch/arm/mach-stm32mp/include/mach/bbu.h | 14 ++++++++++++++
>>  2 files changed, 28 insertions(+)
>>  create mode 100644 arch/arm/mach-stm32mp/include/mach/bbu.h
>>
>> diff --git a/arch/arm/boards/stm32mp157c-dk2/board.c b/arch/arm/boards/stm32mp157c-dk2/board.c
>> index 9cb861af85d8..23eb6728b15a 100644
>> --- a/arch/arm/boards/stm32mp157c-dk2/board.c
>> +++ b/arch/arm/boards/stm32mp157c-dk2/board.c
>> @@ -4,6 +4,7 @@
>>  #include <init.h>
>>  #include <asm/memory.h>
>>  #include <mach/stm32.h>
>> +#include <mach/bbu.h>
>>  
>>  static int dk2_mem_init(void)
>>  {
>> @@ -15,3 +16,16 @@ static int dk2_mem_init(void)
>>  	return 0;
>>  }
>>  mem_initcall(dk2_mem_init);
>> +
>> +static int dk2_postcore_init(void)
>> +{
>> +	if (!of_machine_is_compatible("st,stm32mp157c-dk2"))
>> +		return 0;
>> +
>> +	stm32mp_bbu_mmc_register_handler("sd", "/dev/disk0.ssbl",
>> +					 BBU_HANDLER_FLAG_DEFAULT);
> 
> You should create an alias in dt for the sd device node (might exist
> already, don't know) and use mci_of_parse_node() in the SD driver. With
> this you get consistent names. "disk0" will be different devices
> depending on probe order.

Ah, ok. I'll resend when Oleksij resends his.
The first patch would be useful to have for other boards as well.
Could you apply it seperately?

Thanks
Ahmad

> 
> Sascha
> 

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/5] ARM: stm32mp: dk2: add barebox SD-Card update handler
  2019-10-15  6:58     ` Ahmad Fatoum
@ 2019-10-15  7:59       ` Sascha Hauer
  2019-10-15  8:21         ` Ahmad Fatoum
  0 siblings, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2019-10-15  7:59 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Tue, Oct 15, 2019 at 08:58:23AM +0200, Ahmad Fatoum wrote:
> Hello,
> 
> On 10/14/19 2:51 PM, Sascha Hauer wrote:
> > On Mon, Oct 14, 2019 at 08:39:21AM +0200, Ahmad Fatoum wrote:
> >> Now with the SD/MMC controller supported, lets add a bbu handler, so we
> >> can use it to update the second stage boot loader partition.
> >>
> >> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> >> ---
> >>  arch/arm/boards/stm32mp157c-dk2/board.c  | 14 ++++++++++++++
> >>  arch/arm/mach-stm32mp/include/mach/bbu.h | 14 ++++++++++++++
> >>  2 files changed, 28 insertions(+)
> >>  create mode 100644 arch/arm/mach-stm32mp/include/mach/bbu.h
> >>
> >> diff --git a/arch/arm/boards/stm32mp157c-dk2/board.c b/arch/arm/boards/stm32mp157c-dk2/board.c
> >> index 9cb861af85d8..23eb6728b15a 100644
> >> --- a/arch/arm/boards/stm32mp157c-dk2/board.c
> >> +++ b/arch/arm/boards/stm32mp157c-dk2/board.c
> >> @@ -4,6 +4,7 @@
> >>  #include <init.h>
> >>  #include <asm/memory.h>
> >>  #include <mach/stm32.h>
> >> +#include <mach/bbu.h>
> >>  
> >>  static int dk2_mem_init(void)
> >>  {
> >> @@ -15,3 +16,16 @@ static int dk2_mem_init(void)
> >>  	return 0;
> >>  }
> >>  mem_initcall(dk2_mem_init);
> >> +
> >> +static int dk2_postcore_init(void)
> >> +{
> >> +	if (!of_machine_is_compatible("st,stm32mp157c-dk2"))
> >> +		return 0;
> >> +
> >> +	stm32mp_bbu_mmc_register_handler("sd", "/dev/disk0.ssbl",
> >> +					 BBU_HANDLER_FLAG_DEFAULT);
> > 
> > You should create an alias in dt for the sd device node (might exist
> > already, don't know) and use mci_of_parse_node() in the SD driver. With
> > this you get consistent names. "disk0" will be different devices
> > depending on probe order.
> 
> Ah, ok. I'll resend when Oleksij resends his.
> The first patch would be useful to have for other boards as well.
> Could you apply it seperately?

I applied all other patches except this one. Environment on SD cards
doesn't obviously work as long as the driver is not there, but that
should be a reason to not apply this series, right?

Sascha

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/5] ARM: stm32mp: dk2: add barebox SD-Card update handler
  2019-10-15  7:59       ` Sascha Hauer
@ 2019-10-15  8:21         ` Ahmad Fatoum
  0 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2019-10-15  8:21 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 10/15/19 9:59 AM, Sascha Hauer wrote:
> On Tue, Oct 15, 2019 at 08:58:23AM +0200, Ahmad Fatoum wrote:
>> Hello,
>>
>> On 10/14/19 2:51 PM, Sascha Hauer wrote:
>>> On Mon, Oct 14, 2019 at 08:39:21AM +0200, Ahmad Fatoum wrote:
>>>> Now with the SD/MMC controller supported, lets add a bbu handler, so we
>>>> can use it to update the second stage boot loader partition.
>>>>
>>>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>>>> ---
>>>>  arch/arm/boards/stm32mp157c-dk2/board.c  | 14 ++++++++++++++
>>>>  arch/arm/mach-stm32mp/include/mach/bbu.h | 14 ++++++++++++++
>>>>  2 files changed, 28 insertions(+)
>>>>  create mode 100644 arch/arm/mach-stm32mp/include/mach/bbu.h
>>>>
>>>> diff --git a/arch/arm/boards/stm32mp157c-dk2/board.c b/arch/arm/boards/stm32mp157c-dk2/board.c
>>>> index 9cb861af85d8..23eb6728b15a 100644
>>>> --- a/arch/arm/boards/stm32mp157c-dk2/board.c
>>>> +++ b/arch/arm/boards/stm32mp157c-dk2/board.c
>>>> @@ -4,6 +4,7 @@
>>>>  #include <init.h>
>>>>  #include <asm/memory.h>
>>>>  #include <mach/stm32.h>
>>>> +#include <mach/bbu.h>
>>>>  
>>>>  static int dk2_mem_init(void)
>>>>  {
>>>> @@ -15,3 +16,16 @@ static int dk2_mem_init(void)
>>>>  	return 0;
>>>>  }
>>>>  mem_initcall(dk2_mem_init);
>>>> +
>>>> +static int dk2_postcore_init(void)
>>>> +{
>>>> +	if (!of_machine_is_compatible("st,stm32mp157c-dk2"))
>>>> +		return 0;
>>>> +
>>>> +	stm32mp_bbu_mmc_register_handler("sd", "/dev/disk0.ssbl",
>>>> +					 BBU_HANDLER_FLAG_DEFAULT);
>>>
>>> You should create an alias in dt for the sd device node (might exist
>>> already, don't know) and use mci_of_parse_node() in the SD driver. With
>>> this you get consistent names. "disk0" will be different devices
>>> depending on probe order.
>>
>> Ah, ok. I'll resend when Oleksij resends his.
>> The first patch would be useful to have for other boards as well.
>> Could you apply it seperately?
> 
> I applied all other patches except this one. Environment on SD cards
> doesn't obviously work as long as the driver is not there, but that
> should be a reason to not apply this series, right?

Great, thanks
Ahmad

> 
> Sascha
> 


-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-10-15  8:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-14  6:39 [PATCH 0/4] ARM: stm32mp: dk2: support barebox_update and env Ahmad Fatoum
2019-10-14  6:39 ` [PATCH 1/5] fs: devfs-core: have device_find_partition search symlinks Ahmad Fatoum
2019-10-14  6:39 ` [PATCH 2/5] ARM: dts: stm32mp: add barebox-enviroment on DK boards Ahmad Fatoum
2019-10-14  6:39 ` [PATCH 3/5] ARM: stm32mp: dk2: rename function according to init level Ahmad Fatoum
2019-10-14  6:39 ` [PATCH 4/5] ARM: stm32mp: dk2: add barebox SD-Card update handler Ahmad Fatoum
2019-10-14 12:51   ` Sascha Hauer
2019-10-15  6:58     ` Ahmad Fatoum
2019-10-15  7:59       ` Sascha Hauer
2019-10-15  8:21         ` Ahmad Fatoum
2019-10-14  6:39 ` [PATCH 5/5] Documentation: boards: stm32mp: document environment partition Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox