All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sunxi: Add support for using UART4 as console on A64
@ 2020-07-07  9:29 Nazım Gediz Aydındoğmuş
  2020-07-07 13:35 ` Maxime Ripard
  0 siblings, 1 reply; 7+ messages in thread
From: Nazım Gediz Aydındoğmuş @ 2020-07-07  9:29 UTC (permalink / raw)
  To: u-boot

Add some additional tests and definitions to be able to use UART4 of A64 and do not let it get in conflict with R_UART of some other SoCs (e.g. A23).

Signed-off-by: Naz?m Gediz Ayd?ndo?mu? <gediz.aydindogmus@genemek.com>
---

 arch/arm/include/asm/arch-sunxi/gpio.h | 1 +
 arch/arm/mach-sunxi/board.c            | 4 ++++
 arch/arm/mach-sunxi/clock_sun6i.c      | 3 ++-
 include/configs/sunxi-common.h         | 4 ++++
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h
index a646ea6a3c..1407aff25f 100644
--- a/arch/arm/include/asm/arch-sunxi/gpio.h
+++ b/arch/arm/include/asm/arch-sunxi/gpio.h
@@ -176,6 +176,7 @@ enum sunxi_gpio_number {
 #define SUNXI_GPD_LCD0		2
 #define SUNXI_GPD_LVDS0		3
 #define SUNXI_GPD_PWM		2
+#define SUN50I_GPD_UART4	3
 
 #define SUN5I_GPE_SDC2		3
 #define SUN8I_GPE_TWI2		3
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index f40fccd8f8..7d95b7dd29 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -140,6 +140,10 @@ static int gpio_init(void)
 	sunxi_gpio_set_cfgpin(SUNXI_GPL(2), SUN8I_GPL_R_UART);
 	sunxi_gpio_set_cfgpin(SUNXI_GPL(3), SUN8I_GPL_R_UART);
 	sunxi_gpio_set_pull(SUNXI_GPL(3), SUNXI_GPIO_PULL_UP);
+#elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN50I)
+	sunxi_gpio_set_cfgpin(SUNXI_GPD(2), SUN50I_GPD_UART4);
+	sunxi_gpio_set_cfgpin(SUNXI_GPD(3), SUN50I_GPD_UART4);
+	sunxi_gpio_set_pull(SUNXI_GPD(3), SUNXI_GPIO_PULL_UP);
 #else
 #error Unsupported console port number. Please fix pin mux settings in board.c
 #endif
diff --git a/arch/arm/mach-sunxi/clock_sun6i.c b/arch/arm/mach-sunxi/clock_sun6i.c
index 8e84062bd7..1f13b96be3 100644
--- a/arch/arm/mach-sunxi/clock_sun6i.c
+++ b/arch/arm/mach-sunxi/clock_sun6i.c
@@ -83,7 +83,8 @@ void clock_init_sec(void)
 
 void clock_init_uart(void)
 {
-#if CONFIG_CONS_INDEX < 5
+#if CONFIG_CONS_INDEX < 5 || \
+    defined(CONFIG_MACH_SUN50I) && CONFIG_CONS_INDEX < 6
 	struct sunxi_ccm_reg *const ccm =
 		(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
 
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 5b0bec0561..1324d60f60 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -45,8 +45,12 @@
 # define CONFIG_SYS_NS16550_COM2		SUNXI_UART1_BASE
 # define CONFIG_SYS_NS16550_COM3		SUNXI_UART2_BASE
 # define CONFIG_SYS_NS16550_COM4		SUNXI_UART3_BASE
+#if defined(CONFIG_MACH_SUN50I)
+# define CONFIG_SYS_NS16550_COM5		SUNXI_UART4_BASE
+#else
 # define CONFIG_SYS_NS16550_COM5		SUNXI_R_UART_BASE
 #endif
+#endif
 
 /* CPU */
 #define COUNTER_FREQUENCY		24000000
-- 
2.17.1

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

* [PATCH] sunxi: Add support for using UART4 as console on A64
  2020-07-07  9:29 [PATCH] sunxi: Add support for using UART4 as console on A64 Nazım Gediz Aydındoğmuş
@ 2020-07-07 13:35 ` Maxime Ripard
  0 siblings, 0 replies; 7+ messages in thread
From: Maxime Ripard @ 2020-07-07 13:35 UTC (permalink / raw)
  To: u-boot

