16 #include <linux/kernel.h>
25 #include <linux/module.h>
39 #define SCSPTR(sp) (sp->membase + 0x1c)
40 #define PIN_SCK (1 << 2)
41 #define PIN_TXD (1 << 0)
42 #define PIN_RXD PIN_TXD
43 #define PIN_INIT ((1 << 1) | (1 << 3) | PIN_SCK | PIN_TXD)
68 static inline void setmosi(
struct spi_device *dev,
int on)
80 #define spidelay(x) ndelay(x)
87 return bitbang_txrx_be_cpha0(spi, nsecs, 0, 0, word, bits);
93 return bitbang_txrx_be_cpha1(spi, nsecs, 0, 0, word, bits);
99 return bitbang_txrx_be_cpha0(spi, nsecs, 1, 0, word, bits);
105 return bitbang_txrx_be_cpha1(spi, nsecs, 1, 0, word, bits);
112 if (sp->
info && sp->
info->chip_select)
124 if (master ==
NULL) {
125 dev_err(&dev->
dev,
"failed to allocate spi master\n");
130 sp = spi_master_get_devdata(master);
132 platform_set_drvdata(dev, sp);
133 sp->
info = dev->
dev.platform_data;
136 sp->
bitbang.master = spi_master_get(master);
138 sp->
bitbang.master->num_chipselect = sp->
info->num_chipselect;
139 sp->
bitbang.chipselect = sh_sci_spi_chipselect;
166 spi_master_put(sp->
bitbang.master);
173 struct sh_sci_spi *sp = platform_get_drvdata(dev);
178 spi_master_put(sp->
bitbang.master);
183 .probe = sh_sci_spi_probe,
184 .remove = sh_sci_spi_remove,
186 .name =
"spi_sh_sci",