Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2456698imm; Thu, 11 Oct 2018 10:30:47 -0700 (PDT) X-Google-Smtp-Source: ACcGV61lLgepmmOlvbmdmtcqYt0RmRxzWaXYIgniDdWcEpOzAY+sfwlkDo5oJQhC2vNAXq9MiUOl X-Received: by 2002:a17:902:3a2:: with SMTP id d31-v6mr2398025pld.287.1539279047329; Thu, 11 Oct 2018 10:30:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539279047; cv=none; d=google.com; s=arc-20160816; b=NwByntjd1ydIjrfOxw6GDzDuVrYpagYL2v9dx3gASFlWuZeg6oXH6Sch6gJh+Kl7WV rfJ/yCorof74FaAUV6GSvfVxm7S+GMmfBy/zpXNk4pLk7wWAO8CqzXwa2WVp0Uu9r8SZ /BXCsqMzv+jL8qkybb+n/c0Y0eghJJ9YTPJhmOPnAY9G8MtQaJssg41vqaXMMpySt97M 1ltpJxjh9b4iS0E1Xq6DUM5enmztabS4R73Lwc4pYeELBdvdPVhdTW7psNk41wnX5C8l 4KJQo5w6o3qGtoSPMdT677Pki89M1JFXXmv5cBxLIvhv48Nihu87RuIlfcAwbcSQJ2QA czIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature; bh=HZoC+TjuukdcZdzVH0JudfJ2Hr+rjEstwT6ENcocrTM=; b=zYvBa8eEA/ofBkYQ/FS0rodrZmm49cTLBYn25tTgi76kOYQCAh0CxtRRkbdK8GqVcI C6fIKs9YCDOaPMYGoe9Tf9Qod+QqUSXAPepTIpgwfjK7VWAPtm8j9oh6a1muBgapkGOM WG3peeY4U57GlEEHdjZxPOt5IhOioivpsPl//SaVu2NNFeFjKN2WFjXompW5dVgJZh00 WhIMbvZbQh6idDf+Bg7qH54AHmS/KjOsWgHRzrXBy2+mkI7axqo8cnFMFDA9623i8Ksj PIJ1xZ8hFsANxAyTzTNPUKTkFdXvDojXaHPUPPkGbx8ST8VEhsDHR9dgoCvJPWICO7+J Zt3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=KqZu29VH; 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 1-v6si28497395plk.405.2018.10.11.10.30.32; Thu, 11 Oct 2018 10:30:47 -0700 (PDT) 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; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=KqZu29VH; 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 S1727215AbeJKWZ6 (ORCPT + 99 others); Thu, 11 Oct 2018 18:25:58 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:50188 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726071AbeJKWZ6 (ORCPT ); Thu, 11 Oct 2018 18:25:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=HZoC+TjuukdcZdzVH0JudfJ2Hr+rjEstwT6ENcocrTM=; b=KqZu29VHF7E+ kvogZ/guy1xfcctbGY8GtTzv5aooADC7eI0GSBhCVh4oIHNpUi+1Spx80HMF5X29ZIwSnTBgcelib th4PmDvrViGw3FREjhLQ1c+uh6XGVd9l7lW1Jg3MQS/BhR1zGYS/2pjdxroLTIXKLYQc9RnqO9xWw 3UjMo=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=debutante.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpa (Exim 4.89) (envelope-from ) id 1gAcPt-0001uO-0i; Thu, 11 Oct 2018 14:58:21 +0000 Received: by debutante.sirena.org.uk (Postfix, from userid 1000) id BB1B411223ED; Thu, 11 Oct 2018 15:58:20 +0100 (BST) From: Mark Brown To: Talel Shenhar Cc: David Woodhouse , Mark Brown , broonie@kernel.org, linux-spi@vger.kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, talel@amazon.com, jonnyc@amazon.com, ronenk@amazon.com, barakw@amazon.com, David Woodhouse , linux-spi@vger.kernel.org Subject: Applied "dw: spi: add support for Amazon's Alpine spi controller" to the spi tree In-Reply-To: <1539256807-25676-2-git-send-email-talel@amazon.com> Message-Id: <20181011145820.BB1B411223ED@debutante.sirena.org.uk> Date: Thu, 11 Oct 2018 15:58:20 +0100 (BST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch dw: spi: add support for Amazon's Alpine spi controller 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 f2d704794864a4bb486f2a0eaed40f25dd87303f Mon Sep 17 00:00:00 2001 From: Talel Shenhar Date: Thu, 11 Oct 2018 14:20:07 +0300 Subject: [PATCH] dw: spi: add support for Amazon's Alpine spi controller Add support for a new devicetree compatible string called 'amazon,alpine-apb-ssi', which is necessary for the Amazon Alpine spi controller. 'amazon,alpine-dw-apb-ssi' is used in the dw spi driver if specified in the devicetree. Otherwise, fall back to driver default behavior, i.e. original dw IP hw driver behavior. Signed-off-by: Talel Shenhar Signed-off-by: David Woodhouse Signed-off-by: Mark Brown --- drivers/spi/spi-dw-mmio.c | 9 +++++++++ drivers/spi/spi-dw.c | 6 ++++++ drivers/spi/spi-dw.h | 2 ++ 3 files changed, 17 insertions(+) diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c index a768461614a0..3ffb6a40fe0c 100644 --- a/drivers/spi/spi-dw-mmio.c +++ b/drivers/spi/spi-dw-mmio.c @@ -126,6 +126,14 @@ static int dw_spi_mscc_jaguar2_init(struct platform_device *pdev, JAGUAR2_IF_SI_OWNER_OFFSET); } +static int dw_spi_alpine_init(struct platform_device *pdev, + struct dw_spi_mmio *dwsmmio) +{ + dwsmmio->dws.cs_override = 1; + + return 0; +} + static int dw_spi_mmio_probe(struct platform_device *pdev) { int (*init_func)(struct platform_device *pdev, @@ -230,6 +238,7 @@ static const struct of_device_id dw_spi_mmio_of_match[] = { { .compatible = "snps,dw-apb-ssi", }, { .compatible = "mscc,ocelot-spi", .data = dw_spi_mscc_ocelot_init}, { .compatible = "mscc,jaguar2-spi", .data = dw_spi_mscc_jaguar2_init}, + { .compatible = "amazon,alpine-dw-apb-ssi", .data = dw_spi_alpine_init}, { /* end of table */} }; MODULE_DEVICE_TABLE(of, dw_spi_mmio_of_match); diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 3e205ab60cd4..b705f2bdb8b9 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -144,6 +144,8 @@ void dw_spi_set_cs(struct spi_device *spi, bool enable) if (!enable) dw_writel(dws, DW_SPI_SER, BIT(spi->chip_select)); + else if (dws->cs_override) + dw_writel(dws, DW_SPI_SER, 0); } EXPORT_SYMBOL_GPL(dw_spi_set_cs); @@ -463,6 +465,10 @@ static void spi_hw_init(struct device *dev, struct dw_spi *dws) dws->fifo_len = (fifo == 1) ? 0 : fifo; dev_dbg(dev, "Detected FIFO size: %u bytes\n", dws->fifo_len); } + + /* enable HW fixup for explicit CS deselect for Amazon's alpine chip */ + if (dws->cs_override) + dw_writel(dws, DW_SPI_CS_OVERRIDE, 0xF); } int dw_spi_add_host(struct device *dev, struct dw_spi *dws) diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h index 0168b08364d5..c9c15881e982 100644 --- a/drivers/spi/spi-dw.h +++ b/drivers/spi/spi-dw.h @@ -32,6 +32,7 @@ #define DW_SPI_IDR 0x58 #define DW_SPI_VERSION 0x5c #define DW_SPI_DR 0x60 +#define DW_SPI_CS_OVERRIDE 0xf4 /* Bit fields in CTRLR0 */ #define SPI_DFS_OFFSET 0 @@ -109,6 +110,7 @@ struct dw_spi { u32 fifo_len; /* depth of the FIFO buffer */ u32 max_freq; /* max bus freq supported */ + int cs_override; u32 reg_io_width; /* DR I/O width in bytes */ u16 bus_num; u16 num_cs; /* supported slave numbers */ -- 2.19.0.rc2