Hi,

On Tue, Jul 07, 2020 at 12:29:37PM +0300, Naz?m Gediz Ayd?ndo?mu? wrote:
> Add some additional tests and definitions to be able to use UART4 of A64 and do not let it get in conflict with R_UART of some other SoCs (e.g. A23).

The commit log should be wrapped at 80 characters, and you should
provide a version number (using the -v option of git send-email) and a
change log from the previous version.

Maxime

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

* [PATCH] sunxi: Add support for using UART4 as console on A64
@ 2020-07-03  8:52 Nazım Gediz Aydındoğmuş
  0 siblings, 0 replies; 7+ messages in thread
From: Nazım Gediz Aydındoğmuş @ 2020-07-03  8:52 UTC (permalink / raw)
  To: u-boot

Add some additional tests and definitions to be able to use UART4 of A64 and do not let it get in conflict with R_UART of some other SoCs (e.g. A23).

Signed-off-by: Naz?m Gediz Ayd?ndo?mu? <gediz.aydindogmus@genemek.com>
---

 arch/arm/include/asm/arch-sunxi/gpio.h | 1 +
 arch/arm/mach-sunxi/board.c            | 4 ++++
 arch/arm/mach-sunxi/clock_sun6i.c      | 3 ++-
 include/configs/sunxi-common.h         | 4 ++++
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h
index a646ea6a3c..1407aff25f 100644
--- a/arch/arm/include/asm/arch-sunxi/gpio.h
+++ b/arch/arm/include/asm/arch-sunxi/gpio.h
@@ -176,6 +176,7 @@ enum sunxi_gpio_number {
 #define SUNXI_GPD_LCD0		2
 #define SUNXI_GPD_LVDS0		3
 #define SUNXI_GPD_PWM		2
+#define SUN50I_GPD_UART4	3
 
 #define SUN5I_GPE_SDC2		3
 #define SUN8I_GPE_TWI2		3
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index f40fccd8f8..7d95b7dd29 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -140,6 +140,10 @@ static int gpio_init(void)
 	sunxi_gpio_set_cfgpin(SUNXI_GPL(2), SUN8I_GPL_R_UART);
 	sunxi_gpio_set_cfgpin(SUNXI_GPL(3), SUN8I_GPL_R_UART);
 	sunxi_gpio_set_pull(SUNXI_GPL(3), SUNXI_GPIO_PULL_UP);
+#elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN50I)
+	sunxi_gpio_set_cfgpin(SUNXI_GPD(2), SUN50I_GPD_UART4);
+	sunxi_gpio_set_cfgpin(SUNXI_GPD(3), SUN50I_GPD_UART4);
+	sunxi_gpio_set_pull(SUNXI_GPD(3), SUNXI_GPIO_PULL_UP);
 #else
 #error Unsupported console port number. Please fix pin mux settings in board.c
 #endif
diff --git a/arch/arm/mach-sunxi/clock_sun6i.c b/arch/arm/mach-sunxi/clock_sun6i.c
index 8e84062bd7..1f13b96be3 100644
--- a/arch/arm/mach-sunxi/clock_sun6i.c
+++ b/arch/arm/mach-sunxi/clock_sun6i.c
@@ -83,7 +83,8 @@ void clock_init_sec(void)
 
 void clock_init_uart(void)
 {
-#if CONFIG_CONS_INDEX < 5
+#if CONFIG_CONS_INDEX < 5 || \
+    defined(CONFIG_MACH_SUN50I) && CONFIG_CONS_INDEX < 6
 	struct sunxi_ccm_reg *const ccm =
 		(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
 
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 5b0bec0561..1324d60f60 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -45,8 +45,12 @@
 # define CONFIG_SYS_NS16550_COM2		SUNXI_UART1_BASE
 # define CONFIG_SYS_NS16550_COM3		SUNXI_UART2_BASE
 # define CONFIG_SYS_NS16550_COM4		SUNXI_UART3_BASE
+#if defined(CONFIG_MACH_SUN50I)
+# define CONFIG_SYS_NS16550_COM5		SUNXI_UART4_BASE
+#else
 # define CONFIG_SYS_NS16550_COM5		SUNXI_R_UART_BASE
 #endif
+#endif
 
 /* CPU */
 #define COUNTER_FREQUENCY		24000000
-- 
2.17.1

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

* [PATCH] sunxi: Add support for using UART4 as console on A64
  2020-06-29 19:12   ` Nazım Gediz AYDINDOĞMUŞ
@ 2020-07-02 17:43     ` Maxime Ripard
  0 siblings, 0 replies; 7+ messages in thread
From: Maxime Ripard @ 2020-07-02 17:43 UTC (permalink / raw)
  To: u-boot

Hi,

On Mon, Jun 29, 2020 at 07:12:04PM +0000, Naz?m Gediz AYDINDO?MU? wrote:
> Hi.
> 
> If I've understood it well, you're pointing out for the following part,
> right?

Yep

> >  /* CPU */
> >  #define COUNTER_FREQUENCY		24000000
> > @@ -248,6 +252,8 @@ extern int soft_i2c_gpio_scl;
> >  #define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01c28800:115200"
> >  #elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN8I)
> >  #define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01f02800:115200"
> > +#elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN50I)
> > +#define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01c29000:115200"
> 
> To be honest, this part was remnant of days long trial and error attempts
> at trying to make UART4 work.
> Sorry for not scrutinizing it carefully. It was not because do not taking
> it serious but due to not fully grasping the said changes.
> 
> If there's not any other thing to remove/add/fix, should I reformat and
> submit a completely new patch or is it okay to send the updated one as a
> follow-up post in this thread?

Yeah, send a new version.

Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200702/f2b8621b/attachment.sig>

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

* [PATCH] sunxi: Add support for using UART4 as console on A64
  2020-06-29 15:27 ` Maxime Ripard
@ 2020-06-29 19:12   ` Nazım Gediz AYDINDOĞMUŞ
  2020-07-02 17:43     ` Maxime Ripard
  0 siblings, 1 reply; 7+ messages in thread
From: Nazım Gediz AYDINDOĞMUŞ @ 2020-06-29 19:12 UTC (permalink / raw)
  To: u-boot

Hi.

If I've understood it well, you're pointing out for the following part,
right?

>  /* CPU */
>  #define COUNTER_FREQUENCY		24000000
> @@ -248,6 +252,8 @@ extern int soft_i2c_gpio_scl;
>  #define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01c28800:115200"
>  #elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN8I)
>  #define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01f02800:115200"
> +#elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN50I)
> +#define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01c29000:115200"

To be honest, this part was remnant of days long trial and error attempts
at trying to make UART4 work.
Sorry for not scrutinizing it carefully. It was not because do not taking
it serious but due to not fully grasping the said changes.

If there's not any other thing to remove/add/fix, should I reformat and
submit a completely new patch or is it okay to send the updated one as a
follow-up post in this thread?

Thanks for the review, by the way.


On 29.06.2020 18:27, Maxime Ripard wrote:
> Hi,
> 
> On Mon, Jun 29, 2020 at 12:09:38PM +0300, Naz?m Gediz Ayd?ndo?mu? wrote:
>> A64 has UART4 but it was in conflict with R_UART of older SoCs (e.g. A23).
>>
>> This commit adds necessary definitions and checks to use UART4 port on A64.
>>
>> Signed-off-by: Naz?m Gediz Ayd?ndo?mu? <gediz.aydindogmus@genemek.com>
>> ---
>>
>>  arch/arm/include/asm/arch-sunxi/gpio.h | 1 +
>>  arch/arm/mach-sunxi/board.c            | 4 ++++
>>  arch/arm/mach-sunxi/clock_sun6i.c      | 3 ++-
>>  include/configs/sunxi-common.h         | 6 ++++++
>>  4 files changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h
>> index a646ea6a3c..1407aff25f 100644
>> --- a/arch/arm/include/asm/arch-sunxi/gpio.h
>> +++ b/arch/arm/include/asm/arch-sunxi/gpio.h
>> @@ -176,6 +176,7 @@ enum sunxi_gpio_number {
>>  #define SUNXI_GPD_LCD0		2
>>  #define SUNXI_GPD_LVDS0		3
>>  #define SUNXI_GPD_PWM		2
>> +#define SUN50I_GPD_UART4	3
>>  
>>  #define SUN5I_GPE_SDC2		3
>>  #define SUN8I_GPE_TWI2		3
>> diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
>> index f40fccd8f8..7d95b7dd29 100644
>> --- a/arch/arm/mach-sunxi/board.c
>> +++ b/arch/arm/mach-sunxi/board.c
>> @@ -140,6 +140,10 @@ static int gpio_init(void)
>>  	sunxi_gpio_set_cfgpin(SUNXI_GPL(2), SUN8I_GPL_R_UART);
>>  	sunxi_gpio_set_cfgpin(SUNXI_GPL(3), SUN8I_GPL_R_UART);
>>  	sunxi_gpio_set_pull(SUNXI_GPL(3), SUNXI_GPIO_PULL_UP);
>> +#elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN50I)
>> +	sunxi_gpio_set_cfgpin(SUNXI_GPD(2), SUN50I_GPD_UART4);
>> +	sunxi_gpio_set_cfgpin(SUNXI_GPD(3), SUN50I_GPD_UART4);
>> +	sunxi_gpio_set_pull(SUNXI_GPD(3), SUNXI_GPIO_PULL_UP);
>>  #else
>>  #error Unsupported console port number. Please fix pin mux settings in board.c
>>  #endif
>> diff --git a/arch/arm/mach-sunxi/clock_sun6i.c b/arch/arm/mach-sunxi/clock_sun6i.c
>> index 8e84062bd7..4bb2d66b1e 100644
>> --- a/arch/arm/mach-sunxi/clock_sun6i.c
>> +++ b/arch/arm/mach-sunxi/clock_sun6i.c
>> @@ -83,7 +83,8 @@ void clock_init_sec(void)
>>  
>>  void clock_init_uart(void)
>>  {
>> -#if CONFIG_CONS_INDEX < 5
>> +#if CONFIG_CONS_INDEX < 5 || \
>> +      defined(CONFIG_MACH_SUN50I) && CONFIG_CONS_INDEX < 6
>>  	struct sunxi_ccm_reg *const ccm =
>>  		(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
>>  
>> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
>> index 5b0bec0561..f7a97b3dec 100644
>> --- a/include/configs/sunxi-common.h
>> +++ b/include/configs/sunxi-common.h
>> @@ -45,8 +45,12 @@
>>  # define CONFIG_SYS_NS16550_COM2		SUNXI_UART1_BASE
>>  # define CONFIG_SYS_NS16550_COM3		SUNXI_UART2_BASE
>>  # define CONFIG_SYS_NS16550_COM4		SUNXI_UART3_BASE
>> +#if defined(CONFIG_MACH_SUN50I)
>> +# define CONFIG_SYS_NS16550_COM5		SUNXI_UART4_BASE
>> +#else
>>  # define CONFIG_SYS_NS16550_COM5		SUNXI_R_UART_BASE
>>  #endif
>> +#endif
>>  
>>  /* CPU */
>>  #define COUNTER_FREQUENCY		24000000
>> @@ -248,6 +252,8 @@ extern int soft_i2c_gpio_scl;
>>  #define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01c28800:115200"
>>  #elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN8I)
>>  #define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01f02800:115200"
>> +#elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN50I)
>> +#define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01c29000:115200"
> 
> The soc node doesn't have a unit-address on the A64
> Maxime
> 

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

* [PATCH] sunxi: Add support for using UART4 as console on A64
  2020-06-29  9:09 Nazım Gediz Aydındoğmuş
@ 2020-06-29 15:27 ` Maxime Ripard
  2020-06-29 19:12   ` Nazım Gediz AYDINDOĞMUŞ
  0 siblings, 1 reply; 7+ messages in thread
From: Maxime Ripard @ 2020-06-29 15:27 UTC (permalink / raw)
  To: u-boot

Hi,

On Mon, Jun 29, 2020 at 12:09:38PM +0300, Naz?m Gediz Ayd?ndo?mu? wrote:
> A64 has UART4 but it was in conflict with R_UART of older SoCs (e.g. A23).
> 
> This commit adds necessary definitions and checks to use UART4 port on A64.
> 
> Signed-off-by: Naz?m Gediz Ayd?ndo?mu? <gediz.aydindogmus@genemek.com>
> ---
> 
>  arch/arm/include/asm/arch-sunxi/gpio.h | 1 +
>  arch/arm/mach-sunxi/board.c            | 4 ++++
>  arch/arm/mach-sunxi/clock_sun6i.c      | 3 ++-
>  include/configs/sunxi-common.h         | 6 ++++++
>  4 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h
> index a646ea6a3c..1407aff25f 100644
> --- a/arch/arm/include/asm/arch-sunxi/gpio.h
> +++ b/arch/arm/include/asm/arch-sunxi/gpio.h
> @@ -176,6 +176,7 @@ enum sunxi_gpio_number {
>  #define SUNXI_GPD_LCD0		2
>  #define SUNXI_GPD_LVDS0		3
>  #define SUNXI_GPD_PWM		2
> +#define SUN50I_GPD_UART4	3
>  
>  #define SUN5I_GPE_SDC2		3
>  #define SUN8I_GPE_TWI2		3
> diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
> index f40fccd8f8..7d95b7dd29 100644
> --- a/arch/arm/mach-sunxi/board.c
> +++ b/arch/arm/mach-sunxi/board.c
> @@ -140,6 +140,10 @@ static int gpio_init(void)
>  	sunxi_gpio_set_cfgpin(SUNXI_GPL(2), SUN8I_GPL_R_UART);
>  	sunxi_gpio_set_cfgpin(SUNXI_GPL(3), SUN8I_GPL_R_UART);
>  	sunxi_gpio_set_pull(SUNXI_GPL(3), SUNXI_GPIO_PULL_UP);
> +#elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN50I)
> +	sunxi_gpio_set_cfgpin(SUNXI_GPD(2), SUN50I_GPD_UART4);
> +	sunxi_gpio_set_cfgpin(SUNXI_GPD(3), SUN50I_GPD_UART4);
> +	sunxi_gpio_set_pull(SUNXI_GPD(3), SUNXI_GPIO_PULL_UP);
>  #else
>  #error Unsupported console port number. Please fix pin mux settings in board.c
>  #endif
> diff --git a/arch/arm/mach-sunxi/clock_sun6i.c b/arch/arm/mach-sunxi/clock_sun6i.c
> index 8e84062bd7..4bb2d66b1e 100644
> --- a/arch/arm/mach-sunxi/clock_sun6i.c
> +++ b/arch/arm/mach-sunxi/clock_sun6i.c
> @@ -83,7 +83,8 @@ void clock_init_sec(void)
>  
>  void clock_init_uart(void)
>  {
> -#if CONFIG_CONS_INDEX < 5
> +#if CONFIG_CONS_INDEX < 5 || \
> +      defined(CONFIG_MACH_SUN50I) && CONFIG_CONS_INDEX < 6
>  	struct sunxi_ccm_reg *const ccm =
>  		(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
>  
> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
> index 5b0bec0561..f7a97b3dec 100644
> --- a/include/configs/sunxi-common.h
> +++ b/include/configs/sunxi-common.h
> @@ -45,8 +45,12 @@
>  # define CONFIG_SYS_NS16550_COM2		SUNXI_UART1_BASE
>  # define CONFIG_SYS_NS16550_COM3		SUNXI_UART2_BASE
>  # define CONFIG_SYS_NS16550_COM4		SUNXI_UART3_BASE
> +#if defined(CONFIG_MACH_SUN50I)
> +# define CONFIG_SYS_NS16550_COM5		SUNXI_UART4_BASE
> +#else
>  # define CONFIG_SYS_NS16550_COM5		SUNXI_R_UART_BASE
>  #endif
> +#endif
>  
>  /* CPU */
>  #define COUNTER_FREQUENCY		24000000
> @@ -248,6 +252,8 @@ extern int soft_i2c_gpio_scl;
>  #define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01c28800:115200"
>  #elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN8I)
>  #define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01f02800:115200"
> +#elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN50I)
> +#define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01c29000:115200"

The soc node doesn't have a unit-address on the A64
Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200629/800cfc76/attachment.sig>

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

* [PATCH] sunxi: Add support for using UART4 as console on A64
@ 2020-06-29  9:09 Nazım Gediz Aydındoğmuş
  2020-06-29 15:27 ` Maxime Ripard
  0 siblings, 1 reply; 7+ messages in thread
From: Nazım Gediz Aydındoğmuş @ 2020-06-29  9:09 UTC (permalink / raw)
  To: u-boot

A64 has UART4 but it was in conflict with R_UART of older SoCs (e.g. A23).

This commit adds necessary definitions and checks to use UART4 port on A64.

Signed-off-by: Naz?m Gediz Ayd?ndo?mu? <gediz.aydindogmus@genemek.com>
---

 arch/arm/include/asm/arch-sunxi/gpio.h | 1 +
 arch/arm/mach-sunxi/board.c            | 4 ++++
 arch/arm/mach-sunxi/clock_sun6i.c      | 3 ++-
 include/configs/sunxi-common.h         | 6 ++++++
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h
index a646ea6a3c..1407aff25f 100644
--- a/arch/arm/include/asm/arch-sunxi/gpio.h
+++ b/arch/arm/include/asm/arch-sunxi/gpio.h
@@ -176,6 +176,7 @@ enum sunxi_gpio_number {
 #define SUNXI_GPD_LCD0		2
 #define SUNXI_GPD_LVDS0		3
 #define SUNXI_GPD_PWM		2
+#define SUN50I_GPD_UART4	3
 
 #define SUN5I_GPE_SDC2		3
 #define SUN8I_GPE_TWI2		3
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index f40fccd8f8..7d95b7dd29 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -140,6 +140,10 @@ static int gpio_init(void)
 	sunxi_gpio_set_cfgpin(SUNXI_GPL(2), SUN8I_GPL_R_UART);
 	sunxi_gpio_set_cfgpin(SUNXI_GPL(3), SUN8I_GPL_R_UART);
 	sunxi_gpio_set_pull(SUNXI_GPL(3), SUNXI_GPIO_PULL_UP);
+#elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN50I)
+	sunxi_gpio_set_cfgpin(SUNXI_GPD(2), SUN50I_GPD_UART4);
+	sunxi_gpio_set_cfgpin(SUNXI_GPD(3), SUN50I_GPD_UART4);
+	sunxi_gpio_set_pull(SUNXI_GPD(3), SUNXI_GPIO_PULL_UP);
 #else
 #error Unsupported console port number. Please fix pin mux settings in board.c
 #endif
diff --git a/arch/arm/mach-sunxi/clock_sun6i.c b/arch/arm/mach-sunxi/clock_sun6i.c
index 8e84062bd7..4bb2d66b1e 100644
--- a/arch/arm/mach-sunxi/clock_sun6i.c
+++ b/arch/arm/mach-sunxi/clock_sun6i.c
@@ -83,7 +83,8 @@ void clock_init_sec(void)
 
 void clock_init_uart(void)
 {
-#if CONFIG_CONS_INDEX < 5
+#if CONFIG_CONS_INDEX < 5 || \
+      defined(CONFIG_MACH_SUN50I) && CONFIG_CONS_INDEX < 6
 	struct sunxi_ccm_reg *const ccm =
 		(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
 
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 5b0bec0561..f7a97b3dec 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -45,8 +45,12 @@
 # define CONFIG_SYS_NS16550_COM2		SUNXI_UART1_BASE
 # define CONFIG_SYS_NS16550_COM3		SUNXI_UART2_BASE
 # define CONFIG_SYS_NS16550_COM4		SUNXI_UART3_BASE
+#if defined(CONFIG_MACH_SUN50I)
+# define CONFIG_SYS_NS16550_COM5		SUNXI_UART4_BASE
+#else
 # define CONFIG_SYS_NS16550_COM5		SUNXI_R_UART_BASE
 #endif
+#endif
 
 /* CPU */
 #define COUNTER_FREQUENCY		24000000
@@ -248,6 +252,8 @@ extern int soft_i2c_gpio_scl;
 #define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01c28800:115200"
 #elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN8I)
 #define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01f02800:115200"
+#elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN50I)
+#define OF_STDOUT_PATH		"/soc at 01c00000/serial@01c29000:115200"
 #else
 #error Unsupported console port nr. Please fix stdout-path in sunxi-common.h.
 #endif
-- 
2.17.1

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

end of thread, other threads:[~2020-07-07 13:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07  9:29 [PATCH] sunxi: Add support for using UART4 as console on A64 Nazım Gediz Aydındoğmuş
2020-07-07 13:35 ` Maxime Ripard
  -- strict thread matches above, loose matches on Subject: below --
2020-07-03  8:52 Nazım Gediz Aydındoğmuş
2020-06-29  9:09 Nazım Gediz Aydındoğmuş
2020-06-29 15:27 ` Maxime Ripard
2020-06-29 19:12   ` Nazım Gediz AYDINDOĞMUŞ
2020-07-02 17:43     ` Maxime Ripard

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.