From nobody Fri Dec 19 05:43:40 2025 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (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 A24C91A9B5D for ; Wed, 4 Dec 2024 09:43:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733305408; cv=none; b=tbs6BKfQKZ+KjSjU0vui/ygXEzHfRSEShyCklCEpLMh9KwxpSt1yzYfGeWupMiu5dMLhCt7w8sXqnAHl4UuBwmn4Wvdb5rbQ3gFPIrnur6UCPrVP1u8sYF4oefOlbzuTn5TPMt+DUtX0/IbS0K2R9/3oKa3Qsa5ePkcZpV7Msf0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733305408; c=relaxed/simple; bh=yIpIw/yPRhOjS09EiAV0V6ZaBpcd4fwYqe81O6r4jQo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BdFacFSFOuN53JJChlrMH/xu+lTqXmcZlfSxd2bzbfgVkJifSEtpcjfAXyz9a6UVSNaWlduvT0MUd3WLZ3hCSr8Yn0zajYbXDIhX69dfeu2vtoc5rnqVZQQeeEGrR1qM06K4ev09FA4m28lBF0tcaruid05OCUvNfTfLFtPbVik= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=OgJ0OEh8; arc=none smtp.client-ip=217.70.183.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="OgJ0OEh8" Received: by mail.gandi.net (Postfix) with ESMTPSA id 55C016000E; Wed, 4 Dec 2024 09:43:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1733305404; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L1dSLJh1SAr2vIT0aQ/N/d5yFBNgqA0SN9iaVBxJ+xc=; b=OgJ0OEh8TT0ynPArYFjdi8h19A0loT1wSX8taMnOcspK+yhepP4Tvx3hQP/enaBZPEy5+k D72w9HUkzUesJPkkry7zH147mZw+smiGbv+0rWfXhOyUPtn7DXS3p+5Ng4kB46QLk8Duh3 6KsSlDZU3qfLi7IoNSLXBPpFw79RaolKfc6wLwcgc2ItV+Z7/+ZTxGo7fq470m4wGJrEbM U4jqDYarhXXWQasGwC935PGTaqAD4S6j68YPqTPPf3aON85Mdx59zuVkMP0YheGq7YlAk1 FW5/+KCaji7nPFETh9KP7OKkKz6VwrMvP1BmzgK660ixyuXalLM/yILqbrBzuQ== From: Bastien Curutchet To: Santosh Shilimkar , Krzysztof Kozlowski , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, Thomas Petazzoni , Herve Codina , Christopher Cordahi , Bastien Curutchet Subject: [PATCH v5 3/9] memory: ti-aemif: Wrap CS timings into a struct Date: Wed, 4 Dec 2024 10:43:13 +0100 Message-ID: <20241204094319.1050826-4-bastien.curutchet@bootlin.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241204094319.1050826-1-bastien.curutchet@bootlin.com> References: <20241204094319.1050826-1-bastien.curutchet@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: bastien.curutchet@bootlin.com Content-Type: text/plain; charset="utf-8" CS timings are store in the struct aemif_cs_data along with other CS parameters. It isn't convenient for exposing CS timings to other drivers without also exposing the other parameters. Wrap the CS timings in a new struct aemif_cs_timings to simplify their export in upcoming patches. Signed-off-by: Bastien Curutchet Reviewed-by: Miquel Raynal --- drivers/memory/ti-aemif.c | 57 ++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c index a0e1a6b53256..1d1b30112af5 100644 --- a/drivers/memory/ti-aemif.c +++ b/drivers/memory/ti-aemif.c @@ -80,8 +80,7 @@ ASIZE_MAX) =20 /** - * struct aemif_cs_data: structure to hold cs parameters - * @cs: chip-select number + * struct aemif_cs_timings: structure to hold CS timings * @wstrobe: write strobe width, number of cycles - 1 * @rstrobe: read strobe width, number of cycles - 1 * @wsetup: write setup width, number of cycles - 1 @@ -89,12 +88,8 @@ * @rsetup: read setup width, number of cycles - 1 * @rhold: read hold width, number of cycles - 1 * @ta: minimum turn around time, number of cycles - 1 - * @enable_ss: enable/disable select strobe mode - * @enable_ew: enable/disable extended wait mode - * @asize: width of the asynchronous device's data bus */ -struct aemif_cs_data { - u8 cs; +struct aemif_cs_timings { u32 wstrobe; u32 rstrobe; u32 wsetup; @@ -102,6 +97,19 @@ struct aemif_cs_data { u32 rsetup; u32 rhold; u32 ta; +}; + +/** + * struct aemif_cs_data: structure to hold CS parameters + * @timings: timings configuration + * @cs: chip-select number + * @enable_ss: enable/disable select strobe mode + * @enable_ew: enable/disable extended wait mode + * @asize: width of the asynchronous device's data bus + */ +struct aemif_cs_data { + struct aemif_cs_timings timings; + u8 cs; u8 enable_ss; u8 enable_ew; u8 asize; @@ -179,9 +187,10 @@ static int aemif_config_abus(struct platform_device *p= dev, int csnum) =20 offset =3D A1CR_OFFSET + (data->cs - aemif->cs_offset) * 4; =20 - set =3D TA(data->ta) | - RHOLD(data->rhold) | RSTROBE(data->rstrobe) | RSETUP(data->rsetup) | - WHOLD(data->whold) | WSTROBE(data->wstrobe) | WSETUP(data->wsetup); + set =3D TA(data->timings.ta) | + RHOLD(data->timings.rhold) | RSTROBE(data->timings.rstrobe) | + RSETUP(data->timings.rsetup) | WHOLD(data->timings.whold) | + WSTROBE(data->timings.wstrobe) | WSETUP(data->timings.wsetup); =20 set |=3D (data->asize & ACR_ASIZE_MASK); if (data->enable_ew) @@ -215,13 +224,13 @@ static void aemif_get_hw_params(struct platform_devic= e *pdev, int csnum) offset =3D A1CR_OFFSET + (data->cs - aemif->cs_offset) * 4; val =3D readl(aemif->base + offset); =20 - data->ta =3D TA_VAL(val); - data->rhold =3D RHOLD_VAL(val); - data->rstrobe =3D RSTROBE_VAL(val); - data->rsetup =3D RSETUP_VAL(val); - data->whold =3D WHOLD_VAL(val); - data->wstrobe =3D WSTROBE_VAL(val); - data->wsetup =3D WSETUP_VAL(val); + data->timings.ta =3D TA_VAL(val); + data->timings.rhold =3D RHOLD_VAL(val); + data->timings.rstrobe =3D RSTROBE_VAL(val); + data->timings.rsetup =3D RSETUP_VAL(val); + data->timings.whold =3D WHOLD_VAL(val); + data->timings.wstrobe =3D WSTROBE_VAL(val); + data->timings.wsetup =3D WSETUP_VAL(val); data->enable_ew =3D EW_VAL(val); data->enable_ss =3D SSTROBE_VAL(val); data->asize =3D val & ASIZE_MAX; @@ -272,7 +281,7 @@ static int of_aemif_parse_abus_config(struct platform_d= evice *pdev, if (ret < 0) return ret; =20 - data->ta =3D ret; + data->timings.ta =3D ret; } =20 if (!of_property_read_u32(np, "ti,cs-read-hold-ns", &val)) { @@ -280,7 +289,7 @@ static int of_aemif_parse_abus_config(struct platform_d= evice *pdev, if (ret < 0) return ret; =20 - data->rhold =3D ret; + data->timings.rhold =3D ret; } =20 if (!of_property_read_u32(np, "ti,cs-read-strobe-ns", &val)) { @@ -288,7 +297,7 @@ static int of_aemif_parse_abus_config(struct platform_d= evice *pdev, if (ret < 0) return ret; =20 - data->rstrobe =3D ret; + data->timings.rstrobe =3D ret; } =20 if (!of_property_read_u32(np, "ti,cs-read-setup-ns", &val)) { @@ -296,7 +305,7 @@ static int of_aemif_parse_abus_config(struct platform_d= evice *pdev, if (ret < 0) return ret; =20 - data->rsetup =3D ret; + data->timings.rsetup =3D ret; } =20 if (!of_property_read_u32(np, "ti,cs-write-hold-ns", &val)) { @@ -304,7 +313,7 @@ static int of_aemif_parse_abus_config(struct platform_d= evice *pdev, if (ret < 0) return ret; =20 - data->whold =3D ret; + data->timings.whold =3D ret; } =20 if (!of_property_read_u32(np, "ti,cs-write-strobe-ns", &val)) { @@ -312,7 +321,7 @@ static int of_aemif_parse_abus_config(struct platform_d= evice *pdev, if (ret < 0) return ret; =20 - data->wstrobe =3D ret; + data->timings.wstrobe =3D ret; } =20 if (!of_property_read_u32(np, "ti,cs-write-setup-ns", &val)) { @@ -320,7 +329,7 @@ static int of_aemif_parse_abus_config(struct platform_d= evice *pdev, if (ret < 0) return ret; =20 - data->wsetup =3D ret; + data->timings.wsetup =3D ret; } =20 if (!of_property_read_u32(np, "ti,cs-bus-width", &val)) --=20 2.47.0