aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-07-30 07:13:46 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2010-09-29 11:20:24 -0400
commit00990e7ce0b0e596fe41d9c64d6933ea70084003 (patch)
tree189e0dd92860feba84231c66955749574cac5d6d /drivers/isdn/hisax
parent440eed43e2a95bb842488755683716814da10f2b (diff)
pcmcia: use autoconfiguration feature for ioports and iomem
When CONF_AUTO_SET_IO or CONF_AUTO_SET_IOMEM are set, the corresponding fields in struct pcmcia_device *p_dev->resource[0,1,2] are set accordinly. Drivers wishing to override certain settings may do so in the callback function, but they no longer need to parse the CIS entries stored in cistpl_cftable_entry_t themselves. CC: netdev@vger.kernel.org CC: linux-wireless@vger.kernel.org CC: linux-ide@vger.kernel.org CC: linux-usb@vger.kernel.org CC: laforge@gnumonks.org CC: linux-mtd@lists.infradead.org CC: linux-bluetooth@vger.kernel.org CC: alsa-devel@alsa-project.org CC: linux-serial@vger.kernel.org CC: Jiri Kosina <jkosina@suse.cz> CC: linux-scsi@vger.kernel.org Tested-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/isdn/hisax')
-rw-r--r--drivers/isdn/hisax/avma1_cs.c22
-rw-r--r--drivers/isdn/hisax/elsa_cs.c23
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c36
-rw-r--r--drivers/isdn/hisax/teles_cs.c16
4 files changed, 25 insertions, 72 deletions
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c
index 2f2b0005f07b..cb09f0cacd12 100644
--- a/drivers/isdn/hisax/avma1_cs.c
+++ b/drivers/isdn/hisax/avma1_cs.c
@@ -76,14 +76,8 @@ static int __devinit avma1cs_probe(struct pcmcia_device *p_dev)
76{ 76{
77 dev_dbg(&p_dev->dev, "avma1cs_attach()\n"); 77 dev_dbg(&p_dev->dev, "avma1cs_attach()\n");
78 78
79 /* The io structure describes IO port mapping */
80 p_dev->resource[0]->end = 16;
81 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
82 p_dev->resource[1]->end = 16;
83 p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_16;
84
85 /* General socket configuration */ 79 /* General socket configuration */
86 p_dev->config_flags |= CONF_ENABLE_IRQ; 80 p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
87 p_dev->config_index = 1; 81 p_dev->config_index = 1;
88 p_dev->config_regs = PRESENT_OPTION; 82 p_dev->config_regs = PRESENT_OPTION;
89 83
@@ -114,17 +108,13 @@ static void __devexit avma1cs_detach(struct pcmcia_device *link)
114 108
115======================================================================*/ 109======================================================================*/
116 110
117static int avma1cs_configcheck(struct pcmcia_device *p_dev, 111static int avma1cs_configcheck(struct pcmcia_device *p_dev, void *priv_data)
118 cistpl_cftable_entry_t *cf,
119 cistpl_cftable_entry_t *dflt,
120 void *priv_data)
121{ 112{
122 if (cf->io.nwin <= 0) 113 p_dev->resource[0]->end = 16;
123 return -ENODEV; 114 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
124 115 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
125 p_dev->resource[0]->start = cf->io.win[0].base;
126 p_dev->resource[0]->end = cf->io.win[0].len;
127 p_dev->io_lines = 5; 116 p_dev->io_lines = 5;
117
128 return pcmcia_request_io(p_dev); 118 return pcmcia_request_io(p_dev);
129} 119}
130 120
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c
index 0a65280be8d5..f203a52aab2a 100644
--- a/drivers/isdn/hisax/elsa_cs.c
+++ b/drivers/isdn/hisax/elsa_cs.c
@@ -118,16 +118,6 @@ static int __devinit elsa_cs_probe(struct pcmcia_device *link)
118 118
119 local->cardnr = -1; 119 local->cardnr = -1;
120 120
121 /*
122 General socket configuration defaults can go here. In this
123 client, we assume very little, and rely on the CIS for almost
124 everything. In most clients, many details (i.e., number, sizes,
125 and attributes of IO windows) are fixed by the nature of the
126 device, and can be hard-wired here.
127 */
128 link->resource[0]->end = 8;
129 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
130
131 return elsa_cs_config(link); 121 return elsa_cs_config(link);
132} /* elsa_cs_attach */ 122} /* elsa_cs_attach */
133 123
@@ -160,18 +150,17 @@ static void __devexit elsa_cs_detach(struct pcmcia_device *link)
160 150
161======================================================================*/ 151======================================================================*/
162 152
163static int elsa_cs_configcheck(struct pcmcia_device *p_dev, 153static int elsa_cs_configcheck(struct pcmcia_device *p_dev, void *priv_data)
164 cistpl_cftable_entry_t *cf,
165 cistpl_cftable_entry_t *dflt,
166 void *priv_data)
167{ 154{
168 int j; 155 int j;
169 156
170 p_dev->io_lines = 3; 157 p_dev->io_lines = 3;
158 p_dev->resource[0]->end = 8;
159 p_dev->resource[0]->flags &= IO_DATA_PATH_WIDTH;
160 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
171 161
172 if ((cf->io.nwin > 0) && cf->io.win[0].base) { 162 if ((p_dev->resource[0]->end) && p_dev->resource[0]->start) {
173 printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n"); 163 printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n");
174 p_dev->resource[0]->start = cf->io.win[0].base;
175 if (!pcmcia_request_io(p_dev)) 164 if (!pcmcia_request_io(p_dev))
176 return 0; 165 return 0;
177 } else { 166 } else {
@@ -194,6 +183,8 @@ static int __devinit elsa_cs_config(struct pcmcia_device *link)
194 dev_dbg(&link->dev, "elsa_config(0x%p)\n", link); 183 dev_dbg(&link->dev, "elsa_config(0x%p)\n", link);
195 dev = link->priv; 184 dev = link->priv;
196 185
186 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
187
197 i = pcmcia_loop_config(link, elsa_cs_configcheck, NULL); 188 i = pcmcia_loop_config(link, elsa_cs_configcheck, NULL);
198 if (i != 0) 189 if (i != 0)
199 goto failed; 190 goto failed;
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index b69eccfdbb05..a88c88f6cdeb 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -128,8 +128,6 @@ static int __devinit sedlbauer_probe(struct pcmcia_device *link)
128 /* from old sedl_cs 128 /* from old sedl_cs
129 */ 129 */
130 /* The io structure describes IO port mapping */ 130 /* The io structure describes IO port mapping */
131 link->resource[0]->end = 8;
132 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
133 131
134 return sedlbauer_config(link); 132 return sedlbauer_config(link);
135} /* sedlbauer_attach */ 133} /* sedlbauer_attach */
@@ -161,35 +159,13 @@ static void __devexit sedlbauer_detach(struct pcmcia_device *link)
161 device available to the system. 159 device available to the system.
162 160
163======================================================================*/ 161======================================================================*/
164static int sedlbauer_config_check(struct pcmcia_device *p_dev, 162static int sedlbauer_config_check(struct pcmcia_device *p_dev, void *priv_data)
165 cistpl_cftable_entry_t *cfg,
166 cistpl_cftable_entry_t *dflt,
167 void *priv_data)
168{ 163{
169 if (cfg->index == 0) 164 if (p_dev->config_index == 0)
170 return -ENODEV; 165 return -EINVAL;
171
172 /* IO window settings */
173 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
174 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
175 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
176 p_dev->resource[0]->start = io->win[0].base;
177 p_dev->resource[0]->end = io->win[0].len;
178 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
179 p_dev->resource[0]->flags |=
180 pcmcia_io_cfg_data_width(io->flags);
181 if (io->nwin > 1) {
182 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
183 p_dev->resource[1]->start = io->win[1].base;
184 p_dev->resource[1]->end = io->win[1].len;
185 }
186 /* This reserves IO space but doesn't actually enable it */
187 p_dev->io_lines = 3;
188 if (pcmcia_request_io(p_dev) != 0)
189 return -ENODEV;
190 }
191 166
192 return 0; 167 p_dev->io_lines = 3;
168 return pcmcia_request_io(p_dev);
193} 169}
194 170
195 171
@@ -202,7 +178,7 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link)
202 dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link); 178 dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link);
203 179
204 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_CHECK_VCC | 180 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_CHECK_VCC |
205 CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO; 181 CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | CONF_AUTO_SET_IO;
206 182
207 /* 183 /*
208 In this loop, we scan the CIS for configuration table entries, 184 In this loop, we scan the CIS for configuration table entries,
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index 6605480aa37f..05a5631963bb 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -105,10 +105,7 @@ static int __devinit teles_probe(struct pcmcia_device *link)
105 and attributes of IO windows) are fixed by the nature of the 105 and attributes of IO windows) are fixed by the nature of the
106 device, and can be hard-wired here. 106 device, and can be hard-wired here.
107 */ 107 */
108 link->resource[0]->end = 96; 108 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
109 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
110
111 link->config_flags |= CONF_ENABLE_IRQ;
112 109
113 return teles_cs_config(link); 110 return teles_cs_config(link);
114} /* teles_attach */ 111} /* teles_attach */
@@ -142,18 +139,17 @@ static void __devexit teles_detach(struct pcmcia_device *link)
142 139
143======================================================================*/ 140======================================================================*/
144 141
145static int teles_cs_configcheck(struct pcmcia_device *p_dev, 142static int teles_cs_configcheck(struct pcmcia_device *p_dev, void *priv_data)
146 cistpl_cftable_entry_t *cf,
147 cistpl_cftable_entry_t *dflt,
148 void *priv_data)
149{ 143{
150 int j; 144 int j;
151 145
152 p_dev->io_lines = 5; 146 p_dev->io_lines = 5;
147 p_dev->resource[0]->end = 96;
148 p_dev->resource[0]->flags &= IO_DATA_PATH_WIDTH;
149 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
153 150
154 if ((cf->io.nwin > 0) && cf->io.win[0].base) { 151 if ((p_dev->resource[0]->end) && p_dev->resource[0]->start) {
155 printk(KERN_INFO "(teles_cs: looks like the 96 model)\n"); 152 printk(KERN_INFO "(teles_cs: looks like the 96 model)\n");
156 p_dev->resource[0]->start = cf->io.win[0].base;
157 if (!pcmcia_request_io(p_dev)) 153 if (!pcmcia_request_io(p_dev))
158 return 0; 154 return 0;
159 } else { 155 } else {