Lines Matching +full:spi +full:- +full:compatible

2  * B53 register access through SPI
4 * Copyright (C) 2011-2013 Jonas Gorski <jogo@openwrt.org>
24 #include <linux/spi/spi.h>
42 static inline int b53_spi_read_reg(struct spi_device *spi, u8 reg, u8 *val, in b53_spi_read_reg() argument
50 return spi_write_then_read(spi, txbuf, 2, val, len); in b53_spi_read_reg()
53 static inline int b53_spi_clear_status(struct spi_device *spi) in b53_spi_clear_status() argument
60 ret = b53_spi_read_reg(spi, B53_SPI_STATUS, &rxbuf, 1); in b53_spi_clear_status()
71 return -EIO; in b53_spi_clear_status()
76 static inline int b53_spi_set_page(struct spi_device *spi, u8 page) in b53_spi_set_page() argument
84 return spi_write(spi, txbuf, sizeof(txbuf)); in b53_spi_set_page()
87 static inline int b53_prepare_reg_access(struct spi_device *spi, u8 page) in b53_prepare_reg_access() argument
89 int ret = b53_spi_clear_status(spi); in b53_prepare_reg_access()
94 return b53_spi_set_page(spi, page); in b53_prepare_reg_access()
97 static int b53_spi_prepare_reg_read(struct spi_device *spi, u8 reg) in b53_spi_prepare_reg_read() argument
103 ret = b53_spi_read_reg(spi, reg, &rxbuf, 1); in b53_spi_prepare_reg_read()
108 ret = b53_spi_read_reg(spi, B53_SPI_STATUS, &rxbuf, 1); in b53_spi_prepare_reg_read()
119 return -EIO; in b53_spi_prepare_reg_read()
127 struct spi_device *spi = dev->priv; in b53_spi_read() local
130 ret = b53_prepare_reg_access(spi, page); in b53_spi_read()
134 ret = b53_spi_prepare_reg_read(spi, reg); in b53_spi_read()
138 return b53_spi_read_reg(spi, B53_SPI_DATA, data, len); in b53_spi_read()
200 struct spi_device *spi = dev->priv; in b53_spi_write8() local
204 ret = b53_prepare_reg_access(spi, page); in b53_spi_write8()
212 return spi_write(spi, txbuf, sizeof(txbuf)); in b53_spi_write8()
217 struct spi_device *spi = dev->priv; in b53_spi_write16() local
221 ret = b53_prepare_reg_access(spi, page); in b53_spi_write16()
229 return spi_write(spi, txbuf, sizeof(txbuf)); in b53_spi_write16()
234 struct spi_device *spi = dev->priv; in b53_spi_write32() local
238 ret = b53_prepare_reg_access(spi, page); in b53_spi_write32()
246 return spi_write(spi, txbuf, sizeof(txbuf)); in b53_spi_write32()
251 struct spi_device *spi = dev->priv; in b53_spi_write48() local
255 ret = b53_prepare_reg_access(spi, page); in b53_spi_write48()
263 return spi_write(spi, txbuf, sizeof(txbuf) - 2); in b53_spi_write48()
268 struct spi_device *spi = dev->priv; in b53_spi_write64() local
272 ret = b53_prepare_reg_access(spi, page); in b53_spi_write64()
280 return spi_write(spi, txbuf, sizeof(txbuf)); in b53_spi_write64()
296 static int b53_spi_probe(struct spi_device *spi) in b53_spi_probe() argument
301 dev = b53_switch_alloc(&spi->dev, &b53_spi_ops, spi); in b53_spi_probe()
303 return -ENOMEM; in b53_spi_probe()
305 if (spi->dev.platform_data) in b53_spi_probe()
306 dev->pdata = spi->dev.platform_data; in b53_spi_probe()
312 spi_set_drvdata(spi, dev); in b53_spi_probe()
317 static void b53_spi_remove(struct spi_device *spi) in b53_spi_remove() argument
319 struct b53_device *dev = spi_get_drvdata(spi); in b53_spi_remove()
325 static void b53_spi_shutdown(struct spi_device *spi) in b53_spi_shutdown() argument
327 struct b53_device *dev = spi_get_drvdata(spi); in b53_spi_shutdown()
332 spi_set_drvdata(spi, NULL); in b53_spi_shutdown()
336 { .compatible = "brcm,bcm5325" },
337 { .compatible = "brcm,bcm5365" },
338 { .compatible = "brcm,bcm5395" },
339 { .compatible = "brcm,bcm5397" },
340 { .compatible = "brcm,bcm5398" },
341 { .compatible = "brcm,bcm53115" },
342 { .compatible = "brcm,bcm53125" },
343 { .compatible = "brcm,bcm53128" },
359 MODULE_DEVICE_TABLE(spi, b53_spi_ids);
363 .name = "b53-switch",
375 MODULE_DESCRIPTION("B53 SPI access driver");