Skip to contentSkip to conversation

rockchip: Add basic support for phyCORE-RK3288 SoM based carrier board

PATCH New Wadim Egorov 2 participants 8 messages May 15, 2017 – Jun 6, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 rockchip: Add basic support for phyCORE-RK3288 SoM based carrier board

The phyCORE-RK3288 is a SoM (System on Module) containing a RK3288 SoC. The module can be connected to different carrier boards.
It can be also equipped with different RAM, SPI flash and eMMC variants. The Rapid Development Kit option is using the following setup:

- 1 GB DDR3 RAM (2 Banks)
- 1x 4 KB EEPROM
- DP83867 Gigabit Ethernet PHY
- 16 MB SPI Flash
- 4 GB eMMC Flash

Add basic support for the PCM-947 carrier board, a RK3288 based development board made by PHYTEC. This board works in a combination with the phyCORE-RK3288 System on Module.

---
Changes in v2:
- Move phycore initialization to an own function
- Use of_machine_is_compatible() instead of #ifdef
- Drop board_boot_order() and use spl_boot_device()
- Added Reviewed-by: Simon Glass <[email protected]>

---
 arch/arm/dts/Makefile                        |   1 +
 arch/arm/dts/rk3288-phycore-rdk.dts          | 294 ++++++++++++++++
 arch/arm/dts/rk3288-phycore-som.dtsi         | 503 +++++++++++++++++++++++++++
 arch/arm/mach-rockchip/rk3288-board-spl.c    |  37 ++
 arch/arm/mach-rockchip/rk3288/Kconfig        |  10 +
 board/phytec/phycore_rk3288/Kconfig          |  15 +
 board/phytec/phycore_rk3288/MAINTAINERS      |   6 +
 board/phytec/phycore_rk3288/Makefile         |   8 +
 board/phytec/phycore_rk3288/phycore-rk3288.c |   8 +
 configs/phycore-rk3288_defconfig             |  69 ++++
 include/configs/phycore_rk3288.h             |  23 ++
 11 files changed, 974 insertions(+)
 create mode 100644 arch/arm/dts/rk3288-phycore-rdk.dts
 create mode 100644 arch/arm/dts/rk3288-phycore-som.dtsi
 create mode 100644 board/phytec/phycore_rk3288/Kconfig
 create mode 100644 board/phytec/phycore_rk3288/MAINTAINERS
 create mode 100644 board/phytec/phycore_rk3288/Makefile
 create mode 100644 board/phytec/phycore_rk3288/phycore-rk3288.c
 create mode 100644 configs/phycore-rk3288_defconfig
 create mode 100644 include/configs/phycore_rk3288.h
arch/arm/dts/Makefile +1 -0
index f3f53f3..51d68d1 100644
@@ -34,6 +34,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \
 	rk3288-fennec.dtb \
 	rk3288-firefly.dtb \
 	rk3288-miqi.dtb \
+	rk3288-phycore-rdk.dtb \
 	rk3288-popmetal.dtb \
 	rk3288-rock2-square.dtb \
 	rk3288-tinker.dtb \
arch/arm/dts/rk3288-phycore-rdk.dts new file +294 -0

294 lines not on this page · raw message

arch/arm/dts/rk3288-phycore-som.dtsi new file +503 -0

503 lines not on this page · raw message

arch/arm/mach-rockchip/rk3288-board-spl.c +37 -0
index 74f3379..724dcb4 100644
@@ -8,6 +8,7 @@
 #include <debug_uart.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <i2c.h>
 #include <led.h>
 #include <malloc.h>
 #include <ram.h>
@@ -25,6 +26,7 @@
 #include <dm/test.h>
 #include <dm/util.h>
 #include <power/regulator.h>
+#include <power/rk8xx_pmic.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -157,6 +159,38 @@ static int configure_emmc(struct udevice *pinctrl)
 }
 #endif
 
+void phycore_init(void)
+{
+	struct udevice *dev;
+	uint reg;
+	int ret;
+
+	ret = uclass_get_device(UCLASS_I2C, 0, &dev);
+	if (ret) {
+		debug("I2C init failed: %d\n", ret);
+		return;
+	}
+
+	ret = i2c_get_chip(dev, 0x1c, 1, &dev);
+	if (ret) {
+		debug("Cannot find RK818: %d\n", ret);
+		return;
+	}
+
+	reg = dm_i2c_reg_read(dev, REG_USB_CTRL);
+
+	/*
+	 * Increase USB input current selection to 2A and close charger
+	 * when usb lower then 3.4V.
+	 */
+	reg |= 0x77;
+	ret = dm_i2c_reg_write(dev, REG_USB_CTRL, reg);
+	if (ret) {
+		debug("Unable to set RK818 REG_USB_CTRL: %d\n", ret);
+		return;
+	}
+}
+
 void board_init_f(ulong dummy)
 {
 	struct udevice *pinctrl;
@@ -206,6 +240,9 @@ void board_init_f(ulong dummy)
 		return;
 	}
 
