From patchwork Thu Sep 10 04:11:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ikjoon Jang X-Patchwork-Id: 11766501 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8742D618 for ; Thu, 10 Sep 2020 04:14:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 58B2F21D46 for ; Thu, 10 Sep 2020 04:14:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sJIwS4c7"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="C0Has8Ps" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 58B2F21D46 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zA+aV8si7dBRiNrfVm7B4+0Rv5AAEVpdYL3+vs/6ke0=; b=sJIwS4c73yLLAjgvcRRsC+MLF 4DV2bhXUO1JYtujmhshhy3JCp7UY+L4TRjRGr/fsKZ9et6+RUrLvBAV3189ZfIvLobIBA1St/Wi7r mnZmkkKlsfNZ2OGadUPudJHKTt0wb7rPNY67ToSGtFMIGhKCYVZkU2P8gn1Nzs/KqaF4+Vg3WWOey EvFc20+WutYa6341mrOYqqcJWl2oVTB+Y3jON+yYiWScBdy3aP+jUweCP/gIpgfRxcVR4dMD4fr1A aIBPbIUAmJ3MW/fIyduiGNYwqIvwS3xhO8uEnrLaEt3t4dvyImdWPDtsTYRS/eiNNPLdFX1Z4GLHy eMsMJdzVA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGDyh-0001UO-62; Thu, 10 Sep 2020 04:14:31 +0000 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGDyd-0001Sl-Lk for linux-mediatek@lists.infradead.org; Thu, 10 Sep 2020 04:14:28 +0000 Received: by mail-pg1-x531.google.com with SMTP id 7so3518267pgm.11 for ; Wed, 09 Sep 2020 21:14:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v8c0TlCjltGNPv4rO1/Om9Bj2FreW//+32287ppV2e8=; b=C0Has8PshVIeDcAQTJrxM9ZzNdfDxXuEqG5zNv5qYtLXbKUFj9EBIzfY9dWxm4thpT DjWXa1ho0Ww850nBUNan6kcto2RrCWkI8NU7l+Wu7qwyqTX4KVv1RoCdnbw7lbVxN7gz peZDzv6PQsO07P9+X9UjV7dc6MsCI9MURi3XQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v8c0TlCjltGNPv4rO1/Om9Bj2FreW//+32287ppV2e8=; b=Q0i+vj0OjrTuQgQSv7qrqyb6F1lwh6i527AfClztxRDA/WkU7+p3ISgWfUJKg/gk95 JfKEyoLu9XWtN09fl0G3fkzX4C+EJz1sSEsx2eqzDvkVIYNneA2RjWZLkmOfjaiL6Kzp FxIzlne100CV8sfGX3M0vytjWNOzT3uydh+RNFkCoCJOEX7k/k7kg8PuZ7X3ww/KuvpN a7v5i/WcvIJTdDJzavQlu+xNpqkNK7TQy/pu3WtN/sqmVhKKd2YtUSYlGisLMXHBpCqf Ebl/P0ffKhcCmKJawHh+GYzfLvJsCTVOqjwMKuIjsn4JfJLv5ZiRmtnHH7uEXRRVBLYa ZdPw== X-Gm-Message-State: AOAM5323dWGrsh/OALoEuvIcjMvtqOQXwmlDNVdTnC5KT9Ri3VF95Plo gR/1Msvwb2DzlBMA+fCFv5g9yA== X-Google-Smtp-Source: ABdhPJyEfGAaDdXT0yj3+AgZpsKtXjp78eyXQV6Ft8bAtu4SuDhI8K5uZicrEwMQlYm4yqJi/J4MPw== X-Received: by 2002:a62:7c82:0:b029:13c:1611:6525 with SMTP id x124-20020a627c820000b029013c16116525mr3778979pfc.5.1599711264257; Wed, 09 Sep 2020 21:14:24 -0700 (PDT) Received: from ikjn-p920.tpe.corp.google.com ([2401:fa00:1:10:f693:9fff:fef4:a8fc]) by smtp.gmail.com with ESMTPSA id z11sm4266169pfc.181.2020.09.09.21.14.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2020 21:14:23 -0700 (PDT) From: Ikjoon Jang To: Rob Herring , Mark Brown , devicetree@vger.kernel.org, linux-spi@vger.kernel.org Subject: [PATCH 1/2] dt-bindings: spi: add mt8192-nor compatible string Date: Thu, 10 Sep 2020 12:11:00 +0800 Message-Id: <20200910041101.1695195-2-ikjn@chromium.org> X-Mailer: git-send-email 2.28.0.526.ge36021eeef-goog In-Reply-To: <20200910041101.1695195-1-ikjn@chromium.org> References: <20200910041101.1695195-1-ikjn@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200910_001427_758612_4BE9C35C X-CRM114-Status: GOOD ( 10.75 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:531 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, Bayi Cheng , linux-mediatek@lists.infradead.org, Matthias Brugger , Chuanhong Guo , Ikjoon Jang , linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org Add MT8192 spi-nor controller binding. Signed-off-by: Ikjoon Jang --- Documentation/devicetree/bindings/spi/mediatek,spi-mtk-nor.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-nor.yaml b/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-nor.yaml index 42c9205ac991..55c239446a5b 100644 --- a/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-nor.yaml +++ b/Documentation/devicetree/bindings/spi/mediatek,spi-mtk-nor.yaml @@ -30,6 +30,7 @@ properties: - mediatek,mt7622-nor - mediatek,mt7623-nor - mediatek,mt7629-nor + - mediatek,mt8192-nor - enum: - mediatek,mt8173-nor - items: From patchwork Thu Sep 10 04:11:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ikjoon Jang X-Patchwork-Id: 11766503 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 12FEF139F for ; Thu, 10 Sep 2020 04:14:42 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 B065621D46 for ; Thu, 10 Sep 2020 04:14:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="B6N0v17L"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="dTCggUrL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B065621D46 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sBphlUBEgFnuJQjkZZlj7fZsXllv0MqifjWr2NCU+/U=; b=B6N0v17LgeEeyoIXXTSPvqWCv GzJv03oPtDcbtOohpG4AwNL7epjKqY/QtJ7c6ok7ziVcuAANDv62MnaxPwdjWBGHOhhlPA72LOMza u0aZ7WFHC9y0bG3Vo8opS8COoY5yNNb+m+3eQG1taoqYwIOT22xIf5ub754hA7N2UZW2LlYomLbDh yn8CGcdrDsXmqWvRa+zGaXEyaZy67kFkxFPKhP3mSrd8GxiHCR/od+3naDFfFe2vsXdqgXm/8Kf8Y m7ZDoHw6OxfRGZB51wt/eCial2twRWwP60ziB7sfTY37BWkzS95dolQ5X8kNNicAUIgRcK11nSVrQ jQBkK3zag==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGDyp-0001W9-EF; Thu, 10 Sep 2020 04:14:39 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGDyf-0001TP-OE for linux-mediatek@lists.infradead.org; Thu, 10 Sep 2020 04:14:30 +0000 Received: by mail-pl1-x641.google.com with SMTP id bd2so273686plb.7 for ; Wed, 09 Sep 2020 21:14:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KWwm8mWE4d4wVcJJo9tytWYejv+Pxcnm9glHhgWnu5Q=; b=dTCggUrLZ8gGuJz0l6b75Knxn3+MUxo3lYXr/4UHEEgOKTtC1kTS0ojPh6SX8sQU8p BCYj2cqqON+K/W0M5bfhEKpPbtQxeGg35NlNVjC7cyMRlsDjHlao3a0vcIe18yGVY1pc 4t0mrw36EPOR+39cKMN1JRaE/tiBhcjr6qetI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KWwm8mWE4d4wVcJJo9tytWYejv+Pxcnm9glHhgWnu5Q=; b=mbFgcw1ICUsxEWbFsX5dZ815AZ4dNpH8PBvtydbftSRNqVzyxUlGzkn8XN4pwS8i+g 577BTHtXoG91qXxWjFKyEJgXA49AAFo5hZTJh9nvrQ1pUBw6cVuD+CXL44+3vdVj3yO7 ghPD5SeIZlQi5ip2qyXKSWyUW8SSjOlFnfsDpuyZSB2DEyOHlVaFBf95pP2NKN+C8tdz mbV5YmcvPKr9R7n2hv8epYmIw5GpwZGZ5lplZD6Qpp13rM1AfXI8vhQK+5KBSf5eRG2K rs1sXADH8I854xkJs+2VqUT4sis76Re/pTSAePaWyYda4Z54+nJSKcpR/pa+gMEPt+QA UAUQ== X-Gm-Message-State: AOAM5330KWbOhXMfAK/ENnRda//CgFfhoVmgmJgSdrpipoMYi2gG+IER Fhzp/voTHJAaJF0jZC47Xrf4TA== X-Google-Smtp-Source: ABdhPJzYfBcwkmIQmoRUkge3+F2vQd+PMsW9pyK+LSIVKTewrgGDMUCeeNY1yViHgy9zIU7mIyiTog== X-Received: by 2002:a17:902:b409:b029:d0:cbe1:e741 with SMTP id x9-20020a170902b409b02900d0cbe1e741mr4019631plr.28.1599711267272; Wed, 09 Sep 2020 21:14:27 -0700 (PDT) Received: from ikjn-p920.tpe.corp.google.com ([2401:fa00:1:10:f693:9fff:fef4:a8fc]) by smtp.gmail.com with ESMTPSA id z11sm4266169pfc.181.2020.09.09.21.14.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2020 21:14:26 -0700 (PDT) From: Ikjoon Jang To: Rob Herring , Mark Brown , devicetree@vger.kernel.org, linux-spi@vger.kernel.org Subject: [PATCH 2/2] spi: spi-mtk-nor: support 36bit dma addressing to mediatek spi-nor Date: Thu, 10 Sep 2020 12:11:01 +0800 Message-Id: <20200910041101.1695195-3-ikjn@chromium.org> X-Mailer: git-send-email 2.28.0.526.ge36021eeef-goog In-Reply-To: <20200910041101.1695195-1-ikjn@chromium.org> References: <20200910041101.1695195-1-ikjn@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200910_001429_826518_927EAAC7 X-CRM114-Status: GOOD ( 17.96 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:641 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthias Brugger , linux-mediatek@lists.infradead.org, Ikjoon Jang , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org This patch enables direct mappings over 32bit range to spi-mtk-nor. Signed-off-by: Ikjoon Jang Reported-by: kernel test robot Reported-by: kernel test robot --- drivers/spi/spi-mtk-nor.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-mtk-nor.c b/drivers/spi/spi-mtk-nor.c index 6e6ca2b8e6c8..eb93ae34e670 100644 --- a/drivers/spi/spi-mtk-nor.c +++ b/drivers/spi/spi-mtk-nor.c @@ -78,6 +78,8 @@ #define MTK_NOR_REG_DMA_FADR 0x71c #define MTK_NOR_REG_DMA_DADR 0x720 #define MTK_NOR_REG_DMA_END_DADR 0x724 +#define MTK_NOR_REG_DMA_DADR_HB 0x738 +#define MTK_NOR_REG_DMA_END_DADR_HB 0x73c #define MTK_NOR_PRG_MAX_SIZE 6 // Reading DMA src/dst addresses have to be 16-byte aligned @@ -101,6 +103,7 @@ struct mtk_nor { unsigned int spi_freq; bool wbuf_en; bool has_irq; + bool high_dma; struct completion op_done; }; @@ -279,6 +282,11 @@ static int mtk_nor_read_dma(struct mtk_nor *sp, u32 from, unsigned int length, writel(dma_addr, sp->base + MTK_NOR_REG_DMA_DADR); writel(dma_addr + length, sp->base + MTK_NOR_REG_DMA_END_DADR); + if (sp->high_dma) { + writel(dma_addr >> 32, sp->base + MTK_NOR_REG_DMA_DADR_HB); + writel((dma_addr + length) >> 32, sp->base + MTK_NOR_REG_DMA_END_DADR_HB); + } + if (sp->has_irq) { reinit_completion(&sp->op_done); mtk_nor_rmw(sp, MTK_NOR_REG_IRQ_EN, MTK_NOR_IRQ_DMA, 0); @@ -578,7 +586,8 @@ static const struct spi_controller_mem_ops mtk_nor_mem_ops = { }; static const struct of_device_id mtk_nor_match[] = { - { .compatible = "mediatek,mt8173-nor" }, + { .compatible = "mediatek,mt8192-nor", .data = (void *)36 }, + { .compatible = "mediatek,mt8173-nor", .data = (void *)32 }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, mtk_nor_match); @@ -591,6 +600,7 @@ static int mtk_nor_probe(struct platform_device *pdev) u8 *buffer; struct clk *spi_clk, *ctlr_clk; int ret, irq; + unsigned long dma_bits; base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(base)) @@ -614,6 +624,12 @@ static int mtk_nor_probe(struct platform_device *pdev) buffer = (u8 *)(((ulong)buffer + MTK_NOR_DMA_ALIGN) & ~MTK_NOR_DMA_ALIGN_MASK); + dma_bits = (unsigned long)of_device_get_match_data(&pdev->dev); + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(dma_bits))) { + dev_err(&pdev->dev, "failed to set dma mask(%lu)\n", dma_bits); + return -EINVAL; + } + ctlr = spi_alloc_master(&pdev->dev, sizeof(*sp)); if (!ctlr) { dev_err(&pdev->dev, "failed to allocate spi controller\n"); @@ -640,6 +656,7 @@ static int mtk_nor_probe(struct platform_device *pdev) sp->dev = &pdev->dev; sp->spi_clk = spi_clk; sp->ctlr_clk = ctlr_clk; + sp->high_dma = (dma_bits > 32); irq = platform_get_irq_optional(pdev, 0); if (irq < 0) {