All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] board: atmel: sama5d2_icp: add periph reset in SPL hw init
@ 2019-05-08 12:58 Eugen.Hristev at microchip.com
  2019-05-08 12:58 ` [U-Boot] [PATCH 2/3] board: atmel: sama5d2_icp: standby disable on CAN transceivers in SPL Eugen.Hristev at microchip.com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eugen.Hristev at microchip.com @ 2019-05-08 12:58 UTC (permalink / raw)
  To: u-boot

From: Eugen Hristev <eugen.hristev@microchip.com>

Some periphs on the board need to be reset by holding their reset GPIO down
for a specific time period.
On a warm reset, the periphs are not being reset by any reset pin and may be
in a wrong state.
Reset them in the SPL to make sure we are booting into the correct state
machine of the specific board periphs (KSZ eth switch, USB hub, HSIC eth,
Ethercat)

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
 board/atmel/sama5d2_icp/sama5d2_icp.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/board/atmel/sama5d2_icp/sama5d2_icp.c b/board/atmel/sama5d2_icp/sama5d2_icp.c
index 807cfcd..1c28aab 100644
--- a/board/atmel/sama5d2_icp/sama5d2_icp.c
+++ b/board/atmel/sama5d2_icp/sama5d2_icp.c
@@ -73,6 +73,23 @@ int misc_init_r(void)
 /* SPL */
 #ifdef CONFIG_SPL_BUILD
 
+/* deassert reset lines for external periph in case of warm reboot */
+static void board_reset_additional_periph(void)
+{
+	atmel_pio4_set_pio_output(AT91_PIO_PORTB, 16, 0); /* LAN9252_RST */
+	atmel_pio4_set_pio_output(AT91_PIO_PORTC, 2, 0); /* HSIC_RST */
+	atmel_pio4_set_pio_output(AT91_PIO_PORTC, 17, 0); /* USB2534_RST */
+	atmel_pio4_set_pio_output(AT91_PIO_PORTD, 4, 0); /* KSZ8563_RST */
+}
+
+static void board_start_additional_periph(void)
+{
+	atmel_pio4_set_pio_output(AT91_PIO_PORTB, 16, 1); /* LAN9252_RST */
+	atmel_pio4_set_pio_output(AT91_PIO_PORTC, 2, 1); /* HSIC_RST */
+	atmel_pio4_set_pio_output(AT91_PIO_PORTC, 17, 1); /* USB2534_RST */
+	atmel_pio4_set_pio_output(AT91_PIO_PORTD, 4, 1); /* KSZ8563_RST */
+}
+
 #ifdef CONFIG_SD_BOOT
 void spl_mmc_init(void)
 {
@@ -93,12 +110,18 @@ void spl_board_init(void)
 #ifdef CONFIG_SD_BOOT
 	spl_mmc_init();
 #endif
+	board_reset_additional_periph();
 }
 
 void spl_display_print(void)
 {
 }
 
+void spl_board_prepare_for_boot(void)
+{
+	board_start_additional_periph();
+}
+
 static void ddrc_conf(struct atmel_mpddrc_config *ddrc)
 {
 	ddrc->md = (ATMEL_MPDDRC_MD_DBW_32_BITS | ATMEL_MPDDRC_MD_DDR3_SDRAM);
-- 
2.7.4

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

* [U-Boot] [PATCH 2/3] board: atmel: sama5d2_icp: standby disable on CAN transceivers in SPL
  2019-05-08 12:58 [U-Boot] [PATCH 1/3] board: atmel: sama5d2_icp: add periph reset in SPL hw init Eugen.Hristev at microchip.com
@ 2019-05-08 12:58 ` Eugen.Hristev at microchip.com
  2019-05-08 12:58 ` [U-Boot] [PATCH 3/3] board: atmel: sama5d2_icp: enable green led on SPL completion Eugen.Hristev at microchip.com
  2019-05-15  6:42 ` [U-Boot] [PATCH 1/3] board: atmel: sama5d2_icp: add periph reset in SPL hw init Eugen.Hristev at microchip.com
  2 siblings, 0 replies; 4+ messages in thread
From: Eugen.Hristev at microchip.com @ 2019-05-08 12:58 UTC (permalink / raw)
  To: u-boot

From: Eugen Hristev <eugen.hristev@microchip.com>

The 2 CAN transceivers have a STBDY pin which must be low in order to
operate.
This pin is tied to PB25.
Set it to 0 in bootstrap.
At a later time, this needs to be controlled by Linux power management
system, or requested by some driver as a gpio and tied to 0 during
CAN link up.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
 board/atmel/sama5d2_icp/sama5d2_icp.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/board/atmel/sama5d2_icp/sama5d2_icp.c b/board/atmel/sama5d2_icp/sama5d2_icp.c
index 1c28aab..f55ea2c 100644
--- a/board/atmel/sama5d2_icp/sama5d2_icp.c
+++ b/board/atmel/sama5d2_icp/sama5d2_icp.c
@@ -73,6 +73,12 @@ int misc_init_r(void)
 /* SPL */
 #ifdef CONFIG_SPL_BUILD
 