+	if (of_machine_is_compatible("phytec,rk3288-phycore-som"))
+		phycore_init();
+
 	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
 	if (ret) {
 		debug("DRAM init failed: %d\n", ret);
arch/arm/mach-rockchip/rk3288/Kconfig +10 -0
index 8e7355e..53cc9a0 100644
@@ -66,6 +66,14 @@ config TARGET_MIQI_RK3288
 	  has 1 or 2 GiB SDRAM. Expansion connectors provide access to
 	  I2C, SPI, UART, GPIOs and fan control.
 
+config TARGET_PHYCORE_RK3288
+	bool "phyCORE-RK3288"
+        select BOARD_LATE_INIT
+	help
+	  Add basic support for the PCM-947 carrier board, a RK3288 based
+	  development board made by PHYTEC. This board works in a combination
+	  with the phyCORE-RK3288 System on Module.
+
 config TARGET_POPMETAL_RK3288
 	bool "PopMetal-RK3288"
 	select BOARD_LATE_INIT
@@ -129,6 +137,8 @@ source "board/google/veyron/Kconfig"
 
 source "board/mqmaker/miqi_rk3288/Kconfig"
 
+source "board/phytec/phycore_rk3288/Kconfig"
+
 source "board/radxa/rock2/Kconfig"
 
 source "board/rockchip/evb_rk3288/Kconfig"
board/phytec/phycore_rk3288/Kconfig new file +15 -0
new file mode 100644
index 0000000..57cd8e2
@@ -0,0 +1,15 @@
+if TARGET_PHYCORE_RK3288
+
+config SYS_BOARD
+	default "phycore_rk3288"
+
+config SYS_VENDOR
+	default "phytec"
+
+config SYS_CONFIG_NAME
+	default "phycore_rk3288"
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+	def_bool y
+
+endif
board/phytec/phycore_rk3288/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000..9c0de3c
@@ -0,0 +1,6 @@
+phyCORE-RK3288
+M:	Wadim Egorov <[email protected]>
+S:	Maintained
+F:	board/phytec/phycore_rk3288
+F:	include/configs/phycore_rk3288.h
+F:	configs/phycore-rk3288_defconfig
board/phytec/phycore_rk3288/Makefile new file +8 -0
new file mode 100644
index 0000000..f379fbe
@@ -0,0 +1,8 @@
+#
+# Copyright (C) 2017 PHYTEC Messtechnik GmbH
+# Author: Wadim Egorov <[email protected]>
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+obj-y += phycore-rk3288.o
board/phytec/phycore_rk3288/phycore-rk3288.c new file +8 -0
new file mode 100644
index 0000000..20696f6
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2017 PHYTEC Messtechnik GmbH
+ * Author: Wadim Egorov <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <common.h>
configs/phycore-rk3288_defconfig new file +69 -0

69 lines not on this page · raw message

include/configs/phycore_rk3288.h new file +23 -0
new file mode 100644
index 0000000..aab43ed
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2017 PHYTEC Messtechnik GmbH
+ * Author: Wadim Egorov <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define ROCKCHIP_DEVICE_SETTINGS
+#include <configs/rk3288_common.h>
+
+#undef BOOT_TARGET_DEVICES
+
+#define BOOT_TARGET_DEVICES(func) \
+	func(MMC, mmc, 0) \
+	func(MMC, mmc, 1)
+
+#define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_SYS_MMC_ENV_DEV 1
+
+#endif
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 2/2 doc: rockchip: Add phyCORE-RK3288 RDK to board list

---
 doc/README.rockchip | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
doc/README.rockchip +2 -1
index 2d8cf9f..dbeb8be 100644
@@ -36,13 +36,14 @@ You will need:
 Building
 ========
 
-At present eight RK3288 boards are supported:
+At present nine RK3288 boards are supported:
 
    - EVB RK3288 - use evb-rk3288 configuration
    - Fennec RK3288 - use fennec-rk3288 configuration
    - Firefly RK3288 - use firefly-rk3288 configuration
    - Hisense Chromebook - use chromebook_jerry configuration
    - MiQi RK3288 - use miqi-rk3288 configuration
+   - phyCORE-RK3288 RDK - use phycore-rk3288 configuration
    - PopMetal RK3288 - use popmetal-rk3288 configuration
    - Radxa Rock 2 - use rock2 configuration
    - Tinker RK3288 - use tinker-rk3288 configuration
Signature · 1 line
1.9.1
#3 lore raw

PATCH v2 1/2 rockchip: Add basic support for phyCORE-RK3288 SoM based carrier board

In reply to Wadim Egorov

Hi Wadim,

Quoted 37 lines · Wadim Egorov

The phyCORE-RK3288 is a SoM (System on Module) containing a RK3288 SoC. The module can be connected to different carrier boards.
It can be also equipped with different RAM, SPI flash and eMMC variants. The Rapid Development Kit option is using the following setup:

- 1 GB DDR3 RAM (2 Banks)
- 1x 4 KB EEPROM
- DP83867 Gigabit Ethernet PHY
- 16 MB SPI Flash
- 4 GB eMMC Flash

Add basic support for the PCM-947 carrier board, a RK3288 based development board made by PHYTEC. This board works in a combination with the phyCORE-RK3288 System on Module.

---
Changes in v2:
- Move phycore initialization to an own function
- Use of_machine_is_compatible() instead of #ifdef
- Drop board_boot_order() and use spl_boot_device()
- Added Reviewed-by: Simon Glass <[email protected]>

---
 arch/arm/dts/Makefile                        |   1 +
 arch/arm/dts/rk3288-phycore-rdk.dts          | 294 ++++++++++++++++
 arch/arm/dts/rk3288-phycore-som.dtsi         | 503 +++++++++++++++++++++++++++
 arch/arm/mach-rockchip/rk3288-board-spl.c    |  37 ++
 arch/arm/mach-rockchip/rk3288/Kconfig        |  10 +
 board/phytec/phycore_rk3288/Kconfig          |  15 +
 board/phytec/phycore_rk3288/MAINTAINERS      |   6 +
 board/phytec/phycore_rk3288/Makefile         |   8 +
 board/phytec/phycore_rk3288/phycore-rk3288.c |   8 +
 configs/phycore-rk3288_defconfig             |  69 ++++
 include/configs/phycore_rk3288.h             |  23 ++
 11 files changed, 974 insertions(+)
Quoted 8 lines
 create mode 100644 arch/arm/dts/rk3288-phycore-rdk.dts
 create mode 100644 arch/arm/dts/rk3288-phycore-som.dtsi
 create mode 100644 board/phytec/phycore_rk3288/Kconfig
 create mode 100644 board/phytec/phycore_rk3288/MAINTAINERS
 create mode 100644 board/phytec/phycore_rk3288/Makefile
 create mode 100644 board/phytec/phycore_rk3288/phycore-rk3288.c
 create mode 100644 configs/phycore-rk3288_defconfig
 create mode 100644 include/configs/phycore_rk3288.h

This unfortunately causes build errors on various rockchip boards.

Try 'buildman rockchip' to see it.

Please see below.

[...]

Quoted 27 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +5 -0
index 74f3379..724dcb4 100644
@@ -8,6 +8,7 @@
 #include <debug_uart.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <i2c.h>
 #include <led.h>
 #include <malloc.h>
 #include <ram.h>
@@ -25,6 +26,7 @@
 #include <dm/test.h>
 #include <dm/util.h>
 #include <power/regulator.h>
+#include <power/rk8xx_pmic.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -157,6 +159,38 @@ static int configure_emmc(struct udevice *pinctrl)
 }
 #endif
 
