Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp259851ybg; Mon, 1 Jun 2020 00:07:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEnN7GvKDpg7AEZGPyJ7MnWEBBZR7gtTiDO/Vs05jDjhyEscSqEsQoOQHIC4C7Lq9OqKYM X-Received: by 2002:a05:6402:417:: with SMTP id q23mr20517372edv.139.1590995277456; Mon, 01 Jun 2020 00:07:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590995277; cv=none; d=google.com; s=arc-20160816; b=FOOx4cxYuuIlu2GIDsuSgYsm5/TAogO4xK0QcEBBFocCHOu54DiMpC3BCmvMS3KzEF lmpCgnGVGv+Kc9KcmUiU9njnUEHY54q3HRmJDWfImOOfaOTRWKbjrEOEuBieDEGalk1k LbQnUEmv7SeQa+wzSo34nsS1HU9SeGa8B6tWX9d8W3kBS2LwFKpwQsfVNAPsb1SDHdZw WdVMHBM+svsznP2VzY2qyf67RDAZjySPGhTI4JLFs1ezfa8YwSFCR/JHxob4ofIEIcKC /4wgn/E0o3Y3Ncxb+UW0zAt0YWn4h7UdnFvY1FRDy+6IBDCiAxJrQJuqWPiFziyJbkfo o8EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0/mu1i+hzFf5b/DPhps7GzhDTK/PLKJI6yv6Vv9jYvU=; b=JEbG/2TG4zwcsuPxSMINn27/GdLrgQWPLZU8AbaR8WG4I4DKzrLyPGmVfFoib6WBKW 2PynZbEZ6WQyRBgs0YpmRTTaGYHniZCGIk72R/iCl6pgiSRXCYJ6w+NMbLDlLdGes6sr DswFwT1xaAMIHG61yszm34Bni/FPC2/4/vI5kEU1vdj8n4fNj3XfRwnvQYpTDIfEfkUl 22RuVLDkqR6KVE/yBys1JiaOnqOegmPfqiW2Z2UFFgez83QoIh5idojQ55aVO66eNuBH smqnJ42+tdcR7KXQzOLB6ceFO1p9g9uqW6hH9R7Vim/CjjiciEyYn+B6xYfvWg73fLT4 h1Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=iF3+cW5l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k14si1648992ejz.68.2020.06.01.00.07.35; Mon, 01 Jun 2020 00:07:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=iF3+cW5l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728084AbgFAHFi (ORCPT + 99 others); Mon, 1 Jun 2020 03:05:38 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:49684 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728071AbgFAHFh (ORCPT ); Mon, 1 Jun 2020 03:05:37 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 05175G8e069524; Mon, 1 Jun 2020 02:05:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1590995116; bh=0/mu1i+hzFf5b/DPhps7GzhDTK/PLKJI6yv6Vv9jYvU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=iF3+cW5lT3nnUxcSBB/yuQu7NDGImOQfXjDe2/ah6Fbf4DLZZ0K4b47kdUbaoWwTL EpSHZJHnfQq4VEeR5/6C8m9bnKQDZBeXmtrDiohMxSVbgApTrVlhZ3q79N1cBdUNW7 Psyjqp+qj2u1nkfzjxbgelxwhMOA5MyeMTQbrczM= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 05175Gqj052185; Mon, 1 Jun 2020 02:05:16 -0500 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Mon, 1 Jun 2020 02:05:16 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Mon, 1 Jun 2020 02:05:16 -0500 Received: from ula0132425.ent.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 051758s3016257; Mon, 1 Jun 2020 02:05:13 -0500 From: Vignesh Raghavendra To: Tudor Ambarus , Mark Brown CC: Vignesh Raghavendra , Boris Brezillon , Ramuthevar Vadivel Murugan , , , , , , Subject: [RESEND PATCH v3 1/8] mtd: spi-nor: cadence-quadspi: Make driver independent of flash geometry Date: Mon, 1 Jun 2020 12:34:37 +0530 Message-ID: <20200601070444.16923-2-vigneshr@ti.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601070444.16923-1-vigneshr@ti.com> References: <20200601070444.16923-1-vigneshr@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Drop configuration of Flash size, erase size and page size configuration. Flash size is needed only if using AHB decoder (BIT 23 of CONFIG_REG) which is not used by the driver. Erase size and page size are needed if IP is configured to send WREN automatically. But since SPI NOR layer takes care of sending WREN, there is no need to configure these fields either. Therefore drop these in preparation to move the driver to spi-mem framework where flash geometry is not visible to controller driver. Signed-off-by: Vignesh Raghavendra Reviewed-by: Tudor Ambarus --- .../mtd/spi-nor/controllers/cadence-quadspi.c | 36 +------------------ 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/drivers/mtd/spi-nor/controllers/cadence-quadspi.c b/drivers/mtd/spi-nor/controllers/cadence-quadspi.c index 494dcab4aaaab..9b8554d44fac8 100644 --- a/drivers/mtd/spi-nor/controllers/cadence-quadspi.c +++ b/drivers/mtd/spi-nor/controllers/cadence-quadspi.c @@ -77,9 +77,6 @@ struct cqspi_st { dma_addr_t mmap_phys_base; int current_cs; - int current_page_size; - int current_erase_size; - int current_addr_width; unsigned long master_ref_clk_hz; bool is_decoded_cs; u32 fifo_depth; @@ -736,32 +733,6 @@ static void cqspi_chipselect(struct spi_nor *nor) writel(reg, reg_base + CQSPI_REG_CONFIG); } -static void cqspi_configure_cs_and_sizes(struct spi_nor *nor) -{ - struct cqspi_flash_pdata *f_pdata = nor->priv; - struct cqspi_st *cqspi = f_pdata->cqspi; - void __iomem *iobase = cqspi->iobase; - unsigned int reg; - - /* configure page size and block size. */ - reg = readl(iobase + CQSPI_REG_SIZE); - reg &= ~(CQSPI_REG_SIZE_PAGE_MASK << CQSPI_REG_SIZE_PAGE_LSB); - reg &= ~(CQSPI_REG_SIZE_BLOCK_MASK << CQSPI_REG_SIZE_BLOCK_LSB); - reg &= ~CQSPI_REG_SIZE_ADDRESS_MASK; - reg |= (nor->page_size << CQSPI_REG_SIZE_PAGE_LSB); - reg |= (ilog2(nor->mtd.erasesize) << CQSPI_REG_SIZE_BLOCK_LSB); - reg |= (nor->addr_width - 1); - writel(reg, iobase + CQSPI_REG_SIZE); - - /* configure the chip select */ - cqspi_chipselect(nor); - - /* Store the new configuration of the controller */ - cqspi->current_page_size = nor->page_size; - cqspi->current_erase_size = nor->mtd.erasesize; - cqspi->current_addr_width = nor->addr_width; -} - static unsigned int calculate_ticks_for_ns(const unsigned int ref_clk_hz, const unsigned int ns_val) { @@ -867,18 +838,13 @@ static void cqspi_configure(struct spi_nor *nor) int switch_cs = (cqspi->current_cs != f_pdata->cs); int switch_ck = (cqspi->sclk != sclk); - if ((cqspi->current_page_size != nor->page_size) || - (cqspi->current_erase_size != nor->mtd.erasesize) || - (cqspi->current_addr_width != nor->addr_width)) - switch_cs = 1; - if (switch_cs || switch_ck) cqspi_controller_enable(cqspi, 0); /* Switch chip select. */ if (switch_cs) { cqspi->current_cs = f_pdata->cs; - cqspi_configure_cs_and_sizes(nor); + cqspi_chipselect(nor); } /* Setup baudrate divisor and delays */ -- 2.26.2