From patchwork Tue Dec 18 09:52:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 154132 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3505071ljp; Tue, 18 Dec 2018 01:55:04 -0800 (PST) X-Google-Smtp-Source: AFSGD/U/3V7nAMNJ3S/Ni4f8FoArRBxIPt0k31HdFOr9EzfABoFIG0LInwZzOECTvGWdCTp6znIT X-Received: by 2002:a50:8fe4:: with SMTP id y91mr15711042edy.231.1545126904727; Tue, 18 Dec 2018 01:55:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545126904; cv=none; d=google.com; s=arc-20160816; b=cm5gRpCwAZUTYSh06ftuiR9lHlr4w8cHvfRnjrAx/sEDip9xhGbE8EEn0R/XtRa3I+ 1GHL8gKurntb30sJY26653MNK55GngmcHrOjINFoNSCPHK+W4+/dK5CzWRk/FkisFjKm 4LVfVsCfw7Bnnh042HTYv/1D9W6fBSVRWBkoi5vfSvR5IP1D+sqXgMVB6bLJ5Y9GQoRG KUinpgTRWat1M0NNd1XcCujZoK+FLbSLt4dmnJ1KfSjBCLpxA0jb/SWJW4y8+U+DyA/n QsmlR8xnyvG/xOiRDKQuoxN4kVJq9QlfCcWFAikQ2T37kW50d3xofnhBdgqYRT0ZL35L tHWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature; bh=ZrpARfizf76qaGD8mi61dBTO5xO//kQ1tmU3EqGELFM=; b=gNcQf0Owpw7Hjlir8S9816l1McmLfGsXLcrXFEWwQxGsrO98P99H3tijxdsBCwQEy2 F2aBGYbRPHPTOUBqqYbrBkMaEeE+B74ZfpHBNqaZNWqsPm8QPuZqUpxhXENbeikZIThA ykrEaSKZbjJzeZsO9VRSz2TsRXJcyv4C7gmw3LiQ3SryliEp2qff5XRtJkbIV6wGNoQv h3U4Aa6ztxHAjZRTJMP39/u6Y6E+K8SN2kndpfufOwFk/+WYpVAN7NOphg3HVpK2u2LE NBK42U5cFnOj3ka6SYYYKGNy1yaILI2EDUlElyloCpSCwnpoXkoQllCtxYws8/mH0o1T 6YTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=V+1xwcZh; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id f14si3574697edw.282.2018.12.18.01.55.04; Tue, 18 Dec 2018 01:55:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=V+1xwcZh; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 51C2BC221B1; Tue, 18 Dec 2018 09:54:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 320C3C221C6; Tue, 18 Dec 2018 09:53:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0D350C2200D; Tue, 18 Dec 2018 09:53:27 +0000 (UTC) Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by lists.denx.de (Postfix) with ESMTPS id F1FA5C22088 for ; Tue, 18 Dec 2018 09:53:23 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id b85so7896114pfc.3 for ; Tue, 18 Dec 2018 01:53:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ePzIhDrHtBShgkgH3kUHRjKROKBloyPC9Al6GnURIuw=; b=V+1xwcZhsa10lkKPgYMv5wRQVQt0T/Vb9ngCLladM1UvSikHT12JGvMqHp+S9Sl0Wb Q0nx42C63iQXd2a7s+P5KJy3+APdIjw5sBfwfZD9IxBk0v7Kz0x++sxwVq5lauqr3lQJ zrAzCgTU9+LjtrN3A2TQpLlTwUfmOV7dRHHx4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ePzIhDrHtBShgkgH3kUHRjKROKBloyPC9Al6GnURIuw=; b=t3+s0RzRCo0citdd4xG9BZmo6bzH2Wb1V1X/Dyy+7wUzRdHNIcL8zqkAKdGM21kiOc loYqn8L3QW0JfR9/Jurq/iTf/jNHNWezYxWfgOjuNQlcygjeVLOz6GMRM143w5L+C1DI 6wIo1/AdzedQzrY/4i6CzPKSlHnetV39MBLs7/DtPMyL90dnhRor4ZeRTyEOYNefst9T gBNaSg3yi1f9el0Dea8LeTts7xldiBQiiL3SjGgGaiWNZnCHYFU8EoLOcb1MKbM7+la2 jwTWjoWnvn8W/3tklc+8eVp2nsebq8MBKqOrw+N2yjkGTXTCs8F2CfPKdFiAsTaYxC+8 GINA== X-Gm-Message-State: AA+aEWYL28ISQyUlzzeWqL+sqgA4SR24m6IwO07AFUWT9zMIsCD10WK9 Y1DJh1K73HJ7O9fmRXSr+09N2afT9r7wBQ== X-Received: by 2002:a63:b105:: with SMTP id r5mr15276345pgf.442.1545126802627; Tue, 18 Dec 2018 01:53:22 -0800 (PST) Received: from localhost.localdomain (61-216-91-114.HINET-IP.hinet.net. [61.216.91.114]) by smtp.gmail.com with ESMTPSA id l69sm30817514pfb.75.2018.12.18.01.53.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Dec 2018 01:53:21 -0800 (PST) From: Shawn Guo To: Tom Rini Date: Tue, 18 Dec 2018 17:52:06 +0800 Message-Id: <20181218095207.11620-2-shawn.guo@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181218095207.11620-1-shawn.guo@linaro.org> References: <20181218095207.11620-1-shawn.guo@linaro.org> Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 1/2] poplar: add DWC2 OTG gadget support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" It enables DWC2 OTG gadget driver support for Poplar board. As usb2_phy_init() is being always called from board_init(), we can save the call from board_usb_init(). Signed-off-by: Shawn Guo --- .../asm/arch-hi3798cv200/hi3798cv200.h | 5 ++++ board/hisilicon/poplar/poplar.c | 28 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/arch/arm/include/asm/arch-hi3798cv200/hi3798cv200.h b/arch/arm/include/asm/arch-hi3798cv200/hi3798cv200.h index f97b1eb29f84..bb221e17e0ed 100644 --- a/arch/arm/include/asm/arch-hi3798cv200/hi3798cv200.h +++ b/arch/arm/include/asm/arch-hi3798cv200/hi3798cv200.h @@ -13,11 +13,16 @@ /* DEVICES */ #define REG_BASE_MCI 0xF9830000 #define REG_BASE_UART0 0xF8B00000 +#define HIOTG_BASE_ADDR 0xF98C0000 /* PERI control registers (4KB) */ /* USB2 PHY01 configuration register */ #define PERI_CTRL_USB0 (REG_BASE_PERI_CTRL + 0x120) + /* USB2 controller configuration register */ +#define PERI_CTRL_USB3 (REG_BASE_PERI_CTRL + 0x12c) +#define USB2_2P_CHIPID (1 << 28) + /* PERI CRG registers (4KB) */ /* USB2 CTRL0 clock and soft reset */ #define PERI_CRG46 (REG_BASE_CRG + 0xb8) diff --git a/board/hisilicon/poplar/poplar.c b/board/hisilicon/poplar/poplar.c index e1fbd5d0c669..af018ad2f8e4 100644 --- a/board/hisilicon/poplar/poplar.c +++ b/board/hisilicon/poplar/poplar.c @@ -168,6 +168,34 @@ int board_mmc_init(bd_t *bis) } #endif +#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG) +#include +#include +#include + +static struct dwc2_plat_otg_data poplar_otg_data = { + .regs_otg = HIOTG_BASE_ADDR +}; + +static void set_usb_to_device(void) +{ + setbits_le32(PERI_CTRL_USB3, USB2_2P_CHIPID); +} + +int board_usb_init(int index, enum usb_init_type init) +{ + set_usb_to_device(); + return dwc2_udc_probe(&poplar_otg_data); +} + +int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) +{ + if (!env_get("serial#")) + g_dnl_set_serialnumber("0123456789POPLAR"); + return 0; +} +#endif + int board_init(void) { usb2_phy_init(); From patchwork Tue Dec 18 09:52:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 154131 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3504521ljp; Tue, 18 Dec 2018 01:54:21 -0800 (PST) X-Google-Smtp-Source: AFSGD/VjeVFeLKbyRec7BgMLwfhwjFbyivA4lmuSr4WAYCFWhbjkmbheKWo7foJrA9MbgvRLM0L2 X-Received: by 2002:a50:b7ad:: with SMTP id h42mr2825688ede.210.1545126861199; Tue, 18 Dec 2018 01:54:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545126861; cv=none; d=google.com; s=arc-20160816; b=spxqfbZtPZOVxYQpuZeuwYyrJAucj1zsh5No4V21rzaL/8fMVE8d7Qf0QXPQujWekv tCkcTRPyVUvYflmH49PFOi8GD1H1MnhLSRpGJBR8Da8jKz+UQ1KdUhrSQwy4KANU1iYY irhkWrZ8tpXPrierZsKCK69fzjEtQZ7+4ol7422sJcN/MAktYSv2Wxw/xHJ73tIMoQl+ 4YLObKxPcbjYJNsxRSlSuN+aOsF16d0kTGreRvPXox/Cn+YSPP879AF30gNfv2x26EjF XUwINuR0BMnBrO2WSiB4eBlbY4MuFdsF18KBULaKfpL5k/4gwA4pEwPqdu+fw7cItL/A 8L2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature; bh=H1Hf3ASpsLIyBwbvzbv4Q/pBN4W5bEwNjrjQCeJOV6s=; b=wMPe51fL40tX1T1seRyOYhQP5YCBGh3fVE+vj+a3U1KWfDUl43peBm0RsSC6njA2vl EC5AClz4xvS+HPp2UYRVPwqeW/ApGXL7eW+VzjOao7MH+CnV5X+Qa2FAlXr+5JB4/IsR ez7jamAWHmJolUKbdWscEHRILCqhMPmdcfki1egzXeFE88/H91L7IacC0iyGhumay72T Vsgu8BgsQM4oIBoyPg9zHQnQqzo1OL7uZreFnNudOx0yuxpgTiUPAmYJwxi3pEOkOMjd KrqnH+R9GWx7HYxX3LgkZzNP0xTr5aG5Dg6VOcCZmbEb2fQY8Je9i3pVNq+d0UgD7qyA qkaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=iT7ASDho; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id h23si2152054edb.114.2018.12.18.01.54.20; Tue, 18 Dec 2018 01:54:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=iT7ASDho; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id BF673C22088; Tue, 18 Dec 2018 09:53:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,T_DKIM_INVALID,UPPERCASE_50_75 autolearn=no autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 17DE3C221AA; Tue, 18 Dec 2018 09:53:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2E038C221B1; Tue, 18 Dec 2018 09:53:30 +0000 (UTC) Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by lists.denx.de (Postfix) with ESMTPS id 86E84C220BA for ; Tue, 18 Dec 2018 09:53:26 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id y1so7572334plp.9 for ; Tue, 18 Dec 2018 01:53:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1C9K48wLdROqVc6Zhn1t2cHrV9TUP0r6FFrerc2DYho=; b=iT7ASDho0B0IptkP4q5LYUNyVo3GPCsiC2p2QXqEeyWMAOKhkZAj95pHO2fGxuA2e2 VY0FVq8gpxEsOfa5qwAfbEK7WLb7QB+CW82qVz62d3mYDYEuq6iXD1XQlK/8KGgLKuou 6PMpWq1rWbO3TCnG3gV7AATtHCB8H7agbHz+0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1C9K48wLdROqVc6Zhn1t2cHrV9TUP0r6FFrerc2DYho=; b=n2aLDB9Qw8GcrttIvRgX5GjmsTCuBPtlWCSVAEtkbT3zLDDRv5HV/ld8S4vEVuGbDN DhBZ+xGxqkKu4wFedLvgazJESHYXQiyKudI30ldc0Zsxv6my22awyrSAUarqucNNhkUJ tQtBdq4qPFhEbk9Ibmftu+ejYnh3G+AVwwnN8K1cLmwjNTiqSYGXW0LN2P2JeWZ5OSV6 dOozYnZ3EMEEjWubW+BfffWSazl+qI9OcTBHxc1nTKtV18QMV8dw72UnQf04VrUdkZ9Y qWfylJ1MPANL/QtFOIheGvyBHy/BtecW/+tytvsSigRus62sPkVlUgMU2reyQb5BQt+k PGbQ== X-Gm-Message-State: AA+aEWZV/eGnx8wOX8FbIhJLAyQQ1usJZKhKtCpe2zkudoWoNEfl/HG2 3OBmbcZccBKtE6cKW5tQBlEHkoINjF6MGA== X-Received: by 2002:a17:902:7791:: with SMTP id o17mr15531212pll.60.1545126805175; Tue, 18 Dec 2018 01:53:25 -0800 (PST) Received: from localhost.localdomain (61-216-91-114.HINET-IP.hinet.net. [61.216.91.114]) by smtp.gmail.com with ESMTPSA id l69sm30817514pfb.75.2018.12.18.01.53.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Dec 2018 01:53:24 -0800 (PST) From: Shawn Guo To: Tom Rini Date: Tue, 18 Dec 2018 17:52:07 +0800 Message-Id: <20181218095207.11620-3-shawn.guo@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181218095207.11620-1-shawn.guo@linaro.org> References: <20181218095207.11620-1-shawn.guo@linaro.org> Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 2/2] poplar_defconfig: enable fastboot support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" It enables fastboot support on Poplar board by using DWC2 OTG gadget driver. Signed-off-by: Shawn Guo --- configs/poplar_defconfig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/configs/poplar_defconfig b/configs/poplar_defconfig index 946e7caf6bea..48e9c6eaac26 100644 --- a/configs/poplar_defconfig +++ b/configs/poplar_defconfig @@ -6,6 +6,13 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_NR_DRAM_BANKS=2 # CONFIG_DISPLAY_CPUINFO is not set CONFIG_SYS_PROMPT="poplar# " +CONFIG_FASTBOOT=y +CONFIG_USB_FUNCTION_FASTBOOT=y +CONFIG_CMD_FASTBOOT=y +CONFIG_FASTBOOT_BUF_ADDR=0x20000000 +CONFIG_FASTBOOT_BUF_SIZE=0x10000000 +CONFIG_FASTBOOT_FLASH=y +CONFIG_FASTBOOT_FLASH_MMC_DEV=0 CONFIG_CMD_MMC=y CONFIG_CMD_USB=y # CONFIG_ISO_PARTITION is not set @@ -18,6 +25,13 @@ CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_GENERIC=y CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_DWC2_OTG=y +CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_USB_GADGET_MANUFACTURER="HiSilicon" +CONFIG_USB_GADGET_VENDOR_NUM=0x18d1 +CONFIG_USB_GADGET_PRODUCT_NUM=0xd00d CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_FAT_WRITE=y