From patchwork Mon Feb 12 17:48:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Kerello X-Patchwork-Id: 199962 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp73015dyb; Mon, 12 Feb 2024 09:52:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVAB7+h5WuJ+or6QjVJIx9B/GjZKqH39q3iahPrqwUIBrhwF5WBLY7kzTj4/jtAvqTfkilgfqqJ9HEMCV9eey1rnQbqQw== X-Google-Smtp-Source: AGHT+IFLGxdxeyUkWPcmFmLZJuBU4Z/UPidDh6YdMDWgIw5h5+6jn+KAvyOZq6GDinxsiRgNTAXn X-Received: by 2002:a0c:e393:0:b0:68c:aa25:c0ce with SMTP id a19-20020a0ce393000000b0068caa25c0cemr7219989qvl.30.1707760325711; Mon, 12 Feb 2024 09:52:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707760325; cv=pass; d=google.com; s=arc-20160816; b=cdqc4eptfi6Kohuhc+97X9QgVnvLdH+boupVkiUxkvD37gaybxpO6gQNtOjojWBq4t fQoT4xv6dAkquegW1EHGpMb0nICWFmnSYn/N0+/oxvVR886dBOHbbcIt9Vb2pT3+Jo6n k4guPMxwKpgg5YEOO1OsuKFNvBAlu3sdqaIVhpP7vTZIVIwP93dZ28N6bN/CUSs6iF9O I+RYcbL+6ljw0qPRl48pe+PzcOjuhPEkaFpL5Fqk5s93Oi7aVl7UBgdPGcCVyquZrHl3 /QfBAAw3GaTj+almxJddqlzsaZyYixcoryyrW7q9SRey/UKrSeLZQLgjEmE0F8wbGYgy rWmQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=OFS/WeJd4jRcMqQNxQdciKfLU7r6D+lgxuZRfC3hr4E=; fh=TOUmD+tY//E4gzGrUcqfchV5B1bl/7DM/GdzoQnZkPg=; b=QAamd4c3y4Aijcs9cZiipA0HIG3O6X4h2VFRQtgfUofZcJEDwXmeNcSCXLT+U1sNe6 oa8pQ5ppENKcljoUCry3d6fPDqUlLG6gYzMEXvGsFmODD+w98mpXrttFfPjxT6yR+EEH i4vykVwpOKIZzhS+UjR5BiHeTgi6NjI1S9OUF4l4UkVbmpnBcCGVgapbSWgq6TMReb1H hGfd8TWTpBaa4ncHIdgtgd7T0CadL8fyYXPjh7MBAxyyCsaHJ59zkrZ0uSSgt+r99Ayy q3ZfXr7gGAV6FgoadvnFp+AUOzCll/jqlxeYN9xAxdwvYrVdQe95cb3AGfWF+rEa7IHh POxQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=mqEayElp; arc=pass (i=1 spf=pass spfdomain=foss.st.com dkim=pass dkdomain=foss.st.com dmarc=pass fromdomain=foss.st.com); spf=pass (google.com: domain of linux-kernel+bounces-62135-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62135-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com X-Forwarded-Encrypted: i=2; AJvYcCW5wyQNSjzaNRL5N/d3vpQTFTrDVhebJJZqKlqJL6lM8/bw4SHOMvt97fl1bUp7vALNX3l1+jYKrVDMuwCg+BlJ5MmuNQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o5-20020ad45c85000000b0068c6cb82b51si954043qvh.192.2024.02.12.09.52.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 09:52:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62135-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=mqEayElp; arc=pass (i=1 spf=pass spfdomain=foss.st.com dkim=pass dkdomain=foss.st.com dmarc=pass fromdomain=foss.st.com); spf=pass (google.com: domain of linux-kernel+bounces-62135-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62135-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6DC9A1C215F0 for ; Mon, 12 Feb 2024 17:52:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 40C1F45945; Mon, 12 Feb 2024 17:50:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="mqEayElp" Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 835D93F9D5; Mon, 12 Feb 2024 17:50:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.182.106 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707760245; cv=none; b=gS7P+ZBcYY3v3AVtwi5e7vx3Nv4SRAawjvgy0IcPHpwUQt44nMH2xStNIgB/sHL6eS7iWCDnN2GDofN8892zJY/DWa623yDK3KD0db/Zy6R+bO4kWIqMway9KsDz1IEatD1zjkzvxfTzYKpiUtSqA8HzNF1W/op0VUwCE3SDpIQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707760245; c=relaxed/simple; bh=vWxwg4hf+VjPDAyXlyVO+P4o51AzsUHRMVNMPfC34UU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bLcXYKXylwG+AV4yGnnKPG69IZTdYoTYHcfuOytpz0pCKMVksdBWk+MUcW9QdcWGhK8yMM/wG/hdAiMKZqdUI7j+SgSkS6PKPb0rVkoAaX20aFCnHA0fnGVjAZwgnk1UrIwIK/2buPUXSHx49MIxq/ZVPsn3uHaWA55OYedKP6s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=mqEayElp; arc=none smtp.client-ip=185.132.182.106 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41CE0Psl006769; Mon, 12 Feb 2024 18:50:14 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= selector1; bh=OFS/WeJd4jRcMqQNxQdciKfLU7r6D+lgxuZRfC3hr4E=; b=mq EayElp2oxnKrSiPjYOaXW9jhDzTOk6b2bPRqaqgT0kEG4BYALw7WyX9N9QjhG1mS X4jniFnY6NZd1sZr+Q2p3YKf7ZTZKXm+HnZYocY0EAyzG2RJew42BMymX2Lk0gv8 z3qMjEdLib0QUZMq7QpnWhMkCaIK9U4qKPg+6hH1QPu7rXXUYSJY7vN0W9ZrA5Fx 2cOcm+Z+VICyqiXaCscdxQoC25Re0zu6TT+B2vjuKufxOc8vlm3SfyVlPyGc4JWi Y1DcichcHIL+xTA/vdbVSEfJkut0cna9kn5WRBWHSnraq3qLFqUvODlFpIiwggme zzv+Bb1ciKmv8Pdh/otg== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3w62js7ptu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Feb 2024 18:50:14 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id C54CD4002D; Mon, 12 Feb 2024 18:50:11 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 1CB1627F260; Mon, 12 Feb 2024 18:49:22 +0100 (CET) Received: from localhost (10.201.22.200) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 12 Feb 2024 18:49:21 +0100 From: Christophe Kerello To: , , , , , , CC: , , , , Christophe Kerello Subject: [PATCH 03/12] memory: stm32-fmc2-ebi: add a platform data structure Date: Mon, 12 Feb 2024 18:48:13 +0100 Message-ID: <20240212174822.77734-4-christophe.kerello@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240212174822.77734-1-christophe.kerello@foss.st.com> References: <20240212174822.77734-1-christophe.kerello@foss.st.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-12_15,2024-02-12_03,2023-05-22_02 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790716491505440128 X-GMAIL-MSGID: 1790716491505440128 Before the introduction of MP25 support, let's use a platform data structure for parameters that will differ. The MP1 SOCs have only one signal to manage all the controllers (NWAIT). The MP25 SOC has one RNB signal for the NAND controller and one NWAIT signal for the memory controller. Signed-off-by: Christophe Kerello --- drivers/memory/stm32-fmc2-ebi.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/memory/stm32-fmc2-ebi.c b/drivers/memory/stm32-fmc2-ebi.c index 47d0ea5f1616..5f82686689ee 100644 --- a/drivers/memory/stm32-fmc2-ebi.c +++ b/drivers/memory/stm32-fmc2-ebi.c @@ -132,10 +132,15 @@ enum stm32_fmc2_ebi_cpsize { FMC2_CPSIZE_1024 = 1024 }; +struct stm32_fmc2_ebi_data { + bool rnb_for_nand; +}; + struct stm32_fmc2_ebi { struct device *dev; struct clk *clk; struct regmap *regmap; + const struct stm32_fmc2_ebi_data *data; u8 bank_assigned; u32 bcr[FMC2_MAX_EBI_CE]; @@ -988,6 +993,9 @@ static bool stm32_fmc2_ebi_nwait_used_by_ctrls(struct stm32_fmc2_ebi *ebi) unsigned int cs; u32 bcr; + if (ebi->data->rnb_for_nand) + return false; + for (cs = 0; cs < FMC2_MAX_EBI_CE; cs++) { if (!(ebi->bank_assigned & BIT(cs))) continue; @@ -1108,6 +1116,10 @@ static int stm32_fmc2_ebi_probe(struct platform_device *pdev) ebi->dev = dev; + ebi->data = of_device_get_match_data(dev); + if (!ebi->data) + return -EINVAL; + ebi->regmap = device_node_to_regmap(dev->of_node); if (IS_ERR(ebi->regmap)) return PTR_ERR(ebi->regmap); @@ -1187,8 +1199,15 @@ static int __maybe_unused stm32_fmc2_ebi_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(stm32_fmc2_ebi_pm_ops, stm32_fmc2_ebi_suspend, stm32_fmc2_ebi_resume); +static const struct stm32_fmc2_ebi_data stm32_fmc2_ebi_mp1_data = { + .rnb_for_nand = false, +}; + static const struct of_device_id stm32_fmc2_ebi_match[] = { - {.compatible = "st,stm32mp1-fmc2-ebi"}, + { + .compatible = "st,stm32mp1-fmc2-ebi", + .data = &stm32_fmc2_ebi_mp1_data, + }, {} }; MODULE_DEVICE_TABLE(of, stm32_fmc2_ebi_match);