/* * REVISIT If there is support for SPI_3WIRE and SPI_LSB_FIRST in SPI * GPIO driver, this SPI driver can be replaced by a simple GPIO driver * providing 3 GPIO pins.
*/
staticinline u32
bitbang_txrx_be_cpha0_lsb(struct spi_lp8841_rtc *data, unsigned usecs, unsigned cpol, unsigned flags,
u32 word, u8 bits)
{ /* if (cpol == 0) this is SPI_MODE_0; else this is SPI_MODE_2 */
u32 shift = 32 - bits; /* clock starts at inactive polarity */ for (; likely(bits); bits--) {
/* setup LSB (to target) on leading edge */ if ((flags & SPI_CONTROLLER_NO_TX) == 0)
setmosi(data, (word & 1));
usleep_range(usecs, usecs + 1); /* T(setup) */
/* sample LSB (from target) on trailing edge */
word >>= 1; if ((flags & SPI_CONTROLLER_NO_RX) == 0)
word |= (getmiso(data) << 31);
data->iomem = devm_platform_ioremap_resource(pdev, 0);
ret = PTR_ERR_OR_ZERO(data->iomem); if (ret) {
dev_err(&pdev->dev, "failed to get IO address\n"); goto err_put_host;
}
/* register with the SPI framework */
ret = devm_spi_register_controller(&pdev->dev, host); if (ret) {
dev_err(&pdev->dev, "cannot register spi host\n"); goto err_put_host;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.