static void dw_reader(struct dw_spi *dws)
{
	u32 max = rx_max(dws);
	u16 rxw;
	
	DBG_SPI("%dbyte rx:",dws->n_bytes);

	while (max--) {
		rxw = dw_readw(dws, SPIM_RXDR);
		/* Care rx only if the transfer's original "rx" is not null */
		if (dws->rx_end - dws->len) {
			if (dws->n_bytes == 1)
			{
				*(u8 *)(dws->rx) = rxw;
				DBG_SPI("0x%02x,", *(u8 *)(dws->rx));
			}
			else
			{
				*(u16 *)(dws->rx) = rxw;
				DBG_SPI("0x%02x,", *(u16 *)(dws->rx));
			}
		}
		
		dws->rx += dws->n_bytes;
	}
	
	DBG_SPI("\n");
}
예제 #2
0
파일: spi-rockchip.c 프로젝트: Abioy/kasan
static void rockchip_spi_pio_reader(struct rockchip_spi *rs)
{
	u32 max = rx_max(rs);
	u32 rxw;

	while (max--) {
		rxw = readl_relaxed(rs->regs + ROCKCHIP_SPI_RXDR);
		if (rs->n_bytes == 1)
			*(u8 *)(rs->rx) = (u8)rxw;
		else
			*(u16 *)(rs->rx) = (u16)rxw;
		rs->rx += rs->n_bytes;
	}
}
예제 #3
0
static void dw_reader(struct dw_spi *dws)
{
    u32 max = rx_max(dws);
    u16 rxw;

    while (max--) {
        rxw = dw_readw(dws, DW_SPI_DR);
        /* Care rx only if the transfer's original "rx" is not null */
        if (dws->rx_end - dws->len) {
            if (dws->n_bytes == 1)
                *(u8 *)(dws->rx) = rxw;
            else
                *(u16 *)(dws->rx) = rxw;
        }
        dws->rx += dws->n_bytes;
    }
}