On Wed, Feb 28, 2018 at 08:03:57AM +0100, Sascha Hauer wrote: > On Tue, Feb 27, 2018 at 10:44:58PM +0100, Uwe Kleine-König wrote: > > This reduces the amount of read accesses to the register space by > > shadowing the values for five registers that only change on writing > > them. There is a single bit in UCR2 that might change without being > > written to it, this is handled accordingly. > > > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> > > --- > > drivers/tty/serial/imx.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++- > > 1 file changed, 59 insertions(+), 1 deletion(-) > > Is this patch really worth it? It doesn't make the code look nicer. The plan was not to make the code look nicer but not to introduce still more register reads in the following patches than necessary. > Another possibility would be not to implement the caching in the > register accessors but instead where it's used, i.e.: > > - ufcr = readl(sport->port.membase + UFCR); > - ufcr = (ufcr & (~UFCR_RFDIV)) | UFCR_RFDIV_REG(div); > - writel(ufcr, sport->port.membase + UFCR); > + sport->ufcr &= ~UFCR_RFDIV; > + sport->ufcr |= UFCR_RFDIV_REG(div); > + writel(ufcr, sport->port.membase + UFCR); Yeah, I'm open for that, but I chose the less intrusive, more easily to verify patch for now to get the fixes in that I found. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html