linux/drivers/mmc/core/sdio_uart.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * SDIO UART/GPS driver
 *
 * Based on drivers/serial/8250.c and drivers/serial/serial_core.c
 * by Russell King.
 *
 * Author:	Nicolas Pitre
 * Created:	June 15, 2007
 * Copyright:	MontaVista Software, Inc.
 */

/*
 * Note: Although this driver assumes a 16550A-like UART implementation,
 * it is not possible to leverage the common 8250/16550 driver, nor the
 * core UART infrastructure, as they assumes direct access to the hardware
 * registers, often under a spinlock.  This is not possible in the SDIO
 * context as SDIO access functions must be able to sleep.
 *
 * Because we need to lock the SDIO host to ensure an exclusive access to
 * the card, we simply rely on that lock to also prevent and serialize
 * concurrent access to the same port.
 */

#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/mutex.h>
#include <linux/seq_file.h>
#include <linux/serial.h>
#include <linux/serial_reg.h>
#include <linux/circ_buf.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/kfifo.h>
#include <linux/slab.h>

#include <linux/mmc/core.h>
#include <linux/mmc/card.h>
#include <linux/mmc/sdio_func.h>
#include <linux/mmc/sdio_ids.h>


#define UART_NR


#define FIFO_SIZE
#define WAKEUP_CHARS

struct uart_icount {};

struct sdio_uart_port {};

static struct sdio_uart_port *sdio_uart_table[UART_NR];
static DEFINE_SPINLOCK(sdio_uart_table_lock);

static int sdio_uart_add_port(struct sdio_uart_port *port)
{}

static struct sdio_uart_port *sdio_uart_port_get(unsigned index)
{}

static void sdio_uart_port_put(struct sdio_uart_port *port)
{}

static void sdio_uart_port_remove(struct sdio_uart_port *port)
{}

static int sdio_uart_claim_func(struct sdio_uart_port *port)
{}

static inline void sdio_uart_release_func(struct sdio_uart_port *port)
{}

static inline u8 sdio_in(struct sdio_uart_port *port, int offset)
{}

static inline void sdio_out(struct sdio_uart_port *port, int offset, int value)
{}

static unsigned int sdio_uart_get_mctrl(struct sdio_uart_port *port)
{}

static void sdio_uart_write_mctrl(struct sdio_uart_port *port,
				  unsigned int mctrl)
{}

static inline void sdio_uart_update_mctrl(struct sdio_uart_port *port,
					  unsigned int set, unsigned int clear)
{}

#define sdio_uart_set_mctrl(port, x)
#define sdio_uart_clear_mctrl(port, x)

static void sdio_uart_change_speed(struct sdio_uart_port *port,
				   struct ktermios *termios,
				   const struct ktermios *old)
{}

static void sdio_uart_start_tx(struct sdio_uart_port *port)
{}

static void sdio_uart_stop_tx(struct sdio_uart_port *port)
{}

static void sdio_uart_stop_rx(struct sdio_uart_port *port)
{}

static void sdio_uart_receive_chars(struct sdio_uart_port *port, u8 *status)
{}

static void sdio_uart_transmit_chars(struct sdio_uart_port *port)
{}

static void sdio_uart_check_modem_status(struct sdio_uart_port *port)
{}

/*
 * This handles the interrupt from one port.
 */
static void sdio_uart_irq(struct sdio_func *func)
{}

static bool uart_carrier_raised(struct tty_port *tport)
{}

/**
 *	uart_dtr_rts		-	 port helper to set uart signals
 *	@tport: tty port to be updated
 *	@active: set to turn on DTR/RTS
 *
 *	Called by the tty port helpers when the modem signals need to be
 *	adjusted during an open, close and hangup.
 */

static void uart_dtr_rts(struct tty_port *tport, bool active)
{}

/**
 *	sdio_uart_activate	-	start up hardware
 *	@tport: tty port to activate
 *	@tty: tty bound to this port
 *
 *	Activate a tty port. The port locking guarantees us this will be
 *	run exactly once per set of opens, and if successful will see the
 *	shutdown method run exactly once to match. Start up and shutdown are
 *	protected from each other by the internal locking and will not run
 *	at the same time even during a hangup event.
 *
 *	If we successfully start up the port we take an extra kref as we
 *	will keep it around until shutdown when the kref is dropped.
 */

static int sdio_uart_activate(struct tty_port *tport, struct tty_struct *tty)
{}

/**
 *	sdio_uart_shutdown	-	stop hardware
 *	@tport: tty port to shut down
 *
 *	Deactivate a tty port. The port locking guarantees us this will be
 *	run only if a successful matching activate already ran. The two are
 *	protected from each other by the internal locking and will not run
 *	at the same time even during a hangup event.
 */

static void sdio_uart_shutdown(struct tty_port *tport)
{}

static void sdio_uart_port_destroy(struct tty_port *tport)
{}

/**
 *	sdio_uart_install	-	install method
 *	@driver: the driver in use (sdio_uart in our case)
 *	@tty: the tty being bound
 *
 *	Look up and bind the tty and the driver together. Initialize
 *	any needed private data (in our case the termios)
 */

static int sdio_uart_install(struct tty_driver *driver, struct tty_struct *tty)
{}

/**
 *	sdio_uart_cleanup	-	called on the last tty kref drop
 *	@tty: the tty being destroyed
 *
 *	Called asynchronously when the last reference to the tty is dropped.
 *	We cannot destroy the tty->driver_data port kref until this point
 */

static void sdio_uart_cleanup(struct tty_struct *tty)
{}

/*
 *	Open/close/hangup is now entirely boilerplate
 */

static int sdio_uart_open(struct tty_struct *tty, struct file *filp)
{}

static void sdio_uart_close(struct tty_struct *tty, struct file * filp)
{}

static void sdio_uart_hangup(struct tty_struct *tty)
{}

static ssize_t sdio_uart_write(struct tty_struct *tty, const u8 *buf,
			      size_t count)
{}

static unsigned int sdio_uart_write_room(struct tty_struct *tty)
{}

static unsigned int sdio_uart_chars_in_buffer(struct tty_struct *tty)
{}

static void sdio_uart_send_xchar(struct tty_struct *tty, u8 ch)
{}

static void sdio_uart_throttle(struct tty_struct *tty)
{}

static void sdio_uart_unthrottle(struct tty_struct *tty)
{}

static void sdio_uart_set_termios(struct tty_struct *tty,
				  const struct ktermios *old_termios)
{}

static int sdio_uart_break_ctl(struct tty_struct *tty, int break_state)
{}

static int sdio_uart_tiocmget(struct tty_struct *tty)
{}

static int sdio_uart_tiocmset(struct tty_struct *tty,
			      unsigned int set, unsigned int clear)
{}

static int sdio_uart_proc_show(struct seq_file *m, void *v)
{}

static const struct tty_port_operations sdio_uart_port_ops =;

static const struct tty_operations sdio_uart_ops =;

static struct tty_driver *sdio_uart_tty_driver;

static int sdio_uart_probe(struct sdio_func *func,
			   const struct sdio_device_id *id)
{}

static void sdio_uart_remove(struct sdio_func *func)
{}

static const struct sdio_device_id sdio_uart_ids[] =;

MODULE_DEVICE_TABLE(sdio, sdio_uart_ids);

static struct sdio_driver sdio_uart_driver =;

static int __init sdio_uart_init(void)
{}

static void __exit sdio_uart_exit(void)
{}

module_init();
module_exit(sdio_uart_exit);

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();