From patchwork Fri Apr 23 08:41:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Lin X-Patchwork-Id: 12219923 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4943C43460 for ; Fri, 23 Apr 2021 08:42:57 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 794B761153 for ; Fri, 23 Apr 2021 08:42:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 794B761153 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=QxY7F3vby1p1DzpmM43S3OO9HVdcHqF5vWCGXCTr9lE=; b=F4ayjL61TgGZjviVgppZ7kKlr8 5fDK5meY/J8z1CH0L2RthSNsiAeQ4kZweNsX/Du/uM4DvjBhcaiblagIJVCFFFnCg6z+YcCDu/2L8 aJXrciLKUYMzglf7TdQtaf7mswDxysHpxj1vVQf3eJlRiYmOsJm+qF05DfHxBp+Io7NGIrIaKHIgJ fz3K0xZQ91kWYkh2/minTMSRju4jT6ojWmJofOUPn7HZy2N7zFPgDPkn9JNcZuAW6efJAQWJw4vhC ssaiHOKDZ5gFdXfPhiPYquTc4KHzgem/P7/SVnPq6OQArt5aF0769ergY1ghYMG2KJpoc/vK11/+7 mbvv75Ow==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lZrOk-0015KS-Ul; Fri, 23 Apr 2021 08:42:51 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZrOE-0015HE-CI; Fri, 23 Apr 2021 08:42:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To:References; bh=wO6h88rCFL6jUV5X9N8mokMhbuhKjxNLIO8lLsddsYo=; b=1fe5dgXD9iif9uiqWyXbaH1cmt BYOVXweesLb23SoryqUV4J5OlfGMi0AX2rmFnDRtqJixO7+37XAqhWX/ky+uzP3InywwG8jooDPxv As9ISsJ93CxaRrjq+L60VxEcXNKFiciw5jyYL8X0IYiFcVVQbxZ1sA/aUX93NqXoEN+mTVmCE5ntn 2YHUw5aHCogi6/ebkHw4ALfQPSWdx5ysTGYDoxk4CB/iJpB/T5kvUprf9tSVi1yWC1vix3QLg5fVW jho+A37mZ3k8IC1/IS0MI7NhTOgag3DHCZLstJndgFDLrICMDBP5fubsQWebfYVqQLqU1OHS17+PK SHvIqEtg==; Received: from lucky1.263xmail.com ([211.157.147.135]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZrOB-00EGKw-76; Fri, 23 Apr 2021 08:42:16 +0000 Received: from localhost (unknown [192.168.167.16]) by lucky1.263xmail.com (Postfix) with ESMTP id B2AABA904A; Fri, 23 Apr 2021 16:42:03 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P31919T139684386649856S1619167319885662_; Fri, 23 Apr 2021 16:42:02 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <3f114a5a2871cab5f701a86f95a23488> X-RL-SENDER: jon.lin@rock-chips.com X-SENDER: jon.lin@rock-chips.com X-LOGIN-NAME: jon.lin@rock-chips.com X-FST-TO: broonie@kernel.org X-RCPT-COUNT: 8 X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Jon Lin To: broonie@kernel.org Cc: heiko@sntech.de, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@esmil.dk, Jon Lin Subject: [PATCH v1 1/8] dt-bindings: spi: spi-rockchip: add description for rv1126 Date: Fri, 23 Apr 2021 16:41:48 +0800 Message-Id: <20210423084155.17439-1-jon.lin@rock-chips.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210423_014215_489075_89C89C10 X-CRM114-Status: UNSURE ( 8.34 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org The description below will be used for rv1126.dtsi in the future Signed-off-by: Jon Lin --- Documentation/devicetree/bindings/spi/spi-rockchip.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/spi/spi-rockchip.yaml b/Documentation/devicetree/bindings/spi/spi-rockchip.yaml index 1e6cf29e6388..4ed5b72a8494 100644 --- a/Documentation/devicetree/bindings/spi/spi-rockchip.yaml +++ b/Documentation/devicetree/bindings/spi/spi-rockchip.yaml @@ -27,6 +27,7 @@ properties: - items: - enum: - rockchip,px30-spi + - rockchip,rv1126-spi - rockchip,rk3188-spi - rockchip,rk3288-spi - rockchip,rk3308-spi From patchwork Fri Apr 23 08:41:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Lin X-Patchwork-Id: 12219921 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3EA5C433B4 for ; Fri, 23 Apr 2021 08:42:57 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1F063613D5 for ; Fri, 23 Apr 2021 08:42:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F063613D5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kaGugI4rwFyOS+LsSOHA2OFClthUp9PUIhYpZ6LWRxU=; b=H7essS3LYXQa60Mt58EjGjwq0G To9ZzpV1vROR9C9KQna0PPa0OkDGNc4wZeH+FK9NWgRp1fWUP2v4w4e2GmXX0RukWUuXKlBgwwEs+ guf9Rsr7fiQdckJio+lRotnZBKkp7F36Bw0rR5WqDo7Wz3C07tZt0U+4Ybe0ZO2BIbJTw7dAS6GEZ Usd7jipKLtW6M2qBA4ZSgGIsL3Dl6kCYaezrCJRxXHm6XDoiucdbP/M/T2HkmnIAlHlfYbVhk+I9A PbyPYwhGx8Wx+CaJ+qhscMTtbAIffEcTcb7jA58r7sR9VMZZdbuBz4N77QJLvVdAYGcBTDBTNkHns w/5JFr9Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lZrOn-0015Ks-5i; Fri, 23 Apr 2021 08:42:53 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZrOF-0015HG-Gn; Fri, 23 Apr 2021 08:42:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description; bh=EKYwdgMayzyihnZ/MR3zXiIWHXI1iRQz3mnLpGbDFKo=; b=YIsOD9tCcUSbJaL0XnRJ4VLbSY rJX2quyDlbMrLxCE6+QTjeKE65YCgL49GRN2MLZC2UmsSoSM/pjZA2OMwotpv/Vp89pjVwGZp7nsF sTA43qnT6y+Le9H9CHwbQKhAlrF5uqP5p6/vwc6pjE+uYbLx1AZv1y4Lmi4J6jUH7343Zwb4ys68d xfozDYTb/VfQ63W1AUz8nrKnCStDE1ql9qz5pvqcC6D6+Facbxqskmjiv05UXF9qlKzrbxvUYGhF4 zJtZVvtnHN1d0jSNqumgCjIoxpOMzoXvZwsIV2idwYK5YpfacUJoUn15pAiQBcRwEtw2fVtomDiWt RL9H7c0A==; Received: from lucky1.263xmail.com ([211.157.147.132]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZrOC-00EGLd-W8; Fri, 23 Apr 2021 08:42:18 +0000 Received: from localhost (unknown [192.168.167.16]) by lucky1.263xmail.com (Postfix) with ESMTP id 64A68F3323; Fri, 23 Apr 2021 16:42:11 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P31919T139684386649856S1619167319885662_; Fri, 23 Apr 2021 16:42:09 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <8793d2e563086ea134022376a1d21486> X-RL-SENDER: jon.lin@rock-chips.com X-SENDER: jon.lin@rock-chips.com X-LOGIN-NAME: jon.lin@rock-chips.com X-FST-TO: broonie@kernel.org X-RCPT-COUNT: 8 X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Jon Lin To: broonie@kernel.org Cc: heiko@sntech.de, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@esmil.dk, Jon Lin Subject: [PATCH v1 2/8] spi: rockchip: add compatible string for rv1126 Date: Fri, 23 Apr 2021 16:41:49 +0800 Message-Id: <20210423084155.17439-2-jon.lin@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210423084155.17439-1-jon.lin@rock-chips.com> References: <20210423084155.17439-1-jon.lin@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210423_014217_255944_67A86EF8 X-CRM114-Status: GOOD ( 11.90 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Add compatible string for rv1126 to applications for potential applications. Signed-off-by: Jon Lin --- drivers/spi/spi-rockchip.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 52d6259d96ed..dae0281f6ba8 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -911,7 +911,9 @@ static const struct dev_pm_ops rockchip_spi_pm = { }; static const struct of_device_id rockchip_spi_dt_match[] = { - { .compatible = "rockchip,px30-spi", }, + { .compatible = "rockchip,px30-spi", }, + { .compatible = "rockchip,rv1108-spi", }, + { .compatible = "rockchip,rv1126-spi", }, { .compatible = "rockchip,rk3036-spi", }, { .compatible = "rockchip,rk3066-spi", }, { .compatible = "rockchip,rk3188-spi", }, @@ -921,7 +923,6 @@ static const struct of_device_id rockchip_spi_dt_match[] = { { .compatible = "rockchip,rk3328-spi", }, { .compatible = "rockchip,rk3368-spi", }, { .compatible = "rockchip,rk3399-spi", }, - { .compatible = "rockchip,rv1108-spi", }, { }, }; MODULE_DEVICE_TABLE(of, rockchip_spi_dt_match); From patchwork Fri Apr 23 08:41:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Lin X-Patchwork-Id: 12219925 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09E61C433B4 for ; Fri, 23 Apr 2021 08:43:18 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5A22161153 for ; Fri, 23 Apr 2021 08:43:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5A22161153 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tIi48JOXM9zjvK6S1NGwwgBR3GoPml12aSUaC2a7wgM=; b=jf70YRFjI/GVVGMaPirl2GVjWR ipnBysa/VGMkK6eDwa3ugDlQH2ggexx3RcmGiGGvCQFE4ihdhflKcPwfc/Nq2bY8RvFlUuJOYNVrw fyEhZp1qDGJUldcpbvNbu9Za9A1+QMcuOO+Y7vPakEIG7iMQqwt1Xtl0mz+sdFCTzWLHFRRopPNyo IgcBF9wwnD5PlonCAA0EckbpOgBQHp9Tr7pNZiLAmIn5ELl7a40vHCo3lQM4BYw45rQJSxoUkt8JX bcAO53BS+urq+m4vqt7cNKAAKKl/O16NbJZjfK72/YRNN15XKic72ohMCBTpfXVlv5o8dKzaPFVAg qeuiMmfQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lZrP0-0015OB-UG; Fri, 23 Apr 2021 08:43:07 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZrOI-0015Hm-UH; Fri, 23 Apr 2021 08:42:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description; bh=HyjFNA2ex+a4VXE6qqnlg9Yao+99vLeCodWk/vS25pk=; b=lkkAlkUP7FWcLeYcyI7DumXDtT yJ1Unq9hQti8bijVCq64yRGNOG/yEo7T0k/CW3nMMytrBrxW+pLbLfi+l4oketCLHos9t+Y1aoKe/ mKHpqSi+raZSMIzQF3a2zAtZ6NKZr29FqwFgpmfql8DTnTTwq+ESzsE8ApGhbnMrvR6+4LmrepG+s LcWMPrPPvglmAXVndX0hA6YT0L0h289AvOSTnOVp47ZW/FjZtRF3iBWTUB4zoTQhP0kEijXJzovGO mLAfY3QtTO+epbWACuE6vKtrYutMg+IAn0+TA3fvahTGdMJ5LqZo9ekm2TMAPsWaOLUaaBOq6P62G 7GAmTtSA==; Received: from lucky1.263xmail.com ([211.157.147.135]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZrOG-00EGMA-11; Fri, 23 Apr 2021 08:42:21 +0000 Received: from localhost (unknown [192.168.167.16]) by lucky1.263xmail.com (Postfix) with ESMTP id 9AB6BA957C; Fri, 23 Apr 2021 16:42:17 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P31919T139684386649856S1619167319885662_; Fri, 23 Apr 2021 16:42:16 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <7bc9b3c8e116ea9d2c712862b486dda5> X-RL-SENDER: jon.lin@rock-chips.com X-SENDER: jon.lin@rock-chips.com X-LOGIN-NAME: jon.lin@rock-chips.com X-FST-TO: broonie@kernel.org X-RCPT-COUNT: 8 X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Jon Lin To: broonie@kernel.org Cc: heiko@sntech.de, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@esmil.dk, Jon Lin Subject: [PATCH v1 3/8] spi: rockchip: Support cs-gpio Date: Fri, 23 Apr 2021 16:41:50 +0800 Message-Id: <20210423084155.17439-3-jon.lin@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210423084155.17439-1-jon.lin@rock-chips.com> References: <20210423084155.17439-1-jon.lin@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210423_014220_492623_8FB125C2 X-CRM114-Status: GOOD ( 17.14 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org 1.Add standard cs-gpio support 2.Refer to spi-controller.yaml for details Signed-off-by: Jon Lin --- drivers/spi/spi-rockchip.c | 61 ++++++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index dae0281f6ba8..bb9d137b6f7f 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -156,7 +157,8 @@ */ #define ROCKCHIP_SPI_MAX_TRANLEN 0xffff -#define ROCKCHIP_SPI_MAX_CS_NUM 2 +/* 2 for native cs, 2 for cs-gpio */ +#define ROCKCHIP_SPI_MAX_CS_NUM 4 #define ROCKCHIP_SPI_VER2_TYPE1 0x05EC0002 #define ROCKCHIP_SPI_VER2_TYPE2 0x00110002 @@ -190,6 +192,7 @@ struct rockchip_spi { bool cs_asserted[ROCKCHIP_SPI_MAX_CS_NUM]; bool slave_abort; + bool gpio_requested; }; static inline void spi_enable_chip(struct rockchip_spi *rs, bool enable) @@ -238,11 +241,15 @@ static void rockchip_spi_set_cs(struct spi_device *spi, bool enable) /* Keep things powered as long as CS is asserted */ pm_runtime_get_sync(rs->dev); - ROCKCHIP_SPI_SET_BITS(rs->regs + ROCKCHIP_SPI_SER, - BIT(spi->chip_select)); + if (gpio_is_valid(spi->cs_gpio)) + ROCKCHIP_SPI_SET_BITS(rs->regs + ROCKCHIP_SPI_SER, 1); + else + ROCKCHIP_SPI_SET_BITS(rs->regs + ROCKCHIP_SPI_SER, BIT(spi->chip_select)); } else { - ROCKCHIP_SPI_CLR_BITS(rs->regs + ROCKCHIP_SPI_SER, - BIT(spi->chip_select)); + if (gpio_is_valid(spi->cs_gpio)) + ROCKCHIP_SPI_CLR_BITS(rs->regs + ROCKCHIP_SPI_SER, 1); + else + ROCKCHIP_SPI_CLR_BITS(rs->regs + ROCKCHIP_SPI_SER, BIT(spi->chip_select)); /* Drop reference from when we first asserted CS */ pm_runtime_put(rs->dev); @@ -625,6 +632,47 @@ static bool rockchip_spi_can_dma(struct spi_controller *ctlr, return xfer->len / bytes_per_word >= rs->fifo_len; } +static int rockchip_spi_setup(struct spi_device *spi) +{ + + int ret = -EINVAL; + struct rockchip_spi *rs = spi_controller_get_devdata(spi->controller); + + if (spi->cs_gpio == -ENOENT) + return 0; + + if (!rs->gpio_requested && gpio_is_valid(spi->cs_gpio)) { + ret = gpio_request_one(spi->cs_gpio, + (spi->mode & SPI_CS_HIGH) ? + GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH, + dev_name(&spi->dev)); + if (ret) + dev_err(&spi->dev, "can't request chipselect gpio %d\n", + spi->cs_gpio); + else + rs->gpio_requested = true; + } else { + if (gpio_is_valid(spi->cs_gpio)) { + int mode = ((spi->mode & SPI_CS_HIGH) ? 0 : 1); + + ret = gpio_direction_output(spi->cs_gpio, mode); + if (ret) + dev_err(&spi->dev, "chipselect gpio %d setup failed (%d)\n", + spi->cs_gpio, ret); + } + } + + return ret; +} + +static void rockchip_spi_cleanup(struct spi_device *spi) +{ + struct rockchip_spi *rs = spi_controller_get_devdata(spi->controller); + + if (rs->gpio_requested) + gpio_free(spi->cs_gpio); +} + static int rockchip_spi_probe(struct platform_device *pdev) { int ret; @@ -699,6 +747,7 @@ static int rockchip_spi_probe(struct platform_device *pdev) rs->dev = &pdev->dev; rs->freq = clk_get_rate(rs->spiclk); + rs->gpio_requested = false; if (!of_property_read_u32(pdev->dev.of_node, "rx-sample-delay-ns", &rsd_nsecs)) { @@ -752,6 +801,8 @@ static int rockchip_spi_probe(struct platform_device *pdev) ctlr->max_speed_hz = min(rs->freq / BAUDR_SCKDV_MIN, MAX_SCLK_OUT); ctlr->set_cs = rockchip_spi_set_cs; + ctlr->setup = rockchip_spi_setup; + ctlr->cleanup = rockchip_spi_cleanup; ctlr->transfer_one = rockchip_spi_transfer_one; ctlr->max_transfer_size = rockchip_spi_max_transfer_size; ctlr->handle_err = rockchip_spi_handle_err; From patchwork Fri Apr 23 08:41:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Lin X-Patchwork-Id: 12219927 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 643BCC433B4 for ; Fri, 23 Apr 2021 08:43:52 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 01063613D5 for ; Fri, 23 Apr 2021 08:43:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01063613D5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CdNeS0YITYHsif1fcIbdxxwWPJGQiO3HDRRGfZEPGgc=; b=caiW6TGpsoNsw05tH6U5/d11ck zPvWaRavdXtUGWSIt0ujlO/SV5qVVKUg7+pR5YK6pDmY3dp3lz+/M4Cs3I1XM4RpbLpU7unr4JpAA 0KvjS64sXt1SaIIJs7Tqr15LuH49GnejQrkzFbbjzVb2blGY7j1gn3ghSvDRN642j5g7aH8MyC2Ku AuoSFRDQLrEYLkHr+5331FgioLqq5rB5JE60ZrgnBLCDXZ1rtVNIoyRbbiPAMRZifmxroi7iQryVQ gvyXnnQFYD2Lu2bQEjt/H3yqZP1G/PCuGGZXX1Lmvl9JUw/HbtDT90mUIK5Qub3hZwoknoilrzag2 wv6FazNg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lZrPV-0015Vf-8q; Fri, 23 Apr 2021 08:43:37 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZrOO-0015IA-Bz; Fri, 23 Apr 2021 08:42:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ZaWLBlLp0/3ortZ741E/KJSSxmqZGhvr0wESXHkgrFM=; b=n2z677mmd2NQ9Snd2IFjoeQ/ux kbiVmYS0dFe6qD4C4N2EpHXQEOaWV6A7T0tDJx9KTD21bPbkTJGWbzK5f+sbOwBWZZ8G9iOX7EeGw E+/kw7dpHV/s1c+QrU4Y0WA+2D6A4qby1n7kz9FiMmo19KZqpG/UoalwFpnolekVlJx5GZdDtB7LZ JK647EbCprMpb4II3IW7G+TXTJGEJsnLa4rZwPT1DtGpVe/Zia5ok9F43ElDhzII3HldAmUDRPMb6 Pl/KurcsuJ7ukNeZjEmTq3RLQM6rz7EciJHCPY2FXMFdAKC1cgaKkt7aurVBOuP0s19BliYOYJtXj WOKS/EYA==; Received: from lucky1.263xmail.com ([211.157.147.131]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZrOL-00EGN6-Ob; Fri, 23 Apr 2021 08:42:27 +0000 Received: from localhost (unknown [192.168.167.16]) by lucky1.263xmail.com (Postfix) with ESMTP id F3427BA231; Fri, 23 Apr 2021 16:42:21 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P31919T139684386649856S1619167319885662_; Fri, 23 Apr 2021 16:42:20 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <8d61127a5a9b3a37120f213d16e54cc9> X-RL-SENDER: jon.lin@rock-chips.com X-SENDER: jon.lin@rock-chips.com X-LOGIN-NAME: jon.lin@rock-chips.com X-FST-TO: broonie@kernel.org X-RCPT-COUNT: 8 X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Jon Lin To: broonie@kernel.org Cc: heiko@sntech.de, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@esmil.dk, Jon Lin Subject: [PATCH v1 4/8] dt-bindings: spi: spi-rockchip: add description for rk3568 Date: Fri, 23 Apr 2021 16:41:51 +0800 Message-Id: <20210423084155.17439-4-jon.lin@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210423084155.17439-1-jon.lin@rock-chips.com> References: <20210423084155.17439-1-jon.lin@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210423_014226_014195_8FCEA9EF X-CRM114-Status: UNSURE ( 8.33 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Add compatible string for rk3568 to applications for potential applications. Signed-off-by: Jon Lin --- Documentation/devicetree/bindings/spi/spi-rockchip.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/spi/spi-rockchip.yaml b/Documentation/devicetree/bindings/spi/spi-rockchip.yaml index 4ed5b72a8494..2d7957f9ae0a 100644 --- a/Documentation/devicetree/bindings/spi/spi-rockchip.yaml +++ b/Documentation/devicetree/bindings/spi/spi-rockchip.yaml @@ -34,6 +34,7 @@ properties: - rockchip,rk3328-spi - rockchip,rk3368-spi - rockchip,rk3399-spi + - rockchip,rk3568-spi - const: rockchip,rk3066-spi reg: From patchwork Fri Apr 23 08:41:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Lin X-Patchwork-Id: 12219929 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 212CAC433B4 for ; Fri, 23 Apr 2021 08:44:25 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AA0DC613D5 for ; Fri, 23 Apr 2021 08:44:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA0DC613D5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Jw3A5E1Fd1eebHk43hk56TGRVZkhS1pLBhclMdqQUMg=; b=pkEP2RTl7aOuZy59Fd9rmzwGSk KrV4lCD3NOkbBYyMzpaUkSbLSZ5SFdRxfHt1VGT8Orh5QiLiKvoJ3GF2a36zDG5oRye1paQ3bTYf3 B7ZpetuuXdY1lCHnIgkwvh/LJpdcust6weGX+3Yg+97mvRAGCJMIHpeqTz789XVoHZeRcdvvPLys8 Os5uKcHgHg7jWtgoe1mWPR+dSEV9FhSSCmGvMk1rhgeda5zmjpj2eXfutNfq6M3tn8GR6sx7Dixyl 8X7p7O9jcIc/e+wT+onZTORF4OsKYUpNNN7hEH2ZyXFBmvygb8+V2lwBqkiL4rKgFrC3Mza/Oo9Ka jSJ9ZrIA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lZrQA-0015eV-5n; Fri, 23 Apr 2021 08:44:18 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZrOR-0015IT-5e; Fri, 23 Apr 2021 08:42:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description; bh=gVo97G+RrhzX7zOPNMKzKUVgpkRLVqPpMsayjZLLd8w=; b=YuS64XwAK9j3+wXTYk9YKJ+pvg wpk0LLZWB5vSLuTbkBtMRvFbfM6eIwW9iL4zQ56N+jkfKpBDCJXMQyeajLXnc/bSuo4suPbP4VUWJ GqpuLe43aM/pOVgXINxz2Bd3yU3ejRBdVPeLG43SV0Bv8Vv/YfY+nFNPInBMYSLkndq+c25mOqBEd tjXekrr5hix4WSF8ha+JXasDsfkDNqGELoRdArxDoQ1wSFJHY5iNWRVhnPjdHqpXfbAfTckuZz2Ur MeWxgI9bXlR42TKUZgrNOgxB1Yxdp4hxfqd/vPsiQldK5ok7SgO+4k+fBANhcbVzWW/21npMOCUEv oH89GBrw==; Received: from lucky1.263xmail.com ([211.157.147.135]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZrOO-00EGNX-LP; Fri, 23 Apr 2021 08:42:29 +0000 Received: from localhost (unknown [192.168.167.16]) by lucky1.263xmail.com (Postfix) with ESMTP id 0BCBBA95E5; Fri, 23 Apr 2021 16:42:26 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P31919T139684386649856S1619167319885662_; Fri, 23 Apr 2021 16:42:23 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <82c0c1d62d69d1860ae69a3730cd97f7> X-RL-SENDER: jon.lin@rock-chips.com X-SENDER: jon.lin@rock-chips.com X-LOGIN-NAME: jon.lin@rock-chips.com X-FST-TO: broonie@kernel.org X-RCPT-COUNT: 8 X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Jon Lin To: broonie@kernel.org Cc: heiko@sntech.de, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@esmil.dk, Jon Lin Subject: [PATCH v1 5/8] spi: rockchip: Add compatible string for rk3568 Date: Fri, 23 Apr 2021 16:41:52 +0800 Message-Id: <20210423084155.17439-5-jon.lin@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210423084155.17439-1-jon.lin@rock-chips.com> References: <20210423084155.17439-1-jon.lin@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210423_014228_900424_2FA7CEC5 X-CRM114-Status: UNSURE ( 9.47 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Add compatible string for rv1126 to applications for potential applications. Signed-off-by: Jon Lin --- drivers/spi/spi-rockchip.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index bb9d137b6f7f..cfcbfd6c1be5 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -974,6 +974,7 @@ static const struct of_device_id rockchip_spi_dt_match[] = { { .compatible = "rockchip,rk3328-spi", }, { .compatible = "rockchip,rk3368-spi", }, { .compatible = "rockchip,rk3399-spi", }, + { .compatible = "rockchip,rk3568-spi", }, { }, }; MODULE_DEVICE_TABLE(of, rockchip_spi_dt_match); From patchwork Fri Apr 23 08:47:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Lin X-Patchwork-Id: 12219947 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DAA9C433B4 for ; Fri, 23 Apr 2021 08:50:37 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 197B0613C9 for ; Fri, 23 Apr 2021 08:50:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 197B0613C9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=K1QbARdLCLCj4tVhI5ccdLeudohm9YYl7D3K7Ug1Ur0=; b=Zr5NhWW9N4gYkTw6OX3uccsY3M ysRb3XjlQOMJf/7XTOerbL6puPPs6iZ2fyti6Rzh717FMDgG/sByI6bjOPxHcjjixfDUt1PD2nwmQ UZR6B1ZNisd/NRMmH5oQc/TFNQQkEmkJfLEfK+GfZmkKOLJBQwxrjFvnWbK+texWCJexeMjDqd/Kk cmvPbI3Eex0rHSogNF9zWF2MnoeWn8zo+lx/Uu2oUmF7wgggOGzt49do/i8gmtnSkTRcXkWRmazvV o/78xHvZgSf3sAAdzKZW15l/RWslfQlU04S3uU+2Nyb5eG1/gqDBA1IJDhSOR9+Ri8qa5jmpXjd3z c5DA0QEQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lZrW8-0016kT-Hm; Fri, 23 Apr 2021 08:50:28 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZrTn-0016UH-St; Fri, 23 Apr 2021 08:48:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description; bh=CKwA2I8Cpn4Ix3oB15GXsVsJKYje96BG8/yI5OKxQnk=; b=W67KPm2NS2Ojs23pYTw/qFEFQx iXynG3MWKisDUDIyZZpnZkAm9+cnGkmXrQWNoHJU0C5shwKAJfHUmoiTNv6kkTVGQPdKz77fBIfLR YyJn+ZT74H1XyQpZrN1YhJWk1hJOLo74gCkm6uUbQiYasfogMghyfxhPucwK4NRTG5KxPhwoa85IY NAsshEcaVgptma2yrBGLP9crQJ3Pwjmgc3R6XCLhWxb6RClAFwpZ4e+wLfzuFizuHtQR3KT8moeSp +imc0c8muvFxGQnG84it79Uasy9i8Lg8e4SvyB7qTindQuXuRwpI4MndYr/qY3OceEIo9Cg2ZQVJY /ekE/CWQ==; Received: from lucky1.263xmail.com ([211.157.147.130]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZrTl-00EGYe-DI; Fri, 23 Apr 2021 08:48:02 +0000 Received: from localhost (unknown [192.168.167.235]) by lucky1.263xmail.com (Postfix) with ESMTP id 23ECCD1AB7; Fri, 23 Apr 2021 16:47:59 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P2750T140649173088000S1619167674948451_; Fri, 23 Apr 2021 16:47:56 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <2557a3ff5cf6116de1b31291f3f41ed3> X-RL-SENDER: jon.lin@rock-chips.com X-SENDER: jon.lin@rock-chips.com X-LOGIN-NAME: jon.lin@rock-chips.com X-FST-TO: broonie@kernel.org X-RCPT-COUNT: 8 X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Jon Lin To: broonie@kernel.org Cc: heiko@sntech.de, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@esmil.dk, Jon Lin Subject: [PATCH v1 6/8] spi: rockchip: Set rx_fifo interrupt waterline base on transfer item Date: Fri, 23 Apr 2021 16:47:48 +0800 Message-Id: <20210423084750.18533-1-jon.lin@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210423084155.17439-1-jon.lin@rock-chips.com> References: <20210423084155.17439-1-jon.lin@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210423_014801_645045_179441ED X-CRM114-Status: GOOD ( 12.47 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org The error here is to calculate the width as 8 bits. In fact, 16 bits should be considered. Signed-off-by: Jon Lin --- drivers/spi/spi-rockchip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index cfcbfd6c1be5..c245af1692c7 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -547,8 +547,8 @@ static int rockchip_spi_config(struct rockchip_spi *rs, * interrupt exactly when the fifo is full doesn't seem to work, * so we need the strict inequality here */ - if (xfer->len < rs->fifo_len) - writel_relaxed(xfer->len - 1, rs->regs + ROCKCHIP_SPI_RXFTLR); + if ((xfer->len / rs->n_bytes) < rs->fifo_len) + writel_relaxed(xfer->len / rs->n_bytes - 1, rs->regs + ROCKCHIP_SPI_RXFTLR); else writel_relaxed(rs->fifo_len / 2 - 1, rs->regs + ROCKCHIP_SPI_RXFTLR); From patchwork Fri Apr 23 08:47:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Lin X-Patchwork-Id: 12219943 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53717C433ED for ; Fri, 23 Apr 2021 08:49:58 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4EDEF613D7 for ; Fri, 23 Apr 2021 08:49:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4EDEF613D7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8oRkR9Cq6nCLZT6TOUfTDtTm4JZGHRmyvmqO0cVm3hY=; b=dCxDIVWGddUfJkNqrKUOHIBsxv R1/UpT/rwz3+gtyclLZf31zAJWTljM1+679GmlWUDtlT4UVRnQqE5UFd5+m+QRmEOc5fUvaISJpGn KC3LbuO3YMvzgA1izXs8QiUs3TD7Ewc00+VCi2yOZ9ech47eWt+fb6h7eGIE1cntOB6dfaHenX4Zj kb9/tkrN4PyFHjjyEOkfxypyYd202vm4wRED7HHd8rBZxbT5ZvwsV4EXcUwNJdoUTTsukUzP5F+Um e7jCNnzHsbJBrf/aDD/YvV00CmjdlDR2qB4bJA+C/wOYiVJM1TXTIelxUzkSwg/2fGp7h6U+RrUCZ FTPNgdBw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lZrVD-0016aC-QG; Fri, 23 Apr 2021 08:49:45 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZrTm-0016Tq-1y; Fri, 23 Apr 2021 08:48:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description; bh=XxuJFthpxpMfY+367kfTrm7FfrSCtiYgxwS1dB0r/w4=; b=LIK7NFqU0SHADckOG0i0tOQPKw g7Ejfo5Kqs5uhTXJ61ivOdww06TN5kUv62o4CTLfOmasV4/HUmIHCY0x5Qu7NYmRT3Lhjj4qyLjmf IyY5ZQtYuPNCrtlT+m6wPaGGfEVso/if8T2Dz/dAmqGQMqqQFYzyHCtQPptXG6r8o12XDBDcpFjq1 zOQHhNXDN0rDnLkPU/Swe68bNyVGgnkK2rcyvc0JdzDpBZ3OTmleHNisnhSokRN0gGBxe29Z9TOdb XdtZkojrRQnpNPVKnJtUrdX3NY86+cPUSLx0DifPMQW/yxlUWCOqZ2dLH5MshADndocR0elHoznza na2MI0hA==; Received: from lucky1.263xmail.com ([211.157.147.133]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZrTj-00EGYP-A7; Fri, 23 Apr 2021 08:48:00 +0000 Received: from localhost (unknown [192.168.167.235]) by lucky1.263xmail.com (Postfix) with ESMTP id BD08BCD853; Fri, 23 Apr 2021 16:47:56 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P2750T140649173088000S1619167674948451_; Fri, 23 Apr 2021 16:47:56 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: X-RL-SENDER: jon.lin@rock-chips.com X-SENDER: jon.lin@rock-chips.com X-LOGIN-NAME: jon.lin@rock-chips.com X-FST-TO: broonie@kernel.org X-RCPT-COUNT: 8 X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Jon Lin To: broonie@kernel.org Cc: heiko@sntech.de, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@esmil.dk, Jon Lin Subject: [PATCH v1 7/8] spi: rockchip: Wait for STB status in slave mode tx_xfer Date: Fri, 23 Apr 2021 16:47:49 +0800 Message-Id: <20210423084750.18533-2-jon.lin@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210423084750.18533-1-jon.lin@rock-chips.com> References: <20210423084155.17439-1-jon.lin@rock-chips.com> <20210423084750.18533-1-jon.lin@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210423_014759_543534_963729AF X-CRM114-Status: GOOD ( 12.25 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org After ROCKCHIP_SPI_VER2_TYPE2, SR->STB is a more accurate judgment bit for spi slave transmition. Signed-off-by: Jon Lin --- drivers/spi/spi-rockchip.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index c245af1692c7..b17463e5fda6 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -117,13 +117,14 @@ #define BAUDR_SCKDV_MIN 2 #define BAUDR_SCKDV_MAX 65534 -/* Bit fields in SR, 5bit */ -#define SR_MASK 0x1f +/* Bit fields in SR, 6bit */ +#define SR_MASK 0x3f #define SR_BUSY (1 << 0) #define SR_TF_FULL (1 << 1) #define SR_TF_EMPTY (1 << 2) #define SR_RF_EMPTY (1 << 3) #define SR_RF_FULL (1 << 4) +#define SR_SLAVE_TX_BUSY (1 << 5) /* Bit fields in ISR, IMR, ISR, RISR, 5bit */ #define INT_MASK 0x1f @@ -200,13 +201,19 @@ static inline void spi_enable_chip(struct rockchip_spi *rs, bool enable) writel_relaxed((enable ? 1U : 0U), rs->regs + ROCKCHIP_SPI_SSIENR); } -static inline void wait_for_idle(struct rockchip_spi *rs) +static inline void wait_for_tx_idle(struct rockchip_spi *rs, bool slave_mode) { unsigned long timeout = jiffies + msecs_to_jiffies(5); do { - if (!(readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)) - return; + if (slave_mode) { + if (!(readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_SLAVE_TX_BUSY) && + !((readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)) + return; + } else { + if (!(readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)) + return; + } } while (!time_after(jiffies, timeout)); dev_warn(rs->dev, "spi controller is in busy state!\n"); @@ -390,7 +397,7 @@ static void rockchip_spi_dma_txcb(void *data) return; /* Wait until the FIFO data completely. */ - wait_for_idle(rs); + wait_for_tx_idle(rs, ctlr->slave); spi_enable_chip(rs, false); spi_finalize_current_transfer(ctlr); @@ -552,7 +559,7 @@ static int rockchip_spi_config(struct rockchip_spi *rs, else writel_relaxed(rs->fifo_len / 2 - 1, rs->regs + ROCKCHIP_SPI_RXFTLR); - writel_relaxed(rs->fifo_len / 2, rs->regs + ROCKCHIP_SPI_DMATDLR); + writel_relaxed(rs->fifo_len / 2 - 1, rs->regs + ROCKCHIP_SPI_DMATDLR); writel_relaxed(rockchip_spi_calc_burst_size(xfer->len / rs->n_bytes) - 1, rs->regs + ROCKCHIP_SPI_DMARDLR); writel_relaxed(dmacr, rs->regs + ROCKCHIP_SPI_DMACR); From patchwork Fri Apr 23 08:47:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Lin X-Patchwork-Id: 12219945 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FDC8C433B4 for ; Fri, 23 Apr 2021 08:50:17 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 22A45613C9 for ; Fri, 23 Apr 2021 08:50:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 22A45613C9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zZ30VC8thoWvbNt+ZQ1Rpz8B1YejQaJOrfVATAk1KiI=; b=J7nRvU1RtYNNvUBO+OYqrzLfHR K/kcVBAwJWI53Cc+WQqtMNaPUZOIbHGXcr19tqJJlqMbrSW+X3STcjGMBSn/cnrYSXmx2OdTBnETD suMb1veeAYK15B1DIDbawspckmzOT7KRahmuIWn5Hl7y8INCjunpOg8m90xF7Fb0+PsysBc9YgBOr nZ1pKHS2r+2S5UVQfDnew6RT5pT+GC6sCd1Oxbwvzyvzx6zCm3/q2XGXkZPg/Pi3nKVNovU56p0nZ rp2xKU/u04iyHUWSFo3XOvgawXzan513MKxsIHG802L0U3X/QbQDmF9xvHhOmqjtfAQV5nFEmiA9m 1cnDy0Rw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lZrVp-0016fi-8F; Fri, 23 Apr 2021 08:50:09 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZrTn-0016U4-9I; Fri, 23 Apr 2021 08:48:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description; bh=1miuZyt30v1sjCf1h2NpleV2aLWHXqbr86dMXJf+M1M=; b=zBGMV1XC/CigvQEGTlfZdNwZln dKvO5q/AXDbUwOdxdJkkSQz66P+m/xPOuFQDs6D1z6XwI3rhQ/HVVhmkLnZ/wtHWp6exw5DMEZXLi QlpYzoFUqxeJSzT0y1HlffsVQgyt4s9zvVo/QwsNqLNxNwH6mra59AVnAoKUTo5GzXg0mJdvfwfmf k7bcaKtJMtIm9Vp9zqYHUOfr8WGVvNxX2b+9THdcthOgHSLFt48xk+h9xQ/6K1o77fv5xoH15bKQW jRz/0ZttIQl2yeBYeIuFFomfEiNtyWjnERVWLBu6+7Cb8+lc8v6KFcj6OeuDZ5QOeke9ReHa9ykWg Ippdyt/Q==; Received: from lucky1.263xmail.com ([211.157.147.131]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZrTk-00EGYd-Pf; Fri, 23 Apr 2021 08:48:02 +0000 Received: from localhost (unknown [192.168.167.235]) by lucky1.263xmail.com (Postfix) with ESMTP id E8029BA73D; Fri, 23 Apr 2021 16:47:58 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P2750T140649173088000S1619167674948451_; Fri, 23 Apr 2021 16:47:57 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <56cbeb1033c6db74f14d199426453886> X-RL-SENDER: jon.lin@rock-chips.com X-SENDER: jon.lin@rock-chips.com X-LOGIN-NAME: jon.lin@rock-chips.com X-FST-TO: broonie@kernel.org X-RCPT-COUNT: 8 X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Jon Lin To: broonie@kernel.org Cc: heiko@sntech.de, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@esmil.dk, Jon Lin Subject: [PATCH v1 8/8] spi: rockchip: Support SPI_CS_HIGH Date: Fri, 23 Apr 2021 16:47:50 +0800 Message-Id: <20210423084750.18533-3-jon.lin@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210423084750.18533-1-jon.lin@rock-chips.com> References: <20210423084155.17439-1-jon.lin@rock-chips.com> <20210423084750.18533-1-jon.lin@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210423_014801_014537_BF97AA2E X-CRM114-Status: GOOD ( 12.38 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org 1.Add standard spi-cs-high support 2.Refer to spi-controller.yaml for details Signed-off-by: Jon Lin --- drivers/spi/spi-rockchip.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index b17463e5fda6..5b52f2bc3d9a 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -108,6 +108,8 @@ #define CR0_OPM_MASTER 0x0 #define CR0_OPM_SLAVE 0x1 +#define CR0_SOI_OFFSET 23 + #define CR0_MTM_OFFSET 0x21 /* Bit fields in SER, 2bit */ @@ -238,7 +240,7 @@ static void rockchip_spi_set_cs(struct spi_device *spi, bool enable) { struct spi_controller *ctlr = spi->controller; struct rockchip_spi *rs = spi_controller_get_devdata(ctlr); - bool cs_asserted = !enable; + bool cs_asserted = spi->mode & SPI_CS_HIGH ? enable : !enable; /* Return immediately for no-op */ if (cs_asserted == rs->cs_asserted[spi->chip_select]) @@ -509,6 +511,8 @@ static int rockchip_spi_config(struct rockchip_spi *rs, cr0 |= (spi->mode & 0x3U) << CR0_SCPH_OFFSET; if (spi->mode & SPI_LSB_FIRST) cr0 |= CR0_FBM_LSB << CR0_FBM_OFFSET; + if (spi->mode & SPI_CS_HIGH) + cr0 |= BIT(spi->chip_select) << CR0_SOI_OFFSET; if (xfer->rx_buf && xfer->tx_buf) cr0 |= CR0_XFM_TR << CR0_XFM_OFFSET; @@ -787,7 +791,7 @@ static int rockchip_spi_probe(struct platform_device *pdev) ctlr->auto_runtime_pm = true; ctlr->bus_num = pdev->id; - ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LOOP | SPI_LSB_FIRST; + ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LOOP | SPI_LSB_FIRST | SPI_CS_HIGH; if (slave_mode) { ctlr->mode_bits |= SPI_NO_CS; ctlr->slave_abort = rockchip_spi_slave_abort;