From patchwork Tue Sep 1 17:22:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1355285 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sartura.hr Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sartura-hr.20150623.gappssmtp.com header.i=@sartura-hr.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=no5io0qE; dkim-atps=neutral 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bgv702T0Bz9sXV for ; Wed, 2 Sep 2020 03:23:40 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1D49A82284; Tue, 1 Sep 2020 19:23:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sartura.hr 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=sartura-hr.20150623.gappssmtp.com header.i=@sartura-hr.20150623.gappssmtp.com header.b="no5io0qE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2F738808B2; Tue, 1 Sep 2020 19:23:16 +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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,UPPERCASE_50_75,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8E810808B2 for ; Tue, 1 Sep 2020 19:23:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sartura.hr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=robert.marko@sartura.hr Received: by mail-wm1-x343.google.com with SMTP id a9so1966152wmm.2 for ; Tue, 01 Sep 2020 10:23:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura-hr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WO/Hx8XnHqA3dS2Yzy8eM5Uql8hlBHtJ2rt41jOIMYc=; b=no5io0qEwImiBYrv0wQxHHH5Q5aKBoMCc8VVw3QDx8bdHR2Oru0ciPDhbeFnGGjukY tKLZMEMuiPDSf1KcTDe9NEt3JwHOBZ8mRAw8IyswNsU6UNHyBLBJ6Ou5OjyjW8TcMkIs gvLQZ/WYaetiviIdi+bOFtJ+ol6mDdc1GhA+1yQUd+gDOg1m45OZey/fiZ/QTuCdgeha jD93XClABqq7Da02AH7t3XLDs0G8KqXGltYLQlzeF/Fx6MyjgrDgbkhvR8bmpfboknbs wRAgIgeg2rjdKu2NB3+l47OdhhBh+SjwOjFcq8ls1ZrnpXZHCWQCLMzMG8j5NlS3wmtt 0UDQ== 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:content-transfer-encoding; bh=WO/Hx8XnHqA3dS2Yzy8eM5Uql8hlBHtJ2rt41jOIMYc=; b=Kvk3AQfFqD+IO2f8TZFqLgEoZ5np5dYjc50g50J8MFd9UOl1Uj+kJZQQSpB3uANn0q 9+/A17oTbQ7LufAnXGVJiihdVdgCz28VLvXF1cGlw5Nz+93qDm2hmZr2u5L3bY/mzw8E 5+g5meeRrX4ITswPEINKAurPg7Y5N+HglWNQWtwcgG3dwp4SLdU8gY/ptqZveWW+HAw2 9lwBrcnamKs7jlbBa6YzwJAX53TJZ3M+GgpRIPvDgjvl0bhYzzYGngVey53cDLnUkvd8 lejoitCRsANIPJ4r9DKNdq5hMLF/CQzFlLheDYI6mYIQeyUAKRyxxSC3fnV6W10skZUa HUQQ== X-Gm-Message-State: AOAM531kA1auPU7vmNmFINaZbjOWiNWWXEAvT0TIiRx+c1UjT9kdIwc5 C5iQ8T7xj7Z9KI3K6yrnQ6mPw6lEPdgwL3mR/4DACOsT4YNXcE4fPkIFPHpvHmdoXEoVy8fB3RP Y3pYQEEm84t70QWk1HPQy4g2Sb+BLBPiyf3VVRd2mqKxDznD52m+4RdbQP0MwR4FxvBkGESbr X-Google-Smtp-Source: ABdhPJw1XoM4MdzWvW58v0eXnqgv5RD2JSe2sGbfZHdkdAeSDzyyj+9Pw0BCJafTctFpRZm3H3y5cw== X-Received: by 2002:a1c:1f41:: with SMTP id f62mr2911807wmf.51.1598980992692; Tue, 01 Sep 2020 10:23:12 -0700 (PDT) Received: from localhost.localdomain (dh207-99-46.xnet.hr. [88.207.99.46]) by smtp.googlemail.com with ESMTPSA id v7sm4419469wma.1.2020.09.01.10.23.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2020 10:23:12 -0700 (PDT) From: Robert Marko To: u-boot@lists.denx.de Cc: Robert Marko , Luka Perkov Subject: [PATCH v2 1/9] dt-bindings: clock: import Qualcomm IPQ4019 bindings Date: Tue, 1 Sep 2020 19:22:54 +0200 Message-Id: <20200901172302.551467-2-robert.marko@sartura.hr> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200901172302.551467-1-robert.marko@sartura.hr> References: <20200901172302.551467-1-robert.marko@sartura.hr> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Import Qualcomm IPQ4019 GCC bindings from Linux. This will enable using bindings instead of raw clock numbers both in the driver and DTS like Linux does. Signed-off-by: Robert Marko Cc: Luka Perkov --- MAINTAINERS | 1 + include/dt-bindings/clock/qcom,ipq4019-gcc.h | 96 ++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 include/dt-bindings/clock/qcom,ipq4019-gcc.h diff --git a/MAINTAINERS b/MAINTAINERS index bebe87b4d1..c0e902a424 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -237,6 +237,7 @@ M: Luka Kovacic M: Luka Perkov S: Maintained F: arch/arm/mach-ipq40xx/ +F: include/dt-bindings/clock/qcom,ipq4019-gcc.h ARM MARVELL KIRKWOOD ARMADA-XP ARMADA-38X ARMADA-37XX ARMADA-7K/8K M: Stefan Roese diff --git a/include/dt-bindings/clock/qcom,ipq4019-gcc.h b/include/dt-bindings/clock/qcom,ipq4019-gcc.h new file mode 100644 index 0000000000..7130e222e4 --- /dev/null +++ b/include/dt-bindings/clock/qcom,ipq4019-gcc.h @@ -0,0 +1,96 @@ +/* Copyright (c) 2015 The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ +#ifndef __QCOM_CLK_IPQ4019_H__ +#define __QCOM_CLK_IPQ4019_H__ + +#define GCC_DUMMY_CLK 0 +#define AUDIO_CLK_SRC 1 +#define BLSP1_QUP1_I2C_APPS_CLK_SRC 2 +#define BLSP1_QUP1_SPI_APPS_CLK_SRC 3 +#define BLSP1_QUP2_I2C_APPS_CLK_SRC 4 +#define BLSP1_QUP2_SPI_APPS_CLK_SRC 5 +#define BLSP1_UART1_APPS_CLK_SRC 6 +#define BLSP1_UART2_APPS_CLK_SRC 7 +#define GCC_USB3_MOCK_UTMI_CLK_SRC 8 +#define GCC_APPS_CLK_SRC 9 +#define GCC_APPS_AHB_CLK_SRC 10 +#define GP1_CLK_SRC 11 +#define GP2_CLK_SRC 12 +#define GP3_CLK_SRC 13 +#define SDCC1_APPS_CLK_SRC 14 +#define FEPHY_125M_DLY_CLK_SRC 15 +#define WCSS2G_CLK_SRC 16 +#define WCSS5G_CLK_SRC 17 +#define GCC_APSS_AHB_CLK 18 +#define GCC_AUDIO_AHB_CLK 19 +#define GCC_AUDIO_PWM_CLK 20 +#define GCC_BLSP1_AHB_CLK 21 +#define GCC_BLSP1_QUP1_I2C_APPS_CLK 22 +#define GCC_BLSP1_QUP1_SPI_APPS_CLK 23 +#define GCC_BLSP1_QUP2_I2C_APPS_CLK 24 +#define GCC_BLSP1_QUP2_SPI_APPS_CLK 25 +#define GCC_BLSP1_UART1_APPS_CLK 26 +#define GCC_BLSP1_UART2_APPS_CLK 27 +#define GCC_DCD_XO_CLK 28 +#define GCC_GP1_CLK 29 +#define GCC_GP2_CLK 30 +#define GCC_GP3_CLK 31 +#define GCC_BOOT_ROM_AHB_CLK 32 +#define GCC_CRYPTO_AHB_CLK 33 +#define GCC_CRYPTO_AXI_CLK 34 +#define GCC_CRYPTO_CLK 35 +#define GCC_ESS_CLK 36 +#define GCC_IMEM_AXI_CLK 37 +#define GCC_IMEM_CFG_AHB_CLK 38 +#define GCC_PCIE_AHB_CLK 39 +#define GCC_PCIE_AXI_M_CLK 40 +#define GCC_PCIE_AXI_S_CLK 41 +#define GCC_PCNOC_AHB_CLK 42 +#define GCC_PRNG_AHB_CLK 43 +#define GCC_QPIC_AHB_CLK 44 +#define GCC_QPIC_CLK 45 +#define GCC_SDCC1_AHB_CLK 46 +#define GCC_SDCC1_APPS_CLK 47 +#define GCC_SNOC_PCNOC_AHB_CLK 48 +#define GCC_SYS_NOC_125M_CLK 49 +#define GCC_SYS_NOC_AXI_CLK 50 +#define GCC_TCSR_AHB_CLK 51 +#define GCC_TLMM_AHB_CLK 52 +#define GCC_USB2_MASTER_CLK 53 +#define GCC_USB2_SLEEP_CLK 54 +#define GCC_USB2_MOCK_UTMI_CLK 55 +#define GCC_USB3_MASTER_CLK 56 +#define GCC_USB3_SLEEP_CLK 57 +#define GCC_USB3_MOCK_UTMI_CLK 58 +#define GCC_WCSS2G_CLK 59 +#define GCC_WCSS2G_REF_CLK 60 +#define GCC_WCSS2G_RTC_CLK 61 +#define GCC_WCSS5G_CLK 62 +#define GCC_WCSS5G_REF_CLK 63 +#define GCC_WCSS5G_RTC_CLK 64 +#define GCC_APSS_DDRPLL_VCO 65 +#define GCC_SDCC_PLLDIV_CLK 66 +#define GCC_FEPLL_VCO 67 +#define GCC_FEPLL125_CLK 68 +#define GCC_FEPLL125DLY_CLK 69 +#define GCC_FEPLL200_CLK 70 +#define GCC_FEPLL500_CLK 71 +#define GCC_FEPLL_WCSS2G_CLK 72 +#define GCC_FEPLL_WCSS5G_CLK 73 +#define GCC_APSS_CPU_PLLDIV_CLK 74 +#define GCC_PCNOC_AHB_CLK_SRC 75 + +#endif From patchwork Tue Sep 1 17:22:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1355286 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sartura.hr Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sartura-hr.20150623.gappssmtp.com header.i=@sartura-hr.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=uiSNKJ8/; dkim-atps=neutral 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bgv791K4xz9sXV for ; Wed, 2 Sep 2020 03:23:49 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 48D0282296; Tue, 1 Sep 2020 19:23:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sartura.hr 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=sartura-hr.20150623.gappssmtp.com header.i=@sartura-hr.20150623.gappssmtp.com header.b="uiSNKJ8/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 639A182284; Tue, 1 Sep 2020 19:23:17 +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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EF72B80422 for ; Tue, 1 Sep 2020 19:23:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sartura.hr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=robert.marko@sartura.hr Received: by mail-wm1-x343.google.com with SMTP id e17so1928239wme.0 for ; Tue, 01 Sep 2020 10:23:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura-hr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+IgE86ahwb2/JSHGl6IqPs8qQVq9kV6evYDG7lIaIOM=; b=uiSNKJ8/Hx1avSktlQSx2QpK8rMITMFNOVfCPCadrvqR819C1KiUvtogaY8uwA7qcA zSiHoPmkqCPUO+dTQ4QStQmUjAi1GdkABoKsPfbSYPBrEZn4nGikmkkwhSe0PzWjiIQl fh2h/2IK6hjcE6/+LEq6J2lo6iQypucNRPa+hliV7YRKQCIpMrpKIvZpfCHTgcMkCkUx PGNsa5vWczjaxHrlRZOAxi57Pppkqf8cXyhJmpEmooohTxZqjWU2Q4tFwZgXhzfP5InY lsmi8O3rHtmdwx8muutC7rP4w2pfw4TxQP/jdPSQdmx6Acv+iWZ9wXsRLiR99b+X3fUz pIUA== 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:content-transfer-encoding; bh=+IgE86ahwb2/JSHGl6IqPs8qQVq9kV6evYDG7lIaIOM=; b=q3J6jevMGIXbWZipnAQDyxq8lgg2jTuSdmIQXTkCS1zrYALhZ+AftmYBYb8XOP4qCM JumHRZ3z0dA1x+eckgHkW0gg5siAZRk/5urljs4wF1tj+cxE3NyBnfxhrLpeFAVGiht7 dfnJ0x8QlnbHV9pgiXQTL5RCx0T9cyeRLCTlVswYqU1nQcvyrwsrL42TPNmhhyzQ62A6 /eRFTXT31B7YYPeJS67cPdItwTgi5l9LZcQh7ap6TaP7Du6kU8eLBB7HFp89/lPiQV4X oE4Ta/eliSJ63nOrS8BDDWnHVkmasDnx4XlPssuqslSm38T/Rv2TimYHSbt9Xaf4OGdA v45w== X-Gm-Message-State: AOAM531QTKADzAJqebefwK2gBtG1LAHU5mTLVw/ndeyzIqGlegv1K31o r+vtpstGuO2l3/Cj85OYoQthOwYrufX7a4YF48AY73xej5WXDd62jzm85LCHs9NeaKp421riecE oXvvSTZHkMDPMJu+w8Nf3Zh0i9QWFiTceR9KUqYt1FlXrhqFaTjO+EyUHbOzUFVB8SfhbsXWz X-Google-Smtp-Source: ABdhPJwLnxICgn+LKy8hd6kLzroEYll6gTEWiywUXeBvtm/9Dc7RKn+fT0Ui+sH4JESXAwB8lmlLVQ== X-Received: by 2002:a1c:e389:: with SMTP id a131mr2830974wmh.181.1598980994164; Tue, 01 Sep 2020 10:23:14 -0700 (PDT) Received: from localhost.localdomain (dh207-99-46.xnet.hr. [88.207.99.46]) by smtp.googlemail.com with ESMTPSA id v7sm4419469wma.1.2020.09.01.10.23.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2020 10:23:13 -0700 (PDT) From: Robert Marko To: u-boot@lists.denx.de Cc: Robert Marko , Luka Perkov Subject: [PATCH v2 2/9] IPQ40xx: clk: Use dt-bindings instead of hardcoding Date: Tue, 1 Sep 2020 19:22:55 +0200 Message-Id: <20200901172302.551467-3-robert.marko@sartura.hr> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200901172302.551467-1-robert.marko@sartura.hr> References: <20200901172302.551467-1-robert.marko@sartura.hr> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Its common to use dt-bindings instead of hard-coding clocks or resets. So lets use the imported Linux GCC bindings on IPQ40xx target. Signed-off-by: Robert Marko Cc: Luka Perkov --- arch/arm/dts/qcom-ipq4019.dtsi | 3 ++- arch/arm/mach-ipq40xx/clock-ipq4019.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/arm/dts/qcom-ipq4019.dtsi b/arch/arm/dts/qcom-ipq4019.dtsi index 5f78bc5ab9..7b3b5e0248 100644 --- a/arch/arm/dts/qcom-ipq4019.dtsi +++ b/arch/arm/dts/qcom-ipq4019.dtsi @@ -10,6 +10,7 @@ #include "skeleton.dtsi" #include #include +#include / { #address-cells = <1>; @@ -61,7 +62,7 @@ blsp1_uart1: serial@78af000 { compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; reg = <0x78af000 0x200>; - clock = <&gcc 26>; + clock = <&gcc GCC_BLSP1_UART1_APPS_CLK>; bit-rate = <0xFF>; status = "disabled"; u-boot,dm-pre-reloc; diff --git a/arch/arm/mach-ipq40xx/clock-ipq4019.c b/arch/arm/mach-ipq40xx/clock-ipq4019.c index 7cf98a203c..83a688e625 100644 --- a/arch/arm/mach-ipq40xx/clock-ipq4019.c +++ b/arch/arm/mach-ipq40xx/clock-ipq4019.c @@ -13,6 +13,8 @@ #include #include +#include + struct msm_clk_priv { phys_addr_t base; }; @@ -20,7 +22,7 @@ struct msm_clk_priv { ulong msm_set_rate(struct clk *clk, ulong rate) { switch (clk->id) { - case 26: /*UART1*/ + case GCC_BLSP1_UART1_APPS_CLK: /*UART1*/ /* This clock is already initialized by SBL1 */ return 0; break; From patchwork Tue Sep 1 17:22:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1355287 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sartura.hr Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sartura-hr.20150623.gappssmtp.com header.i=@sartura-hr.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=E1m2ahAT; dkim-atps=neutral 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bgv7Q42TJz9sXV for ; Wed, 2 Sep 2020 03:24:02 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2DD8D822B5; Tue, 1 Sep 2020 19:23:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sartura.hr 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=sartura-hr.20150623.gappssmtp.com header.i=@sartura-hr.20150623.gappssmtp.com header.b="E1m2ahAT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0407582294; Tue, 1 Sep 2020 19:23:19 +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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7FC93821FF for ; Tue, 1 Sep 2020 19:23:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sartura.hr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=robert.marko@sartura.hr Received: by mail-wm1-x343.google.com with SMTP id o21so1979745wmc.0 for ; Tue, 01 Sep 2020 10:23:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura-hr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2mF5V9WsGy/J36E9ZlfVjdQK7aTyahRXokv0dn4vI6A=; b=E1m2ahATmsgSDDxoq0vZkgkQUjqJj+QwHb5Nqs4/gm40ue6RaDuVeImwmrcm1gHrQx UgH5mSUuu4821O1k5B3rNO+QVMSmXU2FnK1hECUrCBGcDHais9Voew1M18k8QIP+WvXZ 5VwA/PKImu1aUZ4P1UJpi2Ew51ngTaJZgi1/J374juob7fMaYhb9Q6Ty7t7P9BUVQtzg ccGKFalRjZpqc8P7Q//OZe64IbXcJ2tBEJ2tGkNpf0+05/4b+L2+dOs7aBxHYdSnNL4a ofAjjQ9GBfxnqQ7Uc5UtHNpDwO/b0wAiMqTbkZ5R4GpW9AbNMfaX+cqw6dWEJqw3hkBr vF8A== 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:content-transfer-encoding; bh=2mF5V9WsGy/J36E9ZlfVjdQK7aTyahRXokv0dn4vI6A=; b=P2dlWv6Tssv1eKVbrGr1Akxfg1J4If+iISujQFFZFN1ndfrEPURFbwJUut6eI4xSkV RoKMqm6MyKs4NcbyXIwaDSxZJ1InicM0mOzEW3Bq88i/rHfrJ88KfhtN2PvHf/qZrNxU rCRCpvx/oHUxfLj+TvbKDLN8dWVSEdIqR+eSu1lFYIQl3ES0mcbz7Kmnp4j/1gIutB7U LkTsgq+j12XU7EjzeQ0FuvUZZJW2qAFQhP3pTuq0zWslY/k1q2THNNS42PCXqSD5n6Ex ICsUpdrXc828fEPVczDD4R5i23tfLf1gWL0jFXJgN/uHPzoGHEtHsokBPEWuWWU+Qi3C Q/5g== X-Gm-Message-State: AOAM532mTlPFnPfL6QdqPLWNIH3J7bhRUNoGEcsbTH5okYjqzdrVJH1D 8Phd/vL5CvEixROsQUQ8jbOM22E2m4qDB/piNIUmbquW1aLcs8+dUGQZCGJtwPlIJC9hGp2sQCH 1ElKh3zg3QXRhYFY6pbIhx+wFUSCwMXYq3YRD+v7VFBGr3vFJRCx4rDxuuveZtKTmHZETyHQO X-Google-Smtp-Source: ABdhPJzY12kpbrv8v+PoCaQ30yuZy10KpeIDnN2bBQjIh32eo6nA5mhLjEsNri1UdQt8jktGxaDLhA== X-Received: by 2002:a1c:6487:: with SMTP id y129mr2912499wmb.90.1598980995708; Tue, 01 Sep 2020 10:23:15 -0700 (PDT) Received: from localhost.localdomain (dh207-99-46.xnet.hr. [88.207.99.46]) by smtp.googlemail.com with ESMTPSA id v7sm4419469wma.1.2020.09.01.10.23.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2020 10:23:15 -0700 (PDT) From: Robert Marko To: u-boot@lists.denx.de Cc: Robert Marko , Luka Perkov Subject: [PATCH v2 3/9] IPQ40xx: Add SMEM support Date: Tue, 1 Sep 2020 19:22:56 +0200 Message-Id: <20200901172302.551467-4-robert.marko@sartura.hr> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200901172302.551467-1-robert.marko@sartura.hr> References: <20200901172302.551467-1-robert.marko@sartura.hr> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean There is already existing driver for SMEM so lets enable it for IPQ40xx as well. Signed-off-by: Robert Marko Cc: Luka Perkov --- arch/arm/Kconfig | 2 ++ arch/arm/dts/qcom-ipq4019.dtsi | 5 +++++ drivers/smem/Kconfig | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 80702c23d3..ee378f03f4 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -767,8 +767,10 @@ config ARCH_IPQ40XX select DM select DM_GPIO select DM_SERIAL + select MSM_SMEM select PINCTRL select CLK + select SMEM select OF_CONTROL imply CMD_DM diff --git a/arch/arm/dts/qcom-ipq4019.dtsi b/arch/arm/dts/qcom-ipq4019.dtsi index 7b3b5e0248..dd69d0a5b2 100644 --- a/arch/arm/dts/qcom-ipq4019.dtsi +++ b/arch/arm/dts/qcom-ipq4019.dtsi @@ -39,6 +39,11 @@ }; }; + smem { + compatible = "qcom,smem"; + memory-region = <&smem_mem>; + }; + soc: soc { #address-cells = <1>; #size-cells = <1>; diff --git a/drivers/smem/Kconfig b/drivers/smem/Kconfig index 7169d0f205..73d51b3a7a 100644 --- a/drivers/smem/Kconfig +++ b/drivers/smem/Kconfig @@ -15,7 +15,7 @@ config SANDBOX_SMEM config MSM_SMEM bool "Qualcomm Shared Memory Manager (SMEM)" depends on DM - depends on ARCH_SNAPDRAGON + depends on ARCH_SNAPDRAGON || ARCH_IPQ40XX help Enable support for the Qualcomm Shared Memory Manager. The driver provides an interface to items in a heap shared among all From patchwork Tue Sep 1 17:22:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1355288 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sartura.hr Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sartura-hr.20150623.gappssmtp.com header.i=@sartura-hr.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=RScQtbd5; dkim-atps=neutral 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bgv7g75Dmz9sXX for ; Wed, 2 Sep 2020 03:24:15 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B46F6822C4; Tue, 1 Sep 2020 19:23:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sartura.hr 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=sartura-hr.20150623.gappssmtp.com header.i=@sartura-hr.20150623.gappssmtp.com header.b="RScQtbd5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 44030822AF; Tue, 1 Sep 2020 19:23:21 +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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1BF5E82281 for ; Tue, 1 Sep 2020 19:23:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sartura.hr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=robert.marko@sartura.hr Received: by mail-wr1-x441.google.com with SMTP id z4so2424559wrr.4 for ; Tue, 01 Sep 2020 10:23:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura-hr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lM+GWG7hzWPdxk4fvXrAjvzVBbGG9/78QfqkXDDAqwQ=; b=RScQtbd5DjQWiZalW2j+rK6efKqWnNcpHdVEEXE0w4reU00fq1c/QTLx3fPOBxKc8E IpqoEYCNYIC/8rQd0cSiH/7BP9jH0L9GctMMzHLu7cb/pzRRA3JhHC+L01HuFnh4Xg8z ldZw4URmVISNVFVRcOg1aY6N7aQnXeHDNurOAtaHjvhTc/47RStJKC6IbCTNtPhb+Jan bkODhC7dIH8T833HADm3RBFsK1WBYoOh3F+GKUSsrBK8TDB2G4RwjXuHQa/dU424Br6M j5WrGLBw4k2A6KXqzZmDtr5JGIPFXo+3HOn6fuKq14IWDrXCmPCVWz5jvkJ8ormoseDn 5Yow== 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:content-transfer-encoding; bh=lM+GWG7hzWPdxk4fvXrAjvzVBbGG9/78QfqkXDDAqwQ=; b=h2cue+OAsGxhkQWezngQT21nO/ZkvOX9/kc7R/hx8+zGN2HTsiS9lBnkMkd7giWh0Y SAMRRQf4T8uVm58pg8xlRsMlPuU/5QqfHL7B3l/ERf92mG0YdObCqE7ldpBe5ZdH/k0j 1cexBinhybc4aSl3u3CvAFPFLzERQk2zmsJMrtFu+7A52lA7QurGw4wUBaNsaVl5fE+C FynGK+3N1Uu5NAU1CaJ4jBFex9x4ibwazl1bdfqvd7eXYW5JuPnJojS6nBYRGJvc3ydY qP4JUmA6jAcSYydw+J5dELRQ33mJmgl4xHFu+WF8sBszrLhI8wMxk4QOBNyTXClKAqrs SuQQ== X-Gm-Message-State: AOAM533fydeuz981GPTA/gr9jsQ2oCyKIXz5x88sxOHtc8Rqk2a0KZXh TNIBqUA3EcEcRTp4HlFPVvmQWqBntDEaUM3WvIxLY45sSPfcRVsyy9oHPhLQ67YkflQ9Vfq3qrP mMOm/NAWPwLoVb27wS6OZ17vXYlkx8+VvWNWD5oGxu+vjbhMA+l6M7n8Rsn3KEnCci4u44Sox X-Google-Smtp-Source: ABdhPJzIZMhw6oyOJzbNe8Vcz76Tozht8J59QmtVXVHHP2tM2NMgWQWNAbrNua+DbEDFKtALLnJtuQ== X-Received: by 2002:adf:e6c2:: with SMTP id y2mr3178013wrm.117.1598980997151; Tue, 01 Sep 2020 10:23:17 -0700 (PDT) Received: from localhost.localdomain (dh207-99-46.xnet.hr. [88.207.99.46]) by smtp.googlemail.com with ESMTPSA id v7sm4419469wma.1.2020.09.01.10.23.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2020 10:23:16 -0700 (PDT) From: Robert Marko To: u-boot@lists.denx.de Cc: Robert Marko , Luka Perkov Subject: [PATCH v2 4/9] reset: Add IPQ40xx reset controller driver Date: Tue, 1 Sep 2020 19:22:57 +0200 Message-Id: <20200901172302.551467-5-robert.marko@sartura.hr> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200901172302.551467-1-robert.marko@sartura.hr> References: <20200901172302.551467-1-robert.marko@sartura.hr> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean On Qualcomm IPQ40xx SoC series, GCC clock IP also handles the resets. So since this will be needed by further drivers, lets add a driver for the reset controller. Signed-off-by: Robert Marko Cc: Luka Perkov --- MAINTAINERS | 2 + drivers/reset/Kconfig | 8 + drivers/reset/Makefile | 1 + drivers/reset/reset-ipq4019.c | 173 ++++++++++++++++++ .../dt-bindings/reset/qcom,ipq4019-reset.h | 92 ++++++++++ 5 files changed, 276 insertions(+) create mode 100644 drivers/reset/reset-ipq4019.c create mode 100644 include/dt-bindings/reset/qcom,ipq4019-reset.h diff --git a/MAINTAINERS b/MAINTAINERS index c0e902a424..f4fc823e4e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -238,6 +238,8 @@ M: Luka Perkov S: Maintained F: arch/arm/mach-ipq40xx/ F: include/dt-bindings/clock/qcom,ipq4019-gcc.h +F: include/dt-bindings/reset/qcom,ipq4019-reset.h +F: drivers/reset/reset-ipq4019.c ARM MARVELL KIRKWOOD ARMADA-XP ARMADA-38X ARMADA-37XX ARMADA-7K/8K M: Stefan Roese diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index 253902ff57..3fdfe4a6cb 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig @@ -148,6 +148,14 @@ config RESET_IMX7 help Support for reset controller on i.MX7/8 SoCs. +config RESET_IPQ419 + bool "Reset driver for Qualcomm IPQ40xx SoCs" + depends on DM_RESET && ARCH_IPQ40XX + default y + help + Support for reset controller on Qualcomm + IPQ40xx SoCs. + config RESET_SIFIVE bool "Reset Driver for SiFive SoC's" depends on DM_RESET && CLK_SIFIVE_FU540_PRCI && TARGET_SIFIVE_FU540 diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile index 3c7f066ae3..5176da5885 100644 --- a/drivers/reset/Makefile +++ b/drivers/reset/Makefile @@ -23,6 +23,7 @@ obj-$(CONFIG_RESET_MTMIPS) += reset-mtmips.o obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o obj-$(CONFIG_RESET_HISILICON) += reset-hisilicon.o obj-$(CONFIG_RESET_IMX7) += reset-imx7.o +obj-$(CONFIG_RESET_IPQ419) += reset-ipq4019.o obj-$(CONFIG_RESET_SIFIVE) += reset-sifive.o obj-$(CONFIG_RESET_SYSCON) += reset-syscon.o obj-$(CONFIG_RESET_RASPBERRYPI) += reset-raspberrypi.o diff --git a/drivers/reset/reset-ipq4019.c b/drivers/reset/reset-ipq4019.c new file mode 100644 index 0000000000..f216db4ce5 --- /dev/null +++ b/drivers/reset/reset-ipq4019.c @@ -0,0 +1,173 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2020 Sartura Ltd. + * + * Author: Robert Marko + * + * Based on Linux driver + */ + +#include +#include +#include +#include +#include +#include +#include + +struct ipq4019_reset_priv { + phys_addr_t base; +}; + +struct qcom_reset_map { + unsigned int reg; + u8 bit; +}; + +static const struct qcom_reset_map gcc_ipq4019_resets[] = { + [WIFI0_CPU_INIT_RESET] = { 0x1f008, 5 }, + [WIFI0_RADIO_SRIF_RESET] = { 0x1f008, 4 }, + [WIFI0_RADIO_WARM_RESET] = { 0x1f008, 3 }, + [WIFI0_RADIO_COLD_RESET] = { 0x1f008, 2 }, + [WIFI0_CORE_WARM_RESET] = { 0x1f008, 1 }, + [WIFI0_CORE_COLD_RESET] = { 0x1f008, 0 }, + [WIFI1_CPU_INIT_RESET] = { 0x20008, 5 }, + [WIFI1_RADIO_SRIF_RESET] = { 0x20008, 4 }, + [WIFI1_RADIO_WARM_RESET] = { 0x20008, 3 }, + [WIFI1_RADIO_COLD_RESET] = { 0x20008, 2 }, + [WIFI1_CORE_WARM_RESET] = { 0x20008, 1 }, + [WIFI1_CORE_COLD_RESET] = { 0x20008, 0 }, + [USB3_UNIPHY_PHY_ARES] = { 0x1e038, 5 }, + [USB3_HSPHY_POR_ARES] = { 0x1e038, 4 }, + [USB3_HSPHY_S_ARES] = { 0x1e038, 2 }, + [USB2_HSPHY_POR_ARES] = { 0x1e01c, 4 }, + [USB2_HSPHY_S_ARES] = { 0x1e01c, 2 }, + [PCIE_PHY_AHB_ARES] = { 0x1d010, 11 }, + [PCIE_AHB_ARES] = { 0x1d010, 10 }, + [PCIE_PWR_ARES] = { 0x1d010, 9 }, + [PCIE_PIPE_STICKY_ARES] = { 0x1d010, 8 }, + [PCIE_AXI_M_STICKY_ARES] = { 0x1d010, 7 }, + [PCIE_PHY_ARES] = { 0x1d010, 6 }, + [PCIE_PARF_XPU_ARES] = { 0x1d010, 5 }, + [PCIE_AXI_S_XPU_ARES] = { 0x1d010, 4 }, + [PCIE_AXI_M_VMIDMT_ARES] = { 0x1d010, 3 }, + [PCIE_PIPE_ARES] = { 0x1d010, 2 }, + [PCIE_AXI_S_ARES] = { 0x1d010, 1 }, + [PCIE_AXI_M_ARES] = { 0x1d010, 0 }, + [ESS_RESET] = { 0x12008, 0}, + [GCC_BLSP1_BCR] = {0x01000, 0}, + [GCC_BLSP1_QUP1_BCR] = {0x02000, 0}, + [GCC_BLSP1_UART1_BCR] = {0x02038, 0}, + [GCC_BLSP1_QUP2_BCR] = {0x03008, 0}, + [GCC_BLSP1_UART2_BCR] = {0x03028, 0}, + [GCC_BIMC_BCR] = {0x04000, 0}, + [GCC_TLMM_BCR] = {0x05000, 0}, + [GCC_IMEM_BCR] = {0x0E000, 0}, + [GCC_ESS_BCR] = {0x12008, 0}, + [GCC_PRNG_BCR] = {0x13000, 0}, + [GCC_BOOT_ROM_BCR] = {0x13008, 0}, + [GCC_CRYPTO_BCR] = {0x16000, 0}, + [GCC_SDCC1_BCR] = {0x18000, 0}, + [GCC_SEC_CTRL_BCR] = {0x1A000, 0}, + [GCC_AUDIO_BCR] = {0x1B008, 0}, + [GCC_QPIC_BCR] = {0x1C000, 0}, + [GCC_PCIE_BCR] = {0x1D000, 0}, + [GCC_USB2_BCR] = {0x1E008, 0}, + [GCC_USB2_PHY_BCR] = {0x1E018, 0}, + [GCC_USB3_BCR] = {0x1E024, 0}, + [GCC_USB3_PHY_BCR] = {0x1E034, 0}, + [GCC_SYSTEM_NOC_BCR] = {0x21000, 0}, + [GCC_PCNOC_BCR] = {0x2102C, 0}, + [GCC_DCD_BCR] = {0x21038, 0}, + [GCC_SNOC_BUS_TIMEOUT0_BCR] = {0x21064, 0}, + [GCC_SNOC_BUS_TIMEOUT1_BCR] = {0x2106C, 0}, + [GCC_SNOC_BUS_TIMEOUT2_BCR] = {0x21074, 0}, + [GCC_SNOC_BUS_TIMEOUT3_BCR] = {0x2107C, 0}, + [GCC_PCNOC_BUS_TIMEOUT0_BCR] = {0x21084, 0}, + [GCC_PCNOC_BUS_TIMEOUT1_BCR] = {0x2108C, 0}, + [GCC_PCNOC_BUS_TIMEOUT2_BCR] = {0x21094, 0}, + [GCC_PCNOC_BUS_TIMEOUT3_BCR] = {0x2109C, 0}, + [GCC_PCNOC_BUS_TIMEOUT4_BCR] = {0x210A4, 0}, + [GCC_PCNOC_BUS_TIMEOUT5_BCR] = {0x210AC, 0}, + [GCC_PCNOC_BUS_TIMEOUT6_BCR] = {0x210B4, 0}, + [GCC_PCNOC_BUS_TIMEOUT7_BCR] = {0x210BC, 0}, + [GCC_PCNOC_BUS_TIMEOUT8_BCR] = {0x210C4, 0}, + [GCC_PCNOC_BUS_TIMEOUT9_BCR] = {0x210CC, 0}, + [GCC_TCSR_BCR] = {0x22000, 0}, + [GCC_MPM_BCR] = {0x24000, 0}, + [GCC_SPDM_BCR] = {0x25000, 0}, +}; + +static int ipq4019_reset_assert(struct reset_ctl *rst) +{ + struct ipq4019_reset_priv *priv = dev_get_priv(rst->dev); + const struct qcom_reset_map *reset_map = gcc_ipq4019_resets; + const struct qcom_reset_map *map; + u32 value; + + map = &reset_map[rst->id]; + + value = readl(priv->base + map->reg); + value |= BIT(map->bit); + writel(value, priv->base + map->reg); + + return 0; +} + +static int ipq4019_reset_deassert(struct reset_ctl *rst) +{ + struct ipq4019_reset_priv *priv = dev_get_priv(rst->dev); + const struct qcom_reset_map *reset_map = gcc_ipq4019_resets; + const struct qcom_reset_map *map; + u32 value; + + map = &reset_map[rst->id]; + + value = readl(priv->base + map->reg); + value &= ~BIT(map->bit); + writel(value, priv->base + map->reg); + + return 0; +} + +static int ipq4019_reset_free(struct reset_ctl *rst) +{ + return 0; +} + +static int ipq4019_reset_request(struct reset_ctl *rst) +{ + return 0; +} + +static const struct reset_ops ipq4019_reset_ops = { + .request = ipq4019_reset_request, + .rfree = ipq4019_reset_free, + .rst_assert = ipq4019_reset_assert, + .rst_deassert = ipq4019_reset_deassert, +}; + +static const struct udevice_id ipq4019_reset_ids[] = { + { .compatible = "qcom,gcc-reset-ipq4019" }, + { } +}; + +static int ipq4019_reset_probe(struct udevice *dev) +{ + struct ipq4019_reset_priv *priv = dev_get_priv(dev); + + priv->base = dev_read_addr(dev); + if (priv->base == FDT_ADDR_T_NONE) + return -EINVAL; + + return 0; +} + +U_BOOT_DRIVER(ipq4019_reset) = { + .name = "ipq4019_reset", + .id = UCLASS_RESET, + .of_match = ipq4019_reset_ids, + .ops = &ipq4019_reset_ops, + .probe = ipq4019_reset_probe, + .priv_auto_alloc_size = sizeof(struct ipq4019_reset_priv), +}; diff --git a/include/dt-bindings/reset/qcom,ipq4019-reset.h b/include/dt-bindings/reset/qcom,ipq4019-reset.h new file mode 100644 index 0000000000..ed047d7402 --- /dev/null +++ b/include/dt-bindings/reset/qcom,ipq4019-reset.h @@ -0,0 +1,92 @@ +/* Copyright (c) 2015 The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ +#ifndef __QCOM_RESET_IPQ4019_H__ +#define __QCOM_RESET_IPQ4019_H__ + +#define WIFI0_CPU_INIT_RESET 0 +#define WIFI0_RADIO_SRIF_RESET 1 +#define WIFI0_RADIO_WARM_RESET 2 +#define WIFI0_RADIO_COLD_RESET 3 +#define WIFI0_CORE_WARM_RESET 4 +#define WIFI0_CORE_COLD_RESET 5 +#define WIFI1_CPU_INIT_RESET 6 +#define WIFI1_RADIO_SRIF_RESET 7 +#define WIFI1_RADIO_WARM_RESET 8 +#define WIFI1_RADIO_COLD_RESET 9 +#define WIFI1_CORE_WARM_RESET 10 +#define WIFI1_CORE_COLD_RESET 11 +#define USB3_UNIPHY_PHY_ARES 12 +#define USB3_HSPHY_POR_ARES 13 +#define USB3_HSPHY_S_ARES 14 +#define USB2_HSPHY_POR_ARES 15 +#define USB2_HSPHY_S_ARES 16 +#define PCIE_PHY_AHB_ARES 17 +#define PCIE_AHB_ARES 18 +#define PCIE_PWR_ARES 19 +#define PCIE_PIPE_STICKY_ARES 20 +#define PCIE_AXI_M_STICKY_ARES 21 +#define PCIE_PHY_ARES 22 +#define PCIE_PARF_XPU_ARES 23 +#define PCIE_AXI_S_XPU_ARES 24 +#define PCIE_AXI_M_VMIDMT_ARES 25 +#define PCIE_PIPE_ARES 26 +#define PCIE_AXI_S_ARES 27 +#define PCIE_AXI_M_ARES 28 +#define ESS_RESET 29 +#define GCC_BLSP1_BCR 30 +#define GCC_BLSP1_QUP1_BCR 31 +#define GCC_BLSP1_UART1_BCR 32 +#define GCC_BLSP1_QUP2_BCR 33 +#define GCC_BLSP1_UART2_BCR 34 +#define GCC_BIMC_BCR 35 +#define GCC_TLMM_BCR 36 +#define GCC_IMEM_BCR 37 +#define GCC_ESS_BCR 38 +#define GCC_PRNG_BCR 39 +#define GCC_BOOT_ROM_BCR 40 +#define GCC_CRYPTO_BCR 41 +#define GCC_SDCC1_BCR 42 +#define GCC_SEC_CTRL_BCR 43 +#define GCC_AUDIO_BCR 44 +#define GCC_QPIC_BCR 45 +#define GCC_PCIE_BCR 46 +#define GCC_USB2_BCR 47 +#define GCC_USB2_PHY_BCR 48 +#define GCC_USB3_BCR 49 +#define GCC_USB3_PHY_BCR 50 +#define GCC_SYSTEM_NOC_BCR 51 +#define GCC_PCNOC_BCR 52 +#define GCC_DCD_BCR 53 +#define GCC_SNOC_BUS_TIMEOUT0_BCR 54 +#define GCC_SNOC_BUS_TIMEOUT1_BCR 55 +#define GCC_SNOC_BUS_TIMEOUT2_BCR 56 +#define GCC_SNOC_BUS_TIMEOUT3_BCR 57 +#define GCC_PCNOC_BUS_TIMEOUT0_BCR 58 +#define GCC_PCNOC_BUS_TIMEOUT1_BCR 59 +#define GCC_PCNOC_BUS_TIMEOUT2_BCR 60 +#define GCC_PCNOC_BUS_TIMEOUT3_BCR 61 +#define GCC_PCNOC_BUS_TIMEOUT4_BCR 62 +#define GCC_PCNOC_BUS_TIMEOUT5_BCR 63 +#define GCC_PCNOC_BUS_TIMEOUT6_BCR 64 +#define GCC_PCNOC_BUS_TIMEOUT7_BCR 65 +#define GCC_PCNOC_BUS_TIMEOUT8_BCR 66 +#define GCC_PCNOC_BUS_TIMEOUT9_BCR 67 +#define GCC_TCSR_BCR 68 +#define GCC_QDSS_BCR 69 +#define GCC_MPM_BCR 70 +#define GCC_SPDM_BCR 71 + +#endif From patchwork Tue Sep 1 17:22:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1355289 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sartura.hr Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sartura-hr.20150623.gappssmtp.com header.i=@sartura-hr.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=TYFt740y; dkim-atps=neutral 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bgv7y1mZbz9sXd for ; Wed, 2 Sep 2020 03:24:29 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AEA53822A3; Tue, 1 Sep 2020 19:23:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sartura.hr 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=sartura-hr.20150623.gappssmtp.com header.i=@sartura-hr.20150623.gappssmtp.com header.b="TYFt740y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 109AC821FF; Tue, 1 Sep 2020 19:23:22 +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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3325A821FF for ; Tue, 1 Sep 2020 19:23:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sartura.hr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=robert.marko@sartura.hr Received: by mail-wm1-x343.google.com with SMTP id l9so1964781wme.3 for ; Tue, 01 Sep 2020 10:23:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura-hr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ezax845onFTn9+d1Dy4mgKiesrLxGx3dHJ8DRIo3Ud8=; b=TYFt740y88l2/6+QwPv8/ndMKS4zMLU2brTZyDtTs+81ke5bHrFeZ66XaD3EsHYq8d NOYc4HfylwGp9jlL/rafZW+/Xnx7+BOXT7XcVSFxNQqIJRaYz1DP9lU4sMhbzB6traZH ZelEE3/b7TrjYKmkKQZtu3fvKnX2MDNZ4Bcr02EycYtbvCyduH3rxmPR3qzMibqcDyxb wPfn+JLYtRPl8pm4CxbZiOMvaF0lw6KYMh9aJU2wIHsqFy3fVHeFR/xoz/JFGzpo8b17 EvEtW7NX7MKgNmMY4IUaR946CD9OTZC2ynZBrswd0XlrS8FiLM/lJyP1KpfGXNovNOOL UXEg== 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:content-transfer-encoding; bh=Ezax845onFTn9+d1Dy4mgKiesrLxGx3dHJ8DRIo3Ud8=; b=Hwzqw3g4mOlPymNc39exex4w0EJm99zYuDXnTuV96CjTleuEEleBcXtGbbzD+UO7a9 xTQzBQThpfFN807xBHc7PqHAeNTHifG+YF/l5P1fyGFkFQnyIYLiUBeH3/5fVgiwdFAf mSEsjHO4r9LrajSS5qJp6lhjdKQHa97OiT811SS/TfDnYeEBcLrQuCgNLXdwUzvaN1Hm jcZ4FfR0pneXngzT53M+8HH8hF1H953jZ5+HWLPmAE09yDDqAyAgEBWpWlvgrJ10uu5h YRDqFNE/gZ+CX4IFznNkMpnO0q9raSY9gIjBcJad0Waf1zh3IL+gKYV/pmCoZ3+6VVVe 8qYQ== X-Gm-Message-State: AOAM531cHwjTD6xaH+wVjZ06vPiViRxc+biJ7Ls1SW6lsN5WNn484/ij QZH7CRWQXVR4HdBXWp21yVwTBtSr85WecMdcpLCNICkVb1uAXThJJW8gYmDlQ3/Fq79tS49Fm8F 21SzKDt5qDm+HeGLX9s61MLiDulSgnO3BWy/a/eopwKwJsa0XZMpoU55Lgksz9SmvRglTa/8/ X-Google-Smtp-Source: ABdhPJwT7PCaRcuVajub5T477hTn5zog0vI08YK8Jv6iaAw9sMKu1+saRai5g7qfqktoGo44vq/ZEA== X-Received: by 2002:a1c:3c42:: with SMTP id j63mr2897840wma.53.1598980998480; Tue, 01 Sep 2020 10:23:18 -0700 (PDT) Received: from localhost.localdomain (dh207-99-46.xnet.hr. [88.207.99.46]) by smtp.googlemail.com with ESMTPSA id v7sm4419469wma.1.2020.09.01.10.23.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2020 10:23:18 -0700 (PDT) From: Robert Marko To: u-boot@lists.denx.de Cc: Robert Marko , Luka Perkov Subject: [PATCH v2 5/9] IPQ40xx: Add reset controller support Date: Tue, 1 Sep 2020 19:22:58 +0200 Message-Id: <20200901172302.551467-6-robert.marko@sartura.hr> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200901172302.551467-1-robert.marko@sartura.hr> References: <20200901172302.551467-1-robert.marko@sartura.hr> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Since we have a driver for the reset controller, lets add the necessary node. Signed-off-by: Robert Marko Cc: Luka Perkov --- arch/arm/Kconfig | 1 + arch/arm/dts/qcom-ipq4019.dtsi | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index ee378f03f4..68d6d1afd6 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -767,6 +767,7 @@ config ARCH_IPQ40XX select DM select DM_GPIO select DM_SERIAL + select DM_RESET select MSM_SMEM select PINCTRL select CLK diff --git a/arch/arm/dts/qcom-ipq4019.dtsi b/arch/arm/dts/qcom-ipq4019.dtsi index dd69d0a5b2..7b15df38d8 100644 --- a/arch/arm/dts/qcom-ipq4019.dtsi +++ b/arch/arm/dts/qcom-ipq4019.dtsi @@ -11,6 +11,7 @@ #include #include #include +#include / { #address-cells = <1>; @@ -58,6 +59,14 @@ u-boot,dm-pre-reloc; }; + reset: gcc-reset@1800000 { + compatible = "qcom,gcc-reset-ipq4019"; + reg = <0x1800000 0x60000>; + #clock-cells = <1>; + #reset-cells = <1>; + u-boot,dm-pre-reloc; + }; + pinctrl: qcom,tlmm@1000000 { compatible = "qcom,tlmm-ipq4019"; reg = <0x1000000 0x300000>; From patchwork Tue Sep 1 17:22:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1355290 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sartura.hr Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sartura-hr.20150623.gappssmtp.com header.i=@sartura-hr.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=jXgrIzBP; dkim-atps=neutral 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bgv8P3Wwbz9sWw for ; Wed, 2 Sep 2020 03:24:52 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 21535822D5; Tue, 1 Sep 2020 19:23:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sartura.hr 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=sartura-hr.20150623.gappssmtp.com header.i=@sartura-hr.20150623.gappssmtp.com header.b="jXgrIzBP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3F699822D1; Tue, 1 Sep 2020 19:23:24 +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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C78EF822A4 for ; Tue, 1 Sep 2020 19:23:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sartura.hr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=robert.marko@sartura.hr Received: by mail-wr1-x442.google.com with SMTP id e16so2437068wrm.2 for ; Tue, 01 Sep 2020 10:23:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura-hr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BfEjjY08n1BASy4/0R+ELXB4sHRcijRYjwhukOdyfyQ=; b=jXgrIzBP9RA5ZbDWCuzNwSh4JSmLzRCgOUNi02lvMC2I7kuimVTX+mf98163c8mXZU ky+vdUEmiYfL/IuOixyEPQT/O49JBL4amtrEBeCkdFyXFbKHFd33Tk2havxc/Oiaqne7 zgCTYdStLlzFm5WVz4hYC7B0M28be7k6tyYLvjEgXc57TyVXgiw+h8Gyj90Xn9am0bs9 TAo2mHVN+MpU2ZQE5mvjVXJkpncGPcyQ6JyoBepiKR9fDEqHBkKs+cMzNm4nzVMV+IjD aFcYfBDj+GSJEYsq1ZrIhk3tGLc6en7GSQa/FtVBQztcXP26dJDLtE7H2OOVfkLZ7JKy 2LdA== 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:content-transfer-encoding; bh=BfEjjY08n1BASy4/0R+ELXB4sHRcijRYjwhukOdyfyQ=; b=q0w32Q2yTBm/bu50xg6EcGtaTcAA8hM00U/U81MTl2phmvQ97wirSwpHJ8O+58hJMj l9lpmAOkgGnsdVzTzmLBw6tAdgcBplAn7Vu2ATZDHD9+TVer+qdy4fwoKR9sN6DwDNGN bsLUzBqdRzw4+g+M/EOuL91Tr5aEYDSEfq3bTCzlAsAgF0sswf4GEuYpRUdLMG+tYkfc pZB+7f7vRYa4hxrImYfTQnIkRHT0Flo5QVXe0OQDtzUX4F6VJ3xJHxxwxrKinIQFcdCw 7IH/sTr2ybF+9Ki+I9cdbhy3MeyTQtY/pUnV7QZDp4ODwhfB8ONyWCA3SA85DRNLeNXF FQrA== X-Gm-Message-State: AOAM5324GzwJj/wUqr5OX8TAx+DYFtyuoNY/sHrSCM4Mv2k3xKTsr/OJ iSQPwHMxHHA/4Vsob24WyboU/N0ROStmBdA6Ps7l3JLmI7M+MwvTbkMdUkAtbjQZ6vWsNNT5ijZ JJDjBIyc3wPUDmuoR1xeDKchXK2FX/eOS9QrL5XaTFaYlT3CcImaK7ZGzUDFXH72uD8t2CcY/ X-Google-Smtp-Source: ABdhPJwYMOEqTcBsR3r+ClmsH2QC/LWHM7mymqz8LavvE22aHszG3yg7X6SEYajPGmfu6JGBDk10Tg== X-Received: by 2002:adf:f3c6:: with SMTP id g6mr3241485wrp.340.1598980999820; Tue, 01 Sep 2020 10:23:19 -0700 (PDT) Received: from localhost.localdomain (dh207-99-46.xnet.hr. [88.207.99.46]) by smtp.googlemail.com with ESMTPSA id v7sm4419469wma.1.2020.09.01.10.23.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2020 10:23:19 -0700 (PDT) From: Robert Marko To: u-boot@lists.denx.de Cc: Robert Marko , Luka Perkov Subject: [PATCH v2 6/9] phy: add driver for Qualcomm IPQ40xx USB PHY Date: Tue, 1 Sep 2020 19:22:59 +0200 Message-Id: <20200901172302.551467-7-robert.marko@sartura.hr> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200901172302.551467-1-robert.marko@sartura.hr> References: <20200901172302.551467-1-robert.marko@sartura.hr> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Add a driver to setup the USB PHY-s on Qualcomm IPQ40xx series SoCs. The driver sets up HS and SS phys. Signed-off-by: Robert Marko Cc: Luka Perkov --- MAINTAINERS | 1 + drivers/phy/Kconfig | 6 ++ drivers/phy/Makefile | 1 + drivers/phy/phy-qcom-ipq4019-usb.c | 145 +++++++++++++++++++++++++++++ 4 files changed, 153 insertions(+) create mode 100644 drivers/phy/phy-qcom-ipq4019-usb.c diff --git a/MAINTAINERS b/MAINTAINERS index f4fc823e4e..d8d2c6278b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -240,6 +240,7 @@ F: arch/arm/mach-ipq40xx/ F: include/dt-bindings/clock/qcom,ipq4019-gcc.h F: include/dt-bindings/reset/qcom,ipq4019-reset.h F: drivers/reset/reset-ipq4019.c +F: drivers/phy/phy-qcom-ipq4019-usb.c ARM MARVELL KIRKWOOD ARMADA-XP ARMADA-38X ARMADA-37XX ARMADA-7K/8K M: Stefan Roese diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 9c775107e9..8da00a259d 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -125,6 +125,12 @@ config STI_USB_PHY used by USB2 and USB3 Host controllers available on STiH407 SoC families. +config PHY_QCOM_IPQ4019_USB + tristate "Qualcomm IPQ4019 USB PHY driver" + depends on PHY && ARCH_IPQ40XX + help + Support for the USB PHY-s on Qualcomm IPQ40xx SoC-s. + config PHY_RCAR_GEN2 tristate "Renesas R-Car Gen2 USB PHY" depends on PHY && RCAR_GEN2 diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index 74e8d931d3..009f353baf 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -13,6 +13,7 @@ obj-$(CONFIG_PHY_SANDBOX) += sandbox-phy.o obj-$(CONFIG_$(SPL_)PIPE3_PHY) += ti-pipe3-phy.o obj-$(CONFIG_AM654_PHY) += phy-ti-am654.o obj-$(CONFIG_STI_USB_PHY) += sti_usb_phy.o +obj-$(CONFIG_PHY_QCOM_IPQ4019_USB) += phy-qcom-ipq4019-usb.o obj-$(CONFIG_PHY_RCAR_GEN2) += phy-rcar-gen2.o obj-$(CONFIG_PHY_RCAR_GEN3) += phy-rcar-gen3.o obj-$(CONFIG_PHY_STM32_USBPHYC) += phy-stm32-usbphyc.o diff --git a/drivers/phy/phy-qcom-ipq4019-usb.c b/drivers/phy/phy-qcom-ipq4019-usb.c new file mode 100644 index 0000000000..465f0d3a01 --- /dev/null +++ b/drivers/phy/phy-qcom-ipq4019-usb.c @@ -0,0 +1,145 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019 Sartura Ltd. + * + * Author: Robert Marko + * + * Based on Linux driver + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +struct ipq4019_usb_phy { + phys_addr_t base; + struct reset_ctl por_rst; + struct reset_ctl srif_rst; +}; + +static int ipq4019_ss_phy_power_off(struct phy *_phy) +{ + struct ipq4019_usb_phy *phy = dev_get_priv(_phy->dev); + + reset_assert(&phy->por_rst); + mdelay(10); + + return 0; +} + +static int ipq4019_ss_phy_power_on(struct phy *_phy) +{ + struct ipq4019_usb_phy *phy = dev_get_priv(_phy->dev); + + ipq4019_ss_phy_power_off(_phy); + + reset_deassert(&phy->por_rst); + + return 0; +} + +static struct phy_ops ipq4019_usb_ss_phy_ops = { + .power_on = ipq4019_ss_phy_power_on, + .power_off = ipq4019_ss_phy_power_off, +}; + +static int ipq4019_usb_ss_phy_probe(struct udevice *dev) +{ + struct ipq4019_usb_phy *phy = dev_get_priv(dev); + int ret; + + phy->base = dev_read_addr(dev); + if (phy->base == FDT_ADDR_T_NONE) + return -EINVAL; + + ret = reset_get_by_name(dev, "por_rst", &phy->por_rst); + if (ret) + return ret; + + return 0; +} + +static const struct udevice_id ipq4019_usb_ss_phy_ids[] = { + { .compatible = "qcom,usb-ss-ipq4019-phy" }, + { } +}; + +U_BOOT_DRIVER(ipq4019_usb_ss_phy) = { + .name = "ipq4019-usb-ss-phy", + .id = UCLASS_PHY, + .of_match = ipq4019_usb_ss_phy_ids, + .ops = &ipq4019_usb_ss_phy_ops, + .probe = ipq4019_usb_ss_phy_probe, + .priv_auto_alloc_size = sizeof(struct ipq4019_usb_phy), +}; + +static int ipq4019_hs_phy_power_off(struct phy *_phy) +{ + struct ipq4019_usb_phy *phy = dev_get_priv(_phy->dev); + + reset_assert(&phy->por_rst); + mdelay(10); + + reset_assert(&phy->srif_rst); + mdelay(10); + + return 0; +} + +static int ipq4019_hs_phy_power_on(struct phy *_phy) +{ + struct ipq4019_usb_phy *phy = dev_get_priv(_phy->dev); + + ipq4019_hs_phy_power_off(_phy); + + reset_deassert(&phy->srif_rst); + mdelay(10); + + reset_deassert(&phy->por_rst); + + return 0; +} + +static struct phy_ops ipq4019_usb_hs_phy_ops = { + .power_on = ipq4019_hs_phy_power_on, + .power_off = ipq4019_hs_phy_power_off, +}; + +static int ipq4019_usb_hs_phy_probe(struct udevice *dev) +{ + struct ipq4019_usb_phy *phy = dev_get_priv(dev); + int ret; + + phy->base = dev_read_addr(dev); + if (phy->base == FDT_ADDR_T_NONE) + return -EINVAL; + + ret = reset_get_by_name(dev, "por_rst", &phy->por_rst); + if (ret) + return ret; + + ret = reset_get_by_name(dev, "srif_rst", &phy->srif_rst); + if (ret) + return ret; + + return 0; +} + +static const struct udevice_id ipq4019_usb_hs_phy_ids[] = { + { .compatible = "qcom,usb-hs-ipq4019-phy" }, + { } +}; + +U_BOOT_DRIVER(ipq4019_usb_hs_phy) = { + .name = "ipq4019-usb-hs-phy", + .id = UCLASS_PHY, + .of_match = ipq4019_usb_hs_phy_ids, + .ops = &ipq4019_usb_hs_phy_ops, + .probe = ipq4019_usb_hs_phy_probe, + .priv_auto_alloc_size = sizeof(struct ipq4019_usb_phy), +}; From patchwork Tue Sep 1 17:23:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1355291 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sartura.hr Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sartura-hr.20150623.gappssmtp.com header.i=@sartura-hr.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=WW/KhB8v; dkim-atps=neutral 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bgv8d1rMNz9sWw for ; Wed, 2 Sep 2020 03:25:04 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1EB02822DF; Tue, 1 Sep 2020 19:23:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sartura.hr 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=sartura-hr.20150623.gappssmtp.com header.i=@sartura-hr.20150623.gappssmtp.com header.b="WW/KhB8v"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9FC58822C3; Tue, 1 Sep 2020 19:23:25 +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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0E1E3822AA for ; Tue, 1 Sep 2020 19:23:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sartura.hr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=robert.marko@sartura.hr Received: by mail-wm1-x344.google.com with SMTP id e11so1407486wme.0 for ; Tue, 01 Sep 2020 10:23:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura-hr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AAVbiQlTzp9niKfw4UCtrY5AunrH+R76oQ9FWtNHo54=; b=WW/KhB8vUMldXXgtJLitFFTdvi3ay9MntsUiZX1FcfVGCiNPd11wCO8O4mCfQSxhTN JRHtgHGdQaJZRDsSg3kMeSeb4SVkUGvzvEcGNC1BLk0fgQJ2Rp6IT7f/arJNZ5Pv2cBs Pw2+d5JMmZjbny/06kLKXyBJ/ccRi+OwHpxhpt2ocyvab3bI2nkB4dJxCVfw4AzYnRQm nE/rHVRnmOxIV4QUAAWWHH5LAEWR2kt+3RPv8OklOQXP7Am3UCweZXR3u2qLm0wOtajO bdOgPudNl0cTj62+GW0c3GYbVI9IzA/fpQJHhODBiu4JxecS6FRAVbEv78IQg22YQ9BI Q2/Q== 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:content-transfer-encoding; bh=AAVbiQlTzp9niKfw4UCtrY5AunrH+R76oQ9FWtNHo54=; b=QpRBvR3LCMZW9FqjPXOMwBwJoV7awolVP3zAu0V6p5DZEVPNGfGXBP2MxYtHPjPzK5 z3+JGg1hevTKz6qP6SqppAvRCKmFCywVpvDoJtqRy84SnLOY7VgFVQYcah3+T1YtIwby zNkzIvqVV3757gPWp1CZ1C8i8A4ct0r8Hc+tzRRxjn04GNq708iCRl82rlgLLuhSCiXZ r59VI6gGXYTxxZhK7G5QvYRtQJGrob0b7Q09j2XWKMIASI7kZAuE2r0YbM5AOIooPQPf gBXpKuatK07IRD6PyjIMpOAUj/cOD4+0qtdUHztO+XD2FW9u6Qm7B6xYLHbroWSlH01A Rnhw== X-Gm-Message-State: AOAM530JYKk7x8TXC2CaHTfnJLAMtPgyXOh07kEHpxUXyIuqFAzc+QCV KvomsMnXe1PFQzNIz5D4Y7TScKlRCoUODvVYENznMY1jysMciormsoML0i9HxQ1oyCvvJMQgW2K vWRsdvwkPOH8jcASvUBz5TkiGCrR0CL2pmsG73VsfkSC6JgOK+ErJsTk0l2noT8XqidDFTymN X-Google-Smtp-Source: ABdhPJzfJkpdbBE2v/ucN31hD52sUreOtUbxktBkPAPHEflmuHfDjget4p3EGgFCxMkuwElfcRTzSQ== X-Received: by 2002:a05:600c:410e:: with SMTP id j14mr2926643wmi.13.1598981001152; Tue, 01 Sep 2020 10:23:21 -0700 (PDT) Received: from localhost.localdomain (dh207-99-46.xnet.hr. [88.207.99.46]) by smtp.googlemail.com with ESMTPSA id v7sm4419469wma.1.2020.09.01.10.23.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2020 10:23:20 -0700 (PDT) From: Robert Marko To: u-boot@lists.denx.de Cc: Robert Marko , Luka Perkov Subject: [PATCH v2 7/9] usb: dwc3: Make PHY functions depend on CONFIG_USB_DWC3 Date: Tue, 1 Sep 2020 19:23:00 +0200 Message-Id: <20200901172302.551467-8-robert.marko@sartura.hr> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200901172302.551467-1-robert.marko@sartura.hr> References: <20200901172302.551467-1-robert.marko@sartura.hr> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean PHY handling functions should depend also on CONFIG_USB_DWC3 aka DM DWC3 version. Otherwise when using the non DM version with PHY subsystem enabled there will be a linking error due to missing dwc3_setup_phy and dwc3_shutdown_phy. Signed-off-by: Robert Marko Cc: Luka Perkov --- include/dwc3-uboot.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/dwc3-uboot.h b/include/dwc3-uboot.h index e08530ec4e..5eb0822d74 100644 --- a/include/dwc3-uboot.h +++ b/include/dwc3-uboot.h @@ -47,7 +47,7 @@ void dwc3_uboot_exit(int index); void dwc3_uboot_handle_interrupt(int index); struct phy; -#if CONFIG_IS_ENABLED(PHY) && CONFIG_IS_ENABLED(DM_USB) +#if CONFIG_IS_ENABLED(PHY) && CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(CONFIG_USB_DWC3) int dwc3_setup_phy(struct udevice *dev, struct phy_bulk *phys); int dwc3_shutdown_phy(struct udevice *dev, struct phy_bulk *phys); #else From patchwork Tue Sep 1 17:23:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1355292 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sartura.hr Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sartura-hr.20150623.gappssmtp.com header.i=@sartura-hr.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=hsJVk3zJ; dkim-atps=neutral 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bgv8p1pYlz9sWY for ; Wed, 2 Sep 2020 03:25:14 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E0C22822E6; Tue, 1 Sep 2020 19:23:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sartura.hr 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=sartura-hr.20150623.gappssmtp.com header.i=@sartura-hr.20150623.gappssmtp.com header.b="hsJVk3zJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 48050822CD; Tue, 1 Sep 2020 19:23:27 +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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AD63C822CA for ; Tue, 1 Sep 2020 19:23:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sartura.hr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=robert.marko@sartura.hr Received: by mail-wm1-x342.google.com with SMTP id a65so1909729wme.5 for ; Tue, 01 Sep 2020 10:23:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura-hr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vPTHI+hAHChz0bFQ5JPeU+gRN4IO92kraFXt6ABbECw=; b=hsJVk3zJVzlLgM/vG0Ge29r6WLxsbe+lHYan29hQXrqI9cu5/Hv9fPrwXcV1WWTNWe dZtgUXtdtDssR4fZE+4+f9qbRkqWoVMI4k+iOiHtLoQdyeBMmUV0mjt0/2XMsU+PWJe2 C7DC2GcAjDOiHRUMsrFlnx0xKzr/EwaznanfXwGrxGmgwe0eafpfRhy7L+8IL2vsMOyS QQwtfCKIMEiTf7AADYqDm8XLgJob080kvXhcOHzfS/MTaX8YdGEOe66SRYuR/GJeU6mF zw55Ezxg6VnwRAMDWl7a9BPCOUYjxDBv3dLAhv2K7Ins/ahRSkR+cxb8nBdnkq2stcoG 1LFA== 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:content-transfer-encoding; bh=vPTHI+hAHChz0bFQ5JPeU+gRN4IO92kraFXt6ABbECw=; b=UEV7Qo3Bt49vev5zID0s95+licgWmmAII2nBMhTUNxSUND0GJuqlxPczL9Y4Gmvn4W 7gL5mQsf8Hke0vhT5WbWT+OEUiTomvtDkGF9UZdQESPfamT2Zp8FM4RwNY0fTwOuMS0e nBqTL7BodzzSIjlr8nO/zbrmIj9STk5VaQkshL5HFVT0HUfjwsTZCCreA3gfJ8q0G90h bMjxcK8/1jyhdaqiUmdtylq6Wi8N7SHfU7W3ms3k5Jh3BUczQpeL0zqHCnfl6a5K/iTK Cpm4eWfPw1QjyiRJT8ufQHbJxIPqDdVR8ZE8OYweVomcqxH/bEPnFzrRPX3o2JhSK8me F+9g== X-Gm-Message-State: AOAM531JpXYtv7SKmq2+HaI30zw+p8EwNlcRePi0M5geU4ITFoskiocD bEs4gobj3Gp4mKsvCJBV3zhkRXadY9VoInhuaFi4YHT0Z76PmxGiJaOUoFFMICHbt0PlwEP6teK 2DuagZ6R5O/gjuP1QXXakT+c59bCD3otLlZQ/bjL5/AjUr0VGtNbGrrKZ/1G4o3O5X6N2fxxU X-Google-Smtp-Source: ABdhPJz5UaiRddyiKMNriVjhjmmwzBITwopyMwHUMgibGUz5OdLFLpvI59wSjcGzahNgDA3VVsBRvA== X-Received: by 2002:a1c:a185:: with SMTP id k127mr2889310wme.142.1598981002502; Tue, 01 Sep 2020 10:23:22 -0700 (PDT) Received: from localhost.localdomain (dh207-99-46.xnet.hr. [88.207.99.46]) by smtp.googlemail.com with ESMTPSA id v7sm4419469wma.1.2020.09.01.10.23.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2020 10:23:22 -0700 (PDT) From: Robert Marko To: u-boot@lists.denx.de Cc: Robert Marko , Luka Perkov Subject: [PATCH v2 8/9] usb: xhci: Add Qualcomm DWC3 xHCI driver Date: Tue, 1 Sep 2020 19:23:01 +0200 Message-Id: <20200901172302.551467-9-robert.marko@sartura.hr> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200901172302.551467-1-robert.marko@sartura.hr> References: <20200901172302.551467-1-robert.marko@sartura.hr> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Add driver for Qualcomm DWC3 based dual role xHCI USB controller. Currently tested on IPQ40xx, but should support other Qualcomm SoC families as well. Only host mode is supported. Signed-off-by: Robert Marko Cc: Luka Perkov --- MAINTAINERS | 2 + .../usb/qcom-dwc3-ipq.txt | 34 +++++ drivers/usb/host/Kconfig | 6 + drivers/usb/host/Makefile | 1 + drivers/usb/host/xhci-ipq.c | 117 ++++++++++++++++++ 5 files changed, 160 insertions(+) create mode 100644 doc/device-tree-bindings/usb/qcom-dwc3-ipq.txt create mode 100644 drivers/usb/host/xhci-ipq.c diff --git a/MAINTAINERS b/MAINTAINERS index d8d2c6278b..99828f656a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -241,6 +241,8 @@ F: include/dt-bindings/clock/qcom,ipq4019-gcc.h F: include/dt-bindings/reset/qcom,ipq4019-reset.h F: drivers/reset/reset-ipq4019.c F: drivers/phy/phy-qcom-ipq4019-usb.c +F: doc/device-tree-bindings/usb/qcom-dwc3-ipq.txt +F: drivers/usb/host/xhci-ipq.c ARM MARVELL KIRKWOOD ARMADA-XP ARMADA-38X ARMADA-37XX ARMADA-7K/8K M: Stefan Roese diff --git a/doc/device-tree-bindings/usb/qcom-dwc3-ipq.txt b/doc/device-tree-bindings/usb/qcom-dwc3-ipq.txt new file mode 100644 index 0000000000..a910a06fa2 --- /dev/null +++ b/doc/device-tree-bindings/usb/qcom-dwc3-ipq.txt @@ -0,0 +1,34 @@ +Qualcomm SuperSpeed DWC3 USB SoC controller + +This controller is integrated in IPQ40xx SoC-s. +It is a dual role USB3.0/USB2.0 controller. + +Required properties : + - compatible: must be "qcom,dwc3-ipq" + - reg: should contain address and length of the standard XHCI + register set for the device. + - #address-cells: must be 1 + - #size-cells: must be 1 + - phys: list of PHY specifiers + - phy-names: shall be "usb2-phy" and "usb3-phy"(In case of USB3.0 only) + +Example: + usb3: xhci@8a00000 { + compatible = "qcom,dwc3-ipq"; + reg = <0x8a00000 0xcd00>; + #address-cells = <1>; + #size-cells = <1>; + phys = <&usb3_hs_phy>, <&usb3_ss_phy>; + phy-names = "usb2-phy", "usb3-phy"; + status = "disabled"; + }; + + usb2: xhci@6000000 { + compatible = "qcom,dwc3-ipq"; + reg = <0x6000000 0xcd00>; + #address-cells = <1>; + #size-cells = <1>; + phys = <&usb2_hs_phy>; + phy-names = "usb2-phy"; + status = "disabled"; + }; diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 1c374a7bd8..7e0b1ab4ce 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -93,6 +93,12 @@ config USB_XHCI_BRCM USB controller based on the Broadcom USB3 IP Core. Supports USB2/3 functionality. +config USB_XHCI_IPQ + bool "Support for Qualcomm IPQ on-chip DWC3 xHCI USB controller" + depends on DM_USB && PHY && USB_XHCI_DWC3 && ARCH_IPQ40XX + help + Enables support for the on-chip xHCI DWC3 controller on Qualcomm IPQ SoCs. + endif # USB_XHCI_HCD config USB_EHCI_HCD diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 29d4f87e38..0fa9c8f32a 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -55,6 +55,7 @@ obj-$(CONFIG_USB_XHCI_MVEBU) += xhci-mvebu.o obj-$(CONFIG_USB_XHCI_OMAP) += xhci-omap.o obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o obj-$(CONFIG_USB_XHCI_RCAR) += xhci-rcar.o +obj-$(CONFIG_USB_XHCI_IPQ) += xhci-ipq.o obj-$(CONFIG_USB_XHCI_STI) += dwc3-sti-glue.o # designware diff --git a/drivers/usb/host/xhci-ipq.c b/drivers/usb/host/xhci-ipq.c new file mode 100644 index 0000000000..840f074819 --- /dev/null +++ b/drivers/usb/host/xhci-ipq.c @@ -0,0 +1,117 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2020 Sartura Ltd. + * + * Qualcomm DWC3 controller driver + * + * Author: Robert Marko + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +struct ipq_xhci_priv { + phys_addr_t hcd_base; + struct xhci_ctrl ctrl; + struct xhci_hccr *hcd; + struct dwc3 *dwc3_reg; + struct phy_bulk phys; +}; + +static int ipq_xhci_core_init(struct ipq_xhci_priv *ipq) +{ + int ret; + + ret = dwc3_core_init(ipq->dwc3_reg); + if (ret) { + return ret; + } + + /* We are hard-coding DWC3 core to Host Mode */ + dwc3_set_mode(ipq->dwc3_reg, DWC3_GCTL_PRTCAP_HOST); + + return ret; +} + +static int ipq_xhci_core_exit(struct udevice *dev) +{ + struct ipq_xhci_priv *priv = dev_get_priv(dev); + int ret; + + ret = generic_phy_power_off_bulk(&priv->phys); + ret |= generic_phy_exit_bulk(&priv->phys); + return ret; +} + +static int ipq_xhci_usb_remove(struct udevice *dev) +{ + int ret; + ret = xhci_deregister(dev); + + if (ret != 0) { + dev_err(dev, "XHCI deregistration failed\n"); + return ret; + } + + ipq_xhci_core_exit(dev); + + return ret; +} + +static int ipq_xhci_usb_probe(struct udevice *dev) +{ + struct ipq_xhci_priv *priv = dev_get_priv(dev); + struct xhci_hcor *hcor; + int ret; + + priv->hcd_base = dev_read_addr(dev); + if (priv->hcd_base == FDT_ADDR_T_NONE) + return -EINVAL; + + ret = generic_phy_get_bulk(dev, &priv->phys); + if (ret) + return ret; + + priv->hcd = (struct xhci_hccr *)priv->hcd_base; + priv->dwc3_reg = (struct dwc3 *)((char *)(priv->hcd) + DWC3_REG_OFFSET); + hcor = (struct xhci_hcor *)((uint32_t)priv->hcd + + HC_LENGTH(xhci_readl(&priv->hcd->cr_capbase))); + + ret = generic_phy_power_on_bulk(&priv->phys); + if (ret) + generic_phy_exit_bulk(&priv->phys); + + ret = ipq_xhci_core_init(priv); + + if (ret) { + dev_err(dev, "Error initializing the XHCI controller\n"); + return ret; + } + + return xhci_register(dev, priv->hcd, hcor); +} + +static const struct udevice_id ipq_xhci_match_ids[] = { + { .compatible = "qcom,dwc3-ipq" }, + {} +}; + +U_BOOT_DRIVER(usb_xhci) = { + .name = "ipq_hci", + .id = UCLASS_USB, + .of_match = ipq_xhci_match_ids, + .probe = ipq_xhci_usb_probe, + .remove = ipq_xhci_usb_remove, + .ops = &xhci_usb_ops, + .priv_auto_alloc_size = sizeof(struct ipq_xhci_priv), + .flags = DM_FLAG_ALLOC_PRIV_DMA, +}; From patchwork Tue Sep 1 17:23:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1355293 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sartura.hr Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sartura-hr.20150623.gappssmtp.com header.i=@sartura-hr.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=rOfHQ6lA; dkim-atps=neutral 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bgv912YH3z9sWc for ; Wed, 2 Sep 2020 03:25:24 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B71FD822EC; Tue, 1 Sep 2020 19:23:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sartura.hr 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=sartura-hr.20150623.gappssmtp.com header.i=@sartura-hr.20150623.gappssmtp.com header.b="rOfHQ6lA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1493F822CD; Tue, 1 Sep 2020 19:23:28 +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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 10C1D822A4 for ; Tue, 1 Sep 2020 19:23:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sartura.hr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=robert.marko@sartura.hr Received: by mail-wm1-x341.google.com with SMTP id a9so1966689wmm.2 for ; Tue, 01 Sep 2020 10:23:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura-hr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5O9P6hXe5JXEYLXAGL3+gclUGAtGhA93wzxnXqrUyMw=; b=rOfHQ6lA5qplJ8w2BbgvZrVLvoawDTTUTkx5Zt+moh03VW9eA+jKM9g2PN6uRBPm6P F/C2q85sIGN+td52ipx6CTHE1i/bpNNzgxy5/Z9I2JR4vv+TtnBhOkICkRhZg3CMYelP Ulxn3/QCHJrnXQ4TToGKxRXJrPKjkYQdLJYrXG5548V7dL/dRAdmVupxQTOzTIbMXxaV gDzcq7v7otnfLenCdI4rNX8GvCg3N8xkVP5iTlfNDyZ6sRwNpvnUA/d95af4C/YLs+Xn ryqstmyFs0npNabUwwD/0iL0bRb7l7f04qE8G7Oh8JPxfxcWK5+PZfdXSI7sViPobCpa 5CIA== 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:content-transfer-encoding; bh=5O9P6hXe5JXEYLXAGL3+gclUGAtGhA93wzxnXqrUyMw=; b=c0z0pgmHtoVLjBZ601cX2FDxDaLBicbCo261vZ07gzivpmeFN/De6JXbmeMSMfgxGw 1QzmfbuXqmkeRXtMIghZA+lcKWdYFfCm+0bF574tJg1NwGk7HtllaCHM8hdXc0BAw3Mq 2zDJR1eVFhSPgXOyfLi9tnT1MOYCHIDhos0YKDmeG7xJJefvpDZebOq+Yy35yxSO7HQs NAPcni02TX+rsV5fiM7p+AMuyYjPV0qAJ7QeWWrgZYOblep79xjDbBJEJMB+78RrXmiV Tp+yK9twQUYU0DUduSpydjfQlzncUSZ5L+4hkUeddaJaf2SeXdWTLJtSj7dwwORUXvxc ymjg== X-Gm-Message-State: AOAM532XK6yj9dvRH8KiYE+wjaB21M4SvLqg/N90SiS/UMQ/YqqhtUFO m0hzQBy/bKVv1xx24Dut8Las5bgPhAOgTvD1QJXLsYNBCdCRyk+lz7nJ0Sa3b/P/zJTe6gfB5Y0 FIRtPRLWjAuuzrvn92u43js7zNETK8X3PyFzF+XTGuXgmTS5SxFoL9u0zrDMCGb6BYPJG42EW X-Google-Smtp-Source: ABdhPJzvPy9ijfNgXGHxB7dNX2M/ykyINYHHTiq9V1FFJlQRu3C1dG+hdGOR78qbynHVVCLeIq5TZQ== X-Received: by 2002:a05:600c:2155:: with SMTP id v21mr2901796wml.118.1598981003885; Tue, 01 Sep 2020 10:23:23 -0700 (PDT) Received: from localhost.localdomain (dh207-99-46.xnet.hr. [88.207.99.46]) by smtp.googlemail.com with ESMTPSA id v7sm4419469wma.1.2020.09.01.10.23.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2020 10:23:23 -0700 (PDT) From: Robert Marko To: u-boot@lists.denx.de Cc: Robert Marko , Luka Perkov Subject: [PATCH v2 9/9] IPQ40xx: Add USB nodes Date: Tue, 1 Sep 2020 19:23:02 +0200 Message-Id: <20200901172302.551467-10-robert.marko@sartura.hr> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200901172302.551467-1-robert.marko@sartura.hr> References: <20200901172302.551467-1-robert.marko@sartura.hr> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean There are drivers to support built in USB controller and PHY-s now, so lets add the USB nodes to DTSI. Signed-off-by: Robert Marko Cc: Luka Perkov --- arch/arm/dts/qcom-ipq4019.dtsi | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/arch/arm/dts/qcom-ipq4019.dtsi b/arch/arm/dts/qcom-ipq4019.dtsi index 7b15df38d8..494b2205a5 100644 --- a/arch/arm/dts/qcom-ipq4019.dtsi +++ b/arch/arm/dts/qcom-ipq4019.dtsi @@ -90,5 +90,55 @@ gpio-bank-name="soc"; #gpio-cells = <2>; }; + + usb3_ss_phy: ssphy@9a000 { + compatible = "qcom,usb-ss-ipq4019-phy"; + #phy-cells = <0>; + reg = <0x9a000 0x800>; + reg-names = "phy_base"; + resets = <&reset USB3_UNIPHY_PHY_ARES>; + reset-names = "por_rst"; + status = "disabled"; + }; + + usb3_hs_phy: hsphy@a6000 { + compatible = "qcom,usb-hs-ipq4019-phy"; + #phy-cells = <0>; + reg = <0xa6000 0x40>; + reg-names = "phy_base"; + resets = <&reset USB3_HSPHY_POR_ARES>, <&reset USB3_HSPHY_S_ARES>; + reset-names = "por_rst", "srif_rst"; + status = "disabled"; + }; + + usb3: xhci@8a00000 { + compatible = "qcom,dwc3-ipq"; + reg = <0x8a00000 0xcd00>; + #address-cells = <1>; + #size-cells = <1>; + phys = <&usb3_hs_phy>, <&usb3_ss_phy>; + phy-names = "usb2-phy", "usb3-phy"; + status = "disabled"; + }; + + usb2_hs_phy: hsphy@a8000 { + compatible = "qcom,usb-hs-ipq4019-phy"; + #phy-cells = <0>; + reg = <0xa8000 0x40>; + reg-names = "phy_base"; + resets = <&reset USB2_HSPHY_POR_ARES>, <&reset USB2_HSPHY_S_ARES>; + reset-names = "por_rst", "srif_rst"; + status = "disabled"; + }; + + usb2: xhci@6000000 { + compatible = "qcom,dwc3-ipq"; + reg = <0x6000000 0xcd00>; + #address-cells = <1>; + #size-cells = <1>; + phys = <&usb2_hs_phy>; + phy-names = "usb2-phy"; + status = "disabled"; + }; }; };