linux/drivers/spi/spi-butterfly.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * parport-to-butterfly adapter
 *
 * Copyright (C) 2005 David Brownell
 */
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/parport.h>

#include <linux/sched.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi_bitbang.h>
#include <linux/spi/flash.h>

#include <linux/mtd/partitions.h>

/*
 * This uses SPI to talk with an "AVR Butterfly", which is a $US20 card
 * with a battery powered AVR microcontroller and lots of goodies.  You
 * can use GCC to develop firmware for this.
 *
 * See Documentation/spi/butterfly.rst for information about how to build
 * and use this custom parallel port cable.
 */

/* DATA output bits (pins 2..9 == D0..D7) */
#define butterfly_nreset

#define spi_sck_bit
#define spi_mosi_bit

#define vcc_bits

/* STATUS input bits */
#define spi_miso_bit

/* CONTROL output bits */
#define spi_cs_bit

static inline struct butterfly *spidev_to_pp(struct spi_device *spi)
{}

struct butterfly {};

/*----------------------------------------------------------------------*/

static inline void
setsck(struct spi_device *spi, int is_on)
{}

static inline void
setmosi(struct spi_device *spi, int is_on)
{}

static inline int getmiso(struct spi_device *spi)
{}

static void butterfly_chipselect(struct spi_device *spi, int value)
{}

/* we only needed to implement one mode here, and choose SPI_MODE_0 */

#define spidelay(X)
/* #define spidelay	ndelay */

#include "spi-bitbang-txrx.h"

static u32
butterfly_txrx_word_mode0(struct spi_device *spi, unsigned nsecs, u32 word,
			  u8 bits, unsigned flags)
{}

/*----------------------------------------------------------------------*/

/* override default partitioning with cmdlinepart */
static struct mtd_partition partitions[] =;

static struct flash_platform_data flash =;

/* REVISIT remove this ugly global and its "only one" limitation */
static struct butterfly *butterfly;

static void butterfly_attach(struct parport *p)
{}

static void butterfly_detach(struct parport *p)
{}

static struct parport_driver butterfly_driver =;
module_parport_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();