+void phycore_init(void)
+{
+       struct udevice *dev;

arch/arm/mach-rockchip/rk3288-board-spl.c static int configure_emmc(struct udevice *pinctrl) · line 174

Quoted 10 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +10 -0
+       uint reg;
+       int ret;
+
+       ret = uclass_get_device(UCLASS_I2C, 0, &dev);
+       if (ret) {
+               debug("I2C init failed: %d\n", ret);
+               return;
+       }
+
+       ret = i2c_get_chip(dev, 0x1c, 1, &dev);

We should not be hard-coding the bus address here.

See veyron_init() for an example of another way to do this.

arch/arm/mach-rockchip/rk3288-board-spl.c static int configure_emmc(struct udevice *pinctrl) · line 187

Quoted 13 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +13 -0
+       if (ret) {
+               debug("Cannot find RK818: %d\n", ret);
+               return;
+       }
+
+       reg = dm_i2c_reg_read(dev, REG_USB_CTRL);
+
+       /*
+        * Increase USB input current selection to 2A and close charger
+        * when usb lower then 3.4V.
+        */
+       reg |= 0x77;
+       ret = dm_i2c_reg_write(dev, REG_USB_CTRL, reg);

Here you are hacking registers in the PMIC. This should go in the PMIC driver. See rk8xx_spl_configure_buck() for how to do this in SPL without bringing in the whole regulator framework.

arch/arm/mach-rockchip/rk3288-board-spl.c static int configure_emmc(struct udevice *pinctrl) · line 193

Quoted 6 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +6 -0
+       if (ret) {
+               debug("Unable to set RK818 REG_USB_CTRL: %d\n", ret);
+               return;
+       }
+}
+

Regards,
Simon

#4 lore raw

PATCH v2 1/2 rockchip: Add basic support for phyCORE-RK3288 SoM based carrier board

Hello Simon,

Am 24.05.2017 um 02:44 schrieb Simon Glass:

Quoted 48 lines

Hi Wadim,

Quoted 37 lines · Wadim Egorov

The phyCORE-RK3288 is a SoM (System on Module) containing a RK3288 SoC. The module can be connected to different carrier boards.
It can be also equipped with different RAM, SPI flash and eMMC variants. The Rapid Development Kit option is using the following setup:

- 1 GB DDR3 RAM (2 Banks)
- 1x 4 KB EEPROM
- DP83867 Gigabit Ethernet PHY
- 16 MB SPI Flash
- 4 GB eMMC Flash

Add basic support for the PCM-947 carrier board, a RK3288 based development board made by PHYTEC. This board works in a combination with the phyCORE-RK3288 System on Module.