+/* must set PB25 low to enable the CAN transceivers */
+static void board_can_stdby_dis(void)
+{
+	atmel_pio4_set_pio_output(AT91_PIO_PORTB, 25, 0);
+}
+
 /* deassert reset lines for external periph in case of warm reboot */
 static void board_reset_additional_periph(void)
 {
@@ -111,6 +117,7 @@ void spl_board_init(void)
 	spl_mmc_init();
 #endif
 	board_reset_additional_periph();
+	board_can_stdby_dis();
 }
 
 void spl_display_print(void)
-- 
2.7.4

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

* [U-Boot] [PATCH 3/3] board: atmel: sama5d2_icp: enable green led on SPL completion
  2019-05-08 12:58 [U-Boot] [PATCH 1/3] board: atmel: sama5d2_icp: add periph reset in SPL hw init Eugen.Hristev at microchip.com
  2019-05-08 12:58 ` [U-Boot] [PATCH 2/3] board: atmel: sama5d2_icp: standby disable on CAN transceivers in SPL Eugen.Hristev at microchip.com
@ 2019-05-08 12:58 ` Eugen.Hristev at microchip.com
  2019-05-15  6:42 ` [U-Boot] [PATCH 1/3] board: atmel: sama5d2_icp: add periph reset in SPL hw init Eugen.Hristev at microchip.com
  2 siblings, 0 replies; 4+ messages in thread
From: Eugen.Hristev at microchip.com @ 2019-05-08 12:58 UTC (permalink / raw)
  To: u-boot

From: Eugen Hristev <eugen.hristev@microchip.com>

Enable the green led on SPL completion.
Red led has no pulldown and it will be lighted by default when the
board starts up.
If the PMIC is not configured to enable LDO2, the leds will not light.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
 board/atmel/sama5d2_icp/sama5d2_icp.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/board/atmel/sama5d2_icp/sama5d2_icp.c b/board/atmel/sama5d2_icp/sama5d2_icp.c
index f55ea2c..1593e2b 100644
--- a/board/atmel/sama5d2_icp/sama5d2_icp.c
+++ b/board/atmel/sama5d2_icp/sama5d2_icp.c
@@ -79,6 +79,13 @@ static void board_can_stdby_dis(void)
 	atmel_pio4_set_pio_output(AT91_PIO_PORTB, 25, 0);
 }
 
+static void board_leds_init(void)
+{
+	atmel_pio4_set_pio_output(AT91_PIO_PORTB, 0, 0); /* RED */
+	atmel_pio4_set_pio_output(AT91_PIO_PORTB, 1, 1); /* GREEN */
+	atmel_pio4_set_pio_output(AT91_PIO_PORTA, 31, 0); /* BLUE */
+}
+
 /* deassert reset lines for external periph in case of warm reboot */
 static void board_reset_additional_periph(void)
 {
@@ -118,6 +125,7 @@ void spl_board_init(void)
 #endif
 	board_reset_additional_periph();
 	board_can_stdby_dis();
+	board_leds_init();
 }
 
 void spl_display_print(void)
-- 
2.7.4

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

* [U-Boot] [PATCH 1/3] board: atmel: sama5d2_icp: add periph reset in SPL hw init
  2019-05-08 12:58 [U-Boot] [PATCH 1/3] board: atmel: sama5d2_icp: add periph reset in SPL hw init Eugen.Hristev at microchip.com
  2019-05-08 12:58 ` [U-Boot] [PATCH 2/3] board: atmel: sama5d2_icp: standby disable on CAN transceivers in SPL Eugen.Hristev at microchip.com
  2019-05-08 12:58 ` [U-Boot] [PATCH 3/3] board: atmel: sama5d2_icp: enable green led on SPL completion Eugen.Hristev at microchip.com
@ 2019-05-15  6:42 ` Eugen.Hristev at microchip.com
  2 siblings, 0 replies; 4+ messages in thread
From: Eugen.Hristev at microchip.com @ 2019-05-15  6:42 UTC (permalink / raw)
  To: u-boot



On 08.05.2019 15:58, Eugen Hristev - M18282 wrote:
> From: Eugen Hristev <eugen.hristev@microchip.com>
> 
> Some periphs on the board need to be reset by holding their reset GPIO down
> for a specific time period.
> On a warm reset, the periphs are not being reset by any reset pin and may be
> in a wrong state.
> Reset them in the SPL to make sure we are booting into the correct state
> machine of the specific board periphs (KSZ eth switch, USB hub, HSIC eth,
> Ethercat)
> 
> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
> ---

Applied all 3 patches to u-boot-atmel/master

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

end of thread, other threads:[~2019-05-15  6:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-08 12:58 [U-Boot] [PATCH 1/3] board: atmel: sama5d2_icp: add periph reset in SPL hw init Eugen.Hristev at microchip.com
2019-05-08 12:58 ` [U-Boot] [PATCH 2/3] board: atmel: sama5d2_icp: standby disable on CAN transceivers in SPL Eugen.Hristev at microchip.com
2019-05-08 12:58 ` [U-Boot] [PATCH 3/3] board: atmel: sama5d2_icp: enable green led on SPL completion Eugen.Hristev at microchip.com
2019-05-15  6:42 ` [U-Boot] [PATCH 1/3] board: atmel: sama5d2_icp: add periph reset in SPL hw init Eugen.Hristev at microchip.com

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.