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 B0C5BC433FE for ; Tue, 18 Jan 2022 07:30:57 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 547DF83834; Tue, 18 Jan 2022 08:29:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.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=ti.com header.i=@ti.com header.b="F9Wh+3Bl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 18E9883856; Tue, 18 Jan 2022 08:29:51 +0100 (CET) Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5E6DF83845 for ; Tue, 18 Jan 2022 08:29:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=a-govindraju@ti.com Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 20I7TQ9I021373; Tue, 18 Jan 2022 01:29:26 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1642490966; bh=8hYtOAjoxTa2+OTu3mXQ7oSonvEcRxVlUMt+6bikm7Q=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=F9Wh+3Blc4j5kXOXesEwSXdvWQJadplCrNe+vMduXTNaOiJiCZgj+hlNdsJNQ5mId JWgyVWXih7DfSZwl5vt5AMWe/DoZNvJKVn5jaGtCUpMo0GILDFcXwBUG3BuQLmlG2t SAE6JKXQSwndzYzqi0kppf7TQ7hNoRFu+EyLv72M= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 20I7TQjq023946 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 18 Jan 2022 01:29:26 -0600 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Tue, 18 Jan 2022 01:29:26 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14 via Frontend Transport; Tue, 18 Jan 2022 01:29:26 -0600 Received: from gsaswath-HP-ProBook-640-G5.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 20I7S7pk100474; Tue, 18 Jan 2022 01:29:20 -0600 From: Aswath Govindraju To: CC: Aswath Govindraju , Lukasz Majewski , Sean Anderson , Jaehoon Chung , Simon Glass , Fabio Estevam , Andre Przywara , Jagan Teki , Kever Yang , Tim Harvey , Christian Hewitt , Peter Robinson , Dave Gerlach , David Huang , Keerthy , Hari Nagalla , Nishanth Menon , Tero Kristo , Suman Anna , Vignesh Raghavendra , Wolfgang Denk , Kishon Vijay Abraham I , Tom Rini , Subject: [PATCH v3 11/20] board: ti: j721s2: Add board support for J721S2 Date: Tue, 18 Jan 2022 12:57:58 +0530 Message-ID: <20220118072807.11586-12-a-govindraju@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220118072807.11586-1-a-govindraju@ti.com> References: <20220118072807.11586-1-a-govindraju@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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.2 at phobos.denx.de X-Virus-Status: Clean From: David Huang Add board support for J721S2 SoC. Signed-off-by: David Huang Signed-off-by: Aswath Govindraju --- board/ti/j721s2/Kconfig | 63 +++++++++++++ board/ti/j721s2/MAINTAINERS | 16 ++++ board/ti/j721s2/Makefile | 8 ++ board/ti/j721s2/evm.c | 180 ++++++++++++++++++++++++++++++++++++ 4 files changed, 267 insertions(+) create mode 100644 board/ti/j721s2/Kconfig create mode 100644 board/ti/j721s2/MAINTAINERS create mode 100644 board/ti/j721s2/Makefile create mode 100644 board/ti/j721s2/evm.c diff --git a/board/ti/j721s2/Kconfig b/board/ti/j721s2/Kconfig new file mode 100644 index 000000000000..2e115f14171d --- /dev/null +++ b/board/ti/j721s2/Kconfig @@ -0,0 +1,63 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com/ +# David Huang + +choice + prompt "K3 J721S2 board" + optional + +config TARGET_J721S2_A72_EVM + bool "TI K3 based J721S2 EVM running on A72" + select ARM64 + select SOC_K3_J721S2 + select BOARD_LATE_INIT + imply TI_I2C_BOARD_DETECT + select SYS_DISABLE_DCACHE_OPS + +config TARGET_J721S2_R5_EVM + bool "TI K3 based J721S2 EVM running on R5" + select CPU_V7R + select SYS_THUMB_BUILD + select SOC_K3_J721S2 + select K3_LOAD_SYSFW + select RAM + select SPL_RAM + select K3_DDRSS + imply SYS_K3_SPL_ATF + imply TI_I2C_BOARD_DETECT + +endchoice + +if TARGET_J721S2_A72_EVM + +config SYS_BOARD + default "j721s2" + +config SYS_VENDOR + default "ti" + +config SYS_CONFIG_NAME + default "j721s2_evm" + +source "board/ti/common/Kconfig" + +endif + +if TARGET_J721S2_R5_EVM + +config SYS_BOARD + default "j721s2" + +config SYS_VENDOR + default "ti" + +config SYS_CONFIG_NAME + default "j721s2_evm" + +config SPL_LDSCRIPT + default "arch/arm/mach-omap2/u-boot-spl.lds" + +source "board/ti/common/Kconfig" + +endif diff --git a/board/ti/j721s2/MAINTAINERS b/board/ti/j721s2/MAINTAINERS new file mode 100644 index 000000000000..323bd2353a7e --- /dev/null +++ b/board/ti/j721s2/MAINTAINERS @@ -0,0 +1,16 @@ +J721S2 BOARD +M: Aswath Govindraju +S: Maintained +F: board/ti/j721s2 +F: include/configs/j721s2_evm.h +F: configs/j721s2_evm_r5_defconfig +F: configs/j721s2_evm_a72_defconfig +F: arch/arm/dts/k3-j721s2.dtsi +F: arch/arm/dts/k3-j721s2-main.dtsi +F: arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi +F: arch/arm/dts/k3-j721s2-som-p0.dtsi +F: arch/arm/dts/k3-j721s2-common-proc-board.dts +F: arch/arm/dts/k3-j721s2-common-proc-board-u-boot.dtsi +F: arch/arm/dts//k3-j721s2-r5-common-proc-board.dts +F: arch/arm/dts/k3-j721s2-ddr.dtsi +F: arch/arm/dts/k3-j721s2-ddr-evm-lp4-4266.dtsi diff --git a/board/ti/j721s2/Makefile b/board/ti/j721s2/Makefile new file mode 100644 index 000000000000..9dced1269942 --- /dev/null +++ b/board/ti/j721s2/Makefile @@ -0,0 +1,8 @@ +# +# Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com/ +# David Huang +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += evm.o diff --git a/board/ti/j721s2/evm.c b/board/ti/j721s2/evm.c new file mode 100644 index 000000000000..3c75ecfc0fe4 --- /dev/null +++ b/board/ti/j721s2/evm.c @@ -0,0 +1,180 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Board specific initialization for J721S2 EVM + * + * Copyright (C) 2021 Texas Instruments Incorporated - http://www.ti.com/ + * David Huang + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../common/board_detect.h" + +#define board_is_j721s2_som() board_ti_k3_is("J721S2X-PM1-SOM") + +DECLARE_GLOBAL_DATA_PTR; + +int board_init(void) +{ + return 0; +} + +int dram_init(void) +{ +#ifdef CONFIG_PHYS_64BIT + gd->ram_size = 0x100000000; +#else + gd->ram_size = 0x80000000; +#endif + + return 0; +} + +ulong board_get_usable_ram_top(ulong total_size) +{ +#ifdef CONFIG_PHYS_64BIT + /* Limit RAM used by U-Boot to the DDR low region */ + if (gd->ram_top > 0x100000000) + return 0x100000000; +#endif + + return gd->ram_top; +} + +int dram_init_banksize(void) +{ + /* Bank 0 declares the memory available in the DDR low region */ + gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; + gd->bd->bi_dram[0].size = 0x7fffffff; + gd->ram_size = 0x80000000; + +#ifdef CONFIG_PHYS_64BIT + /* Bank 1 declares the memory available in the DDR high region */ + gd->bd->bi_dram[1].start = CONFIG_SYS_SDRAM_BASE1; + gd->bd->bi_dram[1].size = 0x37fffffff; + gd->ram_size = 0x400000000; +#endif + + return 0; +} + +#ifdef CONFIG_SPL_LOAD_FIT +int board_fit_config_name_match(const char *name) +{ + if (!strcmp(name, "k3-j721s2-common-proc-board")) + 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", "J721S2X-PM1-SOM", "E1"); + else + printf("Board: %s rev %s\n", ep->name, ep->version); + + return 0; +} + +static void setup_board_eeprom_env(void) +{ + char *name = "j721s2"; + + if (do_board_detect()) + goto invalid_eeprom; + + if (board_is_j721s2_som()) + name = "j721s2"; + 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 + +int board_late_init(void) +{ + if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) { + setup_board_eeprom_env(); + setup_serial(); + } + + return 0; +} + +void spl_board_init(void) +{ +} -- 2.17.1