---
Changes in v2:
- Move phycore initialization to an own function
- Use of_machine_is_compatible() instead of #ifdef
- Drop board_boot_order() and use spl_boot_device()
- Added Reviewed-by: Simon Glass <[email protected]>

---
 arch/arm/dts/Makefile                        |   1 +
 arch/arm/dts/rk3288-phycore-rdk.dts          | 294 ++++++++++++++++
 arch/arm/dts/rk3288-phycore-som.dtsi         | 503 +++++++++++++++++++++++++++
 arch/arm/mach-rockchip/rk3288-board-spl.c    |  37 ++
 arch/arm/mach-rockchip/rk3288/Kconfig        |  10 +
 board/phytec/phycore_rk3288/Kconfig          |  15 +
 board/phytec/phycore_rk3288/MAINTAINERS      |   6 +
 board/phytec/phycore_rk3288/Makefile         |   8 +
 board/phytec/phycore_rk3288/phycore-rk3288.c |   8 +
 configs/phycore-rk3288_defconfig             |  69 ++++
 include/configs/phycore_rk3288.h             |  23 ++
 11 files changed, 974 insertions(+)
Quoted 8 lines
 create mode 100644 arch/arm/dts/rk3288-phycore-rdk.dts
 create mode 100644 arch/arm/dts/rk3288-phycore-som.dtsi
 create mode 100644 board/phytec/phycore_rk3288/Kconfig
 create mode 100644 board/phytec/phycore_rk3288/MAINTAINERS
 create mode 100644 board/phytec/phycore_rk3288/Makefile
 create mode 100644 board/phytec/phycore_rk3288/phycore-rk3288.c
 create mode 100644 configs/phycore-rk3288_defconfig
 create mode 100644 include/configs/phycore_rk3288.h
Quoted 1 line

This unfortunately causes build errors on various rockchip boards.

This seems to be a problem because I am using of_machine_is_compatible(). I think we will need a CONFIG_TARGET_PHYCORE_RK3288 guard there.

Quoted 48 lines

Try 'buildman rockchip' to see it.

Please see below.

[...]

Quoted 27 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +5 -0
index 74f3379..724dcb4 100644
@@ -8,6 +8,7 @@
 #include <debug_uart.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <i2c.h>
 #include <led.h>
 #include <malloc.h>
 #include <ram.h>
@@ -25,6 +26,7 @@
 #include <dm/test.h>
 #include <dm/util.h>
 #include <power/regulator.h>
+#include <power/rk8xx_pmic.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -157,6 +159,38 @@ static int configure_emmc(struct udevice *pinctrl)
 }
 #endif
 
+void phycore_init(void)
+{
+       struct udevice *dev;

arch/arm/mach-rockchip/rk3288-board-spl.c static int configure_emmc(struct udevice *pinctrl) · line 174

Quoted 10 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +10 -0
+       uint reg;
+       int ret;
+
+       ret = uclass_get_device(UCLASS_I2C, 0, &dev);
+       if (ret) {
+               debug("I2C init failed: %d\n", ret);
+               return;
+       }
+
+       ret = i2c_get_chip(dev, 0x1c, 1, &dev);

We should not be hard-coding the bus address here.

See veyron_init() for an example of another way to do this.

Quoted 16 lines

arch/arm/mach-rockchip/rk3288-board-spl.c static int configure_emmc(struct udevice *pinctrl) · line 187

Quoted 13 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +13 -0
+       if (ret) {
+               debug("Cannot find RK818: %d\n", ret);
+               return;
+       }
+
+       reg = dm_i2c_reg_read(dev, REG_USB_CTRL);
+
+       /*
+        * Increase USB input current selection to 2A and close charger
+        * when usb lower then 3.4V.
+        */
+       reg |= 0x77;
+       ret = dm_i2c_reg_write(dev, REG_USB_CTRL, reg);

Here you are hacking registers in the PMIC. This should go in the PMIC driver. See rk8xx_spl_configure_buck() for how to do this in SPL without bringing in the whole regulator framework.

For this I have to enable CONFIG_SPL_POWER_SUPPORT to get the pmic part compiled.
Unfortunately, I am not able to boot my board with POWER_SUPPORT enabled, because the dm_init_and_scan() function which is called from spl_early_init() is failing.
Do you have any hints on what the problem could be?

Regards,
Wadim

Quoted 9 lines

arch/arm/mach-rockchip/rk3288-board-spl.c static int configure_emmc(struct udevice *pinctrl) · line 193

Quoted 7 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +6 -0
+       if (ret) {
+               debug("Unable to set RK818 REG_USB_CTRL: %d\n", ret);
+               return;
+       }
+}
+

Regards,
Simon

#5 lore raw

PATCH v2 1/2 rockchip: Add basic support for phyCORE-RK3288 SoM based carrier board

Quoted 52 lines · Wadim Egorov

Hello Simon,

Am 24.05.2017 um 02:44 schrieb Simon Glass:

Quoted 48 lines

Hi Wadim,

Quoted 45 lines · Wadim Egorov

The phyCORE-RK3288 is a SoM (System on Module) containing a RK3288 SoC. The module can be connected to different carrier boards.
It can be also equipped with different RAM, SPI flash and eMMC variants. The Rapid Development Kit option is using the following setup:

