static void dw_writer(struct dw_spi *dws)
{
	u32 max = tx_max(dws);
	u16 txw = 0;	
	
	DBG_SPI("%dbyte tx:",dws->n_bytes);
	while (max--) {
		/* Set the tx word if the transfer's original "tx" is not null */
		if (dws->tx_end - dws->len) {
			if (dws->n_bytes == 1)
			{
				txw = *(u8 *)(dws->tx);	
				DBG_SPI("0x%02x,", *(u8 *)(dws->tx));
			}
			else
			{
				txw = *(u16 *)(dws->tx);
				DBG_SPI("0x%02x,", *(u16 *)(dws->tx));
			}
		}
		dw_writew(dws, SPIM_TXDR, txw);
		dws->tx += dws->n_bytes;
	}
	
	//it is neccessary
	wait_till_not_busy(dws);
	
	DBG_SPI("\n");
}
Exemple #2
0
static void rockchip_spi_pio_writer(struct rockchip_spi *rs)
{
	u32 max = tx_max(rs);
	u32 txw = 0;

	while (max--) {
		if (rs->n_bytes == 1)
			txw = *(u8 *)(rs->tx);
		else
			txw = *(u16 *)(rs->tx);

		writel_relaxed(txw, rs->regs + ROCKCHIP_SPI_TXDR);
		rs->tx += rs->n_bytes;
	}
}
Exemple #3
0
static void dw_writer(struct dw_spi *dws)
{
    u32 max = tx_max(dws);
    u16 txw = 0;

    while (max--) {
        /* Set the tx word if the transfer's original "tx" is not null */
        if (dws->tx_end - dws->len) {
            if (dws->n_bytes == 1)
                txw = *(u8 *)(dws->tx);
            else
                txw = *(u16 *)(dws->tx);
        }
        dw_writew(dws, DW_SPI_DR, txw);
        dws->tx += dws->n_bytes;
    }
}