unsigned int mode;
unsigned int wordlen;
unsigned int pin_dir:1;
+
+ bool bus_claimed;
};
static void omap3_spi_write_chconf(struct omap3_spi_priv *priv, int val)
conf |= OMAP3_MCSPI_MODULCTRL_SINGLE;
writel(conf, &priv->regs->modulctrl);
+
+ priv->bus_claimed = true;
}
static int omap3_spi_claim_bus(struct udevice *dev)
struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
priv->cs = slave_plat->cs;
- priv->freq = slave_plat->max_hz;
+ if (!priv->freq)
+ priv->freq = slave_plat->max_hz;
_omap3_spi_claim_bus(priv);
+ _omap3_spi_set_speed(priv);
+ _omap3_spi_set_mode(priv);
return 0;
}
writel(OMAP3_MCSPI_MODULCTRL_MS, &priv->regs->modulctrl);
+ priv->bus_claimed = false;
+
return 0;
}
struct omap3_spi_priv *priv = dev_get_priv(dev);
priv->freq = speed;
- _omap3_spi_set_speed(priv);
+ if (priv->bus_claimed)
+ _omap3_spi_set_speed(priv);
return 0;
}
priv->mode = mode;
- _omap3_spi_set_mode(priv);
+ if (priv->bus_claimed)
+ _omap3_spi_set_mode(priv);
return 0;
}