- 1 GB DDR3 RAM (2 Banks)
- 1x 4 KB EEPROM
- DP83867 Gigabit Ethernet PHY
- 16 MB SPI Flash
- 4 GB eMMC Flash

Add basic support for the PCM-947 carrier board, a RK3288 based development board made by PHYTEC. This board works in a combination with the phyCORE-RK3288 System on Module.

---
Changes in v2:
- Move phycore initialization to an own function
- Use of_machine_is_compatible() instead of #ifdef
- Drop board_boot_order() and use spl_boot_device()
- Added Reviewed-by: Simon Glass <[email protected]>

---
 arch/arm/dts/Makefile                        |   1 +
 arch/arm/dts/rk3288-phycore-rdk.dts          | 294 ++++++++++++++++
 arch/arm/dts/rk3288-phycore-som.dtsi         | 503 +++++++++++++++++++++++++++
 arch/arm/mach-rockchip/rk3288-board-spl.c    |  37 ++
 arch/arm/mach-rockchip/rk3288/Kconfig        |  10 +
 board/phytec/phycore_rk3288/Kconfig          |  15 +
 board/phytec/phycore_rk3288/MAINTAINERS      |   6 +
 board/phytec/phycore_rk3288/Makefile         |   8 +
 board/phytec/phycore_rk3288/phycore-rk3288.c |   8 +
 configs/phycore-rk3288_defconfig             |  69 ++++
 include/configs/phycore_rk3288.h             |  23 ++
 11 files changed, 974 insertions(+)
 create mode 100644 arch/arm/dts/rk3288-phycore-rdk.dts
 create mode 100644 arch/arm/dts/rk3288-phycore-som.dtsi
 create mode 100644 board/phytec/phycore_rk3288/Kconfig
 create mode 100644 board/phytec/phycore_rk3288/MAINTAINERS
 create mode 100644 board/phytec/phycore_rk3288/Makefile
 create mode 100644 board/phytec/phycore_rk3288/phycore-rk3288.c
 create mode 100644 configs/phycore-rk3288_defconfig
 create mode 100644 include/configs/phycore_rk3288.h
Quoted 4 lines
Quoted 1 line

This unfortunately causes build errors on various rockchip boards.

This seems to be a problem because I am using of_machine_is_compatible(). I think we will need a CONFIG_TARGET_PHYCORE_RK3288 guard there.

You mean that it does not work? You should be able to call that function.

Quoted 66 lines
Quoted 49 lines

Try 'buildman rockchip' to see it.

Please see below.

[...]

Quoted 27 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +5 -0
index 74f3379..724dcb4 100644
@@ -8,6 +8,7 @@
 #include <debug_uart.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <i2c.h>
 #include <led.h>
 #include <malloc.h>
 #include <ram.h>
@@ -25,6 +26,7 @@
 #include <dm/test.h>
 #include <dm/util.h>
 #include <power/regulator.h>
+#include <power/rk8xx_pmic.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -157,6 +159,38 @@ static int configure_emmc(struct udevice *pinctrl)
 }
 #endif
 
+void phycore_init(void)
+{
+       struct udevice *dev;

arch/arm/mach-rockchip/rk3288-board-spl.c static int configure_emmc(struct udevice *pinctrl) · line 174

Quoted 10 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +10 -0
+       uint reg;
+       int ret;
+
+       ret = uclass_get_device(UCLASS_I2C, 0, &dev);
+       if (ret) {
+               debug("I2C init failed: %d\n", ret);
+               return;
+       }
+
+       ret = i2c_get_chip(dev, 0x1c, 1, &dev);

We should not be hard-coding the bus address here.

See veyron_init() for an example of another way to do this.

Quoted 16 lines

arch/arm/mach-rockchip/rk3288-board-spl.c static int configure_emmc(struct udevice *pinctrl) · line 187

Quoted 13 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +13 -0
+       if (ret) {
+               debug("Cannot find RK818: %d\n", ret);
+               return;
+       }
+
+       reg = dm_i2c_reg_read(dev, REG_USB_CTRL);
+
+       /*
+        * Increase USB input current selection to 2A and close charger
+        * when usb lower then 3.4V.
+        */
+       reg |= 0x77;
+       ret = dm_i2c_reg_write(dev, REG_USB_CTRL, reg);

Here you are hacking registers in the PMIC. This should go in the PMIC driver. See rk8xx_spl_configure_buck() for how to do this in SPL without bringing in the whole regulator framework.

Quoted 6 lines

For this I have to enable CONFIG_SPL_POWER_SUPPORT to get the pmic part compiled.
Unfortunately, I am not able to boot my board with POWER_SUPPORT enabled, because the dm_init_and_scan() function which is called from spl_early_init() is failing.
Do you have any hints on what the problem could be?

Do you know what the error is? Also you could put #define DEBUG in lists.c pehaps?

Quoted 14 lines

Regards,
Wadim

Quoted 9 lines

arch/arm/mach-rockchip/rk3288-board-spl.c static int configure_emmc(struct udevice *pinctrl) · line 193

Quoted 7 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +6 -0
+       if (ret) {
+               debug("Unable to set RK818 REG_USB_CTRL: %d\n", ret);
+               return;
+       }
+}
+

