All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/2] ARMv8: driver model enable
@ 2015-01-31  3:55 fenghua at phytium.com.cn
  2015-01-31  3:55 ` [U-Boot] [PATCH 1/2] ARMv8: enable pre-allocation malloc fenghua at phytium.com.cn
  0 siblings, 1 reply; 10+ messages in thread
From: fenghua at phytium.com.cn @ 2015-01-31  3:55 UTC (permalink / raw)
  To: u-boot

From: David Feng <fenghua@phytium.com.cn>

Currently serial_pl01x.c driver contain DM and non-DM mode,
but it will access static varible in non-DM mode.
So, u-boot using non-DM pl01x driver can not be placed in flash.
This patch set enable pre-allocation malloc that is required by DM
and enable DM in vexpress64 board.

David Feng (2):
  ARMv8: enable pre-allocation malloc
  ARMv8: enable DM in vexpress64 board

 arch/arm/include/asm/config.h        |    4 ----
 arch/arm/lib/crt0_64.S               |   13 +++++++++++--
 board/armltd/vexpress64/vexpress64.c |   13 +++++++++++++
 include/configs/vexpress_aemv8a.h    |   14 ++++++++++++--
 4 files changed, 36 insertions(+), 8 deletions(-)

-- 
1.7.9.5

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

* [U-Boot] [PATCH 1/2] ARMv8: enable pre-allocation malloc
  2015-01-31  3:55 [U-Boot] [PATCH 0/2] ARMv8: driver model enable fenghua at phytium.com.cn
@ 2015-01-31  3:55 ` fenghua at phytium.com.cn
  2015-01-31  3:55   ` [U-Boot] [PATCH 2/2] ARMv8: enable DM in vexpress64 board fenghua at phytium.com.cn
  2015-03-27 15:35   ` [U-Boot] [PATCH 1/2] ARMv8: enable pre-allocation malloc Albert ARIBAUD
  0 siblings, 2 replies; 10+ messages in thread
From: fenghua at phytium.com.cn @ 2015-01-31  3:55 UTC (permalink / raw)
  To: u-boot

From: David Feng <fenghua@phytium.com.cn>

Allocate memory space for pre-allocation malloc and zero global data.
This code is partly from crt0.S.

Signed-off-by: David Feng <fenghua@phytium.com.cn>
---
 arch/arm/include/asm/config.h |    4 ----
 arch/arm/lib/crt0_64.S        |   13 +++++++++++--
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/arch/arm/include/asm/config.h b/arch/arm/include/asm/config.h
index be80434..7a34a01 100644
--- a/arch/arm/include/asm/config.h
+++ b/arch/arm/include/asm/config.h
@@ -7,10 +7,6 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
-#ifdef __aarch64__
-#define CONFIG_SYS_GENERIC_GLOBAL_DATA
-#endif
-
 #define CONFIG_LMB
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
index 7756396..1654011 100644
--- a/arch/arm/lib/crt0_64.S
+++ b/arch/arm/lib/crt0_64.S
@@ -62,9 +62,18 @@ ENTRY(_main)
  * Set up initial C runtime environment and call board_init_f(0).
  */
 	ldr	x0, =(CONFIG_SYS_INIT_SP_ADDR)
