aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/ip2/ip2base.c
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@stusta.de>2006-01-19 12:07:10 -0500
committerAdrian Bunk <bunk@r063144.stusta.swh.mhn.de>2006-01-19 12:07:10 -0500
commit9c4b562abc9005e4b413de02c85d3d29da707cba (patch)
tree20985e711d285aaf1b87aa3b4837a7ed2bc3b73a /drivers/char/ip2/ip2base.c
parent0f36b018b2e314d45af86449f1a97facb1fbe300 (diff)
Move ip2.c and ip2main.c to drivers/char/ip2/ where the other files
used by this driver reside. Renamed ip2.c to ip2base.c to allow ip2.o to be built from multiple objects. Signed-off-by: Adrian Bunk <bunk@stusta.de> Acked-by: Michael H. Warfield <mhw@WittsEnd.com>
Diffstat (limited to 'drivers/char/ip2/ip2base.c')
-rw-r--r--drivers/char/ip2/ip2base.c109
1 files changed, 109 insertions, 0 deletions
diff --git a/drivers/char/ip2/ip2base.c b/drivers/char/ip2/ip2base.c
new file mode 100644
index 000000000000..435ccfc74958
--- /dev/null
+++ b/drivers/char/ip2/ip2base.c
@@ -0,0 +1,109 @@
1// ip2.c
2// This is a dummy module to make the firmware available when needed
3// and allows it to be unloaded when not. Rumor is the __initdata
4// macro doesn't always works on all platforms so we use this kludge.
5// If not compiled as a module it just makes fip_firm avaliable then
6// __initdata should work as advertized
7//
8
9#include <linux/module.h>
10#include <linux/init.h>
11#include <linux/wait.h>
12
13#ifndef __init
14#define __init
15#endif
16#ifndef __initfunc
17#define __initfunc(a) a
18#endif
19#ifndef __initdata
20#define __initdata
21#endif
22
23#include "ip2types.h"
24#include "fip_firm.h" // the meat
25
26int
27ip2_loadmain(int *, int *, unsigned char *, int ); // ref into ip2main.c
28
29/* Note: Add compiled in defaults to these arrays, not to the structure
30 in ip2.h any longer. That structure WILL get overridden
31 by these values, or command line values, or insmod values!!! =mhw=
32*/
33static int io[IP2_MAX_BOARDS]= { 0, 0, 0, 0 };
34static int irq[IP2_MAX_BOARDS] = { -1, -1, -1, -1 };
35
36static int poll_only = 0;
37
38MODULE_AUTHOR("Doug McNash");
39MODULE_DESCRIPTION("Computone IntelliPort Plus Driver");
40module_param_array(irq, int, NULL, 0);
41MODULE_PARM_DESC(irq,"Interrupts for IntelliPort Cards");
42module_param_array(io, int, NULL, 0);
43MODULE_PARM_DESC(io,"I/O ports for IntelliPort Cards");
44module_param(poll_only, bool, 0);
45MODULE_PARM_DESC(poll_only,"Do not use card interrupts");
46
47
48static int __init ip2_init(void)
49{
50 if( poll_only ) {
51 /* Hard lock the interrupts to zero */
52 irq[0] = irq[1] = irq[2] = irq[3] = 0;
53 }
54
55 return ip2_loadmain(io,irq,(unsigned char *)fip_firm,sizeof(fip_firm));
56}
57module_init(ip2_init);
58
59MODULE_LICENSE("GPL");
60
61#ifndef MODULE
62/******************************************************************************
63 * ip2_setup:
64 * str: kernel command line string
65 *
66 * Can't autoprobe the boards so user must specify configuration on
67 * kernel command line. Sane people build it modular but the others
68 * come here.
69 *
70 * Alternating pairs of io,irq for up to 4 boards.
71 * ip2=io0,irq0,io1,irq1,io2,irq2,io3,irq3
72 *
73 * io=0 => No board
74 * io=1 => PCI
75 * io=2 => EISA
76 * else => ISA I/O address
77 *
78 * irq=0 or invalid for ISA will revert to polling mode
79 *
80 * Any value = -1, do not overwrite compiled in value.
81 *
82 ******************************************************************************/
83static int __init ip2_setup(char *str)
84{
85 int ints[10]; /* 4 boards, 2 parameters + 2 */
86 int i, j;
87
88 str = get_options (str, ARRAY_SIZE(ints), ints);
89
90 for( i = 0, j = 1; i < 4; i++ ) {
91 if( j > ints[0] ) {
92 break;
93 }
94 if( ints[j] >= 0 ) {
95 io[i] = ints[j];
96 }
97 j++;
98 if( j > ints[0] ) {
99 break;
100 }
101 if( ints[j] >= 0 ) {
102 irq[i] = ints[j];
103 }
104 j++;
105 }
106 return 1;
107}
108__setup("ip2=", ip2_setup);
109#endif /* !MODULE */