On Wed, 5 Mar 2025 at 23:11, Stephen Boyd <sboyd@xxxxxxxxxx> wrote: > > Quoting Sasha Finkelstein via B4 Relay (2025-03-05 12:26:40) > > + while (len_to_read < bc) { > > + rsp = read_reg(spmi, SPMI_RSP_REG); > > + i = 0; > > + while ((len_to_read < bc) && (i < 4)) { > > + __buf[len_to_read++] = ((0xff << (8 * i)) & rsp) >> > > + (8 * i); > > + i += 1; > > + } > > Is this ioread32_rep()? > [...] > > + while (i < bc) { > > + j = 0; > > + spmi_cmd = 0; > > + while ((j < 4) & (i < bc)) > > + spmi_cmd |= __buf[i++] << (j++ * 8); > > Is this iowrite32_rep()? Perhaps unaligned sizes have to be dealt with, > but otherwise I suspect it would be more efficient to use > iowrite32_rep() until the number of bytes is less than 4 and then do the > one extra pack. I think it would be better to leave them open-coded, io{read,write}32_rep casts the buffer to u32 and accesses it that way, probably resulting in unaligned accesses, and we are on arm64.