From patchwork Mon Mar 18 10:11:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 10857273 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 13EED139A for ; Mon, 18 Mar 2019 10:12:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3D2C29229 for ; Mon, 18 Mar 2019 10:12:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D847B2932C; Mon, 18 Mar 2019 10:12:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5E87F29229 for ; Mon, 18 Mar 2019 10:12:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=QtDA5JqNsCv5mR1lWjCjHGzdRNGiChm9c9KQYUimagY=; b=pdKB1RVmHVyjed Qgo3Q5rHJDYrPrHpxrzRKHdW2lD3pXM2e9LIdTYFM/E5BN/hUfPfkb7ivvpoN+PyaenVnbYRfR8+e B32kFIkc+jGJxULJz/Vb4uLV2TIkPtHqB/5e1/N5w98b56IIUUqDtt5FAUNmWhaMAjwejzppK3W4C SpOHit/rpTWxvPMVZomUIVPOyOSc8UkHFOdC52Bf0gd+e5IzRUeH6wN1NYAIzH8LiuOBAwsW0xnst v7Y7Gk+tfifeHgmsT8WBe0sAc3P+BfhqxaWzodNCkOhQA4ytxmNvuhEiDtYmFazS/M5oWo8K40j/z EAxF7yiV7gCNyM4hTnYQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h5pFR-0007PG-Rx; Mon, 18 Mar 2019 10:12:01 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h5pFN-0007MP-O2 for linux-amlogic@lists.infradead.org; Mon, 18 Mar 2019 10:11:59 +0000 Received: by mail-wr1-x441.google.com with SMTP id y13so11797505wrd.3 for ; Mon, 18 Mar 2019 03:11:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Ld3J54sxdg0UMOT5kawtLOALpYru6XDyZnBywhjdwFY=; b=eW+k4b5DdsCuGskaXhzPaxWlByaOtCJFvGhk1DYz8aOqEygOu4FbcZJExlTVMeevMS smM3oVK3dIxxalrP3VOvj/5+4BtrLyITf5w6CGlMNTlSAG7M19rowZIdKGNDjnY71Fh7 yRVo0x9UbozVoXRKBgdAimdqBbSVMPQnGKDC1ULMv6C1LewlQ5vCOQPLsrMytyogfB1z G6Ob3upkSeHwD4kS1rOl+Vl+QAIlCjjA9sw+ErqHnVkT38y3SJRMEQj8xeRjFbJuJVMT DP6QusY5JESCt0XOYEDZnLdANb2sIWv4oSTFGb7YGDga16SwiCERucHOfNO83r4naaBw ex+g== 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:mime-version :content-transfer-encoding; bh=Ld3J54sxdg0UMOT5kawtLOALpYru6XDyZnBywhjdwFY=; b=Hvxf9LKi/8Lj98Ow446eeRFzTtl2IIgrbYknLrQQtxZZxdoyuWgF2h0Tp8Zzr9br81 GYUJvMDNq1nYAPIW84pAA2qwJmh7+FArQnkAeDS9TMTui9iR9gHQH6bonjlrG7DqJ5vg jKrqUbikRQZWMXyuCdeGFZlbxfZuScArJWG39do/Gf5ymJlT33Q8rDTaPcOZp06dBbM0 JCgvteBkVzP+98assKh6owKs0DcofMzEb6bDnFInVjqP7jLfx9TvGiUrqqm+CcV3ofaf 1xh3++dAuhuSp+4H/c4loCSRP48qNoHlIfn0WRUigCZe6HYUBYbWhNaET9iSsUNnF9GL 734A== X-Gm-Message-State: APjAAAXtUE/Eg7sPyCbWkSC6xbc1NWSi6H6kHvQnrtCUU6p+70OxBQ2H 394d9TUScQksrlEELccogA9C18s+yGVebA== X-Google-Smtp-Source: APXvYqyTCPSUV43gmVFixqzLHYM7X1XcD29QDt16ivjitPCf1YsDRCNP86SM+hdy4s7Y1nODBCjfRw== X-Received: by 2002:adf:eb8f:: with SMTP id t15mr4506723wrn.119.1552903916098; Mon, 18 Mar 2019 03:11:56 -0700 (PDT) Received: from bender.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id z8sm6697855wrl.59.2019.03.18.03.11.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Mar 2019 03:11:55 -0700 (PDT) From: Neil Armstrong To: gregkh@linuxfoundation.org, hminas@synopsys.com, balbi@kernel.org, kishon@ti.com Subject: [PATCH v3 0/8] arm64: meson: Add support for USB on Amlogic G12A Date: Mon, 18 Mar 2019 11:11:45 +0100 Message-Id: <20190318101153.7531-1-narmstrong@baylibre.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190318_031157_786350_6CB0765A X-CRM114-Status: GOOD ( 13.69 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Neil Armstrong Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patchset adds support for USB on Amlogic G12A SoCs. This patchset is composed with : - bindings of the PHYs - bindings of the USB Control Glue - PHY Drivers - USB Control Glue driver Device Tree nodes will be added in a separate patchset. The Amlogic G12A USB Complex is composed of : - 2 USB Controllers : * DWC3 for USB2 and USB3 Host functionality * DWC2 for USB2 Peripheral functionality - 2 USB2 OTG PHYs, only a single one will be routed to either DWC2 to DWC3 - 1 USB3 PHY shared with PCIE funcionnality - A Glue to control PHY routing, setup and OTG detection The Glue configures the UTMI 8bit interfaces for the USB2 PHYs, including routing of the OTG PHY between the DWC3 and DWC2 controllers, and setups the on-chip OTG mode selection for this PHY. This drivers supports the on-probe setup of the OTG mode, and manually via the USB Role interface. The IRQ mode change detect is yet to be added in a future patchset, mainly due to lack of hardware to validate on. Changes since v2 at [1]: - Collected review tags - Removed syscon.h in usb2 phy driver - Added comment on the USB3/PCIe switch - Renamed dwc3_meson_g12a_usb_init_mode in glue driver - Changed indentation in dwc3_meson_g12a_role_set - Switched to of_get_compatible_child in glue code - Added devm_add_action_or_reset() to disable clock in case of probe failure - Checks priv->vbus before enabling regulator - Switched phy_init/phy_power_on - Removed priv->phys[i] NULL checks in suspend code - Removed clk_disable_unprepare/clk_put in remove code Changes since v1 at [0]: - USB2 PHY Bindings: collected tags and updated commit log - USB3/PCIE PHY Bindings: collected tag and updated reset list - DWC2 Compatible: collected tags - DWC3 Glue Bindings: - removed clock-names and reset-names for single entries - removed ports graph for PHYs and replaced by phys list with phy-names - added dr_mode and optional vbus-supply - fixed example - USB2 PHY Driver: removed USB_SUPPORT and otg.h include - USB3/PCIE PHY Driver: removed USB_SUPPORT, fixed comment and unused reg variable - USB Glue Driver: - Moved debugfs I/F to USB_ROLE_SWITCH framework - Integrated USB Glue Control Registers offset - Removed of graph parsing to use devm_phy_optional_get() - Fixed PHY mode handling and OTG switching - Simplified PHY calls by removing the NULL test - Added optional vbus regulator handling [1] https://lkml.kernel.org/r/20190212151413.24632-1-narmstrong@baylibre.com [2] https://lkml.kernel.org/r/20190304103846.2060-1-narmstrong@baylibre.com Neil Armstrong (8): dt-bindings: phy: Add Amlogic G12A USB2 PHY Bindings dt-bindings: phy: Add Amlogic G12A USB3+PCIE Combo PHY Bindings dt-bindings: usb: dwc2: Add Amlogic G12A DWC2 Compatible dt-bindings: usb: dwc3: Add Amlogic G12A DWC3 Glue Bindings phy: amlogic: add Amlogic G12A USB2 PHY Driver phy: amlogic: Add Amlogic G12A USB3 + PCIE Combo PHY Driver usb: dwc2: Add Amlogic G12A DWC2 Params usb: dwc3: Add Amlogic G12A DWC3 glue .../bindings/phy/meson-g12a-usb2-phy.txt | 22 + .../bindings/phy/meson-g12a-usb3-pcie-phy.txt | 22 + .../devicetree/bindings/usb/amlogic,dwc3.txt | 88 +++ .../devicetree/bindings/usb/dwc2.txt | 1 + drivers/phy/amlogic/Kconfig | 22 + drivers/phy/amlogic/Makefile | 2 + drivers/phy/amlogic/phy-meson-g12a-usb2.c | 189 ++++++ .../phy/amlogic/phy-meson-g12a-usb3-pcie.c | 413 ++++++++++++ drivers/usb/dwc2/params.c | 12 + drivers/usb/dwc3/Kconfig | 10 + drivers/usb/dwc3/Makefile | 1 + drivers/usb/dwc3/dwc3-meson-g12a.c | 602 ++++++++++++++++++ 12 files changed, 1384 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/meson-g12a-usb2-phy.txt create mode 100644 Documentation/devicetree/bindings/phy/meson-g12a-usb3-pcie-phy.txt create mode 100644 drivers/phy/amlogic/phy-meson-g12a-usb2.c create mode 100644 drivers/phy/amlogic/phy-meson-g12a-usb3-pcie.c create mode 100644 drivers/usb/dwc3/dwc3-meson-g12a.c