From patchwork Thu Jul 9 12:44:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjit Waghmode X-Patchwork-Id: 6755981 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5139AC05AC for ; Thu, 9 Jul 2015 13:02:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5EB3120767 for ; Thu, 9 Jul 2015 13:02:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9E40D20703 for ; Thu, 9 Jul 2015 13:02:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753860AbbGINCN (ORCPT ); Thu, 9 Jul 2015 09:02:13 -0400 Received: from mail-bn1bon0081.outbound.protection.outlook.com ([157.56.111.81]:47552 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753857AbbGINCK (ORCPT ); Thu, 9 Jul 2015 09:02:10 -0400 Received: from BN1AFFO11FD051.protection.gbl (10.58.52.32) by BN1AFFO11HUB008.protection.gbl (10.58.52.118) with Microsoft SMTP Server (TLS) id 15.1.213.8; Thu, 9 Jul 2015 12:46:08 +0000 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; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by BN1AFFO11FD051.mail.protection.outlook.com (10.58.53.66) with Microsoft SMTP Server (TLS) id 15.1.190.9 via Frontend Transport; Thu, 9 Jul 2015 12:46:08 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:60603 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1ZDBDL-0000ci-9e; Thu, 09 Jul 2015 05:46:07 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1ZDBDL-0007H6-3L; Thu, 09 Jul 2015 05:46:07 -0700 Received: from xsj-pvapsmtp01 (mailman.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id t69CjcuR002281; Thu, 9 Jul 2015 05:45:38 -0700 Received: from [172.23.64.207] (helo=xhd-lin64re117.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1ZDBDD-0007Fb-SH; Thu, 09 Jul 2015 05:46:00 -0700 Received: by xhd-lin64re117.xilinx.com (Postfix, from userid 32810) id 08D3720872; Thu, 9 Jul 2015 18:15:59 +0530 (IST) From: Ranjit Waghmode To: , , , , , , , , , CC: , , , , , , , Ranjit Waghmode Subject: [RFC PATCH 1/2] spi: zynqmp: gqspi: add support for dual parallel mode configuration Date: Thu, 9 Jul 2015 18:14:54 +0530 Message-ID: <1436445895-25504-2-git-send-email-ranjit.waghmode@xilinx.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1436445895-25504-1-git-send-email-ranjit.waghmode@xilinx.com> References: <1436445895-25504-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-21666.003 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD051; 1:kN8LFk1irnndenqKppYbVB4auAKautxbwfwuAyuj4CzqWiwA26yW61SGfzfWpTgzTJ4yW+P6IdGwvK33ovZrUeei202o5/2F23f3EpbmFlRlhN7rcorlpHFoO0/JwuJ/jeMAGY7w1avou+g75tRexxbZuuOrUm4h1EwoDh6k4wIPkF232fJCQOdNb3e8XKn1kS6nOQglgyXkpM0STE3iJQH0KF9wlz1y/Y5g1ebOW5bQxcTa9rWh/lSPFgV/Qpg5tzMS9MKv1FHrNW2GBhEpuF8saFCcRljz2Gop4fDGqY+q+ZwNciA1sNdx4NvPYKvEPuIVXBj7f4ZDVxZDLSUWNA== X-Forefront-Antispam-Report: CIP:149.199.60.100; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(199003)(189002)(46386002)(45336002)(50986999)(107886002)(5001960100002)(2950100001)(62966003)(189998001)(77156002)(229853001)(2201001)(46102003)(86362001)(52956003)(92566002)(76176999)(6806004)(48376002)(19580405001)(87936001)(50226001)(50466002)(42186005)(33646002)(5003940100001)(63266004)(36756003)(19580395003)(106466001)(36386004)(5001770100001)(103686003)(107986001)(921003)(1121003)(217873001)(4001430100001)(90966001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1AFFO11HUB008; H:xsj-pvapsmtpgw02; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11HUB008; 2:BHKoY0VZ9xO0wuWKnEcNc85dDxsZ4zzu35ozcozZCKTmhOZg+SbECChMh8O1b0GQ; 3:XIQCL6IIlppg1hcYYXqD/GKHuBbt2CciuR/OIS8iMNs2p6Po4BiCwKjH7GQQLrkl5MaqDUPlPgo98d7vlbUJl9DubK9tZXICZdu30pJkUgsj0bU4/tgkPRtDsN6OTcozYxdSrLqlQ6ibOdip4xXSEL8VBnt/OSM/0qy5kuzNKg6pk3YZX1rFGKUod2Cnm7wmgU5e9Wg7lhjxaFA8dkOKyJcPd9HmSGj/rlkQENgOlA2whyQsudPB/BHqDm6JxD8f; 25:rwD1Y5w5BShrf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ELY8viTQlD3ab6QyjWwTtTYdth0t2k5a/sIPEv7qnBKFa92tnjwEzigwoHvT/fKVRWQmKVlRl26JoePLqc5tXWHLvnU8he0xkPeUPpA= BN1AFFO11HUB008: X-MS-Exchange-Organization-RulesExecuted 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:BN1AFFO11HUB008; BCL:0; PCL:0; RULEID:; SRVR:BN1AFFO11HUB008; X-Forefront-PRVS: 0632519F33 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1AFFO11HUB008; 23:9vNy1lNVY1p6iwvaqqa/oV2cxFJYTXsrgjUkLv/?= =?us-ascii?Q?UjrT8h1boX2HHDp5TOooVyaykREnLvputwQfPHkhxk1w9OsQFLjAbZtnte3Q?= =?us-ascii?Q?AJLIed0HMgJt+6AWz4XWUU4OyKafakFhKMJWVmV9K0wNf0dL7QhYIEc8F8bQ?= =?us-ascii?Q?h+Wo8uqHncrgKyzUzEl4vwDwgpwbYJTOKpnn+8YNgLusJ3DcoICXm2e3nz2k?= =?us-ascii?Q?591PHt1iT3WzKg8eyGcfCelNck1Zccsk6hTCnMfUlTtlaxjHEoy6uTPCOCa5?= =?us-ascii?Q?+FtbDGrQuQYw4PZMcngQFONKZFKHMWWRrMMArnGM+nEWLkDDuumC/Y0rQXS6?= =?us-ascii?Q?a9DDYQXW99URu8ZvqJgFjpH+zeQqWxVXeBSk0p4q7opQ/84mEetQA+1/22Ez?= =?us-ascii?Q?j9w4rwJvqmwhCZy9O3r7e1xlws0pVAIapctvRoCSnwb1Y6PkAvfGfwq3MNkz?= =?us-ascii?Q?tM4qCE1U2Aj/cdJYosz+8kBUloRynsPqc4LVQ2DOFVMvQT4CupPtPgsjNVbr?= =?us-ascii?Q?VRZKmkQm9VmV5xq3pawBWZxpqOntdrpo5VDLX3FzFUO9HJ17VRszwBRd9BQl?= =?us-ascii?Q?9L8o/REVhz+AarVUb+Z38B1/OEm325yVE/Z0GSxUUh8S93nqW/vlHF1ZzqNv?= =?us-ascii?Q?1mboEuaeU6our8XYaxTFt81w4hY8YPMnxV3/C9lT11Y23V6lxja7Qaf8lYmA?= =?us-ascii?Q?oODFAkMjjYMMHhGDYN3AnICvOQEvT6aOieptNauLy9utqF6VaedKhIS8pdmT?= =?us-ascii?Q?PDggAkx1Dz2pU5qegWZSWEjpD9jHiPQHItwN/2Kd2KiOXY26MXbS/jcolkuV?= =?us-ascii?Q?McOxv6RA5P/hCWUUfC2eN8Gu5kttwy+l0A8ApvHCDPX1PSZq3Ql0aCwo89tx?= =?us-ascii?Q?5LG5/BvXlSfS5cqoeAoFJl2nNvTP5IJ5iz+pz0dKMVYmMikSLcbFOZEFF0Ru?= =?us-ascii?Q?5SPZ7V17OIXf9/hLt72fDkkEfGBlCRECMjl7lzoeMY9VuQscfmsMpSAJU6eE?= =?us-ascii?Q?y231x35XZkHkVh/h4lTjoW4c0T0vI5on/uaDtdVgzp1hb9EChJmrro4MJAuv?= =?us-ascii?Q?6ZTCmLEz+BQSUlBmjQa7Qw8pcqFN9ctYnT/+gpBavLvksoCOJ2J/9WHR84e9?= =?us-ascii?Q?ZRGQOAiexyIc=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11HUB008; 5:0DMedWRZ9pkrI1o9k3Mg9lKDn8zWvUU0GlS9RHPWtIMugXYmdnzBtAYvOqaKW5w4ZEuC8RPf8DbSLaLojg6pECvoIWWMsL3PHf52sGZ0e9bS3sqCQWEhBmn00s5y6/W25xiHsa7C3nZa2UQlhEDqOg==; 24:QhVlBQJqxMGTAEPwwuyOsgyeJCg1VRhBuicQ4Ql2T58PSJcKnbSLuikqhFeotwPV7rXJ9XcauKqsyoSwfyyh46IXn6l0XD3x+cXUsiY52mE= X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2015 12:46:08.2842 (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: BN1AFFO11HUB008 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) -- 2.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c index 87b20a5..271fa80 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; }; @@ -404,9 +406,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_BOTH_FLASH) { + 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; } @@ -663,6 +676,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; } @@ -826,6 +840,9 @@ static int zynqmp_qspi_start_transfer(struct spi_master *master, genfifoentry |= xqspi->genfifocs; genfifoentry |= xqspi->genfifobus; + if ((!xqspi->isinstr) && (master->flags & SPI_DATA_STRIPE)) + genfifoentry |= GQSPI_GENFIFO_STRIPE; + zynqmp_qspi_txrxsetup(xqspi, transfer, &genfifoentry); if (xqspi->mode == GQSPI_MODE_DMA) @@ -982,6 +999,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) @@ -1042,7 +1060,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;