public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Hari Nagalla <hnagalla@ti.com>
Cc: lukma@denx.de, seanga2@gmail.com, jh80.chung@samsung.com,
	nm@ti.com, afd@ti.com, a-nandan@ti.com, u-boot@lists.denx.de
Subject: Re: [PATCH 09/12] board: ti: j784s4: Add board support for J784S4 SoC
Date: Mon, 21 Nov 2022 11:01:43 -0500	[thread overview]
Message-ID: <20221121160143.GL7282@bill-the-cat> (raw)
In-Reply-To: <20221119185933.16194-10-hnagalla@ti.com>

[-- Attachment #1: Type: text/plain, Size: 3099 bytes --]

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@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@100000", "sram@70000000");
> +	if (ret < 0)
> +		ret = fdt_fixup_msmc_ram(blob, "/interconnect@100000",
> +					 "sram@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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2022-11-21 16:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-19 18:59 [PATCH 00/12] Introduce initial TI's J784S4 support Hari Nagalla
2022-11-19 18:59 ` [PATCH 01/12] arm: dts: introduce j784s4 dtbs from linux kernel Hari Nagalla
2022-11-19 18:59 ` [PATCH 02/12] arm: dts: introduce j784s4 u-boot dtbs Hari Nagalla
2022-11-19 18:59 ` [PATCH 03/12] arm: K3: Add basic support for J784S4 SoC definition Hari Nagalla
2022-11-21 16:01   ` Tom Rini
2022-11-19 18:59 ` [PATCH 04/12] drivers: dma: Add support for J784S4 Hari Nagalla
2022-12-21  4:27   ` Vignesh Raghavendra
2022-11-19 18:59 ` [PATCH 05/12] clk: clk-k3: Add support for J784S4 SoC Hari Nagalla
2022-11-22  4:12   ` Sean Anderson
2022-11-19 18:59 ` [PATCH 06/12] power: domain: ti: " Hari Nagalla
2022-11-19 18:59 ` [PATCH 07/12] ram: k3-ddrss: " Hari Nagalla
2022-11-19 18:59 ` [PATCH 08/12] soc: ti: k3-socinfo: Add entry " Hari Nagalla
2022-11-19 18:59 ` [PATCH 09/12] board: ti: j784s4: Add board support " Hari Nagalla
2022-11-21 16:01   ` Tom Rini [this message]
2022-11-19 18:59 ` [PATCH 10/12] dt-bindings: ti-serdes-mux: Add defines " Hari Nagalla
2022-11-19 18:59 ` [PATCH 11/12] configs: j784s4_evm_r5_defconfig: Add R5 specific defconfig Hari Nagalla
2022-11-19 18:59 ` [PATCH 12/12] configs: j784s4_evm_a72_defconfig: Add A72 " Hari Nagalla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221121160143.GL7282@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=a-nandan@ti.com \
    --cc=afd@ti.com \
    --cc=hnagalla@ti.com \
    --cc=jh80.chung@samsung.com \
    --cc=lukma@denx.de \
    --cc=nm@ti.com \
    --cc=seanga2@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox