From patchwork Fri Jan 5 07:36:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 855944 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="JwbKGB6R"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zCc2q2Nclz9s7F for ; Fri, 5 Jan 2018 18:37:55 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 0ADAFC21DDF; Fri, 5 Jan 2018 07:37:45 +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 09F11C21E35; Fri, 5 Jan 2018 07:37:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 40566C21DD9; Fri, 5 Jan 2018 07:37:32 +0000 (UTC) Received: from mail-pl0-f67.google.com (mail-pl0-f67.google.com [209.85.160.67]) by lists.denx.de (Postfix) with ESMTPS id 60DC7C21DE9 for ; Fri, 5 Jan 2018 07:37:28 +0000 (UTC) Received: by mail-pl0-f67.google.com with SMTP id o2so2621981plk.12 for ; Thu, 04 Jan 2018 23:37:28 -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=h/uiOs8vX/kTZ/RbQ2nhH5QcKDz7Z+zCilPXw739beE=; b=JwbKGB6RuM+xrJWZYHYrflzhycU7lLZbYQg59lC1ndfjXaMKGgAASiwor/YVds1WSr uXuyANtdqC0RGX4eMRNDtGE8WqVuWYuCpglUA7WqJYW9bnA+nvtsIr90ej98/ZH3Ov4+ Cgr2fDrmqzM/QOvfLXVNqQ82EVrWCXp9nMAT0= 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=h/uiOs8vX/kTZ/RbQ2nhH5QcKDz7Z+zCilPXw739beE=; b=AkMggQy+Z5y6XMveCiwPolNpbXHSGADsFVFNPd3BUaLrZxDFTLrHYMs9+dkUqHQUxk IdKrT2NkOaih1E4d+RQMMwPAczyV0D9x0XpO8xyiyGOkP07Ga/lMsqoDEC9McoqMrZOB LWM741bO+BLbAAjOs5kS5A+pc0bVBTLki4iKPNooyLG/tcXXSSpI0nr4ChH59Bk1e6F8 ankshBWMyfOkZfaiPRrQkXBeMGHG3iPU7WGtMMLAnPze51W7IBoIappzC3TN1x9JqrdK 1Uc7uZ4x+Rx18rJt+1J804BK3eDYfABBHlT1PkZRLCj25DUsS9hKE8IvIAGnHnDDryMC 8MTA== X-Gm-Message-State: AKGB3mKU74sn+d6wMhW5DmyjEFxm7zbFaAltqxLSCKnka3QkKKNbW2TO JnejgCuZuWVz0TuEb7GNYDjtkQ== X-Google-Smtp-Source: ACJfBoubyBqrOBftuM4iz9okVxLi3+YTtvCEhqkwbBThwvjoFzyWPGamDlLokRjNqYQBnH39kjqFdw== X-Received: by 10.159.206.134 with SMTP id bg6mr2261004plb.311.1515137846947; Thu, 04 Jan 2018 23:37:26 -0800 (PST) Received: from localhost.localdomain ([45.56.153.113]) by smtp.gmail.com with ESMTPSA id b9sm9553789pgs.3.2018.01.04.23.37.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Jan 2018 23:37:25 -0800 (PST) From: Jun Nie To: wens@csie.org, maxime.ripard@free-electrons.com, hdegoede@redhat.com Date: Fri, 5 Jan 2018 15:36:56 +0800 Message-Id: <1515137821-30583-2-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1515137821-30583-1-git-send-email-jun.nie@linaro.org> References: <1515137821-30583-1-git-send-email-jun.nie@linaro.org> Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 1/6] sunxi: h3: add usb_otg and OHCI/EHCI for usbc0 on H3 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" Allwinner H3 have a dual-routed USB PHY0 -- routed to either OHCI/EHCI or MUSB controller. Signed-off-by: Jun Nie --- arch/arm/dts/sun8i-h3.dtsi | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/arch/arm/dts/sun8i-h3.dtsi b/arch/arm/dts/sun8i-h3.dtsi index afa6079..ae1e861 100644 --- a/arch/arm/dts/sun8i-h3.dtsi +++ b/arch/arm/dts/sun8i-h3.dtsi @@ -218,6 +218,19 @@ #size-cells = <0>; }; + usb_otg: usb@01c19000 { + compatible = "allwinner,sun8i-h3-musb"; + reg = <0x01c19000 0x400>; + clocks = <&ccu CLK_BUS_OTG>; + resets = <&ccu RST_BUS_OTG>; + interrupts = ; + interrupt-names = "mc"; + phys = <&usbphy 0>; + phy-names = "usb"; + extcon = <&usbphy 0>; + status = "disabled"; + }; + usbphy: phy@01c19400 { compatible = "allwinner,sun8i-h3-usb-phy"; reg = <0x01c19400 0x2c>, @@ -250,6 +263,25 @@ #phy-cells = <1>; }; + ehci0: usb@01c1a000 { + compatible = "allwinner,sun8i-h3-ehci", "generic-ehci"; + reg = <0x01c1a000 0x100>; + interrupts = ; + clocks = <&ccu CLK_BUS_EHCI0>, <&ccu CLK_BUS_OHCI0>; + resets = <&ccu RST_BUS_EHCI0>, <&ccu RST_BUS_OHCI0>; + status = "disabled"; + }; + + ohci0: usb@01c1a400 { + compatible = "allwinner,sun8i-h3-ohci", "generic-ohci"; + reg = <0x01c1a400 0x100>; + interrupts = ; + clocks = <&ccu CLK_BUS_EHCI0>, <&ccu CLK_BUS_OHCI0>, + <&ccu CLK_USB_OHCI0>; + resets = <&ccu RST_BUS_EHCI0>, <&ccu RST_BUS_OHCI0>; + status = "disabled"; + }; + ehci1: usb@01c1b000 { compatible = "allwinner,sun8i-h3-ehci", "generic-ehci"; reg = <0x01c1b000 0x100>; From patchwork Fri Jan 5 07:36:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 855946 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="WTsAXwmg"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zCc4P0nRzz9s7F for ; Fri, 5 Jan 2018 18:39:17 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id C5E5CC21E10; Fri, 5 Jan 2018 07:38:23 +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 3498CC21E06; Fri, 5 Jan 2018 07:38:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C6E01C21E0E; Fri, 5 Jan 2018 07:37:38 +0000 (UTC) Received: from mail-pl0-f67.google.com (mail-pl0-f67.google.com [209.85.160.67]) by lists.denx.de (Postfix) with ESMTPS id CB86CC21E06 for ; Fri, 5 Jan 2018 07:37:36 +0000 (UTC) Received: by mail-pl0-f67.google.com with SMTP id n13so2634036plp.11 for ; Thu, 04 Jan 2018 23:37:36 -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=1Ilnws27UaIqbKdrxOqfIgmpqDBNEoe73Wb2iFMudwY=; b=WTsAXwmgtyzPzgd8oNp+J1I4Pok6EGQ1zvHa4EL/mzoxPk77UEtkemp7PxT9FcEbAm qAQ2Z1EOJnm/gXfxJpdpAnUsz4u0qwf+BSCAHJg1wKW133IOOHVg2UpE+4Xa6Y3gDPVw O4dqt9HhZLlrc2wsX4FiJe9/+Lee5dBDftXH0= 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=1Ilnws27UaIqbKdrxOqfIgmpqDBNEoe73Wb2iFMudwY=; b=Xlu7MoaK6A3c51hFSDI4xs2HJ3KGZMgsu53moU+fKIi6V6SomtXA94+/yWlXl1H7II eo0f8l8skhVDkCPZd37drAfp82LL3jCCFxlM720HPw4d174b1ljibi4yo1cN+tN6ZG4b YdudwGl+qCISkU5xuVWxXif4qN6B5eu5GF7iW51bpvKqT/QriUYS9XhD5A4z+G5iYW/2 offZIpcHDFG23ZGGElRes6Fro143/KoAgAbCCL4MVrhaO3sPk38GshBkBcm+y5WC3dhe aiMToYxzu5zNsJWAgL77oq0gayuWa9gZHVR+jK7LTsbQgqTzsY7chepHEc1+9VKJfdQ6 AJNA== X-Gm-Message-State: AKGB3mIFD7mZTDbrcaebpoDHqFJ3s1XYFaTkAch/J+hXmYh666LQN/Rz StzXcuJmfp0KGb+nv9yTT50lcA== X-Google-Smtp-Source: ACJfBouhJ4hemq76dp1SZqJ5OgzmENnw2VAfLXtlD1VcQso40H27rjsFQIOIuuLC7PIpAuNuvAnF3w== X-Received: by 10.159.247.129 with SMTP id e1mr2245844pls.222.1515137855543; Thu, 04 Jan 2018 23:37:35 -0800 (PST) Received: from localhost.localdomain ([45.56.153.113]) by smtp.gmail.com with ESMTPSA id b9sm9553789pgs.3.2018.01.04.23.37.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Jan 2018 23:37:34 -0800 (PST) From: Jun Nie To: wens@csie.org, maxime.ripard@free-electrons.com, hdegoede@redhat.com Date: Fri, 5 Jan 2018 15:36:57 +0800 Message-Id: <1515137821-30583-3-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1515137821-30583-1-git-send-email-jun.nie@linaro.org> References: <1515137821-30583-1-git-send-email-jun.nie@linaro.org> Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 2/6] sunxi: musb: Add fifo config for H3 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" Add fifo config for H3 as H3 differ with other SoC on ep number. Signed-off-by: Jun Nie Reviewed-by: Jagan Teki --- drivers/usb/musb-new/sunxi.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c index 7ee44ea..0005c1e 100644 --- a/drivers/usb/musb-new/sunxi.c +++ b/drivers/usb/musb-new/sunxi.c @@ -290,10 +290,42 @@ static const struct musb_platform_ops sunxi_musb_ops = { .disable = sunxi_musb_disable, }; +#if defined(CONFIG_MACH_SUN8I_H3) +static struct musb_fifo_cfg sunxi_musb_fifo_config[] = { + { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, + { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, + { .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, }, + { .hw_ep_num = 2, .style = FIFO_RX, .maxpacket = 512, }, + { .hw_ep_num = 3, .style = FIFO_TX, .maxpacket = 512, }, + { .hw_ep_num = 3, .style = FIFO_RX, .maxpacket = 512, }, + { .hw_ep_num = 4, .style = FIFO_TX, .maxpacket = 512, }, + { .hw_ep_num = 4, .style = FIFO_RX, .maxpacket = 512, }, +}; +#else +static struct musb_fifo_cfg sunxi_musb_fifo_config[] = { + { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, + { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, + { .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, }, + { .hw_ep_num = 2, .style = FIFO_RX, .maxpacket = 512, }, + { .hw_ep_num = 3, .style = FIFO_TX, .maxpacket = 512, }, + { .hw_ep_num = 3, .style = FIFO_RX, .maxpacket = 512, }, + { .hw_ep_num = 4, .style = FIFO_TX, .maxpacket = 512, }, + { .hw_ep_num = 4, .style = FIFO_RX, .maxpacket = 512, }, + { .hw_ep_num = 5, .style = FIFO_TX, .maxpacket = 512, }, + { .hw_ep_num = 5, .style = FIFO_RX, .maxpacket = 512, }, +}; +#endif + static struct musb_hdrc_config musb_config = { + .fifo_cfg = sunxi_musb_fifo_config, + .fifo_cfg_size = ARRAY_SIZE(sunxi_musb_fifo_config), .multipoint = 1, .dyn_fifo = 1, +#if defined(CONFIG_MACH_SUN8I_H3) .num_eps = 6, +#else + .num_eps = 5, +#endif .ram_bits = 11, }; From patchwork Fri Jan 5 07:36:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 855945 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="DFKCYIgr"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zCc3d1nX8z9s7F for ; Fri, 5 Jan 2018 18:38:37 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id E31AFC21DDE; Fri, 5 Jan 2018 07:38:06 +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_BLOCKED, 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 65E52C21DD9; Fri, 5 Jan 2018 07:38:03 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 33459C21DD9; Fri, 5 Jan 2018 07:37:43 +0000 (UTC) Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by lists.denx.de (Postfix) with ESMTPS id 85CE2C21E16 for ; Fri, 5 Jan 2018 07:37:42 +0000 (UTC) Received: by mail-pg0-f68.google.com with SMTP id t67so1725141pgc.5 for ; Thu, 04 Jan 2018 23:37:42 -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=hktDAHNZharS8aE32qKIEZ3nQ+nD8CQVpxghBFlGQbA=; b=DFKCYIgrFzELINt4SKHeAa+zSEelh+njAglVzZfZZRcS9cDfC6AeKfasYxMzRd6l6n hlQQp5T07kDpsbxrkD8A6kJ9YEvDYIqX9PUHgTiyAo+57s2IF068FCYZWaHFI2yaEGR7 cE8WiZ+Dtc7zyh15BxmzPPbhraD6Ta8w6+l4c= 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=hktDAHNZharS8aE32qKIEZ3nQ+nD8CQVpxghBFlGQbA=; b=oQg4Wu5+oOfc+VtUxXtj8j4UjiBdomVtwI9Vr3yJc82I5Vxd1m//YnWuikQSCCTBTH qx3fwH1ASzb2v2rTWGBAo/t9zYx07p2iJT2IhZ0yQKuajDncFH5v8ptfS2Q55tJb2XUE 13jDaU3EIknxsS9JBiz0xNtUwHfzQCgRqcNbd4JLKH2MDcNyxrs9YJ1CbzrvkZ3FV+Ib mcAnnogpMWcmzuobybDVYvtmfoVwIv3EgZR0HhMN1covJROAEZuG+6LUle3sFT6+LP5I lpOSaty0PD1v6/d3aPlS+Zc6/vq/OR64GO7XzTA9bBkx1TqAq1jpyJGglAQRquXDHrq0 TXSA== X-Gm-Message-State: AKGB3mL/JoaeeMA4JUihnOQhO95uu1qGryD6K+050yNO26f5bjWFK+ho zzuUpOhTZXEDB/KCfsFyxxVXwQ== X-Google-Smtp-Source: ACJfBouboRhiAIDRljFq8LQXTPFrXo0OAaTdGmHbpXWp5ZKRPIEK9hToyFM32n6yB7dEULrjflZRpQ== X-Received: by 10.98.15.203 with SMTP id 72mr2118120pfp.104.1515137861247; Thu, 04 Jan 2018 23:37:41 -0800 (PST) Received: from localhost.localdomain ([45.56.153.113]) by smtp.gmail.com with ESMTPSA id b9sm9553789pgs.3.2018.01.04.23.37.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Jan 2018 23:37:40 -0800 (PST) From: Jun Nie To: wens@csie.org, maxime.ripard@free-electrons.com, hdegoede@redhat.com Date: Fri, 5 Jan 2018 15:36:58 +0800 Message-Id: <1515137821-30583-4-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1515137821-30583-1-git-send-email-jun.nie@linaro.org> References: <1515137821-30583-1-git-send-email-jun.nie@linaro.org> Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 3/6] sunxi: musb: Enable OTG device clock for H3 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" Enable OTG clock and deassert reset Signed-off-by: Jun Nie --- arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 2 ++ arch/arm/include/asm/arch-sunxi/cpu_sun4i.h | 4 ++++ drivers/usb/musb-new/sunxi.c | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun6i.h b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h index d328df9..0d81791 100644 --- a/arch/arm/include/asm/arch-sunxi/clock_sun6i.h +++ b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h @@ -280,6 +280,8 @@ struct sunxi_ccm_reg { #define AHB_GATE_OFFSET_USB_EHCI2 27 #define AHB_GATE_OFFSET_USB_EHCI1 26 #define AHB_GATE_OFFSET_USB_EHCI0 25 +#define AHB_GATE_OFFSET_OTG_EHCI 24 +#define AHB_GATE_OFFSET_OTG_DEVICE 23 #else #define AHB_GATE_OFFSET_USB_EHCI1 27 #define AHB_GATE_OFFSET_USB_EHCI0 26 diff --git a/arch/arm/include/asm/arch-sunxi/cpu_sun4i.h b/arch/arm/include/asm/arch-sunxi/cpu_sun4i.h index 2419062..f7050df 100644 --- a/arch/arm/include/asm/arch-sunxi/cpu_sun4i.h +++ b/arch/arm/include/asm/arch-sunxi/cpu_sun4i.h @@ -64,7 +64,11 @@ #ifdef CONFIG_SUNXI_GEN_SUN6I #if defined(CONFIG_MACH_SUNXI_H3_H5) || defined(CONFIG_MACH_SUN50I) #define SUNXI_USBPHY_BASE 0x01c19000 +#ifndef CONFIG_USB_MUSB_HOST +#define SUNXI_USB0_BASE 0x01c19000 +#else #define SUNXI_USB0_BASE 0x01c1a000 +#endif #define SUNXI_USB1_BASE 0x01c1b000 #define SUNXI_USB2_BASE 0x01c1c000 #define SUNXI_USB3_BASE 0x01c1d000 diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c index 0005c1e..6d8242e 100644 --- a/drivers/usb/musb-new/sunxi.c +++ b/drivers/usb/musb-new/sunxi.c @@ -266,6 +266,16 @@ static int sunxi_musb_init(struct musb *musb) #ifdef CONFIG_SUNXI_GEN_SUN6I setbits_le32(&ccm->ahb_reset0_cfg, 1 << AHB_GATE_OFFSET_USB0); #endif + +#ifdef CONFIG_MACH_SUNXI_H3_H5 +#ifdef CONFIG_USB_MUSB_HOST + setbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_OTG_EHCI); + setbits_le32(&ccm->ahb_reset0_cfg, 1 << AHB_GATE_OFFSET_OTG_EHCI); +#else + setbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_OTG_DEVICE); + setbits_le32(&ccm->ahb_reset0_cfg, 1 << AHB_GATE_OFFSET_OTG_DEVICE); +#endif +#endif sunxi_usb_phy_init(0); USBC_ConfigFIFO_Base(); @@ -379,6 +389,15 @@ static int musb_usb_remove(struct udevice *dev) #endif clrbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_USB0); +#ifdef CONFIG_MACH_SUNXI_H3_H5 +#ifdef CONFIG_USB_MUSB_HOST + clrbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_OTG_EHCI); + clrbits_le32(&ccm->ahb_reset0_cfg, 1 << AHB_GATE_OFFSET_OTG_EHCI); +#else + clrbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_OTG_DEVICE); + clrbits_le32(&ccm->ahb_reset0_cfg, 1 << AHB_GATE_OFFSET_OTG_DEVICE); +#endif +#endif free(host->host); host->host = NULL; From patchwork Fri Jan 5 07:36:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 855948 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Wlj7Ri+G"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zCc5t23FRz9s7F for ; Fri, 5 Jan 2018 18:40:31 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 96015C21DFA; Fri, 5 Jan 2018 07:38:57 +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_BLOCKED, 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 633A0C21E28; Fri, 5 Jan 2018 07:38:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 49BBBC21DDE; Fri, 5 Jan 2018 07:37:54 +0000 (UTC) Received: from mail-pl0-f68.google.com (mail-pl0-f68.google.com [209.85.160.68]) by lists.denx.de (Postfix) with ESMTPS id 6F693C21E0F for ; Fri, 5 Jan 2018 07:37:50 +0000 (UTC) Received: by mail-pl0-f68.google.com with SMTP id bi12so2636849plb.6 for ; Thu, 04 Jan 2018 23:37:50 -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=dQ152zcWCwRotT8+zvQ3j3TSDH8Z/EH6+ZDQsInBotE=; b=Wlj7Ri+GiyeZ1EHcgW2Qni8zWIfkbL1p2ltx7UNZOgZcvbqf4VCXk5TDXYyy/QkDjk Ju+aZMM7teDYvplq4SSE8j8ax+Lb4SCFFwe5cSV6i/8WS4LwQT5asQhjWQhQwDF28DaO l4mcVZRQby+qtd1ltPwohIgMalXUeOeF9Xz+s= 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=dQ152zcWCwRotT8+zvQ3j3TSDH8Z/EH6+ZDQsInBotE=; b=JL+Sc1efWDZ0yk/mNwwb6L2mZsGpzDIbPQBqQjQaUHH0B3sYrsK4VAUncuihjNHlmT rk1uOcUY7b5+NVYTNRMQaH2MnwMJmbXRVe0lpXjbVuRYKfmsKTsTfIXqX8TybJlQk4S3 Dm5NPtq1b1xkdBAY20qxYN+GHd/JrmC3kW7galKpFMnFXSW8T1Nn5G3x05Mqgqe1ZX2y rPr96hlQC3pdY80HpIeQseK1CR8VGWTsdlFlht7pIm5+bz9EFF5eIpyHbmdIwbR4v9Yv 0iPGF5Gp3R0oFuffefJGFSq3QFd0z77ejgi9ech5SRB0SJpAjxB3OvIUZyeVxfeKRgyL hSLg== X-Gm-Message-State: AKGB3mJ6zMgqW4v+DypQ1fl4r9ZC1kxL7zVgmQx/sQ3jzC17tUEQ3jPv EcmgeFMLAFuAa903CE9Qc+Tg6g== X-Google-Smtp-Source: ACJfBouKP8QI2xBP2CZ6sq0OQt3FEjNHGGd7BQPsxRDQUL5K+rOJ6i12Iv51kcuY0kKk8SxLDW6kSQ== X-Received: by 10.84.241.138 with SMTP id b10mr2258893pll.435.1515137869170; Thu, 04 Jan 2018 23:37:49 -0800 (PST) Received: from localhost.localdomain ([45.56.153.113]) by smtp.gmail.com with ESMTPSA id b9sm9553789pgs.3.2018.01.04.23.37.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Jan 2018 23:37:48 -0800 (PST) From: Jun Nie To: wens@csie.org, maxime.ripard@free-electrons.com, hdegoede@redhat.com Date: Fri, 5 Jan 2018 15:36:59 +0800 Message-Id: <1515137821-30583-5-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1515137821-30583-1-git-send-email-jun.nie@linaro.org> References: <1515137821-30583-1-git-send-email-jun.nie@linaro.org> Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 4/6] sunxi: musb: Hack dynamic fifo support for H3 OTG 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" Like other Allwinner SoC, the H3 is missing the config register from the musb hardware block. Use a known working value for it like other SoC. Signed-off-by: Jun Nie --- drivers/usb/musb-new/musb_regs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/musb-new/musb_regs.h b/drivers/usb/musb-new/musb_regs.h index a3cc38e..3e51003 100644 --- a/drivers/usb/musb-new/musb_regs.h +++ b/drivers/usb/musb-new/musb_regs.h @@ -432,7 +432,8 @@ static inline u8 musb_read_ulpi_buscontrol(void __iomem *mbase) static inline u8 musb_read_configdata(void __iomem *mbase) { -#if defined CONFIG_MACH_SUN8I_A33 || defined CONFIG_MACH_SUN8I_A83T +#if defined(CONFIG_MACH_SUN8I_A33) || defined(CONFIG_MACH_SUN8I_A83T) || \ + defined(CONFIG_MACH_SUN8I_H3) /* allwinner saves a reg, and we need to hardcode this */ return 0xde; #else From patchwork Fri Jan 5 07:37:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 855947 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="dmPewsJY"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zCc4j3Hj6z9s7F for ; Fri, 5 Jan 2018 18:39:33 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 2AD14C21E1D; Fri, 5 Jan 2018 07:38:40 +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_BLOCKED, 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 24A2FC21E14; Fri, 5 Jan 2018 07:38:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6E2F6C21DC1; Fri, 5 Jan 2018 07:38:01 +0000 (UTC) Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by lists.denx.de (Postfix) with ESMTPS id 61F44C21DE5 for ; Fri, 5 Jan 2018 07:37:59 +0000 (UTC) Received: by mail-pg0-f68.google.com with SMTP id 77so1723278pgd.8 for ; Thu, 04 Jan 2018 23:37:59 -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=zg3tNK9l6yMwj8b1QUhOzU3EmxLV2FbRwO86A1s/d60=; b=dmPewsJY0dOSdBfqyj8utLLRdxc4merfU4jwsycWrNB1noGIMob7TtRUtY+2Dl9/1j dZN2oGi/rI4UkiKo0Ye494YtaMpUqoEOHudSxnSEcW1RWJcS4eN65R3KyechsVBSu99c uElD0XRnAJ5dRaE1PYTQ4jgMH6JawTwNx2JhQ= 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=zg3tNK9l6yMwj8b1QUhOzU3EmxLV2FbRwO86A1s/d60=; b=TfL64f++Up2F2S8p1PIaeTpZWwe3C19YEUqwWW5CLNdlwr9rVUBveHMN2kamKhzJxG kRfT+0x5VQtrz+oMIHI1Uqr/8Z28gM88/n1VIpTetjUd4SVqzeZXOL1AFb5HEhBYJFqH Az96Fmuvsh+4RHzcvVh+/tki7iZ8SHfAtm6TtgWLE/3JcTZtnx/CPT2UBIsAkbUGsJAj pbLRlF8IsPilFNh1JTdnigZDE8UlKB15TlUVFAzy//J/X3Jqz1QABG4OZoX828/IrPu4 Ffww0joxONyx3pkjKpleVgeyRgWGPvRPt9L3eplyJSLKcjmktY2Fumlfpa+F9m4TLCqd tXYw== X-Gm-Message-State: AKGB3mKt/MkWI2VD7yOEl2U8crsqzHxdJ3ofJm2J8lLk3tIVeLORKfyn +OEhZlHjoOe8lUCXPuzxhPt0Zw== X-Google-Smtp-Source: ACJfBouEbRptVWbruO/sxenVh0IiL3ab554w+MOs+ux3GeeNWvXv3CxCfImgc/E1Jsz60r3zhfwARQ== X-Received: by 10.101.82.205 with SMTP id z13mr1856532pgp.134.1515137878126; Thu, 04 Jan 2018 23:37:58 -0800 (PST) Received: from localhost.localdomain ([45.56.153.113]) by smtp.gmail.com with ESMTPSA id b9sm9553789pgs.3.2018.01.04.23.37.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Jan 2018 23:37:57 -0800 (PST) From: Jun Nie To: wens@csie.org, maxime.ripard@free-electrons.com, hdegoede@redhat.com Date: Fri, 5 Jan 2018 15:37:00 +0800 Message-Id: <1515137821-30583-6-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1515137821-30583-1-git-send-email-jun.nie@linaro.org> References: <1515137821-30583-1-git-send-email-jun.nie@linaro.org> Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 5/6] sunxi: usb_phy: Clear PHYCTL register before writing 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" PHYCTL register offset at 0x10 need to be cleared before it's written. Ported from below Linux patch. d699c1d phy: sun4i-usb: change PHYCTL register clearing code Signed-off-by: Jun Nie --- arch/arm/mach-sunxi/usb_phy.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-sunxi/usb_phy.c b/arch/arm/mach-sunxi/usb_phy.c index 2f1cad1..1a6b4b4 100644 --- a/arch/arm/mach-sunxi/usb_phy.c +++ b/arch/arm/mach-sunxi/usb_phy.c @@ -156,8 +156,14 @@ __maybe_unused static void usb_phy_write(struct sunxi_usb_phy *phy, int addr, static void sunxi_usb_phy_config(struct sunxi_usb_phy *phy) { #if defined CONFIG_MACH_SUNXI_H3_H5 - if (phy->id == 0) + if (phy->id == 0) { +#if defined(CONFIG_USB_MUSB_HOST) clrbits_le32(SUNXI_USBPHY_BASE + REG_PHY_UNK_H3, 0x01); +#else + setbits_le32(SUNXI_USBPHY_BASE + REG_PHY_UNK_H3, 0x01); + writel(0, SUNXI_USB0_BASE + SUNXI_USB_CSR); +#endif + } #endif clrbits_le32(phy->base + REG_PMU_UNK_H3, 0x02); } From patchwork Fri Jan 5 07:37:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 855949 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="YnSwfRDJ"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zCc7223gVz9s7F for ; Fri, 5 Jan 2018 18:41:34 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id D3DECC21E11; Fri, 5 Jan 2018 07:39:36 +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_BLOCKED, 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 C02C0C21E14; Fri, 5 Jan 2018 07:39:32 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4912AC21DF0; Fri, 5 Jan 2018 07:38:12 +0000 (UTC) Received: from mail-pl0-f68.google.com (mail-pl0-f68.google.com [209.85.160.68]) by lists.denx.de (Postfix) with ESMTPS id 51274C21E24 for ; Fri, 5 Jan 2018 07:38:08 +0000 (UTC) Received: by mail-pl0-f68.google.com with SMTP id bd8so2639291plb.9 for ; Thu, 04 Jan 2018 23:38:08 -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=GfUJICeP89NwMktJbbPtysrYbMtGJR95aLbrL9pXg80=; b=YnSwfRDJAuzwaTQuHxhtpfC4lY3it92jiZUVcs57j6Z1ZSU5/1FcPx2pFyei0P61uC c+f3qCvOmPwRzUAhIBJYSB5nqXGlejymmZD1K/EO+fUkQy7+zn88E98jb5I6TO/vaTcs M+h3yBmMsMgE/HGJuXSzOL+uxBox/xUFt8jdY= 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=GfUJICeP89NwMktJbbPtysrYbMtGJR95aLbrL9pXg80=; b=mKWUhpDmTELx4+uzzkD4vYiHs+gzssNtCAqr8g8ncn/NySNl+uWAxkMwlRtvLarNCC B4ZJgJzta+cRqVtVsS2TIv/2D7ph/Petc4DDc5PVcqo3MySc3Y31A8LuYUhtz45bZERU BnlPQWqmPCf38NIwqo74gQigEat42GH7x9uOTeTIR0DFyQEH1YxVS4lDAV0FGmu4aTD1 1diDN+KHWQHi9vhGU8LZ9pVlqW1Jko3Wvl2IiSIKCcku92B8vnppJ8DCvUnKXuC9ri3s NcnANQRXbP6bG7YxDChTb5IQYCV4KnRdQ63rHxRBFvmwdKJH7YmfHG7clysbqbWd4kCL shiw== X-Gm-Message-State: AKGB3mL00cek9ccRST5ZN2P3Y/z6G24ARXzBf0zQF0sndvhOaqmiK5QY BZi9+w4ToYfx7nlnUcfVhA3ZMQ== X-Google-Smtp-Source: ACJfBou00WHfauEybOrQqNyidBGZsDHma55sMNo8KQYE8Urz82Y1xm1do+TyydZl6z1o1bVf6Ul5xQ== X-Received: by 10.159.234.141 with SMTP id d13mr252124plr.74.1515137886974; Thu, 04 Jan 2018 23:38:06 -0800 (PST) Received: from localhost.localdomain ([45.56.153.113]) by smtp.gmail.com with ESMTPSA id b9sm9553789pgs.3.2018.01.04.23.37.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Jan 2018 23:38:05 -0800 (PST) From: Jun Nie To: wens@csie.org, maxime.ripard@free-electrons.com, hdegoede@redhat.com Date: Fri, 5 Jan 2018 15:37:01 +0800 Message-Id: <1515137821-30583-7-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1515137821-30583-1-git-send-email-jun.nie@linaro.org> References: <1515137821-30583-1-git-send-email-jun.nie@linaro.org> Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 6/6] sunxi: Add initial Banana-Pi Zero 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" Banana-Pi Zero is designed for IOT development using the Allwinner H2+ SOC. Key features - Allwinner H2+, Quad-core Cortex-A7 - 512MB DRAM - microSD slot - Serial Debug Port - Combo WiFi/BT - HDMI Signed-off-by: Jun Nie --- arch/arm/dts/Makefile | 1 + arch/arm/dts/sun8i-h2-plus-bananapi-m2-zero.dts | 113 ++++++++++++++++++++++++ configs/bananapi_zero_defconfig | 17 ++++ 3 files changed, 131 insertions(+) create mode 100644 arch/arm/dts/sun8i-h2-plus-bananapi-m2-zero.dts create mode 100644 configs/bananapi_zero_defconfig diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index a895c70..80eec7e 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -327,6 +327,7 @@ dtb-$(CONFIG_MACH_SUN8I_A83T) += \ sun8i-a83t-cubietruck-plus.dtb \ sun8i-a83t-tbs-a711.dts dtb-$(CONFIG_MACH_SUN8I_H3) += \ + sun8i-h2-plus-bananapi-m2-zero.dtb \ sun8i-h2-plus-orangepi-zero.dtb \ sun8i-h3-bananapi-m2-plus.dtb \ sun8i-h3-orangepi-2.dtb \ diff --git a/arch/arm/dts/sun8i-h2-plus-bananapi-m2-zero.dts b/arch/arm/dts/sun8i-h2-plus-bananapi-m2-zero.dts new file mode 100644 index 0000000..4d96c16 --- /dev/null +++ b/arch/arm/dts/sun8i-h2-plus-bananapi-m2-zero.dts @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2017 Jun Nie + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/dts-v1/; +#include "sun8i-h3.dtsi" +#include "sunxi-common-regulators.dtsi" + +#include +#include + +/ { + model = "Banana Pi BPI-M2-Zero"; + compatible = "sinovoip,bpi-m2-zero", "allwinner,sun8i-h2-plus"; + + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + + pwr_led { + label = "bananapi-m2-zero:red:pwr"; + gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */ + default-state = "on"; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + + sw4 { + label = "power"; + linux,code = ; + gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&mmc0 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc0_pins_a>; + vmmc-supply = <®_vcc3v3>; + bus-width = <4>; + /* + * In different revisions the board have different card detect + * configuration. + */ + broken-cd; + status = "okay"; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins_a>; + status = "okay"; +}; + +&usb_otg { + dr_mode = "otg"; + status = "okay"; +}; + +&usbphy { + usb0_id_det-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */ + /* USB OTG VBUS is directly connected to 5V without any regulators */ + status = "okay"; +}; diff --git a/configs/bananapi_zero_defconfig b/configs/bananapi_zero_defconfig new file mode 100644 index 0000000..9c78b21 --- /dev/null +++ b/configs/bananapi_zero_defconfig @@ -0,0 +1,17 @@ +CONFIG_ARM=y +CONFIG_ARCH_SUNXI=y +CONFIG_MACH_SUN8I_H3=y +CONFIG_DRAM_CLK=408 +CONFIG_DRAM_ZQ=3881979 +CONFIG_DRAM_ODT_EN=y +CONFIG_DEFAULT_DEVICE_TREE="sun8i-h2-plus-bananapi-m2-zero" +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_SPL=y +# CONFIG_CMD_FLASH is not set +# CONFIG_CMD_FPGA is not set +CONFIG_CMD_USB_MASS_STORAGE=y +# CONFIG_SPL_DOS_PARTITION is not set +# CONFIG_SPL_ISO_PARTITION is not set +# CONFIG_SPL_EFI_PARTITION is not set +CONFIG_MMC_BROKEN_CD=y +CONFIG_USB_MUSB_GADGET=y