Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp935294ybf; Fri, 28 Feb 2020 10:27:03 -0800 (PST) X-Google-Smtp-Source: APXvYqwSVbO6FvrhzdwVw2i8/uxztf3lHgNkj8WsubxQOkNs1Sy2LbOXIRe4Xn0689Px1NZ3le/3 X-Received: by 2002:a9d:4c06:: with SMTP id l6mr4465426otf.161.1582914423613; Fri, 28 Feb 2020 10:27:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582914423; cv=none; d=google.com; s=arc-20160816; b=zWlfX/CbxVFqng0FqOdNnb6JoTRfgZKoaS4FQhJDAp3Hi1AWScySklP+bVcN+aC6os tUX8d1iWIBNG3TQJHU77HHmuVFYVMeU4r9UTpSaO7GOXetwn6G/HIH34ogJNiwfBmifw bBPvffhlsmGfn94oYzpvj2ERmLviAfi/c17sqIsxPBi+XaKNu4vik1Rd5C7wqGFF8nu4 SDU/fjiMyVw2w+LbzDUorv4Ch/I9Tz+94PqRxlTUkeSYpE9jXW2bkEh+OG1elg6WR+pw go3e0rTM8+Sc3fZi/mQyq3cLUe9J7pRGG6XSOkaao0wiQt3m2CPrluoyCTJq9F6GLZzb Sb8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:in-reply-to:subject:cc:to:from :date; bh=5BgDqRrFIVky2NiTeuAPGoZ0urSEuUsO6ivIeg/T3gE=; b=oarlzioDn+iE8ukPqdgtt7SK96MB1wOODUaJ2sBEHsGquOugSp6fNhnvCXMTjSgk16 y9BlJXeQEOC2EY2EappB2YGKIk2ofme1p7oPy675Xk3fX4hox+EppGtgetL6hkqrjmiT ohcZn8cPs+FVS3Bwqhg0ruuqdicLBQBzBnP9OdTnAXf0PBhDg6R2GzQtQCXYY4Nht4MH SH+orCDsF0g6g+hE3ANVzC9aUc8P4KXievIGZvOyOLwS/oAxy2hCaq3tPfRAt4oPyqtO 4z17YRBs3vKGqVtwx1C1Nh4i/7NZMM67jSiAfhS3LzGJwKJhL5M7//zHySvdAil6PsvW udcg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t28si2112430otr.16.2020.02.28.10.26.51; Fri, 28 Feb 2020 10:27:03 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726890AbgB1SZk (ORCPT + 99 others); Fri, 28 Feb 2020 13:25:40 -0500 Received: from foss.arm.com ([217.140.110.172]:42650 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725730AbgB1SZk (ORCPT ); Fri, 28 Feb 2020 13:25:40 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C3A4B31B; Fri, 28 Feb 2020 10:25:39 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 47EE23F7B4; Fri, 28 Feb 2020 10:25:39 -0800 (PST) Date: Fri, 28 Feb 2020 18:25:37 +0000 From: Mark Brown To: John Garry Cc: andriy.shevchenko@linux.intel.com, broonie@kernel.org, linuxarm@huawei.com, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-spi@vger.kernel.org, Mark Brown Subject: Applied "spi: Allow SPI controller override device buswidth" to the spi tree In-Reply-To: <1582903131-160033-2-git-send-email-john.garry@huawei.com> Message-Id: X-Patchwork-Hint: ignore Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch spi: Allow SPI controller override device buswidth has been applied to the spi tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From ea23578611dce2eeaf31dcfe12cd7130cf3d1411 Mon Sep 17 00:00:00 2001 From: John Garry Date: Fri, 28 Feb 2020 23:18:49 +0800 Subject: [PATCH] spi: Allow SPI controller override device buswidth 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 Link: https://lore.kernel.org/r/1582903131-160033-2-git-send-email-john.garry@huawei.com Signed-off-by: Mark Brown --- drivers/spi/spi.c | 4 +++- include/linux/spi/spi.h | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) 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) -- 2.20.1