From patchwork Tue Nov 19 08:26:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 898 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 4F2563F1EA for ; Tue, 19 Nov 2019 09:27:03 +0100 (CET) Received: by mail-pg1-f199.google.com with SMTP id u8sf3028306pgl.4 for ; Tue, 19 Nov 2019 00:27:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1574152022; cv=pass; d=google.com; s=arc-20160816; b=wG32ZGIRJ0E/3My/qjnn+whCJQsb9Wq4sOn/mfS4isMf20O/3vaxDxvYCWbvf6H/JC TSN8n43mmha55jIn8Y9uTyde7q42ml9WaM7Mpk8XMsrNIXr4mnypGfwGq+ne3bwVpqDE mhVyGaJ61HzNK88Wrop5Lm8uh7sSriE1nKmF3j7G+XLTrHPA4MKrqQ58dVKuxIDCfKin w89Jtz+L/TKTioZUqeJq5QEuCPQ/6L+q0474p91AvtvlvD0q6Nd4m6PSh9ieC8UcqSXE 0tjJiw1jNArP5MTvpAK7r2Yzaze66yCNzos7xmBBTMGBHcgTzn3nyJGWjzw9yigUGo9/ iUIg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=vygAwL7GtUqia3aM7cWH0XsAA3k+Vy3ppcYZRmaO60E=; b=RwFlEq9srNWgRCAW6K6zKFcwmE22BPCOago6xMLQF9/vnKLUsKrNWQjMz1y/5O2Aq1 62aJsMABpJgAHHrZUzBHh8+GdykDrjIinNwigIIIQQ9PIvs1clkOdem3lCbkh3ma+1pV k6P/tSCC3rvnpcOItCLSgIJh7P3QemfMq9xRmV5BX+j+2sQMelcVJLNVYIFq3a8NaQE1 rjbSMtGjmMbjV9U7CJkblhNnzeFQXm16SwUPSpBdiOQ1PPhvVczMROa5fZMFtcmzcZSw ryImLLOCXX7P50ipZnc54v2ZBkVarQrAuIq5OTpB09gPmY2/hU7ZRsmKn6roy5Yq/Ago +i0w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="gYPpV/k9"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=vygAwL7GtUqia3aM7cWH0XsAA3k+Vy3ppcYZRmaO60E=; b=S970UI7J9LTjxzMW+2MrsKnxq4zC0fK4xSpxSs43geDJbBp4NN9Xy+BtRjaY/SLLEJ Y9FSmzQTg7zqZUAjPsKJccvLIJcI+LPmp4eTFd1bz6HlqcZqPhK3cPfPgyP4ygY+u5Lz TqQA3T5gm085lfGqPY+0ylpGO5DmX5wqvZbLU= 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:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=vygAwL7GtUqia3aM7cWH0XsAA3k+Vy3ppcYZRmaO60E=; b=tytIho+8uDoExLQHDdXuIljZ2MWQz8z2q8DsRjjHHgmyDcaN6FTckPA3kA45BWU7kV 6AA62l1F1zGsXOOf0yCpwIADa/ZzlKmPxTncmesACCTfAm+OPeSuTdfWAJ/CklZXYVai HwDBBtv1gEoXhjz2jnV2QLZ1LG5mYliRaWwfhV9AyhDffhQgW2+5pweqhw/kgKWapjb8 FnM5/IicFcbTRUsL8FoM0Yk0E2KU1ZoO6RpBwFunrg0WCMh+TRbc+IFs6r+O3XzcnXDf nEhMpdxizJ7LhHTajuvsV5hvqXIyRRtMkbDMtg2Zd4RbFEmsji4CoJZINoyREcuDukf6 ii2w== X-Gm-Message-State: APjAAAVypi3EZMx8gCsnMRZwkvzXbe9rpHIgIm+qcuXKBtt7xAc8Pp3Y 6hPWHOmWOdIysTnBalJEOx8sh7NC X-Google-Smtp-Source: APXvYqyABZSUKnKXlVYeJgOSyZLXBmcOA1Bvei4MxUbN3lz8AJVYVwHttB0qsluYNCFlTpLqg7jubg== X-Received: by 2002:a17:902:b215:: with SMTP id t21mr33939056plr.332.1574152022041; Tue, 19 Nov 2019 00:27:02 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:1ae6:: with SMTP id p93ls817749pjp.2.canary-gmail; Tue, 19 Nov 2019 00:27:01 -0800 (PST) X-Received: by 2002:a17:902:fe06:: with SMTP id g6mr32984638plj.159.1574152021428; Tue, 19 Nov 2019 00:27:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574152021; cv=none; d=google.com; s=arc-20160816; b=RUSTSLcnqpOf0M00IMA+T1j/yia8f6V/18bS5zQ8jOnc7kmiuQlEPmm1QkvgEZFsLb c4tYT0bb1DycObiOyXeA1b/JCFHTus1plV6QwQ5VyP7B3Y2zbMamPSWiOSIcvdKNWn+7 vyilC2cA9tDyN+mViBJ4s1IQQ/WwClNc8ClFGK6kvF6NlFosf0oeGbu0XPgE3l2E5SGX ClER2hvzCB74fW9/TZMhgKy4lfNs/e0zvidTzC5GKQtkTPsGuL2Esm3gvLHW8SePF3uE qi9xVx2g7RFil7yVPfUG5pflQo+eXXiG72Ncl/Ww4P4DfQApP5/90PCWS+yv1CmJxebP vJGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=ERUG8BZ0QuZnGE3F6ql5Lg29BeT9X+LCUpVkl19Pg68=; b=RDIfYY2GwsW78VGAvZZpY332LfO3V9De2Xe32cKNcAEaXyrWe724tHmwPlm52PxNh3 ZYMRbzwnjSNHSSkOAkODfTPslK/6gLHXcG+PDdvArc0oaK/lutRJlatIxPvgYoSGE/II siWnjRGMagS/23RahMpYMrlQPjwk3GznNiYRNZUzI/VD0JfVBJFUA9ErBgXlJghzK7Sq 1dDw/V/K/oVUslkj59B5iE46Mx9GV0zvGEB8idC7IVyu7HjO9BY/USwlMDaGy3glUkSj 58IBirabC4j5BZJxGS9EX/w+cQaIJ5UtK/JYk31Qb0hLni9GvswWtpzr/mDZYOvfHYv1 kWtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="gYPpV/k9"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id s8sor24589462plq.52.2019.11.19.00.27.01 for (Google Transport Security); Tue, 19 Nov 2019 00:27:01 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a17:902:349:: with SMTP id 67mr187750pld.80.1574152021041; Tue, 19 Nov 2019 00:27:01 -0800 (PST) Received: from localhost.localdomain ([115.97.180.31]) by smtp.gmail.com with ESMTPSA id u7sm2312221pjx.19.2019.11.19.00.26.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2019 00:27:00 -0800 (PST) From: Jagan Teki To: Kever Yang , Simon Glass , Philipp Tomsich Cc: Levin Du , u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, Jagan Teki , Marek Vasut Subject: [PATCH v2 09/10] rockchip: Setup dwc3_device (for non-dm gadgets) Date: Tue, 19 Nov 2019 13:56:22 +0530 Message-Id: <20191119082623.6165-10-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20191119082623.6165-1-jagan@amarulasolutions.com> References: <20191119082623.6165-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="gYPpV/k9"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Setup dwc3_device structure for non-dm gadgets, which is used in rk3399 platforms. dwc3_device would have basic regbase, dr_mode, high speed and 16-bit UTMI+ etc. Cc: Marek Vasut Tested-by: Levin Du Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- arch/arm/mach-rockchip/board.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index c90eb976d0..542823b8cd 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -49,8 +49,10 @@ void enable_caches(void) } #endif -#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG) +#if defined(CONFIG_USB_GADGET) #include + +#if defined(CONFIG_USB_GADGET_DWC2_OTG) #include static struct dwc2_plat_otg_data otg_data = { @@ -117,7 +119,33 @@ int board_usb_cleanup(int index, enum usb_init_type init) { return 0; } -#endif +#endif /* CONFIG_USB_GADGET_DWC2_OTG */ + +#if defined(CONFIG_USB_DWC3) && !defined(CONFIG_DM_USB_GADGET) +#include + +static struct dwc3_device dwc3_device_data = { + .maximum_speed = USB_SPEED_HIGH, + .base = 0xfe800000, + .dr_mode = USB_DR_MODE_PERIPHERAL, + .index = 0, + .dis_u2_susphy_quirk = 1, + .hsphy_mode = USBPHY_INTERFACE_MODE_UTMIW, +}; + +int usb_gadget_handle_interrupts(void) +{ + dwc3_uboot_handle_interrupt(0); + return 0; +} + +int board_usb_init(int index, enum usb_init_type init) +{ + return dwc3_uboot_init(&dwc3_device_data); +} +#endif /* CONFIG_USB_DWC3 */ + +#endif /* CONFIG_USB_GADGET */ #if CONFIG_IS_ENABLED(FASTBOOT) int fastboot_set_reboot_flag(void)