diff options
-rw-r--r-- | drivers/net/arcnet/com20020-pci.c | 33 | ||||
-rw-r--r-- | drivers/net/arcnet/com20020.h | 4 |
2 files changed, 37 insertions, 0 deletions
diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index e3b7c14e619f..637a6110cec6 100644 --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c | |||
@@ -68,6 +68,7 @@ static int com20020pci_probe(struct pci_dev *pdev, | |||
68 | const struct pci_device_id *id) | 68 | const struct pci_device_id *id) |
69 | { | 69 | { |
70 | struct com20020_pci_card_info *ci; | 70 | struct com20020_pci_card_info *ci; |
71 | struct com20020_pci_channel_map *mm; | ||
71 | struct net_device *dev; | 72 | struct net_device *dev; |
72 | struct arcnet_local *lp; | 73 | struct arcnet_local *lp; |
73 | struct com20020_priv *priv; | 74 | struct com20020_priv *priv; |
@@ -84,9 +85,22 @@ static int com20020pci_probe(struct pci_dev *pdev, | |||
84 | 85 | ||
85 | ci = (struct com20020_pci_card_info *)id->driver_data; | 86 | ci = (struct com20020_pci_card_info *)id->driver_data; |
86 | priv->ci = ci; | 87 | priv->ci = ci; |
88 | mm = &ci->misc_map; | ||
87 | 89 | ||
88 | INIT_LIST_HEAD(&priv->list_dev); | 90 | INIT_LIST_HEAD(&priv->list_dev); |
89 | 91 | ||
92 | if (mm->size) { | ||
93 | ioaddr = pci_resource_start(pdev, mm->bar) + mm->offset; | ||
94 | r = devm_request_region(&pdev->dev, ioaddr, mm->size, | ||
95 | "com20020-pci"); | ||
96 | if (!r) { | ||
97 | pr_err("IO region %xh-%xh already allocated.\n", | ||
98 | ioaddr, ioaddr + mm->size - 1); | ||
99 | return -EBUSY; | ||
100 | } | ||
101 | priv->misc = ioaddr; | ||
102 | } | ||
103 | |||
90 | for (i = 0; i < ci->devcount; i++) { | 104 | for (i = 0; i < ci->devcount; i++) { |
91 | struct com20020_pci_channel_map *cm = &ci->chan_map_tbl[i]; | 105 | struct com20020_pci_channel_map *cm = &ci->chan_map_tbl[i]; |
92 | struct com20020_dev *card; | 106 | struct com20020_dev *card; |
@@ -132,6 +146,13 @@ static int com20020pci_probe(struct pci_dev *pdev, | |||
132 | lp->timeout = timeout; | 146 | lp->timeout = timeout; |
133 | lp->hw.owner = THIS_MODULE; | 147 | lp->hw.owner = THIS_MODULE; |
134 | 148 | ||
149 | /* Get the dev_id from the PLX rotary coder */ | ||
150 | if (!strncmp(ci->name, "EAE PLX-PCI MA1", 15)) | ||
151 | dev->dev_id = 0xc; | ||
152 | dev->dev_id ^= inb(priv->misc + ci->rotary) >> 4; | ||
153 | |||
154 | snprintf(dev->name, sizeof(dev->name), "arc%d-%d", dev->dev_id, i); | ||
155 | |||
135 | if (arcnet_inb(ioaddr, COM20020_REG_R_STATUS) == 0xFF) { | 156 | if (arcnet_inb(ioaddr, COM20020_REG_R_STATUS) == 0xFF) { |
136 | pr_err("IO address %Xh is empty!\n", ioaddr); | 157 | pr_err("IO address %Xh is empty!\n", ioaddr); |
137 | ret = -EIO; | 158 | ret = -EIO; |
@@ -235,6 +256,12 @@ static struct com20020_pci_card_info card_info_eae_arc1 = { | |||
235 | .size = 0x08, | 256 | .size = 0x08, |
236 | }, | 257 | }, |
237 | }, | 258 | }, |
259 | .misc_map = { | ||
260 | .bar = 2, | ||
261 | .offset = 0x10, | ||
262 | .size = 0x04, | ||
263 | }, | ||
264 | .rotary = 0x0, | ||
238 | .flags = ARC_CAN_10MBIT, | 265 | .flags = ARC_CAN_10MBIT, |
239 | }; | 266 | }; |
240 | 267 | ||
@@ -252,6 +279,12 @@ static struct com20020_pci_card_info card_info_eae_ma1 = { | |||
252 | .size = 0x08, | 279 | .size = 0x08, |
253 | } | 280 | } |
254 | }, | 281 | }, |
282 | .misc_map = { | ||
283 | .bar = 2, | ||
284 | .offset = 0x10, | ||
285 | .size = 0x04, | ||
286 | }, | ||
287 | .rotary = 0x0, | ||
255 | .flags = ARC_CAN_10MBIT, | 288 | .flags = ARC_CAN_10MBIT, |
256 | }; | 289 | }; |
257 | 290 | ||
diff --git a/drivers/net/arcnet/com20020.h b/drivers/net/arcnet/com20020.h index 22a460f39fb9..f2ed2eff3ae3 100644 --- a/drivers/net/arcnet/com20020.h +++ b/drivers/net/arcnet/com20020.h | |||
@@ -47,6 +47,9 @@ struct com20020_pci_card_info { | |||
47 | int devcount; | 47 | int devcount; |
48 | 48 | ||
49 | struct com20020_pci_channel_map chan_map_tbl[PLX_PCI_MAX_CARDS]; | 49 | struct com20020_pci_channel_map chan_map_tbl[PLX_PCI_MAX_CARDS]; |
50 | struct com20020_pci_channel_map misc_map; | ||
51 | |||
52 | int rotary; | ||
50 | 53 | ||
51 | unsigned int flags; | 54 | unsigned int flags; |
52 | }; | 55 | }; |
@@ -54,6 +57,7 @@ struct com20020_pci_card_info { | |||
54 | struct com20020_priv { | 57 | struct com20020_priv { |
55 | struct com20020_pci_card_info *ci; | 58 | struct com20020_pci_card_info *ci; |
56 | struct list_head list_dev; | 59 | struct list_head list_dev; |
60 | resource_size_t misc; | ||
57 | }; | 61 | }; |
58 | 62 | ||
59 | struct com20020_dev { | 63 | struct com20020_dev { |