Commit af4e944d authored by Shubhrajyoti D's avatar Shubhrajyoti D Committed by Mark Brown

spi: omap2-mcspi: Remove the macro MOD_REG_BIT

Remove the macro MOD_REG_BIT instead make the bit field modifications
directly. This deletes a branch operation in cases where the the set
is predecided. While at it optimise two sequential bit clear in one step.
Acked-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarShubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent b2af045c
...@@ -140,13 +140,6 @@ struct omap2_mcspi_cs { ...@@ -140,13 +140,6 @@ struct omap2_mcspi_cs {
u32 chconf0; u32 chconf0;
}; };
#define MOD_REG_BIT(val, mask, set) do { \
if (set) \
val |= mask; \
else \
val &= ~mask; \
} while (0)
static inline void mcspi_write_reg(struct spi_master *master, static inline void mcspi_write_reg(struct spi_master *master,
int idx, u32 val) int idx, u32 val)
{ {
...@@ -205,7 +198,11 @@ static void omap2_mcspi_set_dma_req(const struct spi_device *spi, ...@@ -205,7 +198,11 @@ static void omap2_mcspi_set_dma_req(const struct spi_device *spi,
else else
rw = OMAP2_MCSPI_CHCONF_DMAW; rw = OMAP2_MCSPI_CHCONF_DMAW;
MOD_REG_BIT(l, rw, enable); if (enable)
l |= rw;
else
l &= ~rw;
mcspi_write_chconf0(spi, l); mcspi_write_chconf0(spi, l);
} }
...@@ -224,7 +221,11 @@ static void omap2_mcspi_force_cs(struct spi_device *spi, int cs_active) ...@@ -224,7 +221,11 @@ static void omap2_mcspi_force_cs(struct spi_device *spi, int cs_active)
u32 l; u32 l;
l = mcspi_cached_chconf0(spi); l = mcspi_cached_chconf0(spi);
MOD_REG_BIT(l, OMAP2_MCSPI_CHCONF_FORCE, cs_active); if (cs_active)
l |= OMAP2_MCSPI_CHCONF_FORCE;
else
l &= ~OMAP2_MCSPI_CHCONF_FORCE;
mcspi_write_chconf0(spi, l); mcspi_write_chconf0(spi, l);
} }
...@@ -239,9 +240,8 @@ static void omap2_mcspi_set_master_mode(struct spi_master *master) ...@@ -239,9 +240,8 @@ static void omap2_mcspi_set_master_mode(struct spi_master *master)
* to single-channel master mode * to single-channel master mode
*/ */
l = mcspi_read_reg(master, OMAP2_MCSPI_MODULCTRL); l = mcspi_read_reg(master, OMAP2_MCSPI_MODULCTRL);
MOD_REG_BIT(l, OMAP2_MCSPI_MODULCTRL_STEST, 0); l &= ~(OMAP2_MCSPI_MODULCTRL_STEST | OMAP2_MCSPI_MODULCTRL_MS);
MOD_REG_BIT(l, OMAP2_MCSPI_MODULCTRL_MS, 0); l |= OMAP2_MCSPI_MODULCTRL_SINGLE;
MOD_REG_BIT(l, OMAP2_MCSPI_MODULCTRL_SINGLE, 1);
mcspi_write_reg(master, OMAP2_MCSPI_MODULCTRL, l); mcspi_write_reg(master, OMAP2_MCSPI_MODULCTRL, l);
ctx->modulctrl = l; ctx->modulctrl = l;
...@@ -1285,9 +1285,9 @@ static int omap2_mcspi_resume(struct device *dev) ...@@ -1285,9 +1285,9 @@ static int omap2_mcspi_resume(struct device *dev)
* We need to toggle CS state for OMAP take this * We need to toggle CS state for OMAP take this
* change in account. * change in account.
*/ */
MOD_REG_BIT(cs->chconf0, OMAP2_MCSPI_CHCONF_FORCE, 1); cs->chconf0 |= OMAP2_MCSPI_CHCONF_FORCE;
__raw_writel(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0); __raw_writel(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0);
MOD_REG_BIT(cs->chconf0, OMAP2_MCSPI_CHCONF_FORCE, 0); cs->chconf0 &= ~OMAP2_MCSPI_CHCONF_FORCE;
__raw_writel(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0); __raw_writel(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment