From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4FF1CC4332F for ; Mon, 21 Nov 2022 16:02:05 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7417E8532C; Mon, 21 Nov 2022 17:01:55 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="atTtZnDK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CFFC48535B; Mon, 21 Nov 2022 17:01:50 +0100 (CET) Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DA9A18537C for ; Mon, 21 Nov 2022 17:01:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x833.google.com with SMTP id fz10so7519128qtb.3 for ; Mon, 21 Nov 2022 08:01:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=0tFWfxTIg+5rZfzb3hn8y+G2XRh289uxJf1waBe12uU=; b=atTtZnDKx2t+dgEaj3O0QBjDKOdgWfpoY3QcmqXIIJTvQ5tVkyxArihyC2ujjQ+xVA 8Pua6MipXBQfs9NR0Jn2i2D2LtrHGFR2bG4HHoht13abB0Xomed7tHvbYoWc0qDqQlws LCa96aPsil8/EMFhtP5vhks+ydGNjHXa1pU1U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=0tFWfxTIg+5rZfzb3hn8y+G2XRh289uxJf1waBe12uU=; b=CecFxkweWRXheTqhR1ivQPgWtociKW9pKkdHe2MSjLeHh11JMBn2J7LH3RzxZOvUYi EDIMaCH9iShB1bkklExIqAA6McUqp/3vnhkOM+fYtojv0G7j7qpBrfP68o0HtvBzRpMT v7CjCKRxf5p9qm/jUjA3rOORzHQovFIMcun6jPtYDTeoGTuDXatix7uRCDD9pjclOgjJ GpUm2bCxmJWCtOrAU4Mh19wgkF7MThAgDlC7iJBHSb9SWpCSNaTWkE+7rTiejFE2kVCA WZt7ly+vcpxexpKvwdbms0ZCh4x3cVZHcS+zs3VKcSw760i3lAg3A+TmT/3ZUD7q8r6W 5a5A== X-Gm-Message-State: ANoB5plO/aWmeH2PbCalIhnUUlNynCpLDagNfBNN70NKEa1faR8lb1nx R5W8QZ94KX0GJ+WFpSNRa2XLVQ== X-Google-Smtp-Source: AA0mqf6Y4ZgJ6W6feCtwMUU5luH9iPOHHOXZDwa6tKTY/4TyfULxPZUBCm1yq8mf5K9WI3kX8Ic0qg== X-Received: by 2002:ac8:4c82:0:b0:3a6:50d6:9d88 with SMTP id j2-20020ac84c82000000b003a650d69d88mr129592qtv.466.1669046505627; Mon, 21 Nov 2022 08:01:45 -0800 (PST) Received: from bill-the-cat (2603-6081-7b00-6400-91a3-6c7b-3405-8039.res6.spectrum.com. [2603:6081:7b00:6400:91a3:6c7b:3405:8039]) by smtp.gmail.com with ESMTPSA id bs10-20020ac86f0a000000b003992448029esm6805624qtb.19.2022.11.21.08.01.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Nov 2022 08:01:45 -0800 (PST) Date: Mon, 21 Nov 2022 11:01:43 -0500 From: Tom Rini To: Hari Nagalla 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 Message-ID: <20221121160143.GL7282@bill-the-cat> References: <20221119185933.16194-1-hnagalla@ti.com> <20221119185933.16194-10-hnagalla@ti.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="pvq4FPIYehQuVelz" Content-Disposition: inline In-Reply-To: <20221119185933.16194-10-hnagalla@ti.com> X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean --pvq4FPIYehQuVelz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 19, 2022 at 12:59:30PM -0600, Hari Nagalla wrote: > Add board support for J784S4 SoC. >=20 > Signed-off-by: Hari Nagalla 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 =3D fdt_fixup_msmc_ram(blob, "/bus@100000", "sram@70000000"); > + if (ret < 0) > + ret =3D 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 =3D 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 =3D 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 =3D "j784s4"; > + > + if (do_board_detect()) > + goto invalid_eeprom; > + > + if (board_is_j784s4_evm()) > + name =3D "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 =3D TI_AM6_EEPROM_DATA; > + unsigned long board_serial; > + char *endp; > + char serial_string[17] =3D { 0 }; > + > + if (env_get("serial#")) > + return; > + > + board_serial =3D simple_strtoul(ep->serial, &endp, 16); > + if (*endp !=3D '\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. --=20 Tom --pvq4FPIYehQuVelz Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmN7oOYACgkQFHw5/5Y0 tyxt7gv+IEiL27iWDOdGfUOznbarSHVAKgAXZGN5VLtPwBm2fWf8DNlWLsvodRbB +s8uCAQ/Pivt62unlF9bYYgRwloKEQPxi2fMLIKqTjJqTR47Kqor0qrtHtzQJlFV hXEawv+THVLXK1ebM9eBRkU1T2/mnJzrNz2HXt9kakuQ6TkQHahkBtpy8agwb6gX A//JHtsrgOfnq7ZolnBaI7WNMGEba7Oldv9tRk/9hKmpDVNg1sOdApvvS4sxEpx0 Msa58t2wgWAYs6n/jegsyuUVseC5NwepQmGNj7oQR31aX2UIwuWy136hkbIQGD68 XhRxVZ56AIuBchTZoDrvaAva0qcl+Rpp6YlDx+xs9jQ039WxwxKP9EmxC2aktNIz GTXXY3DHm11EBCOqXQMQ5+PW6v7JQfZr86m66gJhwgurDjM/f4xPa1A+TlN2H1YK chDOkhu3lh5GpscMepfWrBehGWESNuUIwpYHqx1R3uAFKY/5UfgS8IAE1XvNXJSm x9Jnr/Nl =y4eK -----END PGP SIGNATURE----- --pvq4FPIYehQuVelz--