From patchwork Thu Jan 19 18:53:40 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: 13108627 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 A3D52C678D4 for ; Thu, 19 Jan 2023 19:00:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230451AbjASTAR (ORCPT ); Thu, 19 Jan 2023 14:00:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229807AbjASTAQ (ORCPT ); Thu, 19 Jan 2023 14:00:16 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on20612.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e88::612]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C7E295199; Thu, 19 Jan 2023 10:59:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ntzec/rB0jX1Lk+UVgHDGXopdgKhZRoA9cDCMRCUJzkj1nLIz1Ri+il50fegN8LOLZwFizQee/ZS2Z7plwWyFAaK7Tepx+4tPoTq60NYsogsnPCha1ReNlsCtf58kD0VdTVGLbom0ynrvyKwTqVG+Ey4oU+wvmYO2LhvSon4FwxnerOH/BLXlX+PykhS4PYVscyDZkNJ+65+zWtvTkrYXghFMXx3rIOy0XDkVGyHZCFSKiudHRYvFsu1vbj4YwIB38pKiBoyU0Qlh51zWcCiSIi2Qztt1Tliaw7zhusTEZ2u91bZrcznuasee6yuXvLZ9DtAIezOulGUCO/rusxr7g== 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=1VN0aTu/b+atiq6PvVnMyB/k52d/DW8+6rw/yfie26o=; b=Am6dG5v5PgVSP3Lh1DAkh3sI5P6brE8zZpSRFqO3KjYVA77jSVVPNGjjlXxU3WFbzV7qzQEpJVjr3i1upx8E0Gaj0X6paMtHwQZtGP3fSPTOMQxWM7KFooSTj4fBuC/9ipaSPZasdjj+ezkkgaenfbHRjcvsJvLt6XTgsUIm0DQ6Duw/Fo+JMzySlLqTAK6Y1937f6WFhf0Ev3Bq1uymm4l738ZMt1FeWlwGGVPf/hYSNziegFir+04CHT6SWhG0XLNmxlbaDeaYvd6ndHe7qUTx7QqT+WKlfVNRBjxHEsSMMFMe8tgzwx+LSl1eglnuKsJcJnlKgPwS7UYoNxr5Tw== 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=1VN0aTu/b+atiq6PvVnMyB/k52d/DW8+6rw/yfie26o=; b=qkJOo7jH9JW45xdx1MXSQTN/mnWeUkjZXNJ5KSy/7z5WA4l42E+MYJn4lHRpLn/t53AozWDZ+eXkQKfEjRrmrzhACz+mhgbbWn1Qtm9csk+GQ2CCKR4dr/7VhMBaPQrusFOX0rA6YRcPe2/AuivaVPoduwsA7uLIpGh9hEukzus= Received: from MW4PR04CA0091.namprd04.prod.outlook.com (2603:10b6:303:83::6) by SJ2PR12MB8062.namprd12.prod.outlook.com (2603:10b6:a03:4cb::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13; Thu, 19 Jan 2023 18:58:55 +0000 Received: from CO1PEPF00001A61.namprd05.prod.outlook.com (2603:10b6:303:83:cafe::a) by MW4PR04CA0091.outlook.office365.com (2603:10b6:303:83::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.22 via Frontend Transport; Thu, 19 Jan 2023 18:58:55 +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 CO1PEPF00001A61.mail.protection.outlook.com (10.167.241.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6002.11 via Frontend Transport; Thu, 19 Jan 2023 18:58:55 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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; Thu, 19 Jan 2023 12:58:54 -0600 Received: from xhdsneeli40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Thu, 19 Jan 2023 12:58:28 -0600 From: Amit Kumar Mahapatra To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 11/13] spi: spi-zynqmp-gqspi: Add stacked memories support in GQSPI driver Date: Fri, 20 Jan 2023 00:23:40 +0530 Message-ID: <20230119185342.2093323-12-amit.kumar-mahapatra@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230119185342.2093323-1-amit.kumar-mahapatra@amd.com> References: <20230119185342.2093323-1-amit.kumar-mahapatra@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF00001A61:EE_|SJ2PR12MB8062:EE_ X-MS-Office365-Filtering-Correlation-Id: 053d0898-e38f-4697-ea81-08dafa4f36d0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +C/U3U1ZGhsc77V49ufcXuX3uNiWpBWuYR5sF2l3wEO9tnqNqoFhZnptgqz4huF9Qdiaz0rrmDbs8UOrAY/O9gBOTxe4aS+nHQSrIeyfUaVwxwsy4AyNwZT/JNAIUx62Ib0h8Zg7tcm29z2X9mkOyrJsyWZsD0bcpaUYvaa317xdT5LiEkCJbVP8v56/8Rzk2tx5SnHsIog56RNjngYmLDIaYhrWmpWbMapaM68rjEpYnEZ4L84ALUDyZP+I1iW1kb/NWoeiYlWiwJMfeQfhwfnm5/vt0X+8+igALyyJwt2/x2dPJlHH2Lv+PUxzmia9g5JA7M6/uZ7YboK4x6/ww1lcdfvev5S0WGsx+XFoSSkDn13h9QjY6JNe/vt3yjhaz3ZsmknHFACnQHkpFji6eYMjjtJ63to2GcyUnoEvJJOnT0HsS69A14N7yDSj49fi8Ijk/06a1P+NeCXgA4dhWZWWxeyNm4UaDF0eeWC6Ew8LDr5b9nJERbcb6L0S8ePocLBEluYpV2gwYT+WA7ER2F625cv3B8deabNqOl/UgD1MRstFQhMyeb5Ttd3xaujJZEqGrGewb08kSIv5Pz6YVx70VgHJYws5RDTvZ5xpXztK0bJlSm0/h8YgZRa0LVo3ejxHLypDrViLXgLasbjr8zNqRw6EBRIhpUniOKk4Mv64BATuP+sCcty5mIPbSrFqOdua4jpbcdyGlbzx+nr5yRZC0GqfamYXeXEhNl+exIZc59gESV8QOW5dweMMczWw6Pxy7u/Of5vpzuM2sCFSNpEPZU8D3dQpA0cBxtd3EpLDCG7iKn5vlvLfeBTgKTJgPIwekSnP21tyAZuoSYi8xbr9tcPw1stJycpk8v0Q4DU= 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:(13230022)(4636009)(346002)(396003)(39860400002)(136003)(376002)(451199015)(40470700004)(36840700001)(46966006)(5660300002)(82740400003)(6666004)(426003)(40460700003)(36860700001)(7416002)(70586007)(4326008)(186003)(921005)(2906002)(54906003)(7336002)(8676002)(356005)(26005)(81166007)(70206006)(1191002)(336012)(86362001)(7276002)(7406005)(478600001)(316002)(36756003)(7366002)(8936002)(40480700001)(1076003)(82310400005)(2616005)(47076005)(41300700001)(110136005)(83380400001)(83996005)(2101003)(84006005)(36900700001)(41080700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 18:58:55.2555 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 053d0898-e38f-4697-ea81-08dafa4f36d0 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: CO1PEPF00001A61.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8062 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 319cdd5a0bdc..4759f704bf5c 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 {