Regards,
Simon

Regards,
Simon

#6 lore raw

PATCH v2 1/2 rockchip: Add basic support for phyCORE-RK3288 SoM based carrier board

Hi Simon,

Am 01.06.2017 um 05:11 schrieb Simon Glass:

Quoted 53 lines · Wadim Egorov
Quoted 52 lines

Hello Simon,

Am 24.05.2017 um 02:44 schrieb Simon Glass:

Quoted 48 lines

Hi Wadim,

Quoted 45 lines · Wadim Egorov

The phyCORE-RK3288 is a SoM (System on Module) containing a RK3288 SoC. The module can be connected to different carrier boards.
It can be also equipped with different RAM, SPI flash and eMMC variants. The Rapid Development Kit option is using the following setup:

- 1 GB DDR3 RAM (2 Banks)
- 1x 4 KB EEPROM
- DP83867 Gigabit Ethernet PHY
- 16 MB SPI Flash
- 4 GB eMMC Flash

Add basic support for the PCM-947 carrier board, a RK3288 based development board made by PHYTEC. This board works in a combination with the phyCORE-RK3288 System on Module.

---
Changes in v2:
- Move phycore initialization to an own function
- Use of_machine_is_compatible() instead of #ifdef
- Drop board_boot_order() and use spl_boot_device()
- Added Reviewed-by: Simon Glass <[email protected]>

---
 arch/arm/dts/Makefile                        |   1 +
 arch/arm/dts/rk3288-phycore-rdk.dts          | 294 ++++++++++++++++
 arch/arm/dts/rk3288-phycore-som.dtsi         | 503 +++++++++++++++++++++++++++
 arch/arm/mach-rockchip/rk3288-board-spl.c    |  37 ++
 arch/arm/mach-rockchip/rk3288/Kconfig        |  10 +
 board/phytec/phycore_rk3288/Kconfig          |  15 +
 board/phytec/phycore_rk3288/MAINTAINERS      |   6 +
 board/phytec/phycore_rk3288/Makefile         |   8 +
 board/phytec/phycore_rk3288/phycore-rk3288.c |   8 +
 configs/phycore-rk3288_defconfig             |  69 ++++
 include/configs/phycore_rk3288.h             |  23 ++
 11 files changed, 974 insertions(+)
 create mode 100644 arch/arm/dts/rk3288-phycore-rdk.dts
 create mode 100644 arch/arm/dts/rk3288-phycore-som.dtsi
 create mode 100644 board/phytec/phycore_rk3288/Kconfig
 create mode 100644 board/phytec/phycore_rk3288/MAINTAINERS
 create mode 100644 board/phytec/phycore_rk3288/Makefile
 create mode 100644 board/phytec/phycore_rk3288/phycore-rk3288.c
 create mode 100644 configs/phycore-rk3288_defconfig
 create mode 100644 include/configs/phycore_rk3288.h
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

This unfortunately causes build errors on various rockchip boards.

This seems to be a problem because I am using of_machine_is_compatible(). I think we will need a CONFIG_TARGET_PHYCORE_RK3288 guard there.

You mean that it does not work? You should be able to call that function.

When I build, for example the chromebook_jerry_defconfig, I get the following error:

drivers/built-in.o: In function `of_machine_is_compatible':
u-boot/chromebook/../drivers/core/device.c:845: undefined reference to `fdt_node_check_compatible'

It works with the phycore-rk3288_defconfig and fails with other rockchip configs.
This is why I wanted to use CONFIG_TARGET_PHYCORE_RK3288 in the first place.

Quoted 64 lines
Quoted 64 lines
Quoted 64 lines

Try 'buildman rockchip' to see it.

Please see below.

[...]

Quoted 27 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +5 -0
index 74f3379..724dcb4 100644
@@ -8,6 +8,7 @@
 #include <debug_uart.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <i2c.h>
 #include <led.h>
 #include <malloc.h>
 #include <ram.h>
@@ -25,6 +26,7 @@
 #include <dm/test.h>
 #include <dm/util.h>
 #include <power/regulator.h>
+#include <power/rk8xx_pmic.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -157,6 +159,38 @@ static int configure_emmc(struct udevice *pinctrl)
 }
 #endif
 
