aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/serial/mos7840.c115
1 files changed, 0 insertions, 115 deletions
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 270009afdf77..b93f0f992d9f 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -2134,106 +2134,6 @@ static int mos7840_get_lsr_info(struct tty_struct *tty,
2134} 2134}
2135 2135
2136/***************************************************************************** 2136/*****************************************************************************
2137 * mos7840_set_modem_info
2138 * function to set modem info
2139 *****************************************************************************/
2140
2141/* FIXME: Should be using the model control hooks */
2142
2143static int mos7840_set_modem_info(struct moschip_port *mos7840_port,
2144 unsigned int cmd, unsigned int __user *value)
2145{
2146 unsigned int mcr;
2147 unsigned int arg;
2148 __u16 Data;
2149 int status;
2150 struct usb_serial_port *port;
2151
2152 if (mos7840_port == NULL)
2153 return -1;
2154
2155 port = (struct usb_serial_port *)mos7840_port->port;
2156 if (mos7840_port_paranoia_check(port, __func__)) {
2157 dbg("%s", "Invalid port");
2158 return -1;
2159 }
2160
2161 mcr = mos7840_port->shadowMCR;
2162
2163 if (copy_from_user(&arg, value, sizeof(int)))
2164 return -EFAULT;
2165
2166 switch (cmd) {
2167 case TIOCMBIS:
2168 if (arg & TIOCM_RTS)
2169 mcr |= MCR_RTS;
2170 if (arg & TIOCM_DTR)
2171 mcr |= MCR_RTS;
2172 if (arg & TIOCM_LOOP)
2173 mcr |= MCR_LOOPBACK;
2174 break;
2175
2176 case TIOCMBIC:
2177 if (arg & TIOCM_RTS)
2178 mcr &= ~MCR_RTS;
2179 if (arg & TIOCM_DTR)
2180 mcr &= ~MCR_RTS;
2181 if (arg & TIOCM_LOOP)
2182 mcr &= ~MCR_LOOPBACK;
2183 break;
2184
2185 case TIOCMSET:
2186 /* turn off the RTS and DTR and LOOPBACK
2187 * and then only turn on what was asked to */
2188 mcr &= ~(MCR_RTS | MCR_DTR | MCR_LOOPBACK);
2189 mcr |= ((arg & TIOCM_RTS) ? MCR_RTS : 0);
2190 mcr |= ((arg & TIOCM_DTR) ? MCR_DTR : 0);
2191 mcr |= ((arg & TIOCM_LOOP) ? MCR_LOOPBACK : 0);
2192 break;
2193 }
2194
2195 lock_kernel();
2196 mos7840_port->shadowMCR = mcr;
2197
2198 Data = mos7840_port->shadowMCR;
2199 status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, Data);
2200 unlock_kernel();
2201 if (status < 0) {
2202 dbg("setting MODEM_CONTROL_REGISTER Failed");
2203 return -1;
2204 }
2205
2206 return 0;
2207}
2208
2209/*****************************************************************************
2210 * mos7840_get_modem_info
2211 * function to get modem info
2212 *****************************************************************************/
2213
2214static int mos7840_get_modem_info(struct moschip_port *mos7840_port,
2215 unsigned int __user *value)
2216{
2217 unsigned int result = 0;
2218 __u16 msr;
2219 unsigned int mcr = mos7840_port->shadowMCR;
2220 mos7840_get_uart_reg(mos7840_port->port,
2221 MODEM_STATUS_REGISTER, &msr);
2222 result = ((mcr & MCR_DTR) ? TIOCM_DTR : 0) /* 0x002 */
2223 |((mcr & MCR_RTS) ? TIOCM_RTS : 0) /* 0x004 */
2224 |((msr & MOS7840_MSR_CTS) ? TIOCM_CTS : 0) /* 0x020 */
2225 |((msr & MOS7840_MSR_CD) ? TIOCM_CAR : 0) /* 0x040 */
2226 |((msr & MOS7840_MSR_RI) ? TIOCM_RI : 0) /* 0x080 */
2227 |((msr & MOS7840_MSR_DSR) ? TIOCM_DSR : 0); /* 0x100 */
2228
2229 dbg("%s -- %x", __func__, result);
2230
2231 if (copy_to_user(value, &result, sizeof(int)))
2232 return -EFAULT;
2233 return 0;
2234}
2235
2236/*****************************************************************************
2237 * mos7840_get_serial_info 2137 * mos7840_get_serial_info
2238 * function to get information about serial port 2138 * function to get information about serial port
2239 *****************************************************************************/ 2139 *****************************************************************************/
@@ -2281,7 +2181,6 @@ static int mos7840_ioctl(struct tty_struct *tty, struct file *file,
2281 struct async_icount cnow; 2181 struct async_icount cnow;
2282 struct async_icount cprev; 2182 struct async_icount cprev;
2283 struct serial_icounter_struct icount; 2183 struct serial_icounter_struct icount;
2284 int mosret = 0;
2285 2184
2286 if (mos7840_port_paranoia_check(port, __func__)) { 2185 if (mos7840_port_paranoia_check(port, __func__)) {
2287 dbg("%s", "Invalid port"); 2186 dbg("%s", "Invalid port");
@@ -2303,20 +2202,6 @@ static int mos7840_ioctl(struct tty_struct *tty, struct file *file,
2303 return mos7840_get_lsr_info(tty, argp); 2202 return mos7840_get_lsr_info(tty, argp);
2304 return 0; 2203 return 0;
2305 2204
2306 /* FIXME: use the modem hooks and remove this */
2307 case TIOCMBIS:
2308 case TIOCMBIC:
2309 case TIOCMSET:
2310 dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", __func__,
2311 port->number);
2312 mosret =
2313 mos7840_set_modem_info(mos7840_port, cmd, argp);
2314 return mosret;
2315
2316 case TIOCMGET:
2317 dbg("%s (%d) TIOCMGET", __func__, port->number);
2318 return mos7840_get_modem_info(mos7840_port, argp);
2319
2320 case TIOCGSERIAL: 2205 case TIOCGSERIAL:
2321 dbg("%s (%d) TIOCGSERIAL", __func__, port->number); 2206 dbg("%s (%d) TIOCGSERIAL", __func__, port->number);
2322 return mos7840_get_serial_info(mos7840_port, argp); 2207 return mos7840_get_serial_info(mos7840_port, argp);