Skip to content

Commit 8c14f9c

Browse files
mgrzeschikdavem330
authored andcommitted
ARCNET: add com20020 PCI IDs with metadata
This patch adds metadata for the com20020 to prepare for devices with multiple io address areas with multi card interfaces. Signed-off-by: Michael Grzeschik <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a0d2e51 commit 8c14f9c

File tree

2 files changed

+197
-35
lines changed

2 files changed

+197
-35
lines changed

drivers/net/arcnet/com20020-pci.c

Lines changed: 181 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ MODULE_LICENSE("GPL");
6363

6464
static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
6565
{
66+
struct com20020_pci_channel_map *cm;
67+
struct com20020_pci_card_info *ci;
6668
struct net_device *dev;
6769
struct arcnet_local *lp;
6870
int ioaddr, err;
@@ -75,19 +77,15 @@ static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
7577

7678
dev->netdev_ops = &com20020_netdev_ops;
7779

80+
ci = (struct com20020_pci_card_info *)id->driver_data;
81+
7882
lp = netdev_priv(dev);
7983

8084
pci_set_drvdata(pdev, dev);
8185

82-
// SOHARD needs PCI base addr 4
83-
if (pdev->vendor==0x10B5) {
84-
BUGMSG(D_NORMAL, "SOHARD\n");
85-
ioaddr = pci_resource_start(pdev, 4);
86-
}
87-
else {
88-
BUGMSG(D_NORMAL, "Contemporary Controls\n");
89-
ioaddr = pci_resource_start(pdev, 2);
90-
}
86+
cm = &ci->chan_map_tbl[0];
87+
BUGMSG(D_NORMAL, "%s Controls\n", ci->name);
88+
ioaddr = pci_resource_start(pdev, cm->bar);
9189

9290
if (!request_region(ioaddr, ARCNET_TOTAL_SIZE, "com20020-pci")) {
9391
BUGMSG(D_INIT, "IO region %xh-%xh already allocated.\n",
@@ -105,7 +103,7 @@ static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
105103
dev->irq = pdev->irq;
106104
dev->dev_addr[0] = node;
107105
lp->card_name = "PCI COM20020";
108-
lp->card_flags = id->driver_data;
106+
lp->card_flags = ci->flags;
109107
lp->backplane = backplane;
110108
lp->clockp = clockp & 7;
111109
lp->clockm = clockm & 3;
@@ -144,32 +142,180 @@ static void com20020pci_remove(struct pci_dev *pdev)
144142
free_netdev(dev);
145143
}
146144

145+
static struct com20020_pci_card_info card_info_10mbit = {
146+
.name = "ARC-PCI",
147+
.devcount = 1,
148+
.chan_map_tbl = {
149+
{ 2, 0x00, 0x08 },
150+
},
151+
.flags = ARC_CAN_10MBIT,
152+
};
153+
154+
static struct com20020_pci_card_info card_info_5mbit = {
155+
.name = "ARC-PCI",
156+
.devcount = 1,
157+
.chan_map_tbl = {
158+
{ 2, 0x00, 0x08 },
159+
},
160+
.flags = ARC_IS_5MBIT,
161+
};
162+
163+
static struct com20020_pci_card_info card_info_sohard = {
164+
.name = "PLX-PCI",
165+
.devcount = 1,
166+
/* SOHARD needs PCI base addr 4 */
167+
.chan_map_tbl = {
168+
{4, 0x00, 0x08},
169+
},
170+
.flags = ARC_CAN_10MBIT,
171+
};
172+
147173
static const struct pci_device_id com20020pci_id_table[] = {
148-
{ 0x1571, 0xa001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
149-
{ 0x1571, 0xa002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
150-
{ 0x1571, 0xa003, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
151-
{ 0x1571, 0xa004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
152-
{ 0x1571, 0xa005, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
153-
{ 0x1571, 0xa006, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
154-
{ 0x1571, 0xa007, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
155-
{ 0x1571, 0xa008, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
156-
{ 0x1571, 0xa009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT },
157-
{ 0x1571, 0xa00a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT },
158-
{ 0x1571, 0xa00b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT },
159-
{ 0x1571, 0xa00c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT },
160-
{ 0x1571, 0xa00d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT },
161-
{ 0x1571, 0xa00e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT },
162-
{ 0x1571, 0xa201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
163-
{ 0x1571, 0xa202, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
164-
{ 0x1571, 0xa203, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
165-
{ 0x1571, 0xa204, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
166-
{ 0x1571, 0xa205, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
167-
{ 0x1571, 0xa206, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
168-
{ 0x10B5, 0x9030, 0x10B5, 0x2978, 0, 0, ARC_CAN_10MBIT },
169-
{ 0x10B5, 0x9050, 0x10B5, 0x2273, 0, 0, ARC_CAN_10MBIT },
170-
{ 0x14BA, 0x6000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
171-
{ 0x10B5, 0x2200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
172-
{0,}
174+
{
175+
0x1571, 0xa001,
176+
PCI_ANY_ID, PCI_ANY_ID,
177+
0, 0,
178+
0,
179+
},
180+
{
181+
0x1571, 0xa002,
182+
PCI_ANY_ID, PCI_ANY_ID,
183+
0, 0,
184+
0,
185+
},
186+
{
187+
0x1571, 0xa003,
188+
PCI_ANY_ID, PCI_ANY_ID,
189+
0, 0,
190+
0
191+
},
192+
{
193+
0x1571, 0xa004,
194+
PCI_ANY_ID, PCI_ANY_ID,
195+
0, 0,
196+
0,
197+
},
198+
{
199+
0x1571, 0xa005,
200+
PCI_ANY_ID, PCI_ANY_ID,
201+
0, 0,
202+
0
203+
},
204+
{
205+
0x1571, 0xa006,
206+
PCI_ANY_ID, PCI_ANY_ID,
207+
0, 0,
208+
0
209+
},
210+
{
211+
0x1571, 0xa007,
212+
PCI_ANY_ID, PCI_ANY_ID,
213+
0, 0,
214+
0
215+
},
216+
{
217+
0x1571, 0xa008,
218+
PCI_ANY_ID, PCI_ANY_ID,
219+
0, 0,
220+
0
221+
},
222+
{
223+
0x1571, 0xa009,
224+
PCI_ANY_ID, PCI_ANY_ID,
225+
0, 0,
226+
(kernel_ulong_t)&card_info_5mbit
227+
},
228+
{
229+
0x1571, 0xa00a,
230+
PCI_ANY_ID, PCI_ANY_ID,
231+
0, 0,
232+
(kernel_ulong_t)&card_info_5mbit
233+
},
234+
{
235+
0x1571, 0xa00b,
236+
PCI_ANY_ID, PCI_ANY_ID,
237+
0, 0,
238+
(kernel_ulong_t)&card_info_5mbit
239+
},
240+
{
241+
0x1571, 0xa00c,
242+
PCI_ANY_ID, PCI_ANY_ID,
243+
0, 0,
244+
(kernel_ulong_t)&card_info_5mbit
245+
},
246+
{
247+
0x1571, 0xa00d,
248+
PCI_ANY_ID, PCI_ANY_ID,
249+
0, 0,
250+
(kernel_ulong_t)&card_info_5mbit
251+
},
252+
{
253+
0x1571, 0xa00e,
254+
PCI_ANY_ID, PCI_ANY_ID,
255+
0, 0,
256+
(kernel_ulong_t)&card_info_5mbit
257+
},
258+
{
259+
0x1571, 0xa201,
260+
PCI_ANY_ID, PCI_ANY_ID,
261+
0, 0,
262+
(kernel_ulong_t)&card_info_10mbit
263+
},
264+
{
265+
0x1571, 0xa202,
266+
PCI_ANY_ID, PCI_ANY_ID,
267+
0, 0,
268+
(kernel_ulong_t)&card_info_10mbit
269+
},
270+
{
271+
0x1571, 0xa203,
272+
PCI_ANY_ID, PCI_ANY_ID,
273+
0, 0,
274+
(kernel_ulong_t)&card_info_10mbit
275+
},
276+
{
277+
0x1571, 0xa204,
278+
PCI_ANY_ID, PCI_ANY_ID,
279+
0, 0,
280+
(kernel_ulong_t)&card_info_10mbit
281+
},
282+
{
283+
0x1571, 0xa205,
284+
PCI_ANY_ID, PCI_ANY_ID,
285+
0, 0,
286+
(kernel_ulong_t)&card_info_10mbit
287+
},
288+
{
289+
0x1571, 0xa206,
290+
PCI_ANY_ID, PCI_ANY_ID,
291+
0, 0,
292+
(kernel_ulong_t)&card_info_10mbit
293+
},
294+
{
295+
0x10B5, 0x9030,
296+
0x10B5, 0x2978,
297+
0, 0,
298+
(kernel_ulong_t)&card_info_sohard
299+
},
300+
{
301+
0x10B5, 0x9050,
302+
0x10B5, 0x2273,
303+
0, 0,
304+
(kernel_ulong_t)&card_info_sohard
305+
},
306+
{
307+
0x14BA, 0x6000,
308+
PCI_ANY_ID, PCI_ANY_ID,
309+
0, 0,
310+
(kernel_ulong_t)&card_info_10mbit
311+
},
312+
{
313+
0x10B5, 0x2200,
314+
PCI_ANY_ID, PCI_ANY_ID,
315+
0, 0,
316+
(kernel_ulong_t)&card_info_10mbit
317+
},
318+
{ 0, }
173319
};
174320

175321
MODULE_DEVICE_TABLE(pci, com20020pci_id_table);

include/linux/com20020.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ extern const struct net_device_ops com20020_netdev_ops;
4141
#define BUS_ALIGN 1
4242
#endif
4343

44+
#define PLX_PCI_MAX_CARDS 1
45+
46+
struct com20020_pci_channel_map {
47+
u32 bar;
48+
u32 offset;
49+
u32 size; /* 0x00 - auto, e.g. length of entire bar */
50+
};
51+
52+
struct com20020_pci_card_info {
53+
const char *name;
54+
int devcount;
55+
56+
struct com20020_pci_channel_map chan_map_tbl[PLX_PCI_MAX_CARDS];
57+
58+
unsigned int flags;
59+
};
4460

4561
#define _INTMASK (ioaddr+BUS_ALIGN*0) /* writable */
4662
#define _STATUS (ioaddr+BUS_ALIGN*0) /* readable */

0 commit comments

Comments
 (0)