Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp774851ybf; Fri, 28 Feb 2020 07:24:21 -0800 (PST) X-Google-Smtp-Source: APXvYqy3VlgY9WVWLpvNazUU786cCtxcpIp9uWntN8hqQnh07bOzB9NMGaEkvMlEoyjYEro4txOz X-Received: by 2002:aca:5fc6:: with SMTP id t189mr3721804oib.166.1582903461587; 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=SKqSwjZahyKGv0k8K6wkzVeLm6TOj/A7ggAKlsfnza9aMW5atORPooI4U+c0B11PVS 8jfwQxDB2gV8DpFOAV78S5EdgUPOKSMb1rSRqJcXT6ZxW2wQQarGWXMAwQrlizqCR4tl jK5TBsT1Ptij1SDsO8k+dkSrMl+/e0nNY0e/StEoQaXty4ewI6GlPP4ZZYxUq0171Ox+ rsWEFRVGqGxalBCKntwpppVP+Vl3NhLLX5lHLN2RESVvjPPV9MlXHw8KL4UANvNnv0kb JKcFARsQ1ATf+n2vxPg3I38hUuEtpttlCzAdhPlPR9ZAfL0Vh/olxEk96FreH4H3T071 6+pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=jpLdM1fn1hhzWvncLKmH7iYBc4soTsXLQf2RSyQOUK0=; b=WojN9Dlxb61Yfq+RSwupicTCb3Eq4xAV0jbjj1OYF+pDxS78hHIrIQ9eb/XSDPV7Ji Hg05sP9KG+KyOKy2HQUIR1bveI21WysWDEiR/J/mKAsIGKb+HwF4k2KL7bEIZEP2U5rJ 7qw/Eqa//5Wn52+WRtG+lUdz61yBqQq4ATVAA9NdL/hhu7zBq5raPtY8I+Bd80njI9hf MaXt/etyfM4PkGpHrLeoF5o2UqG2qKiuuLT88MTix68WRVp3F/dnyD/tvZ1CMTXk+nbM EX+sVY5rRcu6e1pMi+/4c0KU4iEebL+NpQ8cuOPNBKhRJWToshshR23lm1F6ygWSMicj dfDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15si2044214oic.269.2020.02.28.07.24.09; Fri, 28 Feb 2020 07:24:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727141AbgB1PXH (ORCPT + 99 others); Fri, 28 Feb 2020 10:23:07 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:40904 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726796AbgB1PXF (ORCPT ); Fri, 28 Feb 2020 10:23:05 -0500 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: CC: , , , , , John Garry 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 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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(-) 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 "); -- 2.17.1