Peripherals like I2C and SPI needs to be taken out of reset during
board init for functioning properly. Hence, add `hi6220_periph_reset`
function for doing the same. For instance without this function, I2C
will fail like below while booting linux:

[    0.608033] i2c_designware f7100000.i2c: Unknown Synopsys component type:
0x00000000
[    0.621378] i2c_designware f7101000.i2c: Unknown Synopsys component type:
0x00000000
[    0.633818] i2c_designware f7102000.i2c: Unknown Synopsys component type:
0x00000000

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasi...@linaro.org>
---
 board/hisilicon/hikey/hikey.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/board/hisilicon/hikey/hikey.c b/board/hisilicon/hikey/hikey.c
index 940ae82c45b..f8b8c372bfd 100644
--- a/board/hisilicon/hikey/hikey.c
+++ b/board/hisilicon/hikey/hikey.c
@@ -364,6 +364,20 @@ static void hi6220_pmussi_init(void)
        gpio_direction_output(0, 1);
 }
 
+static void hi6220_periph_reset(void)
+{
+       u32 data, bits;
+
+       /* Bring I2C0/I2C1/I2C2/SPI0 out of reset */
+       bits = PERI_RST3_I2C0 | PERI_RST3_I2C1 | PERI_RST3_I2C2 | PERI_RST3_SSP;
+       writel(bits, &peri_sc->rst3_dis);
+
+       /* Wait until the peripherals are out of reset */
+       do {
+               data = readl(&peri_sc->rst3_dis);
+       } while (data & bits);
+}
+
 int misc_init_r(void)
 {
        return 0;
@@ -371,6 +385,8 @@ int misc_init_r(void)
 
 int board_init(void)
 {
+       hi6220_periph_reset();
+
        return 0;
 }
 
-- 
2.17.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to