Lines Matching +full:txrx +full:- +full:3
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * parport-to-butterfly adapter
31 #define butterfly_nreset (1 << 1) /* pin 3 */
46 return spi->controller_data; in spidev_to_pp()
64 /*----------------------------------------------------------------------*/
70 u8 bit, byte = pp->lastbyte; in setsck()
78 parport_write_data(pp->port, byte); in setsck()
79 pp->lastbyte = byte; in setsck()
86 u8 bit, byte = pp->lastbyte; in setmosi()
94 parport_write_data(pp->port, byte); in setmosi()
95 pp->lastbyte = byte; in setmosi()
107 value = !(parport_read_status(pp->port) & bit); in getmiso()
117 setsck(spi, spi->mode & SPI_CPOL); in butterfly_chipselect()
126 parport_frob_control(pp->port, spi_cs_bit, value ? spi_cs_bit : 0); in butterfly_chipselect()
134 #include "spi-bitbang-txrx.h"
143 /*----------------------------------------------------------------------*/
160 * sectors 3-5 = 512 pages * 264 bytes/page
182 struct device *dev = p->physport->dev; in butterfly_attach()
194 status = -ENOMEM; in butterfly_attach()
205 host->bus_num = 42; in butterfly_attach()
206 host->num_chipselect = 2; in butterfly_attach()
208 pp->bitbang.master = host; in butterfly_attach()
209 pp->bitbang.chipselect = butterfly_chipselect; in butterfly_attach()
210 pp->bitbang.txrx_word[SPI_MODE_0] = butterfly_txrx_word_mode0; in butterfly_attach()
215 pp->port = p; in butterfly_attach()
220 status = -ENOMEM; in butterfly_attach()
223 pp->pd = pd; in butterfly_attach()
232 pr_debug("%s: powerup/reset Butterfly\n", p->name); in butterfly_attach()
235 parport_frob_control(pp->port, spi_cs_bit, 0); in butterfly_attach()
240 pp->lastbyte |= vcc_bits; in butterfly_attach()
241 parport_write_data(pp->port, pp->lastbyte); in butterfly_attach()
245 pp->lastbyte |= butterfly_nreset; in butterfly_attach()
246 parport_write_data(pp->port, pp->lastbyte); in butterfly_attach()
252 status = spi_bitbang_start(&pp->bitbang); in butterfly_attach()
261 pp->info[0].max_speed_hz = 15 * 1000 * 1000; in butterfly_attach()
262 strcpy(pp->info[0].modalias, "mtd_dataflash"); in butterfly_attach()
263 pp->info[0].platform_data = &flash; in butterfly_attach()
264 pp->info[0].chip_select = 1; in butterfly_attach()
265 pp->info[0].controller_data = pp; in butterfly_attach()
266 pp->dataflash = spi_new_device(pp->bitbang.master, &pp->info[0]); in butterfly_attach()
267 if (pp->dataflash) in butterfly_attach()
268 pr_debug("%s: dataflash at %s\n", p->name, in butterfly_attach()
269 dev_name(&pp->dataflash->dev)); in butterfly_attach()
271 pr_info("%s: AVR Butterfly\n", p->name); in butterfly_attach()
277 parport_write_data(pp->port, 0); in butterfly_attach()
279 parport_release(pp->pd); in butterfly_attach()
285 pr_debug("%s: butterfly probe, fail %d\n", p->name, status); in butterfly_attach()
294 * "old school" driver-internal device lists? in butterfly_detach()
296 if (!butterfly || butterfly->port != p) in butterfly_detach()
302 spi_bitbang_stop(&pp->bitbang); in butterfly_detach()
305 parport_write_data(pp->port, 0); in butterfly_detach()
308 parport_release(pp->pd); in butterfly_detach()
309 parport_unregister_device(pp->pd); in butterfly_detach()
311 spi_controller_put(pp->bitbang.master); in butterfly_detach()