On 10/21/20 1:56 PM, Jagan Teki wrote: > On Thu, Sep 3, 2020 at 10:37 AM Samuel Holland <[email protected]> wrote: >> >> There are two different publicly-released revisions of the PinePhone >> hardware, versions 1.1 and 1.2; and they need different device trees. >> Since some GPIO pins were rerouted, we can use that to distinguish >> between them. >> >> Signed-off-by: Samuel Holland <[email protected]> >> --- >> arch/arm/mach-sunxi/Kconfig | 7 +++++++ >> board/sunxi/board.c | 21 +++++++++++++++++++++ >> 2 files changed, 28 insertions(+) >> >> diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig >> index be0822bfb7d..8421f3b6854 100644 >> --- a/arch/arm/mach-sunxi/Kconfig >> +++ b/arch/arm/mach-sunxi/Kconfig >> @@ -1010,4 +1010,11 @@ config PINE64_DT_SELECTION >> option, the device tree selection code specific to Pine64 which >> utilizes the DRAM size will be enabled. >> >> +config PINEPHONE_DT_SELECTION >> + bool "Enable PinePhone device tree selection code" >> + depends on MACH_SUN50I >> + help >> + Enable this option to automatically select the device tree for the >> + correct PinePhone hardware revision during boot. >> + >> endif >> diff --git a/board/sunxi/board.c b/board/sunxi/board.c >> index fb0d5bf4743..3d64ed18664 100644 >> --- a/board/sunxi/board.c >> +++ b/board/sunxi/board.c >> @@ -27,6 +27,7 @@ >> #include <asm/arch/dram.h> >> #include <asm/arch/gpio.h> >> #include <asm/arch/mmc.h> >> +#include <asm/arch/prcm.h> >> #include <asm/arch/spl.h> >> #include <linux/delay.h> >> #include <u-boot/crc.h> >> @@ -920,6 +921,26 @@ int board_fit_config_name_match(const char *name) >> best_dt_name = "sun50i-a64-pine64"; >> } >> #endif >> +#ifdef CONFIG_PINEPHONE_DT_SELECTION > > Look like these board detection CONFIG items are keep on increasing. > Better to have something like CONFIG_SUNXI_DT_SELECTION for all dt > selection code.
Are you sure? This is in SPL, where we are always running out of space. And a single SPL binary cannot work on both Pine A64 and PinePhone anyway, since they have different DRAM types. I think the space savings is worth the cost of the extra config symbol (especially if more boards need special handling in the future). Cheers, Samuel

