From patchwork Fri Feb 28 15:18:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 183965 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp848327ile; Fri, 28 Feb 2020 07:23:44 -0800 (PST) X-Google-Smtp-Source: APXvYqw/15yARcZQuCvFsUsI7TJQv6LW+zbmSiSXSLW6mNpTH5zU088FCk9TmHFnlFF+2lMdIUpz X-Received: by 2002:a25:9704:: with SMTP id d4mr4209049ybo.137.1582903424145; Fri, 28 Feb 2020 07:23:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582903424; cv=none; d=google.com; s=arc-20160816; b=SdScnNG9j+aGUc45ArW2cghqdOLcD2GbqQFloNIb2MsiV9i1s7uiO/Gjcgw36P5tth Xnfh9qyeIxN0RZjg9im3ynCZtC0v9eVfbOtf7ygzQYZht5j3GdzprxPaWJezvTPBt7Kf 44hQ2rZchR7zdFs+KBi6kq0hOHRsS0NabRYsMJ8qWq8Gg9LqJY0C9wPYWbVP0yEuTzrC DBzicJm1scWkVDSU5Ih4GWDIOxWbSOQx6FS1H4tArbRU4K1Avz+fcuU+d2hpo5LCx474 JnDxWFJ/2b1maxd2IGGFuOE+gjP+JPEu2hFEjRXy6eV9+WZfMcA0TndtjipqbQFC+AyA u7bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature; bh=f/Oja4+7sSNhzSOA2F9Is/MOWhG+mEt6HEI1xQWtgM4=; b=bPCFXhcNRZCa2r7IHpOncUlqu+U7m6R4kmKO2GZlZQyBE+L1PYSRBIkqDWucYwcmHe 30QXvAta+4tsrSdF71Db3O4RPKcRLkM2Az2mMnMc44mJOHOCYQW96K+ap4RyQcEi0v+F DPORgQBdvsFLW7kOfmmCawT5RYRXzdsDQK8/w8pv0saSLP4q51yqPsIzj2D5c5iVlYwP siJWvd7IeWla2m0MwHKW3pCM9OnLJrNjjxs518W2E4lMvjxSnfCRjISb7K/OVBqu0ugm 5zgVyqxr71nBj9O53k37GlvLpncs31M66ZUe/doRTwafuCNWzSWrnRT9Jwr39jVGTlVP j4Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b="N/4G3BIY"; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id l11si1581635ywh.240.2020.02.28.07.23.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 07:23:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b="N/4G3BIY"; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.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=f/Oja4+7sSNhzSOA2F9Is/MOWhG+mEt6HEI1xQWtgM4=; b=N/4G3BIYQ4b+DQ qUhw+3LYVbJaAb65JWbk6YHnLD5IyPGEGXPFtgrH7WJQ7GIzmH6icOL5Ps2yptE//+jbMTomoUxeV 7aax4Hr+Lwh0soGPS/kPmXCrscpffYRTeJYH8RZymYT/CFVPIyXhFSgW+oJ4VJ8s+xZIu4p0rngTc 574FEzzUYFBQnjdXZ00zbTmHC9UKUQquFoBDtePkWNPc9Jk/HH8nPebIaLB/qodCljp9XfLQLeB6a 4qDniQ4tMWFAFV6rf21XbeNZYRY5U2VhN7qlRkkbJnbMQ36+FD0ewtDt3cjLp+E9IUVNk9OGzdJ1Z S3odQx5935Q9WtoHoXQw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7hUE-0005Cx-R9; Fri, 28 Feb 2020 15:23:34 +0000 Received: from szxga06-in.huawei.com ([45.249.212.32] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7hTl-0004m8-05 for linux-mtd@lists.infradead.org; Fri, 28 Feb 2020 15:23:07 +0000 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id E895CBCDD998B0D1E4CE; Fri, 28 Feb 2020 23:22:53 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.439.0; Fri, 28 Feb 2020 23:22:44 +0800 From: John Garry To: Subject: [PATCH RFC 1/3] spi: Allow SPI controller override device buswidth Date: Fri, 28 Feb 2020 23:18:49 +0800 Message-ID: <1582903131-160033-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1582903131-160033-1-git-send-email-john.garry@huawei.com> References: <1582903131-160033-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200228_072305_635036_FAA8C653 X-CRM114-Status: GOOD ( 13.22 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [45.249.212.32 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Garry , linux-spi@vger.kernel.org, linuxarm@huawei.com, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, andriy.shevchenko@linux.intel.com Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org Currently ACPI firmware description for a SPI device does not have any method to describe the data buswidth on the board. So even through the controller and device may support higher modes than standard SPI, it cannot be assumed that the board does - as such, that device is limited to standard SPI in such a circumstance. As a workaround, allow the controller driver supply buswidth override bits, which are used inform the core code that the controller driver knows the buswidth supported on that board for that device. A host controller driver might know this info from DMI tables, for example. Signed-off-by: John Garry --- drivers/spi/spi.c | 4 +++- include/linux/spi/spi.h | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 38b4c78df506..292f26807b41 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -510,6 +510,7 @@ struct spi_device *spi_alloc_device(struct spi_controller *ctlr) spi->dev.bus = &spi_bus_type; spi->dev.release = spidev_release; spi->cs_gpio = -ENOENT; + spi->mode = ctlr->buswidth_override_bits; spin_lock_init(&spi->statistics.lock); @@ -2181,9 +2182,10 @@ static acpi_status acpi_register_spi_device(struct spi_controller *ctlr, return AE_NO_MEMORY; } + ACPI_COMPANION_SET(&spi->dev, adev); spi->max_speed_hz = lookup.max_speed_hz; - spi->mode = lookup.mode; + spi->mode |= lookup.mode; spi->irq = lookup.irq; spi->bits_per_word = lookup.bits_per_word; spi->chip_select = lookup.chip_select; diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 6d16ba01ff5a..600e3793303e 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -481,6 +481,9 @@ struct spi_controller { /* spi_device.mode flags understood by this controller driver */ u32 mode_bits; + /* spi_device.mode flags override flags for this controller */ + u32 buswidth_override_bits; + /* bitmask of supported bits_per_word for transfers */ u32 bits_per_word_mask; #define SPI_BPW_MASK(bits) BIT((bits) - 1) From patchwork Fri Feb 28 15:18:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 183964 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp847989ile; Fri, 28 Feb 2020 07:23:26 -0800 (PST) X-Google-Smtp-Source: APXvYqxlqbH+dkasaeY8Cpt0CbsSpRy0i4WV8uKnK39qRGCA24jzeey68JFAqCNRh10hadaHUOVd X-Received: by 2002:a81:5441:: with SMTP id i62mr4610926ywb.8.1582903406307; Fri, 28 Feb 2020 07:23:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582903406; cv=none; d=google.com; s=arc-20160816; b=KByRiNcHw+USGOlwhCyEM3UXuH7lGQxSSMJ6cjqINJL8r7OmHDJQ9awtd54pkSnbLP aba187GNUq2CrkDzJtyNbKYeKXRd+yXjQagpWo6PwFnnA38bQzBvbrIhM7jTc5JyKbmS aW1wiN5Dz5eg7nCWQwXoQoJPvSnisHWT/L9faLnAXsw3mCsLCCOTOPiBRyv3LJKo0k/q u2MCjvot1DuB+Zg81bBIHn68QuotdZo9B/Tgn+RWkWHuBkx5HvmYa4Oy3psBU28M66Am tfD+xLYTdH1Rh5n3Gd8NBNNGQLYNZ3A4f2HO2VhCPeJqqjjD6GYWuIQTmTi81/kR7VyG Czeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature; bh=R+Q1dnZGK3GENvYPRLCUchHeZeDyAn7PJdsYxJ1rzAI=; b=azaSvb9khAoRDbZ46BWv5QDwuesPY0ZAPX58fjM1XDnIP4x9Y/DfF/pnPzmxqHxkeV HQPE+xVuxAiImrKHcdt0+7W/tROyy5utqiNtcyxK8Or0mxAAGD3xxNKldjqgOP7H9Pxx ssAwP5ZonnA/Z4ZnOvlTx3m+mm/7tnaKr3thu7jXRt2nNNQTTg+/X1/pGtnNyj8BfyPW 3UiV0nRRLHoxV0Xm+QqnXnOfFqQIUF7ULWTHKJ4SCgBxtvwskdUBiTHMhGtv0Q2Fk9OE yyyk9AX5RGUUliykGKqOkm6qp9TXYPkodF9dZQN70c3cb2TWjm6C5UzZG9nw2fdWei4I kaSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=YCta2nXi; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id t19si528059ywg.224.2020.02.28.07.23.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 07:23:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=YCta2nXi; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.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=R+Q1dnZGK3GENvYPRLCUchHeZeDyAn7PJdsYxJ1rzAI=; b=YCta2nXiVNpMfH ZT6JZO1Fm0BPJ2mdpszr+gzPMtCoSzF+nPYjl1NyKgvh0xTEjLnhUg++r92/nok2A+LOzPxta2xmb vx4YeRVHjoPEuqS1FEnzaLezThZhU/GvSH8pUNdkMD3FONTVif8FRgYmlRp5shJE4VCshVnLYO/mk 7kuGWsAcjfMQRFjnxe5eitgYuL876ph3c6itaPrKmVRi/BPwn4jIrG7sKdg6eNXJpooeRpH3gFIwr kOkZLazlyiDm4LC59SIzHyN7wMuxBfudkmrYB7RKlYm9dinnWxgVIQ3XlxaY+36KZAW9TziLcUxwc CgpCFBR/2BvMwfOUguQQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7hTx-0004wC-0q; Fri, 28 Feb 2020 15:23:17 +0000 Received: from szxga06-in.huawei.com ([45.249.212.32] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7hTk-0004m9-Rz for linux-mtd@lists.infradead.org; Fri, 28 Feb 2020 15:23:06 +0000 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id DE65CFFEE367F48376C9; Fri, 28 Feb 2020 23:22:53 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.439.0; Fri, 28 Feb 2020 23:22:44 +0800 From: John Garry To: Subject: [PATCH RFC 2/3] spi: HiSilicon v3xx: Properly set CMD_CONFIG for Dual/Quad modes Date: Fri, 28 Feb 2020 23:18:50 +0800 Message-ID: <1582903131-160033-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1582903131-160033-1-git-send-email-john.garry@huawei.com> References: <1582903131-160033-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200228_072305_074474_2FE94822 X-CRM114-Status: UNSURE ( 9.16 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [45.249.212.32 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Garry , linux-spi@vger.kernel.org, linuxarm@huawei.com, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, andriy.shevchenko@linux.intel.com Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org The CMD_CONFIG register memory interface type field is not set configured for Dual and Quad modes, so set appropriately. This was not detected previously as we only ever operated in standard SPI mode. Signed-off-by: John Garry --- drivers/spi/spi-hisi-sfc-v3xx.c | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/spi/spi-hisi-sfc-v3xx.c b/drivers/spi/spi-hisi-sfc-v3xx.c index 4cf8fc80a7b7..45d906110ed1 100644 --- a/drivers/spi/spi-hisi-sfc-v3xx.c +++ b/drivers/spi/spi-hisi-sfc-v3xx.c @@ -17,6 +17,12 @@ #define HISI_SFC_V3XX_VERSION (0x1f8) #define HISI_SFC_V3XX_CMD_CFG (0x300) +#define HISI_SFC_V3XX_CMD_CFG_DUAL_IN_DUAL_OUT (1 << 17) +#define HISI_SFC_V3XX_CMD_CFG_DUAL_IO (2 << 17) +#define HISI_SFC_V3XX_CMD_CFG_FULL_DIO (3 << 17) +#define HISI_SFC_V3XX_CMD_CFG_QUAD_IN_QUAD_OUT (5 << 17) +#define HISI_SFC_V3XX_CMD_CFG_QUAD_IO (6 << 17) +#define HISI_SFC_V3XX_CMD_CFG_FULL_QIO (7 << 17) #define HISI_SFC_V3XX_CMD_CFG_DATA_CNT_OFF 9 #define HISI_SFC_V3XX_CMD_CFG_RW_MSK BIT(8) #define HISI_SFC_V3XX_CMD_CFG_DATA_EN_MSK BIT(7) @@ -161,6 +167,43 @@ static int hisi_sfc_v3xx_generic_exec_op(struct hisi_sfc_v3xx_host *host, if (op->addr.nbytes) config |= HISI_SFC_V3XX_CMD_CFG_ADDR_EN_MSK; + switch (op->data.buswidth) { + case 0 ... 1: + break; + case 2: + if (op->addr.buswidth <= 1) { + config |= HISI_SFC_V3XX_CMD_CFG_DUAL_IN_DUAL_OUT; + } else if (op->addr.buswidth == 2) { + if (op->cmd.buswidth <= 1) { + config |= HISI_SFC_V3XX_CMD_CFG_DUAL_IO; + } else if (op->cmd.buswidth == 2) { + config |= HISI_SFC_V3XX_CMD_CFG_FULL_DIO; + } else { + return -EIO; + } + } else { + return -EIO; + } + break; + case 4: + if (op->addr.buswidth <= 1) { + config |= HISI_SFC_V3XX_CMD_CFG_QUAD_IN_QUAD_OUT; + } else if (op->addr.buswidth == 4) { + if (op->cmd.buswidth <= 1) { + config |= HISI_SFC_V3XX_CMD_CFG_QUAD_IO; + } else if (op->cmd.buswidth == 4) { + config |= HISI_SFC_V3XX_CMD_CFG_FULL_QIO; + } else { + return -EIO; + } + } else { + return -EIO; + } + break; + default: + return -EOPNOTSUPP; + } + if (op->data.dir != SPI_MEM_NO_DATA) { config |= (len - 1) << HISI_SFC_V3XX_CMD_CFG_DATA_CNT_OFF; config |= HISI_SFC_V3XX_CMD_CFG_DATA_EN_MSK; From patchwork Fri Feb 28 15:18:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 183966 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp848997ile; Fri, 28 Feb 2020 07:24:21 -0800 (PST) X-Google-Smtp-Source: APXvYqyoBjdXte0QSns3EMth006+UixMZdKb6zF/ZmKnneULuWNIo1Cc9GxJoCjxMBTxejpYg+Lg X-Received: by 2002:a81:5b83:: with SMTP id p125mr4774078ywb.182.1582903461445; Fri, 28 Feb 2020 07:24:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582903461; cv=none; d=google.com; s=arc-20160816; b=wSCmpjEpm7VfxWyhmMus/KJ/s0Z+n1dIvrDy+cOKuzIyNo0XmuvRV1xtlja163mbRl 20p/FVI1kO6ItPM71mvHKE7JcfD9K0YKgRbHoBnS4aQSbztOaPMiXowddfSZdUibggqU IolZIAPrpKQfuyBzD8k7i2d558TX0ExZtlp9FbRhgqa0uffW1fTTX/HDhrg25vqhk+UT qdIKMPdwZWCNkAPu5KMXKhxFIzd+ccHtL5IParDepdcFfcMjhfGx/t5koZgL01MiW1Go L+bLvc+HRXu9C8xmziVBuTrmG9mGONOwUgtM96VyNUWZuaqJP2f6KH4pJxtZ61DxEIgB A4Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature; bh=3Q4zY60/+VIFUe7c7JRvjT+27ll8TUD9f1GYhokAqA8=; b=v8p/hmLrI6TOtrHn/n4lUSc7c+td7KKxl0bf4oz2OBQRqacP+b4JSlOIzjFpVxdi++ 7w/OcnplgyWfgPynv57nxsL7mh+c5byK6VqF1xIGmdZs9CzWpB1vU1/zuspWev9SOUAl p8N+5FyPezGFyh5zH0AvmayCmbKZXTrLu8lrO0dse0h8AVz7/N80F75rdpmD4GuPc5kZ 2PlqKZ6ljL4HJVk26yGy+KYFJUY4/bw1R/KFl/HfdZDeao1Aqqybnkiuffy35Kj0Ketu yXo3QqzWPE96KcOR6p+mFOnvDPaWwcCbV53M62/YF/Ia33kkmjta7LPi7IGrBFdf+hgL LKEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=Xibbztdo; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id w129si1483094ywa.330.2020.02.28.07.24.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 07:24:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=Xibbztdo; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.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=3Q4zY60/+VIFUe7c7JRvjT+27ll8TUD9f1GYhokAqA8=; b=XibbztdozYPc3f hCPBpSJy9oPogbgMlWqNAiCLqi0uWcCV6nmQi0z4r1ONdsRdoipbkEOfaQsIZd5gXO7V2GUK05bPB h/cB4o4JyBzDc6+tOohfgL0JefRBUId1LB3k+u7wJHQLhYvI6H81G7p08uok/PDlqvM4RBEzVlauF S3ri/9p3yceMgwo48+hjM8z1GlWVI52kYhbZPHJeceKUbEqSR4tCt5r5cmMmVEmQNlVIa36wqRhVy LBuL/eOQ1zxrnDOMnHhtmQjeO4aoKW573TtlKXUCa9eXhJ7aayb60HFkCwTacl+G1dYgEkQiXdkRH SbUZ7CzQKqTrSD3g+N+g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7hUr-0005lp-Af; Fri, 28 Feb 2020 15:24:13 +0000 Received: from szxga06-in.huawei.com ([45.249.212.32] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7hTy-0004mB-6m for linux-mtd@lists.infradead.org; Fri, 28 Feb 2020 15:23:19 +0000 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id E33A56AC8E6748186BEC; Fri, 28 Feb 2020 23:22:53 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.439.0; Fri, 28 Feb 2020 23:22:44 +0800 From: John Garry To: Subject: [PATCH RFC 3/3] spi: HiSilicon v3xx: Use DMI quirk to set controller buswidth override bits Date: Fri, 28 Feb 2020 23:18:51 +0800 Message-ID: <1582903131-160033-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1582903131-160033-1-git-send-email-john.garry@huawei.com> References: <1582903131-160033-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200228_072318_430350_08E9C11F X-CRM114-Status: GOOD ( 12.67 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [45.249.212.32 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Garry , linux-spi@vger.kernel.org, linuxarm@huawei.com, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, andriy.shevchenko@linux.intel.com Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org The Huawei D06 board (and variants) can support Quad mode of operation. Since we have no current method in ACPI SPI bus device resource description to describe this information, use DMI to detect the board, and set the controller buswidth override bits. Signed-off-by: John Garry --- drivers/spi/spi-hisi-sfc-v3xx.c | 56 ++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/spi/spi-hisi-sfc-v3xx.c b/drivers/spi/spi-hisi-sfc-v3xx.c index 45d906110ed1..e3b57252d075 100644 --- a/drivers/spi/spi-hisi-sfc-v3xx.c +++ b/drivers/spi/spi-hisi-sfc-v3xx.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -250,6 +251,44 @@ static const struct spi_controller_mem_ops hisi_sfc_v3xx_mem_ops = { .exec_op = hisi_sfc_v3xx_exec_op, }; +static int hisi_sfc_v3xx_buswidth_override_bits; + +/* + * ACPI FW does not allow us to currently set the device buswidth, so quirk it + * depending on the board. + */ +static int __init hisi_sfc_v3xx_dmi_quirk(const struct dmi_system_id *d) +{ + hisi_sfc_v3xx_buswidth_override_bits = SPI_RX_QUAD | SPI_TX_QUAD; + + return 0; +} + +static const struct dmi_system_id hisi_sfc_v3xx_dmi_quirk_table[] = { + { + .callback = hisi_sfc_v3xx_dmi_quirk, + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Huawei"), + DMI_MATCH(DMI_PRODUCT_NAME, "D06"), + }, + }, + { + .callback = hisi_sfc_v3xx_dmi_quirk, + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Huawei"), + DMI_MATCH(DMI_PRODUCT_NAME, "TaiShan 2280 V2"), + }, + }, + { + .callback = hisi_sfc_v3xx_dmi_quirk, + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Huawei"), + DMI_MATCH(DMI_PRODUCT_NAME, "TaiShan 200 (Model 2280)"), + }, + }, + {} +}; + static int hisi_sfc_v3xx_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -265,6 +304,8 @@ static int hisi_sfc_v3xx_probe(struct platform_device *pdev) ctlr->mode_bits = SPI_RX_DUAL | SPI_RX_QUAD | SPI_TX_DUAL | SPI_TX_QUAD; + ctlr->buswidth_override_bits = hisi_sfc_v3xx_buswidth_override_bits; + host = spi_controller_get_devdata(ctlr); host->dev = dev; @@ -320,7 +361,20 @@ static struct platform_driver hisi_sfc_v3xx_spi_driver = { .probe = hisi_sfc_v3xx_probe, }; -module_platform_driver(hisi_sfc_v3xx_spi_driver); +static int __init hisi_sfc_v3xx_spi_init(void) +{ + dmi_check_system(hisi_sfc_v3xx_dmi_quirk_table); + + return platform_driver_register(&hisi_sfc_v3xx_spi_driver); +} + +static void __exit hisi_sfc_v3xx_spi_exit(void) +{ + platform_driver_unregister(&hisi_sfc_v3xx_spi_driver); +} + +module_init(hisi_sfc_v3xx_spi_init); +module_exit(hisi_sfc_v3xx_spi_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("John Garry ");