1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2008-2010
5 * - Kurt Van Dijck, EIA Electronics
8 #include <linux/module.h>
9 #include <linux/interrupt.h>
14 #define TX_ECHO_SKB_MAX (((TXMAX+1)/2)-1)
17 * test is a specific CAN netdev
18 * is online (ie. up 'n running, not sleeping, not busoff
20 static inline int canif_is_active(struct net_device
*netdev
)
22 struct can_priv
*can
= netdev_priv(netdev
);
24 if (!netif_running(netdev
))
26 return (can
->state
<= CAN_STATE_ERROR_PASSIVE
);
30 static inline void softing_set_reset_dpram(struct softing
*card
)
32 if (card
->pdat
->generation
>= 2) {
33 spin_lock_bh(&card
->spin
);
34 iowrite8(ioread8(&card
->dpram
[DPRAM_V2_RESET
]) & ~1,
35 &card
->dpram
[DPRAM_V2_RESET
]);
36 spin_unlock_bh(&card
->spin
);
40 static inline void softing_clr_reset_dpram(struct softing
*card
)
42 if (card
->pdat
->generation
>= 2) {
43 spin_lock_bh(&card
->spin
);
44 iowrite8(ioread8(&card
->dpram
[DPRAM_V2_RESET
]) | 1,
45 &card
->dpram
[DPRAM_V2_RESET
]);
46 spin_unlock_bh(&card
->spin
);
50 /* trigger the tx queue-ing */
51 static netdev_tx_t
softing_netdev_start_xmit(struct sk_buff
*skb
,
52 struct net_device
*dev
)
54 struct softing_priv
*priv
= netdev_priv(dev
);
55 struct softing
*card
= priv
->card
;
58 uint8_t fifo_wr
, fifo_rd
;
59 struct can_frame
*cf
= (struct can_frame
*)skb
->data
;
60 uint8_t buf
[DPRAM_TX_SIZE
];
62 if (can_dropped_invalid_skb(dev
, skb
))
65 spin_lock(&card
->spin
);
69 (card
->tx
.pending
>= TXMAX
) ||
70 (priv
->tx
.pending
>= TX_ECHO_SKB_MAX
))
72 fifo_wr
= ioread8(&card
->dpram
[DPRAM_TX_WR
]);
73 fifo_rd
= ioread8(&card
->dpram
[DPRAM_TX_RD
]);
74 if (fifo_wr
== fifo_rd
)
77 memset(buf
, 0, sizeof(buf
));
80 if (cf
->can_id
& CAN_RTR_FLAG
)
82 if (cf
->can_id
& CAN_EFF_FLAG
)
88 *ptr
++ = (cf
->can_id
>> 0);
89 *ptr
++ = (cf
->can_id
>> 8);
90 if (cf
->can_id
& CAN_EFF_FLAG
) {
91 *ptr
++ = (cf
->can_id
>> 16);
92 *ptr
++ = (cf
->can_id
>> 24);
94 /* increment 1, not 2 as you might think */
97 if (!(cf
->can_id
& CAN_RTR_FLAG
))
98 memcpy(ptr
, &cf
->data
[0], cf
->len
);
99 memcpy_toio(&card
->dpram
[DPRAM_TX
+ DPRAM_TX_SIZE
* fifo_wr
],
101 if (++fifo_wr
>= DPRAM_TX_CNT
)
103 iowrite8(fifo_wr
, &card
->dpram
[DPRAM_TX_WR
]);
104 card
->tx
.last_bus
= priv
->index
;
107 can_put_echo_skb(skb
, dev
, priv
->tx
.echo_put
);
109 if (priv
->tx
.echo_put
>= TX_ECHO_SKB_MAX
)
110 priv
->tx
.echo_put
= 0;
111 /* can_put_echo_skb() saves the skb, safe to return TX_OK */
114 spin_unlock(&card
->spin
);
115 if (card
->tx
.pending
>= TXMAX
) {
117 for (j
= 0; j
< ARRAY_SIZE(card
->net
); ++j
) {
119 netif_stop_queue(card
->net
[j
]);
122 if (ret
!= NETDEV_TX_OK
)
123 netif_stop_queue(dev
);
129 * shortcut for skb delivery
131 int softing_netdev_rx(struct net_device
*netdev
, const struct can_frame
*msg
,
135 struct can_frame
*cf
;
137 skb
= alloc_can_skb(netdev
, &cf
);
140 memcpy(cf
, msg
, sizeof(*msg
));
142 return netif_rx(skb
);
147 * pop 1 entry from the DPRAM queue, and process
149 static int softing_handle_1(struct softing
*card
)
151 struct net_device
*netdev
;
152 struct softing_priv
*priv
;
154 struct can_frame msg
;
155 int cnt
= 0, lost_msg
;
156 uint8_t fifo_rd
, fifo_wr
, cmd
;
159 uint8_t buf
[DPRAM_RX_SIZE
];
161 memset(&msg
, 0, sizeof(msg
));
162 /* test for lost msgs */
163 lost_msg
= ioread8(&card
->dpram
[DPRAM_RX_LOST
]);
166 /* reset condition */
167 iowrite8(0, &card
->dpram
[DPRAM_RX_LOST
]);
169 msg
.can_id
= CAN_ERR_FLAG
| CAN_ERR_CRTL
;
170 msg
.len
= CAN_ERR_DLC
;
171 msg
.data
[1] = CAN_ERR_CRTL_RX_OVERFLOW
;
173 * service to all buses, we don't know which it was applicable
174 * but only service buses that are online
176 for (j
= 0; j
< ARRAY_SIZE(card
->net
); ++j
) {
177 netdev
= card
->net
[j
];
180 if (!canif_is_active(netdev
))
181 /* a dead bus has no overflows */
183 ++netdev
->stats
.rx_over_errors
;
184 softing_netdev_rx(netdev
, &msg
, 0);
186 /* prepare for other use */
187 memset(&msg
, 0, sizeof(msg
));
191 fifo_rd
= ioread8(&card
->dpram
[DPRAM_RX_RD
]);
192 fifo_wr
= ioread8(&card
->dpram
[DPRAM_RX_WR
]);
194 if (++fifo_rd
>= DPRAM_RX_CNT
)
196 if (fifo_wr
== fifo_rd
)
199 memcpy_fromio(buf
, &card
->dpram
[DPRAM_RX
+ DPRAM_RX_SIZE
*fifo_rd
],
202 /* trigger dual port RAM */
203 iowrite8(fifo_rd
, &card
->dpram
[DPRAM_RX_RD
]);
208 /* not quite useful, probably the card has got out */
210 netdev
= card
->net
[0];
212 netdev
= card
->net
[1];
213 priv
= netdev_priv(netdev
);
216 uint8_t can_state
, state
;
220 msg
.can_id
= CAN_ERR_FLAG
;
221 msg
.len
= CAN_ERR_DLC
;
223 if (state
& SF_MASK_BUSOFF
) {
224 can_state
= CAN_STATE_BUS_OFF
;
225 msg
.can_id
|= CAN_ERR_BUSOFF
;
226 state
= STATE_BUSOFF
;
227 } else if (state
& SF_MASK_EPASSIVE
) {
228 can_state
= CAN_STATE_ERROR_PASSIVE
;
229 msg
.can_id
|= CAN_ERR_CRTL
;
230 msg
.data
[1] = CAN_ERR_CRTL_TX_PASSIVE
;
231 state
= STATE_EPASSIVE
;
233 can_state
= CAN_STATE_ERROR_ACTIVE
;
234 msg
.can_id
|= CAN_ERR_CRTL
;
235 state
= STATE_EACTIVE
;
238 iowrite8(state
, &card
->dpram
[priv
->index
?
239 DPRAM_INFO_BUSSTATE2
: DPRAM_INFO_BUSSTATE
]);
241 tmp_u32
= le32_to_cpup((void *)ptr
);
243 ktime
= softing_raw2ktime(card
, tmp_u32
);
245 ++netdev
->stats
.rx_errors
;
246 /* update internal status */
247 if (can_state
!= priv
->can
.state
) {
248 priv
->can
.state
= can_state
;
249 if (can_state
== CAN_STATE_ERROR_PASSIVE
)
250 ++priv
->can
.can_stats
.error_passive
;
251 else if (can_state
== CAN_STATE_BUS_OFF
) {
252 /* this calls can_close_cleanup() */
253 ++priv
->can
.can_stats
.bus_off
;
255 netif_stop_queue(netdev
);
257 /* trigger socketcan */
258 softing_netdev_rx(netdev
, &msg
, ktime
);
263 msg
.can_id
|= CAN_RTR_FLAG
;
264 msg
.len
= can_cc_dlc2len(*ptr
++);
266 msg
.can_id
|= CAN_EFF_FLAG
;
267 msg
.can_id
|= le32_to_cpup((void *)ptr
);
270 msg
.can_id
|= le16_to_cpup((void *)ptr
);
274 tmp_u32
= le32_to_cpup((void *)ptr
);
276 ktime
= softing_raw2ktime(card
, tmp_u32
);
277 if (!(msg
.can_id
& CAN_RTR_FLAG
))
278 memcpy(&msg
.data
[0], ptr
, 8);
282 /* acknowledge, was tx msg */
284 skb
= priv
->can
.echo_skb
[priv
->tx
.echo_get
];
287 can_get_echo_skb(netdev
, priv
->tx
.echo_get
);
289 if (priv
->tx
.echo_get
>= TX_ECHO_SKB_MAX
)
290 priv
->tx
.echo_get
= 0;
291 if (priv
->tx
.pending
)
293 if (card
->tx
.pending
)
295 ++netdev
->stats
.tx_packets
;
296 if (!(msg
.can_id
& CAN_RTR_FLAG
))
297 netdev
->stats
.tx_bytes
+= msg
.len
;
301 ret
= softing_netdev_rx(netdev
, &msg
, ktime
);
302 if (ret
== NET_RX_SUCCESS
) {
303 ++netdev
->stats
.rx_packets
;
304 if (!(msg
.can_id
& CAN_RTR_FLAG
))
305 netdev
->stats
.rx_bytes
+= msg
.len
;
307 ++netdev
->stats
.rx_dropped
;
316 * real interrupt handler
318 static irqreturn_t
softing_irq_thread(int irq
, void *dev_id
)
320 struct softing
*card
= (struct softing
*)dev_id
;
321 struct net_device
*netdev
;
322 struct softing_priv
*priv
;
323 int j
, offset
, work_done
;
326 spin_lock_bh(&card
->spin
);
327 while (softing_handle_1(card
) > 0) {
328 ++card
->irq
.svc_count
;
331 spin_unlock_bh(&card
->spin
);
332 /* resume tx queue's */
333 offset
= card
->tx
.last_bus
;
334 for (j
= 0; j
< ARRAY_SIZE(card
->net
); ++j
) {
335 if (card
->tx
.pending
>= TXMAX
)
337 netdev
= card
->net
[(j
+ offset
+ 1) % card
->pdat
->nbus
];
340 priv
= netdev_priv(netdev
);
341 if (!canif_is_active(netdev
))
342 /* it makes no sense to wake dead buses */
344 if (priv
->tx
.pending
>= TX_ECHO_SKB_MAX
)
347 netif_wake_queue(netdev
);
349 return work_done
? IRQ_HANDLED
: IRQ_NONE
;
353 * interrupt routines:
354 * schedule the 'real interrupt handler'
356 static irqreturn_t
softing_irq_v2(int irq
, void *dev_id
)
358 struct softing
*card
= (struct softing
*)dev_id
;
361 ir
= ioread8(&card
->dpram
[DPRAM_V2_IRQ_TOHOST
]);
362 iowrite8(0, &card
->dpram
[DPRAM_V2_IRQ_TOHOST
]);
363 return (1 == ir
) ? IRQ_WAKE_THREAD
: IRQ_NONE
;
366 static irqreturn_t
softing_irq_v1(int irq
, void *dev_id
)
368 struct softing
*card
= (struct softing
*)dev_id
;
371 ir
= ioread8(&card
->dpram
[DPRAM_IRQ_TOHOST
]);
372 iowrite8(0, &card
->dpram
[DPRAM_IRQ_TOHOST
]);
373 return ir
? IRQ_WAKE_THREAD
: IRQ_NONE
;
377 * netdev/candev interoperability
379 static int softing_netdev_open(struct net_device
*ndev
)
383 /* check or determine and set bittime */
384 ret
= open_candev(ndev
);
388 ret
= softing_startstop(ndev
, 1);
395 static int softing_netdev_stop(struct net_device
*ndev
)
399 netif_stop_queue(ndev
);
401 /* softing cycle does close_candev() */
402 ret
= softing_startstop(ndev
, 0);
406 static int softing_candev_set_mode(struct net_device
*ndev
, enum can_mode mode
)
412 /* softing_startstop does close_candev() */
413 ret
= softing_startstop(ndev
, 1);
423 * Softing device management helpers
425 int softing_enable_irq(struct softing
*card
, int enable
)
431 } else if (card
->irq
.requested
&& !enable
) {
432 free_irq(card
->irq
.nr
, card
);
433 card
->irq
.requested
= 0;
434 } else if (!card
->irq
.requested
&& enable
) {
435 ret
= request_threaded_irq(card
->irq
.nr
,
436 (card
->pdat
->generation
>= 2) ?
437 softing_irq_v2
: softing_irq_v1
,
438 softing_irq_thread
, IRQF_SHARED
,
439 dev_name(&card
->pdev
->dev
), card
);
441 dev_alert(&card
->pdev
->dev
,
442 "request_threaded_irq(%u) failed\n",
446 card
->irq
.requested
= 1;
451 static void softing_card_shutdown(struct softing
*card
)
455 if (mutex_lock_interruptible(&card
->fw
.lock
)) {
456 /* return -ERESTARTSYS */;
461 if (card
->irq
.requested
&& card
->irq
.nr
) {
462 free_irq(card
->irq
.nr
, card
);
463 card
->irq
.requested
= 0;
466 if (card
->pdat
->enable_irq
)
467 card
->pdat
->enable_irq(card
->pdev
, 0);
468 softing_set_reset_dpram(card
);
469 if (card
->pdat
->reset
)
470 card
->pdat
->reset(card
->pdev
, 1);
472 mutex_unlock(&card
->fw
.lock
);
475 static int softing_card_boot(struct softing
*card
)
478 static const uint8_t stream
[] = {
479 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, };
480 unsigned char back
[sizeof(stream
)];
482 if (mutex_lock_interruptible(&card
->fw
.lock
))
485 mutex_unlock(&card
->fw
.lock
);
489 if (card
->pdat
->enable_irq
)
490 card
->pdat
->enable_irq(card
->pdev
, 1);
492 softing_set_reset_dpram(card
);
493 if (card
->pdat
->reset
)
494 card
->pdat
->reset(card
->pdev
, 1);
495 for (j
= 0; (j
+ sizeof(stream
)) < card
->dpram_size
;
496 j
+= sizeof(stream
)) {
498 memcpy_toio(&card
->dpram
[j
], stream
, sizeof(stream
));
501 memcpy_fromio(back
, &card
->dpram
[j
], sizeof(stream
));
503 if (!memcmp(back
, stream
, sizeof(stream
)))
505 /* memory is not equal */
506 dev_alert(&card
->pdev
->dev
, "dpram failed at 0x%04x\n", j
);
511 /* load boot firmware */
512 ret
= softing_load_fw(card
->pdat
->boot
.fw
, card
, card
->dpram
,
514 card
->pdat
->boot
.offs
- card
->pdat
->boot
.addr
);
517 /* load loader firmware */
518 ret
= softing_load_fw(card
->pdat
->load
.fw
, card
, card
->dpram
,
520 card
->pdat
->load
.offs
- card
->pdat
->load
.addr
);
524 if (card
->pdat
->reset
)
525 card
->pdat
->reset(card
->pdev
, 0);
526 softing_clr_reset_dpram(card
);
527 ret
= softing_bootloader_command(card
, 0, "card boot");
530 ret
= softing_load_app_fw(card
->pdat
->app
.fw
, card
);
534 ret
= softing_chip_poweron(card
);
539 mutex_unlock(&card
->fw
.lock
);
543 if (card
->pdat
->enable_irq
)
544 card
->pdat
->enable_irq(card
->pdev
, 0);
545 softing_set_reset_dpram(card
);
546 if (card
->pdat
->reset
)
547 card
->pdat
->reset(card
->pdev
, 1);
548 mutex_unlock(&card
->fw
.lock
);
555 static ssize_t
show_chip(struct device
*dev
, struct device_attribute
*attr
,
558 struct net_device
*ndev
= to_net_dev(dev
);
559 struct softing_priv
*priv
= netdev2softing(ndev
);
561 return sprintf(buf
, "%i\n", priv
->chip
);
564 static ssize_t
show_output(struct device
*dev
, struct device_attribute
*attr
,
567 struct net_device
*ndev
= to_net_dev(dev
);
568 struct softing_priv
*priv
= netdev2softing(ndev
);
570 return sprintf(buf
, "0x%02x\n", priv
->output
);
573 static ssize_t
store_output(struct device
*dev
, struct device_attribute
*attr
,
574 const char *buf
, size_t count
)
576 struct net_device
*ndev
= to_net_dev(dev
);
577 struct softing_priv
*priv
= netdev2softing(ndev
);
578 struct softing
*card
= priv
->card
;
582 ret
= kstrtoul(buf
, 0, &val
);
587 ret
= mutex_lock_interruptible(&card
->fw
.lock
);
590 if (netif_running(ndev
)) {
591 mutex_unlock(&card
->fw
.lock
);
595 mutex_unlock(&card
->fw
.lock
);
599 static const DEVICE_ATTR(chip
, 0444, show_chip
, NULL
);
600 static const DEVICE_ATTR(output
, 0644, show_output
, store_output
);
602 static const struct attribute
*const netdev_sysfs_attrs
[] = {
604 &dev_attr_output
.attr
,
607 static const struct attribute_group netdev_sysfs_group
= {
609 .attrs
= (struct attribute
**)netdev_sysfs_attrs
,
612 static const struct net_device_ops softing_netdev_ops
= {
613 .ndo_open
= softing_netdev_open
,
614 .ndo_stop
= softing_netdev_stop
,
615 .ndo_start_xmit
= softing_netdev_start_xmit
,
616 .ndo_change_mtu
= can_change_mtu
,
619 static const struct can_bittiming_const softing_btr_const
= {
625 .sjw_max
= 4, /* overruled */
627 .brp_max
= 32, /* overruled */
632 static struct net_device
*softing_netdev_create(struct softing
*card
,
635 struct net_device
*netdev
;
636 struct softing_priv
*priv
;
638 netdev
= alloc_candev(sizeof(*priv
), TX_ECHO_SKB_MAX
);
640 dev_alert(&card
->pdev
->dev
, "alloc_candev failed\n");
643 priv
= netdev_priv(netdev
);
644 priv
->netdev
= netdev
;
646 memcpy(&priv
->btr_const
, &softing_btr_const
, sizeof(priv
->btr_const
));
647 priv
->btr_const
.brp_max
= card
->pdat
->max_brp
;
648 priv
->btr_const
.sjw_max
= card
->pdat
->max_sjw
;
649 priv
->can
.bittiming_const
= &priv
->btr_const
;
650 priv
->can
.clock
.freq
= 8000000;
651 priv
->chip
= chip_id
;
652 priv
->output
= softing_default_output(netdev
);
653 SET_NETDEV_DEV(netdev
, &card
->pdev
->dev
);
655 netdev
->flags
|= IFF_ECHO
;
656 netdev
->netdev_ops
= &softing_netdev_ops
;
657 priv
->can
.do_set_mode
= softing_candev_set_mode
;
658 priv
->can
.ctrlmode_supported
= CAN_CTRLMODE_3_SAMPLES
;
663 static int softing_netdev_register(struct net_device
*netdev
)
667 ret
= register_candev(netdev
);
669 dev_alert(&netdev
->dev
, "register failed\n");
672 if (sysfs_create_group(&netdev
->dev
.kobj
, &netdev_sysfs_group
) < 0)
673 netdev_alert(netdev
, "sysfs group failed\n");
678 static void softing_netdev_cleanup(struct net_device
*netdev
)
680 sysfs_remove_group(&netdev
->dev
.kobj
, &netdev_sysfs_group
);
681 unregister_candev(netdev
);
686 * sysfs for Platform device
688 #define DEV_ATTR_RO(name, member) \
689 static ssize_t show_##name(struct device *dev, \
690 struct device_attribute *attr, char *buf) \
692 struct softing *card = dev_get_drvdata(dev); \
693 return sprintf(buf, "%u\n", card->member); \
695 static DEVICE_ATTR(name, 0444, show_##name, NULL)
697 #define DEV_ATTR_RO_STR(name, member) \
698 static ssize_t show_##name(struct device *dev, \
699 struct device_attribute *attr, char *buf) \
701 struct softing *card = dev_get_drvdata(dev); \
702 return sprintf(buf, "%s\n", card->member); \
704 static DEVICE_ATTR(name, 0444, show_##name, NULL)
706 DEV_ATTR_RO(serial
, id
.serial
);
707 DEV_ATTR_RO_STR(firmware
, pdat
->app
.fw
);
708 DEV_ATTR_RO(firmware_version
, id
.fw_version
);
709 DEV_ATTR_RO_STR(hardware
, pdat
->name
);
710 DEV_ATTR_RO(hardware_version
, id
.hw_version
);
711 DEV_ATTR_RO(license
, id
.license
);
713 static struct attribute
*softing_pdev_attrs
[] = {
714 &dev_attr_serial
.attr
,
715 &dev_attr_firmware
.attr
,
716 &dev_attr_firmware_version
.attr
,
717 &dev_attr_hardware
.attr
,
718 &dev_attr_hardware_version
.attr
,
719 &dev_attr_license
.attr
,
723 static const struct attribute_group softing_pdev_group
= {
725 .attrs
= softing_pdev_attrs
,
731 static int softing_pdev_remove(struct platform_device
*pdev
)
733 struct softing
*card
= platform_get_drvdata(pdev
);
736 /* first, disable card*/
737 softing_card_shutdown(card
);
739 for (j
= 0; j
< ARRAY_SIZE(card
->net
); ++j
) {
742 softing_netdev_cleanup(card
->net
[j
]);
745 sysfs_remove_group(&pdev
->dev
.kobj
, &softing_pdev_group
);
747 iounmap(card
->dpram
);
752 static int softing_pdev_probe(struct platform_device
*pdev
)
754 const struct softing_platform_data
*pdat
= dev_get_platdata(&pdev
->dev
);
755 struct softing
*card
;
756 struct net_device
*netdev
;
757 struct softing_priv
*priv
;
758 struct resource
*pres
;
763 dev_warn(&pdev
->dev
, "no platform data\n");
766 if (pdat
->nbus
> ARRAY_SIZE(card
->net
)) {
767 dev_warn(&pdev
->dev
, "%u nets??\n", pdat
->nbus
);
771 card
= kzalloc(sizeof(*card
), GFP_KERNEL
);
776 platform_set_drvdata(pdev
, card
);
777 mutex_init(&card
->fw
.lock
);
778 spin_lock_init(&card
->spin
);
781 pres
= platform_get_resource(pdev
, IORESOURCE_MEM
, 0);
783 goto platform_resource_failed
;
784 card
->dpram_phys
= pres
->start
;
785 card
->dpram_size
= resource_size(pres
);
786 card
->dpram
= ioremap(card
->dpram_phys
, card
->dpram_size
);
788 dev_alert(&card
->pdev
->dev
, "dpram ioremap failed\n");
792 pres
= platform_get_resource(pdev
, IORESOURCE_IRQ
, 0);
794 card
->irq
.nr
= pres
->start
;
797 ret
= softing_card_boot(card
);
799 dev_alert(&pdev
->dev
, "failed to boot\n");
803 /* only now, the chip's are known */
804 card
->id
.freq
= card
->pdat
->freq
;
806 ret
= sysfs_create_group(&pdev
->dev
.kobj
, &softing_pdev_group
);
808 dev_alert(&card
->pdev
->dev
, "sysfs failed\n");
812 for (j
= 0; j
< ARRAY_SIZE(card
->net
); ++j
) {
813 card
->net
[j
] = netdev
=
814 softing_netdev_create(card
, card
->id
.chip
[j
]);
816 dev_alert(&pdev
->dev
, "failed to make can[%i]", j
);
821 priv
= netdev_priv(card
->net
[j
]);
823 ret
= softing_netdev_register(netdev
);
827 dev_alert(&card
->pdev
->dev
,
828 "failed to register can[%i]\n", j
);
832 dev_info(&card
->pdev
->dev
, "%s ready.\n", card
->pdat
->name
);
836 for (j
= 0; j
< ARRAY_SIZE(card
->net
); ++j
) {
839 softing_netdev_cleanup(card
->net
[j
]);
841 sysfs_remove_group(&pdev
->dev
.kobj
, &softing_pdev_group
);
843 softing_card_shutdown(card
);
845 iounmap(card
->dpram
);
847 platform_resource_failed
:
852 static struct platform_driver softing_driver
= {
856 .probe
= softing_pdev_probe
,
857 .remove
= softing_pdev_remove
,
860 module_platform_driver(softing_driver
);
862 MODULE_ALIAS("platform:softing");
863 MODULE_DESCRIPTION("Softing DPRAM CAN driver");
864 MODULE_AUTHOR("Kurt Van Dijck <kurt.van.dijck@eia.be>");
865 MODULE_LICENSE("GPL v2");