20 #include <linux/kernel.h>
23 #include <linux/module.h>
24 #include <linux/device.h>
25 #include <linux/parport.h>
27 #include <linux/sched.h>
46 #define butterfly_nreset (1 << 1)
48 #define spi_sck_bit (1 << 0)
49 #define spi_mosi_bit (1 << 7)
51 #define vcc_bits ((1 << 6) | (1 << 5))
54 #define spi_miso_bit PARPORT_STATUS_BUSY
57 #define spi_cs_bit PARPORT_CONTROL_SELECT
103 struct butterfly *pp = spidev_to_pp(spi);
116 static inline int getmiso(
struct spi_device *spi)
118 struct butterfly *pp = spidev_to_pp(spi);
129 static void butterfly_chipselect(
struct spi_device *spi,
int value)
131 struct butterfly *pp = spidev_to_pp(spi);
150 #define spidelay(X) do{}while(0)
156 butterfly_txrx_word_mode0(
struct spi_device *spi,
160 return bitbang_txrx_be_cpha0(spi, nsecs, 0, 0, word, bits);
174 .name =
"bookkeeping",
176 .size = (8 + 248) * 264,
182 .name =
"filesystem",
188 .name =
"butterflash",
197 static void butterfly_attach(
struct parport *
p)
201 struct butterfly *
pp;
205 if (butterfly || !dev)
217 pp = spi_master_get_devdata(master);
228 pp->
bitbang.master = spi_master_get(master);
229 pp->
bitbang.chipselect = butterfly_chipselect;
282 pp->
info[0].max_speed_hz = 15 * 1000 * 1000;
283 strcpy(pp->
info[0].modalias,
"mtd_dataflash");
285 pp->
info[0].chip_select = 1;
286 pp->
info[0].controller_data =
pp;
307 pr_debug(
"%s: butterfly probe, fail %d\n", p->
name, status);
310 static void butterfly_detach(
struct parport *p)
312 struct butterfly *
pp;
319 if (!butterfly || butterfly->
port != p)
338 .name =
"spi_butterfly",
339 .attach = butterfly_attach,
340 .detach = butterfly_detach,
344 static int __init butterfly_init(
void)
350 static void __exit butterfly_exit(
void)