-	sub	x0, x0, #GD_SIZE	/* allocate one GD above SP */
+	sub	x18, x0, #GD_SIZE	/* allocate one GD above SP */
+	bic	x18, x18, #0x7		/* 8-byte alignment for GD */
+zero_gd:
+	sub	x0, x0, #0x8
+	str	xzr, [x0]
+	cmp	x0, x18
+	b.gt	zero_gd
+#if defined(CONFIG_SYS_MALLOC_F_LEN)
+	sub	x0, x18, #CONFIG_SYS_MALLOC_F_LEN
+	str	x0, [x18, #GD_MALLOC_BASE]
+#endif
 	bic	sp, x0, #0xf	/* 16-byte alignment for ABI compliance */
-	mov	x18, sp			/* GD is above SP */
 	mov	x0, #0
 	bl	board_init_f
 
-- 
1.7.9.5

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

* [U-Boot] [PATCH 2/2] ARMv8: enable DM in vexpress64 board
  2015-01-31  3:55 ` [U-Boot] [PATCH 1/2] ARMv8: enable pre-allocation malloc fenghua at phytium.com.cn
@ 2015-01-31  3:55   ` fenghua at phytium.com.cn
  2015-03-27 15:36     ` Albert ARIBAUD
  2015-04-13 14:50     ` Linus Walleij
  2015-03-27 15:35   ` [U-Boot] [PATCH 1/2] ARMv8: enable pre-allocation malloc Albert ARIBAUD
  1 sibling, 2 replies; 10+ messages in thread
From: fenghua at phytium.com.cn @ 2015-01-31  3:55 UTC (permalink / raw)
  To: u-boot

From: David Feng <fenghua@phytium.com.cn>

Signed-off-by: David Feng <fenghua@phytium.com.cn>
---
 board/armltd/vexpress64/vexpress64.c |   13 +++++++++++++
 include/configs/vexpress_aemv8a.h    |   14 ++++++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/board/armltd/vexpress64/vexpress64.c b/board/armltd/vexpress64/vexpress64.c
index 5897318..4171c6e 100644
--- a/board/armltd/vexpress64/vexpress64.c
+++ b/board/armltd/vexpress64/vexpress64.c
@@ -12,9 +12,22 @@
 #include <asm/io.h>
 #include <linux/compiler.h>
 #include <asm/semihosting.h>
+#include <dm/platdata.h>
+#include <dm/platform_data/serial_pl01x.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
+static const struct pl01x_serial_platdata serial_platdata = {
+	.base = V2M_UART0,
+	.type = TYPE_PL011,
+	.clock = 2400 * 1000,
+};
+
+U_BOOT_DEVICE(vexpress_serials) = {
+	.name = "serial_pl01x",
+	.platdata = &serial_platdata,
+};
+
 int board_init(void)
 {
 	return 0;
diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h
index 027d78b..9b31c2d 100644
--- a/include/configs/vexpress_aemv8a.h
+++ b/include/configs/vexpress_aemv8a.h
@@ -8,6 +8,8 @@
 #ifndef __VEXPRESS_AEMV8A_H
 #define __VEXPRESS_AEMV8A_H
 
+#define CONFIG_DM
+
 /* We use generic board for v8 Versatile Express */
 #define CONFIG_SYS_GENERIC_BOARD
 
@@ -52,7 +54,6 @@
 /* Flat Device Tree Definitions */
 #define CONFIG_OF_LIBFDT
 
-
 /* SMP Spin Table Definitions */
 #ifdef CONFIG_BASE_FVP
 #define CPU_RELEASE_ADDR		(CONFIG_SYS_SDRAM_BASE + 0x03f00000)
@@ -132,6 +133,7 @@
 #define CONFIG_SYS_MEMTEST_END		(V2M_BASE + 0x80000000)
 
 /* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_F_LEN		0x2000
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (8 << 20))
 
 /* SMSC91C111 Ethernet Configuration */
@@ -139,11 +141,19 @@
 #define CONFIG_SMC91111_BASE		(0x01A000000)
 
 /* PL011 Serial Configuration */
+#define CONFIG_BAUDRATE			115200
+#ifdef CONFIG_DM
+#define CONFIG_DM_SERIAL
+#define CONFIG_PL01X_SERIAL
+#else
+#define CONFIG_SYS_SERIAL0		V2M_UART0
+#define CONFIG_SYS_SERIAL1		V2M_UART1
+#define CONFIG_CONS_INDEX		0
 #define CONFIG_PL011_SERIAL
 #define CONFIG_PL011_CLOCK		24000000
 #define CONFIG_PL01x_PORTS		{(void *)CONFIG_SYS_SERIAL0, \
 					 (void *)CONFIG_SYS_SERIAL1}
-#define CONFIG_CONS_INDEX		0
+#endif
 
 #define CONFIG_BAUDRATE			115200
 #define CONFIG_SYS_SERIAL0		V2M_UART0
-- 
1.7.9.5

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

* [U-Boot] [PATCH 1/2] ARMv8: enable pre-allocation malloc
  2015-01-31  3:55 ` [U-Boot] [PATCH 1/2] ARMv8: enable pre-allocation malloc fenghua at phytium.com.cn
  2015-01-31  3:55   ` [U-Boot] [PATCH 2/2] ARMv8: enable DM in vexpress64 board fenghua at phytium.com.cn
@ 2015-03-27 15:35   ` Albert ARIBAUD
  1 sibling, 0 replies; 10+ messages in thread
From: Albert ARIBAUD @ 2015-03-27 15:35 UTC (permalink / raw)
  To: u-boot

Hello fenghua at phytium.com.cn,

On Sat, 31 Jan 2015 11:55:28 +0800, fenghua at phytium.com.cn <fenghua@phytium.com.cn> wrote:
> From: David Feng <fenghua@phytium.com.cn>
> 
> Allocate memory space for pre-allocation malloc and zero global data.
> This code is partly from crt0.S.
> 
> Signed-off-by: David Feng <fenghua@phytium.com.cn>
> ---
>  arch/arm/include/asm/config.h |    4 ----
>  arch/arm/lib/crt0_64.S        |   13 +++++++++++--
>  2 files changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/include/asm/config.h b/arch/arm/include/asm/config.h
> index be80434..7a34a01 100644
> --- a/arch/arm/include/asm/config.h
> +++ b/arch/arm/include/asm/config.h
> @@ -7,10 +7,6 @@
>  #ifndef _ASM_CONFIG_H_
>  #define _ASM_CONFIG_H_
>  
> -#ifdef __aarch64__
> -#define CONFIG_SYS_GENERIC_GLOBAL_DATA
> -#endif
> -
>  #define CONFIG_LMB
>  #define CONFIG_SYS_BOOT_RAMDISK_HIGH
>  
> diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
> index 7756396..1654011 100644
> --- a/arch/arm/lib/crt0_64.S
> +++ b/arch/arm/lib/crt0_64.S
> @@ -62,9 +62,18 @@ ENTRY(_main)
>   * Set up initial C runtime environment and call board_init_f(0).
>   */
>  	ldr	x0, =(CONFIG_SYS_INIT_SP_ADDR)
> -	sub	x0, x0, #GD_SIZE	/* allocate one GD above SP */
> +	sub	x18, x0, #GD_SIZE	/* allocate one GD above SP */
> +	bic	x18, x18, #0x7		/* 8-byte alignment for GD */
> +zero_gd:
> +	sub	x0, x0, #0x8
> +	str	xzr, [x0]
> +	cmp	x0, x18
> +	b.gt	zero_gd
> +#if defined(CONFIG_SYS_MALLOC_F_LEN)
> +	sub	x0, x18, #CONFIG_SYS_MALLOC_F_LEN
> +	str	x0, [x18, #GD_MALLOC_BASE]
> +#endif
>  	bic	sp, x0, #0xf	/* 16-byte alignment for ABI compliance */
> -	mov	x18, sp			/* GD is above SP */
>  	mov	x0, #0
>  	bl	board_init_f
>  
> -- 
> 1.7.9.5
> 
> 

Applied to u-boot-arm/master, thanks!

Amicalement,
-- 
Albert.

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

* [U-Boot] [PATCH 2/2] ARMv8: enable DM in vexpress64 board
  2015-01-31  3:55   ` [U-Boot] [PATCH 2/2] ARMv8: enable DM in vexpress64 board fenghua at phytium.com.cn
@ 2015-03-27 15:36     ` Albert ARIBAUD
  2015-04-13 14:50     ` Linus Walleij
  1 sibling, 0 replies; 10+ messages in thread
From: Albert ARIBAUD @ 2015-03-27 15:36 UTC (permalink / raw)
  To: u-boot

Hello fenghua at phytium.com.cn,

On Sat, 31 Jan 2015 11:55:29 +0800, fenghua at phytium.com.cn <fenghua@phytium.com.cn> wrote:
> From: David Feng <fenghua@phytium.com.cn>
> 
> Signed-off-by: David Feng <fenghua@phytium.com.cn>
> ---
>  board/armltd/vexpress64/vexpress64.c |   13 +++++++++++++
>  include/configs/vexpress_aemv8a.h    |   14 ++++++++++++--
>  2 files changed, 25 insertions(+), 2 deletions(-)
> 
> diff --git a/board/armltd/vexpress64/vexpress64.c b/board/armltd/vexpress64/vexpress64.c
> index 5897318..4171c6e 100644
> --- a/board/armltd/vexpress64/vexpress64.c
> +++ b/board/armltd/vexpress64/vexpress64.c
> @@ -12,9 +12,22 @@
>  #include <asm/io.h>
>  #include <linux/compiler.h>
>  #include <asm/semihosting.h>
> +#include <dm/platdata.h>
> +#include <dm/platform_data/serial_pl01x.h>
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> +static const struct pl01x_serial_platdata serial_platdata = {
> +	.base = V2M_UART0,
> +	.type = TYPE_PL011,
> +	.clock = 2400 * 1000,
> +};
> +
> +U_BOOT_DEVICE(vexpress_serials) = {
> +	.name = "serial_pl01x",
> +	.platdata = &serial_platdata,
> +};
> +
>  int board_init(void)
>  {
>  	return 0;
> diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h
> index 027d78b..9b31c2d 100644
> --- a/include/configs/vexpress_aemv8a.h
> +++ b/include/configs/vexpress_aemv8a.h
> @@ -8,6 +8,8 @@
>  #ifndef __VEXPRESS_AEMV8A_H
>  #define __VEXPRESS_AEMV8A_H
>  
> +#define CONFIG_DM
> +
>  /* We use generic board for v8 Versatile Express */
>  #define CONFIG_SYS_GENERIC_BOARD
>  
> @@ -52,7 +54,6 @@
>  /* Flat Device Tree Definitions */
>  #define CONFIG_OF_LIBFDT
>  
> -
>  /* SMP Spin Table Definitions */
>  #ifdef CONFIG_BASE_FVP
>  #define CPU_RELEASE_ADDR		(CONFIG_SYS_SDRAM_BASE + 0x03f00000)
> @@ -132,6 +133,7 @@
>  #define CONFIG_SYS_MEMTEST_END		(V2M_BASE + 0x80000000)
>  
>  /* Size of malloc() pool */
> +#define CONFIG_SYS_MALLOC_F_LEN		0x2000
>  #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (8 << 20))
>  
>  /* SMSC91C111 Ethernet Configuration */
> @@ -139,11 +141,19 @@
>  #define CONFIG_SMC91111_BASE		(0x01A000000)
>  
>  /* PL011 Serial Configuration */
> +#define CONFIG_BAUDRATE			115200
> +#ifdef CONFIG_DM
> +#define CONFIG_DM_SERIAL
> +#define CONFIG_PL01X_SERIAL
> +#else
> +#define CONFIG_SYS_SERIAL0		V2M_UART0
> +#define CONFIG_SYS_SERIAL1		V2M_UART1
> +#define CONFIG_CONS_INDEX		0
>  #define CONFIG_PL011_SERIAL
>  #define CONFIG_PL011_CLOCK		24000000
>  #define CONFIG_PL01x_PORTS		{(void *)CONFIG_SYS_SERIAL0, \
>  					 (void *)CONFIG_SYS_SERIAL1}
> -#define CONFIG_CONS_INDEX		0
> +#endif
>  
>  #define CONFIG_BAUDRATE			115200
>  #define CONFIG_SYS_SERIAL0		V2M_UART0
> -- 
> 1.7.9.5
> 
> 

Applied to u-boot-arm/master, thanks!

Amicalement,
-- 
Albert.

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

* [U-Boot] [PATCH 2/2] ARMv8: enable DM in vexpress64 board
  2015-01-31  3:55   ` [U-Boot] [PATCH 2/2] ARMv8: enable DM in vexpress64 board fenghua at phytium.com.cn
  2015-03-27 15:36     ` Albert ARIBAUD
@ 2015-04-13 14:50     ` Linus Walleij
  2015-04-13 15:15       ` Tom Rini
  1 sibling, 1 reply; 10+ messages in thread
From: Linus Walleij @ 2015-04-13 14:50 UTC (permalink / raw)
  To: u-boot

On Sat, Jan 31, 2015 at 4:55 AM,  <fenghua@phytium.com.cn> wrote:

> From: David Feng <fenghua@phytium.com.cn>
>
> Signed-off-by: David Feng <fenghua@phytium.com.cn>

This commit breaks U-Boot on the Juno board, I don't know how to
best fix it? Is DM something we want available on all boards or just
the FVP model?

Yours,
Linus Walleij

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

* [U-Boot] [PATCH 2/2] ARMv8: enable DM in vexpress64 board
  2015-04-13 14:50     ` Linus Walleij
@ 2015-04-13 15:15       ` Tom Rini
  2015-04-13 20:58         ` Linus Walleij
  0 siblings, 1 reply; 10+ messages in thread
From: Tom Rini @ 2015-04-13 15:15 UTC (permalink / raw)
  To: u-boot

On Mon, Apr 13, 2015 at 04:50:55PM +0200, Linus Walleij wrote:
> On Sat, Jan 31, 2015 at 4:55 AM,  <fenghua@phytium.com.cn> wrote:
> 
> > From: David Feng <fenghua@phytium.com.cn>
> >
> > Signed-off-by: David Feng <fenghua@phytium.com.cn>
> 
> This commit breaks U-Boot on the Juno board, I don't know how to
> best fix it? Is DM something we want available on all boards or just
> the FVP model?

All boards, moving forward more things are going to need it.  If you
poke around git log you'll see some other patches fixing "enabled DM and
now board X doesn't work" commits.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150413/1320c96b/attachment.sig>

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

* [U-Boot] [PATCH 2/2] ARMv8: enable DM in vexpress64 board
  2015-04-13 15:15       ` Tom Rini
@ 2015-04-13 20:58         ` Linus Walleij
  2015-04-13 22:26           ` Simon Glass
  0 siblings, 1 reply; 10+ messages in thread
From: Linus Walleij @ 2015-04-13 20:58 UTC (permalink / raw)
  To: u-boot

On Mon, Apr 13, 2015 at 5:15 PM, Tom Rini <trini@konsulko.com> wrote:
> On Mon, Apr 13, 2015 at 04:50:55PM +0200, Linus Walleij wrote:
>> On Sat, Jan 31, 2015 at 4:55 AM,  <fenghua@phytium.com.cn> wrote:
>>
>> > From: David Feng <fenghua@phytium.com.cn>
>> >
>> > Signed-off-by: David Feng <fenghua@phytium.com.cn>
>>
>> This commit breaks U-Boot on the Juno board, I don't know how to
>> best fix it? Is DM something we want available on all boards or just
>> the FVP model?
>
> All boards, moving forward more things are going to need it.  If you
> poke around git log you'll see some other patches fixing "enabled DM and
> now board X doesn't work" commits.

Yeah well right now my problem is figuring out what DM is,
but I guess I will get it as part of fixing this...

Yours,
Linus Walleij

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

* [U-Boot] [PATCH 2/2] ARMv8: enable DM in vexpress64 board
  2015-04-13 20:58         ` Linus Walleij
@ 2015-04-13 22:26           ` Simon Glass
  2015-04-15  8:08             ` Linus Walleij
  0 siblings, 1 reply; 10+ messages in thread
From: Simon Glass @ 2015-04-13 22:26 UTC (permalink / raw)
  To: u-boot

Hi Linus,

On 13 April 2015 at 14:58, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Mon, Apr 13, 2015 at 5:15 PM, Tom Rini <trini@konsulko.com> wrote:
>> On Mon, Apr 13, 2015 at 04:50:55PM +0200, Linus Walleij wrote:
>>> On Sat, Jan 31, 2015 at 4:55 AM,  <fenghua@phytium.com.cn> wrote:
>>>
>>> > From: David Feng <fenghua@phytium.com.cn>
>>> >
>>> > Signed-off-by: David Feng <fenghua@phytium.com.cn>
>>>
>>> This commit breaks U-Boot on the Juno board, I don't know how to
>>> best fix it? Is DM something we want available on all boards or just
>>> the FVP model?
>>
>> All boards, moving forward more things are going to need it.  If you
>> poke around git log you'll see some other patches fixing "enabled DM and
>> now board X doesn't work" commits.
>
> Yeah well right now my problem is figuring out what DM is,
> but I guess I will get it as part of fixing this...

It's a driver model for U-Boot. You could start with
doc/driver-model/README.txt and try the 'demo' command in sandbox. The
demo drivers are pretty easy to follow.

Regards,
Simon

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

* [U-Boot] [PATCH 2/2] ARMv8: enable DM in vexpress64 board
  2015-04-13 22:26           ` Simon Glass
@ 2015-04-15  8:08             ` Linus Walleij
  0 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2015-04-15  8:08 UTC (permalink / raw)
  To: u-boot

On Tue, Apr 14, 2015 at 12:26 AM, Simon Glass <sjg@chromium.org> wrote:
> On 13 April 2015 at 14:58, Linus Walleij <linus.walleij@linaro.org> wrote:

>> Yeah well right now my problem is figuring out what DM is,
>> but I guess I will get it as part of fixing this...
>
> It's a driver model for U-Boot. You could start with
> doc/driver-model/README.txt and try the 'demo' command in sandbox. The
> demo drivers are pretty easy to follow.

Thanks Simon, much appreciated. Reading up and becoming a better
developer.

Yours,
Linus Walleij

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

end of thread, other threads:[~2015-04-15  8:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-31  3:55 [U-Boot] [PATCH 0/2] ARMv8: driver model enable fenghua at phytium.com.cn
2015-01-31  3:55 ` [U-Boot] [PATCH 1/2] ARMv8: enable pre-allocation malloc fenghua at phytium.com.cn
2015-01-31  3:55   ` [U-Boot] [PATCH 2/2] ARMv8: enable DM in vexpress64 board fenghua at phytium.com.cn
2015-03-27 15:36     ` Albert ARIBAUD
2015-04-13 14:50     ` Linus Walleij
2015-04-13 15:15       ` Tom Rini
2015-04-13 20:58         ` Linus Walleij
2015-04-13 22:26           ` Simon Glass
2015-04-15  8:08             ` Linus Walleij
2015-03-27 15:35   ` [U-Boot] [PATCH 1/2] ARMv8: enable pre-allocation malloc Albert ARIBAUD

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.