+void phycore_init(void)
+{
+       struct udevice *dev;

arch/arm/mach-rockchip/rk3288-board-spl.c static int configure_emmc(struct udevice *pinctrl) · line 174

Quoted 10 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +10 -0
+       uint reg;
+       int ret;
+
+       ret = uclass_get_device(UCLASS_I2C, 0, &dev);
+       if (ret) {
+               debug("I2C init failed: %d\n", ret);
+               return;
+       }
+
+       ret = i2c_get_chip(dev, 0x1c, 1, &dev);

We should not be hard-coding the bus address here.

See veyron_init() for an example of another way to do this.

arch/arm/mach-rockchip/rk3288-board-spl.c static int configure_emmc(struct udevice *pinctrl) · line 187

Quoted 13 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +13 -0
+       if (ret) {
+               debug("Cannot find RK818: %d\n", ret);
+               return;
+       }
+
+       reg = dm_i2c_reg_read(dev, REG_USB_CTRL);
+
+       /*
+        * Increase USB input current selection to 2A and close charger
+        * when usb lower then 3.4V.
+        */
+       reg |= 0x77;
+       ret = dm_i2c_reg_write(dev, REG_USB_CTRL, reg);

Here you are hacking registers in the PMIC. This should go in the PMIC driver. See rk8xx_spl_configure_buck() for how to do this in SPL without bringing in the whole regulator framework.

Quoted 8 lines
Quoted 6 lines

For this I have to enable CONFIG_SPL_POWER_SUPPORT to get the pmic part compiled.
Unfortunately, I am not able to boot my board with POWER_SUPPORT enabled, because the dm_init_and_scan() function which is called from spl_early_init() is failing.
Do you have any hints on what the problem could be?

Do you know what the error is? Also you could put #define DEBUG in lists.c pehaps?

With CONFIG_SPL_POWER_SUPPORT=y enabled the device_bind_common() function is failing for
the I2C (fail_uclass_post_bind) and PMIC (fail_bind) device. See the output below:

[...]
bind node dmc at ff610000
- attempt to match compatible string 'rockchip,rk3288-dmc'
- found match at 'rockchip_rk3288_dmc'
Bound device dmc at ff610000 to root_driver
bind node i2c at ff650000
- attempt to match compatible string 'rockchip,rk3288-i2c'
- found match at 'i2c_rockchip'
bind node pmic at 1c
- attempt to match compatible string 'rockchip,rk818'
- found match at 'rk8xx pmic'
bind node power-management at ff730000
- attempt to match compatible string 'rockchip,rk3288-pmu'
- found match at 'rk3288_syscon'
Bound device power-management at ff730000 to root_driver [...]
bind node config
Device 'config' has no compatible string
### ERROR ### Please RESET the board ###

Regards,
Wadim

Quoted 14 lines
Quoted 12 lines

Regards,
Wadim

Quoted 8 lines

arch/arm/mach-rockchip/rk3288-board-spl.c static int configure_emmc(struct udevice *pinctrl) · line 193

Quoted 6 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +6 -0
+       if (ret) {
+               debug("Unable to set RK818 REG_USB_CTRL: %d\n", ret);
+               return;
+       }
+}
+

Regards,
Simon

Regards,
Simon

#7 lore raw

PATCH v2 1/2 rockchip: Add basic support for phyCORE-RK3288 SoM based carrier board

Hi,

Quoted 65 lines · Wadim Egorov

Hi Simon,

Am 01.06.2017 um 05:11 schrieb Simon Glass:

Quoted 53 lines · Wadim Egorov
Quoted 52 lines

Hello Simon,

Am 24.05.2017 um 02:44 schrieb Simon Glass:

Quoted 48 lines

Hi Wadim,

Quoted 45 lines · Wadim Egorov

The phyCORE-RK3288 is a SoM (System on Module) containing a RK3288 SoC. The module can be connected to different carrier boards.
It can be also equipped with different RAM, SPI flash and eMMC variants. The Rapid Development Kit option is using the following setup:

- 1 GB DDR3 RAM (2 Banks)
- 1x 4 KB EEPROM
- DP83867 Gigabit Ethernet PHY
- 16 MB SPI Flash
- 4 GB eMMC Flash

Add basic support for the PCM-947 carrier board, a RK3288 based development board made by PHYTEC. This board works in a combination with the phyCORE-RK3288 System on Module.

---
Changes in v2:
- Move phycore initialization to an own function
- Use of_machine_is_compatible() instead of #ifdef
- Drop board_boot_order() and use spl_boot_device()
- Added Reviewed-by: Simon Glass <[email protected]>

---
 arch/arm/dts/Makefile                        |   1 +
 arch/arm/dts/rk3288-phycore-rdk.dts          | 294 ++++++++++++++++
 arch/arm/dts/rk3288-phycore-som.dtsi         | 503 +++++++++++++++++++++++++++
 arch/arm/mach-rockchip/rk3288-board-spl.c    |  37 ++
 arch/arm/mach-rockchip/rk3288/Kconfig        |  10 +
 board/phytec/phycore_rk3288/Kconfig          |  15 +
 board/phytec/phycore_rk3288/MAINTAINERS      |   6 +
 board/phytec/phycore_rk3288/Makefile         |   8 +
 board/phytec/phycore_rk3288/phycore-rk3288.c |   8 +
 configs/phycore-rk3288_defconfig             |  69 ++++
 include/configs/phycore_rk3288.h             |  23 ++
 11 files changed, 974 insertions(+)
 create mode 100644 arch/arm/dts/rk3288-phycore-rdk.dts
 create mode 100644 arch/arm/dts/rk3288-phycore-som.dtsi
 create mode 100644 board/phytec/phycore_rk3288/Kconfig
 create mode 100644 board/phytec/phycore_rk3288/MAINTAINERS
 create mode 100644 board/phytec/phycore_rk3288/Makefile
 create mode 100644 board/phytec/phycore_rk3288/phycore-rk3288.c
 create mode 100644 configs/phycore-rk3288_defconfig
 create mode 100644 include/configs/phycore_rk3288.h
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

