mtd: spi-nor-ids: Add XMC XM25QH128C
Subsystems (3)
PATCH v4 1/4 mtd: spi-nor-ids: Add XMC XM25QH128C
From: Fabio Estevam <[email protected]>
Add the JEDEC ID for the XMC XM25QH128C SPI NOR flash.
This is a 128Mbit device using 64KiB sectors and supporting 4KiB erase, dual read and quad read, matching the other XM25QH128 variants.
---
Changes since v3:
- None.
drivers/mtd/spi/spi-nor-ids.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/spi/spi-nor-ids.c +1 -0
@@ -673,6 +673,7 @@ const struct flash_info spi_nor_ids[] = { { INFO("XM25QH64A", 0x207017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { INFO("XM25QH64C", 0x204017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { INFO("XM25QH128A", 0x207018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, + { INFO("XM25QH128C", 0x204018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { INFO("XM25QU128C", 0x204118, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { INFO("XM25QH256C", 0x204019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, { INFO("XM25QU256C", 0x204119, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
Signature · 1 line
2.43.0
PATCH v4 2/4 rockchip: rk3399: Remove ROC-PC regulator overrides
From: Fabio Estevam <[email protected]>
The upstream devicetree already describes dc_12v as the output of the MP8859 regulator and drives the USB hub reset through the vcc5v0_host regulator pinctrl state.
Remove the legacy fixed-regulator overrides and rely on the upstream regulator descriptions.
---
Changes since v3:
- None. Only added Quentin's Reviewed-by tag.
arch/arm/dts/rk3399-roc-pc-u-boot.dtsi | 24 ------------------------ 1 file changed, 24 deletions(-)
arch/arm/dts/rk3399-roc-pc-u-boot.dtsi +0 -24
@@ -10,30 +10,6 @@ config { sysreset-gpio = <&gpio1 RK_PA6 GPIO_ACTIVE_HIGH>; }; - - vcc_hub_en: vcc_hub_en-regulator { - compatible = "regulator-fixed"; - enable-active-high; - gpio = <&gpio2 RK_PA4 GPIO_ACTIVE_HIGH>; - pinctrl-names = "default"; - pinctrl-0 = <&hub_rst>; - regulator-name = "vcc_hub_en"; - regulator-always-on; - }; -}; - -/* - * should be placed inside mp8859, but not until mp8859 has - * its own dt-binding. - */ -&dc_12v { - compatible = "regulator-fixed"; - regulator-name = "dc_12v"; - regulator-always-on; - regulator-boot-on; - regulator-min-microvolt = <12000000>; - regulator-max-microvolt = <12000000>; - vin-supply = <&vcc_vbus_typec0>; }; &gpio4 {
Signature · 1 line
2.43.0
PATCH v4 3/4 rockchip: rk3399: Add ROC-PC-PLUS board detection
In reply to Fabio Estevam via U-BootFrom: Fabio Estevam <[email protected]>
The ROC-RK3399-PC has an MP8859 regulator on I2C7 at address 0x66, while the ROC-RK3399-PC-PLUS does not. Probe for the regulator in SPL and use the result to select the matching devicetree from the U-Boot FIT. Fall back to the original board if the I2C bus cannot be probed.
Build both devicetrees from the existing roc-pc-rk3399_defconfig and enable the XMC SPI NOR driver used by the Plus variant. Set fdtfile from the selected U-Boot devicetree so the matching Linux devicetree is used as well.
---
Changes since v3:
- Explicitly sets fdtfile for both PC and PC-PLUS.
arch/arm/dts/rk3399-roc-pc-plus-u-boot.dtsi | 3 ++ arch/arm/dts/rk3399-roc-pc-u-boot.dtsi | 8 +++++ board/firefly/roc-pc-rk3399/roc-pc-rk3399.c | 39 +++++++++++++++++++++ configs/roc-pc-rk3399_defconfig | 3 ++ doc/board/rockchip/rockchip.rst | 2 +- 5 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/rk3399-roc-pc-plus-u-boot.dtsi
arch/arm/dts/rk3399-roc-pc-plus-u-boot.dtsi new file +3 -0
@@ -0,0 +1,3 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include "rk3399-roc-pc-u-boot.dtsi"
arch/arm/dts/rk3399-roc-pc-u-boot.dtsi +8 -0
@@ -12,6 +12,14 @@ }; }; +&i2c7 { + bootph-pre-ram; +}; + +&i2c7_xfer { + bootph-pre-ram; +}; + &gpio4 { bootph-pre-ram; };
board/firefly/roc-pc-rk3399/roc-pc-rk3399.c +39 -0
@@ -5,14 +5,24 @@#include <dm.h> #include <env.h> +#include <fdtdec.h> +#include <i2c.h> +#include <image.h> #include <log.h> #include <spl_gpio.h> +#include <asm/global_data.h> #include <asm/io.h> #include <asm/arch-rockchip/cru.h> #include <asm/arch-rockchip/gpio.h> #include <asm/arch-rockchip/grf_rk3399.h> +#define ROC_PC_MP8859_BUS "i2c@ff160000" +#define ROC_PC_MP8859_ADDR 0x66 +#define ROC_PC_PLUS_FDTFILE "rockchip/rk3399-roc-pc-plus.dtb" + +DECLARE_GLOBAL_DATA_PTR ; +#ifdef CONFIG_XPL_BUILD #define PMUGRF_BASE 0xff320000
@@ -54,4 +64,33 @@ void led_setup(void) spl_gpio_output(gpio0, GPIO(BANK_B, 5), 1); } +static bool is_roc_pc_plus (void ) +{ +struct udevice *bus, *dev; + +if (uclass_get_device_by_name (UCLASS_I2C ,ROC_PC_MP8859_BUS , &bus)) +return false; + +return dm_i2c_probe (bus,ROC_PC_MP8859_ADDR ,0 , &dev); +} + +int board_fit_config_name_match (const char *name) +{ +if (is_roc_pc_plus ()) +return strcmp (name,ROC_PC_PLUS_FDTFILE ); + +return strcmp (name,CONFIG_DEFAULT_FDT_FILE ); +} +#endif + +int rk_board_late_init (void ) +{ +if (!fdt_node_check_compatible (gd->fdt_blob,0 , +"firefly,roc-rk3399-pc-plus" )) +env_set ("fdtfile" ,ROC_PC_PLUS_FDTFILE ); +else +env_set ("fdtfile" ,CONFIG_DEFAULT_FDT_FILE ); + +return 0 ; +}
configs/roc-pc-rk3399_defconfig +3 -0
@@ -26,6 +26,7 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_MAX_SIZE=0x40000 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set CONFIG_SPL_ENV_SUPPORT=y +CONFIG_SPL_I2C=y CONFIG_SPL_SPI_LOAD=y CONFIG_SYS_SPI_U_BOOT_OFFS=0xE0000 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
@@ -37,6 +38,7 @@ CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_TIME=y CONFIG_SPL_OF_CONTROL=y +CONFIG_OF_LIST="rockchip/rk3399-roc-pc rockchip/rk3399-roc-pc-plus" CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_RELOC_GD_ENV_ADDR=y
@@ -49,6 +51,7 @@ CONFIG_MMC_SDHCI_SDMA=y CONFIG_MMC_SDHCI_ROCKCHIP=y CONFIG_SPI_FLASH_SFDP_SUPPORT=y CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_XMC=y CONFIG_DM_ETH_PHY=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y
doc/board/rockchip/rockchip.rst +1 -1
@@ -81,7 +81,7 @@ List of mainline supported Rockchip boards: - 96boards RK3399 Ficus (ficus-rk3399) - 96boards Rock960 (rock960-rk3399) - Firefly-RK3399 (firefly_rk3399) - - Firefly ROC-RK3399-PC + - Firefly ROC-RK3399-PC/ROC-RK3399-PC-PLUS (roc-pc-rk3399) - FriendlyElec NanoPC-T4 (nanopc-t4-rk3399) - FriendlyElec NanoPi M4 (nanopi-m4-rk3399) - FriendlyElec NanoPi M4B (nanopi-m4b-rk3399)
Signature · 1 line
2.43.0
PATCH v4 4/4 rockchip: roc-pc-rk3399: Enable redundant environment
In reply to Fabio Estevam via U-BootFrom: Fabio Estevam <[email protected]>
Keep the primary U-Boot environment at its existing 0x3f8000 offset and use the preceding 32 KiB region at 0x3f0000 for the redundant copy.
Both copies are aligned to the 4 KiB erase size and together occupy 0x3f0000 through 0x3fffff. Redundancy protects the environment against power loss or an interrupted update.
---
Changes since v3:
- Preserved the primary environment at 0x3f8000.
configs/roc-pc-rk3399_defconfig | 2 ++ 1 file changed, 2 insertions(+)
configs/roc-pc-rk3399_defconfig +2 -0
@@ -17,6 +17,7 @@ CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_SF_DEFAULT_BUS=1 CONFIG_DEBUG_UART_BASE=0xFF1A0000 CONFIG_DEBUG_UART_CLOCK=24000000 +CONFIG_ENV_OFFSET_REDUND=0x3F0000 CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI=y CONFIG_DEBUG_UART=y
@@ -41,6 +42,7 @@ CONFIG_SPL_OF_CONTROL=y CONFIG_OF_LIST="rockchip/rk3399-roc-pc rockchip/rk3399-roc-pc-plus" CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_ENV_REDUNDANT=y CONFIG_ENV_RELOC_GD_ENV_ADDR=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y
Signature · 1 line
2.43.0
Re: [PATCH v4 3/4] rockchip: rk3399: Add ROC-PC-PLUS board detection
In reply to Fabio Estevam via U-BootHi Fabio,
Quoted 7 lines · Fabio Estevam via U-Boot
From: Fabio Estevam <[email protected]>
The ROC-RK3399-PC has an MP8859 regulator on I2C7 at address
0x66, while the ROC-RK3399-PC-PLUS does not. Probe for the regulator in SPL and use the result to select the matching devicetree from the U-Boot FIT. Fall back to the original board if the I2C bus cannot be probed.
Quoted 5 lines
Build both devicetrees from the existing roc-pc-rk3399_defconfig and enable the XMC SPI NOR driver used by the Plus variant. Set fdtfile from the selected U-Boot devicetree so the matching Linux devicetree is used as well.
Thanks!
Quentin
Re: [PATCH v4 4/4] rockchip: roc-pc-rk3399: Enable redundant environment
In reply to Fabio Estevam via U-BootHi Fabio,
Quoted 9 lines · Fabio Estevam via U-Boot
From: Fabio Estevam <[email protected]>
Keep the primary U-Boot environment at its existing
0x3f8000offset and use the preceding 32 KiB region at0x3f0000for the redundant copy.Both copies are aligned to the 4 KiB erase size and together occupy
0x3f0000through0x3fffff. Redundancy protects the environment against power loss or an interrupted update.
Thanks!
Quentin
Hi,
Quoted 11 lines
From: Fabio Estevam <[email protected]>
Add the JEDEC ID for the XMC XM25QH128C SPI NOR flash.
This is a 128Mbit device using 64KiB sectors and supporting 4KiB erase, dual read and quad read, matching the other XM25QH128 variants.
Cc Vignesh Raghavendra <[email protected]>Cc Takahiro Kuwano <[email protected]>Signed-off-by Fabio Estevam <[email protected]>---
It would be nice to have Link: tag followed by datasheet URL [1].
Quoted 11 lines
Changes since v3:
- None.drivers/mtd/spi/spi-nor-ids.c | 1 + 1 file changed, 1 insertion(+)drivers/mtd/spi/spi-nor-ids.c +0
-0
drivers/mtd/spi/spi-nor-ids.c const struct flash_info spi_nor_ids[] = { · line 676
Quoted 4 lines
drivers/mtd/spi/spi-nor-ids.c +1
-0@@ -673,6 +673,7 @@ const struct flash_info spi_nor_ids[] = { { INFO("XM25QH64A", 0x207017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { INFO("XM25QH64C", 0x204017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { INFO("XM25QH128A", 0x207018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, + { INFO("XM25QH128C", 0x204018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
Per the datasheet, this chip supports Dual/Quad ops but for my reference, could you let me know if you tested 1-1-4 or 1-4-4 ops?
Anyway,
Quoted 7 lines
drivers/mtd/spi/spi-nor-ids.c +0
-0{ INFO("XM25QU128C", 0x204118, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { INFO("XM25QH256C", 0x204019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },{ INFO("XM25QU256C", 0x204119, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
SPI_NOR_4B_OPCODES) },
--
2.43.0
Hi Fabio,
Quoted 9 lines · On 7/29/26 10:59 AM, [email protected] wrote:
Hi,
Quoted 7 lines
From: Fabio Estevam <[email protected]>
Add the JEDEC ID for the XMC XM25QH128C SPI NOR flash.
This is a 128Mbit device using 64KiB sectors and supporting 4KiB erase, dual read and quad read, matching the other XM25QH128 variants.
Quoted 7 lines
Quoted 4 lines
Cc Vignesh Raghavendra <[email protected]>Cc Takahiro Kuwano <[email protected]>Signed-off-by Fabio Estevam <[email protected]>---
It would be nice to have Link: tag followed by datasheet URL [1].
I'll add the link when applying (I'm targeting the next branch, open in a bit more than a week from now), no need to send a v5 for that.
Please still answer Takahiro's question below when you have time.
Thanks!
Quentin
Quoted 32 lines
Quoted 11 lines
Changes since v3:
- None.drivers/mtd/spi/spi-nor-ids.c | 1 + 1 file changed, 1 insertion(+)drivers/mtd/spi/spi-nor-ids.c +0
-0drivers/mtd/spi/spi-nor-ids.c const struct flash_info spi_nor_ids[] = { · line 676
Quoted 4 lines
drivers/mtd/spi/spi-nor-ids.c +1
-0@@ -673,6 +673,7 @@ const struct flash_info spi_nor_ids[] = { { INFO("XM25QH64A", 0x207017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { INFO("XM25QH64C", 0x204017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { INFO("XM25QH128A", 0x207018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, + { INFO("XM25QH128C", 0x204018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },Per the datasheet, this chip supports Dual/Quad ops but for my reference, could you let me know if you tested 1-1-4 or 1-4-4 ops?
Anyway,
Reviewed-by Takahiro Kuwano <[email protected]>Quoted 7 lines
drivers/mtd/spi/spi-nor-ids.c +0
-0{ INFO("XM25QU128C", 0x204118, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { INFO("XM25QH256C", 0x204019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },{ INFO("XM25QU256C", 0x204119, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
SPI_NOR_4B_OPCODES) },
--
2.43.0
Hi Takahiro-san,
Quoted 2 lines · On Wed, Jul 29, 2026 at 5:59 AM <[email protected]> wrote:
Per the datasheet, this chip supports Dual/Quad ops but for my reference, could you let me know if you tested 1-1-4 or 1-4-4 ops?
I checked the RK3399 SPI1 pin configuration. It only exposes CLK, CS, TX/IO0, and RX/IO1; IO2 and IO3 are not muxed to the SPI controller. Therefore, my test exercised 1-1-1 operations rather than either 1-1-4 or 1-4-4.
Quoted 2 lines
Anyway,
Reviewed-by Takahiro Kuwano <[email protected]>
Thanks for the review.
Quoted 10 lines
Hi Takahiro-san,
Quoted 2 lines · On Wed, Jul 29, 2026 at 5:59 AM <[email protected]> wrote:
Per the datasheet, this chip supports Dual/Quad ops but for my reference, could you let me know if you tested 1-1-4 or 1-4-4 ops?
I checked the RK3399 SPI1 pin configuration. It only exposes CLK, CS, TX/IO0, and RX/IO1; IO2 and IO3 are not muxed to the SPI controller. Therefore, my test exercised 1-1-1 operations rather than either 1-1-4 or 1-4-4.
Noted, thank you!
Quoted 5 lines
Quoted 3 lines
Anyway,
Reviewed-by Takahiro Kuwano <[email protected]>Thanks for the review.
Re: [PATCH v4 3/4] rockchip: rk3399: Add ROC-PC-PLUS board detection
In reply to Fabio Estevam via U-BootHi Fabio,
Quoted 84 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
The ROC-RK3399-PC has an MP8859 regulator on I2C7 at address
0x66, while the ROC-RK3399-PC-PLUS does not. Probe for the regulator in SPL and use the result to select the matching devicetree from the U-Boot FIT. Fall back to the original board if the I2C bus cannot be probed.Build both devicetrees from the existing roc-pc-rk3399_defconfig and enable the XMC SPI NOR driver used by the Plus variant. Set fdtfile from the selected U-Boot devicetree so the matching Linux devicetree is used as well.
Signed-off-by Fabio Estevam <[email protected]>---
Changes since v3:
- Explicitly sets fdtfile for both PC and PC-PLUS.arch/arm/dts/rk3399-roc-pc-plus-u-boot.dtsi | 3 ++ arch/arm/dts/rk3399-roc-pc-u-boot.dtsi | 8 +++++ board/firefly/roc-pc-rk3399/roc-pc-rk3399.c | 39 +++++++++++++++++++++ configs/roc-pc-rk3399_defconfig | 3 ++ doc/board/rockchip/rockchip.rst | 2 +- 5 files changed, 54 insertions(+), 1 deletion(-)create mode 100644
arch/arm/dts/rk3399-roc-pc-plus-u-boot.dtsiarch/arm/dts/rk3399-roc-pc-plus-u-boot.dtsi new file +3
-0@@ -0,0 +1,3 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include "rk3399-roc-pc-u-boot.dtsi"arch/arm/dts/rk3399-roc-pc-u-boot.dtsi +8
-0@@ -12,6 +12,14 @@ }; }; +&i2c7 { + bootph-pre-ram; +}; + +&i2c7_xfer { + bootph-pre-ram; +}; + &gpio4 { bootph-pre-ram; };board/firefly/roc-pc-rk3399/roc-pc-rk3399.c +10
-0@@ -5,14 +5,24 @@#include <dm.h> #include <env.h> +#include <fdtdec.h> +#include <i2c.h> +#include <image.h> #include <log.h> #include <spl_gpio.h> +#include <asm/global_data.h> #include <asm/io.h> #include <asm/arch-rockchip/cru.h> #include <asm/arch-rockchip/gpio.h> #include <asm/arch-rockchip/grf_rk3399.h> +#define ROC_PC_MP8859_BUS "i2c@ff160000" +#define ROC_PC_MP8859_ADDR 0x66 +#define ROC_PC_PLUS_FDTFILE "rockchip/rk3399-roc-pc-plus.dtb" + +DECLARE_GLOBAL_DATA_PTR ; +#ifdef CONFIG_XPL_BUILD #define PMUGRF_BASE 0xff320000@@ -54,4 +64,33 @@ void led_setup(void)spl_gpio_output (gpio0,GPIO (BANK_B ,5 ),1 );
board/firefly/roc-pc-rk3399/roc-pc-rk3399.c void led_setup(void) · line 74
Quoted 10 lines
board/firefly/roc-pc-rk3399/roc-pc-rk3399.c +8
-0} +static bool is_roc_pc_plus (void ) +{ +struct udevice *bus, *dev; + +if (uclass_get_device_by_name (UCLASS_I2C ,ROC_PC_MP8859_BUS , &bus)) +return false; + +return dm_i2c_probe (bus,ROC_PC_MP8859_ADDR ,0 , &dev);
This fails to build due to undefined reference to dm_i2c_probe in SPL:
+Some images are invalid
aarch64: + roc-pc-mezzanine-rk3399
+aarch64-linux-ld: board/firefly/roc-pc-rk3399/roc-pc-rk3399.o: in function `is_roc_pc_plus':
+board/firefly/roc-pc-rk3399/roc-pc-rk3399.c:74:(.text.board_fit_config_name_match+0x38): undefined reference to `dm_i2c_probe' +make[2]: *** [scripts/Makefile.xpl:546: spl/u-boot-spl] Error 1
+make[1]: *** [Makefile:2448: spl/u-boot-spl] Error 2
+make: *** [Makefile:189: __sub-make] Error 2
c.f. https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/jobs/67143#L592
Note this applies to the roc-pc-mezzanine-rk3399 defconfig which is only slightly different from roc-pc-rk3399.
Ideally, we should be able to automatically detect whether it's a roc-pc-mezzanine-rk3399, but I couldn't find schematics for it and from the Device Tree, there doesn't seem to be something we could use to detect it like we do for ROC-PC-PLUS/ROC-PC. So instead I recommend to check for CONFIG_IS_ENABLED(DM_I2C). If it ever gets enabled for roc-pc-mezzanine-rk3399_defconfig, the logic will return that it's NOT a ROC-PC-PLUS and thus use CONFIG_DEFAULT_FDT_FILE which is rockchip/rk3399-roc-pc-mezzanine.dtb which is correct.
What do you think? Can you send a v5 for this? Please pick Takahiro's R-b and the Link that was suggested to be added to the commit log of patch 1.
Thanks!
Quentin
Re: [PATCH v4 3/4] rockchip: rk3399: Add ROC-PC-PLUS board detection
Hi Quentin,
Quoted 8 lines · Quentin Schulz
Ideally, we should be able to automatically detect whether it's a roc-pc-mezzanine-rk3399, but I couldn't find schematics for it and from the Device Tree, there doesn't seem to be something we could use to detect it like we do for ROC-PC-PLUS/ROC-PC. So instead I recommend to check for
CONFIG_IS_ENABLED(DM_I2C). If it ever gets enabled for roc-pc-mezzanine-rk3399_defconfig, the logic will return that it's NOT a ROC-PC-PLUS and thus useCONFIG_DEFAULT_FDT_FILEwhich is rockchip/rk3399-roc-pc-mezzanine.dtb which is correct.
DM_I2C is also selected by roc-pc-mezzanine-rk3399_defconfig.
We can use SPL_I2C to distinguish, like this:
board/firefly/roc-pc-rk3399/roc-pc-rk3399.c +3 -0
@@ -68,6 +68,9 @@ static bool is_roc_pc_plus(void) {struct udevice *bus, *dev; +/* roc-pc-mezzanine-rk3399_defconfig does not select SPL_I2C */ +if (!CONFIG_IS_ENABLED (SPL_I2C )) +return false;if (uclass_get_device_by_name (UCLASS_I2C ,ROC_PC_MP8859_BUS , &bus))return false;
If you agree, I'll send a v5 with the change above included.
Thanks
Re: [PATCH v4 3/4] rockchip: rk3399: Add ROC-PC-PLUS board detection
Hi Fabio,
Quoted 13 lines · Fabio Estevam
Hi Quentin,
Quoted 8 lines · Quentin Schulz
Ideally, we should be able to automatically detect whether it's a roc-pc-mezzanine-rk3399, but I couldn't find schematics for it and from the Device Tree, there doesn't seem to be something we could use to detect it like we do for ROC-PC-PLUS/ROC-PC. So instead I recommend to check for
CONFIG_IS_ENABLED(DM_I2C). If it ever gets enabled for roc-pc-mezzanine-rk3399_defconfig, the logic will return that it's NOT a ROC-PC-PLUS and thus useCONFIG_DEFAULT_FDT_FILEwhich is rockchip/rk3399-roc-pc-mezzanine.dtb which is correct.
Quoted 2 lines
DM_I2Cis also selected by roc-pc-mezzanine-rk3399_defconfig.
Yes, but it's missing SPL_DM_I2C.
Quoted 2 lines
We can use
SPL_I2Cto distinguish, like this:
Unfortunately, we cannot simply rely on SPL_I2C as the function is only implemented in i2c-uclass.c which is only compiled when SPL_DM_I2C (and SPL_I2C) is enabled.
There's also an issue in the dependencies for SPL_DM_I2C and TPL_DM_I2C as they both depend on I2C (via the if at the top of drivers/i2c/Kconfig) and DM_I2C while they should depend on SPL_I2C (respectively TPL_I2C). I'm not sure why they depend on DM_I2C as it's for proper, not xPL...
TPL_SYS_I2C_LEGACY depends on !SPL_DM_I2C but I'm assuming it should rather depend on !TPL_DM_I2C.
Same for SPL_DM_I2C_GPIO, not sure why it depends on DM_I2C_GPIO. SPL_I2C_MUX also depends on I2C_MUX, for what reason?
VPL_DM_I2C should depend on VPL_I2C but it doesn't exist, so we probably should just remove the symbol since it won't do anything as is.
None are a blocker for this series.
board/firefly/roc-pc-rk3399/roc-pc-rk3399.c static bool is_roc_pc_plus(void) · line 73
Quoted 9 lines
board/firefly/roc-pc-rk3399/roc-pc-rk3399.c +3
-0@@ -68,6 +68,9 @@ static bool is_roc_pc_plus(void) {struct udevice *bus, *dev; +/* roc-pc-mezzanine-rk3399_defconfig does not select SPL_I2C */ +if (!CONFIG_IS_ENABLED (SPL_I2C )) +return false;
Please add a newline after the return false;
It should be !CONFIG_IS_ENABLED(DM_I2C) as CONFIG_IS_ENABLED is going to add the appropriate prefix based on the current stage being built (so definitely no SPL/TPL/VPL to be added manually) and CONFIG_SPL_I2C is not enough to build the dm_i2c_probe implementation, we need CONFIG_SPL_DM_I2C (well, and CONFIG_SPL_I2C because otherwise the drivers/i2c directory isn't traversed and because SPL_DM_I2C is missing a dependency on it).
Cheers,
Quentin
Re: [PATCH v4 3/4] rockchip: rk3399: Add ROC-PC-PLUS board detection
Hi Quentin,
Quoted 7 lines · Quentin Schulz
It should be !CONFIG_IS_ENABLED(DM_I2C) as
CONFIG_IS_ENABLEDis going to add the appropriate prefix based on the current stage being built (so definitely no SPL/TPL/VPL to be added manually) andCONFIG_SPL_I2Cis not enough to build thedm_i2c_probeimplementation, we needCONFIG_SPL_DM_I2C(well, andCONFIG_SPL_I2Cbecause otherwise thedrivers/i2cdirectory isn't traversed and becauseSPL_DM_I2Cis missing a dependency on it).
I tested !CONFIG_IS_ENABLED(DM_I2C) alone, but the mezzanine SPL still fails to link because SPL_DM_I2C is enabled while SPL_I2C is not.
Checking both works:
if (!(CONFIG_IS_ENABLED(I2C) && CONFIG_IS_ENABLED(DM_I2C)))
return false;
I tested the mezzanine build successfully with this change.
I'll use this in v5 unless you see an issue.
Thanks,
Fabio Estevam
Re: [PATCH v4 3/4] rockchip: rk3399: Add ROC-PC-PLUS board detection
Hi Fabio,
Quoted 12 lines · Fabio Estevam
Hi Quentin,
Quoted 7 lines · Quentin Schulz
It should be !CONFIG_IS_ENABLED(DM_I2C) as
CONFIG_IS_ENABLEDis going to add the appropriate prefix based on the current stage being built (so definitely no SPL/TPL/VPL to be added manually) andCONFIG_SPL_I2Cis not enough to build thedm_i2c_probeimplementation, we needCONFIG_SPL_DM_I2C(well, andCONFIG_SPL_I2Cbecause otherwise thedrivers/i2cdirectory isn't traversed and becauseSPL_DM_I2Cis missing a dependency on it).
Quoted 3 lines
I tested !CONFIG_IS_ENABLED(DM_I2C) alone, but the mezzanine SPL still fails to link because
SPL_DM_I2Cis enabled whileSPL_I2Cis not.
Yes, because SPL_DM_I2C (and TPL_DM_I2C) do not depend on SPL_I2C/TPL_I2C but should. Something else to fix :)
Quoted 9 lines
Checking both works:
if (!(CONFIG_IS_ENABLED(I2C) &&
CONFIG_IS_ENABLED(DM_I2C)))return false;I tested the mezzanine build successfully with this change.
I'll use this in v5 unless you see an issue.
Works for me!
Cheers,
Quentin