Commit 36dcfaba authored by Russell King's avatar Russell King

Update Acorn serial drivers.

parent 1a4457da
...@@ -20,7 +20,4 @@ ...@@ -20,7 +20,4 @@
#define MY_PORT_ADDRESS(port,cardaddr) \ #define MY_PORT_ADDRESS(port,cardaddr) \
((cardaddr) + 0x200 - (port) * 0x100) ((cardaddr) + 0x200 - (port) * 0x100)
#define INIT serial_card_atomwide_init
#define EXIT serial_card_atomwide_exit
#include "serial-card.c" #include "serial-card.c"
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/serial.h> #include <linux/serial.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/ecard.h> #include <asm/ecard.h>
...@@ -38,95 +39,84 @@ ...@@ -38,95 +39,84 @@
#define NUM_SERIALS MY_NUMPORTS * MAX_ECARDS #define NUM_SERIALS MY_NUMPORTS * MAX_ECARDS
#endif #endif
#ifdef MODULE static int serial_ports[NUM_SERIALS];
static int __serial_ports[NUM_SERIALS]; static int serial_pcount;
static int __serial_pcount; static int serial_addr[NUM_SERIALS];
static int __serial_addr[NUM_SERIALS];
static struct expansion_card *expcard[MAX_ECARDS]; static struct expansion_card *expcard[MAX_ECARDS];
#define ADD_ECARD(ec,card) expcard[(card)] = (ec)
#define ADD_PORT(port,addr) \
do { \
__serial_ports[__serial_pcount] = (port); \
__serial_addr[__serial_pcount] = (addr); \
__serial_pcount += 1; \
} while (0)
#else
#define ADD_ECARD(ec,card)
#define ADD_PORT(port,addr)
#endif
static const card_ids serial_cids[] = { MY_CARD_LIST, { 0xffff, 0xffff } }; static const card_ids serial_cids[] = { MY_CARD_LIST, { 0xffff, 0xffff } };
static inline int serial_register_onedev (unsigned long port, int irq) static inline int serial_register_onedev (unsigned long port, int irq)
{ {
struct serial_struct req; struct serial_struct req;
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.baud_base = MY_BAUD_BASE; req.baud_base = MY_BAUD_BASE;
req.irq = irq; req.irq = irq;
req.port = port; req.port = port;
req.flags = 0; req.flags = 0;
return register_serial(&req); return register_serial(&req);
} }
static int __init INIT (void) static int __init serial_card_init(void)
{ {
int card = 0; int card = 0;
ecard_startfind (); ecard_startfind ();
do { do {
struct expansion_card *ec; struct expansion_card *ec;
unsigned long cardaddr; unsigned long cardaddr;
int port; int port;
ec = ecard_find (0, serial_cids); ec = ecard_find (0, serial_cids);
if (!ec) if (!ec)
break; break;
cardaddr = MY_BASE_ADDRESS(ec); cardaddr = MY_BASE_ADDRESS(ec);
for (port = 0; port < MY_NUMPORTS; port ++) { for (port = 0; port < MY_NUMPORTS; port ++) {
unsigned long address; unsigned long address;
int line; int line;
address = MY_PORT_ADDRESS(port, cardaddr); address = MY_PORT_ADDRESS(port, cardaddr);
line = serial_register_onedev (address, ec->irq); line = serial_register_onedev (address, ec->irq);
if (line < 0) if (line < 0)
break; break;
ADD_PORT(line, address); serial_ports[serial_pcount] = line;
} serial_addr[serial_pcount] = address;
serial_pcount += 1;
if (port) { }
ecard_claim (ec);
ADD_ECARD(ec, card); if (port) {
} else ecard_claim (ec);
break; expcard[card] = ec;
} while (++card < MAX_ECARDS); } else
return card ? 0 : -ENODEV; break;
} while (++card < MAX_ECARDS);
return card ? 0 : -ENODEV;
} }
static void __exit EXIT (void) static void __exit serial_card_exit(void)
{ {
#ifdef MODULE int i;
int i;
for (i = 0; i < __serial_pcount; i++) { for (i = 0; i < serial_pcount; i++) {
unregister_serial(__serial_ports[i]); unregister_serial(serial_ports[i]);
release_region(__serial_addr[i], 8); release_region(serial_addr[i], 8);
} }
for (i = 0; i < MAX_ECARDS; i++) for (i = 0; i < MAX_ECARDS; i++)
if (expcard[i]) if (expcard[i])
ecard_release (expcard[i]); ecard_release (expcard[i]);
#endif
} }
EXPORT_NO_SYMBOLS; EXPORT_NO_SYMBOLS;
MODULE_AUTHOR("Russell King");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(INIT); module_init(serial_card_init);
module_exit(EXIT); module_exit(serial_card_exit);
...@@ -18,7 +18,4 @@ ...@@ -18,7 +18,4 @@
#define MY_PORT_ADDRESS(port,cardaddress) \ #define MY_PORT_ADDRESS(port,cardaddress) \
((cardaddress) + (port) * 8) ((cardaddress) + (port) * 8)
#define INIT serial_card_dualsp_init
#define EXIT serial_card_dualsp_exit
#include "serial-card.c" #include "serial-card.c"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment