aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/misc/Makefile2
-rw-r--r--drivers/misc/pch_phub.c4
-rw-r--r--drivers/misc/pti.c99
-rw-r--r--drivers/parport/parport_pc.c54
-rw-r--r--drivers/parport/parport_serial.c229
-rw-r--r--drivers/tty/moxa.c5
-rw-r--r--drivers/tty/mxser.c4
-rw-r--r--drivers/tty/n_gsm.c401
-rw-r--r--drivers/tty/n_tty.c2
-rw-r--r--drivers/tty/serial/8250.c4
-rw-r--r--drivers/tty/serial/8250_pci.c183
-rw-r--r--drivers/tty/serial/Kconfig2
-rw-r--r--drivers/tty/serial/pch_uart.c11
-rw-r--r--drivers/tty/serial/s5pv210.c4
-rw-r--r--drivers/tty/serial/samsung.c27
-rw-r--r--drivers/tty/tty_io.c4
-rw-r--r--include/linux/gsmmux.h11
-rw-r--r--include/linux/pci_ids.h4
-rw-r--r--include/linux/pti.h3
-rw-r--r--include/linux/tty.h37
20 files changed, 903 insertions, 187 deletions
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 33282157bc3c..8f3efb68a141 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -6,7 +6,7 @@ obj-$(CONFIG_IBM_ASM) += ibmasm/
6obj-$(CONFIG_AD525X_DPOT) += ad525x_dpot.o 6obj-$(CONFIG_AD525X_DPOT) += ad525x_dpot.o
7obj-$(CONFIG_AD525X_DPOT_I2C) += ad525x_dpot-i2c.o 7obj-$(CONFIG_AD525X_DPOT_I2C) += ad525x_dpot-i2c.o
8obj-$(CONFIG_AD525X_DPOT_SPI) += ad525x_dpot-spi.o 8obj-$(CONFIG_AD525X_DPOT_SPI) += ad525x_dpot-spi.o
90bj-$(CONFIG_INTEL_MID_PTI) += pti.o 9obj-$(CONFIG_INTEL_MID_PTI) += pti.o
10obj-$(CONFIG_ATMEL_PWM) += atmel_pwm.o 10obj-$(CONFIG_ATMEL_PWM) += atmel_pwm.o
11obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o 11obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o
12obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o 12obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o
diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c
index 01eb67b4871a..0fd7e77bee29 100644
--- a/drivers/misc/pch_phub.c
+++ b/drivers/misc/pch_phub.c
@@ -735,6 +735,8 @@ static int __devinit pch_phub_probe(struct pci_dev *pdev,
735 * Device8(GbE) 735 * Device8(GbE)
736 */ 736 */
737 iowrite32(0x000a0000, chip->pch_phub_base_address + 0x14); 737 iowrite32(0x000a0000, chip->pch_phub_base_address + 0x14);
738 /* set the interrupt delay value */
739 iowrite32(0x25, chip->pch_phub_base_address + 0x140);
738 chip->pch_opt_rom_start_address =\ 740 chip->pch_opt_rom_start_address =\
739 PCH_PHUB_ROM_START_ADDR_ML7223; 741 PCH_PHUB_ROM_START_ADDR_ML7223;
740 chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223; 742 chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223;
@@ -752,8 +754,6 @@ static int __devinit pch_phub_probe(struct pci_dev *pdev,
752 * Device6(SATA 2):f 754 * Device6(SATA 2):f
753 */ 755 */
754 iowrite32(0x0000ffa0, chip->pch_phub_base_address + 0x14); 756 iowrite32(0x0000ffa0, chip->pch_phub_base_address + 0x14);
755 /* set the interrupt delay value */
756 iowrite32(0x25, chip->pch_phub_base_address + 0x140);
757 chip->pch_opt_rom_start_address =\ 757 chip->pch_opt_rom_start_address =\
758 PCH_PHUB_ROM_START_ADDR_ML7223; 758 PCH_PHUB_ROM_START_ADDR_ML7223;
759 chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223; 759 chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223;
diff --git a/drivers/misc/pti.c b/drivers/misc/pti.c
index e5f295a38a34..8653bd0b1a33 100644
--- a/drivers/misc/pti.c
+++ b/drivers/misc/pti.c
@@ -146,45 +146,54 @@ static void pti_write_to_aperture(struct pti_masterchannel *mc,
146/** 146/**
147 * pti_control_frame_built_and_sent()- control frame build and send function. 147 * pti_control_frame_built_and_sent()- control frame build and send function.
148 * 148 *
149 * @mc: The master / channel structure on which the function 149 * @mc: The master / channel structure on which the function
150 * built a control frame. 150 * built a control frame.
151 * @thread_name: The thread name associated with the master / channel or
152 * 'NULL' if using the 'current' global variable.
151 * 153 *
152 * To be able to post process the PTI contents on host side, a control frame 154 * To be able to post process the PTI contents on host side, a control frame
153 * is added before sending any PTI content. So the host side knows on 155 * is added before sending any PTI content. So the host side knows on
154 * each PTI frame the name of the thread using a dedicated master / channel. 156 * each PTI frame the name of the thread using a dedicated master / channel.
155 * The thread name is retrieved from the 'current' global variable. 157 * The thread name is retrieved from 'current' global variable if 'thread_name'
158 * is 'NULL', else it is retrieved from 'thread_name' parameter.
156 * This function builds this frame and sends it to a master ID CONTROL_ID. 159 * This function builds this frame and sends it to a master ID CONTROL_ID.
157 * The overhead is only 32 bytes since the driver only writes to HW 160 * The overhead is only 32 bytes since the driver only writes to HW
158 * in 32 byte chunks. 161 * in 32 byte chunks.
159 */ 162 */
160 163static void pti_control_frame_built_and_sent(struct pti_masterchannel *mc,
161static void pti_control_frame_built_and_sent(struct pti_masterchannel *mc) 164 const char *thread_name)
162{ 165{
163 struct pti_masterchannel mccontrol = {.master = CONTROL_ID, 166 struct pti_masterchannel mccontrol = {.master = CONTROL_ID,
164 .channel = 0}; 167 .channel = 0};
168 const char *thread_name_p;
165 const char *control_format = "%3d %3d %s"; 169 const char *control_format = "%3d %3d %s";
166 u8 control_frame[CONTROL_FRAME_LEN]; 170 u8 control_frame[CONTROL_FRAME_LEN];
167 171
168 /* 172 if (!thread_name) {
169 * Since we access the comm member in current's task_struct, 173 /*
170 * we only need to be as large as what 'comm' in that 174 * Since we access the comm member in current's task_struct,
171 * structure is. 175 * we only need to be as large as what 'comm' in that
172 */ 176 * structure is.
173 char comm[TASK_COMM_LEN]; 177 */
178 char comm[TASK_COMM_LEN];
174 179
175 if (!in_interrupt()) 180 if (!in_interrupt())
176 get_task_comm(comm, current); 181 get_task_comm(comm, current);
177 else 182 else
178 strncpy(comm, "Interrupt", TASK_COMM_LEN); 183 strncpy(comm, "Interrupt", TASK_COMM_LEN);
179 184
180 /* Absolutely ensure our buffer is zero terminated. */ 185 /* Absolutely ensure our buffer is zero terminated. */
181 comm[TASK_COMM_LEN-1] = 0; 186 comm[TASK_COMM_LEN-1] = 0;
187 thread_name_p = comm;
188 } else {
189 thread_name_p = thread_name;
190 }
182 191
183 mccontrol.channel = pti_control_channel; 192 mccontrol.channel = pti_control_channel;
184 pti_control_channel = (pti_control_channel + 1) & 0x7f; 193 pti_control_channel = (pti_control_channel + 1) & 0x7f;
185 194
186 snprintf(control_frame, CONTROL_FRAME_LEN, control_format, mc->master, 195 snprintf(control_frame, CONTROL_FRAME_LEN, control_format, mc->master,
187 mc->channel, comm); 196 mc->channel, thread_name_p);
188 pti_write_to_aperture(&mccontrol, control_frame, strlen(control_frame)); 197 pti_write_to_aperture(&mccontrol, control_frame, strlen(control_frame));
189} 198}
190 199
@@ -206,18 +215,20 @@ static void pti_write_full_frame_to_aperture(struct pti_masterchannel *mc,
206 const unsigned char *buf, 215 const unsigned char *buf,
207 int len) 216 int len)
208{ 217{
209 pti_control_frame_built_and_sent(mc); 218 pti_control_frame_built_and_sent(mc, NULL);
210 pti_write_to_aperture(mc, (u8 *)buf, len); 219 pti_write_to_aperture(mc, (u8 *)buf, len);
211} 220}
212 221
213/** 222/**
214 * get_id()- Allocate a master and channel ID. 223 * get_id()- Allocate a master and channel ID.
215 * 224 *
216 * @id_array: an array of bits representing what channel 225 * @id_array: an array of bits representing what channel
217 * id's are allocated for writing. 226 * id's are allocated for writing.
218 * @max_ids: The max amount of available write IDs to use. 227 * @max_ids: The max amount of available write IDs to use.
219 * @base_id: The starting SW channel ID, based on the Intel 228 * @base_id: The starting SW channel ID, based on the Intel
220 * PTI arch. 229 * PTI arch.
230 * @thread_name: The thread name associated with the master / channel or
231 * 'NULL' if using the 'current' global variable.
221 * 232 *
222 * Returns: 233 * Returns:
223 * pti_masterchannel struct with master, channel ID address 234 * pti_masterchannel struct with master, channel ID address
@@ -227,7 +238,10 @@ static void pti_write_full_frame_to_aperture(struct pti_masterchannel *mc,
227 * channel id. The bit is one if the id is taken and 0 if free. For 238 * channel id. The bit is one if the id is taken and 0 if free. For
228 * every master there are 128 channel id's. 239 * every master there are 128 channel id's.
229 */ 240 */
230static struct pti_masterchannel *get_id(u8 *id_array, int max_ids, int base_id) 241static struct pti_masterchannel *get_id(u8 *id_array,
242 int max_ids,
243 int base_id,
244 const char *thread_name)
231{ 245{
232 struct pti_masterchannel *mc; 246 struct pti_masterchannel *mc;
233 int i, j, mask; 247 int i, j, mask;
@@ -257,7 +271,7 @@ static struct pti_masterchannel *get_id(u8 *id_array, int max_ids, int base_id)
257 mc->master = base_id; 271 mc->master = base_id;
258 mc->channel = ((i & 0xf)<<3) + j; 272 mc->channel = ((i & 0xf)<<3) + j;
259 /* write new master Id / channel Id allocation to channel control */ 273 /* write new master Id / channel Id allocation to channel control */
260 pti_control_frame_built_and_sent(mc); 274 pti_control_frame_built_and_sent(mc, thread_name);
261 return mc; 275 return mc;
262} 276}
263 277
@@ -273,18 +287,22 @@ static struct pti_masterchannel *get_id(u8 *id_array, int max_ids, int base_id)
273 * a master, channel ID address 287 * a master, channel ID address
274 * to write to PTI HW. 288 * to write to PTI HW.
275 * 289 *
276 * @type: 0- request Application master, channel aperture ID write address. 290 * @type: 0- request Application master, channel aperture ID
277 * 1- request OS master, channel aperture ID write 291 * write address.
278 * address. 292 * 1- request OS master, channel aperture ID write
279 * 2- request Modem master, channel aperture ID 293 * address.
280 * write address. 294 * 2- request Modem master, channel aperture ID
281 * Other values, error. 295 * write address.
296 * Other values, error.
297 * @thread_name: The thread name associated with the master / channel or
298 * 'NULL' if using the 'current' global variable.
282 * 299 *
283 * Returns: 300 * Returns:
284 * pti_masterchannel struct 301 * pti_masterchannel struct
285 * 0 for error 302 * 0 for error
286 */ 303 */
287struct pti_masterchannel *pti_request_masterchannel(u8 type) 304struct pti_masterchannel *pti_request_masterchannel(u8 type,
305 const char *thread_name)
288{ 306{
289 struct pti_masterchannel *mc; 307 struct pti_masterchannel *mc;
290 308
@@ -293,15 +311,18 @@ struct pti_masterchannel *pti_request_masterchannel(u8 type)
293 switch (type) { 311 switch (type) {
294 312
295 case 0: 313 case 0:
296 mc = get_id(drv_data->ia_app, MAX_APP_IDS, APP_BASE_ID); 314 mc = get_id(drv_data->ia_app, MAX_APP_IDS,
315 APP_BASE_ID, thread_name);
297 break; 316 break;
298 317
299 case 1: 318 case 1:
300 mc = get_id(drv_data->ia_os, MAX_OS_IDS, OS_BASE_ID); 319 mc = get_id(drv_data->ia_os, MAX_OS_IDS,
320 OS_BASE_ID, thread_name);
301 break; 321 break;
302 322
303 case 2: 323 case 2:
304 mc = get_id(drv_data->ia_modem, MAX_MODEM_IDS, MODEM_BASE_ID); 324 mc = get_id(drv_data->ia_modem, MAX_MODEM_IDS,
325 MODEM_BASE_ID, thread_name);
305 break; 326 break;
306 default: 327 default:
307 mc = NULL; 328 mc = NULL;
@@ -472,9 +493,9 @@ static int pti_tty_install(struct tty_driver *driver, struct tty_struct *tty)
472 return -ENOMEM; 493 return -ENOMEM;
473 494
474 if (idx == PTITTY_MINOR_START) 495 if (idx == PTITTY_MINOR_START)
475 pti_tty_data->mc = pti_request_masterchannel(0); 496 pti_tty_data->mc = pti_request_masterchannel(0, NULL);
476 else 497 else
477 pti_tty_data->mc = pti_request_masterchannel(2); 498 pti_tty_data->mc = pti_request_masterchannel(2, NULL);
478 499
479 if (pti_tty_data->mc == NULL) { 500 if (pti_tty_data->mc == NULL) {
480 kfree(pti_tty_data); 501 kfree(pti_tty_data);
@@ -563,7 +584,7 @@ static int pti_char_open(struct inode *inode, struct file *filp)
563 * before assigning the value to filp->private_data. 584 * before assigning the value to filp->private_data.
564 * Slightly easier to debug if this driver needs debugging. 585 * Slightly easier to debug if this driver needs debugging.
565 */ 586 */
566 mc = pti_request_masterchannel(0); 587 mc = pti_request_masterchannel(0, NULL);
567 if (mc == NULL) 588 if (mc == NULL)
568 return -ENOMEM; 589 return -ENOMEM;
569 filp->private_data = mc; 590 filp->private_data = mc;
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index f330338c2f22..d1cdb9449f84 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -2864,24 +2864,6 @@ enum parport_pc_pci_cards {
2864 lava_parallel_dual_b, 2864 lava_parallel_dual_b,
2865 boca_ioppar, 2865 boca_ioppar,
2866 plx_9050, 2866 plx_9050,
2867 timedia_4078a,
2868 timedia_4079h,
2869 timedia_4085h,
2870 timedia_4088a,
2871 timedia_4089a,
2872 timedia_4095a,
2873 timedia_4096a,
2874 timedia_4078u,
2875 timedia_4079a,
2876 timedia_4085u,
2877 timedia_4079r,
2878 timedia_4079s,
2879 timedia_4079d,
2880 timedia_4079e,
2881 timedia_4079f,
2882 timedia_9079a,
2883 timedia_9079b,
2884 timedia_9079c,
2885 timedia_4006a, 2867 timedia_4006a,
2886 timedia_4014, 2868 timedia_4014,
2887 timedia_4008a, 2869 timedia_4008a,
@@ -2940,24 +2922,6 @@ static struct parport_pc_pci {
2940 /* lava_parallel_dual_b */ { 1, { { 0, -1 }, } }, 2922 /* lava_parallel_dual_b */ { 1, { { 0, -1 }, } },
2941 /* boca_ioppar */ { 1, { { 0, -1 }, } }, 2923 /* boca_ioppar */ { 1, { { 0, -1 }, } },
2942 /* plx_9050 */ { 2, { { 4, -1 }, { 5, -1 }, } }, 2924 /* plx_9050 */ { 2, { { 4, -1 }, { 5, -1 }, } },
2943 /* timedia_4078a */ { 1, { { 2, -1 }, } },
2944 /* timedia_4079h */ { 1, { { 2, 3 }, } },
2945 /* timedia_4085h */ { 2, { { 2, -1 }, { 4, -1 }, } },
2946 /* timedia_4088a */ { 2, { { 2, 3 }, { 4, 5 }, } },
2947 /* timedia_4089a */ { 2, { { 2, 3 }, { 4, 5 }, } },
2948 /* timedia_4095a */ { 2, { { 2, 3 }, { 4, 5 }, } },
2949 /* timedia_4096a */ { 2, { { 2, 3 }, { 4, 5 }, } },
2950 /* timedia_4078u */ { 1, { { 2, -1 }, } },
2951 /* timedia_4079a */ { 1, { { 2, 3 }, } },
2952 /* timedia_4085u */ { 2, { { 2, -1 }, { 4, -1 }, } },
2953 /* timedia_4079r */ { 1, { { 2, 3 }, } },
2954 /* timedia_4079s */ { 1, { { 2, 3 }, } },
2955 /* timedia_4079d */ { 1, { { 2, 3 }, } },
2956 /* timedia_4079e */ { 1, { { 2, 3 }, } },
2957 /* timedia_4079f */ { 1, { { 2, 3 }, } },
2958 /* timedia_9079a */ { 1, { { 2, 3 }, } },
2959 /* timedia_9079b */ { 1, { { 2, 3 }, } },
2960 /* timedia_9079c */ { 1, { { 2, 3 }, } },
2961 /* timedia_4006a */ { 1, { { 0, -1 }, } }, 2925 /* timedia_4006a */ { 1, { { 0, -1 }, } },
2962 /* timedia_4014 */ { 2, { { 0, -1 }, { 2, -1 }, } }, 2926 /* timedia_4014 */ { 2, { { 0, -1 }, { 2, -1 }, } },
2963 /* timedia_4008a */ { 1, { { 0, 1 }, } }, 2927 /* timedia_4008a */ { 1, { { 0, 1 }, } },
@@ -3019,24 +2983,6 @@ static const struct pci_device_id parport_pc_pci_tbl[] = {
3019 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, 2983 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3020 PCI_SUBVENDOR_ID_EXSYS, PCI_SUBDEVICE_ID_EXSYS_4014, 0, 0, plx_9050 }, 2984 PCI_SUBVENDOR_ID_EXSYS, PCI_SUBDEVICE_ID_EXSYS_4014, 0, 0, plx_9050 },
3021 /* PCI_VENDOR_ID_TIMEDIA/SUNIX has many differing cards ...*/ 2985 /* PCI_VENDOR_ID_TIMEDIA/SUNIX has many differing cards ...*/
3022 { 0x1409, 0x7168, 0x1409, 0x4078, 0, 0, timedia_4078a },
3023 { 0x1409, 0x7168, 0x1409, 0x4079, 0, 0, timedia_4079h },
3024 { 0x1409, 0x7168, 0x1409, 0x4085, 0, 0, timedia_4085h },
3025 { 0x1409, 0x7168, 0x1409, 0x4088, 0, 0, timedia_4088a },
3026 { 0x1409, 0x7168, 0x1409, 0x4089, 0, 0, timedia_4089a },
3027 { 0x1409, 0x7168, 0x1409, 0x4095, 0, 0, timedia_4095a },
3028 { 0x1409, 0x7168, 0x1409, 0x4096, 0, 0, timedia_4096a },
3029 { 0x1409, 0x7168, 0x1409, 0x5078, 0, 0, timedia_4078u },
3030 { 0x1409, 0x7168, 0x1409, 0x5079, 0, 0, timedia_4079a },
3031 { 0x1409, 0x7168, 0x1409, 0x5085, 0, 0, timedia_4085u },
3032 { 0x1409, 0x7168, 0x1409, 0x6079, 0, 0, timedia_4079r },
3033 { 0x1409, 0x7168, 0x1409, 0x7079, 0, 0, timedia_4079s },
3034 { 0x1409, 0x7168, 0x1409, 0x8079, 0, 0, timedia_4079d },
3035 { 0x1409, 0x7168, 0x1409, 0x9079, 0, 0, timedia_4079e },
3036 { 0x1409, 0x7168, 0x1409, 0xa079, 0, 0, timedia_4079f },
3037 { 0x1409, 0x7168, 0x1409, 0xb079, 0, 0, timedia_9079a },
3038 { 0x1409, 0x7168, 0x1409, 0xc079, 0, 0, timedia_9079b },
3039 { 0x1409, 0x7168, 0x1409, 0xd079, 0, 0, timedia_9079c },
3040 { 0x1409, 0x7268, 0x1409, 0x0101, 0, 0, timedia_4006a }, 2986 { 0x1409, 0x7268, 0x1409, 0x0101, 0, 0, timedia_4006a },
3041 { 0x1409, 0x7268, 0x1409, 0x0102, 0, 0, timedia_4014 }, 2987 { 0x1409, 0x7268, 0x1409, 0x0102, 0, 0, timedia_4014 },
3042 { 0x1409, 0x7268, 0x1409, 0x0103, 0, 0, timedia_4008a }, 2988 { 0x1409, 0x7268, 0x1409, 0x0103, 0, 0, timedia_4008a },
diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
index f01e26440f11..e9c32274df3f 100644
--- a/drivers/parport/parport_serial.c
+++ b/drivers/parport/parport_serial.c
@@ -33,6 +33,9 @@ enum parport_pc_pci_cards {
33 netmos_9xx5_combo, 33 netmos_9xx5_combo,
34 netmos_9855, 34 netmos_9855,
35 netmos_9855_2p, 35 netmos_9855_2p,
36 netmos_9900,
37 netmos_9900_2p,
38 netmos_99xx_1p,
36 avlab_1s1p, 39 avlab_1s1p,
37 avlab_1s2p, 40 avlab_1s2p,
38 avlab_2s1p, 41 avlab_2s1p,
@@ -41,6 +44,24 @@ enum parport_pc_pci_cards {
41 siig_2p1s_20x, 44 siig_2p1s_20x,
42 siig_1s1p_20x, 45 siig_1s1p_20x,
43 siig_2s1p_20x, 46 siig_2s1p_20x,
47 timedia_4078a,
48 timedia_4079h,
49 timedia_4085h,
50 timedia_4088a,
51 timedia_4089a,
52 timedia_4095a,
53 timedia_4096a,
54 timedia_4078u,
55 timedia_4079a,
56 timedia_4085u,
57 timedia_4079r,
58 timedia_4079s,
59 timedia_4079d,
60 timedia_4079e,
61 timedia_4079f,
62 timedia_9079a,
63 timedia_9079b,
64 timedia_9079c,
44}; 65};
45 66
46/* each element directly indexed from enum list, above */ 67/* each element directly indexed from enum list, above */
@@ -72,22 +93,20 @@ static int __devinit netmos_parallel_init(struct pci_dev *dev, struct parport_pc
72 dev->subsystem_vendor == PCI_VENDOR_ID_IBM && 93 dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
73 dev->subsystem_device == 0x0299) 94 dev->subsystem_device == 0x0299)
74 return -ENODEV; 95 return -ENODEV;
75 /* 96
76 * Netmos uses the subdevice ID to indicate the number of parallel 97 if (dev->device == PCI_DEVICE_ID_NETMOS_9912) {
77 * and serial ports. The form is 0x00PS, where <P> is the number of 98 par->numports = 1;
78 * parallel ports and <S> is the number of serial ports. 99 } else {
79 */ 100 /*
80 par->numports = (dev->subsystem_device & 0xf0) >> 4; 101 * Netmos uses the subdevice ID to indicate the number of parallel
81 if (par->numports > ARRAY_SIZE(par->addr)) 102 * and serial ports. The form is 0x00PS, where <P> is the number of
82 par->numports = ARRAY_SIZE(par->addr); 103 * parallel ports and <S> is the number of serial ports.
83 /* 104 */
84 * This function is currently only called for cards with up to 105 par->numports = (dev->subsystem_device & 0xf0) >> 4;
85 * one parallel port. 106 if (par->numports > ARRAY_SIZE(par->addr))
86 * Parallel port BAR is either before or after serial ports BARS; 107 par->numports = ARRAY_SIZE(par->addr);
87 * hence, lo should be either 0 or equal to the number of serial ports. 108 }
88 */ 109
89 if (par->addr[0].lo != 0)
90 par->addr[0].lo = dev->subsystem_device & 0xf;
91 return 0; 110 return 0;
92} 111}
93 112
@@ -97,6 +116,9 @@ static struct parport_pc_pci cards[] __devinitdata = {
97 /* netmos_9xx5_combo */ { 1, { { 2, -1 }, }, netmos_parallel_init }, 116 /* netmos_9xx5_combo */ { 1, { { 2, -1 }, }, netmos_parallel_init },
98 /* netmos_9855 */ { 1, { { 0, -1 }, }, netmos_parallel_init }, 117 /* netmos_9855 */ { 1, { { 0, -1 }, }, netmos_parallel_init },
99 /* netmos_9855_2p */ { 2, { { 0, -1 }, { 2, -1 }, } }, 118 /* netmos_9855_2p */ { 2, { { 0, -1 }, { 2, -1 }, } },
119 /* netmos_9900 */ {1, { { 3, 4 }, }, netmos_parallel_init },
120 /* netmos_9900_2p */ {2, { { 0, 1 }, { 3, 4 }, } },
121 /* netmos_99xx_1p */ {1, { { 0, 1 }, } },
100 /* avlab_1s1p */ { 1, { { 1, 2}, } }, 122 /* avlab_1s1p */ { 1, { { 1, 2}, } },
101 /* avlab_1s2p */ { 2, { { 1, 2}, { 3, 4 },} }, 123 /* avlab_1s2p */ { 2, { { 1, 2}, { 3, 4 },} },
102 /* avlab_2s1p */ { 1, { { 2, 3}, } }, 124 /* avlab_2s1p */ { 1, { { 2, 3}, } },
@@ -105,6 +127,24 @@ static struct parport_pc_pci cards[] __devinitdata = {
105 /* siig_2p1s_20x */ { 2, { { 1, 2 }, { 3, 4 }, } }, 127 /* siig_2p1s_20x */ { 2, { { 1, 2 }, { 3, 4 }, } },
106 /* siig_1s1p_20x */ { 1, { { 1, 2 }, } }, 128 /* siig_1s1p_20x */ { 1, { { 1, 2 }, } },
107 /* siig_2s1p_20x */ { 1, { { 2, 3 }, } }, 129 /* siig_2s1p_20x */ { 1, { { 2, 3 }, } },
130 /* timedia_4078a */ { 1, { { 2, -1 }, } },
131 /* timedia_4079h */ { 1, { { 2, 3 }, } },
132 /* timedia_4085h */ { 2, { { 2, -1 }, { 4, -1 }, } },
133 /* timedia_4088a */ { 2, { { 2, 3 }, { 4, 5 }, } },
134 /* timedia_4089a */ { 2, { { 2, 3 }, { 4, 5 }, } },
135 /* timedia_4095a */ { 2, { { 2, 3 }, { 4, 5 }, } },
136 /* timedia_4096a */ { 2, { { 2, 3 }, { 4, 5 }, } },
137 /* timedia_4078u */ { 1, { { 2, -1 }, } },
138 /* timedia_4079a */ { 1, { { 2, 3 }, } },
139 /* timedia_4085u */ { 2, { { 2, -1 }, { 4, -1 }, } },
140 /* timedia_4079r */ { 1, { { 2, 3 }, } },
141 /* timedia_4079s */ { 1, { { 2, 3 }, } },
142 /* timedia_4079d */ { 1, { { 2, 3 }, } },
143 /* timedia_4079e */ { 1, { { 2, 3 }, } },
144 /* timedia_4079f */ { 1, { { 2, 3 }, } },
145 /* timedia_9079a */ { 1, { { 2, 3 }, } },
146 /* timedia_9079b */ { 1, { { 2, 3 }, } },
147 /* timedia_9079c */ { 1, { { 2, 3 }, } },
108}; 148};
109 149
110static struct pci_device_id parport_serial_pci_tbl[] = { 150static struct pci_device_id parport_serial_pci_tbl[] = {
@@ -127,6 +167,14 @@ static struct pci_device_id parport_serial_pci_tbl[] = {
127 0x1000, 0x0022, 0, 0, netmos_9855_2p }, 167 0x1000, 0x0022, 0, 0, netmos_9855_2p },
128 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9855, 168 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9855,
129 PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9855 }, 169 PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9855 },
170 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
171 0xA000, 0x3011, 0, 0, netmos_9900 },
172 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
173 0xA000, 0x3012, 0, 0, netmos_9900 },
174 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
175 0xA000, 0x3020, 0, 0, netmos_9900_2p },
176 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9912,
177 0xA000, 0x2000, 0, 0, netmos_99xx_1p },
130 /* PCI_VENDOR_ID_AVLAB/Intek21 has another bunch of cards ...*/ 178 /* PCI_VENDOR_ID_AVLAB/Intek21 has another bunch of cards ...*/
131 { PCI_VENDOR_ID_AFAVLAB, 0x2110, 179 { PCI_VENDOR_ID_AFAVLAB, 0x2110,
132 PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s1p }, 180 PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s1p },
@@ -176,6 +224,25 @@ static struct pci_device_id parport_serial_pci_tbl[] = {
176 PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2s1p_20x }, 224 PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2s1p_20x },
177 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_20x_850, 225 { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_20x_850,
178 PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2s1p_20x }, 226 PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2s1p_20x },
227 /* PCI_VENDOR_ID_TIMEDIA/SUNIX has many differing cards ...*/
228 { 0x1409, 0x7168, 0x1409, 0x4078, 0, 0, timedia_4078a },
229 { 0x1409, 0x7168, 0x1409, 0x4079, 0, 0, timedia_4079h },
230 { 0x1409, 0x7168, 0x1409, 0x4085, 0, 0, timedia_4085h },
231 { 0x1409, 0x7168, 0x1409, 0x4088, 0, 0, timedia_4088a },
232 { 0x1409, 0x7168, 0x1409, 0x4089, 0, 0, timedia_4089a },
233 { 0x1409, 0x7168, 0x1409, 0x4095, 0, 0, timedia_4095a },
234 { 0x1409, 0x7168, 0x1409, 0x4096, 0, 0, timedia_4096a },
235 { 0x1409, 0x7168, 0x1409, 0x5078, 0, 0, timedia_4078u },
236 { 0x1409, 0x7168, 0x1409, 0x5079, 0, 0, timedia_4079a },
237 { 0x1409, 0x7168, 0x1409, 0x5085, 0, 0, timedia_4085u },
238 { 0x1409, 0x7168, 0x1409, 0x6079, 0, 0, timedia_4079r },
239 { 0x1409, 0x7168, 0x1409, 0x7079, 0, 0, timedia_4079s },
240 { 0x1409, 0x7168, 0x1409, 0x8079, 0, 0, timedia_4079d },
241 { 0x1409, 0x7168, 0x1409, 0x9079, 0, 0, timedia_4079e },
242 { 0x1409, 0x7168, 0x1409, 0xa079, 0, 0, timedia_4079f },
243 { 0x1409, 0x7168, 0x1409, 0xb079, 0, 0, timedia_9079a },
244 { 0x1409, 0x7168, 0x1409, 0xc079, 0, 0, timedia_9079b },
245 { 0x1409, 0x7168, 0x1409, 0xd079, 0, 0, timedia_9079c },
179 246
180 { 0, } /* terminate list */ 247 { 0, } /* terminate list */
181}; 248};
@@ -219,6 +286,24 @@ static struct pciserial_board pci_parport_serial_boards[] __devinitdata = {
219 .base_baud = 115200, 286 .base_baud = 115200,
220 .uart_offset = 8, 287 .uart_offset = 8,
221 }, 288 },
289 [netmos_9900] = { /* n/t */
290 .flags = FL_BASE0 | FL_BASE_BARS,
291 .num_ports = 1,
292 .base_baud = 115200,
293 .uart_offset = 8,
294 },
295 [netmos_9900_2p] = { /* parallel only */ /* n/t */
296 .flags = FL_BASE0,
297 .num_ports = 0,
298 .base_baud = 115200,
299 .uart_offset = 8,
300 },
301 [netmos_99xx_1p] = { /* parallel only */ /* n/t */
302 .flags = FL_BASE0,
303 .num_ports = 0,
304 .base_baud = 115200,
305 .uart_offset = 8,
306 },
222 [avlab_1s1p] = { /* n/t */ 307 [avlab_1s1p] = { /* n/t */
223 .flags = FL_BASE0 | FL_BASE_BARS, 308 .flags = FL_BASE0 | FL_BASE_BARS,
224 .num_ports = 1, 309 .num_ports = 1,
@@ -267,6 +352,114 @@ static struct pciserial_board pci_parport_serial_boards[] __devinitdata = {
267 .base_baud = 921600, 352 .base_baud = 921600,
268 .uart_offset = 8, 353 .uart_offset = 8,
269 }, 354 },
355 [timedia_4078a] = {
356 .flags = FL_BASE0|FL_BASE_BARS,
357 .num_ports = 1,
358 .base_baud = 921600,
359 .uart_offset = 8,
360 },
361 [timedia_4079h] = {
362 .flags = FL_BASE0|FL_BASE_BARS,
363 .num_ports = 1,
364 .base_baud = 921600,
365 .uart_offset = 8,
366 },
367 [timedia_4085h] = {
368 .flags = FL_BASE0|FL_BASE_BARS,
369 .num_ports = 1,
370 .base_baud = 921600,
371 .uart_offset = 8,
372 },
373 [timedia_4088a] = {
374 .flags = FL_BASE0|FL_BASE_BARS,
375 .num_ports = 1,
376 .base_baud = 921600,
377 .uart_offset = 8,
378 },
379 [timedia_4089a] = {
380 .flags = FL_BASE0|FL_BASE_BARS,
381 .num_ports = 1,
382 .base_baud = 921600,
383 .uart_offset = 8,
384 },
385 [timedia_4095a] = {
386 .flags = FL_BASE0|FL_BASE_BARS,
387 .num_ports = 1,
388 .base_baud = 921600,
389 .uart_offset = 8,
390 },
391 [timedia_4096a] = {
392 .flags = FL_BASE0|FL_BASE_BARS,
393 .num_ports = 1,
394 .base_baud = 921600,
395 .uart_offset = 8,
396 },
397 [timedia_4078u] = {
398 .flags = FL_BASE0|FL_BASE_BARS,
399 .num_ports = 1,
400 .base_baud = 921600,
401 .uart_offset = 8,
402 },
403 [timedia_4079a] = {
404 .flags = FL_BASE0|FL_BASE_BARS,
405 .num_ports = 1,
406 .base_baud = 921600,
407 .uart_offset = 8,
408 },
409 [timedia_4085u] = {
410 .flags = FL_BASE0|FL_BASE_BARS,
411 .num_ports = 1,
412 .base_baud = 921600,
413 .uart_offset = 8,
414 },
415 [timedia_4079r] = {
416 .flags = FL_BASE0|FL_BASE_BARS,
417 .num_ports = 1,
418 .base_baud = 921600,
419 .uart_offset = 8,
420 },
421 [timedia_4079s] = {
422 .flags = FL_BASE0|FL_BASE_BARS,
423 .num_ports = 1,
424 .base_baud = 921600,
425 .uart_offset = 8,
426 },
427 [timedia_4079d] = {
428 .flags = FL_BASE0|FL_BASE_BARS,
429 .num_ports = 1,
430 .base_baud = 921600,
431 .uart_offset = 8,
432 },
433 [timedia_4079e] = {
434 .flags = FL_BASE0|FL_BASE_BARS,
435 .num_ports = 1,
436 .base_baud = 921600,
437 .uart_offset = 8,
438 },
439 [timedia_4079f] = {
440 .flags = FL_BASE0|FL_BASE_BARS,
441 .num_ports = 1,
442 .base_baud = 921600,
443 .uart_offset = 8,
444 },
445 [timedia_9079a] = {
446 .flags = FL_BASE0|FL_BASE_BARS,
447 .num_ports = 1,
448 .base_baud = 921600,
449 .uart_offset = 8,
450 },
451 [timedia_9079b] = {
452 .flags = FL_BASE0|FL_BASE_BARS,
453 .num_ports = 1,
454 .base_baud = 921600,
455 .uart_offset = 8,
456 },
457 [timedia_9079c] = {
458 .flags = FL_BASE0|FL_BASE_BARS,
459 .num_ports = 1,
460 .base_baud = 921600,
461 .uart_offset = 8,
462 },
270}; 463};
271 464
272struct parport_serial_private { 465struct parport_serial_private {
@@ -285,6 +478,10 @@ static int __devinit serial_register (struct pci_dev *dev,
285 struct serial_private *serial; 478 struct serial_private *serial;
286 479
287 board = &pci_parport_serial_boards[id->driver_data]; 480 board = &pci_parport_serial_boards[id->driver_data];
481
482 if (board->num_ports == 0)
483 return 0;
484
288 serial = pciserial_init_ports(dev, board); 485 serial = pciserial_init_ports(dev, board);
289 486
290 if (IS_ERR(serial)) 487 if (IS_ERR(serial))
diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
index ba679ce0a774..d15a071b1a54 100644
--- a/drivers/tty/moxa.c
+++ b/drivers/tty/moxa.c
@@ -44,6 +44,7 @@
44#include <linux/init.h> 44#include <linux/init.h>
45#include <linux/bitops.h> 45#include <linux/bitops.h>
46#include <linux/slab.h> 46#include <linux/slab.h>
47#include <linux/ratelimit.h>
47 48
48#include <asm/system.h> 49#include <asm/system.h>
49#include <asm/io.h> 50#include <asm/io.h>
@@ -242,8 +243,8 @@ static void moxa_wait_finish(void __iomem *ofsAddr)
242 while (readw(ofsAddr + FuncCode) != 0) 243 while (readw(ofsAddr + FuncCode) != 0)
243 if (time_after(jiffies, end)) 244 if (time_after(jiffies, end))
244 return; 245 return;
245 if (readw(ofsAddr + FuncCode) != 0 && printk_ratelimit()) 246 if (readw(ofsAddr + FuncCode) != 0)
246 printk(KERN_WARNING "moxa function expired\n"); 247 printk_ratelimited(KERN_WARNING "moxa function expired\n");
247} 248}
248 249
249static void moxafunc(void __iomem *ofsAddr, u16 cmd, u16 arg) 250static void moxafunc(void __iomem *ofsAddr, u16 cmd, u16 arg)
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index d188f378684d..7fc8c02fea6c 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -39,6 +39,7 @@
39#include <linux/pci.h> 39#include <linux/pci.h>
40#include <linux/bitops.h> 40#include <linux/bitops.h>
41#include <linux/slab.h> 41#include <linux/slab.h>
42#include <linux/ratelimit.h>
42 43
43#include <asm/system.h> 44#include <asm/system.h>
44#include <asm/io.h> 45#include <asm/io.h>
@@ -1490,8 +1491,7 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp)
1490 1491
1491 switch (cmd) { 1492 switch (cmd) {
1492 case MOXA_GET_MAJOR: 1493 case MOXA_GET_MAJOR:
1493 if (printk_ratelimit()) 1494 printk_ratelimited(KERN_WARNING "mxser: '%s' uses deprecated ioctl "
1494 printk(KERN_WARNING "mxser: '%s' uses deprecated ioctl "
1495 "%x (GET_MAJOR), fix your userspace\n", 1495 "%x (GET_MAJOR), fix your userspace\n",
1496 current->comm, cmd); 1496 current->comm, cmd);
1497 return put_user(ttymajor, (int __user *)argp); 1497 return put_user(ttymajor, (int __user *)argp);
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 19b4ae052af8..8a50e4eebf18 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -58,6 +58,10 @@
58#include <linux/serial.h> 58#include <linux/serial.h>
59#include <linux/kfifo.h> 59#include <linux/kfifo.h>
60#include <linux/skbuff.h> 60#include <linux/skbuff.h>
61#include <net/arp.h>
62#include <linux/ip.h>
63#include <linux/netdevice.h>
64#include <linux/etherdevice.h>
61#include <linux/gsmmux.h> 65#include <linux/gsmmux.h>
62 66
63static int debug; 67static int debug;
@@ -77,8 +81,24 @@ module_param(debug, int, 0600);
77 * Semi-arbitrary buffer size limits. 0710 is normally run with 32-64 byte 81 * Semi-arbitrary buffer size limits. 0710 is normally run with 32-64 byte
78 * limits so this is plenty 82 * limits so this is plenty
79 */ 83 */
80#define MAX_MRU 512 84#define MAX_MRU 1500
81#define MAX_MTU 512 85#define MAX_MTU 1500
86#define GSM_NET_TX_TIMEOUT (HZ*10)
87
88/**
89 * struct gsm_mux_net - network interface
90 * @struct gsm_dlci* dlci
91 * @struct net_device_stats stats;
92 *
93 * Created when net interface is initialized.
94 **/
95struct gsm_mux_net {
96 struct kref ref;
97 struct gsm_dlci *dlci;
98 struct net_device_stats stats;
99};
100
101#define STATS(net) (((struct gsm_mux_net *)netdev_priv(net))->stats)
82 102
83/* 103/*
84 * Each block of data we have queued to go out is in the form of 104 * Each block of data we have queued to go out is in the form of
@@ -113,6 +133,8 @@ struct gsm_dlci {
113#define DLCI_OPENING 1 /* Sending SABM not seen UA */ 133#define DLCI_OPENING 1 /* Sending SABM not seen UA */
114#define DLCI_OPEN 2 /* SABM/UA complete */ 134#define DLCI_OPEN 2 /* SABM/UA complete */
115#define DLCI_CLOSING 3 /* Sending DISC not seen UA/DM */ 135#define DLCI_CLOSING 3 /* Sending DISC not seen UA/DM */
136 struct kref ref; /* freed from port or mux close */
137 struct mutex mutex;
116 138
117 /* Link layer */ 139 /* Link layer */
118 spinlock_t lock; /* Protects the internal state */ 140 spinlock_t lock; /* Protects the internal state */
@@ -123,6 +145,7 @@ struct gsm_dlci {
123 struct kfifo *fifo; /* Queue fifo for the DLCI */ 145 struct kfifo *fifo; /* Queue fifo for the DLCI */
124 struct kfifo _fifo; /* For new fifo API porting only */ 146 struct kfifo _fifo; /* For new fifo API porting only */
125 int adaption; /* Adaption layer in use */ 147 int adaption; /* Adaption layer in use */
148 int prev_adaption;
126 u32 modem_rx; /* Our incoming virtual modem lines */ 149 u32 modem_rx; /* Our incoming virtual modem lines */
127 u32 modem_tx; /* Our outgoing modem lines */ 150 u32 modem_tx; /* Our outgoing modem lines */
128 int dead; /* Refuse re-open */ 151 int dead; /* Refuse re-open */
@@ -134,6 +157,8 @@ struct gsm_dlci {
134 struct sk_buff_head skb_list; /* Queued frames */ 157 struct sk_buff_head skb_list; /* Queued frames */
135 /* Data handling callback */ 158 /* Data handling callback */
136 void (*data)(struct gsm_dlci *dlci, u8 *data, int len); 159 void (*data)(struct gsm_dlci *dlci, u8 *data, int len);
160 void (*prev_data)(struct gsm_dlci *dlci, u8 *data, int len);
161 struct net_device *net; /* network interface, if created */
137}; 162};
138 163
139/* DLCI 0, 62/63 are special or reseved see gsmtty_open */ 164/* DLCI 0, 62/63 are special or reseved see gsmtty_open */
@@ -169,6 +194,8 @@ struct gsm_control {
169struct gsm_mux { 194struct gsm_mux {
170 struct tty_struct *tty; /* The tty our ldisc is bound to */ 195 struct tty_struct *tty; /* The tty our ldisc is bound to */
171 spinlock_t lock; 196 spinlock_t lock;
197 unsigned int num;
198 struct kref ref;
172 199
173 /* Events on the GSM channel */ 200 /* Events on the GSM channel */
174 wait_queue_head_t event; 201 wait_queue_head_t event;
@@ -250,6 +277,8 @@ struct gsm_mux {
250static struct gsm_mux *gsm_mux[MAX_MUX]; /* GSM muxes */ 277static struct gsm_mux *gsm_mux[MAX_MUX]; /* GSM muxes */
251static spinlock_t gsm_mux_lock; 278static spinlock_t gsm_mux_lock;
252 279
280static struct tty_driver *gsm_tty_driver;
281
253/* 282/*
254 * This section of the driver logic implements the GSM encodings 283 * This section of the driver logic implements the GSM encodings
255 * both the basic and the 'advanced'. Reliable transport is not 284 * both the basic and the 'advanced'. Reliable transport is not
@@ -878,8 +907,10 @@ static int gsm_dlci_data_output_framed(struct gsm_mux *gsm,
878 memcpy(dp, dlci->skb->data, len); 907 memcpy(dp, dlci->skb->data, len);
879 skb_pull(dlci->skb, len); 908 skb_pull(dlci->skb, len);
880 __gsm_data_queue(dlci, msg); 909 __gsm_data_queue(dlci, msg);
881 if (last) 910 if (last) {
911 kfree_skb(dlci->skb);
882 dlci->skb = NULL; 912 dlci->skb = NULL;
913 }
883 return size; 914 return size;
884} 915}
885 916
@@ -912,7 +943,7 @@ static void gsm_dlci_data_sweep(struct gsm_mux *gsm)
912 i++; 943 i++;
913 continue; 944 continue;
914 } 945 }
915 if (dlci->adaption < 3) 946 if (dlci->adaption < 3 && !dlci->net)
916 len = gsm_dlci_data_output(gsm, dlci); 947 len = gsm_dlci_data_output(gsm, dlci);
917 else 948 else
918 len = gsm_dlci_data_output_framed(gsm, dlci); 949 len = gsm_dlci_data_output_framed(gsm, dlci);
@@ -939,9 +970,12 @@ static void gsm_dlci_data_kick(struct gsm_dlci *dlci)
939 970
940 spin_lock_irqsave(&dlci->gsm->tx_lock, flags); 971 spin_lock_irqsave(&dlci->gsm->tx_lock, flags);
941 /* If we have nothing running then we need to fire up */ 972 /* If we have nothing running then we need to fire up */
942 if (dlci->gsm->tx_bytes == 0) 973 if (dlci->gsm->tx_bytes == 0) {
943 gsm_dlci_data_output(dlci->gsm, dlci); 974 if (dlci->net)
944 else if (dlci->gsm->tx_bytes < TX_THRESH_LO) 975 gsm_dlci_data_output_framed(dlci->gsm, dlci);
976 else
977 gsm_dlci_data_output(dlci->gsm, dlci);
978 } else if (dlci->gsm->tx_bytes < TX_THRESH_LO)
945 gsm_dlci_data_sweep(dlci->gsm); 979 gsm_dlci_data_sweep(dlci->gsm);
946 spin_unlock_irqrestore(&dlci->gsm->tx_lock, flags); 980 spin_unlock_irqrestore(&dlci->gsm->tx_lock, flags);
947} 981}
@@ -1588,6 +1622,8 @@ static struct gsm_dlci *gsm_dlci_alloc(struct gsm_mux *gsm, int addr)
1588 if (dlci == NULL) 1622 if (dlci == NULL)
1589 return NULL; 1623 return NULL;
1590 spin_lock_init(&dlci->lock); 1624 spin_lock_init(&dlci->lock);
1625 kref_init(&dlci->ref);
1626 mutex_init(&dlci->mutex);
1591 dlci->fifo = &dlci->_fifo; 1627 dlci->fifo = &dlci->_fifo;
1592 if (kfifo_alloc(&dlci->_fifo, 4096, GFP_KERNEL) < 0) { 1628 if (kfifo_alloc(&dlci->_fifo, 4096, GFP_KERNEL) < 0) {
1593 kfree(dlci); 1629 kfree(dlci);
@@ -1613,26 +1649,52 @@ static struct gsm_dlci *gsm_dlci_alloc(struct gsm_mux *gsm, int addr)
1613} 1649}
1614 1650
1615/** 1651/**
1616 * gsm_dlci_free - release DLCI 1652 * gsm_dlci_free - free DLCI
1653 * @dlci: DLCI to free
1654 *
1655 * Free up a DLCI.
1656 *
1657 * Can sleep.
1658 */
1659static void gsm_dlci_free(struct kref *ref)
1660{
1661 struct gsm_dlci *dlci = container_of(ref, struct gsm_dlci, ref);
1662
1663 del_timer_sync(&dlci->t1);
1664 dlci->gsm->dlci[dlci->addr] = NULL;
1665 kfifo_free(dlci->fifo);
1666 while ((dlci->skb = skb_dequeue(&dlci->skb_list)))
1667 kfree_skb(dlci->skb);
1668 kfree(dlci);
1669}
1670
1671static inline void dlci_get(struct gsm_dlci *dlci)
1672{
1673 kref_get(&dlci->ref);
1674}
1675
1676static inline void dlci_put(struct gsm_dlci *dlci)
1677{
1678 kref_put(&dlci->ref, gsm_dlci_free);
1679}
1680
1681/**
1682 * gsm_dlci_release - release DLCI
1617 * @dlci: DLCI to destroy 1683 * @dlci: DLCI to destroy
1618 * 1684 *
1619 * Free up a DLCI. Currently to keep the lifetime rules sane we only 1685 * Release a DLCI. Actual free is deferred until either
1620 * clean up DLCI objects when the MUX closes rather than as the port 1686 * mux is closed or tty is closed - whichever is last.
1621 * is closed down on both the tty and mux levels.
1622 * 1687 *
1623 * Can sleep. 1688 * Can sleep.
1624 */ 1689 */
1625static void gsm_dlci_free(struct gsm_dlci *dlci) 1690static void gsm_dlci_release(struct gsm_dlci *dlci)
1626{ 1691{
1627 struct tty_struct *tty = tty_port_tty_get(&dlci->port); 1692 struct tty_struct *tty = tty_port_tty_get(&dlci->port);
1628 if (tty) { 1693 if (tty) {
1629 tty_vhangup(tty); 1694 tty_vhangup(tty);
1630 tty_kref_put(tty); 1695 tty_kref_put(tty);
1631 } 1696 }
1632 del_timer_sync(&dlci->t1); 1697 dlci_put(dlci);
1633 dlci->gsm->dlci[dlci->addr] = NULL;
1634 kfifo_free(dlci->fifo);
1635 kfree(dlci);
1636} 1698}
1637 1699
1638/* 1700/*
@@ -1823,10 +1885,6 @@ static void gsm0_receive(struct gsm_mux *gsm, unsigned char c)
1823 break; 1885 break;
1824 case GSM_FCS: /* FCS follows the packet */ 1886 case GSM_FCS: /* FCS follows the packet */
1825 gsm->received_fcs = c; 1887 gsm->received_fcs = c;
1826 if (c == GSM0_SOF) {
1827 gsm->state = GSM_SEARCH;
1828 break;
1829 }
1830 gsm_queue(gsm); 1888 gsm_queue(gsm);
1831 gsm->state = GSM_SSOF; 1889 gsm->state = GSM_SSOF;
1832 break; 1890 break;
@@ -1970,7 +2028,7 @@ void gsm_cleanup_mux(struct gsm_mux *gsm)
1970 /* Free up any link layer users */ 2028 /* Free up any link layer users */
1971 for (i = 0; i < NUM_DLCI; i++) 2029 for (i = 0; i < NUM_DLCI; i++)
1972 if (gsm->dlci[i]) 2030 if (gsm->dlci[i])
1973 gsm_dlci_free(gsm->dlci[i]); 2031 gsm_dlci_release(gsm->dlci[i]);
1974 /* Now wipe the queues */ 2032 /* Now wipe the queues */
1975 for (txq = gsm->tx_head; txq != NULL; txq = gsm->tx_head) { 2033 for (txq = gsm->tx_head; txq != NULL; txq = gsm->tx_head) {
1976 gsm->tx_head = txq->next; 2034 gsm->tx_head = txq->next;
@@ -2010,6 +2068,7 @@ int gsm_activate_mux(struct gsm_mux *gsm)
2010 spin_lock(&gsm_mux_lock); 2068 spin_lock(&gsm_mux_lock);
2011 for (i = 0; i < MAX_MUX; i++) { 2069 for (i = 0; i < MAX_MUX; i++) {
2012 if (gsm_mux[i] == NULL) { 2070 if (gsm_mux[i] == NULL) {
2071 gsm->num = i;
2013 gsm_mux[i] = gsm; 2072 gsm_mux[i] = gsm;
2014 break; 2073 break;
2015 } 2074 }
@@ -2030,8 +2089,7 @@ EXPORT_SYMBOL_GPL(gsm_activate_mux);
2030 * gsm_free_mux - free up a mux 2089 * gsm_free_mux - free up a mux
2031 * @mux: mux to free 2090 * @mux: mux to free
2032 * 2091 *
2033 * Dispose of allocated resources for a dead mux. No refcounting 2092 * Dispose of allocated resources for a dead mux
2034 * at present so the mux must be truly dead.
2035 */ 2093 */
2036void gsm_free_mux(struct gsm_mux *gsm) 2094void gsm_free_mux(struct gsm_mux *gsm)
2037{ 2095{
@@ -2042,6 +2100,28 @@ void gsm_free_mux(struct gsm_mux *gsm)
2042EXPORT_SYMBOL_GPL(gsm_free_mux); 2100EXPORT_SYMBOL_GPL(gsm_free_mux);
2043 2101
2044/** 2102/**
2103 * gsm_free_muxr - free up a mux
2104 * @mux: mux to free
2105 *
2106 * Dispose of allocated resources for a dead mux
2107 */
2108static void gsm_free_muxr(struct kref *ref)
2109{
2110 struct gsm_mux *gsm = container_of(ref, struct gsm_mux, ref);
2111 gsm_free_mux(gsm);
2112}
2113
2114static inline void mux_get(struct gsm_mux *gsm)
2115{
2116 kref_get(&gsm->ref);
2117}
2118
2119static inline void mux_put(struct gsm_mux *gsm)
2120{
2121 kref_put(&gsm->ref, gsm_free_muxr);
2122}
2123
2124/**
2045 * gsm_alloc_mux - allocate a mux 2125 * gsm_alloc_mux - allocate a mux
2046 * 2126 *
2047 * Creates a new mux ready for activation. 2127 * Creates a new mux ready for activation.
@@ -2064,12 +2144,12 @@ struct gsm_mux *gsm_alloc_mux(void)
2064 return NULL; 2144 return NULL;
2065 } 2145 }
2066 spin_lock_init(&gsm->lock); 2146 spin_lock_init(&gsm->lock);
2147 kref_init(&gsm->ref);
2067 2148
2068 gsm->t1 = T1; 2149 gsm->t1 = T1;
2069 gsm->t2 = T2; 2150 gsm->t2 = T2;
2070 gsm->n2 = N2; 2151 gsm->n2 = N2;
2071 gsm->ftype = UIH; 2152 gsm->ftype = UIH;
2072 gsm->initiator = 0;
2073 gsm->adaption = 1; 2153 gsm->adaption = 1;
2074 gsm->encoding = 1; 2154 gsm->encoding = 1;
2075 gsm->mru = 64; /* Default to encoding 1 so these should be 64 */ 2155 gsm->mru = 64; /* Default to encoding 1 so these should be 64 */
@@ -2115,13 +2195,20 @@ static int gsmld_output(struct gsm_mux *gsm, u8 *data, int len)
2115 2195
2116static int gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) 2196static int gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm)
2117{ 2197{
2118 int ret; 2198 int ret, i;
2199 int base = gsm->num << 6; /* Base for this MUX */
2119 2200
2120 gsm->tty = tty_kref_get(tty); 2201 gsm->tty = tty_kref_get(tty);
2121 gsm->output = gsmld_output; 2202 gsm->output = gsmld_output;
2122 ret = gsm_activate_mux(gsm); 2203 ret = gsm_activate_mux(gsm);
2123 if (ret != 0) 2204 if (ret != 0)
2124 tty_kref_put(gsm->tty); 2205 tty_kref_put(gsm->tty);
2206 else {
2207 /* Don't register device 0 - this is the control channel and not
2208 a usable tty interface */
2209 for (i = 1; i < NUM_DLCI; i++)
2210 tty_register_device(gsm_tty_driver, base + i, NULL);
2211 }
2125 return ret; 2212 return ret;
2126} 2213}
2127 2214
@@ -2136,7 +2223,12 @@ static int gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm)
2136 2223
2137static void gsmld_detach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) 2224static void gsmld_detach_gsm(struct tty_struct *tty, struct gsm_mux *gsm)
2138{ 2225{
2226 int i;
2227 int base = gsm->num << 6; /* Base for this MUX */
2228
2139 WARN_ON(tty != gsm->tty); 2229 WARN_ON(tty != gsm->tty);
2230 for (i = 1; i < NUM_DLCI; i++)
2231 tty_unregister_device(gsm_tty_driver, base + i);
2140 gsm_cleanup_mux(gsm); 2232 gsm_cleanup_mux(gsm);
2141 tty_kref_put(gsm->tty); 2233 tty_kref_put(gsm->tty);
2142 gsm->tty = NULL; 2234 gsm->tty = NULL;
@@ -2224,7 +2316,7 @@ static void gsmld_close(struct tty_struct *tty)
2224 2316
2225 gsmld_flush_buffer(tty); 2317 gsmld_flush_buffer(tty);
2226 /* Do other clean up here */ 2318 /* Do other clean up here */
2227 gsm_free_mux(gsm); 2319 mux_put(gsm);
2228} 2320}
2229 2321
2230/** 2322/**
@@ -2476,6 +2568,220 @@ static int gsmld_ioctl(struct tty_struct *tty, struct file *file,
2476 } 2568 }
2477} 2569}
2478 2570
2571/*
2572 * Network interface
2573 *
2574 */
2575
2576static int gsm_mux_net_open(struct net_device *net)
2577{
2578 pr_debug("%s called\n", __func__);
2579 netif_start_queue(net);
2580 return 0;
2581}
2582
2583static int gsm_mux_net_close(struct net_device *net)
2584{
2585 netif_stop_queue(net);
2586 return 0;
2587}
2588
2589static struct net_device_stats *gsm_mux_net_get_stats(struct net_device *net)
2590{
2591 return &((struct gsm_mux_net *)netdev_priv(net))->stats;
2592}
2593static void dlci_net_free(struct gsm_dlci *dlci)
2594{
2595 if (!dlci->net) {
2596 WARN_ON(1);
2597 return;
2598 }
2599 dlci->adaption = dlci->prev_adaption;
2600 dlci->data = dlci->prev_data;
2601 free_netdev(dlci->net);
2602 dlci->net = NULL;
2603}
2604static void net_free(struct kref *ref)
2605{
2606 struct gsm_mux_net *mux_net;
2607 struct gsm_dlci *dlci;
2608
2609 mux_net = container_of(ref, struct gsm_mux_net, ref);
2610 dlci = mux_net->dlci;
2611
2612 if (dlci->net) {
2613 unregister_netdev(dlci->net);
2614 dlci_net_free(dlci);
2615 }
2616}
2617
2618static inline void muxnet_get(struct gsm_mux_net *mux_net)
2619{
2620 kref_get(&mux_net->ref);
2621}
2622
2623static inline void muxnet_put(struct gsm_mux_net *mux_net)
2624{
2625 kref_put(&mux_net->ref, net_free);
2626}
2627
2628static int gsm_mux_net_start_xmit(struct sk_buff *skb,
2629 struct net_device *net)
2630{
2631 struct gsm_mux_net *mux_net = (struct gsm_mux_net *)netdev_priv(net);
2632 struct gsm_dlci *dlci = mux_net->dlci;
2633 muxnet_get(mux_net);
2634
2635 skb_queue_head(&dlci->skb_list, skb);
2636 STATS(net).tx_packets++;
2637 STATS(net).tx_bytes += skb->len;
2638 gsm_dlci_data_kick(dlci);
2639 /* And tell the kernel when the last transmit started. */
2640 net->trans_start = jiffies;
2641 muxnet_put(mux_net);
2642 return NETDEV_TX_OK;
2643}
2644
2645/* called when a packet did not ack after watchdogtimeout */
2646static void gsm_mux_net_tx_timeout(struct net_device *net)
2647{
2648 /* Tell syslog we are hosed. */
2649 dev_dbg(&net->dev, "Tx timed out.\n");
2650
2651 /* Update statistics */
2652 STATS(net).tx_errors++;
2653}
2654
2655static void gsm_mux_rx_netchar(struct gsm_dlci *dlci,
2656 unsigned char *in_buf, int size)
2657{
2658 struct net_device *net = dlci->net;
2659 struct sk_buff *skb;
2660 struct gsm_mux_net *mux_net = (struct gsm_mux_net *)netdev_priv(net);
2661 muxnet_get(mux_net);
2662
2663 /* Allocate an sk_buff */
2664 skb = dev_alloc_skb(size + NET_IP_ALIGN);
2665 if (!skb) {
2666 /* We got no receive buffer. */
2667 STATS(net).rx_dropped++;
2668 muxnet_put(mux_net);
2669 return;
2670 }
2671 skb_reserve(skb, NET_IP_ALIGN);
2672 memcpy(skb_put(skb, size), in_buf, size);
2673
2674 skb->dev = net;
2675 skb->protocol = __constant_htons(ETH_P_IP);
2676
2677 /* Ship it off to the kernel */
2678 netif_rx(skb);
2679
2680 /* update out statistics */
2681 STATS(net).rx_packets++;
2682 STATS(net).rx_bytes += size;
2683 muxnet_put(mux_net);
2684 return;
2685}
2686
2687int gsm_change_mtu(struct net_device *net, int new_mtu)
2688{
2689 struct gsm_mux_net *mux_net = (struct gsm_mux_net *)netdev_priv(net);
2690 if ((new_mtu < 8) || (new_mtu > mux_net->dlci->gsm->mtu))
2691 return -EINVAL;
2692 net->mtu = new_mtu;
2693 return 0;
2694}
2695
2696static void gsm_mux_net_init(struct net_device *net)
2697{
2698 static const struct net_device_ops gsm_netdev_ops = {
2699 .ndo_open = gsm_mux_net_open,
2700 .ndo_stop = gsm_mux_net_close,
2701 .ndo_start_xmit = gsm_mux_net_start_xmit,
2702 .ndo_tx_timeout = gsm_mux_net_tx_timeout,
2703 .ndo_get_stats = gsm_mux_net_get_stats,
2704 .ndo_change_mtu = gsm_change_mtu,
2705 };
2706
2707 net->netdev_ops = &gsm_netdev_ops;
2708
2709 /* fill in the other fields */
2710 net->watchdog_timeo = GSM_NET_TX_TIMEOUT;
2711 net->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
2712 net->type = ARPHRD_NONE;
2713 net->tx_queue_len = 10;
2714}
2715
2716
2717/* caller holds the dlci mutex */
2718static void gsm_destroy_network(struct gsm_dlci *dlci)
2719{
2720 struct gsm_mux_net *mux_net;
2721
2722 pr_debug("destroy network interface");
2723 if (!dlci->net)
2724 return;
2725 mux_net = (struct gsm_mux_net *)netdev_priv(dlci->net);
2726 muxnet_put(mux_net);
2727}
2728
2729
2730/* caller holds the dlci mutex */
2731static int gsm_create_network(struct gsm_dlci *dlci, struct gsm_netconfig *nc)
2732{
2733 char *netname;
2734 int retval = 0;
2735 struct net_device *net;
2736 struct gsm_mux_net *mux_net;
2737
2738 if (!capable(CAP_NET_ADMIN))
2739 return -EPERM;
2740
2741 /* Already in a non tty mode */
2742 if (dlci->adaption > 2)
2743 return -EBUSY;
2744
2745 if (nc->protocol != htons(ETH_P_IP))
2746 return -EPROTONOSUPPORT;
2747
2748 if (nc->adaption != 3 && nc->adaption != 4)
2749 return -EPROTONOSUPPORT;
2750
2751 pr_debug("create network interface");
2752
2753 netname = "gsm%d";
2754 if (nc->if_name[0] != '\0')
2755 netname = nc->if_name;
2756 net = alloc_netdev(sizeof(struct gsm_mux_net),
2757 netname,
2758 gsm_mux_net_init);
2759 if (!net) {
2760 pr_err("alloc_netdev failed");
2761 return -ENOMEM;
2762 }
2763 net->mtu = dlci->gsm->mtu;
2764 mux_net = (struct gsm_mux_net *)netdev_priv(net);
2765 mux_net->dlci = dlci;
2766 kref_init(&mux_net->ref);
2767 strncpy(nc->if_name, net->name, IFNAMSIZ); /* return net name */
2768
2769 /* reconfigure dlci for network */
2770 dlci->prev_adaption = dlci->adaption;
2771 dlci->prev_data = dlci->data;
2772 dlci->adaption = nc->adaption;
2773 dlci->data = gsm_mux_rx_netchar;
2774 dlci->net = net;
2775
2776 pr_debug("register netdev");
2777 retval = register_netdev(net);
2778 if (retval) {
2779 pr_err("network register fail %d\n", retval);
2780 dlci_net_free(dlci);
2781 return retval;
2782 }
2783 return net->ifindex; /* return network index */
2784}
2479 2785
2480/* Line discipline for real tty */ 2786/* Line discipline for real tty */
2481struct tty_ldisc_ops tty_ldisc_packet = { 2787struct tty_ldisc_ops tty_ldisc_packet = {
@@ -2579,6 +2885,9 @@ static int gsmtty_open(struct tty_struct *tty, struct file *filp)
2579 port = &dlci->port; 2885 port = &dlci->port;
2580 port->count++; 2886 port->count++;
2581 tty->driver_data = dlci; 2887 tty->driver_data = dlci;
2888 dlci_get(dlci);
2889 dlci_get(dlci->gsm->dlci[0]);
2890 mux_get(dlci->gsm);
2582 tty_port_tty_set(port, tty); 2891 tty_port_tty_set(port, tty);
2583 2892
2584 dlci->modem_rx = 0; 2893 dlci->modem_rx = 0;
@@ -2594,13 +2903,23 @@ static int gsmtty_open(struct tty_struct *tty, struct file *filp)
2594static void gsmtty_close(struct tty_struct *tty, struct file *filp) 2903static void gsmtty_close(struct tty_struct *tty, struct file *filp)
2595{ 2904{
2596 struct gsm_dlci *dlci = tty->driver_data; 2905 struct gsm_dlci *dlci = tty->driver_data;
2906 struct gsm_mux *gsm;
2907
2597 if (dlci == NULL) 2908 if (dlci == NULL)
2598 return; 2909 return;
2910 mutex_lock(&dlci->mutex);
2911 gsm_destroy_network(dlci);
2912 mutex_unlock(&dlci->mutex);
2913 gsm = dlci->gsm;
2599 if (tty_port_close_start(&dlci->port, tty, filp) == 0) 2914 if (tty_port_close_start(&dlci->port, tty, filp) == 0)
2600 return; 2915 goto out;
2601 gsm_dlci_begin_close(dlci); 2916 gsm_dlci_begin_close(dlci);
2602 tty_port_close_end(&dlci->port, tty); 2917 tty_port_close_end(&dlci->port, tty);
2603 tty_port_tty_set(&dlci->port, NULL); 2918 tty_port_tty_set(&dlci->port, NULL);
2919out:
2920 dlci_put(dlci);
2921 dlci_put(gsm->dlci[0]);
2922 mux_put(gsm);
2604} 2923}
2605 2924
2606static void gsmtty_hangup(struct tty_struct *tty) 2925static void gsmtty_hangup(struct tty_struct *tty)
@@ -2677,7 +2996,32 @@ static int gsmtty_tiocmset(struct tty_struct *tty,
2677static int gsmtty_ioctl(struct tty_struct *tty, 2996static int gsmtty_ioctl(struct tty_struct *tty,
2678 unsigned int cmd, unsigned long arg) 2997 unsigned int cmd, unsigned long arg)
2679{ 2998{
2680 return -ENOIOCTLCMD; 2999 struct gsm_dlci *dlci = tty->driver_data;
3000 struct gsm_netconfig nc;
3001 int index;
3002
3003 switch (cmd) {
3004 case GSMIOC_ENABLE_NET:
3005 if (copy_from_user(&nc, (void __user *)arg, sizeof(nc)))
3006 return -EFAULT;
3007 nc.if_name[IFNAMSIZ-1] = '\0';
3008 /* return net interface index or error code */
3009 mutex_lock(&dlci->mutex);
3010 index = gsm_create_network(dlci, &nc);
3011 mutex_unlock(&dlci->mutex);
3012 if (copy_to_user((void __user *)arg, &nc, sizeof(nc)))
3013 return -EFAULT;
3014 return index;
3015 case GSMIOC_DISABLE_NET:
3016 if (!capable(CAP_NET_ADMIN))
3017 return -EPERM;
3018 mutex_lock(&dlci->mutex);
3019 gsm_destroy_network(dlci);
3020 mutex_unlock(&dlci->mutex);
3021 return 0;
3022 default:
3023 return -ENOIOCTLCMD;
3024 }
2681} 3025}
2682 3026
2683static void gsmtty_set_termios(struct tty_struct *tty, struct ktermios *old) 3027static void gsmtty_set_termios(struct tty_struct *tty, struct ktermios *old)
@@ -2726,7 +3070,6 @@ static int gsmtty_break_ctl(struct tty_struct *tty, int state)
2726 return gsmtty_modem_update(dlci, encode); 3070 return gsmtty_modem_update(dlci, encode);
2727} 3071}
2728 3072
2729static struct tty_driver *gsm_tty_driver;
2730 3073
2731/* Virtual ttys for the demux */ 3074/* Virtual ttys for the demux */
2732static const struct tty_operations gsmtty_ops = { 3075static const struct tty_operations gsmtty_ops = {
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index c3954fbf6ac4..39d6ab6551e0 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -185,7 +185,6 @@ static void reset_buffer_flags(struct tty_struct *tty)
185 tty->canon_head = tty->canon_data = tty->erasing = 0; 185 tty->canon_head = tty->canon_data = tty->erasing = 0;
186 memset(&tty->read_flags, 0, sizeof tty->read_flags); 186 memset(&tty->read_flags, 0, sizeof tty->read_flags);
187 n_tty_set_room(tty); 187 n_tty_set_room(tty);
188 check_unthrottle(tty);
189} 188}
190 189
191/** 190/**
@@ -1587,6 +1586,7 @@ static int n_tty_open(struct tty_struct *tty)
1587 return -ENOMEM; 1586 return -ENOMEM;
1588 } 1587 }
1589 reset_buffer_flags(tty); 1588 reset_buffer_flags(tty);
1589 tty_unthrottle(tty);
1590 tty->column = 0; 1590 tty->column = 0;
1591 n_tty_set_termios(tty, NULL); 1591 n_tty_set_termios(tty, NULL);
1592 tty->minimum_to_wake = 1; 1592 tty->minimum_to_wake = 1;
diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c
index b4129f53fb1b..f2dfec82faf8 100644
--- a/drivers/tty/serial/8250.c
+++ b/drivers/tty/serial/8250.c
@@ -81,7 +81,7 @@ static unsigned int skip_txen_test; /* force skip of txen test at init time */
81#define DEBUG_INTR(fmt...) do { } while (0) 81#define DEBUG_INTR(fmt...) do { } while (0)
82#endif 82#endif
83 83
84#define PASS_LIMIT 256 84#define PASS_LIMIT 512
85 85
86#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) 86#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
87 87
@@ -1107,7 +1107,7 @@ static void autoconfig_16550a(struct uart_8250_port *up)
1107 */ 1107 */
1108 DEBUG_AUTOCONF("Xscale "); 1108 DEBUG_AUTOCONF("Xscale ");
1109 up->port.type = PORT_XSCALE; 1109 up->port.type = PORT_XSCALE;
1110 up->capabilities |= UART_CAP_UUE; 1110 up->capabilities |= UART_CAP_UUE | UART_CAP_RTOIE;
1111 return; 1111 return;
1112 } 1112 }
1113 } else { 1113 } else {
diff --git a/drivers/tty/serial/8250_pci.c b/drivers/tty/serial/8250_pci.c
index cf35e0dc5085..6b887d90a205 100644
--- a/drivers/tty/serial/8250_pci.c
+++ b/drivers/tty/serial/8250_pci.c
@@ -39,6 +39,7 @@ struct pci_serial_quirk {
39 u32 device; 39 u32 device;
40 u32 subvendor; 40 u32 subvendor;
41 u32 subdevice; 41 u32 subdevice;
42 int (*probe)(struct pci_dev *dev);
42 int (*init)(struct pci_dev *dev); 43 int (*init)(struct pci_dev *dev);
43 int (*setup)(struct serial_private *, 44 int (*setup)(struct serial_private *,
44 const struct pciserial_board *, 45 const struct pciserial_board *,
@@ -56,6 +57,9 @@ struct serial_private {
56 int line[0]; 57 int line[0];
57}; 58};
58 59
60static int pci_default_setup(struct serial_private*,
61 const struct pciserial_board*, struct uart_port*, int);
62
59static void moan_device(const char *str, struct pci_dev *dev) 63static void moan_device(const char *str, struct pci_dev *dev)
60{ 64{
61 printk(KERN_WARNING 65 printk(KERN_WARNING
@@ -571,6 +575,28 @@ static const struct timedia_struct {
571 { 8, timedia_eight_port } 575 { 8, timedia_eight_port }
572}; 576};
573 577
578/*
579 * There are nearly 70 different Timedia/SUNIX PCI serial devices. Instead of
580 * listing them individually, this driver merely grabs them all with
581 * PCI_ANY_ID. Some of these devices, however, also feature a parallel port,
582 * and should be left free to be claimed by parport_serial instead.
583 */
584static int pci_timedia_probe(struct pci_dev *dev)
585{
586 /*
587 * Check the third digit of the subdevice ID
588 * (0,2,3,5,6: serial only -- 7,8,9: serial + parallel)
589 */
590 if ((dev->subsystem_device & 0x00f0) >= 0x70) {
591 dev_info(&dev->dev,
592 "ignoring Timedia subdevice %04x for parport_serial\n",
593 dev->subsystem_device);
594 return -ENODEV;
595 }
596
597 return 0;
598}
599
574static int pci_timedia_init(struct pci_dev *dev) 600static int pci_timedia_init(struct pci_dev *dev)
575{ 601{
576 const unsigned short *ids; 602 const unsigned short *ids;
@@ -752,6 +778,62 @@ pci_ni8430_setup(struct serial_private *priv,
752 return setup_port(priv, port, bar, offset, board->reg_shift); 778 return setup_port(priv, port, bar, offset, board->reg_shift);
753} 779}
754 780
781static int pci_netmos_9900_setup(struct serial_private *priv,
782 const struct pciserial_board *board,
783 struct uart_port *port, int idx)
784{
785 unsigned int bar;
786
787 if ((priv->dev->subsystem_device & 0xff00) == 0x3000) {
788 /* netmos apparently orders BARs by datasheet layout, so serial
789 * ports get BARs 0 and 3 (or 1 and 4 for memmapped)
790 */
791 bar = 3 * idx;
792
793 return setup_port(priv, port, bar, 0, board->reg_shift);
794 } else {
795 return pci_default_setup(priv, board, port, idx);
796 }
797}
798
799/* the 99xx series comes with a range of device IDs and a variety
800 * of capabilities:
801 *
802 * 9900 has varying capabilities and can cascade to sub-controllers
803 * (cascading should be purely internal)
804 * 9904 is hardwired with 4 serial ports
805 * 9912 and 9922 are hardwired with 2 serial ports
806 */
807static int pci_netmos_9900_numports(struct pci_dev *dev)
808{
809 unsigned int c = dev->class;
810 unsigned int pi;
811 unsigned short sub_serports;
812
813 pi = (c & 0xff);
814
815 if (pi == 2) {
816 return 1;
817 } else if ((pi == 0) &&
818 (dev->device == PCI_DEVICE_ID_NETMOS_9900)) {
819 /* two possibilities: 0x30ps encodes number of parallel and
820 * serial ports, or 0x1000 indicates *something*. This is not
821 * immediately obvious, since the 2s1p+4s configuration seems
822 * to offer all functionality on functions 0..2, while still
823 * advertising the same function 3 as the 4s+2s1p config.
824 */
825 sub_serports = dev->subsystem_device & 0xf;
826 if (sub_serports > 0) {
827 return sub_serports;
828 } else {
829 printk(KERN_NOTICE "NetMos/Mostech serial driver ignoring port on ambiguous config.\n");
830 return 0;
831 }
832 }
833
834 moan_device("unknown NetMos/Mostech program interface", dev);
835 return 0;
836}
755 837
756static int pci_netmos_init(struct pci_dev *dev) 838static int pci_netmos_init(struct pci_dev *dev)
757{ 839{
@@ -761,12 +843,28 @@ static int pci_netmos_init(struct pci_dev *dev)
761 if ((dev->device == PCI_DEVICE_ID_NETMOS_9901) || 843 if ((dev->device == PCI_DEVICE_ID_NETMOS_9901) ||
762 (dev->device == PCI_DEVICE_ID_NETMOS_9865)) 844 (dev->device == PCI_DEVICE_ID_NETMOS_9865))
763 return 0; 845 return 0;
846
764 if (dev->subsystem_vendor == PCI_VENDOR_ID_IBM && 847 if (dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
765 dev->subsystem_device == 0x0299) 848 dev->subsystem_device == 0x0299)
766 return 0; 849 return 0;
767 850
851 switch (dev->device) { /* FALLTHROUGH on all */
852 case PCI_DEVICE_ID_NETMOS_9904:
853 case PCI_DEVICE_ID_NETMOS_9912:
854 case PCI_DEVICE_ID_NETMOS_9922:
855 case PCI_DEVICE_ID_NETMOS_9900:
856 num_serial = pci_netmos_9900_numports(dev);
857 break;
858
859 default:
860 if (num_serial == 0 ) {
861 moan_device("unknown NetMos/Mostech device", dev);
862 }
863 }
864
768 if (num_serial == 0) 865 if (num_serial == 0)
769 return -ENODEV; 866 return -ENODEV;
867
770 return num_serial; 868 return num_serial;
771} 869}
772 870
@@ -1396,6 +1494,7 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
1396 .device = PCI_DEVICE_ID_TIMEDIA_1889, 1494 .device = PCI_DEVICE_ID_TIMEDIA_1889,
1397 .subvendor = PCI_VENDOR_ID_TIMEDIA, 1495 .subvendor = PCI_VENDOR_ID_TIMEDIA,
1398 .subdevice = PCI_ANY_ID, 1496 .subdevice = PCI_ANY_ID,
1497 .probe = pci_timedia_probe,
1399 .init = pci_timedia_init, 1498 .init = pci_timedia_init,
1400 .setup = pci_timedia_setup, 1499 .setup = pci_timedia_setup,
1401 }, 1500 },
@@ -1426,7 +1525,7 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
1426 .subvendor = PCI_ANY_ID, 1525 .subvendor = PCI_ANY_ID,
1427 .subdevice = PCI_ANY_ID, 1526 .subdevice = PCI_ANY_ID,
1428 .init = pci_netmos_init, 1527 .init = pci_netmos_init,
1429 .setup = pci_default_setup, 1528 .setup = pci_netmos_9900_setup,
1430 }, 1529 },
1431 /* 1530 /*
1432 * For Oxford Semiconductor Tornado based devices 1531 * For Oxford Semiconductor Tornado based devices
@@ -1703,6 +1802,7 @@ enum pci_board_num_t {
1703 pbn_ADDIDATA_PCIe_8_3906250, 1802 pbn_ADDIDATA_PCIe_8_3906250,
1704 pbn_ce4100_1_115200, 1803 pbn_ce4100_1_115200,
1705 pbn_omegapci, 1804 pbn_omegapci,
1805 pbn_NETMOS9900_2s_115200,
1706}; 1806};
1707 1807
1708/* 1808/*
@@ -2404,6 +2504,11 @@ static struct pciserial_board pci_boards[] __devinitdata = {
2404 .base_baud = 115200, 2504 .base_baud = 115200,
2405 .uart_offset = 0x200, 2505 .uart_offset = 0x200,
2406 }, 2506 },
2507 [pbn_NETMOS9900_2s_115200] = {
2508 .flags = FL_BASE0,
2509 .num_ports = 2,
2510 .base_baud = 115200,
2511 },
2407}; 2512};
2408 2513
2409static const struct pci_device_id softmodem_blacklist[] = { 2514static const struct pci_device_id softmodem_blacklist[] = {
@@ -2640,11 +2745,19 @@ EXPORT_SYMBOL_GPL(pciserial_resume_ports);
2640static int __devinit 2745static int __devinit
2641pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent) 2746pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent)
2642{ 2747{
2748 struct pci_serial_quirk *quirk;
2643 struct serial_private *priv; 2749 struct serial_private *priv;
2644 const struct pciserial_board *board; 2750 const struct pciserial_board *board;
2645 struct pciserial_board tmp; 2751 struct pciserial_board tmp;
2646 int rc; 2752 int rc;
2647 2753
2754 quirk = find_quirk(dev);
2755 if (quirk->probe) {
2756 rc = quirk->probe(dev);
2757 if (rc)
2758 return rc;
2759 }
2760
2648 if (ent->driver_data >= ARRAY_SIZE(pci_boards)) { 2761 if (ent->driver_data >= ARRAY_SIZE(pci_boards)) {
2649 printk(KERN_ERR "pci_init_one: invalid driver_data: %ld\n", 2762 printk(KERN_ERR "pci_init_one: invalid driver_data: %ld\n",
2650 ent->driver_data); 2763 ent->driver_data);
@@ -2654,6 +2767,7 @@ pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent)
2654 board = &pci_boards[ent->driver_data]; 2767 board = &pci_boards[ent->driver_data];
2655 2768
2656 rc = pci_enable_device(dev); 2769 rc = pci_enable_device(dev);
2770 pci_save_state(dev);
2657 if (rc) 2771 if (rc)
2658 return rc; 2772 return rc;
2659 2773
@@ -3885,6 +3999,27 @@ static struct pci_device_id serial_pci_tbl[] = {
3885 0xA000, 0x1000, 3999 0xA000, 0x1000,
3886 0, 0, pbn_b0_1_115200 }, 4000 0, 0, pbn_b0_1_115200 },
3887 4001
4002 /* the 9901 is a rebranded 9912 */
4003 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9912,
4004 0xA000, 0x1000,
4005 0, 0, pbn_b0_1_115200 },
4006
4007 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9922,
4008 0xA000, 0x1000,
4009 0, 0, pbn_b0_1_115200 },
4010
4011 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9904,
4012 0xA000, 0x1000,
4013 0, 0, pbn_b0_1_115200 },
4014
4015 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
4016 0xA000, 0x1000,
4017 0, 0, pbn_b0_1_115200 },
4018
4019 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
4020 0xA000, 0x3002,
4021 0, 0, pbn_NETMOS9900_2s_115200 },
4022
3888 /* 4023 /*
3889 * Best Connectivity PCI Multi I/O cards 4024 * Best Connectivity PCI Multi I/O cards
3890 */ 4025 */
@@ -3927,6 +4062,51 @@ static struct pci_device_id serial_pci_tbl[] = {
3927 { 0, } 4062 { 0, }
3928}; 4063};
3929 4064
4065static pci_ers_result_t serial8250_io_error_detected(struct pci_dev *dev,
4066 pci_channel_state_t state)
4067{
4068 struct serial_private *priv = pci_get_drvdata(dev);
4069
4070 if (state == pci_channel_io_perm_failure)
4071 return PCI_ERS_RESULT_DISCONNECT;
4072
4073 if (priv)
4074 pciserial_suspend_ports(priv);
4075
4076 pci_disable_device(dev);
4077
4078 return PCI_ERS_RESULT_NEED_RESET;
4079}
4080
4081static pci_ers_result_t serial8250_io_slot_reset(struct pci_dev *dev)
4082{
4083 int rc;
4084
4085 rc = pci_enable_device(dev);
4086
4087 if (rc)
4088 return PCI_ERS_RESULT_DISCONNECT;
4089
4090 pci_restore_state(dev);
4091 pci_save_state(dev);
4092
4093 return PCI_ERS_RESULT_RECOVERED;
4094}
4095
4096static void serial8250_io_resume(struct pci_dev *dev)
4097{
4098 struct serial_private *priv = pci_get_drvdata(dev);
4099
4100 if (priv)
4101 pciserial_resume_ports(priv);
4102}
4103
4104static struct pci_error_handlers serial8250_err_handler = {
4105 .error_detected = serial8250_io_error_detected,
4106 .slot_reset = serial8250_io_slot_reset,
4107 .resume = serial8250_io_resume,
4108};
4109
3930static struct pci_driver serial_pci_driver = { 4110static struct pci_driver serial_pci_driver = {
3931 .name = "serial", 4111 .name = "serial",
3932 .probe = pciserial_init_one, 4112 .probe = pciserial_init_one,
@@ -3936,6 +4116,7 @@ static struct pci_driver serial_pci_driver = {
3936 .resume = pciserial_resume_one, 4116 .resume = pciserial_resume_one,
3937#endif 4117#endif
3938 .id_table = serial_pci_tbl, 4118 .id_table = serial_pci_tbl,
4119 .err_handler = &serial8250_err_handler,
3939}; 4120};
3940 4121
3941static int __init serial8250_pci_init(void) 4122static int __init serial8250_pci_init(void)
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 8f41e1123461..cb40b82daf36 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1404,7 +1404,7 @@ config SERIAL_SC26XX
1404 1404
1405config SERIAL_SC26XX_CONSOLE 1405config SERIAL_SC26XX_CONSOLE
1406 bool "Console on SC2681/SC2692 serial port" 1406 bool "Console on SC2681/SC2692 serial port"
1407 depends on SERIAL_SC26XX 1407 depends on SERIAL_SC26XX=y
1408 select SERIAL_CORE_CONSOLE 1408 select SERIAL_CORE_CONSOLE
1409 help 1409 help
1410 Support for Console on SC2681/SC2692 serial ports. 1410 Support for Console on SC2681/SC2692 serial ports.
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 465210930890..846dfcd3ce0d 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -14,6 +14,7 @@
14 *along with this program; if not, write to the Free Software 14 *along with this program; if not, write to the Free Software
15 *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 15 *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
16 */ 16 */
17#include <linux/kernel.h>
17#include <linux/serial_reg.h> 18#include <linux/serial_reg.h>
18#include <linux/slab.h> 19#include <linux/slab.h>
19#include <linux/module.h> 20#include <linux/module.h>
@@ -44,6 +45,7 @@ enum {
44/* Set the max number of UART port 45/* Set the max number of UART port
45 * Intel EG20T PCH: 4 port 46 * Intel EG20T PCH: 4 port
46 * OKI SEMICONDUCTOR ML7213 IOH: 3 port 47 * OKI SEMICONDUCTOR ML7213 IOH: 3 port
48 * OKI SEMICONDUCTOR ML7223 IOH: 2 port
47*/ 49*/
48#define PCH_UART_NR 4 50#define PCH_UART_NR 4
49 51
@@ -137,8 +139,6 @@ enum {
137#define PCH_UART_DLL 0x00 139#define PCH_UART_DLL 0x00
138#define PCH_UART_DLM 0x01 140#define PCH_UART_DLM 0x01
139 141
140#define DIV_ROUND(a, b) (((a) + ((b)/2)) / (b))
141
142#define PCH_UART_IID_RLS (PCH_UART_IIR_REI) 142#define PCH_UART_IID_RLS (PCH_UART_IIR_REI)
143#define PCH_UART_IID_RDR (PCH_UART_IIR_RRI) 143#define PCH_UART_IID_RDR (PCH_UART_IIR_RRI)
144#define PCH_UART_IID_RDR_TO (PCH_UART_IIR_RRI | PCH_UART_IIR_TOI) 144#define PCH_UART_IID_RDR_TO (PCH_UART_IIR_RRI | PCH_UART_IIR_TOI)
@@ -316,7 +316,7 @@ static int pch_uart_hal_set_line(struct eg20t_port *priv, int baud,
316 unsigned int dll, dlm, lcr; 316 unsigned int dll, dlm, lcr;
317 int div; 317 int div;
318 318
319 div = DIV_ROUND(priv->base_baud / 16, baud); 319 div = DIV_ROUND_CLOSEST(priv->base_baud / 16, baud);
320 if (div < 0 || USHRT_MAX <= div) { 320 if (div < 0 || USHRT_MAX <= div) {
321 dev_err(priv->port.dev, "Invalid Baud(div=0x%x)\n", div); 321 dev_err(priv->port.dev, "Invalid Baud(div=0x%x)\n", div);
322 return -EINVAL; 322 return -EINVAL;
@@ -1429,6 +1429,8 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
1429 goto init_port_hal_free; 1429 goto init_port_hal_free;
1430 } 1430 }
1431 1431
1432 pci_enable_msi(pdev);
1433
1432 iobase = pci_resource_start(pdev, 0); 1434 iobase = pci_resource_start(pdev, 0);
1433 mapbase = pci_resource_start(pdev, 1); 1435 mapbase = pci_resource_start(pdev, 1);
1434 priv->mapbase = mapbase; 1436 priv->mapbase = mapbase;
@@ -1485,6 +1487,8 @@ static void pch_uart_pci_remove(struct pci_dev *pdev)
1485 struct eg20t_port *priv; 1487 struct eg20t_port *priv;
1486 1488
1487 priv = (struct eg20t_port *)pci_get_drvdata(pdev); 1489 priv = (struct eg20t_port *)pci_get_drvdata(pdev);
1490
1491 pci_disable_msi(pdev);
1488 pch_uart_exit_port(priv); 1492 pch_uart_exit_port(priv);
1489 pci_disable_device(pdev); 1493 pci_disable_device(pdev);
1490 kfree(priv); 1494 kfree(priv);
@@ -1568,6 +1572,7 @@ static int __devinit pch_uart_pci_probe(struct pci_dev *pdev,
1568 return ret; 1572 return ret;
1569 1573
1570probe_disable_device: 1574probe_disable_device:
1575 pci_disable_msi(pdev);
1571 pci_disable_device(pdev); 1576 pci_disable_device(pdev);
1572probe_error: 1577probe_error:
1573 return ret; 1578 return ret;
diff --git a/drivers/tty/serial/s5pv210.c b/drivers/tty/serial/s5pv210.c
index 8dd160c96e87..8b0b888a1b76 100644
--- a/drivers/tty/serial/s5pv210.c
+++ b/drivers/tty/serial/s5pv210.c
@@ -18,6 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/serial_core.h> 19#include <linux/serial_core.h>
20#include <linux/serial.h> 20#include <linux/serial.h>
21#include <linux/delay.h>
21 22
22#include <asm/irq.h> 23#include <asm/irq.h>
23#include <mach/hardware.h> 24#include <mach/hardware.h>
@@ -83,6 +84,9 @@ static int s5pv210_serial_resetport(struct uart_port *port,
83 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); 84 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);
84 wr_regl(port, S3C2410_UFCON, cfg->ufcon); 85 wr_regl(port, S3C2410_UFCON, cfg->ufcon);
85 86
87 /* It is need to delay When reset FIFO register */
88 udelay(1);
89
86 return 0; 90 return 0;
87} 91}
88 92
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index 7ead42104c67..afc629423152 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1194,12 +1194,10 @@ int __devexit s3c24xx_serial_remove(struct platform_device *dev)
1194EXPORT_SYMBOL_GPL(s3c24xx_serial_remove); 1194EXPORT_SYMBOL_GPL(s3c24xx_serial_remove);
1195 1195
1196/* UART power management code */ 1196/* UART power management code */
1197 1197#ifdef CONFIG_PM_SLEEP
1198#ifdef CONFIG_PM 1198static int s3c24xx_serial_suspend(struct device *dev)
1199
1200static int s3c24xx_serial_suspend(struct platform_device *dev, pm_message_t state)
1201{ 1199{
1202 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev); 1200 struct uart_port *port = s3c24xx_dev_to_port(dev);
1203 1201
1204 if (port) 1202 if (port)
1205 uart_suspend_port(&s3c24xx_uart_drv, port); 1203 uart_suspend_port(&s3c24xx_uart_drv, port);
@@ -1207,9 +1205,9 @@ static int s3c24xx_serial_suspend(struct platform_device *dev, pm_message_t stat
1207 return 0; 1205 return 0;
1208} 1206}
1209 1207
1210static int s3c24xx_serial_resume(struct platform_device *dev) 1208static int s3c24xx_serial_resume(struct device *dev)
1211{ 1209{
1212 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev); 1210 struct uart_port *port = s3c24xx_dev_to_port(dev);
1213 struct s3c24xx_uart_port *ourport = to_ourport(port); 1211 struct s3c24xx_uart_port *ourport = to_ourport(port);
1214 1212
1215 if (port) { 1213 if (port) {
@@ -1222,17 +1220,20 @@ static int s3c24xx_serial_resume(struct platform_device *dev)
1222 1220
1223 return 0; 1221 return 0;
1224} 1222}
1225#endif 1223
1224static const struct dev_pm_ops s3c24xx_serial_pm_ops = {
1225 .suspend = s3c24xx_serial_suspend,
1226 .resume = s3c24xx_serial_resume,
1227};
1228#else /* !CONFIG_PM_SLEEP */
1229#define s3c24xx_serial_pm_ops NULL
1230#endif /* CONFIG_PM_SLEEP */
1226 1231
1227int s3c24xx_serial_init(struct platform_driver *drv, 1232int s3c24xx_serial_init(struct platform_driver *drv,
1228 struct s3c24xx_uart_info *info) 1233 struct s3c24xx_uart_info *info)
1229{ 1234{
1230 dbg("s3c24xx_serial_init(%p,%p)\n", drv, info); 1235 dbg("s3c24xx_serial_init(%p,%p)\n", drv, info);
1231 1236 drv->driver.pm = &s3c24xx_serial_pm_ops;
1232#ifdef CONFIG_PM
1233 drv->suspend = s3c24xx_serial_suspend;
1234 drv->resume = s3c24xx_serial_resume;
1235#endif
1236 1237
1237 return platform_driver_register(drv); 1238 return platform_driver_register(drv);
1238} 1239}
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 6556f7452ba6..150e4f747c7d 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -94,6 +94,7 @@
94#include <linux/delay.h> 94#include <linux/delay.h>
95#include <linux/seq_file.h> 95#include <linux/seq_file.h>
96#include <linux/serial.h> 96#include <linux/serial.h>
97#include <linux/ratelimit.h>
97 98
98#include <linux/uaccess.h> 99#include <linux/uaccess.h>
99#include <asm/system.h> 100#include <asm/system.h>
@@ -1420,8 +1421,7 @@ err_module_put:
1420 1421
1421 /* call the tty release_tty routine to clean out this slot */ 1422 /* call the tty release_tty routine to clean out this slot */
1422err_release_tty: 1423err_release_tty:
1423 if (printk_ratelimit()) 1424 printk_ratelimited(KERN_INFO "tty_init_dev: ldisc open failed, "
1424 printk(KERN_INFO "tty_init_dev: ldisc open failed, "
1425 "clearing slot %d\n", idx); 1425 "clearing slot %d\n", idx);
1426 release_tty(tty, idx); 1426 release_tty(tty, idx);
1427 return ERR_PTR(retval); 1427 return ERR_PTR(retval);
diff --git a/include/linux/gsmmux.h b/include/linux/gsmmux.h
index 378de4195caf..c25e9477f7c3 100644
--- a/include/linux/gsmmux.h
+++ b/include/linux/gsmmux.h
@@ -21,5 +21,16 @@ struct gsm_config
21#define GSMIOC_GETCONF _IOR('G', 0, struct gsm_config) 21#define GSMIOC_GETCONF _IOR('G', 0, struct gsm_config)
22#define GSMIOC_SETCONF _IOW('G', 1, struct gsm_config) 22#define GSMIOC_SETCONF _IOW('G', 1, struct gsm_config)
23 23
24struct gsm_netconfig {
25 unsigned int adaption; /* Adaption to use in network mode */
26 unsigned short protocol;/* Protocol to use - only ETH_P_IP supported */
27 unsigned short unused2;
28 char if_name[IFNAMSIZ]; /* interface name format string */
29 __u8 unused[28]; /* For future use */
30};
31
32#define GSMIOC_ENABLE_NET _IOW('G', 2, struct gsm_netconfig)
33#define GSMIOC_DISABLE_NET _IO('G', 3)
34
24 35
25#endif 36#endif
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 74173c585afa..b00c4ec5056e 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2832,7 +2832,11 @@
2832#define PCI_DEVICE_ID_NETMOS_9845 0x9845 2832#define PCI_DEVICE_ID_NETMOS_9845 0x9845
2833#define PCI_DEVICE_ID_NETMOS_9855 0x9855 2833#define PCI_DEVICE_ID_NETMOS_9855 0x9855
2834#define PCI_DEVICE_ID_NETMOS_9865 0x9865 2834#define PCI_DEVICE_ID_NETMOS_9865 0x9865
2835#define PCI_DEVICE_ID_NETMOS_9900 0x9900
2835#define PCI_DEVICE_ID_NETMOS_9901 0x9901 2836#define PCI_DEVICE_ID_NETMOS_9901 0x9901
2837#define PCI_DEVICE_ID_NETMOS_9904 0x9904
2838#define PCI_DEVICE_ID_NETMOS_9912 0x9912
2839#define PCI_DEVICE_ID_NETMOS_9922 0x9922
2836 2840
2837#define PCI_VENDOR_ID_3COM_2 0xa727 2841#define PCI_VENDOR_ID_3COM_2 0xa727
2838 2842
diff --git a/include/linux/pti.h b/include/linux/pti.h
index 81af667bb2d5..b3ea01a3197e 100644
--- a/include/linux/pti.h
+++ b/include/linux/pti.h
@@ -36,7 +36,8 @@ struct pti_masterchannel {
36 36
37/* the following functions are defined in misc/pti.c */ 37/* the following functions are defined in misc/pti.c */
38void pti_writedata(struct pti_masterchannel *mc, u8 *buf, int count); 38void pti_writedata(struct pti_masterchannel *mc, u8 *buf, int count);
39struct pti_masterchannel *pti_request_masterchannel(u8 type); 39struct pti_masterchannel *pti_request_masterchannel(u8 type,
40 const char *thread_name);
40void pti_release_masterchannel(struct pti_masterchannel *mc); 41void pti_release_masterchannel(struct pti_masterchannel *mc);
41 42
42#endif /*PTI_H_*/ 43#endif /*PTI_H_*/
diff --git a/include/linux/tty.h b/include/linux/tty.h
index d6f05292e456..44bc0c5617e1 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -5,24 +5,6 @@
5 * 'tty.h' defines some structures used by tty_io.c and some defines. 5 * 'tty.h' defines some structures used by tty_io.c and some defines.
6 */ 6 */
7 7
8#ifdef __KERNEL__
9#include <linux/fs.h>
10#include <linux/major.h>
11#include <linux/termios.h>
12#include <linux/workqueue.h>
13#include <linux/tty_driver.h>
14#include <linux/tty_ldisc.h>
15#include <linux/mutex.h>
16
17#include <asm/system.h>
18
19
20/*
21 * (Note: the *_driver.minor_start values 1, 64, 128, 192 are
22 * hardcoded at present.)
23 */
24#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */
25#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */
26#define NR_LDISCS 30 8#define NR_LDISCS 30
27 9
28/* line disciplines */ 10/* line disciplines */
@@ -53,6 +35,25 @@
53#define N_TRACESINK 23 /* Trace data routing for MIPI P1149.7 */ 35#define N_TRACESINK 23 /* Trace data routing for MIPI P1149.7 */
54#define N_TRACEROUTER 24 /* Trace data routing for MIPI P1149.7 */ 36#define N_TRACEROUTER 24 /* Trace data routing for MIPI P1149.7 */
55 37
38#ifdef __KERNEL__
39#include <linux/fs.h>
40#include <linux/major.h>
41#include <linux/termios.h>
42#include <linux/workqueue.h>
43#include <linux/tty_driver.h>
44#include <linux/tty_ldisc.h>
45#include <linux/mutex.h>
46
47#include <asm/system.h>
48
49
50/*
51 * (Note: the *_driver.minor_start values 1, 64, 128, 192 are
52 * hardcoded at present.)
53 */
54#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */
55#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */
56
56/* 57/*
57 * This character is the same as _POSIX_VDISABLE: it cannot be used as 58 * This character is the same as _POSIX_VDISABLE: it cannot be used as
58 * a c_cc[] character, but indicates that a particular special character 59 * a c_cc[] character, but indicates that a particular special character