This unfortunately causes build errors on various rockchip boards.

This seems to be a problem because I am using of_machine_is_compatible(). I think we will need a CONFIG_TARGET_PHYCORE_RK3288 guard there.

You mean that it does not work? You should be able to call that function.

When I build, for example the chromebook_jerry_defconfig, I get the following error:

Quoted 7 lines

drivers/built-in.o: In function `of_machine_is_compatible':
u-boot/chromebook/../drivers/core/device.c:845: undefined reference to `fdt_node_check_compatible'

It works with the phycore-rk3288_defconfig and fails with other rockchip configs.
This is why I wanted to use CONFIG_TARGET_PHYCORE_RK3288 in the first place.

OK I see. Well you can add:

#ifndef CONFIG_SPL_OF_PLATDATA
...
#endif

Quoted 79 lines
Quoted 65 lines
Quoted 65 lines
Quoted 65 lines

Try 'buildman rockchip' to see it.

Please see below.

[...]

Quoted 27 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +5 -0
index 74f3379..724dcb4 100644
@@ -8,6 +8,7 @@
 #include <debug_uart.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <i2c.h>
 #include <led.h>
 #include <malloc.h>
 #include <ram.h>
@@ -25,6 +26,7 @@
 #include <dm/test.h>
 #include <dm/util.h>
 #include <power/regulator.h>
+#include <power/rk8xx_pmic.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -157,6 +159,38 @@ static int configure_emmc(struct udevice *pinctrl)
 }
 #endif
 
+void phycore_init(void)
+{
+       struct udevice *dev;

arch/arm/mach-rockchip/rk3288-board-spl.c static int configure_emmc(struct udevice *pinctrl) · line 174

Quoted 10 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +10 -0
+       uint reg;
+       int ret;
+
+       ret = uclass_get_device(UCLASS_I2C, 0, &dev);
+       if (ret) {
+               debug("I2C init failed: %d\n", ret);
+               return;
+       }
+
+       ret = i2c_get_chip(dev, 0x1c, 1, &dev);

We should not be hard-coding the bus address here.

See veyron_init() for an example of another way to do this.

arch/arm/mach-rockchip/rk3288-board-spl.c static int configure_emmc(struct udevice *pinctrl) · line 187

Quoted 13 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +13 -0
+       if (ret) {
+               debug("Cannot find RK818: %d\n", ret);
+               return;
+       }
+
+       reg = dm_i2c_reg_read(dev, REG_USB_CTRL);
+
+       /*
+        * Increase USB input current selection to 2A and close charger
+        * when usb lower then 3.4V.
+        */
+       reg |= 0x77;
+       ret = dm_i2c_reg_write(dev, REG_USB_CTRL, reg);

Here you are hacking registers in the PMIC. This should go in the PMIC driver. See rk8xx_spl_configure_buck() for how to do this in SPL without bringing in the whole regulator framework.

Quoted 8 lines
Quoted 6 lines

For this I have to enable CONFIG_SPL_POWER_SUPPORT to get the pmic part compiled.
Unfortunately, I am not able to boot my board with POWER_SUPPORT enabled, because the dm_init_and_scan() function which is called from spl_early_init() is failing.
Do you have any hints on what the problem could be?

Do you know what the error is? Also you could put #define DEBUG in lists.c pehaps?

With CONFIG_SPL_POWER_SUPPORT=y enabled the device_bind_common() function is failing for
the I2C (fail_uclass_post_bind) and PMIC (fail_bind) device. See the output below:

Quoted 15 lines

[...]
bind node dmc at ff610000
- attempt to match compatible string 'rockchip,rk3288-dmc'
- found match at 'rockchip_rk3288_dmc'
Bound device dmc at ff610000 to root_driver
bind node i2c at ff650000
- attempt to match compatible string 'rockchip,rk3288-i2c'
- found match at 'i2c_rockchip'
bind node pmic at 1c
- attempt to match compatible string 'rockchip,rk818'
- found match at 'rk8xx pmic'
bind node power-management at ff730000
- attempt to match compatible string 'rockchip,rk3288-pmu'
- found match at 'rk3288_syscon'
Bound device power-management at ff730000 to root_driver

That seems really odd! I don't understand why it would bind it to root_driver.

Quoted 12 lines

[...]
bind node config
Device 'config' has no compatible string
### ERROR ### Please RESET the board ###

Regards,
Wadim

Quoted 4 lines
Quoted 4 lines

Regards,
Wadim

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

arch/arm/mach-rockchip/rk3288-board-spl.c static int configure_emmc(struct udevice *pinctrl) · line 193

Quoted 6 lines
arch/arm/mach-rockchip/rk3288-board-spl.c +6 -0
+       if (ret) {
+               debug("Unable to set RK818 REG_USB_CTRL: %d\n", ret);
+               return;
+       }
+}
+

Regards,
Simon