From: Michael Tretter <m.tretter@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
BAREBOX <barebox@lists.infradead.org>
Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>,
Michael Tretter <m.tretter@pengutronix.de>
Subject: [PATCH v2 03/10] arm: socfpga: iossm: use local mb_ctrl variable
Date: Thu, 09 Apr 2026 15:52:43 +0200 [thread overview]
Message-ID: <20260409-socfpga-iossm-v1-v2-3-09effab91bc1@pengutronix.de> (raw)
In-Reply-To: <20260409-socfpga-iossm-v1-v2-0-09effab91bc1@pengutronix.de>
Introduce a local variable to improve the readablility and avoid long
names when accessing the variables.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
Changes in v2:
- none
---
arch/arm/mach-socfpga/iossm_mailbox.c | 47 +++++++++++++++++++++--------------
1 file changed, 29 insertions(+), 18 deletions(-)
diff --git a/arch/arm/mach-socfpga/iossm_mailbox.c b/arch/arm/mach-socfpga/iossm_mailbox.c
index d14399f305de..9299fee71e0b 100644
--- a/arch/arm/mach-socfpga/iossm_mailbox.c
+++ b/arch/arm/mach-socfpga/iossm_mailbox.c
@@ -185,6 +185,7 @@ static int io96b_mb_version(struct io96b_info *io96b_ctrl)
void io96b_mb_init(struct io96b_info *io96b_ctrl)
{
struct io96b_mb_resp usr_resp;
+ struct io96b_mb_ctrl *mb_ctrl;
u8 ip_type_ret, instance_id_ret;
int i, j, k;
int version;
@@ -202,27 +203,28 @@ void io96b_mb_init(struct io96b_info *io96b_ctrl)
pr_debug("%s: num_instance %d\n", __func__, io96b_ctrl->num_instance);
for (i = 0; i < io96b_ctrl->num_instance; i++) {
+ mb_ctrl = &io96b_ctrl->io96b[i].mb_ctrl;
pr_debug("%s: get memory interface IO96B %d\n", __func__, i);
/* Get memory interface IP type and instance ID (IP identifier) */
io96b_mb_req_no_param(io96b_ctrl->io96b[i].io96b_csr_addr, 0, 0,
CMD_GET_SYS_INFO, GET_MEM_INTF_INFO, &usr_resp);
pr_debug("%s: get response from memory interface IO96B %d\n", __func__, i);
/* Retrieve number of memory interface(s) */
- io96b_ctrl->io96b[i].mb_ctrl.num_mem_interface =
+ mb_ctrl->num_mem_interface =
IOSSM_CMD_RESPONSE_DATA_SHORT(usr_resp.cmd_resp_status) & 0x3;
- pr_debug("%s: IO96B %d: num_mem_interface: 0x%x\n", __func__,
- i, io96b_ctrl->io96b[i].mb_ctrl.num_mem_interface);
+ pr_debug("%s: IO96B %d: num_mem_interface: %d\n", __func__,
+ i, mb_ctrl->num_mem_interface);
/* Retrieve memory interface IP type and instance ID (IP identifier) */
j = 0;
- for (k = 0; k < io96b_ctrl->io96b[i].mb_ctrl.num_mem_interface; k++) {
+ for (k = 0; k < mb_ctrl->num_mem_interface; k++) {
ip_type_ret = FIELD_GET(INTF_IP_TYPE_MASK, usr_resp.cmd_resp_data[k]);
instance_id_ret = FIELD_GET(INTF_INSTANCE_ID_MASK,
usr_resp.cmd_resp_data[k]);
if (ip_type_ret) {
- io96b_ctrl->io96b[i].mb_ctrl.ip_type[j] = ip_type_ret;
- io96b_ctrl->io96b[i].mb_ctrl.ip_instance_id[j] = instance_id_ret;
+ mb_ctrl->ip_type[j] = ip_type_ret;
+ mb_ctrl->ip_instance_id[j] = instance_id_ret;
pr_debug("%s: IO96B %d mem_interface %d: ip_type_ret: 0x%x\n",
__func__, i, j, ip_type_ret);
pr_debug("%s: IO96B %d mem_interface %d: instance_id_ret: 0x%x\n",
@@ -297,6 +299,7 @@ void io96b_init_mem_cal(struct io96b_info *io96b_ctrl)
int io96b_trig_mem_cal(struct io96b_info *io96b_ctrl)
{
struct io96b_mb_resp usr_resp;
+ struct io96b_mb_ctrl *mb_ctrl;
bool recal_success;
int i, j, k;
u32 cal_stat_offset;
@@ -305,10 +308,12 @@ int io96b_trig_mem_cal(struct io96b_info *io96b_ctrl)
int count = 0;
for (i = 0; i < io96b_ctrl->num_instance; i++) {
+ mb_ctrl = &io96b_ctrl->io96b[i].mb_ctrl;
+
if (io96b_ctrl->io96b[i].cal_status)
continue;
- for (j = 0; j < io96b_ctrl->io96b[i].mb_ctrl.num_mem_interface; j++) {
+ for (j = 0; j < mb_ctrl->num_mem_interface; j++) {
recal_success = false;
/* Re-calibration first memory interface with failed calibration */
@@ -326,8 +331,8 @@ int io96b_trig_mem_cal(struct io96b_info *io96b_ctrl)
break;
}
io96b_mb_req_no_param(io96b_ctrl->io96b[i].io96b_csr_addr,
- io96b_ctrl->io96b[i].mb_ctrl.ip_type[j],
- io96b_ctrl->io96b[i].mb_ctrl.ip_instance_id[j],
+ mb_ctrl->ip_type[j],
+ mb_ctrl->ip_instance_id[j],
CMD_TRIG_MEM_CAL_OP,
TRIG_MEM_CAL, &usr_resp);
@@ -361,6 +366,7 @@ int io96b_trig_mem_cal(struct io96b_info *io96b_ctrl)
int io96b_get_mem_technology(struct io96b_info *io96b_ctrl)
{
struct io96b_mb_resp usr_resp;
+ struct io96b_mb_ctrl *mb_ctrl;
int i, j;
u8 ddr_type_ret;
@@ -369,10 +375,11 @@ int io96b_get_mem_technology(struct io96b_info *io96b_ctrl)
/* Get and ensure all memory interface(s) same DDR type */
for (i = 0; i < io96b_ctrl->num_instance; i++) {
- for (j = 0; j < io96b_ctrl->io96b[i].mb_ctrl.num_mem_interface; j++) {
+ mb_ctrl = &io96b_ctrl->io96b[i].mb_ctrl;
+ for (j = 0; j < mb_ctrl->num_mem_interface; j++) {
io96b_mb_req_no_param(io96b_ctrl->io96b[i].io96b_csr_addr,
- io96b_ctrl->io96b[i].mb_ctrl.ip_type[j],
- io96b_ctrl->io96b[i].mb_ctrl.ip_instance_id[j],
+ mb_ctrl->ip_type[j],
+ mb_ctrl->ip_instance_id[j],
CMD_GET_MEM_INFO, GET_MEM_TECHNOLOGY, &usr_resp);
ddr_type_ret =
@@ -395,17 +402,19 @@ int io96b_get_mem_technology(struct io96b_info *io96b_ctrl)
int io96b_get_mem_width_info(struct io96b_info *io96b_ctrl)
{
struct io96b_mb_resp usr_resp;
+ struct io96b_mb_ctrl *mb_ctrl;
int i, j;
u16 memory_size;
u16 total_memory_size = 0;
/* Get all memory interface(s) total memory size on all instance(s) */
for (i = 0; i < io96b_ctrl->num_instance; i++) {
+ mb_ctrl = &io96b_ctrl->io96b[i].mb_ctrl;
memory_size = 0;
- for (j = 0; j < io96b_ctrl->io96b[i].mb_ctrl.num_mem_interface; j++) {
+ for (j = 0; j < mb_ctrl->num_mem_interface; j++) {
io96b_mb_req_no_param(io96b_ctrl->io96b[i].io96b_csr_addr,
- io96b_ctrl->io96b[i].mb_ctrl.ip_type[j],
- io96b_ctrl->io96b[i].mb_ctrl.ip_instance_id[j],
+ mb_ctrl->ip_type[j],
+ mb_ctrl->ip_instance_id[j],
CMD_GET_MEM_INFO, GET_MEM_WIDTH_INFO, &usr_resp);
memory_size = memory_size +
@@ -435,6 +444,7 @@ int io96b_get_mem_width_info(struct io96b_info *io96b_ctrl)
int io96b_ecc_enable_status(struct io96b_info *io96b_ctrl)
{
struct io96b_mb_resp usr_resp;
+ struct io96b_mb_ctrl *mb_ctrl;
int i, j;
bool ecc_stat_set = false;
bool ecc_stat;
@@ -444,10 +454,11 @@ int io96b_ecc_enable_status(struct io96b_info *io96b_ctrl)
/* Get and ensure all memory interface(s) same ECC status */
for (i = 0; i < io96b_ctrl->num_instance; i++) {
- for (j = 0; j < io96b_ctrl->io96b[i].mb_ctrl.num_mem_interface; j++) {
+ mb_ctrl = &io96b_ctrl->io96b[i].mb_ctrl;
+ for (j = 0; j < mb_ctrl->num_mem_interface; j++) {
io96b_mb_req_no_param(io96b_ctrl->io96b[i].io96b_csr_addr,
- io96b_ctrl->io96b[i].mb_ctrl.ip_type[j],
- io96b_ctrl->io96b[i].mb_ctrl.ip_instance_id[j],
+ mb_ctrl->ip_type[j],
+ mb_ctrl->ip_instance_id[j],
CMD_TRIG_CONTROLLER_OP, ECC_ENABLE_STATUS,
&usr_resp);
--
2.47.3
next prev parent reply other threads:[~2026-04-09 13:54 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-09 13:52 [PATCH v2 00/10] arm: socfpga: iossm: add support for mailbox v1 Michael Tretter
2026-04-09 13:52 ` [PATCH v2 01/10] arm: socfpga: iossm: remove uninitialized variable Michael Tretter
2026-04-09 13:52 ` [PATCH v2 02/10] arm: socfpga: iossm: add version check Michael Tretter
2026-04-10 8:18 ` Ahmad Fatoum
2026-04-10 13:24 ` Michael Tretter
2026-04-09 13:52 ` Michael Tretter [this message]
2026-04-09 13:52 ` [PATCH v2 04/10] arm: socfpga: iossm: store size in bytes Michael Tretter
2026-04-10 8:13 ` Ahmad Fatoum
2026-04-10 8:31 ` Michael Tretter
2026-04-10 8:37 ` Ahmad Fatoum
2026-04-10 12:06 ` Michael Tretter
2026-04-13 7:27 ` Sascha Hauer
2026-04-09 13:52 ` [PATCH v2 05/10] arm: socfpga: iossm: refactor io96b_mb_init Michael Tretter
2026-04-09 13:52 ` [PATCH v2 06/10] arm: socfpga: iossm: refactor return value handling Michael Tretter
2026-04-09 13:52 ` [PATCH v2 07/10] arm: socfgpa: iossm: extract poll_bist_mem_init_status Michael Tretter
2026-04-09 13:52 ` [PATCH v2 08/10] arm: socfgpa: iossm: extract initialization of one interface Michael Tretter
2026-04-15 6:12 ` Sascha Hauer
2026-04-15 8:29 ` Michael Tretter
2026-04-15 10:31 ` Sascha Hauer
2026-04-15 10:56 ` [PATCH] fixup! " Michael Tretter
2026-04-15 11:48 ` Sascha Hauer
2026-04-09 13:52 ` [PATCH v2 09/10] arm: socfpga: iossm: add memory initialization with inline ecc Michael Tretter
2026-04-09 13:52 ` [PATCH v2 10/10] arm: socfpga: iossm: add support for mailbox v1 Michael Tretter
2026-04-10 8:19 ` [PATCH v2 00/10] " Ahmad Fatoum
2026-04-13 7:26 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260409-socfpga-iossm-v1-v2-3-09effab91bc1@pengutronix.de \
--to=m.tretter@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
--cc=s.trumtrar@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox