mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
TTY/Serial driver changes for 6.6-rc1
Here is the big set of tty and serial driver changes for 6.6-rc1. Lots of cleanups in here this cycle, and some driver updates. Short summary is: - Jiri's continued work to make the tty code and apis be a bit more sane with regards to modern kernel coding style and types - cpm_uart driver updates - n_gsm updates and fixes - meson driver updates - sc16is7xx driver updates - 8250 driver updates for different hardware types - qcom-geni driver fixes - tegra serial driver change - stm32 driver updates - synclink_gt driver cleanups - tty structure size reduction All of these have been in linux-next this week with no reported issues. The last bit of cleanups from Jiri and the tty structure size reduction came in last week, a bit late but as they were just style changes and size reductions, I figured they should get into this merge cycle so that others can work on top of them with no merge conflicts. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -----BEGIN PGP SIGNATURE----- iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCZPH+jA8cZ3JlZ0Brcm9h aC5jb20ACgkQMUfUDdst+ykKyACgldt6QeenTN+6dXIHS/eQHtTKZwMAn3arSeXI QrUUnLFjOWyoX87tbMBQ =LVw0 -----END PGP SIGNATURE----- Merge tag 'tty-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty Pull tty/serial driver updates from Greg KH: "Here is the big set of tty and serial driver changes for 6.6-rc1. Lots of cleanups in here this cycle, and some driver updates. Short summary is: - Jiri's continued work to make the tty code and apis be a bit more sane with regards to modern kernel coding style and types - cpm_uart driver updates - n_gsm updates and fixes - meson driver updates - sc16is7xx driver updates - 8250 driver updates for different hardware types - qcom-geni driver fixes - tegra serial driver change - stm32 driver updates - synclink_gt driver cleanups - tty structure size reduction All of these have been in linux-next this week with no reported issues. The last bit of cleanups from Jiri and the tty structure size reduction came in last week, a bit late but as they were just style changes and size reductions, I figured they should get into this merge cycle so that others can work on top of them with no merge conflicts" * tag 'tty-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (199 commits) tty: shrink the size of struct tty_struct by 40 bytes tty: n_tty: deduplicate copy code in n_tty_receive_buf_real_raw() tty: n_tty: extract ECHO_OP processing to a separate function tty: n_tty: unify counts to size_t tty: n_tty: use u8 for chars and flags tty: n_tty: simplify chars_in_buffer() tty: n_tty: remove unsigned char casts from character constants tty: n_tty: move newline handling to a separate function tty: n_tty: move canon handling to a separate function tty: n_tty: use MASK() for masking out size bits tty: n_tty: make n_tty_data::num_overrun unsigned tty: n_tty: use time_is_before_jiffies() in n_tty_receive_overrun() tty: n_tty: use 'num' for writes' counts tty: n_tty: use output character directly tty: n_tty: make flow of n_tty_receive_buf_common() a bool Revert "tty: serial: meson: Add a earlycon for the T7 SoC" Documentation: devices.txt: Fix minors for ttyCPM* Documentation: devices.txt: Remove ttySIOC* Documentation: devices.txt: Remove ttyIOC* serial: 8250_bcm7271: improve bcm7271 8250 port ...
This commit is contained in:
commit
8e1e49550d
@ -2691,18 +2691,9 @@
|
||||
45 = /dev/ttyMM1 Marvell MPSC - port 1 (obsolete unused)
|
||||
46 = /dev/ttyCPM0 PPC CPM (SCC or SMC) - port 0
|
||||
...
|
||||
49 = /dev/ttyCPM5 PPC CPM (SCC or SMC) - port 3
|
||||
50 = /dev/ttyIOC0 Altix serial card
|
||||
...
|
||||
81 = /dev/ttyIOC31 Altix serial card
|
||||
51 = /dev/ttyCPM5 PPC CPM (SCC or SMC) - port 5
|
||||
82 = /dev/ttyVR0 NEC VR4100 series SIU
|
||||
83 = /dev/ttyVR1 NEC VR4100 series DSIU
|
||||
84 = /dev/ttyIOC84 Altix ioc4 serial card
|
||||
...
|
||||
115 = /dev/ttyIOC115 Altix ioc4 serial card
|
||||
116 = /dev/ttySIOC0 Altix ioc3 serial card
|
||||
...
|
||||
147 = /dev/ttySIOC31 Altix ioc3 serial card
|
||||
148 = /dev/ttyPSC0 PPC PSC - port 0
|
||||
...
|
||||
153 = /dev/ttyPSC5 PPC PSC - port 5
|
||||
@ -2761,10 +2752,7 @@
|
||||
43 = /dev/ttycusmx2 Callout device for ttySMX2
|
||||
46 = /dev/cucpm0 Callout device for ttyCPM0
|
||||
...
|
||||
49 = /dev/cucpm5 Callout device for ttyCPM5
|
||||
50 = /dev/cuioc40 Callout device for ttyIOC40
|
||||
...
|
||||
81 = /dev/cuioc431 Callout device for ttyIOC431
|
||||
51 = /dev/cucpm5 Callout device for ttyCPM5
|
||||
82 = /dev/cuvr0 Callout device for ttyVR0
|
||||
83 = /dev/cuvr1 Callout device for ttyVR1
|
||||
|
||||
|
@ -33,6 +33,7 @@ properties:
|
||||
- amlogic,meson8b-uart
|
||||
- amlogic,meson-gx-uart
|
||||
- amlogic,meson-s4-uart
|
||||
- amlogic,meson-a1-uart
|
||||
- const: amlogic,meson-ao-uart
|
||||
- description: Always-on power domain UART controller on G12A SoCs
|
||||
items:
|
||||
@ -46,10 +47,15 @@ properties:
|
||||
- amlogic,meson8b-uart
|
||||
- amlogic,meson-gx-uart
|
||||
- amlogic,meson-s4-uart
|
||||
- amlogic,meson-a1-uart
|
||||
- description: Everything-Else power domain UART controller on G12A SoCs
|
||||
items:
|
||||
- const: amlogic,meson-g12a-uart
|
||||
- const: amlogic,meson-gx-uart
|
||||
- description: UART controller on S4 compatible SoCs
|
||||
items:
|
||||
- const: amlogic,t7-uart
|
||||
- const: amlogic,meson-s4-uart
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
@ -25,9 +25,13 @@ properties:
|
||||
- fsl,imxrt1050-lpuart
|
||||
- items:
|
||||
- enum:
|
||||
- fsl,imx93-lpuart
|
||||
- fsl,imx8ulp-lpuart
|
||||
- const: fsl,imx7ulp-lpuart
|
||||
- items:
|
||||
- enum:
|
||||
- fsl,imx93-lpuart
|
||||
- const: fsl,imx8ulp-lpuart
|
||||
- const: fsl,imx7ulp-lpuart
|
||||
- items:
|
||||
- enum:
|
||||
- fsl,imx8qm-lpuart
|
||||
|
@ -23,6 +23,9 @@ Optional properties:
|
||||
1 = active low.
|
||||
- irda-mode-ports: An array that lists the indices of the port that
|
||||
should operate in IrDA mode.
|
||||
- nxp,modem-control-line-ports: An array that lists the indices of the port that
|
||||
should have shared GPIO lines configured as
|
||||
modem control lines.
|
||||
|
||||
Example:
|
||||
sc16is750: sc16is750@51 {
|
||||
@ -35,6 +38,26 @@ Example:
|
||||
#gpio-cells = <2>;
|
||||
};
|
||||
|
||||
sc16is752: sc16is752@53 {
|
||||
compatible = "nxp,sc16is752";
|
||||
reg = <0x53>;
|
||||
clocks = <&clk20m>;
|
||||
interrupt-parent = <&gpio3>;
|
||||
interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
|
||||
nxp,modem-control-line-ports = <1>; /* Port 1 as modem control lines */
|
||||
gpio-controller; /* Port 0 as GPIOs */
|
||||
#gpio-cells = <2>;
|
||||
};
|
||||
|
||||
sc16is752: sc16is752@54 {
|
||||
compatible = "nxp,sc16is752";
|
||||
reg = <0x54>;
|
||||
clocks = <&clk20m>;
|
||||
interrupt-parent = <&gpio3>;
|
||||
interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
|
||||
nxp,modem-control-line-ports = <0 1>; /* Ports 0 and 1 as modem control lines */
|
||||
};
|
||||
|
||||
* spi as bus
|
||||
|
||||
Required properties:
|
||||
@ -59,6 +82,9 @@ Optional properties:
|
||||
1 = active low.
|
||||
- irda-mode-ports: An array that lists the indices of the port that
|
||||
should operate in IrDA mode.
|
||||
- nxp,modem-control-line-ports: An array that lists the indices of the port that
|
||||
should have shared GPIO lines configured as
|
||||
modem control lines.
|
||||
|
||||
Example:
|
||||
sc16is750: sc16is750@0 {
|
||||
@ -70,3 +96,23 @@ Example:
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
};
|
||||
|
||||
sc16is752: sc16is752@1 {
|
||||
compatible = "nxp,sc16is752";
|
||||
reg = <1>;
|
||||
clocks = <&clk20m>;
|
||||
interrupt-parent = <&gpio3>;
|
||||
interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
|
||||
nxp,modem-control-line-ports = <1>; /* Port 1 as modem control lines */
|
||||
gpio-controller; /* Port 0 as GPIOs */
|
||||
#gpio-cells = <2>;
|
||||
};
|
||||
|
||||
sc16is752: sc16is752@2 {
|
||||
compatible = "nxp,sc16is752";
|
||||
reg = <2>;
|
||||
clocks = <&clk20m>;
|
||||
interrupt-parent = <&gpio3>;
|
||||
interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
|
||||
nxp,modem-control-line-ports = <0 1>; /* Ports 0 and 1 as modem control lines */
|
||||
};
|
||||
|
@ -117,7 +117,6 @@ properties:
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- interrupts
|
||||
|
||||
unevaluatedProperties: false
|
||||
|
||||
|
@ -15,10 +15,13 @@ Flip Buffer Management
|
||||
======================
|
||||
|
||||
.. kernel-doc:: drivers/tty/tty_buffer.c
|
||||
:identifiers: tty_prepare_flip_string tty_insert_flip_string_fixed_flag
|
||||
tty_insert_flip_string_flags __tty_insert_flip_char
|
||||
:identifiers: tty_prepare_flip_string
|
||||
tty_flip_buffer_push tty_ldisc_receive_buf
|
||||
|
||||
.. kernel-doc:: include/linux/tty_flip.h
|
||||
:identifiers: tty_insert_flip_string_fixed_flag tty_insert_flip_string_flags
|
||||
tty_insert_flip_char
|
||||
|
||||
----
|
||||
|
||||
Other Functions
|
||||
|
@ -421,7 +421,7 @@ register_cpus(void)
|
||||
arch_initcall(register_cpus);
|
||||
|
||||
#ifdef CONFIG_MAGIC_SYSRQ
|
||||
static void sysrq_reboot_handler(int unused)
|
||||
static void sysrq_reboot_handler(u8 unused)
|
||||
{
|
||||
machine_halt();
|
||||
}
|
||||
|
@ -129,9 +129,8 @@ srmcons_do_write(struct tty_port *port, const char *buf, int count)
|
||||
return count;
|
||||
}
|
||||
|
||||
static int
|
||||
srmcons_write(struct tty_struct *tty,
|
||||
const unsigned char *buf, int count)
|
||||
static ssize_t
|
||||
srmcons_write(struct tty_struct *tty, const u8 *buf, size_t count)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
|
@ -108,7 +108,7 @@
|
||||
};
|
||||
|
||||
uart_AO: serial@1c00 {
|
||||
compatible = "amlogic,meson-gx-uart",
|
||||
compatible = "amlogic,meson-a1-uart",
|
||||
"amlogic,meson-ao-uart";
|
||||
reg = <0x0 0x1c00 0x0 0x18>;
|
||||
interrupts = <GIC_SPI 25 IRQ_TYPE_EDGE_RISING>;
|
||||
@ -118,7 +118,7 @@
|
||||
};
|
||||
|
||||
uart_AO_B: serial@2000 {
|
||||
compatible = "amlogic,meson-gx-uart",
|
||||
compatible = "amlogic,meson-a1-uart",
|
||||
"amlogic,meson-ao-uart";
|
||||
reg = <0x0 0x2000 0x0 0x18>;
|
||||
interrupts = <GIC_SPI 26 IRQ_TYPE_EDGE_RISING>;
|
||||
|
@ -43,7 +43,7 @@ static void sysrq_tlbdump_othercpus(struct work_struct *dummy)
|
||||
static DECLARE_WORK(sysrq_tlbdump, sysrq_tlbdump_othercpus);
|
||||
#endif
|
||||
|
||||
static void sysrq_handle_tlbdump(int key)
|
||||
static void sysrq_handle_tlbdump(u8 key)
|
||||
{
|
||||
sysrq_tlbdump_single(NULL);
|
||||
#ifdef CONFIG_SMP
|
||||
|
@ -70,16 +70,16 @@ static void nfcon_tty_close(struct tty_struct *tty, struct file *filp)
|
||||
{
|
||||
}
|
||||
|
||||
static int nfcon_tty_write(struct tty_struct *tty, const unsigned char *buf,
|
||||
int count)
|
||||
static ssize_t nfcon_tty_write(struct tty_struct *tty, const u8 *buf,
|
||||
size_t count)
|
||||
{
|
||||
nfputs(buf, count);
|
||||
return count;
|
||||
}
|
||||
|
||||
static int nfcon_tty_put_char(struct tty_struct *tty, unsigned char ch)
|
||||
static int nfcon_tty_put_char(struct tty_struct *tty, u8 ch)
|
||||
{
|
||||
char temp[2] = { ch, 0 };
|
||||
u8 temp[2] = { ch, 0 };
|
||||
|
||||
nf_call(stderr_id, virt_to_phys(temp));
|
||||
return 1;
|
||||
|
@ -44,7 +44,7 @@ static void sysrq_tlbdump_othercpus(struct work_struct *dummy)
|
||||
static DECLARE_WORK(sysrq_tlbdump, sysrq_tlbdump_othercpus);
|
||||
#endif
|
||||
|
||||
static void sysrq_handle_tlbdump(int key)
|
||||
static void sysrq_handle_tlbdump(u8 key)
|
||||
{
|
||||
sysrq_tlbdump_single(NULL);
|
||||
#ifdef CONFIG_SMP
|
||||
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Platform information definitions.
|
||||
*
|
||||
* 2006 (c) MontaVista Software, Inc.
|
||||
* Vitaly Bordug <vbordug@ru.mvista.com>
|
||||
*
|
||||
* This file is licensed under the terms of the GNU General Public License
|
||||
* version 2. This program is licensed "as is" without any warranty of any
|
||||
* kind, whether express or implied.
|
||||
*/
|
||||
|
||||
#ifndef FS_PD_H
|
||||
#define FS_PD_H
|
||||
#include <sysdev/fsl_soc.h>
|
||||
#include <asm/time.h>
|
||||
|
||||
static inline int uart_baudrate(void)
|
||||
{
|
||||
return get_baudrate();
|
||||
}
|
||||
|
||||
static inline int uart_clock(void)
|
||||
{
|
||||
return ppc_proc_freq;
|
||||
}
|
||||
|
||||
#endif
|
@ -21,7 +21,6 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
#include <linux/fs_uart_pd.h>
|
||||
#include <linux/fsl_devices.h>
|
||||
#include <linux/mii.h>
|
||||
#include <linux/of_address.h>
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
#include <linux/fs_uart_pd.h>
|
||||
#include <linux/fsl_devices.h>
|
||||
#include <linux/mii.h>
|
||||
#include <linux/of_fdt.h>
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include <linux/phy.h>
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/fsl_devices.h>
|
||||
#include <linux/fs_uart_pd.h>
|
||||
#include <linux/reboot.h>
|
||||
|
||||
#include <linux/atomic.h>
|
||||
@ -35,7 +34,6 @@
|
||||
#include <asm/cpm2.h>
|
||||
#include <asm/fsl_hcalls.h> /* For the Freescale hypervisor */
|
||||
|
||||
extern void init_smc_ioports(struct fs_uart_platform_info*);
|
||||
static phys_addr_t immrbase = -1;
|
||||
|
||||
phys_addr_t get_immrbase(void)
|
||||
|
@ -3988,7 +3988,7 @@ static void xmon_init(int enable)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MAGIC_SYSRQ
|
||||
static void sysrq_handle_xmon(int key)
|
||||
static void sysrq_handle_xmon(u8 key)
|
||||
{
|
||||
if (xmon_is_locked_down()) {
|
||||
clear_all_bpt();
|
||||
|
@ -284,7 +284,7 @@ struct vio_dring_state {
|
||||
struct ldc_trans_cookie cookies[VIO_MAX_RING_COOKIES];
|
||||
};
|
||||
|
||||
#define VIO_TAG_SIZE ((int)sizeof(struct vio_msg_tag))
|
||||
#define VIO_TAG_SIZE (sizeof(struct vio_msg_tag))
|
||||
#define VIO_VCC_MTU_SIZE (LDC_PACKET_SIZE - VIO_TAG_SIZE)
|
||||
|
||||
struct vio_vcc {
|
||||
|
@ -295,7 +295,7 @@ void arch_trigger_cpumask_backtrace(const cpumask_t *mask, int exclude_cpu)
|
||||
|
||||
#ifdef CONFIG_MAGIC_SYSRQ
|
||||
|
||||
static void sysrq_handle_globreg(int key)
|
||||
static void sysrq_handle_globreg(u8 key)
|
||||
{
|
||||
trigger_all_cpu_backtrace();
|
||||
}
|
||||
@ -370,7 +370,7 @@ static void pmu_snapshot_all_cpus(void)
|
||||
spin_unlock_irqrestore(&global_cpu_snapshot_lock, flags);
|
||||
}
|
||||
|
||||
static void sysrq_handle_globpmu(int key)
|
||||
static void sysrq_handle_globpmu(u8 key)
|
||||
{
|
||||
pmu_snapshot_all_cpus();
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ void line_flush_chars(struct tty_struct *tty)
|
||||
line_flush_buffer(tty);
|
||||
}
|
||||
|
||||
int line_write(struct tty_struct *tty, const unsigned char *buf, int len)
|
||||
ssize_t line_write(struct tty_struct *tty, const u8 *buf, size_t len)
|
||||
{
|
||||
struct line *line = tty->driver_data;
|
||||
unsigned long flags;
|
||||
|
@ -64,8 +64,7 @@ extern void line_cleanup(struct tty_struct *tty);
|
||||
extern void line_hangup(struct tty_struct *tty);
|
||||
extern int line_setup(char **conf, unsigned nlines, char **def,
|
||||
char *init, char *name);
|
||||
extern int line_write(struct tty_struct *tty, const unsigned char *buf,
|
||||
int len);
|
||||
extern ssize_t line_write(struct tty_struct *tty, const u8 *buf, size_t len);
|
||||
extern unsigned int line_chars_in_buffer(struct tty_struct *tty);
|
||||
extern void line_flush_buffer(struct tty_struct *tty);
|
||||
extern void line_flush_chars(struct tty_struct *tty);
|
||||
|
@ -52,8 +52,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
|
||||
}
|
||||
|
||||
|
||||
static int rs_write(struct tty_struct * tty,
|
||||
const unsigned char *buf, int count)
|
||||
static ssize_t rs_write(struct tty_struct * tty, const u8 *buf, size_t count)
|
||||
{
|
||||
/* see drivers/char/serialX.c to reference original version */
|
||||
|
||||
@ -82,32 +81,12 @@ static void rs_poll(struct timer_list *unused)
|
||||
mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE);
|
||||
}
|
||||
|
||||
|
||||
static int rs_put_char(struct tty_struct *tty, unsigned char ch)
|
||||
{
|
||||
return rs_write(tty, &ch, 1);
|
||||
}
|
||||
|
||||
static void rs_flush_chars(struct tty_struct *tty)
|
||||
{
|
||||
}
|
||||
|
||||
static unsigned int rs_write_room(struct tty_struct *tty)
|
||||
{
|
||||
/* Let's say iss can always accept 2K characters.. */
|
||||
return 2 * 1024;
|
||||
}
|
||||
|
||||
static void rs_hangup(struct tty_struct *tty)
|
||||
{
|
||||
/* Stub, once again.. */
|
||||
}
|
||||
|
||||
static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
|
||||
{
|
||||
/* Stub, once again.. */
|
||||
}
|
||||
|
||||
static int rs_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
seq_printf(m, "serinfo:1.0 driver:0.1\n");
|
||||
@ -118,11 +97,7 @@ static const struct tty_operations serial_ops = {
|
||||
.open = rs_open,
|
||||
.close = rs_close,
|
||||
.write = rs_write,
|
||||
.put_char = rs_put_char,
|
||||
.flush_chars = rs_flush_chars,
|
||||
.write_room = rs_write_room,
|
||||
.hangup = rs_hangup,
|
||||
.wait_until_sent = rs_wait_until_sent,
|
||||
.proc_show = rs_proc_show,
|
||||
};
|
||||
|
||||
|
@ -71,15 +71,14 @@ static void spk_ttyio_ldisc_close(struct tty_struct *tty)
|
||||
kfree(tty->disc_data);
|
||||
}
|
||||
|
||||
static int spk_ttyio_receive_buf2(struct tty_struct *tty,
|
||||
const unsigned char *cp,
|
||||
const char *fp, int count)
|
||||
static size_t spk_ttyio_receive_buf2(struct tty_struct *tty, const u8 *cp,
|
||||
const u8 *fp, size_t count)
|
||||
{
|
||||
struct spk_ldisc_data *ldisc_data = tty->disc_data;
|
||||
struct spk_synth *synth = ldisc_data->synth;
|
||||
|
||||
if (synth->read_buff_add) {
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
synth->read_buff_add(cp[i]);
|
||||
|
@ -599,7 +599,7 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty)
|
||||
* Return Value: None
|
||||
*/
|
||||
static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data,
|
||||
const char *flags, int count)
|
||||
const u8 *flags, size_t count)
|
||||
{
|
||||
struct hci_uart *hu = tty->disc_data;
|
||||
|
||||
@ -807,20 +807,14 @@ static int hci_uart_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
|
||||
* We don't provide read/write/poll interface for user space.
|
||||
*/
|
||||
static ssize_t hci_uart_tty_read(struct tty_struct *tty, struct file *file,
|
||||
unsigned char *buf, size_t nr,
|
||||
void **cookie, unsigned long offset)
|
||||
u8 *buf, size_t nr, void **cookie,
|
||||
unsigned long offset)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t hci_uart_tty_write(struct tty_struct *tty, struct file *file,
|
||||
const unsigned char *data, size_t count)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __poll_t hci_uart_tty_poll(struct tty_struct *tty,
|
||||
struct file *filp, poll_table *wait)
|
||||
const u8 *data, size_t count)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -835,7 +829,6 @@ static struct tty_ldisc_ops hci_uart_ldisc = {
|
||||
.write = hci_uart_tty_write,
|
||||
.ioctl = hci_uart_tty_ioctl,
|
||||
.compat_ioctl = hci_uart_tty_ioctl,
|
||||
.poll = hci_uart_tty_poll,
|
||||
.receive_buf = hci_uart_tty_receive,
|
||||
.write_wakeup = hci_uart_tty_wakeup,
|
||||
};
|
||||
|
@ -51,7 +51,7 @@ static void tpk_flush(void)
|
||||
}
|
||||
}
|
||||
|
||||
static int tpk_printk(const unsigned char *buf, int count)
|
||||
static int tpk_printk(const u8 *buf, int count)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -103,8 +103,7 @@ static void tpk_close(struct tty_struct *tty, struct file *filp)
|
||||
/*
|
||||
* TTY operations write function.
|
||||
*/
|
||||
static int tpk_write(struct tty_struct *tty,
|
||||
const unsigned char *buf, int count)
|
||||
static ssize_t tpk_write(struct tty_struct *tty, const u8 *buf, size_t count)
|
||||
{
|
||||
struct ttyprintk_port *tpkp = tty->driver_data;
|
||||
unsigned long flags;
|
||||
|
@ -301,7 +301,7 @@ static void drm_fb_helper_restore_work_fn(struct work_struct *ignored)
|
||||
|
||||
static DECLARE_WORK(drm_fb_helper_restore_work, drm_fb_helper_restore_work_fn);
|
||||
|
||||
static void drm_fb_helper_sysrq(int dummy1)
|
||||
static void drm_fb_helper_sysrq(u8 dummy1)
|
||||
{
|
||||
schedule_work(&drm_fb_helper_restore_work);
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ static int serport_ldisc_open(struct tty_struct *tty)
|
||||
|
||||
static void serport_ldisc_close(struct tty_struct *tty)
|
||||
{
|
||||
struct serport *serport = (struct serport *) tty->disc_data;
|
||||
struct serport *serport = tty->disc_data;
|
||||
|
||||
kfree(serport);
|
||||
}
|
||||
@ -114,10 +114,10 @@ static void serport_ldisc_close(struct tty_struct *tty)
|
||||
* 'interrupt' routine.
|
||||
*/
|
||||
|
||||
static void serport_ldisc_receive(struct tty_struct *tty,
|
||||
const unsigned char *cp, const char *fp, int count)
|
||||
static void serport_ldisc_receive(struct tty_struct *tty, const u8 *cp,
|
||||
const u8 *fp, size_t count)
|
||||
{
|
||||
struct serport *serport = (struct serport*) tty->disc_data;
|
||||
struct serport *serport = tty->disc_data;
|
||||
unsigned long flags;
|
||||
unsigned int ch_flags = 0;
|
||||
int i;
|
||||
@ -158,10 +158,10 @@ out:
|
||||
*/
|
||||
|
||||
static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file,
|
||||
unsigned char *kbuf, size_t nr,
|
||||
void **cookie, unsigned long offset)
|
||||
u8 *kbuf, size_t nr, void **cookie,
|
||||
unsigned long offset)
|
||||
{
|
||||
struct serport *serport = (struct serport*) tty->disc_data;
|
||||
struct serport *serport = tty->disc_data;
|
||||
struct serio *serio;
|
||||
|
||||
if (test_and_set_bit(SERPORT_BUSY, &serport->flags))
|
||||
@ -245,7 +245,7 @@ static int serport_ldisc_compat_ioctl(struct tty_struct *tty,
|
||||
|
||||
static void serport_ldisc_hangup(struct tty_struct *tty)
|
||||
{
|
||||
struct serport *serport = (struct serport *) tty->disc_data;
|
||||
struct serport *serport = tty->disc_data;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&serport->lock, flags);
|
||||
@ -257,7 +257,7 @@ static void serport_ldisc_hangup(struct tty_struct *tty)
|
||||
|
||||
static void serport_ldisc_write_wakeup(struct tty_struct * tty)
|
||||
{
|
||||
struct serport *serport = (struct serport *) tty->disc_data;
|
||||
struct serport *serport = tty->disc_data;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&serport->lock, flags);
|
||||
|
@ -437,8 +437,7 @@ err_put_driver:
|
||||
}
|
||||
|
||||
static inline int ipoctal_copy_write_buffer(struct ipoctal_channel *channel,
|
||||
const unsigned char *buf,
|
||||
int count)
|
||||
const u8 *buf, int count)
|
||||
{
|
||||
unsigned long flags;
|
||||
int i;
|
||||
@ -459,8 +458,8 @@ static inline int ipoctal_copy_write_buffer(struct ipoctal_channel *channel,
|
||||
return i;
|
||||
}
|
||||
|
||||
static int ipoctal_write_tty(struct tty_struct *tty,
|
||||
const unsigned char *buf, int count)
|
||||
static ssize_t ipoctal_write_tty(struct tty_struct *tty, const u8 *buf,
|
||||
size_t count)
|
||||
{
|
||||
struct ipoctal_channel *channel = tty->driver_data;
|
||||
unsigned int char_copied;
|
||||
|
@ -1077,13 +1077,13 @@ static void capinc_tty_close(struct tty_struct *tty, struct file *filp)
|
||||
tty_port_close(&mp->port, tty, filp);
|
||||
}
|
||||
|
||||
static int capinc_tty_write(struct tty_struct *tty,
|
||||
const unsigned char *buf, int count)
|
||||
static ssize_t capinc_tty_write(struct tty_struct *tty, const u8 *buf,
|
||||
size_t count)
|
||||
{
|
||||
struct capiminor *mp = tty->driver_data;
|
||||
struct sk_buff *skb;
|
||||
|
||||
pr_debug("capinc_tty_write(count=%d)\n", count);
|
||||
pr_debug("capinc_tty_write(count=%zu)\n", count);
|
||||
|
||||
spin_lock_bh(&mp->outlock);
|
||||
skb = mp->outskb;
|
||||
@ -1112,7 +1112,7 @@ static int capinc_tty_write(struct tty_struct *tty,
|
||||
return count;
|
||||
}
|
||||
|
||||
static int capinc_tty_put_char(struct tty_struct *tty, unsigned char ch)
|
||||
static int capinc_tty_put_char(struct tty_struct *tty, u8 ch)
|
||||
{
|
||||
struct capiminor *mp = tty->driver_data;
|
||||
bool invoke_send = false;
|
||||
|
@ -186,9 +186,8 @@ static void bcm_vk_tty_doorbell(struct bcm_vk *vk, u32 db_val)
|
||||
VK_BAR0_REGSEG_DB_BASE + VK_BAR0_REGSEG_TTY_DB_OFFSET);
|
||||
}
|
||||
|
||||
static int bcm_vk_tty_write(struct tty_struct *tty,
|
||||
const unsigned char *buffer,
|
||||
int count)
|
||||
static ssize_t bcm_vk_tty_write(struct tty_struct *tty, const u8 *buffer,
|
||||
size_t count)
|
||||
{
|
||||
int index;
|
||||
struct bcm_vk *vk;
|
||||
|
@ -16,14 +16,12 @@
|
||||
|
||||
#include <linux/ti_wilink_st.h>
|
||||
|
||||
extern void st_kim_recv(void *, const unsigned char *, long);
|
||||
void st_int_recv(void *, const unsigned char *, long);
|
||||
/*
|
||||
* function pointer pointing to either,
|
||||
* st_kim_recv during registration to receive fw download responses
|
||||
* st_int_recv after registration to receive proto stack responses
|
||||
*/
|
||||
static void (*st_recv) (void *, const unsigned char *, long);
|
||||
static void (*st_recv)(void *disc_data, const u8 *ptr, size_t count);
|
||||
|
||||
/********************************************************************/
|
||||
static void add_channel_to_table(struct st_data_s *st_gdata,
|
||||
@ -225,10 +223,8 @@ static inline void st_wakeup_ack(struct st_data_s *st_gdata,
|
||||
* HCI-Events, ACL, SCO, 4 types of HCI-LL PM packets
|
||||
* CH-8 packets from FM, CH-9 packets from GPS cores.
|
||||
*/
|
||||
void st_int_recv(void *disc_data,
|
||||
const unsigned char *data, long count)
|
||||
static void st_int_recv(void *disc_data, const u8 *ptr, size_t count)
|
||||
{
|
||||
char *ptr;
|
||||
struct st_proto_s *proto;
|
||||
unsigned short payload_len = 0;
|
||||
int len = 0;
|
||||
@ -237,14 +233,12 @@ void st_int_recv(void *disc_data,
|
||||
struct st_data_s *st_gdata = (struct st_data_s *)disc_data;
|
||||
unsigned long flags;
|
||||
|
||||
ptr = (char *)data;
|
||||
/* tty_receive sent null ? */
|
||||
if (unlikely(ptr == NULL) || (st_gdata == NULL)) {
|
||||
if (st_gdata == NULL) {
|
||||
pr_err(" received null from TTY ");
|
||||
return;
|
||||
}
|
||||
|
||||
pr_debug("count %ld rx_state %ld"
|
||||
pr_debug("count %zu rx_state %ld"
|
||||
"rx_count %ld", count, st_gdata->rx_state,
|
||||
st_gdata->rx_count);
|
||||
|
||||
@ -796,8 +790,8 @@ static void st_tty_close(struct tty_struct *tty)
|
||||
pr_debug("%s: done ", __func__);
|
||||
}
|
||||
|
||||
static void st_tty_receive(struct tty_struct *tty, const unsigned char *data,
|
||||
const char *tty_flags, int count)
|
||||
static void st_tty_receive(struct tty_struct *tty, const u8 *data,
|
||||
const u8 *tty_flags, size_t count)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
print_hex_dump(KERN_DEBUG, ">in>", DUMP_PREFIX_NONE,
|
||||
|
@ -127,21 +127,14 @@ static inline int kim_check_data_len(struct kim_data_s *kim_gdata, int len)
|
||||
* have been observed to come in bursts of different
|
||||
* tty_receive and hence the logic
|
||||
*/
|
||||
static void kim_int_recv(struct kim_data_s *kim_gdata,
|
||||
const unsigned char *data, long count)
|
||||
static void kim_int_recv(struct kim_data_s *kim_gdata, const u8 *ptr,
|
||||
size_t count)
|
||||
{
|
||||
const unsigned char *ptr;
|
||||
int len = 0;
|
||||
unsigned char *plen;
|
||||
|
||||
pr_debug("%s", __func__);
|
||||
/* Decode received bytes here */
|
||||
ptr = data;
|
||||
if (unlikely(ptr == NULL)) {
|
||||
pr_err(" received null from TTY ");
|
||||
return;
|
||||
}
|
||||
|
||||
while (count) {
|
||||
if (kim_gdata->rx_count) {
|
||||
len = min_t(unsigned int, kim_gdata->rx_count, count);
|
||||
@ -424,7 +417,7 @@ static long download_firmware(struct kim_data_s *kim_gdata)
|
||||
* 1. response to read local version
|
||||
* 2. during send/recv's of firmware download
|
||||
*/
|
||||
void st_kim_recv(void *disc_data, const unsigned char *data, long count)
|
||||
void st_kim_recv(void *disc_data, const u8 *data, size_t count)
|
||||
{
|
||||
struct st_data_s *st_gdata = (struct st_data_s *)disc_data;
|
||||
struct kim_data_s *kim_gdata = st_gdata->kim_data;
|
||||
|
@ -760,8 +760,8 @@ static void sdio_uart_hangup(struct tty_struct *tty)
|
||||
tty_port_hangup(&port->port);
|
||||
}
|
||||
|
||||
static int sdio_uart_write(struct tty_struct *tty, const unsigned char *buf,
|
||||
int count)
|
||||
static ssize_t sdio_uart_write(struct tty_struct *tty, const u8 *buf,
|
||||
size_t count)
|
||||
{
|
||||
struct sdio_uart_port *port = tty->driver_data;
|
||||
int ret;
|
||||
|
@ -159,7 +159,7 @@ static inline void debugfs_tx(struct ser_device *ser, const u8 *data, int size)
|
||||
#endif
|
||||
|
||||
static void ldisc_receive(struct tty_struct *tty, const u8 *data,
|
||||
const char *flags, int count)
|
||||
const u8 *flags, size_t count)
|
||||
{
|
||||
struct sk_buff *skb = NULL;
|
||||
struct ser_device *ser;
|
||||
|
@ -885,10 +885,10 @@ static bool can327_is_valid_rx_char(u8 c)
|
||||
* This will not be re-entered while running, but other ldisc
|
||||
* functions may be called in parallel.
|
||||
*/
|
||||
static void can327_ldisc_rx(struct tty_struct *tty, const unsigned char *cp,
|
||||
const char *fp, int count)
|
||||
static void can327_ldisc_rx(struct tty_struct *tty, const u8 *cp,
|
||||
const u8 *fp, size_t count)
|
||||
{
|
||||
struct can327 *elm = (struct can327 *)tty->disc_data;
|
||||
struct can327 *elm = tty->disc_data;
|
||||
size_t first_new_char_idx;
|
||||
|
||||
if (elm->uart_side_failure)
|
||||
@ -901,15 +901,17 @@ static void can327_ldisc_rx(struct tty_struct *tty, const unsigned char *cp,
|
||||
*/
|
||||
first_new_char_idx = elm->rxfill;
|
||||
|
||||
while (count-- && elm->rxfill < CAN327_SIZE_RXBUF) {
|
||||
while (count--) {
|
||||
if (elm->rxfill >= CAN327_SIZE_RXBUF) {
|
||||
netdev_err(elm->dev,
|
||||
"Receive buffer overflowed. Bad chip or wiring? count = %zu",
|
||||
count);
|
||||
goto uart_failure;
|
||||
}
|
||||
if (fp && *fp++) {
|
||||
netdev_err(elm->dev,
|
||||
"Error in received character stream. Check your wiring.");
|
||||
|
||||
can327_uart_side_failure(elm);
|
||||
|
||||
spin_unlock_bh(&elm->lock);
|
||||
return;
|
||||
goto uart_failure;
|
||||
}
|
||||
|
||||
/* Ignore NUL characters, which the PIC microcontroller may
|
||||
@ -925,10 +927,7 @@ static void can327_ldisc_rx(struct tty_struct *tty, const unsigned char *cp,
|
||||
netdev_err(elm->dev,
|
||||
"Received illegal character %02x.\n",
|
||||
*cp);
|
||||
can327_uart_side_failure(elm);
|
||||
|
||||
spin_unlock_bh(&elm->lock);
|
||||
return;
|
||||
goto uart_failure;
|
||||
}
|
||||
|
||||
elm->rxbuf[elm->rxfill++] = *cp;
|
||||
@ -937,19 +936,13 @@ static void can327_ldisc_rx(struct tty_struct *tty, const unsigned char *cp,
|
||||
cp++;
|
||||
}
|
||||
|
||||
if (count >= 0) {
|
||||
netdev_err(elm->dev,
|
||||
"Receive buffer overflowed. Bad chip or wiring? count = %i",
|
||||
count);
|
||||
|
||||
can327_uart_side_failure(elm);
|
||||
|
||||
spin_unlock_bh(&elm->lock);
|
||||
return;
|
||||
}
|
||||
|
||||
can327_parse_rxbuf(elm, first_new_char_idx);
|
||||
spin_unlock_bh(&elm->lock);
|
||||
|
||||
return;
|
||||
uart_failure:
|
||||
can327_uart_side_failure(elm);
|
||||
spin_unlock_bh(&elm->lock);
|
||||
}
|
||||
|
||||
/* Write out remaining transmit buffer.
|
||||
@ -990,7 +983,7 @@ static void can327_ldisc_tx_worker(struct work_struct *work)
|
||||
/* Called by the driver when there's room for more data. */
|
||||
static void can327_ldisc_tx_wakeup(struct tty_struct *tty)
|
||||
{
|
||||
struct can327 *elm = (struct can327 *)tty->disc_data;
|
||||
struct can327 *elm = tty->disc_data;
|
||||
|
||||
schedule_work(&elm->tx_work);
|
||||
}
|
||||
@ -1067,7 +1060,7 @@ static int can327_ldisc_open(struct tty_struct *tty)
|
||||
*/
|
||||
static void can327_ldisc_close(struct tty_struct *tty)
|
||||
{
|
||||
struct can327 *elm = (struct can327 *)tty->disc_data;
|
||||
struct can327 *elm = tty->disc_data;
|
||||
|
||||
/* unregister_netdev() calls .ndo_stop() so we don't have to. */
|
||||
unregister_candev(elm->dev);
|
||||
@ -1092,7 +1085,7 @@ static void can327_ldisc_close(struct tty_struct *tty)
|
||||
static int can327_ldisc_ioctl(struct tty_struct *tty, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
struct can327 *elm = (struct can327 *)tty->disc_data;
|
||||
struct can327 *elm = tty->disc_data;
|
||||
unsigned int tmp;
|
||||
|
||||
switch (cmd) {
|
||||
|
@ -108,11 +108,6 @@ struct ems_pci_card {
|
||||
|
||||
#define EMS_PCI_BASE_SIZE 4096 /* size of controller area */
|
||||
|
||||
#ifndef PCI_VENDOR_ID_ASIX
|
||||
#define PCI_VENDOR_ID_ASIX 0x125b
|
||||
#define PCI_DEVICE_ID_ASIX_9110 0x9110
|
||||
#define PCI_SUBVENDOR_ID_ASIX 0xa000
|
||||
#endif
|
||||
#define PCI_SUBDEVICE_ID_EMS 0x4010
|
||||
|
||||
static const struct pci_device_id ems_pci_tbl[] = {
|
||||
@ -123,7 +118,7 @@ static const struct pci_device_id ems_pci_tbl[] = {
|
||||
/* CPC-104P v2 */
|
||||
{PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030, PCI_VENDOR_ID_PLX, 0x4002},
|
||||
/* CPC-PCIe v3 */
|
||||
{PCI_VENDOR_ID_ASIX, PCI_DEVICE_ID_ASIX_9110, PCI_SUBVENDOR_ID_ASIX, PCI_SUBDEVICE_ID_EMS},
|
||||
{PCI_VENDOR_ID_ASIX, PCI_DEVICE_ID_ASIX_AX99100_LB, 0xa000, PCI_SUBDEVICE_ID_EMS},
|
||||
{0,}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(pci, ems_pci_tbl);
|
||||
|
@ -583,7 +583,7 @@ static void slcan_transmit(struct work_struct *work)
|
||||
*/
|
||||
static void slcan_write_wakeup(struct tty_struct *tty)
|
||||
{
|
||||
struct slcan *sl = (struct slcan *)tty->disc_data;
|
||||
struct slcan *sl = tty->disc_data;
|
||||
|
||||
schedule_work(&sl->tx_work);
|
||||
}
|
||||
@ -774,11 +774,10 @@ static const struct net_device_ops slcan_netdev_ops = {
|
||||
* be re-entered while running but other ldisc functions may be called
|
||||
* in parallel
|
||||
*/
|
||||
static void slcan_receive_buf(struct tty_struct *tty,
|
||||
const unsigned char *cp, const char *fp,
|
||||
int count)
|
||||
static void slcan_receive_buf(struct tty_struct *tty, const u8 *cp,
|
||||
const u8 *fp, size_t count)
|
||||
{
|
||||
struct slcan *sl = (struct slcan *)tty->disc_data;
|
||||
struct slcan *sl = tty->disc_data;
|
||||
|
||||
if (!netif_running(sl->dev))
|
||||
return;
|
||||
@ -862,7 +861,7 @@ static int slcan_open(struct tty_struct *tty)
|
||||
*/
|
||||
static void slcan_close(struct tty_struct *tty)
|
||||
{
|
||||
struct slcan *sl = (struct slcan *)tty->disc_data;
|
||||
struct slcan *sl = tty->disc_data;
|
||||
|
||||
unregister_candev(sl->dev);
|
||||
|
||||
@ -886,7 +885,7 @@ static void slcan_close(struct tty_struct *tty)
|
||||
static int slcan_ioctl(struct tty_struct *tty, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
struct slcan *sl = (struct slcan *)tty->disc_data;
|
||||
struct slcan *sl = tty->disc_data;
|
||||
unsigned int tmp;
|
||||
|
||||
switch (cmd) {
|
||||
|
@ -427,8 +427,8 @@ out:
|
||||
* a block of 6pack data has been received, which can now be decapsulated
|
||||
* and sent on to some IP layer for further processing.
|
||||
*/
|
||||
static void sixpack_receive_buf(struct tty_struct *tty,
|
||||
const unsigned char *cp, const char *fp, int count)
|
||||
static void sixpack_receive_buf(struct tty_struct *tty, const u8 *cp,
|
||||
const u8 *fp, size_t count)
|
||||
{
|
||||
struct sixpack *sp;
|
||||
int count1;
|
||||
|
@ -874,8 +874,8 @@ static int mkiss_ioctl(struct tty_struct *tty, unsigned int cmd,
|
||||
* a block of data has been received, which can now be decapsulated
|
||||
* and sent on to the AX.25 layer for further processing.
|
||||
*/
|
||||
static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp,
|
||||
const char *fp, int count)
|
||||
static void mkiss_receive_buf(struct tty_struct *tty, const u8 *cp,
|
||||
const u8 *fp, size_t count)
|
||||
{
|
||||
struct mkiss *ax = mkiss_get(tty);
|
||||
|
||||
|
@ -390,9 +390,8 @@ static void mctp_serial_push(struct mctp_serial *dev, unsigned char c)
|
||||
}
|
||||
}
|
||||
|
||||
static void mctp_serial_tty_receive_buf(struct tty_struct *tty,
|
||||
const unsigned char *c,
|
||||
const char *f, int len)
|
||||
static void mctp_serial_tty_receive_buf(struct tty_struct *tty, const u8 *c,
|
||||
const u8 *f, size_t len)
|
||||
{
|
||||
struct mctp_serial *dev = tty->disc_data;
|
||||
int i;
|
||||
|
@ -98,7 +98,7 @@ static int ppp_async_send(struct ppp_channel *chan, struct sk_buff *skb);
|
||||
static int ppp_async_push(struct asyncppp *ap);
|
||||
static void ppp_async_flush_output(struct asyncppp *ap);
|
||||
static void ppp_async_input(struct asyncppp *ap, const unsigned char *buf,
|
||||
const char *flags, int count);
|
||||
const u8 *flags, int count);
|
||||
static int ppp_async_ioctl(struct ppp_channel *chan, unsigned int cmd,
|
||||
unsigned long arg);
|
||||
static void ppp_async_process(struct tasklet_struct *t);
|
||||
@ -257,9 +257,8 @@ static void ppp_asynctty_hangup(struct tty_struct *tty)
|
||||
* Pppd reads and writes packets via /dev/ppp instead.
|
||||
*/
|
||||
static ssize_t
|
||||
ppp_asynctty_read(struct tty_struct *tty, struct file *file,
|
||||
unsigned char *buf, size_t count,
|
||||
void **cookie, unsigned long offset)
|
||||
ppp_asynctty_read(struct tty_struct *tty, struct file *file, u8 *buf,
|
||||
size_t count, void **cookie, unsigned long offset)
|
||||
{
|
||||
return -EAGAIN;
|
||||
}
|
||||
@ -269,8 +268,8 @@ ppp_asynctty_read(struct tty_struct *tty, struct file *file,
|
||||
* from the ppp generic stuff.
|
||||
*/
|
||||
static ssize_t
|
||||
ppp_asynctty_write(struct tty_struct *tty, struct file *file,
|
||||
const unsigned char *buf, size_t count)
|
||||
ppp_asynctty_write(struct tty_struct *tty, struct file *file, const u8 *buf,
|
||||
size_t count)
|
||||
{
|
||||
return -EAGAIN;
|
||||
}
|
||||
@ -328,17 +327,10 @@ ppp_asynctty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
|
||||
return err;
|
||||
}
|
||||
|
||||
/* No kernel lock - fine */
|
||||
static __poll_t
|
||||
ppp_asynctty_poll(struct tty_struct *tty, struct file *file, poll_table *wait)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* May sleep, don't call from interrupt level or with interrupts disabled */
|
||||
static void
|
||||
ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf,
|
||||
const char *cflags, int count)
|
||||
ppp_asynctty_receive(struct tty_struct *tty, const u8 *buf, const u8 *cflags,
|
||||
size_t count)
|
||||
{
|
||||
struct asyncppp *ap = ap_get(tty);
|
||||
unsigned long flags;
|
||||
@ -378,7 +370,6 @@ static struct tty_ldisc_ops ppp_ldisc = {
|
||||
.read = ppp_asynctty_read,
|
||||
.write = ppp_asynctty_write,
|
||||
.ioctl = ppp_asynctty_ioctl,
|
||||
.poll = ppp_asynctty_poll,
|
||||
.receive_buf = ppp_asynctty_receive,
|
||||
.write_wakeup = ppp_asynctty_wakeup,
|
||||
};
|
||||
@ -827,8 +818,7 @@ process_input_packet(struct asyncppp *ap)
|
||||
other ldisc functions but will not be re-entered */
|
||||
|
||||
static void
|
||||
ppp_async_input(struct asyncppp *ap, const unsigned char *buf,
|
||||
const char *flags, int count)
|
||||
ppp_async_input(struct asyncppp *ap, const u8 *buf, const u8 *flags, int count)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
int c, i, j, n, s, f;
|
||||
|
@ -93,8 +93,8 @@ static int ppp_sync_ioctl(struct ppp_channel *chan, unsigned int cmd,
|
||||
static void ppp_sync_process(struct tasklet_struct *t);
|
||||
static int ppp_sync_push(struct syncppp *ap);
|
||||
static void ppp_sync_flush_output(struct syncppp *ap);
|
||||
static void ppp_sync_input(struct syncppp *ap, const unsigned char *buf,
|
||||
const char *flags, int count);
|
||||
static void ppp_sync_input(struct syncppp *ap, const u8 *buf, const u8 *flags,
|
||||
int count);
|
||||
|
||||
static const struct ppp_channel_ops sync_ops = {
|
||||
.start_xmit = ppp_sync_send,
|
||||
@ -255,8 +255,7 @@ static void ppp_sync_hangup(struct tty_struct *tty)
|
||||
* Pppd reads and writes packets via /dev/ppp instead.
|
||||
*/
|
||||
static ssize_t
|
||||
ppp_sync_read(struct tty_struct *tty, struct file *file,
|
||||
unsigned char *buf, size_t count,
|
||||
ppp_sync_read(struct tty_struct *tty, struct file *file, u8 *buf, size_t count,
|
||||
void **cookie, unsigned long offset)
|
||||
{
|
||||
return -EAGAIN;
|
||||
@ -267,8 +266,8 @@ ppp_sync_read(struct tty_struct *tty, struct file *file,
|
||||
* from the ppp generic stuff.
|
||||
*/
|
||||
static ssize_t
|
||||
ppp_sync_write(struct tty_struct *tty, struct file *file,
|
||||
const unsigned char *buf, size_t count)
|
||||
ppp_sync_write(struct tty_struct *tty, struct file *file, const u8 *buf,
|
||||
size_t count)
|
||||
{
|
||||
return -EAGAIN;
|
||||
}
|
||||
@ -321,17 +320,10 @@ ppp_synctty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
|
||||
return err;
|
||||
}
|
||||
|
||||
/* No kernel lock - fine */
|
||||
static __poll_t
|
||||
ppp_sync_poll(struct tty_struct *tty, struct file *file, poll_table *wait)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* May sleep, don't call from interrupt level or with interrupts disabled */
|
||||
static void
|
||||
ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf,
|
||||
const char *cflags, int count)
|
||||
ppp_sync_receive(struct tty_struct *tty, const u8 *buf, const u8 *cflags,
|
||||
size_t count)
|
||||
{
|
||||
struct syncppp *ap = sp_get(tty);
|
||||
unsigned long flags;
|
||||
@ -371,7 +363,6 @@ static struct tty_ldisc_ops ppp_sync_ldisc = {
|
||||
.read = ppp_sync_read,
|
||||
.write = ppp_sync_write,
|
||||
.ioctl = ppp_synctty_ioctl,
|
||||
.poll = ppp_sync_poll,
|
||||
.receive_buf = ppp_sync_receive,
|
||||
.write_wakeup = ppp_sync_wakeup,
|
||||
};
|
||||
@ -663,8 +654,7 @@ ppp_sync_flush_output(struct syncppp *ap)
|
||||
* frame is considered to be in error and is tossed.
|
||||
*/
|
||||
static void
|
||||
ppp_sync_input(struct syncppp *ap, const unsigned char *buf,
|
||||
const char *flags, int count)
|
||||
ppp_sync_input(struct syncppp *ap, const u8 *buf, const u8 *flags, int count)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
unsigned char *p;
|
||||
|
@ -685,8 +685,8 @@ static void sl_setup(struct net_device *dev)
|
||||
* in parallel
|
||||
*/
|
||||
|
||||
static void slip_receive_buf(struct tty_struct *tty, const unsigned char *cp,
|
||||
const char *fp, int count)
|
||||
static void slip_receive_buf(struct tty_struct *tty, const u8 *cp, const u8 *fp,
|
||||
size_t count)
|
||||
{
|
||||
struct slip *sl = tty->disc_data;
|
||||
|
||||
|
@ -1322,11 +1322,10 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp)
|
||||
}
|
||||
|
||||
/* close the requested serial port */
|
||||
static int hso_serial_write(struct tty_struct *tty, const unsigned char *buf,
|
||||
int count)
|
||||
static ssize_t hso_serial_write(struct tty_struct *tty, const u8 *buf,
|
||||
size_t count)
|
||||
{
|
||||
struct hso_serial *serial = tty->driver_data;
|
||||
int space, tx_bytes;
|
||||
unsigned long flags;
|
||||
|
||||
/* sanity check */
|
||||
@ -1337,21 +1336,16 @@ static int hso_serial_write(struct tty_struct *tty, const unsigned char *buf,
|
||||
|
||||
spin_lock_irqsave(&serial->serial_lock, flags);
|
||||
|
||||
space = serial->tx_data_length - serial->tx_buffer_count;
|
||||
tx_bytes = (count < space) ? count : space;
|
||||
count = min_t(size_t, serial->tx_data_length - serial->tx_buffer_count,
|
||||
count);
|
||||
memcpy(serial->tx_buffer + serial->tx_buffer_count, buf, count);
|
||||
serial->tx_buffer_count += count;
|
||||
|
||||
if (!tx_bytes)
|
||||
goto out;
|
||||
|
||||
memcpy(serial->tx_buffer + serial->tx_buffer_count, buf, tx_bytes);
|
||||
serial->tx_buffer_count += tx_bytes;
|
||||
|
||||
out:
|
||||
spin_unlock_irqrestore(&serial->serial_lock, flags);
|
||||
|
||||
hso_kick_transmit(serial);
|
||||
/* done */
|
||||
return tx_bytes;
|
||||
return count;
|
||||
}
|
||||
|
||||
/* how much room is there for writing */
|
||||
|
@ -2655,6 +2655,7 @@ enum parport_pc_pci_cards {
|
||||
netmos_9815,
|
||||
netmos_9901,
|
||||
netmos_9865,
|
||||
asix_ax99100,
|
||||
quatech_sppxp100,
|
||||
wch_ch382l,
|
||||
};
|
||||
@ -2733,6 +2734,7 @@ static struct parport_pc_pci {
|
||||
/* netmos_9815 */ { 2, { { 0, 1 }, { 2, 3 }, } },
|
||||
/* netmos_9901 */ { 1, { { 0, -1 }, } },
|
||||
/* netmos_9865 */ { 1, { { 0, -1 }, } },
|
||||
/* asix_ax99100 */ { 1, { { 0, 1 }, } },
|
||||
/* quatech_sppxp100 */ { 1, { { 0, 1 }, } },
|
||||
/* wch_ch382l */ { 1, { { 2, -1 }, } },
|
||||
};
|
||||
@ -2823,6 +2825,9 @@ static const struct pci_device_id parport_pc_pci_tbl[] = {
|
||||
0xA000, 0x1000, 0, 0, netmos_9865 },
|
||||
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
|
||||
0xA000, 0x2000, 0, 0, netmos_9865 },
|
||||
/* ASIX AX99100 PCIe to Multi I/O Controller */
|
||||
{ PCI_VENDOR_ID_ASIX, PCI_DEVICE_ID_ASIX_AX99100,
|
||||
0xA000, 0x2000, 0, 0, asix_ax99100 },
|
||||
/* Quatech SPPXP-100 Parallel port PCI ExpressCard */
|
||||
{ PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_SPPXP_100,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, quatech_sppxp100 },
|
||||
|
@ -1021,8 +1021,8 @@ static unsigned int tty3215_write_room(struct tty_struct *tty)
|
||||
/*
|
||||
* String write routine for 3215 ttys
|
||||
*/
|
||||
static int tty3215_write(struct tty_struct *tty,
|
||||
const unsigned char *buf, int count)
|
||||
static ssize_t tty3215_write(struct tty_struct *tty, const u8 *buf,
|
||||
size_t count)
|
||||
{
|
||||
handle_write(tty->driver_data, buf, count);
|
||||
return count;
|
||||
@ -1031,7 +1031,7 @@ static int tty3215_write(struct tty_struct *tty,
|
||||
/*
|
||||
* Put character routine for 3215 ttys
|
||||
*/
|
||||
static int tty3215_put_char(struct tty_struct *tty, unsigned char ch)
|
||||
static int tty3215_put_char(struct tty_struct *tty, u8 ch)
|
||||
{
|
||||
struct raw3215_info *raw = tty->driver_data;
|
||||
|
||||
|
@ -1803,8 +1803,8 @@ static void tty3270_do_write(struct tty3270 *tp, struct tty_struct *tty,
|
||||
/*
|
||||
* String write routine for 3270 ttys
|
||||
*/
|
||||
static int tty3270_write(struct tty_struct *tty,
|
||||
const unsigned char *buf, int count)
|
||||
static ssize_t tty3270_write(struct tty_struct *tty, const u8 *buf,
|
||||
size_t count)
|
||||
{
|
||||
struct tty3270 *tp;
|
||||
|
||||
@ -1822,7 +1822,7 @@ static int tty3270_write(struct tty_struct *tty,
|
||||
/*
|
||||
* Put single characters to the ttys character buffer
|
||||
*/
|
||||
static int tty3270_put_char(struct tty_struct *tty, unsigned char ch)
|
||||
static int tty3270_put_char(struct tty_struct *tty, u8 ch)
|
||||
{
|
||||
struct tty3270 *tp;
|
||||
|
||||
|
@ -48,7 +48,7 @@ static struct sclp_buffer *sclp_ttybuf;
|
||||
static struct timer_list sclp_tty_timer;
|
||||
|
||||
static struct tty_port sclp_port;
|
||||
static unsigned char sclp_tty_chars[SCLP_TTY_BUF_SIZE];
|
||||
static u8 sclp_tty_chars[SCLP_TTY_BUF_SIZE];
|
||||
static unsigned short int sclp_tty_chars_count;
|
||||
|
||||
struct tty_driver *sclp_tty_driver;
|
||||
@ -168,7 +168,7 @@ sclp_tty_timeout(struct timer_list *unused)
|
||||
/*
|
||||
* Write a string to the sclp tty.
|
||||
*/
|
||||
static int sclp_tty_write_string(const unsigned char *str, int count, int may_fail)
|
||||
static int sclp_tty_write_string(const u8 *str, int count, int may_fail)
|
||||
{
|
||||
unsigned long flags;
|
||||
void *page;
|
||||
@ -229,8 +229,8 @@ out:
|
||||
* tty device. The characters may come from user space or kernel space. This
|
||||
* routine will return the number of characters actually accepted for writing.
|
||||
*/
|
||||
static int
|
||||
sclp_tty_write(struct tty_struct *tty, const unsigned char *buf, int count)
|
||||
static ssize_t
|
||||
sclp_tty_write(struct tty_struct *tty, const u8 *buf, size_t count)
|
||||
{
|
||||
if (sclp_tty_chars_count > 0) {
|
||||
sclp_tty_write_string(sclp_tty_chars, sclp_tty_chars_count, 0);
|
||||
@ -250,7 +250,7 @@ sclp_tty_write(struct tty_struct *tty, const unsigned char *buf, int count)
|
||||
* sclp_write() without final '\n' - will be written.
|
||||
*/
|
||||
static int
|
||||
sclp_tty_put_char(struct tty_struct *tty, unsigned char ch)
|
||||
sclp_tty_put_char(struct tty_struct *tty, u8 ch)
|
||||
{
|
||||
sclp_tty_chars[sclp_tty_chars_count++] = ch;
|
||||
if (ch == '\n' || sclp_tty_chars_count >= SCLP_TTY_BUF_SIZE) {
|
||||
|
@ -462,8 +462,8 @@ out:
|
||||
* user space or kernel space. This routine will return the
|
||||
* number of characters actually accepted for writing.
|
||||
*/
|
||||
static int
|
||||
sclp_vt220_write(struct tty_struct *tty, const unsigned char *buf, int count)
|
||||
static ssize_t
|
||||
sclp_vt220_write(struct tty_struct *tty, const u8 *buf, size_t count)
|
||||
{
|
||||
return __sclp_vt220_write(buf, count, 1, 0, 1);
|
||||
}
|
||||
@ -579,7 +579,7 @@ sclp_vt220_close(struct tty_struct *tty, struct file *filp)
|
||||
* done stuffing characters into the driver.
|
||||
*/
|
||||
static int
|
||||
sclp_vt220_put_char(struct tty_struct *tty, unsigned char ch)
|
||||
sclp_vt220_put_char(struct tty_struct *tty, u8 ch)
|
||||
{
|
||||
return __sclp_vt220_write(&ch, 1, 0, 0, 1);
|
||||
}
|
||||
|
@ -149,22 +149,17 @@ static void gdm_tty_send_complete(void *arg)
|
||||
tty_port_tty_wakeup(&gdm->port);
|
||||
}
|
||||
|
||||
static int gdm_tty_write(struct tty_struct *tty, const unsigned char *buf,
|
||||
int len)
|
||||
static ssize_t gdm_tty_write(struct tty_struct *tty, const u8 *buf, size_t len)
|
||||
{
|
||||
struct gdm *gdm = tty->driver_data;
|
||||
int remain = len;
|
||||
int sent_len = 0;
|
||||
int sending_len = 0;
|
||||
size_t remain = len;
|
||||
size_t sent_len = 0;
|
||||
|
||||
if (!gdm_tty_ready(gdm))
|
||||
return -ENODEV;
|
||||
|
||||
if (!len)
|
||||
return 0;
|
||||
|
||||
while (1) {
|
||||
sending_len = min(MUX_TX_MAX_SIZE, remain);
|
||||
while (remain) {
|
||||
size_t sending_len = min_t(size_t, MUX_TX_MAX_SIZE, remain);
|
||||
gdm->tty_dev->send_func(gdm->tty_dev->priv_dev,
|
||||
(void *)(buf + sent_len),
|
||||
sending_len,
|
||||
@ -173,8 +168,6 @@ static int gdm_tty_write(struct tty_struct *tty, const unsigned char *buf,
|
||||
gdm);
|
||||
sent_len += sending_len;
|
||||
remain -= sending_len;
|
||||
if (remain <= 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return len;
|
||||
|
@ -427,8 +427,7 @@ static void gb_tty_hangup(struct tty_struct *tty)
|
||||
tty_port_hangup(&gb_tty->port);
|
||||
}
|
||||
|
||||
static int gb_tty_write(struct tty_struct *tty, const unsigned char *buf,
|
||||
int count)
|
||||
static ssize_t gb_tty_write(struct tty_struct *tty, const u8 *buf, size_t count)
|
||||
{
|
||||
struct gb_tty *gb_tty = tty->driver_data;
|
||||
|
||||
|
@ -239,6 +239,7 @@ config MOXA_SMARTIO
|
||||
config SYNCLINK_GT
|
||||
tristate "SyncLink GT/AC support"
|
||||
depends on SERIAL_NONSTANDARD && PCI
|
||||
depends on BROKEN
|
||||
help
|
||||
Support for SyncLink GT and SyncLink AC families of
|
||||
synchronous and asynchronous serial adapters
|
||||
|
@ -696,7 +696,7 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info,
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
static int rs_put_char(struct tty_struct *tty, unsigned char ch)
|
||||
static int rs_put_char(struct tty_struct *tty, u8 ch)
|
||||
{
|
||||
struct serial_state *info;
|
||||
unsigned long flags;
|
||||
@ -741,7 +741,7 @@ static void rs_flush_chars(struct tty_struct *tty)
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
static int rs_write(struct tty_struct * tty, const unsigned char *buf, int count)
|
||||
static ssize_t rs_write(struct tty_struct * tty, const u8 *buf, size_t count)
|
||||
{
|
||||
int c, ret = 0;
|
||||
struct serial_state *info = tty->driver_data;
|
||||
|
@ -466,8 +466,8 @@ static irqreturn_t ehv_bc_tty_tx_isr(int irq, void *data)
|
||||
* ehv_bc_tty_write_room() will never lie, so the tty layer will never send us
|
||||
* too much data.
|
||||
*/
|
||||
static int ehv_bc_tty_write(struct tty_struct *ttys, const unsigned char *s,
|
||||
int count)
|
||||
static ssize_t ehv_bc_tty_write(struct tty_struct *ttys, const u8 *s,
|
||||
size_t count)
|
||||
{
|
||||
struct ehv_bc_data *bc = ttys->driver_data;
|
||||
unsigned long flags;
|
||||
|
@ -125,8 +125,7 @@ static void goldfish_tty_rw(struct goldfish_tty *qtty,
|
||||
}
|
||||
}
|
||||
|
||||
static void goldfish_tty_do_write(int line, const char *buf,
|
||||
unsigned int count)
|
||||
static void goldfish_tty_do_write(int line, const u8 *buf, unsigned int count)
|
||||
{
|
||||
struct goldfish_tty *qtty = &goldfish_ttys[line];
|
||||
unsigned long address = (unsigned long)(void *)buf;
|
||||
@ -186,8 +185,8 @@ static void goldfish_tty_hangup(struct tty_struct *tty)
|
||||
tty_port_hangup(tty->port);
|
||||
}
|
||||
|
||||
static int goldfish_tty_write(struct tty_struct *tty, const unsigned char *buf,
|
||||
int count)
|
||||
static ssize_t goldfish_tty_write(struct tty_struct *tty, const u8 *buf,
|
||||
size_t count)
|
||||
{
|
||||
goldfish_tty_do_write(tty->index, buf, count);
|
||||
return count;
|
||||
|
@ -496,11 +496,11 @@ static int hvc_push(struct hvc_struct *hp)
|
||||
return n;
|
||||
}
|
||||
|
||||
static int hvc_write(struct tty_struct *tty, const unsigned char *buf, int count)
|
||||
static ssize_t hvc_write(struct tty_struct *tty, const u8 *buf, size_t count)
|
||||
{
|
||||
struct hvc_struct *hp = tty->driver_data;
|
||||
unsigned long flags;
|
||||
int rsize, written = 0;
|
||||
size_t rsize, written = 0;
|
||||
|
||||
/* This write was probably executed during a tty close. */
|
||||
if (!hp)
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <linux/console.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
|
@ -1257,15 +1257,14 @@ static void hvcs_hangup(struct tty_struct * tty)
|
||||
* tty_hangup will allow hvcs_write time to complete execution before it
|
||||
* terminates our device.
|
||||
*/
|
||||
static int hvcs_write(struct tty_struct *tty,
|
||||
const unsigned char *buf, int count)
|
||||
static ssize_t hvcs_write(struct tty_struct *tty, const u8 *buf, size_t count)
|
||||
{
|
||||
struct hvcs_struct *hvcsd = tty->driver_data;
|
||||
unsigned int unit_address;
|
||||
const unsigned char *charbuf;
|
||||
unsigned long flags;
|
||||
int total_sent = 0;
|
||||
int tosend = 0;
|
||||
size_t total_sent = 0;
|
||||
size_t tosend = 0;
|
||||
int result = 0;
|
||||
|
||||
/*
|
||||
@ -1300,7 +1299,8 @@ static int hvcs_write(struct tty_struct *tty,
|
||||
unit_address = hvcsd->vdev->unit_address;
|
||||
|
||||
while (count > 0) {
|
||||
tosend = min(count, (HVCS_BUFF_LEN - hvcsd->chars_in_buffer));
|
||||
tosend = min_t(size_t, count,
|
||||
(HVCS_BUFF_LEN - hvcsd->chars_in_buffer));
|
||||
/*
|
||||
* No more space, this probably means that the last call to
|
||||
* hvcs_write() didn't succeed and the buffer was filled up.
|
||||
|
@ -904,14 +904,13 @@ static unsigned int hvsi_chars_in_buffer(struct tty_struct *tty)
|
||||
return hp->n_outbuf;
|
||||
}
|
||||
|
||||
static int hvsi_write(struct tty_struct *tty,
|
||||
const unsigned char *buf, int count)
|
||||
static ssize_t hvsi_write(struct tty_struct *tty, const u8 *source,
|
||||
size_t count)
|
||||
{
|
||||
struct hvsi_struct *hp = tty->driver_data;
|
||||
const char *source = buf;
|
||||
unsigned long flags;
|
||||
int total = 0;
|
||||
int origcount = count;
|
||||
size_t total = 0;
|
||||
size_t origcount = count;
|
||||
|
||||
spin_lock_irqsave(&hp->lock, flags);
|
||||
|
||||
@ -929,7 +928,7 @@ static int hvsi_write(struct tty_struct *tty,
|
||||
* will see there is no room in outbuf and return.
|
||||
*/
|
||||
while ((count > 0) && (hvsi_write_room(tty) > 0)) {
|
||||
int chunksize = min_t(int, count, hvsi_write_room(tty));
|
||||
size_t chunksize = min_t(size_t, count, hvsi_write_room(tty));
|
||||
|
||||
BUG_ON(hp->n_outbuf < 0);
|
||||
memcpy(hp->outbuf + hp->n_outbuf, source, chunksize);
|
||||
@ -953,8 +952,8 @@ out:
|
||||
spin_unlock_irqrestore(&hp->lock, flags);
|
||||
|
||||
if (total != origcount)
|
||||
pr_debug("%s: wanted %i, only wrote %i\n", __func__, origcount,
|
||||
total);
|
||||
pr_debug("%s: wanted %zu, only wrote %zu\n", __func__,
|
||||
origcount, total);
|
||||
|
||||
return total;
|
||||
}
|
||||
|
@ -1292,7 +1292,7 @@ static void *alloc_ctrl_packet(int header_size,
|
||||
}
|
||||
|
||||
int ipwireless_send_packet(struct ipw_hardware *hw, unsigned int channel_idx,
|
||||
const unsigned char *data, unsigned int length,
|
||||
const u8 *data, unsigned int length,
|
||||
void (*callback) (void *cb, unsigned int length),
|
||||
void *callback_data)
|
||||
{
|
||||
|
@ -186,8 +186,8 @@ static void ipw_write_packet_sent_callback(void *callback_data,
|
||||
tty->tx_bytes_queued -= packet_length;
|
||||
}
|
||||
|
||||
static int ipw_write(struct tty_struct *linux_tty,
|
||||
const unsigned char *buf, int count)
|
||||
static ssize_t ipw_write(struct tty_struct *linux_tty, const u8 *buf,
|
||||
size_t count)
|
||||
{
|
||||
struct ipw_tty *tty = linux_tty->driver_data;
|
||||
int room, ret;
|
||||
|
@ -796,8 +796,8 @@ static void mips_ejtag_fdc_tty_hangup(struct tty_struct *tty)
|
||||
tty_port_hangup(tty->port);
|
||||
}
|
||||
|
||||
static int mips_ejtag_fdc_tty_write(struct tty_struct *tty,
|
||||
const unsigned char *buf, int total)
|
||||
static ssize_t mips_ejtag_fdc_tty_write(struct tty_struct *tty, const u8 *buf,
|
||||
size_t total)
|
||||
{
|
||||
int count, block;
|
||||
struct mips_ejtag_fdc_tty_port *dport = tty->driver_data;
|
||||
@ -816,7 +816,7 @@ static int mips_ejtag_fdc_tty_write(struct tty_struct *tty,
|
||||
*/
|
||||
spin_lock(&dport->xmit_lock);
|
||||
/* Work out how many bytes we can write to the xmit buffer */
|
||||
total = min(total, (int)(priv->xmit_size - dport->xmit_cnt));
|
||||
total = min_t(size_t, total, priv->xmit_size - dport->xmit_cnt);
|
||||
atomic_add(total, &priv->xmit_total);
|
||||
dport->xmit_cnt += total;
|
||||
/* Write the actual bytes (may need splitting if it wraps) */
|
||||
|
@ -487,7 +487,7 @@ module_param(ttymajor, int, 0);
|
||||
*/
|
||||
static int moxa_open(struct tty_struct *, struct file *);
|
||||
static void moxa_close(struct tty_struct *, struct file *);
|
||||
static int moxa_write(struct tty_struct *, const unsigned char *, int);
|
||||
static ssize_t moxa_write(struct tty_struct *, const u8 *, size_t);
|
||||
static unsigned int moxa_write_room(struct tty_struct *);
|
||||
static void moxa_flush_buffer(struct tty_struct *);
|
||||
static unsigned int moxa_chars_in_buffer(struct tty_struct *);
|
||||
@ -1499,8 +1499,7 @@ static void moxa_close(struct tty_struct *tty, struct file *filp)
|
||||
tty_port_close(&ch->port, tty, filp);
|
||||
}
|
||||
|
||||
static int moxa_write(struct tty_struct *tty,
|
||||
const unsigned char *buf, int count)
|
||||
static ssize_t moxa_write(struct tty_struct *tty, const u8 *buf, size_t count)
|
||||
{
|
||||
struct moxa_port *ch = tty->driver_data;
|
||||
unsigned long flags;
|
||||
@ -2164,8 +2163,7 @@ static int MoxaPortLineStatus(struct moxa_port *port)
|
||||
return val;
|
||||
}
|
||||
|
||||
static int MoxaPortWriteData(struct tty_struct *tty,
|
||||
const unsigned char *buffer, int len)
|
||||
static int MoxaPortWriteData(struct tty_struct *tty, const u8 *buffer, int len)
|
||||
{
|
||||
struct moxa_port *port = tty->driver_data;
|
||||
void __iomem *baseAddr, *ofsAddr, *ofs;
|
||||
|
@ -901,7 +901,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
|
||||
tty_port_close(tty->port, tty, filp);
|
||||
}
|
||||
|
||||
static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int count)
|
||||
static ssize_t mxser_write(struct tty_struct *tty, const u8 *buf, size_t count)
|
||||
{
|
||||
struct mxser_port *info = tty->driver_data;
|
||||
unsigned long flags;
|
||||
@ -920,7 +920,7 @@ static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int cou
|
||||
return written;
|
||||
}
|
||||
|
||||
static int mxser_put_char(struct tty_struct *tty, unsigned char ch)
|
||||
static int mxser_put_char(struct tty_struct *tty, u8 ch)
|
||||
{
|
||||
struct mxser_port *info = tty->driver_data;
|
||||
unsigned long flags;
|
||||
|
@ -339,6 +339,7 @@ struct gsm_mux {
|
||||
unsigned long bad_fcs;
|
||||
unsigned long malformed;
|
||||
unsigned long io_error;
|
||||
unsigned long open_error;
|
||||
unsigned long bad_size;
|
||||
unsigned long unsupported;
|
||||
};
|
||||
@ -1450,15 +1451,16 @@ static int gsm_control_command(struct gsm_mux *gsm, int cmd, const u8 *data,
|
||||
int dlen)
|
||||
{
|
||||
struct gsm_msg *msg;
|
||||
struct gsm_dlci *dlci = gsm->dlci[0];
|
||||
|
||||
msg = gsm_data_alloc(gsm, 0, dlen + 2, gsm->dlci[0]->ftype);
|
||||
msg = gsm_data_alloc(gsm, 0, dlen + 2, dlci->ftype);
|
||||
if (msg == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
msg->data[0] = (cmd << 1) | CR | EA; /* Set C/R */
|
||||
msg->data[1] = (dlen << 1) | EA;
|
||||
memcpy(msg->data + 2, data, dlen);
|
||||
gsm_data_queue(gsm->dlci[0], msg);
|
||||
gsm_data_queue(dlci, msg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1477,14 +1479,15 @@ static void gsm_control_reply(struct gsm_mux *gsm, int cmd, const u8 *data,
|
||||
int dlen)
|
||||
{
|
||||
struct gsm_msg *msg;
|
||||
struct gsm_dlci *dlci = gsm->dlci[0];
|
||||
|
||||
msg = gsm_data_alloc(gsm, 0, dlen + 2, gsm->dlci[0]->ftype);
|
||||
msg = gsm_data_alloc(gsm, 0, dlen + 2, dlci->ftype);
|
||||
if (msg == NULL)
|
||||
return;
|
||||
msg->data[0] = (cmd & 0xFE) << 1 | EA; /* Clear C/R */
|
||||
msg->data[1] = (dlen << 1) | EA;
|
||||
memcpy(msg->data + 2, data, dlen);
|
||||
gsm_data_queue(gsm->dlci[0], msg);
|
||||
gsm_data_queue(dlci, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1589,6 +1592,7 @@ static int gsm_process_negotiation(struct gsm_mux *gsm, unsigned int addr,
|
||||
if (debug & DBG_ERRORS)
|
||||
pr_info("%s unsupported I frame request in PN\n",
|
||||
__func__);
|
||||
gsm->unsupported++;
|
||||
return -EINVAL;
|
||||
default:
|
||||
if (debug & DBG_ERRORS)
|
||||
@ -1730,25 +1734,32 @@ static void gsm_control_negotiation(struct gsm_mux *gsm, unsigned int cr,
|
||||
struct gsm_dlci *dlci;
|
||||
struct gsm_dlci_param_bits *params;
|
||||
|
||||
if (dlen < sizeof(struct gsm_dlci_param_bits))
|
||||
if (dlen < sizeof(struct gsm_dlci_param_bits)) {
|
||||
gsm->open_error++;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Invalid DLCI? */
|
||||
params = (struct gsm_dlci_param_bits *)data;
|
||||
addr = FIELD_GET(PN_D_FIELD_DLCI, params->d_bits);
|
||||
if (addr == 0 || addr >= NUM_DLCI || !gsm->dlci[addr])
|
||||
if (addr == 0 || addr >= NUM_DLCI || !gsm->dlci[addr]) {
|
||||
gsm->open_error++;
|
||||
return;
|
||||
}
|
||||
dlci = gsm->dlci[addr];
|
||||
|
||||
/* Too late for parameter negotiation? */
|
||||
if ((!cr && dlci->state == DLCI_OPENING) || dlci->state == DLCI_OPEN)
|
||||
if ((!cr && dlci->state == DLCI_OPENING) || dlci->state == DLCI_OPEN) {
|
||||
gsm->open_error++;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Process the received parameters */
|
||||
if (gsm_process_negotiation(gsm, addr, cr, params) != 0) {
|
||||
/* Negotiation failed. Close the link. */
|
||||
if (debug & DBG_ERRORS)
|
||||
pr_info("%s PN failed\n", __func__);
|
||||
gsm->open_error++;
|
||||
gsm_dlci_close(dlci);
|
||||
return;
|
||||
}
|
||||
@ -1768,6 +1779,7 @@ static void gsm_control_negotiation(struct gsm_mux *gsm, unsigned int cr,
|
||||
} else {
|
||||
if (debug & DBG_ERRORS)
|
||||
pr_info("%s PN in invalid state\n", __func__);
|
||||
gsm->open_error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1888,6 +1900,8 @@ static void gsm_control_message(struct gsm_mux *gsm, unsigned int command,
|
||||
/* Optional unsupported commands */
|
||||
case CMD_RPN: /* Remote port negotiation */
|
||||
case CMD_SNC: /* Service negotiation command */
|
||||
gsm->unsupported++;
|
||||
fallthrough;
|
||||
default:
|
||||
/* Reply to bad commands with an NSC */
|
||||
buf[0] = command;
|
||||
@ -2221,6 +2235,7 @@ static void gsm_dlci_t1(struct timer_list *t)
|
||||
dlci->retries--;
|
||||
mod_timer(&dlci->t1, jiffies + gsm->t1 * HZ / 100);
|
||||
} else {
|
||||
gsm->open_error++;
|
||||
gsm_dlci_begin_close(dlci); /* prevent half open link */
|
||||
}
|
||||
break;
|
||||
@ -2236,6 +2251,7 @@ static void gsm_dlci_t1(struct timer_list *t)
|
||||
dlci->mode = DLCI_MODE_ADM;
|
||||
gsm_dlci_open(dlci);
|
||||
} else {
|
||||
gsm->open_error++;
|
||||
gsm_dlci_begin_close(dlci); /* prevent half open link */
|
||||
}
|
||||
|
||||
@ -2444,8 +2460,10 @@ static void gsm_dlci_command(struct gsm_dlci *dlci, const u8 *data, int len)
|
||||
data += dlen;
|
||||
|
||||
/* Malformed command? */
|
||||
if (clen > len)
|
||||
if (clen > len) {
|
||||
dlci->gsm->malformed++;
|
||||
return;
|
||||
}
|
||||
|
||||
if (command & 1)
|
||||
gsm_control_message(dlci->gsm, command, data, clen);
|
||||
@ -2532,6 +2550,8 @@ static int gsm_dlci_config(struct gsm_dlci *dlci, struct gsm_dlci_config *dc, in
|
||||
return -EINVAL;
|
||||
if (dc->k > 7)
|
||||
return -EINVAL;
|
||||
if (dc->flags & ~GSM_FL_RESTART) /* allow future extensions */
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
* See what is needed for reconfiguration
|
||||
@ -2546,6 +2566,8 @@ static int gsm_dlci_config(struct gsm_dlci *dlci, struct gsm_dlci_config *dc, in
|
||||
/* Requires care */
|
||||
if (dc->priority != dlci->prio)
|
||||
need_restart = true;
|
||||
if (dc->flags & GSM_FL_RESTART)
|
||||
need_restart = true;
|
||||
|
||||
if ((open && gsm->wait_config) || need_restart)
|
||||
need_open = true;
|
||||
@ -2753,12 +2775,16 @@ static void gsm_queue(struct gsm_mux *gsm)
|
||||
|
||||
switch (gsm->control) {
|
||||
case SABM|PF:
|
||||
if (cr == 1)
|
||||
if (cr == 1) {
|
||||
gsm->open_error++;
|
||||
goto invalid;
|
||||
}
|
||||
if (dlci == NULL)
|
||||
dlci = gsm_dlci_alloc(gsm, address);
|
||||
if (dlci == NULL)
|
||||
if (dlci == NULL) {
|
||||
gsm->open_error++;
|
||||
return;
|
||||
}
|
||||
if (dlci->dead)
|
||||
gsm_response(gsm, address, DM|PF);
|
||||
else {
|
||||
@ -3276,7 +3302,6 @@ static void gsm_copy_config_values(struct gsm_mux *gsm,
|
||||
|
||||
static int gsm_config(struct gsm_mux *gsm, struct gsm_config *c)
|
||||
{
|
||||
int ret = 0;
|
||||
int need_close = 0;
|
||||
int need_restart = 0;
|
||||
|
||||
@ -3355,7 +3380,7 @@ static int gsm_config(struct gsm_mux *gsm, struct gsm_config *c)
|
||||
* and removing from the mux array
|
||||
*/
|
||||
if (gsm->dead) {
|
||||
ret = gsm_activate_mux(gsm);
|
||||
int ret = gsm_activate_mux(gsm);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (gsm->initiator)
|
||||
@ -3374,6 +3399,7 @@ static void gsm_copy_config_ext_values(struct gsm_mux *gsm,
|
||||
|
||||
static int gsm_config_ext(struct gsm_mux *gsm, struct gsm_config_ext *ce)
|
||||
{
|
||||
bool need_restart = false;
|
||||
unsigned int i;
|
||||
|
||||
/*
|
||||
@ -3383,6 +3409,20 @@ static int gsm_config_ext(struct gsm_mux *gsm, struct gsm_config_ext *ce)
|
||||
for (i = 0; i < ARRAY_SIZE(ce->reserved); i++)
|
||||
if (ce->reserved[i])
|
||||
return -EINVAL;
|
||||
if (ce->flags & ~GSM_FL_RESTART)
|
||||
return -EINVAL;
|
||||
|
||||
/* Requires care */
|
||||
if (ce->flags & GSM_FL_RESTART)
|
||||
need_restart = true;
|
||||
|
||||
/*
|
||||
* Close down what is needed, restart and initiate the new
|
||||
* configuration. On the first time there is no DLCI[0]
|
||||
* and closing or cleaning up is not necessary.
|
||||
*/
|
||||
if (need_restart)
|
||||
gsm_cleanup_mux(gsm, true);
|
||||
|
||||
/*
|
||||
* Setup the new configuration values
|
||||
@ -3390,6 +3430,14 @@ static int gsm_config_ext(struct gsm_mux *gsm, struct gsm_config_ext *ce)
|
||||
gsm->wait_config = ce->wait_config ? true : false;
|
||||
gsm->keep_alive = ce->keep_alive;
|
||||
|
||||
if (gsm->dead) {
|
||||
int ret = gsm_activate_mux(gsm);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (gsm->initiator)
|
||||
gsm_dlci_begin_open(gsm->dlci[0]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3490,8 +3538,8 @@ static void gsmld_detach_gsm(struct tty_struct *tty, struct gsm_mux *gsm)
|
||||
gsm->tty = NULL;
|
||||
}
|
||||
|
||||
static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp,
|
||||
const char *fp, int count)
|
||||
static void gsmld_receive_buf(struct tty_struct *tty, const u8 *cp,
|
||||
const u8 *fp, size_t count)
|
||||
{
|
||||
struct gsm_mux *gsm = tty->disc_data;
|
||||
char flags = TTY_NORMAL;
|
||||
@ -3577,6 +3625,9 @@ static int gsmld_open(struct tty_struct *tty)
|
||||
{
|
||||
struct gsm_mux *gsm;
|
||||
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
if (tty->ops->write == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
@ -3636,9 +3687,8 @@ static void gsmld_write_wakeup(struct tty_struct *tty)
|
||||
* This code must be sure never to sleep through a hangup.
|
||||
*/
|
||||
|
||||
static ssize_t gsmld_read(struct tty_struct *tty, struct file *file,
|
||||
unsigned char *buf, size_t nr,
|
||||
void **cookie, unsigned long offset)
|
||||
static ssize_t gsmld_read(struct tty_struct *tty, struct file *file, u8 *buf,
|
||||
size_t nr, void **cookie, unsigned long offset)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
@ -3658,7 +3708,7 @@ static ssize_t gsmld_read(struct tty_struct *tty, struct file *file,
|
||||
*/
|
||||
|
||||
static ssize_t gsmld_write(struct tty_struct *tty, struct file *file,
|
||||
const unsigned char *buf, size_t nr)
|
||||
const u8 *buf, size_t nr)
|
||||
{
|
||||
struct gsm_mux *gsm = tty->disc_data;
|
||||
unsigned long flags;
|
||||
@ -4254,8 +4304,7 @@ static void gsmtty_hangup(struct tty_struct *tty)
|
||||
gsm_dlci_begin_close(dlci);
|
||||
}
|
||||
|
||||
static int gsmtty_write(struct tty_struct *tty, const unsigned char *buf,
|
||||
int len)
|
||||
static ssize_t gsmtty_write(struct tty_struct *tty, const u8 *buf, size_t len)
|
||||
{
|
||||
int sent;
|
||||
struct gsm_dlci *dlci = tty->driver_data;
|
||||
|
@ -369,13 +369,13 @@ static void n_hdlc_tty_wakeup(struct tty_struct *tty)
|
||||
* Called by tty low level driver when receive data is available. Data is
|
||||
* interpreted as one HDLC frame.
|
||||
*/
|
||||
static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data,
|
||||
const char *flags, int count)
|
||||
static void n_hdlc_tty_receive(struct tty_struct *tty, const u8 *data,
|
||||
const u8 *flags, size_t count)
|
||||
{
|
||||
register struct n_hdlc *n_hdlc = tty->disc_data;
|
||||
register struct n_hdlc_buf *buf;
|
||||
|
||||
pr_debug("%s() called count=%d\n", __func__, count);
|
||||
pr_debug("%s() called count=%zu\n", __func__, count);
|
||||
|
||||
if (count > maxframe) {
|
||||
pr_debug("rx count>maxframesize, data discarded\n");
|
||||
@ -425,8 +425,8 @@ static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data,
|
||||
* Returns the number of bytes returned or error code.
|
||||
*/
|
||||
static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
|
||||
__u8 *kbuf, size_t nr,
|
||||
void **cookie, unsigned long offset)
|
||||
u8 *kbuf, size_t nr, void **cookie,
|
||||
unsigned long offset)
|
||||
{
|
||||
struct n_hdlc *n_hdlc = tty->disc_data;
|
||||
int ret = 0;
|
||||
@ -518,7 +518,7 @@ done_with_rbuf:
|
||||
* Returns the number of bytes written (or error code).
|
||||
*/
|
||||
static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
|
||||
const unsigned char *data, size_t count)
|
||||
const u8 *data, size_t count)
|
||||
{
|
||||
struct n_hdlc *n_hdlc = tty->disc_data;
|
||||
int error = 0;
|
||||
|
@ -10,43 +10,24 @@
|
||||
* Copyright (C) Intel 2017
|
||||
*/
|
||||
|
||||
static int n_null_open(struct tty_struct *tty)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void n_null_close(struct tty_struct *tty)
|
||||
{
|
||||
}
|
||||
|
||||
static ssize_t n_null_read(struct tty_struct *tty, struct file *file,
|
||||
unsigned char *buf, size_t nr,
|
||||
void **cookie, unsigned long offset)
|
||||
static ssize_t n_null_read(struct tty_struct *tty, struct file *file, u8 *buf,
|
||||
size_t nr, void **cookie, unsigned long offset)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static ssize_t n_null_write(struct tty_struct *tty, struct file *file,
|
||||
const unsigned char *buf, size_t nr)
|
||||
const u8 *buf, size_t nr)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static void n_null_receivebuf(struct tty_struct *tty,
|
||||
const unsigned char *cp, const char *fp,
|
||||
int cnt)
|
||||
{
|
||||
}
|
||||
|
||||
static struct tty_ldisc_ops null_ldisc = {
|
||||
.owner = THIS_MODULE,
|
||||
.num = N_NULL,
|
||||
.name = "n_null",
|
||||
.open = n_null_open,
|
||||
.close = n_null_close,
|
||||
.read = n_null_read,
|
||||
.write = n_null_write,
|
||||
.receive_buf = n_null_receivebuf
|
||||
};
|
||||
|
||||
static int __init n_null_init(void)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1599,8 +1599,8 @@ static void ntty_hangup(struct tty_struct *tty)
|
||||
* called when the userspace process writes to the tty (/dev/noz*).
|
||||
* Data is inserted into a fifo, which is then read and transferred to the modem.
|
||||
*/
|
||||
static int ntty_write(struct tty_struct *tty, const unsigned char *buffer,
|
||||
int count)
|
||||
static ssize_t ntty_write(struct tty_struct *tty, const u8 *buffer,
|
||||
size_t count)
|
||||
{
|
||||
int rval = -EINVAL;
|
||||
struct nozomi *dc = get_dc_by_tty(tty);
|
||||
@ -1610,7 +1610,7 @@ static int ntty_write(struct tty_struct *tty, const unsigned char *buffer,
|
||||
if (!dc || !port)
|
||||
return -ENODEV;
|
||||
|
||||
rval = kfifo_in(&port->fifo_ul, (unsigned char *)buffer, count);
|
||||
rval = kfifo_in(&port->fifo_ul, buffer, count);
|
||||
|
||||
spin_lock_irqsave(&dc->spin_mutex, flags);
|
||||
/* CTS is only valid on the modem channel */
|
||||
|
@ -108,7 +108,7 @@ static void pty_unthrottle(struct tty_struct *tty)
|
||||
* the other side of the pty/tty pair.
|
||||
*/
|
||||
|
||||
static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c)
|
||||
static ssize_t pty_write(struct tty_struct *tty, const u8 *buf, size_t c)
|
||||
{
|
||||
struct tty_struct *to = tty->link;
|
||||
|
||||
|
@ -73,7 +73,8 @@ static void rpmsg_tty_close(struct tty_struct *tty, struct file *filp)
|
||||
return tty_port_close(tty->port, tty, filp);
|
||||
}
|
||||
|
||||
static int rpmsg_tty_write(struct tty_struct *tty, const u8 *buf, int len)
|
||||
static ssize_t rpmsg_tty_write(struct tty_struct *tty, const u8 *buf,
|
||||
size_t len)
|
||||
{
|
||||
struct rpmsg_tty_port *cport = tty->driver_data;
|
||||
struct rpmsg_device *rpdev;
|
||||
@ -86,7 +87,7 @@ static int rpmsg_tty_write(struct tty_struct *tty, const u8 *buf, int len)
|
||||
if (msg_max_size < 0)
|
||||
return msg_max_size;
|
||||
|
||||
msg_size = min(len, msg_max_size);
|
||||
msg_size = min_t(unsigned int, len, msg_max_size);
|
||||
|
||||
/*
|
||||
* Use rpmsg_trysend instead of rpmsg_send to send the message so the caller is not
|
||||
|
@ -22,8 +22,8 @@ struct serport {
|
||||
* Callback functions from the tty port.
|
||||
*/
|
||||
|
||||
static int ttyport_receive_buf(struct tty_port *port, const unsigned char *cp,
|
||||
const unsigned char *fp, size_t count)
|
||||
static size_t ttyport_receive_buf(struct tty_port *port, const u8 *cp,
|
||||
const u8 *fp, size_t count)
|
||||
{
|
||||
struct serdev_controller *ctrl = port->client_data;
|
||||
struct serport *serport = serdev_controller_get_drvdata(ctrl);
|
||||
|
@ -117,7 +117,8 @@ static void serial21285_stop_rx(struct uart_port *port)
|
||||
static irqreturn_t serial21285_rx_chars(int irq, void *dev_id)
|
||||
{
|
||||
struct uart_port *port = dev_id;
|
||||
unsigned int status, ch, flag, rxs, max_count = 256;
|
||||
unsigned int status, rxs, max_count = 256;
|
||||
u8 ch, flag;
|
||||
|
||||
status = *CSR_UARTFLG;
|
||||
while (!(status & 0x10) && max_count--) {
|
||||
|
@ -1042,7 +1042,7 @@ static int brcmuart_probe(struct platform_device *pdev)
|
||||
dev_dbg(dev, "DMA is %senabled\n", priv->dma_enabled ? "" : "not ");
|
||||
|
||||
memset(&up, 0, sizeof(up));
|
||||
up.port.type = PORT_16550A;
|
||||
up.port.type = PORT_BCM7271;
|
||||
up.port.uartclk = clk_rate;
|
||||
up.port.dev = dev;
|
||||
up.port.mapbase = mapbase;
|
||||
@ -1056,8 +1056,6 @@ static int brcmuart_probe(struct platform_device *pdev)
|
||||
| UPF_FIXED_PORT | UPF_FIXED_TYPE;
|
||||
up.port.dev = dev;
|
||||
up.port.private_data = priv;
|
||||
up.capabilities = UART_CAP_FIFO | UART_CAP_AFE;
|
||||
up.port.fifosize = 32;
|
||||
|
||||
/* Check for a fixed line number */
|
||||
ret = of_alias_get_id(np, "serial");
|
||||
|
@ -523,7 +523,10 @@ static int dw8250_probe(struct platform_device *pdev)
|
||||
if (!regs)
|
||||
return dev_err_probe(dev, -EINVAL, "no registers defined\n");
|
||||
|
||||
irq = platform_get_irq(pdev, 0);
|
||||
irq = platform_get_irq_optional(pdev, 0);
|
||||
/* no interrupt -> fall back to polling */
|
||||
if (irq == -ENXIO)
|
||||
irq = 0;
|
||||
if (irq < 0)
|
||||
return irq;
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/console.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/serial_reg.h>
|
||||
#include <linux/serial.h>
|
||||
#include <linux/serial_8250.h>
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_fdt.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/serial_8250.h>
|
||||
#include <linux/serial_core.h>
|
||||
|
@ -12,11 +12,42 @@
|
||||
#define MEN_UART_ID_Z057 0x39
|
||||
#define MEN_UART_ID_Z125 0x7d
|
||||
|
||||
/*
|
||||
* IP Cores Z025 and Z057 can have up to 4 UART
|
||||
* The UARTs available are stored in a global
|
||||
* register saved in physical address + 0x40
|
||||
* Is saved as follows:
|
||||
*
|
||||
* 7 0
|
||||
* +------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* |UART4 | UART3 | UART2 | UART1 | U4irq | U3irq | U2irq | U1irq |
|
||||
* +------+-------+-------+-------+-------+-------+-------+-------+
|
||||
*/
|
||||
#define MEN_UART1_MASK 0x01
|
||||
#define MEN_UART2_MASK 0x02
|
||||
#define MEN_UART3_MASK 0x04
|
||||
#define MEN_UART4_MASK 0x08
|
||||
|
||||
#define MEN_Z125_UARTS_AVAILABLE 0x01
|
||||
|
||||
#define MEN_Z025_MAX_UARTS 4
|
||||
#define MEN_UART_MEM_SIZE 0x10
|
||||
#define MEM_UART_REGISTER_SIZE 0x01
|
||||
#define MEN_Z025_REGISTER_OFFSET 0x40
|
||||
|
||||
#define MEN_UART1_OFFSET 0
|
||||
#define MEN_UART2_OFFSET (MEN_UART1_OFFSET + MEN_UART_MEM_SIZE)
|
||||
#define MEN_UART3_OFFSET (MEN_UART2_OFFSET + MEN_UART_MEM_SIZE)
|
||||
#define MEN_UART4_OFFSET (MEN_UART3_OFFSET + MEN_UART_MEM_SIZE)
|
||||
|
||||
#define MEN_READ_REGISTER(addr) readb(addr)
|
||||
|
||||
#define MAX_PORTS 4
|
||||
|
||||
struct serial_8250_men_mcb_data {
|
||||
struct uart_8250_port uart;
|
||||
int line;
|
||||
int num_ports;
|
||||
int line[MAX_PORTS];
|
||||
unsigned int offset[MAX_PORTS];
|
||||
};
|
||||
|
||||
/*
|
||||
@ -37,10 +68,10 @@ static u32 men_lookup_uartclk(struct mcb_device *mdev)
|
||||
clkval = 1041666;
|
||||
else if (strncmp(mdev->bus->name, "F216", 4) == 0)
|
||||
clkval = 1843200;
|
||||
else if (strncmp(mdev->bus->name, "G215", 4) == 0)
|
||||
clkval = 1843200;
|
||||
else if (strncmp(mdev->bus->name, "F210", 4) == 0)
|
||||
clkval = 115200;
|
||||
else if (strstr(mdev->bus->name, "215"))
|
||||
clkval = 1843200;
|
||||
else
|
||||
dev_info(&mdev->dev,
|
||||
"board not detected, using default uartclk\n");
|
||||
@ -50,16 +81,98 @@ static u32 men_lookup_uartclk(struct mcb_device *mdev)
|
||||
return clkval;
|
||||
}
|
||||
|
||||
static int get_num_ports(struct mcb_device *mdev,
|
||||
void __iomem *membase)
|
||||
static int read_uarts_available_from_register(struct resource *mem_res,
|
||||
u8 *uarts_available)
|
||||
{
|
||||
void __iomem *mem;
|
||||
int reg_value;
|
||||
|
||||
if (!request_mem_region(mem_res->start + MEN_Z025_REGISTER_OFFSET,
|
||||
MEM_UART_REGISTER_SIZE, KBUILD_MODNAME)) {
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
mem = ioremap(mem_res->start + MEN_Z025_REGISTER_OFFSET,
|
||||
MEM_UART_REGISTER_SIZE);
|
||||
if (!mem) {
|
||||
release_mem_region(mem_res->start + MEN_Z025_REGISTER_OFFSET,
|
||||
MEM_UART_REGISTER_SIZE);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
reg_value = MEN_READ_REGISTER(mem);
|
||||
|
||||
iounmap(mem);
|
||||
|
||||
release_mem_region(mem_res->start + MEN_Z025_REGISTER_OFFSET,
|
||||
MEM_UART_REGISTER_SIZE);
|
||||
|
||||
*uarts_available = reg_value >> 4;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int read_serial_data(struct mcb_device *mdev,
|
||||
struct resource *mem_res,
|
||||
struct serial_8250_men_mcb_data *serial_data)
|
||||
{
|
||||
u8 uarts_available;
|
||||
int count = 0;
|
||||
int mask;
|
||||
int res;
|
||||
int i;
|
||||
|
||||
res = read_uarts_available_from_register(mem_res, &uarts_available);
|
||||
if (res < 0)
|
||||
return res;
|
||||
|
||||
for (i = 0; i < MAX_PORTS; i++) {
|
||||
mask = 0x1 << i;
|
||||
switch (uarts_available & mask) {
|
||||
case MEN_UART1_MASK:
|
||||
serial_data->offset[count] = MEN_UART1_OFFSET;
|
||||
count++;
|
||||
break;
|
||||
case MEN_UART2_MASK:
|
||||
serial_data->offset[count] = MEN_UART2_OFFSET;
|
||||
count++;
|
||||
break;
|
||||
case MEN_UART3_MASK:
|
||||
serial_data->offset[count] = MEN_UART3_OFFSET;
|
||||
count++;
|
||||
break;
|
||||
case MEN_UART4_MASK:
|
||||
serial_data->offset[count] = MEN_UART4_OFFSET;
|
||||
count++;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (count <= 0 || count > MAX_PORTS) {
|
||||
dev_err(&mdev->dev, "unexpected number of ports: %u\n",
|
||||
count);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
serial_data->num_ports = count;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int init_serial_data(struct mcb_device *mdev,
|
||||
struct resource *mem_res,
|
||||
struct serial_8250_men_mcb_data *serial_data)
|
||||
{
|
||||
switch (mdev->id) {
|
||||
case MEN_UART_ID_Z125:
|
||||
return 1U;
|
||||
serial_data->num_ports = 1;
|
||||
serial_data->offset[0] = 0;
|
||||
return 0;
|
||||
case MEN_UART_ID_Z025:
|
||||
return readb(membase) >> 4;
|
||||
case MEN_UART_ID_Z057:
|
||||
return 4U;
|
||||
return read_serial_data(mdev, mem_res, serial_data);
|
||||
default:
|
||||
dev_err(&mdev->dev, "no supported device!\n");
|
||||
return -ENODEV;
|
||||
@ -69,62 +182,54 @@ static int get_num_ports(struct mcb_device *mdev,
|
||||
static int serial_8250_men_mcb_probe(struct mcb_device *mdev,
|
||||
const struct mcb_device_id *id)
|
||||
{
|
||||
struct uart_8250_port uart;
|
||||
struct serial_8250_men_mcb_data *data;
|
||||
struct resource *mem;
|
||||
int num_ports;
|
||||
int i;
|
||||
void __iomem *membase;
|
||||
int res;
|
||||
|
||||
mem = mcb_get_resource(mdev, IORESOURCE_MEM);
|
||||
if (mem == NULL)
|
||||
return -ENXIO;
|
||||
membase = devm_ioremap_resource(&mdev->dev, mem);
|
||||
if (IS_ERR(membase))
|
||||
return PTR_ERR_OR_ZERO(membase);
|
||||
|
||||
num_ports = get_num_ports(mdev, membase);
|
||||
|
||||
dev_dbg(&mdev->dev, "found a 16z%03u with %u ports\n",
|
||||
mdev->id, num_ports);
|
||||
|
||||
if (num_ports <= 0 || num_ports > 4) {
|
||||
dev_err(&mdev->dev, "unexpected number of ports: %u\n",
|
||||
num_ports);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
data = devm_kcalloc(&mdev->dev, num_ports,
|
||||
data = devm_kzalloc(&mdev->dev,
|
||||
sizeof(struct serial_8250_men_mcb_data),
|
||||
GFP_KERNEL);
|
||||
if (!data)
|
||||
return -ENOMEM;
|
||||
|
||||
res = init_serial_data(mdev, mem, data);
|
||||
if (res < 0)
|
||||
return res;
|
||||
|
||||
dev_dbg(&mdev->dev, "found a 16z%03u with %u ports\n",
|
||||
mdev->id, data->num_ports);
|
||||
|
||||
mcb_set_drvdata(mdev, data);
|
||||
|
||||
for (i = 0; i < num_ports; i++) {
|
||||
data[i].uart.port.dev = mdev->dma_dev;
|
||||
spin_lock_init(&data[i].uart.port.lock);
|
||||
for (i = 0; i < data->num_ports; i++) {
|
||||
memset(&uart, 0, sizeof(struct uart_8250_port));
|
||||
spin_lock_init(&uart.port.lock);
|
||||
|
||||
data[i].uart.port.type = PORT_16550;
|
||||
data[i].uart.port.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ
|
||||
| UPF_FIXED_TYPE;
|
||||
data[i].uart.port.iotype = UPIO_MEM;
|
||||
data[i].uart.port.uartclk = men_lookup_uartclk(mdev);
|
||||
data[i].uart.port.regshift = 0;
|
||||
data[i].uart.port.irq = mcb_get_irq(mdev);
|
||||
data[i].uart.port.membase = membase;
|
||||
data[i].uart.port.fifosize = 60;
|
||||
data[i].uart.port.mapbase = (unsigned long) mem->start
|
||||
+ i * MEN_UART_MEM_SIZE;
|
||||
data[i].uart.port.iobase = data[i].uart.port.mapbase;
|
||||
uart.port.flags = UPF_SKIP_TEST |
|
||||
UPF_SHARE_IRQ |
|
||||
UPF_BOOT_AUTOCONF |
|
||||
UPF_IOREMAP;
|
||||
uart.port.iotype = UPIO_MEM;
|
||||
uart.port.uartclk = men_lookup_uartclk(mdev);
|
||||
uart.port.irq = mcb_get_irq(mdev);
|
||||
uart.port.mapbase = (unsigned long) mem->start
|
||||
+ data->offset[i];
|
||||
|
||||
/* ok, register the port */
|
||||
data[i].line = serial8250_register_8250_port(&data[i].uart);
|
||||
if (data[i].line < 0) {
|
||||
res = serial8250_register_8250_port(&uart);
|
||||
if (res < 0) {
|
||||
dev_err(&mdev->dev, "unable to register UART port\n");
|
||||
return data[i].line;
|
||||
return res;
|
||||
}
|
||||
dev_info(&mdev->dev, "found MCB UART: ttyS%d\n", data[i].line);
|
||||
|
||||
data->line[i] = res;
|
||||
dev_info(&mdev->dev, "found MCB UART: ttyS%d\n", data->line[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -132,20 +237,14 @@ static int serial_8250_men_mcb_probe(struct mcb_device *mdev,
|
||||
|
||||
static void serial_8250_men_mcb_remove(struct mcb_device *mdev)
|
||||
{
|
||||
int num_ports, i;
|
||||
int i;
|
||||
struct serial_8250_men_mcb_data *data = mcb_get_drvdata(mdev);
|
||||
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
num_ports = get_num_ports(mdev, data[0].uart.port.membase);
|
||||
if (num_ports <= 0 || num_ports > 4) {
|
||||
dev_err(&mdev->dev, "error retrieving number of ports!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_ports; i++)
|
||||
serial8250_unregister_port(data[i].line);
|
||||
for (i = 0; i < data->num_ports; i++)
|
||||
serial8250_unregister_port(data->line[i]);
|
||||
}
|
||||
|
||||
static const struct mcb_device_id serial_8250_men_mcb_ids[] = {
|
||||
@ -159,7 +258,6 @@ MODULE_DEVICE_TABLE(mcb, serial_8250_men_mcb_ids);
|
||||
static struct mcb_driver mcb_driver = {
|
||||
.driver = {
|
||||
.name = "8250_men_mcb",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = serial_8250_men_mcb_probe,
|
||||
.remove = serial_8250_men_mcb_remove,
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -67,6 +67,8 @@ static const struct pci_device_id pci_use_msi[] = {
|
||||
0xA000, 0x1000) },
|
||||
{ PCI_DEVICE_SUB(PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9922,
|
||||
0xA000, 0x1000) },
|
||||
{ PCI_DEVICE_SUB(PCI_VENDOR_ID_ASIX, PCI_DEVICE_ID_ASIX_AX99100,
|
||||
0xA000, 0x1000) },
|
||||
{ PCI_DEVICE_SUB(PCI_VENDOR_ID_HP_3PAR, PCI_DEVICE_ID_HPE_PCI_SERIAL,
|
||||
PCI_ANY_ID, PCI_ANY_ID) },
|
||||
{ }
|
||||
@ -5557,6 +5559,14 @@ static const struct pci_device_id serial_pci_tbl[] = {
|
||||
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
|
||||
0xA000, 0x3004,
|
||||
0, 0, pbn_b0_bt_4_115200 },
|
||||
|
||||
/*
|
||||
* ASIX AX99100 PCIe to Multi I/O Controller
|
||||
*/
|
||||
{ PCI_VENDOR_ID_ASIX, PCI_DEVICE_ID_ASIX_AX99100,
|
||||
0xA000, 0x1000,
|
||||
0, 0, pbn_b0_1_115200 },
|
||||
|
||||
/* Intel CE4100 */
|
||||
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CE4100_UART,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0,
|
||||
|
@ -322,6 +322,14 @@ static const struct serial8250_config uart_config[] = {
|
||||
.rxtrig_bytes = {2, 66, 130, 194},
|
||||
.flags = UART_CAP_FIFO,
|
||||
},
|
||||
[PORT_BCM7271] = {
|
||||
.name = "Broadcom BCM7271 UART",
|
||||
.fifo_size = 32,
|
||||
.tx_loadsz = 32,
|
||||
.fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_01,
|
||||
.rxtrig_bytes = {1, 8, 16, 30},
|
||||
.flags = UART_CAP_FIFO | UART_CAP_AFE,
|
||||
},
|
||||
};
|
||||
|
||||
/* Uart divisor latch read */
|
||||
@ -1703,8 +1711,7 @@ static void serial8250_enable_ms(struct uart_port *port)
|
||||
void serial8250_read_char(struct uart_8250_port *up, u16 lsr)
|
||||
{
|
||||
struct uart_port *port = &up->port;
|
||||
unsigned char ch;
|
||||
char flag = TTY_NORMAL;
|
||||
u8 ch, flag = TTY_NORMAL;
|
||||
|
||||
if (likely(lsr & UART_LSR_DR))
|
||||
ch = serial_in(up, UART_RX);
|
||||
|
@ -183,6 +183,7 @@ static int __init early_serial_pxa_setup(struct earlycon_device *device,
|
||||
return early_serial8250_setup(device, NULL);
|
||||
}
|
||||
OF_EARLYCON_DECLARE(early_pxa, "mrvl,pxa-uart", early_serial_pxa_setup);
|
||||
OF_EARLYCON_DECLARE(mmp, "mrvl,mmp-uart", early_serial_pxa_setup);
|
||||
#endif
|
||||
|
||||
MODULE_AUTHOR("Sergei Ianovich");
|
||||
|
@ -41,7 +41,7 @@ obj-$(CONFIG_SERIAL_HS_LPC32XX) += lpc32xx_hs.o
|
||||
obj-$(CONFIG_SERIAL_DZ) += dz.o
|
||||
obj-$(CONFIG_SERIAL_ZS) += zs.o
|
||||
obj-$(CONFIG_SERIAL_SH_SCI) += sh-sci.o
|
||||
obj-$(CONFIG_SERIAL_CPM) += cpm_uart/
|
||||
obj-$(CONFIG_SERIAL_CPM) += cpm_uart.o
|
||||
obj-$(CONFIG_SERIAL_IMX) += imx.o
|
||||
obj-$(CONFIG_SERIAL_IMX_EARLYCON) += imx_earlycon.o
|
||||
obj-$(CONFIG_SERIAL_MPC52xx) += mpc52xx_uart.o
|
||||
|
@ -110,8 +110,8 @@ static void altera_jtaguart_set_termios(struct uart_port *port,
|
||||
|
||||
static void altera_jtaguart_rx_chars(struct uart_port *port)
|
||||
{
|
||||
unsigned char ch;
|
||||
unsigned long status;
|
||||
u32 status;
|
||||
u8 ch;
|
||||
|
||||
while ((status = readl(port->membase + ALTERA_JTAGUART_DATA_REG)) &
|
||||
ALTERA_JTAGUART_DATA_RVALID_MSK) {
|
||||
|
@ -201,8 +201,8 @@ static void altera_uart_set_termios(struct uart_port *port,
|
||||
|
||||
static void altera_uart_rx_chars(struct uart_port *port)
|
||||
{
|
||||
unsigned char ch, flag;
|
||||
unsigned short status;
|
||||
u8 ch, flag;
|
||||
|
||||
while ((status = altera_uart_readl(port, ALTERA_UART_STATUS_REG)) &
|
||||
ALTERA_UART_STATUS_RRDY_MSK) {
|
||||
|
@ -112,7 +112,8 @@ static void pl010_enable_ms(struct uart_port *port)
|
||||
|
||||
static void pl010_rx_chars(struct uart_port *port)
|
||||
{
|
||||
unsigned int status, ch, flag, rsr, max_count = 256;
|
||||
unsigned int status, rsr, max_count = 256;
|
||||
u8 ch, flag;
|
||||
|
||||
status = readb(port->membase + UART01x_FR);
|
||||
while (UART_RX_DATA(status) && max_count--) {
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/console.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/sysrq.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/tty.h>
|
||||
@ -36,7 +37,6 @@
|
||||
#include <linux/delay.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#include <linux/sizes.h>
|
||||
#include <linux/io.h>
|
||||
@ -307,9 +307,10 @@ static void pl011_write(unsigned int val, const struct uart_amba_port *uap,
|
||||
*/
|
||||
static int pl011_fifo_to_tty(struct uart_amba_port *uap)
|
||||
{
|
||||
unsigned int ch, flag, fifotaken;
|
||||
unsigned int ch, fifotaken;
|
||||
int sysrq;
|
||||
u16 status;
|
||||
u8 flag;
|
||||
|
||||
for (fifotaken = 0; fifotaken != 256; fifotaken++) {
|
||||
status = pl011_read(uap, REG_FR);
|
||||
|
@ -22,9 +22,6 @@
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/serial_core.h>
|
||||
@ -70,8 +67,9 @@ static void apbuart_stop_rx(struct uart_port *port)
|
||||
|
||||
static void apbuart_rx_chars(struct uart_port *port)
|
||||
{
|
||||
unsigned int status, ch, rsr, flag;
|
||||
unsigned int status, rsr;
|
||||
unsigned int max_chars = port->fifosize;
|
||||
u8 ch, flag;
|
||||
|
||||
status = UART_GET_STATUS(port);
|
||||
|
||||
|
@ -749,8 +749,7 @@ static int ar933x_uart_probe(struct platform_device *pdev)
|
||||
|
||||
port = &up->port;
|
||||
|
||||
mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
port->membase = devm_ioremap_resource(&pdev->dev, mem_res);
|
||||
port->membase = devm_platform_get_and_ioremap_resource(pdev, 0, &mem_res);
|
||||
if (IS_ERR(port->membase))
|
||||
return PTR_ERR(port->membase);
|
||||
|
||||
|
@ -195,8 +195,6 @@ static void arc_serial_start_tx(struct uart_port *port)
|
||||
|
||||
static void arc_serial_rx_chars(struct uart_port *port, unsigned int status)
|
||||
{
|
||||
unsigned int ch, flg = 0;
|
||||
|
||||
/*
|
||||
* UART has 4 deep RX-FIFO. Driver's recongnition of this fact
|
||||
* is very subtle. Here's how ...
|
||||
@ -207,11 +205,12 @@ static void arc_serial_rx_chars(struct uart_port *port, unsigned int status)
|
||||
* controller, which is indeed the Rx-FIFO.
|
||||
*/
|
||||
do {
|
||||
u8 ch, flg = TTY_NORMAL;
|
||||
|
||||
/*
|
||||
* This could be an Rx Intr for err (no data),
|
||||
* so check err and clear that Intr first
|
||||
*/
|
||||
if (unlikely(status & (RXOERR | RXFERR))) {
|
||||
if (status & RXOERR) {
|
||||
port->icount.overrun++;
|
||||
flg = TTY_OVERRUN;
|
||||
@ -223,8 +222,6 @@ static void arc_serial_rx_chars(struct uart_port *port, unsigned int status)
|
||||
flg = TTY_FRAME;
|
||||
UART_CLR_STATUS(port, RXFERR);
|
||||
}
|
||||
} else
|
||||
flg = TTY_NORMAL;
|
||||
|
||||
if (status & RXEMPTY)
|
||||
continue;
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include <linux/tty_flip.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/dmaengine.h>
|
||||
#include <linux/atmel_pdc.h>
|
||||
@ -1516,8 +1515,8 @@ static void atmel_rx_from_ring(struct uart_port *port)
|
||||
{
|
||||
struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
|
||||
struct circ_buf *ring = &atmel_port->rx_ring;
|
||||
unsigned int flg;
|
||||
unsigned int status;
|
||||
u8 flg;
|
||||
|
||||
while (ring->head != ring->tail) {
|
||||
struct atmel_uart_char c;
|
||||
|
@ -832,14 +832,10 @@ static int bcm_uart_probe(struct platform_device *pdev)
|
||||
return -EBUSY;
|
||||
memset(port, 0, sizeof(*port));
|
||||
|
||||
res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res_mem)
|
||||
return -ENODEV;
|
||||
|
||||
port->mapbase = res_mem->start;
|
||||
port->membase = devm_ioremap_resource(&pdev->dev, res_mem);
|
||||
port->membase = devm_platform_get_and_ioremap_resource(pdev, 0, &res_mem);
|
||||
if (IS_ERR(port->membase))
|
||||
return PTR_ERR(port->membase);
|
||||
port->mapbase = res_mem->start;
|
||||
|
||||
ret = platform_get_irq(pdev, 0);
|
||||
if (ret < 0)
|
||||
|
@ -92,8 +92,9 @@ static irqreturn_t uart_clps711x_int_rx(int irq, void *dev_id)
|
||||
{
|
||||
struct uart_port *port = dev_id;
|
||||
struct clps711x_port *s = dev_get_drvdata(port->dev);
|
||||
unsigned int status, flg;
|
||||
unsigned int status;
|
||||
u16 ch;
|
||||
u8 flg;
|
||||
|
||||
for (;;) {
|
||||
u32 sysflg = 0;
|
||||
@ -450,8 +451,7 @@ static int uart_clps711x_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(uart_clk))
|
||||
return PTR_ERR(uart_clk);
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
s->port.membase = devm_ioremap_resource(&pdev->dev, res);
|
||||
s->port.membase = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||
if (IS_ERR(s->port.membase))
|
||||
return PTR_ERR(s->port.membase);
|
||||
|
||||
|
@ -26,17 +26,17 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/fs_uart_pd.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/clk.h>
|
||||
|
||||
#include <sysdev/fsl_soc.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/delay.h>
|
||||
#include <asm/fs_pd.h>
|
||||
#include <asm/udbg.h>
|
||||
|
||||
#include <linux/serial_core.h>
|
||||
@ -48,14 +48,17 @@
|
||||
/**************************************************************/
|
||||
|
||||
static int cpm_uart_tx_pump(struct uart_port *port);
|
||||
static void cpm_uart_init_smc(struct uart_cpm_port *pinfo);
|
||||
static void cpm_uart_init_scc(struct uart_cpm_port *pinfo);
|
||||
static void cpm_uart_initbd(struct uart_cpm_port *pinfo);
|
||||
|
||||
/**************************************************************/
|
||||
|
||||
#define HW_BUF_SPD_THRESHOLD 2400
|
||||
|
||||
static void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
|
||||
{
|
||||
cpm_command(port->command, cmd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check, if transmit buffers are processed
|
||||
*/
|
||||
@ -605,7 +608,7 @@ static void cpm_uart_set_termios(struct uart_port *port,
|
||||
if (pinfo->clk)
|
||||
clk_set_rate(pinfo->clk, baud);
|
||||
else
|
||||
cpm_set_brg(pinfo->brg - 1, baud);
|
||||
cpm_setbrg(pinfo->brg - 1, baud);
|
||||
spin_unlock_irqrestore(&port->lock, flags);
|
||||
}
|
||||
|
||||
@ -771,7 +774,8 @@ static void cpm_uart_init_scc(struct uart_cpm_port *pinfo)
|
||||
* parameter ram.
|
||||
*/
|
||||
|
||||
cpm_set_scc_fcr(sup);
|
||||
out_8(&sup->scc_genscc.scc_rfcr, CPMFCR_GBL | CPMFCR_EB);
|
||||
out_8(&sup->scc_genscc.scc_tfcr, CPMFCR_GBL | CPMFCR_EB);
|
||||
|
||||
out_be16(&sup->scc_genscc.scc_mrblr, pinfo->rx_fifosize);
|
||||
out_be16(&sup->scc_maxidl, 0x10);
|
||||
@ -842,7 +846,8 @@ static void cpm_uart_init_smc(struct uart_cpm_port *pinfo)
|
||||
/* Set up the uart parameters in the
|
||||
* parameter ram.
|
||||
*/
|
||||
cpm_set_smc_fcr(up);
|
||||
out_8(&up->smc_rfcr, CPMFCR_GBL | CPMFCR_EB);
|
||||
out_8(&up->smc_tfcr, CPMFCR_GBL | CPMFCR_EB);
|
||||
|
||||
/* Using idle character time requires some additional tuning. */
|
||||
out_be16(&up->smc_mrblr, pinfo->rx_fifosize);
|
||||
@ -863,6 +868,78 @@ static void cpm_uart_init_smc(struct uart_cpm_port *pinfo)
|
||||
setbits16(&sp->smc_smcmr, SMCMR_REN | SMCMR_TEN);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate DP-Ram and memory buffers. We need to allocate a transmit and
|
||||
* receive buffer descriptors from dual port ram, and a character
|
||||
* buffer area from host mem. If we are allocating for the console we need
|
||||
* to do it from bootmem
|
||||
*/
|
||||
static int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
|
||||
{
|
||||
int dpmemsz, memsz;
|
||||
u8 __iomem *dp_mem;
|
||||
unsigned long dp_offset;
|
||||
u8 *mem_addr;
|
||||
dma_addr_t dma_addr = 0;
|
||||
|
||||
pr_debug("CPM uart[%d]:allocbuf\n", pinfo->port.line);
|
||||
|
||||
dpmemsz = sizeof(cbd_t) * (pinfo->rx_nrfifos + pinfo->tx_nrfifos);
|
||||
dp_offset = cpm_muram_alloc(dpmemsz, 8);
|
||||
if (IS_ERR_VALUE(dp_offset)) {
|
||||
pr_err("%s: could not allocate buffer descriptors\n", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
dp_mem = cpm_muram_addr(dp_offset);
|
||||
|
||||
memsz = L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize) +
|
||||
L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize);
|
||||
if (IS_ENABLED(CONFIG_CPM1) && is_con) {
|
||||
/* was hostalloc but changed cause it blows away the */
|
||||
/* large tlb mapping when pinning the kernel area */
|
||||
mem_addr = (u8 __force *)cpm_muram_addr(cpm_muram_alloc(memsz, 8));
|
||||
dma_addr = cpm_muram_dma((void __iomem *)mem_addr);
|
||||
} else if (is_con) {
|
||||
mem_addr = kzalloc(memsz, GFP_NOWAIT);
|
||||
dma_addr = virt_to_bus(mem_addr);
|
||||
} else {
|
||||
mem_addr = dma_alloc_coherent(pinfo->port.dev, memsz, &dma_addr,
|
||||
GFP_KERNEL);
|
||||
}
|
||||
|
||||
if (!mem_addr) {
|
||||
cpm_muram_free(dp_offset);
|
||||
pr_err("%s: could not allocate coherent memory\n", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
pinfo->dp_addr = dp_offset;
|
||||
pinfo->mem_addr = mem_addr;
|
||||
pinfo->dma_addr = dma_addr;
|
||||
pinfo->mem_size = memsz;
|
||||
|
||||
pinfo->rx_buf = mem_addr;
|
||||
pinfo->tx_buf = pinfo->rx_buf + L1_CACHE_ALIGN(pinfo->rx_nrfifos
|
||||
* pinfo->rx_fifosize);
|
||||
|
||||
pinfo->rx_bd_base = (cbd_t __iomem *)dp_mem;
|
||||
pinfo->tx_bd_base = pinfo->rx_bd_base + pinfo->rx_nrfifos;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cpm_uart_freebuf(struct uart_cpm_port *pinfo)
|
||||
{
|
||||
dma_free_coherent(pinfo->port.dev, L1_CACHE_ALIGN(pinfo->rx_nrfifos *
|
||||
pinfo->rx_fifosize) +
|
||||
L1_CACHE_ALIGN(pinfo->tx_nrfifos *
|
||||
pinfo->tx_fifosize), (void __force *)pinfo->mem_addr,
|
||||
pinfo->dma_addr);
|
||||
|
||||
cpm_muram_free(pinfo->dp_addr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize port. This is called from early_console stuff
|
||||
* so we have to be careful here !
|
||||
@ -1128,7 +1205,55 @@ static const struct uart_ops cpm_uart_pops = {
|
||||
#endif
|
||||
};
|
||||
|
||||
struct uart_cpm_port cpm_uart_ports[UART_NR];
|
||||
static struct uart_cpm_port cpm_uart_ports[UART_NR];
|
||||
|
||||
static void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
|
||||
struct device_node *np)
|
||||
{
|
||||
void __iomem *pram;
|
||||
unsigned long offset;
|
||||
struct resource res;
|
||||
resource_size_t len;
|
||||
|
||||
/* Don't remap parameter RAM if it has already been initialized
|
||||
* during console setup.
|
||||
*/
|
||||
if (IS_SMC(port) && port->smcup)
|
||||
return port->smcup;
|
||||
else if (!IS_SMC(port) && port->sccup)
|
||||
return port->sccup;
|
||||
|
||||
if (of_address_to_resource(np, 1, &res))
|
||||
return NULL;
|
||||
|
||||
len = resource_size(&res);
|
||||
pram = ioremap(res.start, len);
|
||||
if (!pram)
|
||||
return NULL;
|
||||
|
||||
if (!IS_ENABLED(CONFIG_CPM2) || !IS_SMC(port))
|
||||
return pram;
|
||||
|
||||
if (len != 2) {
|
||||
pr_warn("cpm_uart[%d]: device tree references "
|
||||
"SMC pram, using boot loader/wrapper pram mapping. "
|
||||
"Please fix your device tree to reference the pram "
|
||||
"base register instead.\n",
|
||||
port->port.line);
|
||||
return pram;
|
||||
}
|
||||
|
||||
offset = cpm_muram_alloc(64, 64);
|
||||
out_be16(pram, offset);
|
||||
iounmap(pram);
|
||||
return cpm_muram_addr(offset);
|
||||
}
|
||||
|
||||
static void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram)
|
||||
{
|
||||
if (!IS_ENABLED(CONFIG_CPM2) || !IS_SMC(port))
|
||||
iounmap(pram);
|
||||
}
|
||||
|
||||
static int cpm_uart_init_port(struct device_node *np,
|
||||
struct uart_cpm_port *pinfo)
|
||||
@ -1255,19 +1380,14 @@ static void cpm_uart_console_write(struct console *co, const char *s,
|
||||
{
|
||||
struct uart_cpm_port *pinfo = &cpm_uart_ports[co->index];
|
||||
unsigned long flags;
|
||||
int nolock = oops_in_progress;
|
||||
|
||||
if (unlikely(nolock)) {
|
||||
if (unlikely(oops_in_progress)) {
|
||||
local_irq_save(flags);
|
||||
} else {
|
||||
spin_lock_irqsave(&pinfo->port.lock, flags);
|
||||
}
|
||||
|
||||
cpm_uart_early_write(pinfo, s, count, true);
|
||||
|
||||
if (unlikely(nolock)) {
|
||||
local_irq_restore(flags);
|
||||
} else {
|
||||
spin_lock_irqsave(&pinfo->port.lock, flags);
|
||||
cpm_uart_early_write(pinfo, s, count, true);
|
||||
spin_unlock_irqrestore(&pinfo->port.lock, flags);
|
||||
}
|
||||
}
|
||||
@ -1319,7 +1439,8 @@ static int __init cpm_uart_console_setup(struct console *co, char *options)
|
||||
if (options) {
|
||||
uart_parse_options(options, &baud, &parity, &bits, &flow);
|
||||
} else {
|
||||
if ((baud = uart_baudrate()) == -1)
|
||||
baud = get_baudrate();
|
||||
if (baud == -1)
|
||||
baud = 9600;
|
||||
}
|
||||
|
@ -11,41 +11,31 @@
|
||||
#define CPM_UART_H
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/fs_uart_pd.h>
|
||||
|
||||
struct gpio_desc;
|
||||
|
||||
#if defined(CONFIG_CPM2)
|
||||
#include "cpm_uart_cpm2.h"
|
||||
#include "asm/cpm2.h"
|
||||
#elif defined(CONFIG_CPM1)
|
||||
#include "cpm_uart_cpm1.h"
|
||||
#include "asm/cpm1.h"
|
||||
#endif
|
||||
|
||||
#define DPRAM_BASE ((u8 __iomem *)cpm_muram_addr(0))
|
||||
|
||||
#define SERIAL_CPM_MAJOR 204
|
||||
#define SERIAL_CPM_MINOR 46
|
||||
|
||||
#define IS_SMC(pinfo) (pinfo->flags & FLAG_SMC)
|
||||
#define IS_DISCARDING(pinfo) (pinfo->flags & FLAG_DISCARDING)
|
||||
#define FLAG_DISCARDING 0x00000004 /* when set, don't discard */
|
||||
#define FLAG_SMC 0x00000002
|
||||
#define FLAG_CONSOLE 0x00000001
|
||||
|
||||
#define UART_SMC1 fsid_smc1_uart
|
||||
#define UART_SMC2 fsid_smc2_uart
|
||||
#define UART_SCC1 fsid_scc1_uart
|
||||
#define UART_SCC2 fsid_scc2_uart
|
||||
#define UART_SCC3 fsid_scc3_uart
|
||||
#define UART_SCC4 fsid_scc4_uart
|
||||
|
||||
#define UART_NR fs_uart_nr
|
||||
#define UART_NR 6
|
||||
|
||||
#define RX_NUM_FIFO 4
|
||||
#define RX_BUF_SIZE 32
|
||||
#define TX_NUM_FIFO 4
|
||||
#define TX_BUF_SIZE 32
|
||||
|
||||
#define SCC_WAIT_CLOSING 100
|
||||
|
||||
#define GPIO_CTS 0
|
||||
#define GPIO_RTS 1
|
||||
#define GPIO_DCD 2
|
||||
@ -85,24 +75,6 @@ struct uart_cpm_port {
|
||||
struct gpio_desc *gpios[NUM_GPIOS];
|
||||
};
|
||||
|
||||
extern struct uart_cpm_port cpm_uart_ports[UART_NR];
|
||||
|
||||
/* these are located in their respective files */
|
||||
void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd);
|
||||
void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
|
||||
struct device_node *np);
|
||||
void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram);
|
||||
int cpm_uart_init_portdesc(void);
|
||||
int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con);
|
||||
void cpm_uart_freebuf(struct uart_cpm_port *pinfo);
|
||||
|
||||
void smc1_lineif(struct uart_cpm_port *pinfo);
|
||||
void smc2_lineif(struct uart_cpm_port *pinfo);
|
||||
void scc1_lineif(struct uart_cpm_port *pinfo);
|
||||
void scc2_lineif(struct uart_cpm_port *pinfo);
|
||||
void scc3_lineif(struct uart_cpm_port *pinfo);
|
||||
void scc4_lineif(struct uart_cpm_port *pinfo);
|
||||
|
||||
/*
|
||||
virtual to phys transtalion
|
||||
*/
|
@ -1,12 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
#
|
||||
# Makefile for the Motorola 8xx FEC ethernet controller
|
||||
#
|
||||
|
||||
obj-$(CONFIG_SERIAL_CPM) += cpm_uart.o
|
||||
|
||||
# Select the correct platform objects.
|
||||
cpm_uart-objs-$(CONFIG_CPM2) += cpm_uart_cpm2.o
|
||||
cpm_uart-objs-$(CONFIG_CPM1) += cpm_uart_cpm1.o
|
||||
|
||||
cpm_uart-objs := cpm_uart_core.o $(cpm_uart-objs-y)
|
@ -1,122 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Driver for CPM (SCC/SMC) serial ports; CPM1 definitions
|
||||
*
|
||||
* Maintainer: Kumar Gala (galak@kernel.crashing.org) (CPM2)
|
||||
* Pantelis Antoniou (panto@intracom.gr) (CPM1)
|
||||
*
|
||||
* Copyright (C) 2004 Freescale Semiconductor, Inc.
|
||||
* (C) 2004 Intracom, S.A.
|
||||
* (C) 2006 MontaVista Software, Inc.
|
||||
* Vitaly Bordug <vbordug@ru.mvista.com>
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/tty.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/serial.h>
|
||||
#include <linux/console.h>
|
||||
#include <linux/sysrq.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/fs_pd.h>
|
||||
|
||||
#include <linux/serial_core.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
|
||||
#include "cpm_uart.h"
|
||||
|
||||
/**************************************************************/
|
||||
|
||||
void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
|
||||
{
|
||||
cpm_command(port->command, cmd);
|
||||
}
|
||||
|
||||
void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
|
||||
struct device_node *np)
|
||||
{
|
||||
return of_iomap(np, 1);
|
||||
}
|
||||
|
||||
void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram)
|
||||
{
|
||||
iounmap(pram);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate DP-Ram and memory buffers. We need to allocate a transmit and
|
||||
* receive buffer descriptors from dual port ram, and a character
|
||||
* buffer area from host mem. If we are allocating for the console we need
|
||||
* to do it from bootmem
|
||||
*/
|
||||
int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
|
||||
{
|
||||
int dpmemsz, memsz;
|
||||
u8 *dp_mem;
|
||||
unsigned long dp_offset;
|
||||
u8 *mem_addr;
|
||||
dma_addr_t dma_addr = 0;
|
||||
|
||||
pr_debug("CPM uart[%d]:allocbuf\n", pinfo->port.line);
|
||||
|
||||
dpmemsz = sizeof(cbd_t) * (pinfo->rx_nrfifos + pinfo->tx_nrfifos);
|
||||
dp_offset = cpm_dpalloc(dpmemsz, 8);
|
||||
if (IS_ERR_VALUE(dp_offset)) {
|
||||
printk(KERN_ERR
|
||||
"cpm_uart_cpm1.c: could not allocate buffer descriptors\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
dp_mem = cpm_dpram_addr(dp_offset);
|
||||
|
||||
memsz = L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize) +
|
||||
L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize);
|
||||
if (is_con) {
|
||||
/* was hostalloc but changed cause it blows away the */
|
||||
/* large tlb mapping when pinning the kernel area */
|
||||
mem_addr = (u8 *) cpm_dpram_addr(cpm_dpalloc(memsz, 8));
|
||||
dma_addr = (u32)cpm_dpram_phys(mem_addr);
|
||||
} else
|
||||
mem_addr = dma_alloc_coherent(pinfo->port.dev, memsz, &dma_addr,
|
||||
GFP_KERNEL);
|
||||
|
||||
if (mem_addr == NULL) {
|
||||
cpm_dpfree(dp_offset);
|
||||
printk(KERN_ERR
|
||||
"cpm_uart_cpm1.c: could not allocate coherent memory\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
pinfo->dp_addr = dp_offset;
|
||||
pinfo->mem_addr = mem_addr; /* virtual address*/
|
||||
pinfo->dma_addr = dma_addr; /* physical address*/
|
||||
pinfo->mem_size = memsz;
|
||||
|
||||
pinfo->rx_buf = mem_addr;
|
||||
pinfo->tx_buf = pinfo->rx_buf + L1_CACHE_ALIGN(pinfo->rx_nrfifos
|
||||
* pinfo->rx_fifosize);
|
||||
|
||||
pinfo->rx_bd_base = (cbd_t __iomem __force *)dp_mem;
|
||||
pinfo->tx_bd_base = pinfo->rx_bd_base + pinfo->rx_nrfifos;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cpm_uart_freebuf(struct uart_cpm_port *pinfo)
|
||||
{
|
||||
dma_free_coherent(pinfo->port.dev, L1_CACHE_ALIGN(pinfo->rx_nrfifos *
|
||||
pinfo->rx_fifosize) +
|
||||
L1_CACHE_ALIGN(pinfo->tx_nrfifos *
|
||||
pinfo->tx_fifosize), pinfo->mem_addr,
|
||||
pinfo->dma_addr);
|
||||
|
||||
cpm_dpfree(pinfo->dp_addr);
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Driver for CPM (SCC/SMC) serial ports
|
||||
*
|
||||
* definitions for cpm1
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CPM_UART_CPM1_H
|
||||
#define CPM_UART_CPM1_H
|
||||
|
||||
#include <asm/cpm1.h>
|
||||
|
||||
static inline void cpm_set_brg(int brg, int baud)
|
||||
{
|
||||
cpm_setbrg(brg, baud);
|
||||
}
|
||||
|
||||
static inline void cpm_set_scc_fcr(scc_uart_t __iomem * sup)
|
||||
{
|
||||
out_8(&sup->scc_genscc.scc_rfcr, SMC_EB);
|
||||
out_8(&sup->scc_genscc.scc_tfcr, SMC_EB);
|
||||
}
|
||||
|
||||
static inline void cpm_set_smc_fcr(smc_uart_t __iomem * up)
|
||||
{
|
||||
out_8(&up->smc_rfcr, SMC_EB);
|
||||
out_8(&up->smc_tfcr, SMC_EB);
|
||||
}
|
||||
|
||||
#define DPRAM_BASE ((u8 __iomem __force *)cpm_dpram_addr(0))
|
||||
|
||||
#endif
|
@ -1,156 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Driver for CPM (SCC/SMC) serial ports; CPM2 definitions
|
||||
*
|
||||
* Maintainer: Kumar Gala (galak@kernel.crashing.org) (CPM2)
|
||||
* Pantelis Antoniou (panto@intracom.gr) (CPM1)
|
||||
*
|
||||
* Copyright (C) 2004 Freescale Semiconductor, Inc.
|
||||
* (C) 2004 Intracom, S.A.
|
||||
* (C) 2006 MontaVista Software, Inc.
|
||||
* Vitaly Bordug <vbordug@ru.mvista.com>
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/tty.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/serial.h>
|
||||
#include <linux/console.h>
|
||||
#include <linux/sysrq.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/fs_pd.h>
|
||||
|
||||
#include <linux/serial_core.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#include "cpm_uart.h"
|
||||
|
||||
/**************************************************************/
|
||||
|
||||
void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
|
||||
{
|
||||
cpm_command(port->command, cmd);
|
||||
}
|
||||
|
||||
void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
|
||||
struct device_node *np)
|
||||
{
|
||||
void __iomem *pram;
|
||||
unsigned long offset;
|
||||
struct resource res;
|
||||
resource_size_t len;
|
||||
|
||||
/* Don't remap parameter RAM if it has already been initialized
|
||||
* during console setup.
|
||||
*/
|
||||
if (IS_SMC(port) && port->smcup)
|
||||
return port->smcup;
|
||||
else if (!IS_SMC(port) && port->sccup)
|
||||
return port->sccup;
|
||||
|
||||
if (of_address_to_resource(np, 1, &res))
|
||||
return NULL;
|
||||
|
||||
len = resource_size(&res);
|
||||
pram = ioremap(res.start, len);
|
||||
if (!pram)
|
||||
return NULL;
|
||||
|
||||
if (!IS_SMC(port))
|
||||
return pram;
|
||||
|
||||
if (len != 2) {
|
||||
printk(KERN_WARNING "cpm_uart[%d]: device tree references "
|
||||
"SMC pram, using boot loader/wrapper pram mapping. "
|
||||
"Please fix your device tree to reference the pram "
|
||||
"base register instead.\n",
|
||||
port->port.line);
|
||||
return pram;
|
||||
}
|
||||
|
||||
offset = cpm_dpalloc(PROFF_SMC_SIZE, 64);
|
||||
out_be16(pram, offset);
|
||||
iounmap(pram);
|
||||
return cpm_muram_addr(offset);
|
||||
}
|
||||
|
||||
void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram)
|
||||
{
|
||||
if (!IS_SMC(port))
|
||||
iounmap(pram);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate DP-Ram and memory buffers. We need to allocate a transmit and
|
||||
* receive buffer descriptors from dual port ram, and a character
|
||||
* buffer area from host mem. If we are allocating for the console we need
|
||||
* to do it from bootmem
|
||||
*/
|
||||
int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
|
||||
{
|
||||
int dpmemsz, memsz;
|
||||
u8 __iomem *dp_mem;
|
||||
unsigned long dp_offset;
|
||||
u8 *mem_addr;
|
||||
dma_addr_t dma_addr = 0;
|
||||
|
||||
pr_debug("CPM uart[%d]:allocbuf\n", pinfo->port.line);
|
||||
|
||||
dpmemsz = sizeof(cbd_t) * (pinfo->rx_nrfifos + pinfo->tx_nrfifos);
|
||||
dp_offset = cpm_dpalloc(dpmemsz, 8);
|
||||
if (IS_ERR_VALUE(dp_offset)) {
|
||||
printk(KERN_ERR
|
||||
"cpm_uart_cpm.c: could not allocate buffer descriptors\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
dp_mem = cpm_dpram_addr(dp_offset);
|
||||
|
||||
memsz = L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize) +
|
||||
L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize);
|
||||
if (is_con) {
|
||||
mem_addr = kzalloc(memsz, GFP_NOWAIT);
|
||||
dma_addr = virt_to_bus(mem_addr);
|
||||
}
|
||||
else
|
||||
mem_addr = dma_alloc_coherent(pinfo->port.dev, memsz, &dma_addr,
|
||||
GFP_KERNEL);
|
||||
|
||||
if (mem_addr == NULL) {
|
||||
cpm_dpfree(dp_offset);
|
||||
printk(KERN_ERR
|
||||
"cpm_uart_cpm.c: could not allocate coherent memory\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
pinfo->dp_addr = dp_offset;
|
||||
pinfo->mem_addr = mem_addr;
|
||||
pinfo->dma_addr = dma_addr;
|
||||
pinfo->mem_size = memsz;
|
||||
|
||||
pinfo->rx_buf = mem_addr;
|
||||
pinfo->tx_buf = pinfo->rx_buf + L1_CACHE_ALIGN(pinfo->rx_nrfifos
|
||||
* pinfo->rx_fifosize);
|
||||
|
||||
pinfo->rx_bd_base = (cbd_t __iomem *)dp_mem;
|
||||
pinfo->tx_bd_base = pinfo->rx_bd_base + pinfo->rx_nrfifos;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cpm_uart_freebuf(struct uart_cpm_port *pinfo)
|
||||
{
|
||||
dma_free_coherent(pinfo->port.dev, L1_CACHE_ALIGN(pinfo->rx_nrfifos *
|
||||
pinfo->rx_fifosize) +
|
||||
L1_CACHE_ALIGN(pinfo->tx_nrfifos *
|
||||
pinfo->tx_fifosize), (void __force *)pinfo->mem_addr,
|
||||
pinfo->dma_addr);
|
||||
|
||||
cpm_dpfree(pinfo->dp_addr);
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Driver for CPM (SCC/SMC) serial ports
|
||||
*
|
||||
* definitions for cpm2
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CPM_UART_CPM2_H
|
||||
#define CPM_UART_CPM2_H
|
||||
|
||||
#include <asm/cpm2.h>
|
||||
|
||||
static inline void cpm_set_brg(int brg, int baud)
|
||||
{
|
||||
cpm_setbrg(brg, baud);
|
||||
}
|
||||
|
||||
static inline void cpm_set_scc_fcr(scc_uart_t __iomem *sup)
|
||||
{
|
||||
out_8(&sup->scc_genscc.scc_rfcr, CPMFCR_GBL | CPMFCR_EB);
|
||||
out_8(&sup->scc_genscc.scc_tfcr, CPMFCR_GBL | CPMFCR_EB);
|
||||
}
|
||||
|
||||
static inline void cpm_set_smc_fcr(smc_uart_t __iomem *up)
|
||||
{
|
||||
out_8(&up->smc_rfcr, CPMFCR_GBL | CPMFCR_EB);
|
||||
out_8(&up->smc_tfcr, CPMFCR_GBL | CPMFCR_EB);
|
||||
}
|
||||
|
||||
#define DPRAM_BASE ((u8 __iomem __force *)cpm_dpram_addr(0))
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user