mos7720.c (fa251f89903d73989e2f63e13d0eaed1e07ce0da) mos7720.c (0bca1b913affbd7e2fdaffee62a499659a466eb5)
1/*
2 * mos7720.c
3 * Controls the Moschip 7720 usb to dual port serial convertor
4 *
5 * Copyright 2006 Moschip Semiconductor Tech. Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by

--- 1882 unchanged lines hidden (view full) ---

1891
1892 mos7720_port->shadowMCR = mcr;
1893 write_mos_reg(port->serial, port->number - port->serial->minor,
1894 MCR, mos7720_port->shadowMCR);
1895
1896 return 0;
1897}
1898
1/*
2 * mos7720.c
3 * Controls the Moschip 7720 usb to dual port serial convertor
4 *
5 * Copyright 2006 Moschip Semiconductor Tech. Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by

--- 1882 unchanged lines hidden (view full) ---

1891
1892 mos7720_port->shadowMCR = mcr;
1893 write_mos_reg(port->serial, port->number - port->serial->minor,
1894 MCR, mos7720_port->shadowMCR);
1895
1896 return 0;
1897}
1898
1899static int mos7720_get_icount(struct tty_struct *tty,
1900 struct serial_icounter_struct *icount)
1901{
1902 struct usb_serial_port *port = tty->driver_data;
1903 struct moschip_port *mos7720_port;
1904 struct async_icount cnow;
1905
1906 mos7720_port = usb_get_serial_port_data(port);
1907 cnow = mos7720_port->icount;
1908
1909 icount->cts = cnow.cts;
1910 icount->dsr = cnow.dsr;
1911 icount->rng = cnow.rng;
1912 icount->dcd = cnow.dcd;
1913 icount->rx = cnow.rx;
1914 icount->tx = cnow.tx;
1915 icount->frame = cnow.frame;
1916 icount->overrun = cnow.overrun;
1917 icount->parity = cnow.parity;
1918 icount->brk = cnow.brk;
1919 icount->buf_overrun = cnow.buf_overrun;
1920
1921 dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__,
1922 port->number, icount->rx, icount->tx);
1923 return 0;
1924}
1925
1899static int set_modem_info(struct moschip_port *mos7720_port, unsigned int cmd,
1900 unsigned int __user *value)
1901{
1926static int set_modem_info(struct moschip_port *mos7720_port, unsigned int cmd,
1927 unsigned int __user *value)
1928{
1902 unsigned int mcr ;
1929 unsigned int mcr;
1903 unsigned int arg;
1904
1905 struct usb_serial_port *port;
1906
1907 if (mos7720_port == NULL)
1908 return -1;
1909
1910 port = (struct usb_serial_port *)mos7720_port->port;

--- 57 unchanged lines hidden (view full) ---

1968
1969static int mos7720_ioctl(struct tty_struct *tty, struct file *file,
1970 unsigned int cmd, unsigned long arg)
1971{
1972 struct usb_serial_port *port = tty->driver_data;
1973 struct moschip_port *mos7720_port;
1974 struct async_icount cnow;
1975 struct async_icount cprev;
1930 unsigned int arg;
1931
1932 struct usb_serial_port *port;
1933
1934 if (mos7720_port == NULL)
1935 return -1;
1936
1937 port = (struct usb_serial_port *)mos7720_port->port;

--- 57 unchanged lines hidden (view full) ---

1995
1996static int mos7720_ioctl(struct tty_struct *tty, struct file *file,
1997 unsigned int cmd, unsigned long arg)
1998{
1999 struct usb_serial_port *port = tty->driver_data;
2000 struct moschip_port *mos7720_port;
2001 struct async_icount cnow;
2002 struct async_icount cprev;
1976 struct serial_icounter_struct icount;
1977
1978 mos7720_port = usb_get_serial_port_data(port);
1979 if (mos7720_port == NULL)
1980 return -ENODEV;
1981
1982 dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd);
1983
1984 switch (cmd) {

--- 31 unchanged lines hidden (view full) ---

2016 ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
2017 ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) {
2018 return 0;
2019 }
2020 cprev = cnow;
2021 }
2022 /* NOTREACHED */
2023 break;
2003
2004 mos7720_port = usb_get_serial_port_data(port);
2005 if (mos7720_port == NULL)
2006 return -ENODEV;
2007
2008 dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd);
2009
2010 switch (cmd) {

--- 31 unchanged lines hidden (view full) ---

2042 ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
2043 ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) {
2044 return 0;
2045 }
2046 cprev = cnow;
2047 }
2048 /* NOTREACHED */
2049 break;
2024
2025 case TIOCGICOUNT:
2026 cnow = mos7720_port->icount;
2027
2028 memset(&icount, 0, sizeof(struct serial_icounter_struct));
2029
2030 icount.cts = cnow.cts;
2031 icount.dsr = cnow.dsr;
2032 icount.rng = cnow.rng;
2033 icount.dcd = cnow.dcd;
2034 icount.rx = cnow.rx;
2035 icount.tx = cnow.tx;
2036 icount.frame = cnow.frame;
2037 icount.overrun = cnow.overrun;
2038 icount.parity = cnow.parity;
2039 icount.brk = cnow.brk;
2040 icount.buf_overrun = cnow.buf_overrun;
2041
2042 dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__,
2043 port->number, icount.rx, icount.tx);
2044 if (copy_to_user((void __user *)arg, &icount, sizeof(icount)))
2045 return -EFAULT;
2046 return 0;
2047 }
2048
2049 return -ENOIOCTLCMD;
2050}
2051
2052static int mos7720_startup(struct usb_serial *serial)
2053{
2054 struct moschip_port *mos7720_port;

--- 152 unchanged lines hidden (view full) ---

2207 .throttle = mos7720_throttle,
2208 .unthrottle = mos7720_unthrottle,
2209 .probe = mos77xx_probe,
2210 .attach = mos7720_startup,
2211 .release = mos7720_release,
2212 .ioctl = mos7720_ioctl,
2213 .tiocmget = mos7720_tiocmget,
2214 .tiocmset = mos7720_tiocmset,
2050 }
2051
2052 return -ENOIOCTLCMD;
2053}
2054
2055static int mos7720_startup(struct usb_serial *serial)
2056{
2057 struct moschip_port *mos7720_port;

--- 152 unchanged lines hidden (view full) ---

2210 .throttle = mos7720_throttle,
2211 .unthrottle = mos7720_unthrottle,
2212 .probe = mos77xx_probe,
2213 .attach = mos7720_startup,
2214 .release = mos7720_release,
2215 .ioctl = mos7720_ioctl,
2216 .tiocmget = mos7720_tiocmget,
2217 .tiocmset = mos7720_tiocmset,
2218 .get_icount = mos7720_get_icount,
2215 .set_termios = mos7720_set_termios,
2216 .write = mos7720_write,
2217 .write_room = mos7720_write_room,
2218 .chars_in_buffer = mos7720_chars_in_buffer,
2219 .break_ctl = mos7720_break,
2220 .read_bulk_callback = mos7720_bulk_in_callback,
2221 .read_int_callback = NULL /* dynamically assigned in probe() */
2222};

--- 45 unchanged lines hidden ---
2219 .set_termios = mos7720_set_termios,
2220 .write = mos7720_write,
2221 .write_room = mos7720_write_room,
2222 .chars_in_buffer = mos7720_chars_in_buffer,
2223 .break_ctl = mos7720_break,
2224 .read_bulk_callback = mos7720_bulk_in_callback,
2225 .read_int_callback = NULL /* dynamically assigned in probe() */
2226};

--- 45 unchanged lines hidden ---