// SPDX-License-Identifier: GPL-2.0/**************************************************************************** * * Driver for the IFX 6x60 spi modem. * * Copyright (C) 2008 Option International * Copyright (C) 2008 Filip Aben <f.aben@option.com> * Denis Joseph Barrow <d.barow@option.com> * Jan Dumon <j.dumon@option.com> * * Copyright (C) 2009, 2010 Intel Corp * Russ Gorby <russ.gorby@intel.com> * * Driver modified by Intel from Option gtm501l_spi.c * * Notes * o The driver currently assumes a single device only. If you need to * change this then look for saved_ifx_dev and add a device lookup * o The driver is intended to be big-endian safe but has never been * tested that way (no suitable hardware). There are a couple of FIXME * notes by areas that may need addressing * o Some of the GPIO naming/setup assumptions may need revisiting if * you need to use this driver for another platform. * *****************************************************************************/#include<linux/dma-mapping.h>#include<linux/module.h>#include<linux/termios.h>#include<linux/tty.h>#include<linux/device.h>#include<linux/spi/spi.h>#include<linux/kfifo.h>#include<linux/tty_flip.h>#include<linux/timer.h>#include<linux/serial.h>#include<linux/interrupt.h>#include<linux/irq.h>#include<linux/rfkill.h>#include<linux/fs.h>#include<linux/ip.h>#include<linux/dmapool.h>#include<linux/gpio/consumer.h>#include<linux/sched.h>#include<linux/time.h>#include<linux/wait.h>#include<linux/pm.h>#include<linux/pm_runtime.h>#include<linux/spi/ifx_modem.h>#include<linux/delay.h>#include<linux/reboot.h>#include"ifx6x60.h"#define IFX_SPI_MORE_MASK 0x10#define IFX_SPI_MORE_BIT 4 /* bit position in u8 */#define IFX_SPI_CTS_BIT 6 /* bit position in u8 */#define IFX_SPI_MODE SPI_MODE_1#define IFX_SPI_TTY_ID 0#define IFX_SPI_TIMEOUT_SEC 2#define IFX_SPI_HEADER_0 (-1)#define IFX_SPI_HEADER_F (-2)#define PO_POST_DELAY 200/* forward reference */staticvoidifx_spi_handle_srdy(structifx_spi_device*ifx_dev);staticintifx_modem_reboot_callback(structnotifier_block*nfb,unsignedlongevent,void*data);staticintifx_modem_power_off(structifx_spi_device*ifx_dev);/* local variables */staticintspi_bpw=16;/* 8, 16 or 32 bit word length */staticstructtty_driver*tty_drv;staticstructifx_spi_device*saved_ifx_dev;staticstructlock_class_keyifx_spi_key;staticstructnotifier_blockifx_modem_reboot_notifier_block={.notifier_call=ifx_modem_reboot_callback,};staticintifx_modem_power_off(structifx_spi_device*ifx_dev)