From patchwork Mon May 6 14:38:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martyn Welch X-Patchwork-Id: 1932036 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=3EH2YxSg; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VY3vV3t34z1ydW for ; Tue, 7 May 2024 00:39:18 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F131F882F1; Mon, 6 May 2024 16:39:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="3EH2YxSg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B1E9B88607; Mon, 6 May 2024 16:39:04 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [IPv6:2a00:1098:ed:100::25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AF941885B5 for ; Mon, 6 May 2024 16:39:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=martyn.welch@collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1715006342; bh=aXGe72gn/JrE68sEfWtH1zBFaulcIetmUmQm5i/YQ7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=3EH2YxSgIDoL9pJkUvA6glLXu3MsfObZc06gJUv304PHbbNUYACstffOw5MM8iq+u ijyVjzpDwGjFq1GBnq5UQJWOWVtIZCblxrg643xsz0+6NZJaq/LYA6m6w0j0/yfnrq GUmRxItqZHhtp2CoXbAbN80P+z3W+ZurS9u9fXJW3egnSGOQzmNcWmA62zL9OAcbTa p/dQnwQcB3fpIBrH1beYSxQFSJ+hoZITupaEMx15OPZOb1zxfeRvt+gJZ9UYJY1uwd ZsaV9cxUYZsILp91ebFpO/S/trcNW3gFq18f8G8UMOxvXv/isTHAHDb7VSAajRgLeW HKq2Dx2RGYblA== Received: from pan.lan (ec2-34-240-57-77.eu-west-1.compute.amazonaws.com [34.240.57.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: martyn) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 840FC3782134; Mon, 6 May 2024 14:39:01 +0000 (UTC) From: Martyn Welch To: Dave Gerlach , Tom Rini , Nishanth Menon , Robert Nelson Cc: Sjoerd Simons , Alexander Sverdlin , Mattijs Korpershoek , Martyn Welch , u-boot@lists.denx.de Subject: [PATCH v5 1/6] usb: dwc3: Add dwc3 glue driver for am62 Date: Mon, 6 May 2024 15:38:41 +0100 Message-ID: <20240506143846.1252377-2-martyn.welch@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240506143846.1252377-1-martyn.welch@collabora.com> References: <20240506143846.1252377-1-martyn.welch@collabora.com> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean From: Sjoerd Simons Add glue code for TI AM62 to the dwc3 driver; Most code adopted from TI vendor u-boot code. Signed-off-by: Sjoerd Simons Tested-by: Alexander Sverdlin Reviewed-by: Mattijs Korpershoek Tested-by: Mattijs Korpershoek # on beagle play --- Changes in v5: - No change Changes in v4: - Add config dependency on SYSCON - Move defines and constants outside out of function scope Changes in v2: - Switch dwc3 glue to a seperate driver rather then in dwc-generic drivers/usb/dwc3/Kconfig | 14 ++++ drivers/usb/dwc3/Makefile | 1 + drivers/usb/dwc3/dwc3-am62.c | 125 +++++++++++++++++++++++++++++++++++ 3 files changed, 140 insertions(+) create mode 100644 drivers/usb/dwc3/dwc3-am62.c diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig index c0c8c16fd9..0100723a68 100644 --- a/drivers/usb/dwc3/Kconfig +++ b/drivers/usb/dwc3/Kconfig @@ -37,6 +37,20 @@ config SPL_USB_DWC3_GENERIC Select this for Xilinx ZynqMP and similar Platforms. This wrapper supports Host and Peripheral operation modes. +config SPL_USB_DWC3_AM62 + bool "TI AM62 USB wrapper" + depends on SPL_DM_USB && SPL_USB_DWC3_GENERIC && SPL_SYSCON + help + Select this for TI AM62 Platforms. + This wrapper supports Host and Peripheral operation modes. + +config USB_DWC3_AM62 + bool "TI AM62 USB wrapper" + depends on DM_USB && USB_DWC3_GENERIC && SYSCON + help + Select this for TI AM62 Platforms. + This wrapper supports Host and Peripheral operation modes. + config USB_DWC3_MESON_G12A bool "Amlogic Meson G12A USB wrapper" depends on DM_USB && USB_DWC3 && ARCH_MESON diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile index 97b4f7191c..a46b6824ab 100644 --- a/drivers/usb/dwc3/Makefile +++ b/drivers/usb/dwc3/Makefile @@ -6,6 +6,7 @@ dwc3-y := core.o obj-$(CONFIG_USB_DWC3_GADGET) += gadget.o ep0.o +obj-$(CONFIG_$(SPL_)USB_DWC3_AM62) += dwc3-am62.o obj-$(CONFIG_USB_DWC3_OMAP) += dwc3-omap.o obj-$(CONFIG_USB_DWC3_MESON_G12A) += dwc3-meson-g12a.o obj-$(CONFIG_USB_DWC3_MESON_GXL) += dwc3-meson-gxl.o diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c new file mode 100644 index 0000000000..99519602eb --- /dev/null +++ b/drivers/usb/dwc3/dwc3-am62.c @@ -0,0 +1,125 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * TI AM62 specific glue layer for DWC3 + */ + +#include +#include +#include +#include +#include + +#include "dwc3-generic.h" + +#define USBSS_MODE_CONTROL 0x1c +#define USBSS_PHY_CONFIG 0x8 +#define USBSS_PHY_VBUS_SEL_MASK GENMASK(2, 1) +#define USBSS_PHY_VBUS_SEL_SHIFT 1 +#define USBSS_MODE_VALID BIT(0) +#define PHY_PLL_REFCLK_MASK GENMASK(3, 0) +static const int dwc3_ti_am62_rate_table[] = { /* in KHZ */ + 9600, + 10000, + 12000, + 19200, + 20000, + 24000, + 25000, + 26000, + 38400, + 40000, + 58000, + 50000, + 52000, +}; + +static void dwc3_ti_am62_glue_configure(struct udevice *dev, int index, + enum usb_dr_mode mode) +{ + struct clk usb2_refclk; + int rate_code, i, ret; + unsigned long rate; + u32 reg; + void *usbss; + bool vbus_divider; + struct regmap *syscon; + struct ofnode_phandle_args args; + + usbss = dev_remap_addr_index(dev, 0); + if (IS_ERR(usbss)) { + dev_err(dev, "can't map IOMEM resource\n"); + return; + } + + ret = clk_get_by_name(dev, "ref", &usb2_refclk); + if (ret) { + dev_err(dev, "can't get usb2_refclk\n"); + return; + } + + /* Calculate the rate code */ + rate = clk_get_rate(&usb2_refclk); + rate /= 1000; /* To KHz */ + for (i = 0; i < ARRAY_SIZE(dwc3_ti_am62_rate_table); i++) { + if (dwc3_ti_am62_rate_table[i] == rate) + break; + } + + if (i == ARRAY_SIZE(dwc3_ti_am62_rate_table)) { + dev_err(dev, "unsupported usb2_refclk rate: %lu KHz\n", rate); + return; + } + + rate_code = i; + + /* Read the syscon property */ + syscon = syscon_regmap_lookup_by_phandle(dev, "ti,syscon-phy-pll-refclk"); + if (IS_ERR(syscon)) { + dev_err(dev, "unable to get ti,syscon-phy-pll-refclk regmap\n"); + return; + } + + ret = ofnode_parse_phandle_with_args(dev_ofnode(dev), "ti,syscon-phy-pll-refclk", NULL, 1, + 0, &args); + if (ret) + return; + + /* Program PHY PLL refclk by reading syscon property */ + ret = regmap_update_bits(syscon, args.args[0], PHY_PLL_REFCLK_MASK, rate_code); + if (ret) { + dev_err(dev, "failed to set phy pll reference clock rate\n"); + return; + } + + /* VBUS divider select */ + reg = readl(usbss + USBSS_PHY_CONFIG); + vbus_divider = dev_read_bool(dev, "ti,vbus-divider"); + if (vbus_divider) + reg |= 1 << USBSS_PHY_VBUS_SEL_SHIFT; + + writel(reg, usbss + USBSS_PHY_CONFIG); + + /* Set mode valid */ + reg = readl(usbss + USBSS_MODE_CONTROL); + reg |= USBSS_MODE_VALID; + writel(reg, usbss + USBSS_MODE_CONTROL); +} + +struct dwc3_glue_ops ti_am62_ops = { + .glue_configure = dwc3_ti_am62_glue_configure, +}; + +static const struct udevice_id dwc3_am62_match[] = { + { .compatible = "ti,am62-usb", .data = (ulong)&ti_am62_ops }, + { /* sentinel */ } +}; + +U_BOOT_DRIVER(dwc3_am62_wrapper) = { + .name = "dwc3-am62", + .id = UCLASS_SIMPLE_BUS, + .of_match = dwc3_am62_match, + .bind = dwc3_glue_bind, + .probe = dwc3_glue_probe, + .remove = dwc3_glue_remove, + .plat_auto = sizeof(struct dwc3_glue_data), +}; From patchwork Mon May 6 14:38:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martyn Welch X-Patchwork-Id: 1932037 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=swwK3YRl; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VY3vk0HTyz1ydW for ; Tue, 7 May 2024 00:39:30 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6953E88607; Mon, 6 May 2024 16:39:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="swwK3YRl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B61CE885D8; Mon, 6 May 2024 16:39:05 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5A33E885D8 for ; Mon, 6 May 2024 16:39:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=martyn.welch@collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1715006343; bh=QgT/TFKCj7ZLx/2Ltv+VhpOvxZOjtNJLgYz82PiQKu4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=swwK3YRlRy1Jp4Qwgv7+pB06JC37F2L03MYMkl+aTUoStmgu/XU/3n+ZrslbMrUCy rRB4kJuZ5653wz/9z9pVYXI2r1jPlefLsLyBc3GyUZYFga7Lt4U/rXJkHK80rb/mEN BSRWq009Z8/FOLIeTBol0UoWArC4Dtzu72Flnao9gLy+h4dIklQj0JXFnwV3lln1SK j0jMVoBbXQiX0DI7GCkEbO8PBK7ZZOuCWij+Hog4tEDYwmz98LgEtbLjeRm8ah4Efy rTuX/imWX8t5GeipfOekgyZTSmZutakEskAsam+ldbojpS5MfRHa1AJkJbQHWzOIfy 4y454/fxK/ZDA== Received: from pan.lan (ec2-34-240-57-77.eu-west-1.compute.amazonaws.com [34.240.57.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: martyn) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 888483782139; Mon, 6 May 2024 14:39:02 +0000 (UTC) From: Martyn Welch To: Dave Gerlach , Tom Rini , Nishanth Menon , Robert Nelson Cc: Sjoerd Simons , Alexander Sverdlin , Mattijs Korpershoek , Martyn Welch , u-boot@lists.denx.de Subject: [PATCH v5 2/6] board: ti: am62x: am62x: include env for DFU Date: Mon, 6 May 2024 15:38:42 +0100 Message-ID: <20240506143846.1252377-3-martyn.welch@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240506143846.1252377-1-martyn.welch@collabora.com> References: <20240506143846.1252377-1-martyn.welch@collabora.com> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean From: Sjoerd Simons Include standard TI K3 dfu environment Signed-off-by: Sjoerd Simons Reviewed-by: Alexander Sverdlin Reviewed-by: Mattijs Korpershoek Tested-by: Mattijs Korpershoek # on beagle play --- (no changes since v3) Changes in v3: - Add dfu via environment rather then config headers Changes in v2: - Minimize config changes to just DFU configuration board/ti/am62x/am62x.env | 1 + 1 file changed, 1 insertion(+) diff --git a/board/ti/am62x/am62x.env b/board/ti/am62x/am62x.env index 9cb186c2a0..09b9b16a3e 100644 --- a/board/ti/am62x/am62x.env +++ b/board/ti/am62x/am62x.env @@ -1,5 +1,6 @@ #include #include +#include name_kern=Image console=ttyS2,115200n8 From patchwork Mon May 6 14:38:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martyn Welch X-Patchwork-Id: 1932038 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=Du6wyN5Q; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VY3w04hs7z1ydW for ; Tue, 7 May 2024 00:39:44 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CBA5A88616; Mon, 6 May 2024 16:39:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="Du6wyN5Q"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ED54D885E3; Mon, 6 May 2024 16:39:05 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [IPv6:2a00:1098:ed:100::25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 13F4987EDC for ; Mon, 6 May 2024 16:39:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=martyn.welch@collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1715006343; bh=/6tAP1AY4HJSN6Wi3r7drHvLJih7ShAEojUmWF7vFw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Du6wyN5QXfmFyVznZYygeb4ElAxvrmDCTStewS5ItmhFUEnZfqMYadMORpRfIsn9L 8K2SJH69Omq5NxURAt0Oc/Ox+XbPASjnIfNTlLyGGpckBTn1AM26qZPNWSDbG+rIaC buPWeEcNLRk3097mT2Q2YpWyeLh33hWttOJrm/iKVsgSB5vTPaFss5eiV07A1u1I0O XHYAgxxiyhtKYcOVBLPHgjlavo4H7Tpo2OpNbr5pM82GxzdXM6rfkVl1mnPfNL68Sp dUnvo04Mk33sSwnnZG2H5pd1+9nuOFIhVTHrMYIS+UCFyazpmbiMQLcLpayG4NFJR5 pNsKO/1Ic1WxQ== Received: from pan.lan (ec2-34-240-57-77.eu-west-1.compute.amazonaws.com [34.240.57.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: martyn) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 41F003782140; Mon, 6 May 2024 14:39:03 +0000 (UTC) From: Martyn Welch To: Dave Gerlach , Tom Rini , Nishanth Menon , Robert Nelson Cc: Sjoerd Simons , Alexander Sverdlin , Mattijs Korpershoek , Martyn Welch , u-boot@lists.denx.de Subject: [PATCH v5 3/6] arm: dts: k3-am625-sk: Enable usb port in u-boot Date: Mon, 6 May 2024 15:38:43 +0100 Message-ID: <20240506143846.1252377-4-martyn.welch@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240506143846.1252377-1-martyn.welch@collabora.com> References: <20240506143846.1252377-1-martyn.welch@collabora.com> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean From: Sjoerd Simons Enable usb0 in all boot phases for use with DFU Signed-off-by: Sjoerd Simons Reviewed-by: Alexander Sverdlin Signed-off-by: Martyn Welch Reviewed-by: Mattijs Korpershoek --- Changes in v5: - Forcing usb0 into peripheral mode reinstated Changes in v4: - Don't force usb0 into peripheral mode Changes in v3: - Enable usb nodes in all boot phases Changes in v2: - Only enable usb port 0 DFU in SPL arch/arm/dts/k3-am625-sk-u-boot.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/dts/k3-am625-sk-u-boot.dtsi b/arch/arm/dts/k3-am625-sk-u-boot.dtsi index fa778b0ff4..1fc0d407cb 100644 --- a/arch/arm/dts/k3-am625-sk-u-boot.dtsi +++ b/arch/arm/dts/k3-am625-sk-u-boot.dtsi @@ -46,3 +46,12 @@ &cpsw_port2 { status = "disabled"; }; + +&usbss0 { + bootph-all; +}; + +&usb0 { + dr_mode = "peripheral"; + bootph-all; +}; From patchwork Mon May 6 14:38:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martyn Welch X-Patchwork-Id: 1932039 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=qBiSqqd4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VY3w8289Lz1ydW for ; Tue, 7 May 2024 00:39:52 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3AC9088622; Mon, 6 May 2024 16:39:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="qBiSqqd4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BCDEF88629; Mon, 6 May 2024 16:39:06 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C731E885B5 for ; Mon, 6 May 2024 16:39:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=martyn.welch@collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1715006344; bh=RE73Mn6Do3+kjc+AR5sq4tWMvLBmml1dnHQgv88B3U0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qBiSqqd4EeetZB27u6J00jOBZtn33cy234zOFOFw2a9bpqJalarjmWn/r9y5ph0Ir oY4Pe4PwdBhPieuFFFXVGgnz192hP7QcFPoyoT0qr+T0TalpovX0I250ItTzoy3Xxm AvxEVm64K9Ijsxc9IBH+ImMkJYWhDr39CHsurgW071lJt89GuM0EbTQVDIJqV8ZR3t yLpH2WsXsO0jIN/hKE5SCBeUOYDQpQaa8RAaucllJHeY12mT32TYZErSWnUMounJqo wLAcYG6jBwUFr3N3yl851GpLdErKmZLaPfMtL8lWnCOF3MQt5FpgSjowSMF224DYv9 pryFkMiNLES6A== Received: from pan.lan (ec2-34-240-57-77.eu-west-1.compute.amazonaws.com [34.240.57.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: martyn) by madrid.collaboradmins.com (Postfix) with ESMTPSA id F0142378215D; Mon, 6 May 2024 14:39:03 +0000 (UTC) From: Martyn Welch To: Dave Gerlach , Tom Rini , Nishanth Menon , Robert Nelson Cc: Sjoerd Simons , Alexander Sverdlin , Mattijs Korpershoek , Martyn Welch , u-boot@lists.denx.de Subject: [PATCH v5 4/6] configs: am62x_evm_*: Enable USB and DFU support Date: Mon, 6 May 2024 15:38:44 +0100 Message-ID: <20240506143846.1252377-5-martyn.welch@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240506143846.1252377-1-martyn.welch@collabora.com> References: <20240506143846.1252377-1-martyn.welch@collabora.com> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean From: Sjoerd Simons Provide config fragments to enable USB host as well as USB gadget and DFU support for a53 and r5. This relevant fragment is included into the am62x EVM a53 defconfig. For the r5, due to the smaller available size, the config fragment also disables support for persistent storage to free up space for USB support. This fragment needs to be included is DFU booting is desired. The CONFIG_DFU_SF option is placed in the defconfig rather than the fragment as this is known not to be supported on all boards that can support DFU. Signed-off-by: Sjoerd Simons Signed-off-by: Martyn Welch Reviewed-by: Mattijs Korpershoek --- Changes in v5: - Switch to config fragment for a53 most DFU configuration Changes in v4: - Move R5 dfu config to a config fragment rather then a full defconfig - Don't enable XHCI for the R5 SPL, unneeded Changes in v3: - Run savedefconfig to adjust to more recent u-boot Changes in v2: - Create a seperate defconfig for R5 configs/am62x_a53_usbdfu.config | 30 ++++++++++++++++++++++++++++++ configs/am62x_evm_a53_defconfig | 2 ++ configs/am62x_r5_usbdfu.config | 28 ++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 configs/am62x_a53_usbdfu.config create mode 100644 configs/am62x_r5_usbdfu.config diff --git a/configs/am62x_a53_usbdfu.config b/configs/am62x_a53_usbdfu.config new file mode 100644 index 0000000000..3a19cf2328 --- /dev/null +++ b/configs/am62x_a53_usbdfu.config @@ -0,0 +1,29 @@ +CONFIG_SYS_MALLOC_LEN=0x2000000 +CONFIG_SPL_ENV_SUPPORT=y +CONFIG_SPL_RAM_SUPPORT=y +CONFIG_SPL_RAM_DEVICE=y +CONFIG_SPL_USB_GADGET=y +CONFIG_SPL_DFU=y +CONFIG_CMD_DFU=y +CONFIG_CMD_USB=y +CONFIG_SYSCON=y +CONFIG_SPL_SYSCON=y +CONFIG_DFU_MMC=y +CONFIG_DFU_RAM=y +CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000 +CONFIG_SYS_DFU_MAX_FILE_SIZE=0x800000 +CONFIG_USB=y +CONFIG_DM_USB_GADGET=y +CONFIG_SPL_DM_USB_GADGET=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_DWC3=y +CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_GENERIC=y +CONFIG_SPL_USB_DWC3_GENERIC=y +CONFIG_SPL_USB_DWC3_AM62=y +CONFIG_USB_DWC3_AM62=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments" +CONFIG_USB_GADGET_VENDOR_NUM=0x0451 +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165 +CONFIG_USB_GADGET_DOWNLOAD=y diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig index 6c708dcb05..16294a6a79 100644 --- a/configs/am62x_evm_a53_defconfig +++ b/configs/am62x_evm_a53_defconfig @@ -68,6 +68,7 @@ CONFIG_SPL_OF_TRANSLATE=y CONFIG_CLK=y CONFIG_SPL_CLK=y CONFIG_CLK_TI_SCI=y +CONFIG_DFU_SF=y CONFIG_DMA_CHANNELS=y CONFIG_TI_K3_NAVSS_UDMA=y CONFIG_TI_SCI_PROTOCOL=y @@ -111,3 +112,5 @@ CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_TI_SCI=y CONFIG_FS_FAT_MAX_CLUSTSIZE=16384 CONFIG_EFI_SET_TIME=y + +#include diff --git a/configs/am62x_r5_usbdfu.config b/configs/am62x_r5_usbdfu.config new file mode 100644 index 0000000000..772bb2ab93 --- /dev/null +++ b/configs/am62x_r5_usbdfu.config @@ -0,0 +1,28 @@ +CONFIG_SPL_ENV_SUPPORT=y +CONFIG_SYSCON=y +CONFIG_SPL_SYSCON=y +CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000 +CONFIG_MISC=y +CONFIG_USB=y +CONFIG_DM_USB_GADGET=y +CONFIG_SPL_DM_USB_GADGET=y +CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_GENERIC=y +CONFIG_SPL_USB_DWC3_GENERIC=y +CONFIG_SPL_USB_DWC3_AM62=y +CONFIG_USB_GADGET=y +CONFIG_SPL_USB_GADGET=y +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments" +CONFIG_USB_GADGET_VENDOR_NUM=0x0451 +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165 +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_SPL_DFU=y +# CONFIG_SPL_MMC is not set +# CONFIG_SPL_FS_FAT is not set +# CONFIG_SPL_LIBDISK_SUPPORT is not set +# CONFIG_SPL_SPI is not set +# CONFIG_SPL_SYS_MALLOC is not set +# CONFIG_CMD_GPT is not set +# CONFIG_CMD_MMC is not set +# CONFIG_CMD_FAT is not set +# CONFIG_MMC_SDHCI is not set From patchwork Mon May 6 14:38:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martyn Welch X-Patchwork-Id: 1932040 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=bNvit3kr; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VY3wM4HdRz1ydW for ; Tue, 7 May 2024 00:40:03 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A384D88625; Mon, 6 May 2024 16:39:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="bNvit3kr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 948E788638; Mon, 6 May 2024 16:39:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 835BB8860E for ; Mon, 6 May 2024 16:39:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=martyn.welch@collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1715006345; bh=6JSKrjy6iJE0wfOolFLiD8Ys06uloVwOwVOgRWPxRlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bNvit3krzwn1JYlhkD048Q+FrPzvz+kN+vLNrNvQl4TBOkgdjyq+TJxbs6IV8VbjP i3SaHTZMIH/6H8IwSVmTRkm5NIVjxaILtS2V3EXonZMQm20pCrfwBFSoHQ3IxyRAto ssNC67NOMGQR0+Ft1w5pxDiIS2cq6Ss+OIDQsPDBqSzqTXUoGoB63VVdtGZsX8oPWa 1uPaJlJbutQIW/clrOQ998f1TLMv5RaHGmBU78qircjlNz6ewq9lVb+g/L6NidX0Ue ANgMi9bCSzhaxc0BKqTwWgFT4bHJ4xTZa1dPjCWTqEJtZJ2re7iRiNfygiXkDaVsJN uNGaWthGs/qqg== Received: from pan.lan (ec2-34-240-57-77.eu-west-1.compute.amazonaws.com [34.240.57.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: martyn) by madrid.collaboradmins.com (Postfix) with ESMTPSA id AF4AE3782134; Mon, 6 May 2024 14:39:04 +0000 (UTC) From: Martyn Welch To: Dave Gerlach , Tom Rini , Nishanth Menon , Robert Nelson Cc: Sjoerd Simons , Alexander Sverdlin , Mattijs Korpershoek , Martyn Welch , u-boot@lists.denx.de Subject: [PATCH v5 5/6] beagleplay: Add DFU support Date: Mon, 6 May 2024 15:38:45 +0100 Message-ID: <20240506143846.1252377-6-martyn.welch@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240506143846.1252377-1-martyn.welch@collabora.com> References: <20240506143846.1252377-1-martyn.welch@collabora.com> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean From: Sjoerd Simons DFU mode on a beagleplay can be used via the Type-C connector by holding the USR switch while powering on. Configuration is already provided as fragments for both the A53 and R5 u-boot parts. Include the am62x_a53_usbdfu.config config. The am62x_r5_usbdfu.config fragment needs to be added should DFU boot be required as this will disable booting from persistent storage due to binary size constraints. Signed-off-by: Sjoerd Simons Signed-off-by: Martyn Welch Reviewed-by: Mattijs Korpershoek Tested-by: Mattijs Korpershoek --- Changes in v5: - Use existing config fragment for a53 DFU configuration - Force usb0 into peripheral mode Changes in v4: - New patch arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi | 9 +++++++++ board/beagle/beagleplay/beagleplay.env | 1 + configs/am62x_beagleplay_a53_defconfig | 2 ++ 3 files changed, 12 insertions(+) diff --git a/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi b/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi index fb2032068d..967a2bdcd1 100644 --- a/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi +++ b/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi @@ -54,6 +54,15 @@ >; }; +&usbss0 { + bootph-all; +}; + +&usb0 { + dr_mode = "peripheral"; + bootph-all; +}; + #ifdef CONFIG_TARGET_AM625_A53_BEAGLEPLAY #define SPL_NODTB "spl/u-boot-spl-nodtb.bin" diff --git a/board/beagle/beagleplay/beagleplay.env b/board/beagle/beagleplay/beagleplay.env index bbf6b925d0..8dbfc2f7d2 100644 --- a/board/beagle/beagleplay/beagleplay.env +++ b/board/beagle/beagleplay/beagleplay.env @@ -1,5 +1,6 @@ #include #include +#include name_kern=Image console=ttyS2,115200n8 diff --git a/configs/am62x_beagleplay_a53_defconfig b/configs/am62x_beagleplay_a53_defconfig index 4f1be1df59..ec62670d55 100644 --- a/configs/am62x_beagleplay_a53_defconfig +++ b/configs/am62x_beagleplay_a53_defconfig @@ -121,3 +121,5 @@ CONFIG_EXT4_WRITE=y CONFIG_FS_FAT_MAX_CLUSTSIZE=16384 CONFIG_LZO=y CONFIG_EFI_SET_TIME=y + +#include From patchwork Mon May 6 14:38:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martyn Welch X-Patchwork-Id: 1932041 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=aIW4nKpD; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VY3wZ6H2Fz1yZk for ; Tue, 7 May 2024 00:40:14 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 168398866A; Mon, 6 May 2024 16:39:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="aIW4nKpD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8B2AB8864D; Mon, 6 May 2024 16:39:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 426DC88624 for ; Mon, 6 May 2024 16:39:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=martyn.welch@collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1715006346; bh=FY+6xnScvT00pJhA42jtHzD+Z+8lx1MWy3PnSSDmpxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aIW4nKpDIz+g94Hl31lnJkl3rncLBewMVmjacT+GzCE3nDjrj1h9A2dn0y9QcMwPk sDbq5vrDpxCDOT+zNwgyMNN9YqWzNkN8FHQ3YgJ71VaQze9A09irgC9eyWXpaj1DP/ aKujTx7abqDjZtvI0jA08lmpCb+XbpW4DMMTnXcnHSBurrqQFLoIyMk/ARpT9uLC1Y XCAjp4vln6AGi5cRr0batAOilbZnkaobOLPceqt+7cQ7dMAgMd6N4vcdasqo3IUiDh Z2EhtxlRDWaY5y+6t193iikrEPnMRsUIE2z6NMrzb+R0f5gBnOAAW/dcz8PQpplVEi c7xTLbbX3NKIA== Received: from pan.lan (ec2-34-240-57-77.eu-west-1.compute.amazonaws.com [34.240.57.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: martyn) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 6B82B3781107; Mon, 6 May 2024 14:39:05 +0000 (UTC) From: Martyn Welch To: Dave Gerlach , Tom Rini , Nishanth Menon , Robert Nelson Cc: Sjoerd Simons , Alexander Sverdlin , Mattijs Korpershoek , Martyn Welch , u-boot@lists.denx.de Subject: [PATCH v5 6/6] doc: board: Add document for DFU boot on am62x SoCs Date: Mon, 6 May 2024 15:38:46 +0100 Message-ID: <20240506143846.1252377-7-martyn.welch@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240506143846.1252377-1-martyn.welch@collabora.com> References: <20240506143846.1252377-1-martyn.welch@collabora.com> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean From: Sjoerd Simons Both AM62 SK and beagleplay support DFU boot in a similar way now; Document how to actually run DFU boot for both boards Signed-off-by: Sjoerd Simons Reviewed-by: Mattijs Korpershoek Tested-by: Mattijs Korpershoek # on beagle play Signed-off-by: Martyn Welch --- Changes in v5: - Typographical corrections Changes in v4: - New patch doc/board/beagle/am62x_beagleplay.rst | 14 +++++++++- doc/board/ti/am62x_sk.rst | 37 +++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/doc/board/beagle/am62x_beagleplay.rst b/doc/board/beagle/am62x_beagleplay.rst index 7784e62b0b..cdc610264e 100644 --- a/doc/board/beagle/am62x_beagleplay.rst +++ b/doc/board/beagle/am62x_beagleplay.rst @@ -268,7 +268,19 @@ for details. - USB Device Firmware Upgrade (DFU) mode To switch to SD card boot mode, hold the USR button while powering on -with Type-C power supply, then release when power LED lights up. +with a USB type C power supply, then release when power LED lights up. + +DFU based boot +-------------- + +To boot the board over DFU, ensure there is no SD card inserted with a +bootloader. Hold the USR switch while plugging into the type C to boot into DFU +mode. After power-on the build artifacts needs to be uploaded one by one with a +tool like dfu-util. + +.. include:: ../ti/am62x_sk.rst + :start-after: .. am62x_evm_rst_include_start_dfu_boot + :end-before: .. am62x_evm_rst_include_end_dfu_boot Debugging U-Boot ---------------- diff --git a/doc/board/ti/am62x_sk.rst b/doc/board/ti/am62x_sk.rst index b12dc85f06..d5f7fe3b03 100644 --- a/doc/board/ti/am62x_sk.rst +++ b/doc/board/ti/am62x_sk.rst @@ -105,6 +105,20 @@ Set the variables corresponding to this platform: * 3.1 R5: +.. include:: ../ti/k3.rst + :start-after: .. k3_rst_include_start_build_steps_spl_r5 + :end-before: .. k3_rst_include_end_build_steps_spl_r5 + +* 3.1.1 Alternative build of R5 for DFU boot: + +As the SPL size can get too big when building with support for booting both +from local storage *and* DFU an extra config fragment should be used to enable +DFU support (and disable storage support) + +.. prompt:: bash $ + + export UBOOT_CFG_CORTEXR="${UBOOT_CFG_CORTEXR} am62x_r5_usbdfu.config" + .. include:: ../ti/k3.rst :start-after: .. k3_rst_include_start_build_steps_spl_r5 :end-before: .. k3_rst_include_end_build_steps_spl_r5 @@ -251,6 +265,29 @@ https://www.ti.com/lit/pdf/spruiv7 under the `Boot Mode Pins` section. For SW2 and SW1, the switch state in the "ON" position = 1. +DFU based boot +-------------- + +To boot the board over DFU, set the switches to DFU mode and connect to the +USB type C DRD port on the board. After power-on the build artifacts needs to be +uploaded one by one with a tool like dfu-util. + +.. am62x_evm_rst_include_start_dfu_boot + +The initial ROM will have a DFU alt named `bootloader` for the initial R5 spl +upload. The next stages as exposed by U-Boot have target alts matching the name +of the artifacts, for these a USB reset has to be done after each upload. + +When using dfu-util the following commands can be used to boot to a U-Boot shell: + +.. prompt:: bash $ + + dfu-util -a bootloader -D tiboot3.bin + dfu-util -R -a tispl -D tispl.bin + dfu-util -R -a u-boot.img -D u-boot.img + +.. am62x_evm_rst_include_end_dfu_boot + Debugging U-Boot ----------------