From patchwork Fri Mar 10 17:32:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mahapatra, Amit Kumar" X-Patchwork-Id: 662445 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 649D7C6FD1C for ; Fri, 10 Mar 2023 17:40:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231679AbjCJRkm (ORCPT ); Fri, 10 Mar 2023 12:40:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231712AbjCJRkN (ORCPT ); Fri, 10 Mar 2023 12:40:13 -0500 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2060d.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e8a::60d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26C3512BAE2; Fri, 10 Mar 2023 09:39:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AFuFER+LWwUAYPT0HAJvKrlXYyCClbIIUVpdsEbv6S1Ludb6KRAd2hDm2K0fVc6nXxVPjYRYzdNElZgB0Bwn0B7l7mDz9yKKn7vD44lLzqBwJudXNFxnMecrVtB0ULmmSh7P+wvnHkIV+k5NEnSFvN3VLKf3Sxo53Sm2/11abldX6+onRamWw7ubgrEULZ7ar8NAPr0UanMvYHUEskNXBfkg9idCBA0bVli9TKrkG9pTn9lMMRrTcbOj3Cqb2/udUE7S46tvoT61/va7iQz660jG9j2Vs62mBxy2BGNLIG5aMu8iVUZucU2WXCvDp6ttBPhWADoNHxuqXGAKvULDFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vKxfkb4YbG5w9Tm8mG5YGBxw1K7w2rVJ374cq5bsNis=; b=CDta0rtI9WgjlisAR/PERpjoARqNsfqwaHFxN8CROpINR1m/A8Is/mXbO83yS3ik0rUG+lI7aNvpRoPOAN1RFgbo/dOhrGH/dCCfj2MKXWJeysfHvgLQ1oUN+47kLaTttffe5DakPtn0jMID8BuLg3Z1byBgDYrFL+DiJirq6AifSaxED53pBYMI8s+dnzAX6OdfsBwGPxdcLVhqTsu5C4qQkWNQReOhjv+DGppaPudF+dqEIW5GOiStJotHK/L7x6djUilrqRwP70d2FDiw1SpCQSuhs2id/Ne9aVZ/+t5zk2bTGNsiyZbu0O7DFB4uOhP+TlDs/6T/EuTpBU0CPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vKxfkb4YbG5w9Tm8mG5YGBxw1K7w2rVJ374cq5bsNis=; b=doqsFrkE1iz98njnNv4CRbMC126Hd7FD3UZAfwIQn+nqKWIX1eZkY7PoXPfY2mtxXb51w/VkH1Ix1R6asG3U6UN1teBXS/mRSssRrK3kq7Yc0cXEDPS5leVJW52ha4BaqEbTxhnFB1S/xQhOpq8pX8q+5f9TR4p/CoTqdR4ZcVI= Received: from BN9PR03CA0765.namprd03.prod.outlook.com (2603:10b6:408:13a::20) by SJ0PR12MB6902.namprd12.prod.outlook.com (2603:10b6:a03:484::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.19; Fri, 10 Mar 2023 17:39:10 +0000 Received: from BN8NAM11FT055.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13a:cafe::e3) by BN9PR03CA0765.outlook.office365.com (2603:10b6:408:13a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.19 via Frontend Transport; Fri, 10 Mar 2023 17:39:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT055.mail.protection.outlook.com (10.13.177.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.20 via Frontend Transport; Fri, 10 Mar 2023 17:39:09 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 10 Mar 2023 11:39:09 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 10 Mar 2023 09:39:08 -0800 Received: from xhdsneeli40.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Fri, 10 Mar 2023 11:38:41 -0600 From: Amit Kumar Mahapatra To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH V6 13/15] spi: spi-zynqmp-gqspi: Add stacked memories support in GQSPI driver Date: Fri, 10 Mar 2023 23:02:15 +0530 Message-ID: <20230310173217.3429788-14-amit.kumar-mahapatra@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230310173217.3429788-1-amit.kumar-mahapatra@amd.com> References: <20230310173217.3429788-1-amit.kumar-mahapatra@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT055:EE_|SJ0PR12MB6902:EE_ X-MS-Office365-Filtering-Correlation-Id: 4050f504-4ad2-40e2-763c-08db218e5aee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x7jQaumCjZR0T9S11MlzIybBELHPA+OmuGtU11G0PLWh/cB9MmUWlp49ftfqyjtd52Pg4JyZYX0Z/hz552N3XB/+la3MdalEs7XG6X5wVvqRJU0Di9oDgZ5QrKk5lo211hTZ1R7e7rRdGlO5Zzh50T1igJqBeQ4LdXF8ii0bBkv6ALqpsTWRXf4PzruORKvAjbuQ9cDJR7eHFXc/rs33xcyNhaLpeFXXBwdysYyZNm2zsOwpCuIpm2agDean3r7lCufM6EuQybB6fnk6Da4kH9ReaTWXBCsepKVjfLDSaUTjECxUjCQNIMGI10FBGlZL/OCIoNropjucaYZiByMKXSTYfyxk6/ZYSoyM2nNjq7aTKohEG56TwZOe5fSnpHRWC2B9pmNo28zVdwnRLf9qup1oD5BcVMbhu4NUwfm+mvbDmeeeMZNES5vOqQvN3YoDdLTwPavrTDQpHUYyhyUntBO6LVpehwvrhIClOrNnqtwtyj7Qf4rwd+N2EkGTxen2v7yl6393b8RZC+6amEUMZc2pLax9DY1FlaUDjofODK+EAFec/RtQzSVHdaYXEPorAeJZ6Gr7UCtviu+CaBfu+cqjGIzrDvfeT+akg+T+k5FoEC87QhOD9MoTYbnOv6ij3Q2L9NYKP879p+9AmSTYEXZUfX6eWWh34X/pMZ2qeNCKwuUE2Jf1sDV1hBE0yRSsCHxVFNpJ/5cbak/tIrcgmdyzH4XV8ARsKOfwsXdDHNTpOt145LnSqZuJszLbJKVxk9P6HdlqPDMs0d5MRJDr0JhleSzWSLYuFJ1FXywbOltLlMDvPSNnDKZ5wJEsrw53Mw4KQ4KTtI57hIZNq5TiCJgb0k7L1HACxhS9pLD4ckg= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230025)(4636009)(136003)(346002)(396003)(39860400002)(376002)(451199018)(36840700001)(40470700004)(46966006)(921005)(1191002)(40460700003)(40480700001)(36756003)(82310400005)(86362001)(478600001)(356005)(2616005)(47076005)(426003)(54906003)(8676002)(70206006)(110136005)(70586007)(336012)(186003)(316002)(6666004)(26005)(1076003)(2906002)(7416002)(7406005)(7276002)(7336002)(7366002)(83380400001)(81166007)(36860700001)(8936002)(82740400003)(4326008)(41300700001)(5660300002)(41080700001)(36900700001)(84006005)(2101003)(83996005); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2023 17:39:09.6300 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4050f504-4ad2-40e2-763c-08db218e5aee X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT055.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6902 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org GQSPI supports two chip select CS0 & CS1. Update the driver to assert/de-assert the appropriate chip select as per the bits set in qspi->cs_index_mask. Signed-off-by: Amit Kumar Mahapatra --- drivers/spi/spi-zynqmp-gqspi.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c index fb2ca9b90eab..3d2b92a88e8a 100644 --- a/drivers/spi/spi-zynqmp-gqspi.c +++ b/drivers/spi/spi-zynqmp-gqspi.c @@ -156,6 +156,9 @@ #define GQSPI_FREQ_100MHZ 100000000 #define GQSPI_FREQ_150MHZ 150000000 +#define GQSPI_SELECT_LOWER_CS BIT(0) +#define GQSPI_SELECT_UPPER_CS BIT(1) + #define SPI_AUTOSUSPEND_TIMEOUT 3000 enum mode_type {GQSPI_MODE_IO, GQSPI_MODE_DMA}; @@ -467,15 +470,17 @@ static void zynqmp_qspi_chipselect(struct spi_device *qspi, bool is_high) genfifoentry |= GQSPI_GENFIFO_MODE_SPI; + if (qspi->cs_index_mask & GQSPI_SELECT_UPPER_CS) { + zynqmp_gqspi_selectslave(xqspi, + GQSPI_SELECT_FLASH_CS_UPPER, + GQSPI_SELECT_FLASH_BUS_LOWER); + } else if (qspi->cs_index_mask & GQSPI_SELECT_LOWER_CS) { + zynqmp_gqspi_selectslave(xqspi, + GQSPI_SELECT_FLASH_CS_LOWER, + GQSPI_SELECT_FLASH_BUS_LOWER); + } + genfifoentry |= xqspi->genfifobus; if (!is_high) { - if (!spi_get_chipselect(qspi, 0)) { - xqspi->genfifobus = GQSPI_GENFIFO_BUS_LOWER; - xqspi->genfifocs = GQSPI_GENFIFO_CS_LOWER; - } else { - xqspi->genfifobus = GQSPI_GENFIFO_BUS_UPPER; - xqspi->genfifocs = GQSPI_GENFIFO_CS_UPPER; - } - genfifoentry |= xqspi->genfifobus; genfifoentry |= xqspi->genfifocs; genfifoentry |= GQSPI_GENFIFO_CS_SETUP; } else {