Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1469673/?format=api
{ "id": 1469673, "url": "http://patchwork.ozlabs.org/api/patches/1469673/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20210423162748.1952-3-d-gerlach@ti.com/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20210423162748.1952-3-d-gerlach@ti.com>", "list_archive_url": null, "date": "2021-04-23T16:27:33", "name": "[02/17] arm: mach-k3: am642: Add support for boot device detection", "commit_ref": "57dba04afbb7e06d3c1399bc38a2831c158ea478", "pull_url": null, "state": "accepted", "archived": false, "hash": "721d69a705c1f174177b37df16480449d37579bd", "submitter": { "id": 61863, "url": "http://patchwork.ozlabs.org/api/people/61863/?format=api", "name": "Dave Gerlach", "email": "d-gerlach@ti.com" }, "delegate": { "id": 19261, "url": "http://patchwork.ozlabs.org/api/users/19261/?format=api", "username": "lokeshvutla", "first_name": "Lokesh", "last_name": "Vutla", "email": "lokeshvutla@ti.com" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20210423162748.1952-3-d-gerlach@ti.com/mbox/", "series": [ { "id": 240546, "url": "http://patchwork.ozlabs.org/api/series/240546/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=240546", "date": "2021-04-23T16:27:34", "name": "arm: mach-k3: Initial Support for Texas Instruments AM642 Platform", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/240546/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1469673/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1469673/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<u-boot-bounces@lists.denx.de>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>)", "ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=ti.com header.i=@ti.com header.a=rsa-sha256\n header.s=ti-com-17Q1 header.b=sFmBXUEn;\n\tdkim-atps=neutral", "phobos.denx.de;\n dmarc=pass (p=quarantine dis=none) header.from=ti.com", "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de", "phobos.denx.de;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=ti.com header.i=@ti.com header.b=\"sFmBXUEn\";\n\tdkim-atps=neutral", "phobos.denx.de;\n dmarc=pass (p=quarantine dis=none) header.from=ti.com", "phobos.denx.de;\n spf=pass smtp.mailfrom=d-gerlach@ti.com" ], "Received": [ "from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4FRfsF5GG5z9sVq\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 24 Apr 2021 02:30:09 +1000 (AEST)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id B769382CF9;\n\tFri, 23 Apr 2021 18:28:45 +0200 (CEST)", "by phobos.denx.de (Postfix, from userid 109)\n id E2DC782CE6; Fri, 23 Apr 2021 18:28:14 +0200 (CEST)", "from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 2021B82CC9\n for <u-boot@lists.denx.de>; Fri, 23 Apr 2021 18:27:50 +0200 (CEST)", "from fllv0034.itg.ti.com ([10.64.40.246])\n by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 13NGRmK2014932;\n Fri, 23 Apr 2021 11:27:48 -0500", "from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41])\n by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 13NGRmq7122421\n (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL);\n Fri, 23 Apr 2021 11:27:48 -0500", "from DLEE113.ent.ti.com (157.170.170.24) by DLEE109.ent.ti.com\n (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Fri, 23\n Apr 2021 11:27:48 -0500", "from lelv0326.itg.ti.com (10.180.67.84) by DLEE113.ent.ti.com\n (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2 via\n Frontend Transport; Fri, 23 Apr 2021 11:27:48 -0500", "from localhost (ileax41-snat.itg.ti.com [10.172.224.153])\n by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 13NGRmKd056735;\n Fri, 23 Apr 2021 11:27:48 -0500" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,\n DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham\n autolearn_force=no version=3.4.2", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com;\n s=ti-com-17Q1; t=1619195268;\n bh=2uJfGyhEi73+sXN4A54i3+CQcFWSH0Se52oA6I19WyU=;\n h=From:To:CC:Subject:Date:In-Reply-To:References;\n b=sFmBXUEnoA+YvOWwJbT5rj0jy3VLyNrP8SXagUdRu7BTb40rsB2Utd9pzBdm/xbl8\n q8AacB3SPtEh8ES9qKVsRx0p9cb6a/77xJgz3r68/gXT2yVX4AUYeJWRTKB4fegUMz\n HI5YoVSGDL42rarEVNnW2UKIzxTNhfjyw+TT9dZo=", "From": "Dave Gerlach <d-gerlach@ti.com>", "To": "<u-boot@lists.denx.de>, Lokesh Vutla <lokeshvutla@ti.com>, Tom Rini\n <trini@konsulko.com>", "CC": "Praneeth Bajjuri <praneeth@ti.com>, Dave Gerlach <d-gerlach@ti.com>,\n Keerthy J <j-keerthy@ti.com>, Suman Anna <s-anna@ti.com>", "Subject": "[PATCH 02/17] arm: mach-k3: am642: Add support for boot device\n detection", "Date": "Fri, 23 Apr 2021 11:27:33 -0500", "Message-ID": "<20210423162748.1952-3-d-gerlach@ti.com>", "X-Mailer": "git-send-email 2.28.0", "In-Reply-To": "<20210423162748.1952-1-d-gerlach@ti.com>", "References": "<20210423162748.1952-1-d-gerlach@ti.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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.34", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<https://lists.denx.de/pipermail/u-boot/>", "List-Post": "<mailto:u-boot@lists.denx.de>", "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>", "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>", "X-Virus-Scanned": "clamav-milter 0.102.4 at phobos.denx.de", "X-Virus-Status": "Clean" }, "content": "From: Keerthy <j-keerthy@ti.com>\n\nAM642 allows for booting from primary or backup boot media.\nBoth media can be chosen individually based on switch settings.\nROM looks for a valid image in primary boot media, if not found\nthen looks in backup boot media. In order to pass this boot media\ninformation to boot loader, ROM stores a value at a particular\naddress. Add support for reading this information and determining\nthe boot media correctly.\n\nSigned-off-by: Keerthy <j-keerthy@ti.com>\nSigned-off-by: Dave Gerlach <d-gerlach@ti.com>\n---\n arch/arm/mach-k3/am642_init.c | 98 +++++++++++++++++++\n arch/arm/mach-k3/include/mach/am64_hardware.h | 48 +++++++++\n arch/arm/mach-k3/include/mach/am64_spl.h | 44 +++++++++\n arch/arm/mach-k3/include/mach/hardware.h | 4 +\n arch/arm/mach-k3/include/mach/spl.h | 4 +\n 5 files changed, 198 insertions(+)\n create mode 100644 arch/arm/mach-k3/include/mach/am64_hardware.h\n create mode 100644 arch/arm/mach-k3/include/mach/am64_spl.h", "diff": "diff --git a/arch/arm/mach-k3/am642_init.c b/arch/arm/mach-k3/am642_init.c\nindex e73450da41da..e63275ccc68f 100644\n--- a/arch/arm/mach-k3/am642_init.c\n+++ b/arch/arm/mach-k3/am642_init.c\n@@ -10,6 +10,7 @@\n #include <common.h>\n #include <spl.h>\n #include <asm/io.h>\n+#include <asm/arch/hardware.h>\n #include \"common.h\"\n \n #if defined(CONFIG_SPL_BUILD)\n@@ -25,4 +26,101 @@ void board_init_f(ulong dummy)\n \n \tpreloader_console_init();\n }\n+\n+u32 spl_boot_mode(const u32 boot_device)\n+{\n+\tswitch (boot_device) {\n+\tcase BOOT_DEVICE_MMC1:\n+\t\treturn MMCSD_MODE_EMMCBOOT;\n+\n+\tcase BOOT_DEVICE_MMC2:\n+\t\treturn MMCSD_MODE_FS;\n+\n+\tdefault:\n+\t\treturn MMCSD_MODE_RAW;\n+\t}\n+}\n+\n+static u32 __get_backup_bootmedia(u32 main_devstat)\n+{\n+\tu32 bkup_bootmode =\n+\t (main_devstat & MAIN_DEVSTAT_BACKUP_BOOTMODE_MASK) >>\n+\t MAIN_DEVSTAT_BACKUP_BOOTMODE_SHIFT;\n+\tu32 bkup_bootmode_cfg =\n+\t (main_devstat & MAIN_DEVSTAT_BACKUP_BOOTMODE_CFG_MASK) >>\n+\t MAIN_DEVSTAT_BACKUP_BOOTMODE_CFG_SHIFT;\n+\n+\tswitch (bkup_bootmode) {\n+\tcase BACKUP_BOOT_DEVICE_UART:\n+\t\treturn BOOT_DEVICE_UART;\n+\n+\tcase BACKUP_BOOT_DEVICE_USB:\n+\t\treturn BOOT_DEVICE_USB;\n+\n+\tcase BACKUP_BOOT_DEVICE_ETHERNET:\n+\t\treturn BOOT_DEVICE_ETHERNET;\n+\n+\tcase BACKUP_BOOT_DEVICE_MMC:\n+\t\tif (bkup_bootmode_cfg)\n+\t\t\treturn BOOT_DEVICE_MMC2;\n+\t\treturn BOOT_DEVICE_MMC1;\n+\n+\tcase BACKUP_BOOT_DEVICE_SPI:\n+\t\treturn BOOT_DEVICE_SPI;\n+\n+\tcase BACKUP_BOOT_DEVICE_I2C:\n+\t\treturn BOOT_DEVICE_I2C;\n+\t};\n+\n+\treturn BOOT_DEVICE_RAM;\n+}\n+\n+static u32 __get_primary_bootmedia(u32 main_devstat)\n+{\n+\tu32 bootmode = (main_devstat & MAIN_DEVSTAT_PRIMARY_BOOTMODE_MASK) >>\n+\t MAIN_DEVSTAT_PRIMARY_BOOTMODE_SHIFT;\n+\tu32 bootmode_cfg =\n+\t (main_devstat & MAIN_DEVSTAT_PRIMARY_BOOTMODE_CFG_MASK) >>\n+\t MAIN_DEVSTAT_PRIMARY_BOOTMODE_CFG_SHIFT;\n+\n+\tswitch (bootmode) {\n+\tcase BOOT_DEVICE_OSPI:\n+\t\tfallthrough;\n+\tcase BOOT_DEVICE_QSPI:\n+\t\tfallthrough;\n+\tcase BOOT_DEVICE_XSPI:\n+\t\tfallthrough;\n+\tcase BOOT_DEVICE_SPI:\n+\t\treturn BOOT_DEVICE_SPI;\n+\n+\tcase BOOT_DEVICE_ETHERNET_RGMII:\n+\t\tfallthrough;\n+\tcase BOOT_DEVICE_ETHERNET_RMII:\n+\t\treturn BOOT_DEVICE_ETHERNET;\n+\n+\tcase BOOT_DEVICE_EMMC:\n+\t\treturn BOOT_DEVICE_MMC1;\n+\n+\tcase BOOT_DEVICE_MMC:\n+\t\tif ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK) >>\n+\t\t MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT)\n+\t\t\treturn BOOT_DEVICE_MMC2;\n+\t\treturn BOOT_DEVICE_MMC1;\n+\n+\tcase BOOT_DEVICE_NOBOOT:\n+\t\treturn BOOT_DEVICE_RAM;\n+\t}\n+\n+\treturn bootmode;\n+}\n+\n+u32 spl_boot_device(void)\n+{\n+\tu32 devstat = readl(CTRLMMR_MAIN_DEVSTAT);\n+\n+\tif (bootindex == K3_PRIMARY_BOOTMODE)\n+\t\treturn __get_primary_bootmedia(devstat);\n+\telse\n+\t\treturn __get_backup_bootmedia(devstat);\n+}\n #endif\ndiff --git a/arch/arm/mach-k3/include/mach/am64_hardware.h b/arch/arm/mach-k3/include/mach/am64_hardware.h\nnew file mode 100644\nindex 000000000000..8136585bde6f\n--- /dev/null\n+++ b/arch/arm/mach-k3/include/mach/am64_hardware.h\n@@ -0,0 +1,48 @@\n+/* SPDX-License-Identifier: GPL-2.0+ */\n+/*\n+ * K3: AM64 SoC definitions, structures etc.\n+ *\n+ * (C) Copyright (C) 2020-2021 Texas Instruments Incorporated - https://www.ti.com/\n+ */\n+#ifndef __ASM_ARCH_AM64_HARDWARE_H\n+#define __ASM_ARCH_AM64_HARDWARE_H\n+\n+#include <config.h>\n+\n+#define CTRL_MMR0_BASE\t\t\t\t\t0x43000000\n+#define CTRLMMR_MAIN_DEVSTAT\t\t\t\t(CTRL_MMR0_BASE + 0x30)\n+\n+#define MAIN_DEVSTAT_PRIMARY_BOOTMODE_MASK\t\t0x00000078\n+#define MAIN_DEVSTAT_PRIMARY_BOOTMODE_SHIFT\t\t3\n+\n+#define MAIN_DEVSTAT_PRIMARY_BOOTMODE_CFG_MASK\t\t0x00000380\n+#define MAIN_DEVSTAT_PRIMARY_BOOTMODE_CFG_SHIFT\t\t7\n+\n+#define MAIN_DEVSTAT_BACKUP_BOOTMODE_MASK\t\t0x00001c00\n+#define MAIN_DEVSTAT_BACKUP_BOOTMODE_SHIFT\t\t10\n+\n+#define MAIN_DEVSTAT_BACKUP_BOOTMODE_CFG_MASK\t\t0x00002000\n+#define MAIN_DEVSTAT_BACKUP_BOOTMODE_CFG_SHIFT\t\t13\n+\n+/* After the cfg mask and shifts have been applied */\n+#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT\t\t2\n+#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK\t\t0x04\n+\n+/*\n+ * The CTRL_MMR memory space is divided into several equally-spaced\n+ * partitions, so defining the partition size allows us to determine\n+ * register addresses common to those partitions.\n+ */\n+#define CTRL_MMR0_PARTITION_SIZE\t\t\t0x4000\n+\n+/*\n+ * CTRL_MMR lock/kick-mechanism shared register definitions.\n+ */\n+#define CTRLMMR_LOCK_KICK0\t\t\t\t0x01008\n+#define CTRLMMR_LOCK_KICK0_UNLOCK_VAL\t\t\t0x68ef3490\n+#define CTRLMMR_LOCK_KICK0_UNLOCKED_MASK\t\tBIT(0)\n+#define CTRLMMR_LOCK_KICK0_UNLOCKED_SHIFT\t\t0\n+#define CTRLMMR_LOCK_KICK1\t\t\t\t0x0100c\n+#define CTRLMMR_LOCK_KICK1_UNLOCK_VAL\t\t\t0xd172bc5a\n+\n+#endif /* __ASM_ARCH_DRA8_HARDWARE_H */\ndiff --git a/arch/arm/mach-k3/include/mach/am64_spl.h b/arch/arm/mach-k3/include/mach/am64_spl.h\nnew file mode 100644\nindex 000000000000..a3de4e70fc3f\n--- /dev/null\n+++ b/arch/arm/mach-k3/include/mach/am64_spl.h\n@@ -0,0 +1,44 @@\n+/* SPDX-License-Identifier: GPL-2.0+ */\n+/*\n+ * Copyright (C) 2020-2021 Texas Instruments Incorporated - https://www.ti.com/\n+ *\tKeerthy <j-keerthy@ti.com>\n+ */\n+#ifndef _ASM_ARCH_AM64_SPL_H_\n+#define _ASM_ARCH_AM64_SPL_H_\n+\n+/* Primary BootMode devices */\n+#define BOOT_DEVICE_RAM\t\t\t0x00\n+#define BOOT_DEVICE_OSPI\t\t0x01\n+#define BOOT_DEVICE_QSPI\t\t0x02\n+#define BOOT_DEVICE_SPI\t\t\t0x03\n+#define BOOT_DEVICE_ETHERNET\t\t0x04\n+#define BOOT_DEVICE_ETHERNET_RGMII\t0x04\n+#define BOOT_DEVICE_ETHERNET_RMII\t0x05\n+#define BOOT_DEVICE_I2C\t\t\t0x06\n+#define BOOT_DEVICE_UART\t\t0x07\n+#define BOOT_DEVICE_MMC\t\t\t0x08\n+#define BOOT_DEVICE_EMMC\t\t0x09\n+\n+#define BOOT_DEVICE_USB\t\t\t0x0A\n+#define BOOT_DEVICE_GPMC_NOR\t\t0x0C\n+#define BOOT_DEVICE_PCIE\t\t0x0D\n+#define BOOT_DEVICE_XSPI\t\t0x0E\n+\n+#define BOOT_DEVICE_NOBOOT\t\t0x0F\n+\n+#define BOOT_DEVICE_MMC2\t\t0x08\n+#define BOOT_DEVICE_MMC1\t\t0x09\n+/* INVALID */\n+#define BOOT_DEVICE_MMC2_2\t\t0x1F\n+\n+/* Backup BootMode devices */\n+#define BACKUP_BOOT_DEVICE_USB\t\t0x01\n+#define BACKUP_BOOT_DEVICE_UART\t\t0x03\n+#define BACKUP_BOOT_DEVICE_ETHERNET\t0x04\n+#define BACKUP_BOOT_DEVICE_MMC\t\t0x05\n+#define BACKUP_BOOT_DEVICE_SPI\t\t0x06\n+#define BACKUP_BOOT_DEVICE_I2C\t\t0x07\n+\n+#define K3_PRIMARY_BOOTMODE\t\t0x0\n+\n+#endif\ndiff --git a/arch/arm/mach-k3/include/mach/hardware.h b/arch/arm/mach-k3/include/mach/hardware.h\nindex 02b3df0e1b78..8725e7d51a5b 100644\n--- a/arch/arm/mach-k3/include/mach/hardware.h\n+++ b/arch/arm/mach-k3/include/mach/hardware.h\n@@ -14,6 +14,10 @@\n #include \"j721e_hardware.h\"\n #endif\n \n+#ifdef CONFIG_SOC_K3_AM642\n+#include \"am64_hardware.h\"\n+#endif\n+\n /* Assuming these addresses and definitions stay common across K3 devices */\n #define CTRLMMR_WKUP_JTAG_ID\t0x43000014\n #define JTAG_ID_VARIANT_SHIFT\t28\ndiff --git a/arch/arm/mach-k3/include/mach/spl.h b/arch/arm/mach-k3/include/mach/spl.h\nindex a26c8ecdd5bd..ef1c3fb8cae6 100644\n--- a/arch/arm/mach-k3/include/mach/spl.h\n+++ b/arch/arm/mach-k3/include/mach/spl.h\n@@ -13,4 +13,8 @@\n #ifdef CONFIG_SOC_K3_J721E\n #include \"j721e_spl.h\"\n #endif\n+\n+#ifdef CONFIG_SOC_K3_AM642\n+#include \"am64_spl.h\"\n+#endif\n #endif /* _ASM_ARCH_SPL_H_ */\n", "prefixes": [ "02/17" ] }