Lines Matching full:spi
16 #include <linux/spi/spi.h>
37 static void slic_write(struct spi_device *spi, u16 addr, in slic_write() argument
48 /* write spi addr and value */ in slic_write()
49 spi_write(spi, &temp[0], SLIC_THREE_LEN); in slic_write()
52 static u8 slic_read(struct spi_device *spi, u16 addr) in slic_read() argument
61 spi_write_then_read(spi, &temp[0], SLIC_TWO_LEN, &data, in slic_read()
68 static bool get_slic_product_code(struct spi_device *spi) in get_slic_product_code() argument
72 device_id = slic_read(spi, DS26522_IDR_ADDR); in get_slic_product_code()
79 static void ds26522_e1_spec_config(struct spi_device *spi) in ds26522_e1_spec_config() argument
82 slic_write(spi, DS26522_RMMR_ADDR, DS26522_RMMR_E1); in ds26522_e1_spec_config()
85 slic_write(spi, DS26522_TMMR_ADDR, DS26522_TMMR_E1); in ds26522_e1_spec_config()
88 slic_write(spi, DS26522_RMMR_ADDR, in ds26522_e1_spec_config()
89 slic_read(spi, DS26522_RMMR_ADDR) | DS26522_RMMR_FRM_EN); in ds26522_e1_spec_config()
92 slic_write(spi, DS26522_TMMR_ADDR, in ds26522_e1_spec_config()
93 slic_read(spi, DS26522_TMMR_ADDR) | DS26522_TMMR_FRM_EN); in ds26522_e1_spec_config()
96 slic_write(spi, DS26522_RCR1_ADDR, in ds26522_e1_spec_config()
100 slic_write(spi, DS26522_RIOCR_ADDR, in ds26522_e1_spec_config()
104 slic_write(spi, DS26522_TCR1_ADDR, DS26522_TCR1_TB8ZS); in ds26522_e1_spec_config()
107 slic_write(spi, DS26522_TIOCR_ADDR, in ds26522_e1_spec_config()
111 slic_write(spi, DS26522_E1TAF_ADDR, DS26522_E1TAF_DEFAULT); in ds26522_e1_spec_config()
114 slic_write(spi, DS26522_E1TNAF_ADDR, DS26522_E1TNAF_DEFAULT); in ds26522_e1_spec_config()
117 slic_write(spi, DS26522_RMMR_ADDR, slic_read(spi, DS26522_RMMR_ADDR) | in ds26522_e1_spec_config()
121 slic_write(spi, DS26522_TMMR_ADDR, slic_read(spi, DS26522_TMMR_ADDR) | in ds26522_e1_spec_config()
125 slic_write(spi, DS26522_LTRCR_ADDR, DS26522_LTRCR_E1); in ds26522_e1_spec_config()
128 slic_write(spi, DS26522_LTITSR_ADDR, in ds26522_e1_spec_config()
132 slic_write(spi, DS26522_LRISMR_ADDR, in ds26522_e1_spec_config()
136 slic_write(spi, DS26522_LMCR_ADDR, DS26522_LMCR_TE); in ds26522_e1_spec_config()
139 static int slic_ds26522_init_configure(struct spi_device *spi) in slic_ds26522_init_configure() argument
144 slic_write(spi, DS26522_GTCCR_ADDR, DS26522_GTCCR_BPREFSEL_REFCLKIN | in slic_ds26522_init_configure()
147 slic_write(spi, DS26522_GTCR2_ADDR, DS26522_GTCR2_TSSYNCOUT); in slic_ds26522_init_configure()
148 slic_write(spi, DS26522_GFCR_ADDR, DS26522_GFCR_BPCLK_2048KHZ); in slic_ds26522_init_configure()
151 slic_write(spi, DS26522_GTCR1_ADDR, DS26522_GTCR1); in slic_ds26522_init_configure()
154 slic_write(spi, DS26522_GLSRR_ADDR, DS26522_GLSRR_RESET); in slic_ds26522_init_configure()
157 slic_write(spi, DS26522_GFSRR_ADDR, DS26522_GFSRR_RESET); in slic_ds26522_init_configure()
161 slic_write(spi, DS26522_GLSRR_ADDR, DS26522_GLSRR_NORMAL); in slic_ds26522_init_configure()
162 slic_write(spi, DS26522_GFSRR_ADDR, DS26522_GFSRR_NORMAL); in slic_ds26522_init_configure()
165 slic_write(spi, DS26522_RMMR_ADDR, DS26522_RMMR_SFTRST); in slic_ds26522_init_configure()
168 slic_write(spi, DS26522_TMMR_ADDR, DS26522_TMMR_SFTRST); in slic_ds26522_init_configure()
175 slic_write(spi, addr, 0); in slic_ds26522_init_configure()
179 slic_write(spi, addr, 0); in slic_ds26522_init_configure()
183 slic_write(spi, addr, 0); in slic_ds26522_init_configure()
187 slic_write(spi, addr, 0); in slic_ds26522_init_configure()
190 ds26522_e1_spec_config(spi); in slic_ds26522_init_configure()
192 slic_write(spi, DS26522_GTCR1_ADDR, 0x00); in slic_ds26522_init_configure()
197 static int slic_ds26522_remove(struct spi_device *spi) in slic_ds26522_remove() argument
203 static int slic_ds26522_probe(struct spi_device *spi) in slic_ds26522_probe() argument
207 g_spi = spi; in slic_ds26522_probe()
208 spi->bits_per_word = 8; in slic_ds26522_probe()
210 if (!get_slic_product_code(spi)) in slic_ds26522_probe()
213 ret = slic_ds26522_init_configure(spi); in slic_ds26522_probe()
215 pr_info("DS26522 cs%d configured\n", spi->chip_select); in slic_ds26522_probe()
224 MODULE_DEVICE_TABLE(spi, slic_ds26522_id);