/* * SC16IS7xx tty serial driver - Copyright (C) 2014 GridPoint * Author: Jon Ringle <jringle@gridpoint.com> * * Based on max310x.c, by Alexander Shiyan <shc_work@mail.ru> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * */#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt#include<linux/bitops.h>#include<linux/clk.h>#include<linux/delay.h>#include<linux/device.h>#include<linux/gpio.h>#include<linux/i2c.h>#include<linux/module.h>#include<linux/of.h>#include<linux/of_device.h>#include<linux/regmap.h>#include<linux/serial_core.h>#include<linux/serial.h>#include<linux/tty.h>#include<linux/tty_flip.h>#include<linux/spi/spi.h>#include<linux/uaccess.h>#define SC16IS7XX_NAME "sc16is7xx"#define SC16IS7XX_MAX_DEVS 8/* SC16IS7XX register definitions */#define SC16IS7XX_RHR_REG (0x00) /* RX FIFO */#define SC16IS7XX_THR_REG (0x00) /* TX FIFO */#define SC16IS7XX_IER_REG (0x01) /* Interrupt enable */#define SC16IS7XX_IIR_REG (0x02) /* Interrupt Identification */#define SC16IS7XX_FCR_REG (0x02) /* FIFO control */#define SC16IS7XX_LCR_REG (0x03) /* Line Control */#define SC16IS7XX_MCR_REG (0x04) /* Modem Control */#define SC16IS7XX_LSR_REG (0x05) /* Line Status */#define SC16IS7XX_MSR_REG (0x06) /* Modem Status */#define SC16IS7XX_SPR_REG (0x07) /* Scratch Pad */#define SC16IS7XX_TXLVL_REG (0x08) /* TX FIFO level */#define SC16IS7XX_RXLVL_REG (0x09) /* RX FIFO level */#define SC16IS7XX_IODIR_REG (0x0a) /* I/O Direction * - only on 75x/76x */#define SC16IS7XX_IOSTATE_REG (0x0b) /* I/O State * - only on 75x/76x */#define SC16IS7XX_IOINTENA_REG (0x0c) /* I/O Interrupt Enable * - only on 75x/76x */#define SC16IS7XX_IOCONTROL_REG (0x0e) /* I/O Control * - only on 75x/76x */#define SC16IS7XX_EFCR_REG (0x0f) /* Extra Features Control *//* TCR/TLR Register set: Only if ((MCR[2] == 1) && (EFR[4] == 1)) */#define SC16IS7XX_TCR_REG (0x06) /* Transmit control */#define SC16IS7XX_TLR_REG (0x07) /* Trigger level *//* Special Register set: Only if ((LCR[7] == 1) && (LCR != 0xBF)) */#define SC16IS7XX_DLL_REG (0x00) /* Divisor Latch Low */#define SC16IS7XX_DLH_REG (0x01) /* Divisor Latch High *//* Enhanced Register set: Only if (LCR == 0xBF) */#define SC16IS7XX_EFR_REG (0x02)