we use spi_device->controller_data pass parameter structure to
controller.
– others configuration is coherent with your device such as CPOL,
Setup time, please refer to your datasheet.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | struct mt_chip_conf { u32 setuptime; u32 holdtime; u32 high_time; u32 low_time; u32 cs_idletime; u32 ulthgh_thrsh; enum spi_sample_sel sample_sel; enum spi_cs_pol cs_pol; enum spi_cpol cpol; enum spi_cpha cpha; enum spi_mlsb tx_mlsb; enum spi_mlsb rx_mlsb; enum spi_endian tx_endian; enum spi_endian rx_endian; enum spi_transfer_mode com_mod; enum spi_pause_mode pause; enum spi_finish_intr finish_intr; enum spi_deassert_mode deassert; enum spi_ulthigh ulthigh; enum spi_tckdly tckdly; }; struct mt_chip_conf *spi_par; pr_debug("%s\n", __func__); fpc1020->spi->controller_data = (void *)&spi_conf; spi_par = &spi_conf; spi_par->setuptime = 20; spi_par->holdtime = 20; spi_par->high_time = 50; spi_par->low_time = 50; spi_par->cs_idletime = 5; spi_par->rx_mlsb = 1; spi_par->tx_mlsb = 1; spi_par->tx_endian = 0; spi_par->rx_endian = 0; spi_par->cpol = 0; spi_par->cpha = 0; spi_par->com_mod = FIFO_TRANSFER; spi_par->pause = 1; spi_par->finish_intr = 1; spi_par->deassert = 0; fpc1020->spi->mode = SPI_MODE_0; fpc1020->spi->bits_per_word = 8; fpc1020->spi->chip_select = 0; error = spi_setup(fpc1020->spi); |