From patchwork Tue Apr 27 07:37:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Lin X-Patchwork-Id: 12225507 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=-17.0 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 D8114C433B4 for ; Tue, 27 Apr 2021 07: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 3EB7C613AA for ; Tue, 27 Apr 2021 07:43:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3EB7C613AA 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-arm-kernel-bounces+linux-arm-kernel=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=Urbp2tkDgRX8Mky9dw1A9MepJqqHLgiMXMIv2oC0Nsw=; b=U7xTKZPmswmv9o1/+OkvWa3z7p zyWtKpZZNIosVmok95ZmDCNnjLhW5lfL72xC56zla7jPi5ccerLsSf2jVsaxA9jKhJAViEjruH81h ywi4foqgT9weJVP65UEezaeyJ/KPfcTKMOkWf4yOPm2CNZVs08Zyse3OIJvolWNnFuMaWB8rNnpBU cyK9oUC8iKpNqQObz0wMF7ape/830+jMDZKQ3PdXveJjg2Jn2LSzt/maHnexc86Sdq5ItysqcqOPG Wwio4cTV5F5/2Dzg2xNbK6i5s6bi/wPPsR3WtStTdNtQM9UcDUIKMAXHjtbxcUdMVvUDPvtnkQO3D dnnFupIg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbILi-000zd6-MY; Tue, 27 Apr 2021 07:41:39 +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 1lbII4-000z9p-Bd; Tue, 27 Apr 2021 07:37:52 +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=ukx7ZfTSUeH5kxFIjKghPbL714R8E0BG+Xo785FPvew=; b=UxIiTU41eOWg4l3yNrq87sqFg6 WRA4tXsdy/nUpmDGVrQSWPX/HKTs/Lua1aQ2f127SGCFIlrw7Nhx0fnmR4Fa+qpatQe37q1c7sOqw CYGn2AlUC1YnC7xUzcyns/4xpeSBtQOAZw63guVRxX+/WSqlvIl4Shcl1h4LQhRmaP4DFZJ3PV8ea lSCHwWFH4GJ8iRhV03yzvAWukmPOWhBkOSSKahScXdhw00fqKD+0/6IWVz7XZ2M8cusUxaDBpoaxW ch1Pkpy7IKeqBBQB7/RvEeOYg/zR7RxLZG2MkLAio9LWse+2dmY3uXmt1Xk1DXy+W7/T3O2oQ3Yqg 4JacprcA==; Received: from lucky1.263xmail.com ([211.157.147.132]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbIHw-00GVkf-Kz; Tue, 27 Apr 2021 07:37:47 +0000 Received: from localhost (unknown [192.168.167.235]) by lucky1.263xmail.com (Postfix) with ESMTP id C2753F39DC; Tue, 27 Apr 2021 15:37:36 +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 P2750T140648996910848S1619509055243892_; Tue, 27 Apr 2021 15:37:36 +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 v2 1/8] spi: rockchip: Set rx_fifo interrupt waterline base on transfer item Date: Tue, 27 Apr 2021 15:37:26 +0800 Message-Id: <20210427073733.31419-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-20210427_003744_867639_1D064CD8 X-CRM114-Status: GOOD ( 13.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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 52d6259d96ed..406ea3c6abd9 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -540,8 +540,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 Tue Apr 27 07:37:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Lin X-Patchwork-Id: 12225509 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=-17.0 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 688DFC433B4 for ; Tue, 27 Apr 2021 07:45:31 +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 D858A61152 for ; Tue, 27 Apr 2021 07:45:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D858A61152 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-arm-kernel-bounces+linux-arm-kernel=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=hBpSzG7Njb+CIDp4PqFiactYf/pUWH+V88kL+hm4GMM=; b=EJe1TEgXVlNozAT4B+dYEto+lW ACljRldBDX8tf1hUt3W4Zik3L2q6RcW1ErcC02P4LQP0OE3T2DGLtgHCQWLXemDSjCTn1Wu9FEjYs d5VcnR4GhkJ+Lp4ScDiacTeLeKRCUfLlqOyQ8LYWOTGPE1r0F+V/+fjgYVS8ekYnEPy6hnYnxCDup nIqcX7o2U6SNOCEP1fsdshk1Pa3yAk7LQPxhw+xiIoD7uRSxvuQ2O419qB6Bd2e/7T/3JmYS/NLFv ytu3r1KyzNRRwqBrNsEB8b6xRc6y2Vqd2JOsTFWaJI59wLA6oRwb1SGKdQx7MgFUavhK3FTPRdr3j p/XtRkiQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbINT-000zuj-46; Tue, 27 Apr 2021 07:43: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 1lbII4-000z9i-FP; Tue, 27 Apr 2021 07:37:52 +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=DQ4OHl2n0N9qAOLoFS6EokGy8EozFrcvMpsVw1BfPWA=; b=DGsdaJQQrhEdiz/cVUq9AnnuSh E7scTw7ho1lg1HD0f2BVKUHsVGL/bbjjqK68uAH1uQYiW/YjEoX+MmG/1W7RII6yDJWOTMNJA4iZL t5O35vURwjMPjwHKL+8eQ0Ei3ETGNmbn2phegX1ZMBn9dF2w4GA7xnCyzaLdv8LyyqJx/BGtwUgw3 QYbVr6bqXIxxrC/sDqkIyymixp1NYBi7tx1+A4/oyTxkfUUadqaVVSQK2F9QQEJ34MTEg0L2Jf4YR fU29BmcxLU2zm16O+3DyMTeAdezE/Azl1h6sCXV8+ILxpOWKVP/ygjUOThB4yq36RNPZnPvt/iAco 1kbrcpcw==; Received: from lucky1.263xmail.com ([211.157.147.132]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbIHw-00GVlY-4c; Tue, 27 Apr 2021 07:37:46 +0000 Received: from localhost (unknown [192.168.167.235]) by lucky1.263xmail.com (Postfix) with ESMTP id 24344F39E7; Tue, 27 Apr 2021 15:37:37 +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 P2750T140648996910848S1619509055243892_; Tue, 27 Apr 2021 15:37:37 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <9750483e74543d081e4f01e3ea61ed59> 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 v2 2/8] spi: rockchip: Wait for STB status in slave mode tx_xfer Date: Tue, 27 Apr 2021 15:37:27 +0800 Message-Id: <20210427073733.31419-2-jon.lin@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210427073733.31419-1-jon.lin@rock-chips.com> References: <20210427073733.31419-1-jon.lin@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_003744_377685_C7CC989C X-CRM114-Status: GOOD ( 13.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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 406ea3c6abd9..0f39ea2d1d31 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -116,13 +116,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 @@ -197,13 +198,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"); @@ -383,7 +390,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); @@ -545,7 +552,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 Tue Apr 27 07:37:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Lin X-Patchwork-Id: 12225475 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=-17.0 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 CDEABC43462 for ; Tue, 27 Apr 2021 07:40:21 +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 67CE1613AA for ; Tue, 27 Apr 2021 07:40:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67CE1613AA 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-arm-kernel-bounces+linux-arm-kernel=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=ZBf9oTtAORPoVVmyw6M3jid1aJ5GKPrRoKy2JIfjSLc=; b=lK51rbolw9BBqo/hVY4jkV+hQm Qp2/QyWUBHVieZAK1sdefJqZHS/co9K7GH9W8IXlMI3OZnYV6SdW7C5tdWycUKdyydY1Dg9RrSoLW MF5uggJ98YstSohcl3S5magia6mgF+DlknLfRyC9KJf/Jr1hQiaBTf6ULxoUZzaeWk+8V/JL4wUer n+9/cK3sIKHkoCRZ4uDueU4n7Guek1DS/V5vGuRHAbYYlsklq8BGZlpcXx823/0XYPnFBCBU1uLLL WuxrJ8vH4yp0DVdOLPtT9JNFyO/0eCbJRWhIzmu5PAOJGTEQ9ckYW3gDKjqhpKbdGuzXdVjNZjJiW VPuPtiTg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbIIH-000zBV-DB; Tue, 27 Apr 2021 07:38:06 +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 1lbII4-000z9s-9u; Tue, 27 Apr 2021 07:37:52 +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=wO6h88rCFL6jUV5X9N8mokMhbuhKjxNLIO8lLsddsYo=; b=lRT9LgtCYgZo5gNVr3jvMzAlgA zrGvxw6RDRx689sKq4R776Q2CZZWSFtpEmwaOvIxkPBkLSTSvXu8OkktuEy1qgmYwplTqV+oKy5tS dkQy2RrFypkZm2wD0IqacGcf6YT1g8/XAPQ2+5IeKmUoFS4MgW7Gvoojg3UblZBm78nCbYCkE4red qB2D/cdTZ4wDY9d7x9wmc5IMGoufnujLvWoX6Br6ynPvkaBN+3jCFXkgsfYVJQU8PwCBwlffBvyb3 IGIkw76EQ02b8ohr2qEAxGJ5fAMuzT4Ac4qxwJMoItjtsaVDtTXiT4IbRweINuZuzCtRCqTYNLr5y vVX8uu0w==; Received: from lucky1.263xmail.com ([211.157.147.132]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbIHx-00GVlu-MA; Tue, 27 Apr 2021 07:37:47 +0000 Received: from localhost (unknown [192.168.167.235]) by lucky1.263xmail.com (Postfix) with ESMTP id A958BF3AF1; Tue, 27 Apr 2021 15:37:39 +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 P2750T140648996910848S1619509055243892_; Tue, 27 Apr 2021 15:37:37 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <01111ffee587bf109de715e58a149324> 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 v2 3/8] dt-bindings: spi: spi-rockchip: add description for rv1126 Date: Tue, 27 Apr 2021 15:37:28 +0800 Message-Id: <20210427073733.31419-3-jon.lin@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210427073733.31419-1-jon.lin@rock-chips.com> References: <20210427073733.31419-1-jon.lin@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_003745_899414_2D108C3E X-CRM114-Status: UNSURE ( 9.94 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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 Tue Apr 27 07:37:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Lin X-Patchwork-Id: 12225477 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=-17.0 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 DEF91C433ED for ; Tue, 27 Apr 2021 07:42:02 +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 84C2D61026 for ; Tue, 27 Apr 2021 07:42:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 84C2D61026 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-arm-kernel-bounces+linux-arm-kernel=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=aM75uPnJlmVvwsvH/KPYT8WYXMfOatq4RRCtAe6lz3I=; b=YwW5KgS8tnYiS8rdZWSnZmeH03 XmODtKDY+YEDJ+f0L0HQB7Y+jzySPWyceMEXTH9XsKfndvjvfMdR209HxzoHxg1zyyNxf2RKnVy0h dZe8quFh0+rAaylsGb67z96UiFKfaxcdpJIvh4OmFyh/U6mFwGw1toZCAOJ6dJTiirLgu7DXpadqv V+B7Xi65BEKU4opiV7/DfWgXTAr9XCMXN73qYLkOeXNNI2nYPFxEPcOfl549bOcCUAECiSQjTBKpn aJRfVd2VIf9im+EkXzp7D1B7GdSw7tvdcgjLcSbryAAR/KuTlvyCsjaThgV3KI70CvQDuc+H3laFe 8qBnzGvA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbIK2-000zOA-GM; Tue, 27 Apr 2021 07:39:55 +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 1lbII4-000z9j-GQ; Tue, 27 Apr 2021 07:37:52 +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=I62t0os2wYM+ocAcdnKGBjrkD2yFyGf3SdNLEXn0P9Y=; b=oEjIQnWjDTE15h0uBzqMAOoj2h RAuTzRGdXnI9vas0ZSATUiLI/BG3AFbYvqOxEFrjVI0XL6Y54QcmeMrRo5XNm/b91S/Y6YIOVFs7U 2pfE5Ph2qi9np3Hy8Jc2yudxkJKEd853AazPTWVY70ESYWfF4WQsiamOWDVpk8NYA0CxBb85ePfnF ra7YWd1KE1vXf55pGVQnqqpYehKHE9An2aVmQKQnUjg8Svwy59kKA/0N2mBwY7YgYAkoFXq6tv0xg +ffXnAoj389CwGPc/BURNGH69t9kIM0cSUrPoF8jLzLk931NJgdvyPmIUT+hUZtLSmbSrYsLVBz61 E0RM/qQA==; Received: from lucky1.263xmail.com ([211.157.147.131]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbIHw-00GVlk-Ad; Tue, 27 Apr 2021 07:37:46 +0000 Received: from localhost (unknown [192.168.167.235]) by lucky1.263xmail.com (Postfix) with ESMTP id 76401BA165; Tue, 27 Apr 2021 15:37:38 +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 P2750T140648996910848S1619509055243892_; Tue, 27 Apr 2021 15:37:38 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <6d357976f75a46d70ce2d1b41d2548a5> 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 v2 4/8] spi: rockchip: add compatible string for rv1126 Date: Tue, 27 Apr 2021 15:37:29 +0800 Message-Id: <20210427073733.31419-4-jon.lin@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210427073733.31419-1-jon.lin@rock-chips.com> References: <20210427073733.31419-1-jon.lin@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_003744_542000_8A847DB9 X-CRM114-Status: UNSURE ( 9.98 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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 0f39ea2d1d31..9fdb53fb7ede 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -929,6 +929,7 @@ static const struct of_device_id rockchip_spi_dt_match[] = { { .compatible = "rockchip,rk3368-spi", }, { .compatible = "rockchip,rk3399-spi", }, { .compatible = "rockchip,rv1108-spi", }, + { .compatible = "rockchip,rv1126-spi", }, { }, }; MODULE_DEVICE_TABLE(of, rockchip_spi_dt_match); From patchwork Tue Apr 27 07:37:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Lin X-Patchwork-Id: 12225517 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=-17.0 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 2FB5DC433ED for ; Tue, 27 Apr 2021 07:47:59 +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 72B6A61289 for ; Tue, 27 Apr 2021 07:47:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 72B6A61289 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-arm-kernel-bounces+linux-arm-kernel=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=05KuacpcPr2z2MQuFpvr+GsXJbcqnAcfsO8xk68yhwY=; b=pmDn5r2aClxN/teQM2oBKBXdi4 PoH4DwCcXMMBC5MiXeTwZV6hrxdQgcTWAipcGyrkYn4Bn3zd/7mDfYR5ddjgvpTTfZSrPUhLTaUGw CRgB3P6aadrRn03j2+0hcj5npw3rKB6WjKKb7vF8edbS3snHFj5664ZwAirCh2WTgsnPzoOk09ez6 WcPn6sX2QWA/yRvi5Bn3QR2rOcarPy6e0kATh4mVf48AmhdC3WoDxehty8vDcTc33jTTQE/8qbVgw I4FSfNQcJNq1sHyjfSqueZ3Ps9vsvoKqkA/RSHnSjlH9xMSbzST1mjD0LdtBcm4++GKB+x7PtTZnn 8umj9/aA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbIPf-0010Nq-J0; Tue, 27 Apr 2021 07:45: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 1lbII4-000z9w-FH; Tue, 27 Apr 2021 07:37:52 +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=20lD7W4EdrOj0snUhhFsCiVmE52lzTWnxMh22zEprhQ=; b=fB+yiQoiIikQLOyxXlZv2XZ2s7 dw5Md1oPz8KqomnF27vs6MPSA2UiRORtiIH1AIQ8mQ69YkdS023kXs+5iOj0nVLtEHdGI7RIdBoQi 1z+z9QSof3kisg5Y9Nc2DVr5KwcJFsFwEV3oJOm31FVUnxCJBeBebGiGUNT/hsPj/T0ju3yY0dD8M BXaGOxTh/YfKamytGtYC6pr+3Ta7xAUVTqmmu4caH8YCkeNp3fXtJXfkeggw7lYufyS9IfSulx8RZ hk9lTLqoJasKtMCR0G6zD5ahiRnFM31WXRDmuFEnJ9PV5GMu69qOFiYsnVc8LnHFwwXbJdDieCB7s /thnkxHw==; Received: from lucky1.263xmail.com ([211.157.147.132]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbIHw-00GVm1-Il; Tue, 27 Apr 2021 07:37:47 +0000 Received: from localhost (unknown [192.168.167.235]) by lucky1.263xmail.com (Postfix) with ESMTP id 1B4A9F3B3B; Tue, 27 Apr 2021 15:37:40 +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 P2750T140648996910848S1619509055243892_; Tue, 27 Apr 2021 15:37:39 +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 v2 5/8] spi: rockchip: Support cs-gpio Date: Tue, 27 Apr 2021 15:37:30 +0800 Message-Id: <20210427073733.31419-5-jon.lin@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210427073733.31419-1-jon.lin@rock-chips.com> References: <20210427073733.31419-1-jon.lin@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_003744_941150_3AC7CE3C X-CRM114-Status: GOOD ( 18.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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 9fdb53fb7ede..3b05c1ed6308 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -157,7 +158,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 @@ -191,6 +193,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) @@ -245,11 +248,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); @@ -632,6 +639,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; @@ -706,6 +754,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)) { @@ -759,6 +808,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 Tue Apr 27 07:38:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Lin X-Patchwork-Id: 12225523 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=-17.0 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 74A08C433B4 for ; Tue, 27 Apr 2021 07:52:59 +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 2B95961154 for ; Tue, 27 Apr 2021 07:52:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2B95961154 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-arm-kernel-bounces+linux-arm-kernel=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=Y9AhhAZOioCk2ZlJ5oYOxns5sxBGEE9UegGw4iaxQ+I=; b=Olgw5Mpu7gF9yQ6kVc6wvzdBoF 3pey4+ZHOey5mg3zjJzQg3gPtpxRw7L66RMDcnx2mcTREwgIF1n56LRPI5rML+VSIa3/uWcBCW7y2 3IsIzrzIAwnaz/DzkKJP55Uw0eql2Qd8CzD1d4ANLoSHotcZL97GZCmxCJJVNSYQk6Mwk4+8vEVXd femtj7WErto/GX6bZ3GKRzNvf3RVIL4kOLHbWteXu3fOFcdIBJVHOjSnRun+1paZX3UfeCL8tkKK3 txVeFMYymRfJxYt2lTcyQAC92tOUxsPKoZxFfVZXezMr2xa/nw64hvctkZuHaupfI/CN9m8AigKfG 6DkihzNw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbIUY-0011Sk-Ck; Tue, 27 Apr 2021 07:50:46 +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 1lbIIi-000zF6-BF; Tue, 27 Apr 2021 07:38:32 +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=szbcOCTsz7RiOvCrHyIX/uIuoq WG0GzFd1ULtV8fd9RcPXGDBRkcTWkXFYCChphtIXTkgzinmRN8MPIdS8Ft2nynDbj9me1SlKN9//H 5eU1kJCkLrU6nLjTJRxlbZJ39dZhxhOcFYmEhlXzpHCxFwDKjGhbQjJzv50X330xzGc5GVkJBP+rM 8YJJNmdM7cFvu7PK9SMHP6RlFINd0ITGIjz36jq3G733e/KgD+Ib2Rlqtp3HQcEcojQJweD2pn0GF LP8cNFNr84byZhfzWBjtFsEEOJkWIwyIrVZme697A9Z2H0XA20/BrSei1rslMxdRxhBchyeUbf2yx abXFvFbw==; Received: from lucky1.263xmail.com ([211.157.147.131]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbIIb-00GVrT-HB; Tue, 27 Apr 2021 07:38:30 +0000 Received: from localhost (unknown [192.168.167.70]) by lucky1.263xmail.com (Postfix) with ESMTP id E8FEEBA258; Tue, 27 Apr 2021 15:38:23 +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 P26232T140422993086208S1619509101181570_; Tue, 27 Apr 2021 15:38:22 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <9332ac1d107f7786e88a539998781cd2> 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 v2 6/8] dt-bindings: spi: spi-rockchip: add description for rk3568 Date: Tue, 27 Apr 2021 15:38:18 +0800 Message-Id: <20210427073820.31797-1-jon.lin@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210427073733.31419-1-jon.lin@rock-chips.com> References: <20210427073733.31419-1-jon.lin@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_003825_747115_C3DE796C X-CRM114-Status: UNSURE ( 8.76 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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 Tue Apr 27 07:38:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Lin X-Patchwork-Id: 12225521 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=-17.0 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 10F00C433B4 for ; Tue, 27 Apr 2021 07:51:35 +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 5B90961152 for ; Tue, 27 Apr 2021 07:51:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5B90961152 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-arm-kernel-bounces+linux-arm-kernel=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=Sl0ASM1MXecgzoW9xtdQWNUj7F0rWm+kM69FpETLtzo=; b=UM1mcH/a1wXzYrRJFg15RELCU6 FuhN+y+OBZl2UZ0VyPp08RbX8Tja5D5sABNel9sBWwkmBkCl1K8RXa3xK/PdpXhBssEwjppvsSEJ7 tReGpzUSvqd3+Km3T/cm2o/+3s0UqaK4ipPpomtldxI1XKu92Ep11Tm+NdsknlOV2ncijrjSZHPHg Wvds+Fz+7OlCPNm1HBk0Ul/KMyXa2UihwO53GSj+L12QLrRWIEFEec13v9oUzM8cQFkhiHwAzYX+l +bDjIzzI26kQCDA4GQ4grA1FwPlOWOMrZXtwj27WvhobaSe2bZetlgAjFAm+glCatjDx+FFjTpCda oidmx3cA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbITJ-0011D2-A3; Tue, 27 Apr 2021 07:49:31 +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 1lbIIi-000zF7-PM; Tue, 27 Apr 2021 07:38:33 +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=+YNHLaJ0yQBRYiSLht5Gc0G6I5E0wcQ0EWBdOCHFkWY=; b=wDFIcLx0l3SxLwoeQe6rr4Ma6U 1+lwckoyVGS/ngnYycEjMhU3dttJl+VBWEJ8ScBKKw/hvUNYfbYzghUaIRv4FsNmYN/WiDHPsGq4p athAHnoqCtwTfSNx5MUpcybMeYWVvYBeinT7jgpUg1di2HBEh8cChI399vIKmntzoRwSKrjFwF/sH 2WDvDNPOCUjehIEi6v4OgDmyBIFNq/HzVGEYBwL9TdZ5L2XT5CdlZomXGg6YWAp/FGK+sNLc0dao5 y/8ZBhNOn1M9NCd/FNA9oiDGaVXmEixRcs/8QbQ0Er8TZ+pnuUAXGTaFNeOJgsNrWHFJAZtLdgLP6 5BMdrebw==; Received: from lucky1.263xmail.com ([211.157.147.134]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbIId-00GVrS-By; Tue, 27 Apr 2021 07:38:30 +0000 Received: from localhost (unknown [192.168.167.70]) by lucky1.263xmail.com (Postfix) with ESMTP id 3BA1DC7F48; Tue, 27 Apr 2021 15:38:23 +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 P26232T140422993086208S1619509101181570_; Tue, 27 Apr 2021 15:38:23 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <1879818975a4bae328804936da9a64ba> 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 v2 7/8] spi: rockchip: Add compatible string for rk3568 Date: Tue, 27 Apr 2021 15:38:19 +0800 Message-Id: <20210427073820.31797-2-jon.lin@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210427073820.31797-1-jon.lin@rock-chips.com> References: <20210427073733.31419-1-jon.lin@rock-chips.com> <20210427073820.31797-1-jon.lin@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_003827_588373_50B94F9B X-CRM114-Status: GOOD ( 10.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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 3b05c1ed6308..2b68691157d0 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -979,6 +979,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", }, { .compatible = "rockchip,rv1108-spi", }, { .compatible = "rockchip,rv1126-spi", }, { }, From patchwork Tue Apr 27 07:38:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Lin X-Patchwork-Id: 12225519 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=-17.0 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 6859FC433B4 for ; Tue, 27 Apr 2021 07:50:30 +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 E83446100C for ; Tue, 27 Apr 2021 07:50:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E83446100C 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-arm-kernel-bounces+linux-arm-kernel=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=CrahRGSyGvQFTDO1q3mxA1cwjmvZgb3IEUPJjNY7+MQ=; b=BL5w3hHtUAd7jlZxU7nXBskvWG CBzvoLQdfxBslUMRpByP6MUoAwQ2vIBLKtbjJ4lnvC0iV0pbohm/nRVHUJDjvGkRnnxTuheJ3MX8S XaP7fdwEJfOuX1vpfq76a6yi7mGc3vSf/fDdlzlU1BzdtrwNlHyb0QAlHv09c9TR2JajPt3XUqP7W 3ah4ZmHGHrGbTYEhnfDCEDL/HY13HDMq5YuCnBiSc/4kojWGZXwblldgC8IN08DApnhGyaH16O8l7 KfBcU22SLLhAbolCtYANjdhdAVyZEHqbKU/hwYEC4fxqTCODO+lqxJ+p/SO38xBkbcalmlq1DUHAC jAQEKcWQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbISA-0010xZ-Mm; Tue, 27 Apr 2021 07:48:19 +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 1lbIIi-000zF8-Qk; Tue, 27 Apr 2021 07:38:33 +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=LJ7pV2oczQ6PJcXoTYNW6Gyl+H5pd9L5AP2DwD7TssE=; b=RT+QNVn/9xUYbNOFfrPdjVnORQ ynxI3QBmD/BAlrhFyIn/PQMd5atIbvIT3p+2yf905sHKFjNtbglHQHBL/v2dI9Sk/orTHb4EZWr2e 1Hw6mrfwb8GwyNq+Y2n8/t1L7HcUkzFSbrRaIiI7zFEuoL/jwEdTnn2apjuE28Sc1BVgaX6/Fckyt BxFHb/8fiemsGe57YGtlFiXJWdcP28IkdS5xOeUf26xvLz9Xw9/hRxMECmSE50yqpqvvd3ven/+0o T8HE0kxeXFOf82Xl9ojNHLVPhGH2GbKaU8oxvWbMaGqTkJZ4w+sGy8usAMEWVJEBwe31NR+QwlLSc 4CqxXOIg==; Received: from lucky1.263xmail.com ([211.157.147.134]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbIId-00GVrU-By; Tue, 27 Apr 2021 07:38:30 +0000 Received: from localhost (unknown [192.168.167.70]) by lucky1.263xmail.com (Postfix) with ESMTP id C60AAC81E1; Tue, 27 Apr 2021 15:38:23 +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 P26232T140422993086208S1619509101181570_; Tue, 27 Apr 2021 15:38:23 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <5a7cc61b9ed6016aa573b9a5f15c5883> 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 v2 8/8] spi: rockchip: Support SPI_CS_HIGH Date: Tue, 27 Apr 2021 15:38:20 +0800 Message-Id: <20210427073820.31797-3-jon.lin@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210427073820.31797-1-jon.lin@rock-chips.com> References: <20210427073733.31419-1-jon.lin@rock-chips.com> <20210427073820.31797-1-jon.lin@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_003827_595814_3F133F3F X-CRM114-Status: GOOD ( 12.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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 2b68691157d0..9d60c1b275e8 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;