Skip to contentSkip to conversation

sunxi: Turn satapwr on from board_init

PATCH New Hans de Goede 2 participants 3 messages Mar 22, 2016 Arm/Allwinner sunXi SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 sunxi: Turn satapwr on from board_init

There are 2 reasons for doing this:

1) The main reason for doing this is to move it outside of board/sunxi/ahci.c, so that it can be used on boards which use a usb<->sata chip too;
2) While doing this I realized that doing it from board_init also meant doing it much earlier. Some printf get_timer(0) calls show that the time between board_init() and scsi_init() is more then 600 ms, so we can drop the mdelay(500)

While at it also drop the printf("SUNXI SCSI INIT\n") AHCI init is noisy enough by itself.

---
 board/sunxi/ahci.c  | 8 --------
 board/sunxi/board.c | 4 ++++
 2 files changed, 4 insertions(+), 8 deletions(-)
board/sunxi/ahci.c +0 -8
index 6d51b9b..522e54a 100644
@@ -72,14 +72,6 @@ static int sunxi_ahci_phy_init(u32 base)
 
 void scsi_init(void)
 {
-	printf("SUNXI SCSI INIT\n");
-#ifdef CONFIG_SATAPWR
-	gpio_request(CONFIG_SATAPWR, "satapwr");
-	gpio_direction_output(CONFIG_SATAPWR, 1);
-	/* Give attached sata device time to power-up to avoid link timeouts */
-	mdelay(500);
-#endif
-
 	if (sunxi_ahci_phy_init(SUNXI_SATA_BASE) < 0)
 		return;
 
board/sunxi/board.c +4 -0
index e16718f..2e2a1f5 100644
@@ -90,6 +90,10 @@ int board_init(void)
 	if (ret)
 		return ret;
 
+#ifdef CONFIG_SATAPWR
+	gpio_request(CONFIG_SATAPWR, "satapwr");
+	gpio_direction_output(CONFIG_SATAPWR, 1);
+#endif
 #ifdef CONFIG_MACPWR
 	gpio_request(CONFIG_MACPWR, "macpwr");
 	gpio_direction_output(CONFIG_MACPWR, 1);
Signature · 1 line
2.7.3
#1 lore raw

PATCH 2/2 sunxi: Specify SATAPWR pin for Orangepi Plus

This enables the use of the sata connector in u-boot.

---
 configs/orangepi_plus_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/orangepi_plus_defconfig +1 -0
index 08f291c..ff124bd 100644
@@ -17,3 +17,4 @@ CONFIG_CMD_GPIO=y
 CONFIG_SY8106A_POWER=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB1_VBUS_PIN="PG13"
+CONFIG_SYS_EXTRA_OPTIONS="SATAPWR=SUNXI_GPG(11)"
Signature · 1 line
2.7.3
#2 lore raw

PATCH 1/2 sunxi: Turn satapwr on from board_init

In reply to Hans de Goede
Quoted 12 lines · Hans de Goede

There are 2 reasons for doing this:

1) The main reason for doing this is to move it outside of ???board/sunxi/ahci.c, so that it can be used on boards which use ???a usb<->sata chip too;
2) While doing this I realized that doing it from board_init also meant
???doing it much earlier. Some printf get_timer(0) calls show that the
???time between board_init() and scsi_init() is more then 600 ms, ???so we can drop the mdelay(500)

Quoted 4 lines

While at it also drop the printf("SUNXI SCSI INIT\n") AHCI init is noisy enough by itself.

Both: Acked-by: Ian Campbell <[email protected]>