/* Slave select should be called in the read/write function */ static void early_mrst_spi_putc(char c) { unsigned int timeout; u32 sr; timeout = MRST_SPI_TIMEOUT; /* Early putc needs to make sure the TX FIFO is not full */ while (--timeout) { sr = dw_readl(pspi, sr); if (!(sr & SR_TF_NOT_FULL)) cpu_relax(); else break; } if (!timeout) pr_warn("MRST earlycon: timed out\n"); else max3110_write_data(c); }
/* slave select should be called in the read/write function */ static int spi_max3110_putc(char c) { unsigned int timeout; u32 sr; timeout = MRST_SPI_TIMEOUT; /* early putc need make sure the TX FIFO is not full*/ while (timeout--) { sr = pspi->sr; if (!(sr & SR_TF_NOT_FULL)) continue; else break; } if (timeout == 0xffffffff) return -1; max3110_write_data(c); return 0; }