Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756109AbbHZGlm (ORCPT ); Wed, 26 Aug 2015 02:41:42 -0400 Received: from mail-by2on0089.outbound.protection.outlook.com ([207.46.100.89]:17775 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751216AbbHZGlj (ORCPT ); Wed, 26 Aug 2015 02:41:39 -0400 X-Greylist: delayed 874 seconds by postgrey-1.27 at vger.kernel.org; Wed, 26 Aug 2015 02:41:39 EDT Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none; From: Ranjit Waghmode To: , , , , , , , , , , , CC: , , , , , , Ranjit Waghmode Subject: [LINUX RFC v2 4/4] spi: zynqmp: gqspi: add support for dual parallel mode configuration Date: Wed, 26 Aug 2015 11:56:07 +0530 Message-ID: <1440570367-22569-5-git-send-email-ranjit.waghmode@xilinx.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1440570367-22569-1-git-send-email-ranjit.waghmode@xilinx.com> References: <1440570367-22569-1-git-send-email-ranjit.waghmode@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-21768.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD029;1:F2PpdGuG93VvzaHuGZ85CcTkaWkgFhbM+UE23bwl96WJ3cpEtKW90LYXm1rPqqoqTgO6Nihn3qcYmsjjbuBh/jAz4dxFvf0jSadP4WY3tzYY7bOzRxhIrVSt29GsnPaYMn64GfYG89e3UqppN83r/dVGglsC1GSh6BoJQ9pKDuSgpPjZOyOq47lg5tBIWlroiFWWhUisqMarmxJMriwhqH442BJnLDF3ZsGoO2CQCrG9+0vx5QVMLo2Pcg1k1bQhgqWw/14+xKyt8y38ACf11fRy+XmQxuRAV1i9LHJ8y8emFnNsGV3QUTKh3lWguk7/OHcf6PRCjgsPVaO56Q6jWZbjlcx9240ymdGI4R0im1Hv86IwSoqZXSZIBjZf1Y/7lL70U6023kxMqoq1Oh08lg== X-Forefront-Antispam-Report: CIP:149.199.60.100;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(438002)(3050300001)(189002)(199003)(62966003)(64706001)(47776003)(77156002)(87936001)(19580395003)(2950100001)(2201001)(5007970100001)(92566002)(36386004)(52956003)(50226001)(5003940100001)(86362001)(36756003)(19580405001)(50466002)(5001770100001)(229853001)(81156007)(46102003)(48376002)(5001960100002)(5001920100001)(5001860100001)(4001540100001)(189998001)(5001830100001)(76176999)(46386002)(107886002)(6806004)(106466001)(63266004)(45336002)(103686003)(50986999)(33646002)(42186005)(7059030)(107986001)(921003)(90966001)(217873001)(4001430100001)(1121003)(5001870100001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN1BFFO11HUB025;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;PTR:xapps1.xilinx.com,unknown-60-100.xilinx.com;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11HUB025;2:bDdUwlN8HrfY6VrIX/M452BHk1kw3N/ofuODPKfV+kBX7JNdVhyFgOh3tf9ENt3IEutGdvboSlXa8MJqpjzW3EZUFJH5ud9GJzN7rUEz3Wvgmp0r7Bc4tGSlVhReJ6WCK1FMbnBpYa7JB5UdwNvbRT+oNTbLtkJxxcLJvTlkvK0=;3:rJVwmFdP2yuGEYM5zQrf7Mxboynk/NOXirVu/vRR/Hpn2SvJLWY7UbRCdXHZNFv+Pa80VZxcuSakBR7k5oUIh+bGT/0nxOvQ0hk5P0V9q5XIDj6OifX0w4Fb7ETxuEdod4zakm/WSdjv05BPzQb9NyxwswbEndhzjl1FZT0Hwfek6JwARZQLhXPHecmO7+HZRMGr6JNmwnp6msEXzDTCZKS/v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U3XhxdmwNS5IMpgDtxpmTZ5ZD4MfdhRUtLL9EgAo6P8kmXxYS5Yf3+2kUOhFCdjs2oyRjiiN4RnID3cjL0xD4o5Piu+I6XaFVZ91c0DXHFodl5SmFORwyb66Ra0Ngh5pkea96Qq5oOI9YKPXiSAO1PDXT9TKUfWYnlkZrg6BjNB X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(8121501046)(3002001);SRVR:BN1BFFO11HUB025;BCL:0;PCL:0;RULEID:;SRVR:BN1BFFO11HUB025; X-Forefront-PRVS: 0680FADD48 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN1BFFO11HUB025;23:Y8LDafx5GgubHuZfxnyYlVCLfbfNGsSvHSVjEYL?= =?us-ascii?Q?LeQZ0Us1IzE0s7eWwx4oEmvqoGX6RoEgr6HvOY3I7o8LQPbvfWGnUNHXq8jd?= =?us-ascii?Q?FyMfqEZdVpQarT3y5IX3WRdpZEWXgJMLKqnGFHP+C3y9jY9Eq5YhsBEtEMxV?= =?us-ascii?Q?8cKluJoxfYO1x6ujuxF4gkKxnJ+UKZ7p8KSmZnLXZeccOYjyCrg9LB9WjGi/?= =?us-ascii?Q?kMZa6xe8kfqhdUP7HmovlborPpnBZhDb0LFs96pw41PNaQ6SK38pEuz6M5kt?= =?us-ascii?Q?DBkyDDjCv+BxdLIUtvL+nyZ67CbZobC2z3cy0m6ZjWqHQnUw7InFXF6dZyQo?= =?us-ascii?Q?9d6uL7WczKWQr7rkz9DYxbGuF9Ml8YiSzC1w/5HlariYoTP9MZ7VzODtIZQN?= =?us-ascii?Q?yfpdK2sCcxDJ/bq1QaJbqdi8twyQ/6wrUPbY4EFEYnl+Y/FaCot2IOhOD6pr?= =?us-ascii?Q?j5PSVfQEPtlc59BFa+jonlJOAFPorryKspxAcXMC2lXpgjxOr2D24CI/8/VD?= =?us-ascii?Q?aiEx6zW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-ascii?Q?boNoPXvjMmg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11HUB025;5:mUCfSSjLzGYK4FHxSKX3Wj8qHMaYhBnD+PWKGff4thAf9tmA8D17K+PDZ8KcvmfjBJBCOD5ciXNyv1qxm9GkyaX2392rqJMbwl9VG09ywybBXjlMW+ggODh4wDSVecdfV88kS5S56RO453j9153aBQ==;24:hmqKaUQ7lm4dhcF6URP4rzRbp/Yv38EXGRgF7GEIQwLiqJeRXB/UxUX8ucWcGHSaMYU/2+PaOmoRKHhLeaWs+elCapjck/W3LefwJ7rKlJo= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2015 06:27:03.1742 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.100];Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1BFFO11HUB025 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3347 Lines: 99 This patch adds support of dual parallel mode configuration for Zynq Ultrascale+ MPSoC GQSPI controller driver. Signed-off-by: Ranjit Waghmode --- V2 Changes: - No change in this patch --- drivers/spi/spi-zynqmp-gqspi.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c index f23f36e..7a72781 100644 --- a/drivers/spi/spi-zynqmp-gqspi.c +++ b/drivers/spi/spi-zynqmp-gqspi.c @@ -153,6 +153,7 @@ enum mode_type {GQSPI_MODE_IO, GQSPI_MODE_DMA}; * @dma_rx_bytes: Remaining bytes to receive by DMA mode * @dma_addr: DMA address after mapping the kernel buffer * @genfifoentry: Used for storing the genfifoentry instruction. + * @isinstr: To determine whether the transfer is instruction * @mode: Defines the mode in which QSPI is operating */ struct zynqmp_qspi { @@ -170,6 +171,7 @@ struct zynqmp_qspi { u32 dma_rx_bytes; dma_addr_t dma_addr; u32 genfifoentry; + bool isinstr; enum mode_type mode; }; @@ -405,9 +407,20 @@ static void zynqmp_qspi_chipselect(struct spi_device *qspi, bool is_high) genfifoentry |= GQSPI_GENFIFO_MODE_SPI; genfifoentry |= xqspi->genfifobus; + if (qspi->master->flags & SPI_MASTER_BOTH_CS) { + zynqmp_gqspi_selectslave(xqspi, + GQSPI_SELECT_FLASH_CS_BOTH, + GQSPI_SELECT_FLASH_BUS_BOTH); + } else { + zynqmp_gqspi_selectslave(xqspi, + GQSPI_SELECT_FLASH_CS_LOWER, + GQSPI_SELECT_FLASH_BUS_LOWER); + } + if (!is_high) { genfifoentry |= xqspi->genfifocs; genfifoentry |= GQSPI_GENFIFO_CS_SETUP; + xqspi->isinstr = true; } else { genfifoentry |= GQSPI_GENFIFO_CS_HOLD; } @@ -664,6 +677,7 @@ static irqreturn_t zynqmp_qspi_irq(int irq, void *dev_id) if ((xqspi->bytes_to_receive == 0) && (xqspi->bytes_to_transfer == 0) && ((status & GQSPI_IRQ_MASK) == GQSPI_IRQ_MASK)) { zynqmp_gqspi_write(xqspi, GQSPI_IDR_OFST, GQSPI_ISR_IDR_MASK); + xqspi->isinstr = false; spi_finalize_current_transfer(master); ret = IRQ_HANDLED; } @@ -827,6 +841,9 @@ static int zynqmp_qspi_start_transfer(struct spi_master *master, genfifoentry |= xqspi->genfifocs; genfifoentry |= xqspi->genfifobus; + if ((!xqspi->isinstr) && (master->flags & SPI_MASTER_DATA_STRIPE)) + genfifoentry |= GQSPI_GENFIFO_STRIPE; + zynqmp_qspi_txrxsetup(xqspi, transfer, &genfifoentry); if (xqspi->mode == GQSPI_MODE_DMA) @@ -983,6 +1000,7 @@ static int zynqmp_qspi_probe(struct platform_device *pdev) struct zynqmp_qspi *xqspi; struct resource *res; struct device *dev = &pdev->dev; + u32 num_cs; master = spi_alloc_master(&pdev->dev, sizeof(*xqspi)); if (!master) @@ -1043,7 +1061,11 @@ static int zynqmp_qspi_probe(struct platform_device *pdev) goto clk_dis_all; } - master->num_chipselect = GQSPI_DEFAULT_NUM_CS; + ret = of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs); + if (ret < 0) + master->num_chipselect = GQSPI_DEFAULT_NUM_CS; + else + master->num_chipselect = num_cs; master->setup = zynqmp_qspi_setup; master->set_cs = zynqmp_qspi_chipselect; -- 2.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/