Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752752AbbHCJFb (ORCPT ); Mon, 3 Aug 2015 05:05:31 -0400 Received: from mail-bl2on0070.outbound.protection.outlook.com ([65.55.169.70]:27573 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751705AbbHCJF1 (ORCPT ); Mon, 3 Aug 2015 05:05:27 -0400 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 2/2] spi: zynqmp: gqspi: add support for dual parallel mode configuration Date: Mon, 3 Aug 2015 14:35:07 +0530 Message-ID: <1438592707-30713-3-git-send-email-ranjit.waghmode@xilinx.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1438592707-30713-1-git-send-email-ranjit.waghmode@xilinx.com> References: <1438592707-30713-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-21720.004 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD028;1:fHBaFjyShHTU+dCyAaeAl8Jz4bFOqWisCHypVju/0CCak4fy1hPRmHYcpJNq8zHKL3PhTlIXbU/DoPKY/PjjalP9uxCfLrHTCRn6h6gElnjWf5W4CxSlOCgXV/v7DGj8lfvgWEZPv6a4yIQT/+Xw4qKy+CIBJUmzn+bQ5ScgwXCTPgBlRgHwIHdXvaPeZr1ivkEK196AIYSRQEH3ES887MKfzEMpPI2MjOhoCyn7auLchykc2gSRg3yB6iDjCmrtPWO9zSwxjCwCz+o+oQ4R6BXpbmVnXdn6Jak004O9g888ZmmXzta0mZc263wojzJfsjPor5HDrpsrLhTrPdzghQ== X-Forefront-Antispam-Report: CIP:149.199.60.100;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(5001960100002)(50226001)(107886002)(19580405001)(6806004)(42186005)(47776003)(19580395003)(63266004)(189998001)(46386002)(36756003)(45336002)(46102003)(2201001)(92566002)(229853001)(33646002)(87936001)(2950100001)(52956003)(36386004)(48376002)(106466001)(5001770100001)(76176999)(77156002)(50466002)(50986999)(62966003)(86362001)(7059030)(107986001)(921003)(4001430100001)(1121003)(217873001)(90966001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN1AFFO11HUB006;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;MLV:sfv;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11HUB006;2:sszUZ1f2tP6Ec2ADK/EFEfbnes+dOWV0irxsKQiRIZTpoMah1MJONt08+OsoOIjv9Ha+ddX2tSBkTWo0SmwwpLBUpD6hsGymkxTTG2hSpzmxWKWBIRW6eu6sp+ieCDhb/YpCezLRRMx4M5UX7rZMb19RZxDBp+PxCi9s3nDtG98=;3:/hKsI8sHLoC4h81me6fe6ar+ly7S9g+3f5UluCtKCAqKBoSZWjFLqN3UNrJHuarDWckhEeFPgKda7EsPAmIEcmWHVhdSuje6YsXHu3SBX96Xn4sPTGfwhHm7/5QzfjCRZxFBG2swj79S/qSIQqyJ/zGK0DeCZytTQ019zErUFfrkNfecX335QtDnVlRYb0c3oXVKdWCjjQTggwpkhREhXJ98zXpsOrklAwb5/4jjYnVbA+A9mHTgcwUptxXxmIvH;25:cR+W+RhlZSldm/UtD+UlVPcSDH9gr3UKDLRcnMolW6m3mAMvulikHu6J/6uv/wtF2Agcrnlx01lSG5o79xXncBI4M6LmIMLKxYNoFC6QWAZuzWwWFAdY0pn8HY5v3bk2WIBG1Bad5IUaNer1sVuwVLFNE2+neSrSQ9nxVM2z3CvMhTwzbYFP54RzvMyn9svm2CfnwF2znzXPYsS3DoIQwyaFnFSwG1KF/Lqf1WsHdHQIKoZc4J435BSa+ZTeK+AHRQEnpJ1/a4wWBRxe/cGWJA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN1AFFO11HUB006; X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11HUB006;20:XG9n/Ucm2nV9/mD28WIGUK91Mz5FAh6urxE+FjoRJqkobn7uLG6mdPYQXj5iRZaTaKKOKIzD5hFmY3CnOAUGpfwatHTk3wQLD9g8jkhUm+YxkOrN3fN9F50TYpI6OyqRQZMlaRrJSKBMb7ZwynQCc/o0YQN3J49d24WAWOq0IUU5wZ1I8eUhF8QCCAAnHhaS1FtqK8cmrkmDkvXAURsSTz73FbdAzfSCWwKojypkvMNR/W47uCPGmL5R93p/QRncnmXdUr8q9OESgdKuz8VtfL5kopsW6IDKDbx1bpGThbek671dISeHWJcZCrKl/8BhRywv+wVmvF/GFPNDicW8AhceC8DUj9spRPWCPyuWs9qX9K+xZI1k/V3YEkSD2ySCJOdoFaJiKQ0WgzdpxR7ZH6CrCKqI1b4ld5gZ6Aggbqhhq7aLcJhVoUN3mu3+x5wLnmVpApzLXXjqEK40m+UFpaxveXvMculT1dAqVHeFcbk1fr/+FSdoomEwfbOy3Rmt;4:5z95SjrI+EJK3D/H5+glClHggVa4LDKCT/TaYNLvV5Gf7Kr4rXAUimjaMkuP1XrfLVM2InI8vKjR4jTOeK66sV7lR/9U+rSkkZuAxtIX6bAb+C2GFaKmuhPkRlcIT//HGl0yKPy6vz2AX4v6vgJf0IX+urqYr91qSNeeDl4wMr9vMJF3vNrcYG/stnMnvd5+FMZ32hSYc2K4iHJfDCgKwjBEfzO2o1+N+JxLduJYSzLEM0o/+Eyo/ovU27UIAUUu2L32vKtTLVE8S9gtk8ON0oM7wcyKVqYFGfkgeTBHr14= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:BN1AFFO11HUB006;BCL:0;PCL:0;RULEID:;SRVR:BN1AFFO11HUB006; X-Forefront-PRVS: 0657D528EC X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN1AFFO11HUB006;23:wMvn5/0hpzTmd7BnjEEuQo40neouDpsAglfcwx0?= =?us-ascii?Q?LSa8X55z/sKMFdtm1w4Ma6grRVZoG9vKXNo6lMHicLenkhP02icq4btsfMJP?= =?us-ascii?Q?zdOBhLKfU+h9Juq9tbxmsb2AUy+2K/9qckOWUAiVHkNOYKn2qTPMNdrzvitD?= =?us-ascii?Q?kTZEVb/N/Wdwha9ziERTV2fK9rQPJ9r1mc3ZArArxfaT+bi6hyf9HTGT9mTD?= =?us-ascii?Q?i9blaKGiZFj47fj84Tu6ZQI6hZawP6cDh3aFlMmtQJjAPYHL2AYgY5Q6OSqb?= =?us-ascii?Q?1W3/K83x0d/k3sWFy5GAKPVnOa4Crd7F5AeqD19m7yHcF3PHPAR4HOf7iS6x?= =?us-ascii?Q?J4/E2aZcT3OcYupLwJMpPiyqHMmK7YgHuDIoWej+zwMEOpoA0KGXR1lAsRGT?= =?us-ascii?Q?fmUaohlmYVRwq/QN+v+o1EYH7c6v+uKUrurBJm59pb3i/HyUi8eaAiedXcoL?= =?us-ascii?Q?UWE08CoqVi9CnGJDzOwfmXS03gJ2zK5ewgEf3OlWiRR7nf+WsnSIluudawIV?= =?us-ascii?Q?MXGqXZh9Un5LBt23c8L73oyCEW9D0LxMTLjZ4Lag/TYUSfmQSPqP0ufuy0LO?= =?us-ascii?Q?xiQtkZStaJVTX4WkpB/SxsCZB6+bNpG3JeKEa8LGZZFTGAoVaJ1eAdZb1+lI?= =?us-ascii?Q?1lCa9U93AX3Nfl1xrUMYwBmdr57ekCwYthEykeImnB2ys9yZtKWcUrLh7RGW?= =?us-ascii?Q?vCqiNiSmLG/3D9HApzZsenFYHEDcb5JpC8d4jcRtvBM6l7tPxZCuyoSJ52c4?= =?us-ascii?Q?8soG3r3mCn9fKg5pWtHCy8ZlRL/yCEZR2nbBJEev43M8PMmZ+Hb8O4Nb/yti?= =?us-ascii?Q?GJMHf/qwLoqXLZjvrbExBHmmoCttHad7oz59UrDa7wnITFVaqJbJrWcoGqkc?= =?us-ascii?Q?O4tLA2myq/9addHPZgWL3F3yYZLPYcfaXZ7bB7bjEeY9WgWDs5He6vA0B9W0?= =?us-ascii?Q?fL0eLjtfSBs7LXgxRRuXiE3xTkmF5NFM7/k8LYFRNUoXrMN9l2BXuyEh7Ld6?= =?us-ascii?Q?nWMG2S+Zkr+65bk7e++IWVv2CVsSF4MkttkGXKobSem3LeK/pItPbWV7ghMj?= =?us-ascii?Q?0gNhxpytKfQ1cBt56oblwbAz19qJNvtQ3YFu5mNq4Nx1SDlp5OxUBLWKTAa4?= =?us-ascii?Q?acOY41b65HdU=3D?= X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11HUB006;5:TSPjl5eaQPqVMBbG00DLE5fSP0P3nDsHrKaLjNmi7oIRpAubF9pWaYyaCrfCaXBk4Fgikn9ynNRWlte2t7cEz7/GIQQnZbDQ1rB3KAuDZBn4ZDpdMPwRMbsbVha3aC/ekxtfstX0c4IjphJ7gsMBnQ==;24:sFsIknXHg9RMj71zgk9oo3EdP2YGwu7IDMapW6SukABaXYN89bTyojSfmnePk5HVC1xj/ZSn6NO5HJfhSlszie1lN92Rp2WLaZv5+4rrn6k= X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2015 09:05:25.4044 (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: BN1AFFO11HUB006 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3305 Lines: 96 This patch adds support of dual parallel mode configuration for Zynq Ultrascale+ MPSoC GQSPI controller driver. Signed-off-by: Ranjit Waghmode --- 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/