[PATCH 09/12] board: ti: j784s4: Add board support for J784S4 SoC

Tom Rini trini at konsulko.com
Mon Nov 21 17:01:43 CET 2022


On Sat, Nov 19, 2022 at 12:59:30PM -0600, Hari Nagalla wrote:

> Add board support for J784S4 SoC.
> 
> Signed-off-by: Hari Nagalla <hnagalla at ti.com>

Patches 9, 11 and 12 should be folded together as it's all adding the
board itself.

[snip]
> diff --git a/board/ti/j784s4/evm.c b/board/ti/j784s4/evm.c
> new file mode 100644
> index 0000000000..155abe53ca
> --- /dev/null
> +++ b/board/ti/j784s4/evm.c
[snip]
> +#ifdef CONFIG_SPL_LOAD_FIT
> +int board_fit_config_name_match(const char *name)
> +{
> +	if (!strcmp(name, "J784S4X-EVM"))
> +		return 0;
> +
> +	return -1;
> +}
> +#endif
> +
> +#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
> +int ft_board_setup(void *blob, struct bd_info *bd)
> +{
> +	int ret;
> +
> +	ret = fdt_fixup_msmc_ram(blob, "/bus at 100000", "sram at 70000000");
> +	if (ret < 0)
> +		ret = fdt_fixup_msmc_ram(blob, "/interconnect at 100000",
> +					 "sram at 70000000");
> +	if (ret)
> +		printf("%s: fixing up msmc ram failed %d\n", __func__, ret);
> +
> +	return ret;
> +}
> +#endif
> +
> +#ifdef CONFIG_TI_I2C_BOARD_DETECT
> +int do_board_detect(void)
> +{
> +	int ret;
> +
> +	ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
> +					 CONFIG_EEPROM_CHIP_ADDRESS);
> +	if (ret)
> +		pr_err("Reading on-board EEPROM at 0x%02x failed %d\n",
> +		       CONFIG_EEPROM_CHIP_ADDRESS, ret);
> +
> +	return ret;
> +}
> +
> +int checkboard(void)
> +{
> +	struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
> +
> +	if (do_board_detect())
> +		/* EEPROM not populated */
> +		printf("Board: %s rev %s\n", "J784S4-EVM", "E1");
> +	else
> +		printf("Board: %s rev %s\n", ep->name, ep->version);
> +
> +	return 0;
> +}
> +
> +static void setup_board_eeprom_env(void)
> +{
> +	char *name = "j784s4";
> +
> +	if (do_board_detect())
> +		goto invalid_eeprom;
> +
> +	if (board_is_j784s4_evm())
> +		name = "j784s4";
> +	else
> +		printf("Unidentified board claims %s in eeprom header\n",
> +		       board_ti_get_name());
> +
> +invalid_eeprom:
> +	set_board_info_env_am6(name);
> +}
> +
> +static void setup_serial(void)
> +{
> +	struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
> +	unsigned long board_serial;
> +	char *endp;
> +	char serial_string[17] = { 0 };
> +
> +	if (env_get("serial#"))
> +		return;
> +
> +	board_serial = simple_strtoul(ep->serial, &endp, 16);
> +	if (*endp != '\0') {
> +		pr_err("Error: Can't set serial# to %s\n", ep->serial);
> +		return;
> +	}
> +
> +	snprintf(serial_string, sizeof(serial_string), "%016lx", board_serial);
> +	env_set("serial#", serial_string);
> +}
> +#endif

How much of all of this is required to get the system up and load the
OS/etc and go? We want to avoid the big nest of board code to find
daughtercards and so forth that makes custom platforms such a challenge.
As much of that logic that can be done in environment scripts (and to
repeat my just made in another thread comment, in the text based
environment instead, which should make writing it easier) should be done
that way instead.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20221121/9cb90be8/attachment.sig>


More information about the U-Boot mailing list