From patchwork Thu Mar 2 10:52:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Qiu X-Patchwork-Id: 63336 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4166937wrd; Thu, 2 Mar 2023 02:59:25 -0800 (PST) X-Google-Smtp-Source: AK7set8BQtLJVWZsVqrvXE6kOZbuz0oco5ISEsBPITxCfrg64CxxruKyOY88relq3k0DeIJvFlZn X-Received: by 2002:a17:906:1991:b0:87e:a34b:9e2b with SMTP id g17-20020a170906199100b0087ea34b9e2bmr9193303ejd.28.1677754765046; Thu, 02 Mar 2023 02:59:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677754765; cv=none; d=google.com; s=arc-20160816; b=gVT6T+NUDfHbNPuKWISp78rnVLxUDYMMquJ5YAb5eeFey6CAqN7Fpnqhnf9KR1epeZ 92Z0xNn9IMcdsdPaqjUxlXF1YxC28M2026Vk454qX5vsEGFiDL/iB99mQ1gOchEMEp+3 CykBkOInmPUefpHnO4WLfv2qnmmIc2XqC2T1Sk9feAFHveD2+q6and+BNau3hclyvc5M UNDGH6iTtuOfGk1YNjGXriDs3vCU13EFQOhctSqMo/D1F8k+aYdFvAlo7VCSsdfjYxUZ R3ADqBLlqpIC7H5kDP7+Y92WfoMx7f/LSJdFmEKtDEuwGTDZTJ6Sq4cssJGECjLV+Hp3 o2MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=JEoTa093hUgX5iPJB2obet4490DEjmRMyseBTX6NNMk=; b=bMbxGFxpHcX6L1HfSuRl3TCkWQyKoFhFfQtW+hQP5jloNlBUAs/Yb8UNNhyrws2cSI aygUI2dqLe/4UCW0i5yOKJtm1VeA8SEL7vJGD8ilpcWfQXGhqXoUD2PpOocfFZXTrEhR R+YZtq+++/RjBCmGqOpbji8OcizwkaVWOpenQo3D2Cx+VGLMoz073bUFmqLH9VFjufFS VdkxD+GN+sljEeiNXG1HvApPsdCVVxMFjBuhdz8Hc+pkjK2pY1frme2W9vXWyW/t5SC9 QdG0DRfB8eVW9kkdnoCkRJ0W6O2IMptl2C6UjTwaSvO69F2qpGdezIZU83aNvTg+oPgz hq9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p9-20020a1709060e8900b008d74beb4219si619019ejf.5.2023.03.02.02.59.02; Thu, 02 Mar 2023 02:59:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229894AbjCBKwa convert rfc822-to-8bit (ORCPT + 99 others); Thu, 2 Mar 2023 05:52:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229592AbjCBKw2 (ORCPT ); Thu, 2 Mar 2023 05:52:28 -0500 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E427F2A9BA; Thu, 2 Mar 2023 02:52:24 -0800 (PST) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 66E2A24E294; Thu, 2 Mar 2023 18:52:23 +0800 (CST) Received: from EXMBX068.cuchost.com (172.16.6.68) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 2 Mar 2023 18:52:23 +0800 Received: from williamqiu-virtual-machine.starfivetech.com (171.223.208.138) by EXMBX068.cuchost.com (172.16.6.68) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 2 Mar 2023 18:52:22 +0800 From: William Qiu To: , , CC: Rob Herring , Krzysztof Kozlowski , Philipp Zabel , Mark Brown , William Qiu , Ziv Xu Subject: [PATCH v1 1/2] dt-bindings: qspi: cdns,qspi-nor: constrain minItems/maxItems of resets Date: Thu, 2 Mar 2023 18:52:20 +0800 Message-ID: <20230302105221.197421-2-william.qiu@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230302105221.197421-1-william.qiu@starfivetech.com> References: <20230302105221.197421-1-william.qiu@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [171.223.208.138] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX068.cuchost.com (172.16.6.68) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759253380306028177?= X-GMAIL-MSGID: =?utf-8?q?1759253380306028177?= The QSPI controller needs three reset items to work properly on JH7110 SoC, so there is need to change the maxItems's value to 3 and add minItems whose value is equal to 2. Other platforms do not have this constraint. Signed-off-by: William Qiu --- .../bindings/spi/cdns,qspi-nor.yaml | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml b/Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml index 4707294d8f59..14821cb6db48 100644 --- a/Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml +++ b/Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml @@ -19,6 +19,33 @@ allOf: then: required: - power-domains + - if: + properties: + compatible: + contains: + const: starfive,jh7110-qspi + then: + properties: + resets: + minItems: 2 + maxItems: 3 + + reset-names: + minItems: 2 + maxItems: 3 + items: + enum: [ qspi, qspi-ocp, rstc_ref ] + + else: + properties: + resets: + maxItems: 2 + + reset-names: + minItems: 1 + maxItems: 2 + items: + enum: [ qspi, qspi-ocp ] properties: compatible: @@ -30,6 +57,7 @@ properties: - intel,lgm-qspi - xlnx,versal-ospi-1.0 - intel,socfpga-qspi + - starfive,jh7110-qspi - const: cdns,qspi-nor - const: cdns,qspi-nor @@ -79,13 +107,14 @@ properties: maxItems: 1 resets: - maxItems: 2 + minItems: 2 + maxItems: 3 reset-names: - minItems: 1 - maxItems: 2 + minItems: 2 + maxItems: 3 items: - enum: [ qspi, qspi-ocp ] + enum: [ qspi, qspi-ocp, rstc_ref ] required: - compatible From patchwork Thu Mar 2 10:52:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Qiu X-Patchwork-Id: 63337 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4166941wrd; Thu, 2 Mar 2023 02:59:26 -0800 (PST) X-Google-Smtp-Source: AK7set9eMJllFzI7CMeKFTELyjsb1kEDPHKUvFTurj9dAUI9BkjN+LpudIVm5bSdbJTZPLMcppC8 X-Received: by 2002:a05:6a20:a021:b0:cc:32a8:323f with SMTP id p33-20020a056a20a02100b000cc32a8323fmr12150085pzj.38.1677754765751; Thu, 02 Mar 2023 02:59:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677754765; cv=none; d=google.com; s=arc-20160816; b=dCTgnSrCmjcHLQVqm5VcToGbSxAkk/1qUx7eESLvT2Y99voKKuP1cprU3ZFtW2Dnm+ sN35gDQl/5OT4ISnQ4zC3GRoidUXBLbIluvoqZ/Z5YVT22B5g0CBU7MeIO/hfyDBYq+M O3j6Ss0OAruJ1ayps8zTHYx5ujQ7CJHQ79jzHdmkS8kYkasDEeJEldEvQaCueF+UAjA5 7YKDZsVh28EEeCZerdZXpH5mJkSm6zeU6hPBLkq5TWh9DeDgsx+EIhvLRiDuEH67AmMj gWrRpYEJFkQXN/E9xmi6OVUC/bVA9t4wAyE6UEfh/OvE5e+AdHCpvmwUYw91kQDl/MZc rL6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=llIdSGu+jTfwrgNBkLR/LYIbmXh0cDQf0TOtyl03ljM=; b=F40rL3deJu7GZ5rTEaFVKo48LFjMOQRmd2CMMrepMP7JqKGBTf1UQAcPnNLSMwY9fD EZF52Dw0Ur+B3ruxs2DBdE+EA6vfAlmaOcbKrC8imHsu9GOxCh+lEYl2KqQO4UIBicuK oPkZzPAkA1M74rtwfpJxA0kAweJGgF/FzAjIkO8dUTPivxDCz7fj5YWmO7jTQexeaaAQ 40+5v8uooRXL9J7yN3xzeA57BDXgt4m/XKTmunEft2fs0r1xCSobIiU2H9j1GP5RxVsp Odf5e9LhGa6+gsuj7D+s1pX88EMMvYIYqXTUBz4kijdQ6Nh+zSyOgrcHoNDint/n8ylb HXlA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s35-20020a056a0017a300b00594356992a1si16008454pfg.108.2023.03.02.02.59.12; Thu, 02 Mar 2023 02:59:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230120AbjCBKwc convert rfc822-to-8bit (ORCPT + 99 others); Thu, 2 Mar 2023 05:52:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230112AbjCBKw3 (ORCPT ); Thu, 2 Mar 2023 05:52:29 -0500 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3937930197; Thu, 2 Mar 2023 02:52:26 -0800 (PST) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id 052EA24E3E0; Thu, 2 Mar 2023 18:52:24 +0800 (CST) Received: from EXMBX068.cuchost.com (172.16.6.68) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 2 Mar 2023 18:52:23 +0800 Received: from williamqiu-virtual-machine.starfivetech.com (171.223.208.138) by EXMBX068.cuchost.com (172.16.6.68) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 2 Mar 2023 18:52:23 +0800 From: William Qiu To: , , CC: Rob Herring , Krzysztof Kozlowski , Philipp Zabel , Mark Brown , William Qiu , Ziv Xu Subject: [PATCH v1 2/2] spi: cadence-quadspi: Add support for StarFive JH7110 QSPI Date: Thu, 2 Mar 2023 18:52:21 +0800 Message-ID: <20230302105221.197421-3-william.qiu@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230302105221.197421-1-william.qiu@starfivetech.com> References: <20230302105221.197421-1-william.qiu@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [171.223.208.138] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX068.cuchost.com (172.16.6.68) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759253381261678520?= X-GMAIL-MSGID: =?utf-8?q?1759253381261678520?= Add QSPI reset operation in device probe and add RISCV support to QUAD SPI Kconfig. Co-developed-by: Ziv Xu Signed-off-by: Ziv Xu Signed-off-by: William Qiu --- drivers/spi/Kconfig | 2 +- drivers/spi/spi-cadence-quadspi.c | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 3b1c0878bb85..c64edea53af6 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -230,7 +230,7 @@ config SPI_CADENCE config SPI_CADENCE_QUADSPI tristate "Cadence Quad SPI controller" - depends on OF && (ARM || ARM64 || X86 || COMPILE_TEST) + depends on OF && (ARM || ARM64 || X86 || RISCV || COMPILE_TEST) help Enable support for the Cadence Quad SPI Flash controller. diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c index 676313e1bdad..d9795e108ec5 100644 --- a/drivers/spi/spi-cadence-quadspi.c +++ b/drivers/spi/spi-cadence-quadspi.c @@ -1583,7 +1583,7 @@ static int cqspi_setup_flash(struct cqspi_st *cqspi) static int cqspi_probe(struct platform_device *pdev) { const struct cqspi_driver_platdata *ddata; - struct reset_control *rstc, *rstc_ocp; + struct reset_control *rstc, *rstc_ocp, *rstc_ref; struct device *dev = &pdev->dev; struct spi_master *master; struct resource *res_ahb; @@ -1673,6 +1673,17 @@ static int cqspi_probe(struct platform_device *pdev) goto probe_reset_failed; } + if (of_device_is_compatible(pdev->dev.of_node, "starfive,jh7110-qspi")) { + rstc_ref = devm_reset_control_get_optional_exclusive(dev, "rstc_ref"); + if (IS_ERR(rstc_ref)) { + ret = PTR_ERR(rstc_ref); + dev_err(dev, "Cannot get QSPI REF reset.\n"); + goto probe_reset_failed; + } + reset_control_assert(rstc_ref); + reset_control_deassert(rstc_ref); + } + reset_control_assert(rstc); reset_control_deassert(rstc); @@ -1825,6 +1836,10 @@ static const struct cqspi_driver_platdata versal_ospi = { .get_dma_status = cqspi_get_versal_dma_status, }; +static const struct cqspi_driver_platdata jh7110_qspi = { + .quirks = CQSPI_DISABLE_DAC_MODE, +}; + static const struct of_device_id cqspi_dt_ids[] = { { .compatible = "cdns,qspi-nor", @@ -1850,6 +1865,10 @@ static const struct of_device_id cqspi_dt_ids[] = { .compatible = "intel,socfpga-qspi", .data = &socfpga_qspi, }, + { + .compatible = "starfive,jh7110-qspi", + .data = &jh7110_qspi, + }, { /* end of table */ } };