Commit 136ce40e9f1f24ca1dbf7714c669a7bca56440ea

Authored by Matthew Wilcox
Committed by Matthew Wilcox
1 parent 75a4958154

[PARISC] Clean up asm-parisc/serial.h

Russell King pointed out that asm/serial.h is anachronistic and we were
misusing BASE_BAUD.  So fix BASE_BAUD for PCI 16550 UARTs, move LASI_BASE_BAUD
into 8250_gsc, and fix the obsolete comment about reserving serial port slots.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>

Showing 2 changed files with 4 additions and 16 deletions Inline Diff

drivers/serial/8250_gsc.c
1 /* 1 /*
2 * Serial Device Initialisation for Lasi/Asp/Wax/Dino 2 * Serial Device Initialisation for Lasi/Asp/Wax/Dino
3 * 3 *
4 * (c) Copyright Matthew Wilcox <willy@debian.org> 2001-2002 4 * (c) Copyright Matthew Wilcox <willy@debian.org> 2001-2002
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or 8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version. 9 * (at your option) any later version.
10 */ 10 */
11 11
12 #include <linux/errno.h> 12 #include <linux/errno.h>
13 #include <linux/init.h> 13 #include <linux/init.h>
14 #include <linux/interrupt.h> 14 #include <linux/interrupt.h>
15 #include <linux/ioport.h> 15 #include <linux/ioport.h>
16 #include <linux/module.h> 16 #include <linux/module.h>
17 #include <linux/serial_core.h> 17 #include <linux/serial_core.h>
18 #include <linux/signal.h> 18 #include <linux/signal.h>
19 #include <linux/slab.h> 19 #include <linux/slab.h>
20 #include <linux/types.h> 20 #include <linux/types.h>
21 21
22 #include <asm/hardware.h> 22 #include <asm/hardware.h>
23 #include <asm/parisc-device.h> 23 #include <asm/parisc-device.h>
24 #include <asm/io.h> 24 #include <asm/io.h>
25 #include <asm/serial.h> /* for LASI_BASE_BAUD */
26 25
27 #include "8250.h" 26 #include "8250.h"
28 27
29 static int __init 28 static int __init
30 serial_init_chip(struct parisc_device *dev) 29 serial_init_chip(struct parisc_device *dev)
31 { 30 {
32 struct uart_port port; 31 struct uart_port port;
33 unsigned long address; 32 unsigned long address;
34 int err; 33 int err;
35 34
36 if (!dev->irq) { 35 if (!dev->irq) {
37 /* We find some unattached serial ports by walking native 36 /* We find some unattached serial ports by walking native
38 * busses. These should be silently ignored. Otherwise, 37 * busses. These should be silently ignored. Otherwise,
39 * what we have here is a missing parent device, so tell 38 * what we have here is a missing parent device, so tell
40 * the user what they're missing. 39 * the user what they're missing.
41 */ 40 */
42 if (parisc_parent(dev)->id.hw_type != HPHW_IOA) { 41 if (parisc_parent(dev)->id.hw_type != HPHW_IOA) {
43 printk(KERN_INFO "Serial: device 0x%lx not configured.\n" 42 printk(KERN_INFO "Serial: device 0x%lx not configured.\n"
44 "Enable support for Wax, Lasi, Asp or Dino.\n", 43 "Enable support for Wax, Lasi, Asp or Dino.\n",
45 dev->hpa.start); 44 dev->hpa.start);
46 } 45 }
47 return -ENODEV; 46 return -ENODEV;
48 } 47 }
49 48
50 address = dev->hpa.start; 49 address = dev->hpa.start;
51 if (dev->id.sversion != 0x8d) { 50 if (dev->id.sversion != 0x8d) {
52 address += 0x800; 51 address += 0x800;
53 } 52 }
54 53
55 memset(&port, 0, sizeof(port)); 54 memset(&port, 0, sizeof(port));
56 port.iotype = UPIO_MEM; 55 port.iotype = UPIO_MEM;
57 port.uartclk = LASI_BASE_BAUD * 16; 56 /* 7.272727MHz on Lasi. Assumed the same for Dino, Wax and Timi. */
57 port.uartclk = 7272727;
58 port.mapbase = address; 58 port.mapbase = address;
59 port.membase = ioremap_nocache(address, 16); 59 port.membase = ioremap_nocache(address, 16);
60 port.irq = dev->irq; 60 port.irq = dev->irq;
61 port.flags = UPF_BOOT_AUTOCONF; 61 port.flags = UPF_BOOT_AUTOCONF;
62 port.dev = &dev->dev; 62 port.dev = &dev->dev;
63 63
64 err = serial8250_register_port(&port); 64 err = serial8250_register_port(&port);
65 if (err < 0) { 65 if (err < 0) {
66 printk(KERN_WARNING "serial8250_register_port returned error %d\n", err); 66 printk(KERN_WARNING "serial8250_register_port returned error %d\n", err);
67 iounmap(port.membase); 67 iounmap(port.membase);
68 return err; 68 return err;
69 } 69 }
70 70
71 return 0; 71 return 0;
72 } 72 }
73 73
74 static struct parisc_device_id serial_tbl[] = { 74 static struct parisc_device_id serial_tbl[] = {
75 { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00075 }, 75 { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00075 },
76 { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008c }, 76 { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008c },
77 { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008d }, 77 { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008d },
78 { 0 } 78 { 0 }
79 }; 79 };
80 80
81 /* Hack. Some machines have SERIAL_0 attached to Lasi and SERIAL_1 81 /* Hack. Some machines have SERIAL_0 attached to Lasi and SERIAL_1
82 * attached to Dino. Unfortunately, Dino appears before Lasi in the device 82 * attached to Dino. Unfortunately, Dino appears before Lasi in the device
83 * tree. To ensure that ttyS0 == SERIAL_0, we register two drivers; one 83 * tree. To ensure that ttyS0 == SERIAL_0, we register two drivers; one
84 * which only knows about Lasi and then a second which will find all the 84 * which only knows about Lasi and then a second which will find all the
85 * other serial ports. HPUX ignores this problem. 85 * other serial ports. HPUX ignores this problem.
86 */ 86 */
87 static struct parisc_device_id lasi_tbl[] = { 87 static struct parisc_device_id lasi_tbl[] = {
88 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03B, 0x0008C }, /* C1xx/C1xxL */ 88 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03B, 0x0008C }, /* C1xx/C1xxL */
89 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03C, 0x0008C }, /* B132L */ 89 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03C, 0x0008C }, /* B132L */
90 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03D, 0x0008C }, /* B160L */ 90 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03D, 0x0008C }, /* B160L */
91 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03E, 0x0008C }, /* B132L+ */ 91 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03E, 0x0008C }, /* B132L+ */
92 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03F, 0x0008C }, /* B180L+ */ 92 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03F, 0x0008C }, /* B180L+ */
93 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x046, 0x0008C }, /* Rocky2 120 */ 93 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x046, 0x0008C }, /* Rocky2 120 */
94 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x047, 0x0008C }, /* Rocky2 150 */ 94 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x047, 0x0008C }, /* Rocky2 150 */
95 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x04E, 0x0008C }, /* Kiji L2 132 */ 95 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x04E, 0x0008C }, /* Kiji L2 132 */
96 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x056, 0x0008C }, /* Raven+ */ 96 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x056, 0x0008C }, /* Raven+ */
97 { 0 } 97 { 0 }
98 }; 98 };
99 99
100 100
101 MODULE_DEVICE_TABLE(parisc, serial_tbl); 101 MODULE_DEVICE_TABLE(parisc, serial_tbl);
102 102
103 static struct parisc_driver lasi_driver = { 103 static struct parisc_driver lasi_driver = {
104 .name = "serial_1", 104 .name = "serial_1",
105 .id_table = lasi_tbl, 105 .id_table = lasi_tbl,
106 .probe = serial_init_chip, 106 .probe = serial_init_chip,
107 }; 107 };
108 108
109 static struct parisc_driver serial_driver = { 109 static struct parisc_driver serial_driver = {
110 .name = "serial", 110 .name = "serial",
111 .id_table = serial_tbl, 111 .id_table = serial_tbl,
112 .probe = serial_init_chip, 112 .probe = serial_init_chip,
113 }; 113 };
114 114
115 int __init probe_serial_gsc(void) 115 int __init probe_serial_gsc(void)
116 { 116 {
117 register_parisc_driver(&lasi_driver); 117 register_parisc_driver(&lasi_driver);
118 register_parisc_driver(&serial_driver); 118 register_parisc_driver(&serial_driver);
119 return 0; 119 return 0;
120 } 120 }
121 121
122 module_init(probe_serial_gsc); 122 module_init(probe_serial_gsc);
include/asm-parisc/serial.h
1 /* 1 /*
2 * include/asm-parisc/serial.h 2 * include/asm-parisc/serial.h
3 */ 3 */
4 4
5 /* 5 /*
6 * This assumes you have a 7.272727 MHz clock for your UART. 6 * This is used for 16550-compatible UARTs
7 * The documentation implies a 40Mhz clock, and elsewhere a 7Mhz clock
8 * Clarified: 7.2727MHz on LASI. Not yet clarified for DINO
9 */ 7 */
8 #define BASE_BAUD ( 1843200 / 16 )
10 9
11 #define LASI_BASE_BAUD ( 7272727 / 16 )
12 #define BASE_BAUD LASI_BASE_BAUD
13
14 /*
15 * We don't use the ISA probing code, so these entries are just to reserve
16 * space. Some example (maximal) configurations:
17 * - 712 w/ additional Lasi & RJ16 ports: 4
18 * - J5k w/ PCI serial cards: 2 + 4 * card ~= 34
19 * A500 w/ PCI serial cards: 5 + 4 * card ~= 17
20 */
21
22 #define SERIAL_PORT_DFNS 10 #define SERIAL_PORT_DFNS