diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-10-13 03:24:51 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-10-13 03:24:59 -0400 |
commit | 2c96c142e941041973faab20ca3b82d57f435c5e (patch) | |
tree | 45188f0ecb3f4bb7408a7219f8fcd041d500235a /drivers | |
parent | 3c355863fb32070a2800f41106519c5c3038623a (diff) | |
parent | 8ad807318fcd62aba0e18c7c7fbfcc1af3fcdbab (diff) |
Merge branch 'tracing/urgent' into tracing/core
Merge reason: Pick up tracing/filters fix from the urgent queue,
we will queue up dependent patches.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers')
93 files changed, 3036 insertions, 703 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index a4fddb24476f..f6e54bf8dd96 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -285,7 +285,7 @@ static int acpi_video_device_brightness_open_fs(struct inode *inode, | |||
285 | struct file *file); | 285 | struct file *file); |
286 | static ssize_t acpi_video_device_write_brightness(struct file *file, | 286 | static ssize_t acpi_video_device_write_brightness(struct file *file, |
287 | const char __user *buffer, size_t count, loff_t *data); | 287 | const char __user *buffer, size_t count, loff_t *data); |
288 | static struct file_operations acpi_video_device_brightness_fops = { | 288 | static const struct file_operations acpi_video_device_brightness_fops = { |
289 | .owner = THIS_MODULE, | 289 | .owner = THIS_MODULE, |
290 | .open = acpi_video_device_brightness_open_fs, | 290 | .open = acpi_video_device_brightness_open_fs, |
291 | .read = seq_read, | 291 | .read = seq_read, |
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c index 703364b52170..66e181345b3a 100644 --- a/drivers/atm/ambassador.c +++ b/drivers/atm/ambassador.c | |||
@@ -1306,14 +1306,6 @@ static void amb_close (struct atm_vcc * atm_vcc) { | |||
1306 | return; | 1306 | return; |
1307 | } | 1307 | } |
1308 | 1308 | ||
1309 | /********** Set socket options for a VC **********/ | ||
1310 | |||
1311 | // int amb_getsockopt (struct atm_vcc * atm_vcc, int level, int optname, void * optval, int optlen); | ||
1312 | |||
1313 | /********** Set socket options for a VC **********/ | ||
1314 | |||
1315 | // int amb_setsockopt (struct atm_vcc * atm_vcc, int level, int optname, void * optval, int optlen); | ||
1316 | |||
1317 | /********** Send **********/ | 1309 | /********** Send **********/ |
1318 | 1310 | ||
1319 | static int amb_send (struct atm_vcc * atm_vcc, struct sk_buff * skb) { | 1311 | static int amb_send (struct atm_vcc * atm_vcc, struct sk_buff * skb) { |
diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c index 5503bfc8e132..0c3026145443 100644 --- a/drivers/atm/eni.c +++ b/drivers/atm/eni.c | |||
@@ -2031,7 +2031,7 @@ static int eni_getsockopt(struct atm_vcc *vcc,int level,int optname, | |||
2031 | 2031 | ||
2032 | 2032 | ||
2033 | static int eni_setsockopt(struct atm_vcc *vcc,int level,int optname, | 2033 | static int eni_setsockopt(struct atm_vcc *vcc,int level,int optname, |
2034 | void __user *optval,int optlen) | 2034 | void __user *optval,unsigned int optlen) |
2035 | { | 2035 | { |
2036 | return -EINVAL; | 2036 | return -EINVAL; |
2037 | } | 2037 | } |
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c index b119640e1ee9..cd5049af47a9 100644 --- a/drivers/atm/firestream.c +++ b/drivers/atm/firestream.c | |||
@@ -1244,7 +1244,7 @@ static int fs_getsockopt(struct atm_vcc *vcc,int level,int optname, | |||
1244 | 1244 | ||
1245 | 1245 | ||
1246 | static int fs_setsockopt(struct atm_vcc *vcc,int level,int optname, | 1246 | static int fs_setsockopt(struct atm_vcc *vcc,int level,int optname, |
1247 | void __user *optval,int optlen) | 1247 | void __user *optval,unsigned int optlen) |
1248 | { | 1248 | { |
1249 | func_enter (); | 1249 | func_enter (); |
1250 | func_exit (); | 1250 | func_exit (); |
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index 10f000dbe448..f766cc46b4c4 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c | |||
@@ -1795,7 +1795,7 @@ fore200e_getsockopt(struct atm_vcc* vcc, int level, int optname, void __user *op | |||
1795 | 1795 | ||
1796 | 1796 | ||
1797 | static int | 1797 | static int |
1798 | fore200e_setsockopt(struct atm_vcc* vcc, int level, int optname, void __user *optval, int optlen) | 1798 | fore200e_setsockopt(struct atm_vcc* vcc, int level, int optname, void __user *optval, unsigned int optlen) |
1799 | { | 1799 | { |
1800 | /* struct fore200e* fore200e = FORE200E_DEV(vcc->dev); */ | 1800 | /* struct fore200e* fore200e = FORE200E_DEV(vcc->dev); */ |
1801 | 1801 | ||
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c index 01ce241dbeae..4e49021e67ee 100644 --- a/drivers/atm/horizon.c +++ b/drivers/atm/horizon.c | |||
@@ -2590,7 +2590,7 @@ static int hrz_getsockopt (struct atm_vcc * atm_vcc, int level, int optname, | |||
2590 | } | 2590 | } |
2591 | 2591 | ||
2592 | static int hrz_setsockopt (struct atm_vcc * atm_vcc, int level, int optname, | 2592 | static int hrz_setsockopt (struct atm_vcc * atm_vcc, int level, int optname, |
2593 | void *optval, int optlen) { | 2593 | void *optval, unsigned int optlen) { |
2594 | hrz_dev * dev = HRZ_DEV(atm_vcc->dev); | 2594 | hrz_dev * dev = HRZ_DEV(atm_vcc->dev); |
2595 | PRINTD (DBG_FLOW|DBG_VCC, "hrz_setsockopt"); | 2595 | PRINTD (DBG_FLOW|DBG_VCC, "hrz_setsockopt"); |
2596 | switch (level) { | 2596 | switch (level) { |
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c index 78c9736c3579..b2c1b37ab2e4 100644 --- a/drivers/atm/iphase.c +++ b/drivers/atm/iphase.c | |||
@@ -2862,7 +2862,7 @@ static int ia_getsockopt(struct atm_vcc *vcc, int level, int optname, | |||
2862 | } | 2862 | } |
2863 | 2863 | ||
2864 | static int ia_setsockopt(struct atm_vcc *vcc, int level, int optname, | 2864 | static int ia_setsockopt(struct atm_vcc *vcc, int level, int optname, |
2865 | void __user *optval, int optlen) | 2865 | void __user *optval, unsigned int optlen) |
2866 | { | 2866 | { |
2867 | IF_EVENT(printk(">ia_setsockopt\n");) | 2867 | IF_EVENT(printk(">ia_setsockopt\n");) |
2868 | return -EINVAL; | 2868 | return -EINVAL; |
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c index 752b1ba81f7e..2e9635be048c 100644 --- a/drivers/atm/zatm.c +++ b/drivers/atm/zatm.c | |||
@@ -1517,7 +1517,7 @@ static int zatm_getsockopt(struct atm_vcc *vcc,int level,int optname, | |||
1517 | 1517 | ||
1518 | 1518 | ||
1519 | static int zatm_setsockopt(struct atm_vcc *vcc,int level,int optname, | 1519 | static int zatm_setsockopt(struct atm_vcc *vcc,int level,int optname, |
1520 | void __user *optval,int optlen) | 1520 | void __user *optval,unsigned int optlen) |
1521 | { | 1521 | { |
1522 | return -EINVAL; | 1522 | return -EINVAL; |
1523 | } | 1523 | } |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 24c3e21ab263..1ece0b47b581 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -426,7 +426,7 @@ out: | |||
426 | return err; | 426 | return err; |
427 | } | 427 | } |
428 | 428 | ||
429 | static struct file_operations cciss_proc_fops = { | 429 | static const struct file_operations cciss_proc_fops = { |
430 | .owner = THIS_MODULE, | 430 | .owner = THIS_MODULE, |
431 | .open = cciss_seq_open, | 431 | .open = cciss_seq_open, |
432 | .read = seq_read, | 432 | .read = seq_read, |
diff --git a/drivers/char/apm-emulation.c b/drivers/char/apm-emulation.c index aaca40283be9..4f568cb9af3f 100644 --- a/drivers/char/apm-emulation.c +++ b/drivers/char/apm-emulation.c | |||
@@ -393,7 +393,7 @@ static int apm_open(struct inode * inode, struct file * filp) | |||
393 | return as ? 0 : -ENOMEM; | 393 | return as ? 0 : -ENOMEM; |
394 | } | 394 | } |
395 | 395 | ||
396 | static struct file_operations apm_bios_fops = { | 396 | static const struct file_operations apm_bios_fops = { |
397 | .owner = THIS_MODULE, | 397 | .owner = THIS_MODULE, |
398 | .read = apm_read, | 398 | .read = apm_read, |
399 | .poll = apm_poll, | 399 | .poll = apm_poll, |
diff --git a/drivers/char/bfin-otp.c b/drivers/char/bfin-otp.c index e3dd24bff514..836d4f0a876f 100644 --- a/drivers/char/bfin-otp.c +++ b/drivers/char/bfin-otp.c | |||
@@ -217,7 +217,7 @@ static long bfin_otp_ioctl(struct file *filp, unsigned cmd, unsigned long arg) | |||
217 | # define bfin_otp_ioctl NULL | 217 | # define bfin_otp_ioctl NULL |
218 | #endif | 218 | #endif |
219 | 219 | ||
220 | static struct file_operations bfin_otp_fops = { | 220 | static const struct file_operations bfin_otp_fops = { |
221 | .owner = THIS_MODULE, | 221 | .owner = THIS_MODULE, |
222 | .unlocked_ioctl = bfin_otp_ioctl, | 222 | .unlocked_ioctl = bfin_otp_ioctl, |
223 | .read = bfin_otp_read, | 223 | .read = bfin_otp_read, |
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index df5038bbcbc2..4254457d3911 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -3354,7 +3354,7 @@ static int __init cy_detect_isa(void) | |||
3354 | continue; | 3354 | continue; |
3355 | } | 3355 | } |
3356 | #ifdef MODULE | 3356 | #ifdef MODULE |
3357 | if (isparam && irq[i]) | 3357 | if (isparam && i < NR_CARDS && irq[i]) |
3358 | cy_isa_irq = irq[i]; | 3358 | cy_isa_irq = irq[i]; |
3359 | else | 3359 | else |
3360 | #endif | 3360 | #endif |
diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c index 5942a9d674c0..452370af95de 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c | |||
@@ -220,8 +220,7 @@ static inline int serial_paranoia_check(struct cyclades_port *info, char *name, | |||
220 | return 1; | 220 | return 1; |
221 | } | 221 | } |
222 | 222 | ||
223 | if ((long)info < (long)(&cy_port[0]) | 223 | if (info < &cy_port[0] || info >= &cy_port[NR_PORTS]) { |
224 | || (long)(&cy_port[NR_PORTS]) < (long)info) { | ||
225 | printk("Warning: cyclades_port out of range for (%s) in %s\n", | 224 | printk("Warning: cyclades_port out of range for (%s) in %s\n", |
226 | name, routine); | 225 | name, routine); |
227 | return 1; | 226 | return 1; |
@@ -520,15 +519,13 @@ static irqreturn_t cd2401_tx_interrupt(int irq, void *dev_id) | |||
520 | panic("TxInt on debug port!!!"); | 519 | panic("TxInt on debug port!!!"); |
521 | } | 520 | } |
522 | #endif | 521 | #endif |
523 | |||
524 | info = &cy_port[channel]; | ||
525 | |||
526 | /* validate the port number (as configured and open) */ | 522 | /* validate the port number (as configured and open) */ |
527 | if ((channel < 0) || (NR_PORTS <= channel)) { | 523 | if ((channel < 0) || (NR_PORTS <= channel)) { |
528 | base_addr[CyIER] &= ~(CyTxMpty | CyTxRdy); | 524 | base_addr[CyIER] &= ~(CyTxMpty | CyTxRdy); |
529 | base_addr[CyTEOIR] = CyNOTRANS; | 525 | base_addr[CyTEOIR] = CyNOTRANS; |
530 | return IRQ_HANDLED; | 526 | return IRQ_HANDLED; |
531 | } | 527 | } |
528 | info = &cy_port[channel]; | ||
532 | info->last_active = jiffies; | 529 | info->last_active = jiffies; |
533 | if (info->tty == 0) { | 530 | if (info->tty == 0) { |
534 | base_addr[CyIER] &= ~(CyTxMpty | CyTxRdy); | 531 | base_addr[CyIER] &= ~(CyTxMpty | CyTxRdy); |
diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c index aafdbaebc16a..feb55075819b 100644 --- a/drivers/char/tty_ldisc.c +++ b/drivers/char/tty_ldisc.c | |||
@@ -518,7 +518,7 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old) | |||
518 | static int tty_ldisc_halt(struct tty_struct *tty) | 518 | static int tty_ldisc_halt(struct tty_struct *tty) |
519 | { | 519 | { |
520 | clear_bit(TTY_LDISC, &tty->flags); | 520 | clear_bit(TTY_LDISC, &tty->flags); |
521 | return cancel_delayed_work(&tty->buf.work); | 521 | return cancel_delayed_work_sync(&tty->buf.work); |
522 | } | 522 | } |
523 | 523 | ||
524 | /** | 524 | /** |
@@ -756,12 +756,9 @@ void tty_ldisc_hangup(struct tty_struct *tty) | |||
756 | * N_TTY. | 756 | * N_TTY. |
757 | */ | 757 | */ |
758 | if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) { | 758 | if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) { |
759 | /* Make sure the old ldisc is quiescent */ | ||
760 | tty_ldisc_halt(tty); | ||
761 | flush_scheduled_work(); | ||
762 | |||
763 | /* Avoid racing set_ldisc or tty_ldisc_release */ | 759 | /* Avoid racing set_ldisc or tty_ldisc_release */ |
764 | mutex_lock(&tty->ldisc_mutex); | 760 | mutex_lock(&tty->ldisc_mutex); |
761 | tty_ldisc_halt(tty); | ||
765 | if (tty->ldisc) { /* Not yet closed */ | 762 | if (tty->ldisc) { /* Not yet closed */ |
766 | /* Switch back to N_TTY */ | 763 | /* Switch back to N_TTY */ |
767 | tty_ldisc_reinit(tty); | 764 | tty_ldisc_reinit(tty); |
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index 29c651ab0d78..6b36ee56e6fe 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
@@ -981,8 +981,10 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
981 | goto eperm; | 981 | goto eperm; |
982 | 982 | ||
983 | if (copy_from_user(&vsa, (struct vt_setactivate __user *)arg, | 983 | if (copy_from_user(&vsa, (struct vt_setactivate __user *)arg, |
984 | sizeof(struct vt_setactivate))) | 984 | sizeof(struct vt_setactivate))) { |
985 | return -EFAULT; | 985 | ret = -EFAULT; |
986 | goto out; | ||
987 | } | ||
986 | if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES) | 988 | if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES) |
987 | ret = -ENXIO; | 989 | ret = -ENXIO; |
988 | else { | 990 | else { |
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c index f40ab699860f..4846d50199f3 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c | |||
@@ -559,7 +559,7 @@ static int hwicap_release(struct inode *inode, struct file *file) | |||
559 | return status; | 559 | return status; |
560 | } | 560 | } |
561 | 561 | ||
562 | static struct file_operations hwicap_fops = { | 562 | static const struct file_operations hwicap_fops = { |
563 | .owner = THIS_MODULE, | 563 | .owner = THIS_MODULE, |
564 | .write = hwicap_write, | 564 | .write = hwicap_write, |
565 | .read = hwicap_read, | 565 | .read = hwicap_read, |
diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c index 4a1dfe1f4ba9..210338ea222f 100644 --- a/drivers/connector/cn_queue.c +++ b/drivers/connector/cn_queue.c | |||
@@ -78,18 +78,20 @@ void cn_queue_wrapper(struct work_struct *work) | |||
78 | struct cn_callback_entry *cbq = | 78 | struct cn_callback_entry *cbq = |
79 | container_of(work, struct cn_callback_entry, work); | 79 | container_of(work, struct cn_callback_entry, work); |
80 | struct cn_callback_data *d = &cbq->data; | 80 | struct cn_callback_data *d = &cbq->data; |
81 | struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(d->skb)); | ||
82 | struct netlink_skb_parms *nsp = &NETLINK_CB(d->skb); | ||
81 | 83 | ||
82 | d->callback(d->callback_priv); | 84 | d->callback(msg, nsp); |
83 | 85 | ||
84 | d->destruct_data(d->ddata); | 86 | kfree_skb(d->skb); |
85 | d->ddata = NULL; | 87 | d->skb = NULL; |
86 | 88 | ||
87 | kfree(d->free); | 89 | kfree(d->free); |
88 | } | 90 | } |
89 | 91 | ||
90 | static struct cn_callback_entry * | 92 | static struct cn_callback_entry * |
91 | cn_queue_alloc_callback_entry(char *name, struct cb_id *id, | 93 | cn_queue_alloc_callback_entry(char *name, struct cb_id *id, |
92 | void (*callback)(struct cn_msg *)) | 94 | void (*callback)(struct cn_msg *, struct netlink_skb_parms *)) |
93 | { | 95 | { |
94 | struct cn_callback_entry *cbq; | 96 | struct cn_callback_entry *cbq; |
95 | 97 | ||
@@ -123,7 +125,7 @@ int cn_cb_equal(struct cb_id *i1, struct cb_id *i2) | |||
123 | } | 125 | } |
124 | 126 | ||
125 | int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, | 127 | int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, |
126 | void (*callback)(struct cn_msg *)) | 128 | void (*callback)(struct cn_msg *, struct netlink_skb_parms *)) |
127 | { | 129 | { |
128 | struct cn_callback_entry *cbq, *__cbq; | 130 | struct cn_callback_entry *cbq, *__cbq; |
129 | int found = 0; | 131 | int found = 0; |
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index 74f52af79563..f06024668f99 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c | |||
@@ -129,21 +129,19 @@ EXPORT_SYMBOL_GPL(cn_netlink_send); | |||
129 | /* | 129 | /* |
130 | * Callback helper - queues work and setup destructor for given data. | 130 | * Callback helper - queues work and setup destructor for given data. |
131 | */ | 131 | */ |
132 | static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), void *data) | 132 | static int cn_call_callback(struct sk_buff *skb) |
133 | { | 133 | { |
134 | struct cn_callback_entry *__cbq, *__new_cbq; | 134 | struct cn_callback_entry *__cbq, *__new_cbq; |
135 | struct cn_dev *dev = &cdev; | 135 | struct cn_dev *dev = &cdev; |
136 | struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(skb)); | ||
136 | int err = -ENODEV; | 137 | int err = -ENODEV; |
137 | 138 | ||
138 | spin_lock_bh(&dev->cbdev->queue_lock); | 139 | spin_lock_bh(&dev->cbdev->queue_lock); |
139 | list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) { | 140 | list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) { |
140 | if (cn_cb_equal(&__cbq->id.id, &msg->id)) { | 141 | if (cn_cb_equal(&__cbq->id.id, &msg->id)) { |
141 | if (likely(!work_pending(&__cbq->work) && | 142 | if (likely(!work_pending(&__cbq->work) && |
142 | __cbq->data.ddata == NULL)) { | 143 | __cbq->data.skb == NULL)) { |
143 | __cbq->data.callback_priv = msg; | 144 | __cbq->data.skb = skb; |
144 | |||
145 | __cbq->data.ddata = data; | ||
146 | __cbq->data.destruct_data = destruct_data; | ||
147 | 145 | ||
148 | if (queue_cn_work(__cbq, &__cbq->work)) | 146 | if (queue_cn_work(__cbq, &__cbq->work)) |
149 | err = 0; | 147 | err = 0; |
@@ -156,10 +154,8 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v | |||
156 | __new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC); | 154 | __new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC); |
157 | if (__new_cbq) { | 155 | if (__new_cbq) { |
158 | d = &__new_cbq->data; | 156 | d = &__new_cbq->data; |
159 | d->callback_priv = msg; | 157 | d->skb = skb; |
160 | d->callback = __cbq->data.callback; | 158 | d->callback = __cbq->data.callback; |
161 | d->ddata = data; | ||
162 | d->destruct_data = destruct_data; | ||
163 | d->free = __new_cbq; | 159 | d->free = __new_cbq; |
164 | 160 | ||
165 | __new_cbq->pdev = __cbq->pdev; | 161 | __new_cbq->pdev = __cbq->pdev; |
@@ -191,7 +187,6 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v | |||
191 | */ | 187 | */ |
192 | static void cn_rx_skb(struct sk_buff *__skb) | 188 | static void cn_rx_skb(struct sk_buff *__skb) |
193 | { | 189 | { |
194 | struct cn_msg *msg; | ||
195 | struct nlmsghdr *nlh; | 190 | struct nlmsghdr *nlh; |
196 | int err; | 191 | int err; |
197 | struct sk_buff *skb; | 192 | struct sk_buff *skb; |
@@ -208,8 +203,7 @@ static void cn_rx_skb(struct sk_buff *__skb) | |||
208 | return; | 203 | return; |
209 | } | 204 | } |
210 | 205 | ||
211 | msg = NLMSG_DATA(nlh); | 206 | err = cn_call_callback(skb); |
212 | err = cn_call_callback(msg, (void (*)(void *))kfree_skb, skb); | ||
213 | if (err < 0) | 207 | if (err < 0) |
214 | kfree_skb(skb); | 208 | kfree_skb(skb); |
215 | } | 209 | } |
@@ -270,7 +264,7 @@ static void cn_notify(struct cb_id *id, u32 notify_event) | |||
270 | * May sleep. | 264 | * May sleep. |
271 | */ | 265 | */ |
272 | int cn_add_callback(struct cb_id *id, char *name, | 266 | int cn_add_callback(struct cb_id *id, char *name, |
273 | void (*callback)(struct cn_msg *)) | 267 | void (*callback)(struct cn_msg *, struct netlink_skb_parms *)) |
274 | { | 268 | { |
275 | int err; | 269 | int err; |
276 | struct cn_dev *dev = &cdev; | 270 | struct cn_dev *dev = &cdev; |
@@ -352,7 +346,7 @@ static int cn_ctl_msg_equals(struct cn_ctl_msg *m1, struct cn_ctl_msg *m2) | |||
352 | * | 346 | * |
353 | * Used for notification of a request's processing. | 347 | * Used for notification of a request's processing. |
354 | */ | 348 | */ |
355 | static void cn_callback(struct cn_msg *msg) | 349 | static void cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) |
356 | { | 350 | { |
357 | struct cn_ctl_msg *ctl; | 351 | struct cn_ctl_msg *ctl; |
358 | struct cn_ctl_entry *ent; | 352 | struct cn_ctl_entry *ent; |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index bb11a429394a..662ed923d9eb 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -1487,7 +1487,7 @@ static int gpiolib_open(struct inode *inode, struct file *file) | |||
1487 | return single_open(file, gpiolib_show, NULL); | 1487 | return single_open(file, gpiolib_show, NULL); |
1488 | } | 1488 | } |
1489 | 1489 | ||
1490 | static struct file_operations gpiolib_operations = { | 1490 | static const struct file_operations gpiolib_operations = { |
1491 | .open = gpiolib_open, | 1491 | .open = gpiolib_open, |
1492 | .read = seq_read, | 1492 | .read = seq_read, |
1493 | .llseek = seq_lseek, | 1493 | .llseek = seq_lseek, |
diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c index ea955edde87e..2a7a85a6dc36 100644 --- a/drivers/hwmon/fschmd.c +++ b/drivers/hwmon/fschmd.c | |||
@@ -915,7 +915,7 @@ static int watchdog_ioctl(struct inode *inode, struct file *filp, | |||
915 | return ret; | 915 | return ret; |
916 | } | 916 | } |
917 | 917 | ||
918 | static struct file_operations watchdog_fops = { | 918 | static const struct file_operations watchdog_fops = { |
919 | .owner = THIS_MODULE, | 919 | .owner = THIS_MODULE, |
920 | .llseek = no_llseek, | 920 | .llseek = no_llseek, |
921 | .open = watchdog_open, | 921 | .open = watchdog_open, |
diff --git a/drivers/input/input.c b/drivers/input/input.c index e828aab7dace..16ec33f27c5d 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -1273,6 +1273,7 @@ static int input_dev_uevent(struct device *device, struct kobj_uevent_env *env) | |||
1273 | } \ | 1273 | } \ |
1274 | } while (0) | 1274 | } while (0) |
1275 | 1275 | ||
1276 | #ifdef CONFIG_PM | ||
1276 | static void input_dev_reset(struct input_dev *dev, bool activate) | 1277 | static void input_dev_reset(struct input_dev *dev, bool activate) |
1277 | { | 1278 | { |
1278 | if (!dev->event) | 1279 | if (!dev->event) |
@@ -1287,7 +1288,6 @@ static void input_dev_reset(struct input_dev *dev, bool activate) | |||
1287 | } | 1288 | } |
1288 | } | 1289 | } |
1289 | 1290 | ||
1290 | #ifdef CONFIG_PM | ||
1291 | static int input_dev_suspend(struct device *dev) | 1291 | static int input_dev_suspend(struct device *dev) |
1292 | { | 1292 | { |
1293 | struct input_dev *input_dev = to_input_dev(dev); | 1293 | struct input_dev *input_dev = to_input_dev(dev); |
diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c index c36f52137456..feb0fa45b664 100644 --- a/drivers/isdn/mISDN/socket.c +++ b/drivers/isdn/mISDN/socket.c | |||
@@ -415,7 +415,7 @@ data_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
415 | } | 415 | } |
416 | 416 | ||
417 | static int data_sock_setsockopt(struct socket *sock, int level, int optname, | 417 | static int data_sock_setsockopt(struct socket *sock, int level, int optname, |
418 | char __user *optval, int len) | 418 | char __user *optval, unsigned int len) |
419 | { | 419 | { |
420 | struct sock *sk = sock->sk; | 420 | struct sock *sk = sock->sk; |
421 | int err = 0, opt = 0; | 421 | int err = 0, opt = 0; |
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c index b4d3f7ca554f..bd1632388e4a 100644 --- a/drivers/lguest/lguest_user.c +++ b/drivers/lguest/lguest_user.c | |||
@@ -508,7 +508,7 @@ static int close(struct inode *inode, struct file *file) | |||
508 | * uses: reading and writing a character device called /dev/lguest. All the | 508 | * uses: reading and writing a character device called /dev/lguest. All the |
509 | * work happens in the read(), write() and close() routines: | 509 | * work happens in the read(), write() and close() routines: |
510 | */ | 510 | */ |
511 | static struct file_operations lguest_fops = { | 511 | static const struct file_operations lguest_fops = { |
512 | .owner = THIS_MODULE, | 512 | .owner = THIS_MODULE, |
513 | .release = close, | 513 | .release = close, |
514 | .write = write, | 514 | .write = write, |
diff --git a/drivers/md/dm-log-userspace-transfer.c b/drivers/md/dm-log-userspace-transfer.c index ba0edad2d048..54abf9e303b7 100644 --- a/drivers/md/dm-log-userspace-transfer.c +++ b/drivers/md/dm-log-userspace-transfer.c | |||
@@ -129,11 +129,13 @@ static int fill_pkg(struct cn_msg *msg, struct dm_ulog_request *tfr) | |||
129 | * This is the connector callback that delivers data | 129 | * This is the connector callback that delivers data |
130 | * that was sent from userspace. | 130 | * that was sent from userspace. |
131 | */ | 131 | */ |
132 | static void cn_ulog_callback(void *data) | 132 | static void cn_ulog_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) |
133 | { | 133 | { |
134 | struct cn_msg *msg = (struct cn_msg *)data; | ||
135 | struct dm_ulog_request *tfr = (struct dm_ulog_request *)(msg + 1); | 134 | struct dm_ulog_request *tfr = (struct dm_ulog_request *)(msg + 1); |
136 | 135 | ||
136 | if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN)) | ||
137 | return; | ||
138 | |||
137 | spin_lock(&receiving_list_lock); | 139 | spin_lock(&receiving_list_lock); |
138 | if (msg->len == 0) | 140 | if (msg->len == 0) |
139 | fill_pkg(msg, NULL); | 141 | fill_pkg(msg, NULL); |
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c index 3750ff48cba1..516414983593 100644 --- a/drivers/media/dvb/dvb-core/dmxdev.c +++ b/drivers/media/dvb/dvb-core/dmxdev.c | |||
@@ -1203,7 +1203,7 @@ static unsigned int dvb_dvr_poll(struct file *file, poll_table *wait) | |||
1203 | return mask; | 1203 | return mask; |
1204 | } | 1204 | } |
1205 | 1205 | ||
1206 | static struct file_operations dvb_dvr_fops = { | 1206 | static const struct file_operations dvb_dvr_fops = { |
1207 | .owner = THIS_MODULE, | 1207 | .owner = THIS_MODULE, |
1208 | .read = dvb_dvr_read, | 1208 | .read = dvb_dvr_read, |
1209 | .write = dvb_dvr_write, | 1209 | .write = dvb_dvr_write, |
diff --git a/drivers/media/dvb/firewire/firedtv-ci.c b/drivers/media/dvb/firewire/firedtv-ci.c index eeb80d0ea3ff..853e04b7cb36 100644 --- a/drivers/media/dvb/firewire/firedtv-ci.c +++ b/drivers/media/dvb/firewire/firedtv-ci.c | |||
@@ -215,7 +215,7 @@ static unsigned int fdtv_ca_io_poll(struct file *file, poll_table *wait) | |||
215 | return POLLIN; | 215 | return POLLIN; |
216 | } | 216 | } |
217 | 217 | ||
218 | static struct file_operations fdtv_ca_fops = { | 218 | static const struct file_operations fdtv_ca_fops = { |
219 | .owner = THIS_MODULE, | 219 | .owner = THIS_MODULE, |
220 | .ioctl = dvb_generic_ioctl, | 220 | .ioctl = dvb_generic_ioctl, |
221 | .open = dvb_generic_open, | 221 | .open = dvb_generic_open, |
diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c index fa57b67593ae..90a95ce8dc34 100644 --- a/drivers/misc/phantom.c +++ b/drivers/misc/phantom.c | |||
@@ -271,7 +271,7 @@ static unsigned int phantom_poll(struct file *file, poll_table *wait) | |||
271 | return mask; | 271 | return mask; |
272 | } | 272 | } |
273 | 273 | ||
274 | static struct file_operations phantom_file_ops = { | 274 | static const struct file_operations phantom_file_ops = { |
275 | .open = phantom_open, | 275 | .open = phantom_open, |
276 | .release = phantom_release, | 276 | .release = phantom_release, |
277 | .unlocked_ioctl = phantom_ioctl, | 277 | .unlocked_ioctl = phantom_ioctl, |
diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c index 300e7ba391a0..41c8fe2a928c 100644 --- a/drivers/misc/sgi-gru/grufile.c +++ b/drivers/misc/sgi-gru/grufile.c | |||
@@ -53,7 +53,6 @@ struct gru_stats_s gru_stats; | |||
53 | /* Guaranteed user available resources on each node */ | 53 | /* Guaranteed user available resources on each node */ |
54 | static int max_user_cbrs, max_user_dsr_bytes; | 54 | static int max_user_cbrs, max_user_dsr_bytes; |
55 | 55 | ||
56 | static struct file_operations gru_fops; | ||
57 | static struct miscdevice gru_miscdev; | 56 | static struct miscdevice gru_miscdev; |
58 | 57 | ||
59 | 58 | ||
@@ -426,7 +425,7 @@ static void __exit gru_exit(void) | |||
426 | gru_proc_exit(); | 425 | gru_proc_exit(); |
427 | } | 426 | } |
428 | 427 | ||
429 | static struct file_operations gru_fops = { | 428 | static const struct file_operations gru_fops = { |
430 | .owner = THIS_MODULE, | 429 | .owner = THIS_MODULE, |
431 | .unlocked_ioctl = gru_file_unlocked_ioctl, | 430 | .unlocked_ioctl = gru_file_unlocked_ioctl, |
432 | .mmap = gru_file_mmap, | 431 | .mmap = gru_file_mmap, |
diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index 610dbd1fcc82..96d10f40fb23 100644 --- a/drivers/mmc/core/debugfs.c +++ b/drivers/mmc/core/debugfs.c | |||
@@ -240,7 +240,7 @@ static int mmc_ext_csd_release(struct inode *inode, struct file *file) | |||
240 | return 0; | 240 | return 0; |
241 | } | 241 | } |
242 | 242 | ||
243 | static struct file_operations mmc_dbg_ext_csd_fops = { | 243 | static const struct file_operations mmc_dbg_ext_csd_fops = { |
244 | .open = mmc_ext_csd_open, | 244 | .open = mmc_ext_csd_open, |
245 | .read = mmc_ext_csd_read, | 245 | .read = mmc_ext_csd_read, |
246 | .release = mmc_ext_csd_release, | 246 | .release = mmc_ext_csd_release, |
diff --git a/drivers/mmc/core/sdio_cis.c b/drivers/mmc/core/sdio_cis.c index 6636354b48ce..e1035c895808 100644 --- a/drivers/mmc/core/sdio_cis.c +++ b/drivers/mmc/core/sdio_cis.c | |||
@@ -98,6 +98,22 @@ static const unsigned char speed_val[16] = | |||
98 | static const unsigned int speed_unit[8] = | 98 | static const unsigned int speed_unit[8] = |
99 | { 10000, 100000, 1000000, 10000000, 0, 0, 0, 0 }; | 99 | { 10000, 100000, 1000000, 10000000, 0, 0, 0, 0 }; |
100 | 100 | ||
101 | /* FUNCE tuples with these types get passed to SDIO drivers */ | ||
102 | static const unsigned char funce_type_whitelist[] = { | ||
103 | 4 /* CISTPL_FUNCE_LAN_NODE_ID used in Broadcom cards */ | ||
104 | }; | ||
105 | |||
106 | static int cistpl_funce_whitelisted(unsigned char type) | ||
107 | { | ||
108 | int i; | ||
109 | |||
110 | for (i = 0; i < ARRAY_SIZE(funce_type_whitelist); i++) { | ||
111 | if (funce_type_whitelist[i] == type) | ||
112 | return 1; | ||
113 | } | ||
114 | return 0; | ||
115 | } | ||
116 | |||
101 | static int cistpl_funce_common(struct mmc_card *card, | 117 | static int cistpl_funce_common(struct mmc_card *card, |
102 | const unsigned char *buf, unsigned size) | 118 | const unsigned char *buf, unsigned size) |
103 | { | 119 | { |
@@ -120,6 +136,10 @@ static int cistpl_funce_func(struct sdio_func *func, | |||
120 | unsigned vsn; | 136 | unsigned vsn; |
121 | unsigned min_size; | 137 | unsigned min_size; |
122 | 138 | ||
139 | /* let SDIO drivers take care of whitelisted FUNCE tuples */ | ||
140 | if (cistpl_funce_whitelisted(buf[0])) | ||
141 | return -EILSEQ; | ||
142 | |||
123 | vsn = func->card->cccr.sdio_vsn; | 143 | vsn = func->card->cccr.sdio_vsn; |
124 | min_size = (vsn == SDIO_SDIO_REV_1_00) ? 28 : 42; | 144 | min_size = (vsn == SDIO_SDIO_REV_1_00) ? 28 : 42; |
125 | 145 | ||
@@ -154,13 +174,12 @@ static int cistpl_funce(struct mmc_card *card, struct sdio_func *func, | |||
154 | else | 174 | else |
155 | ret = cistpl_funce_common(card, buf, size); | 175 | ret = cistpl_funce_common(card, buf, size); |
156 | 176 | ||
157 | if (ret) { | 177 | if (ret && ret != -EILSEQ) { |
158 | printk(KERN_ERR "%s: bad CISTPL_FUNCE size %u " | 178 | printk(KERN_ERR "%s: bad CISTPL_FUNCE size %u " |
159 | "type %u\n", mmc_hostname(card->host), size, buf[0]); | 179 | "type %u\n", mmc_hostname(card->host), size, buf[0]); |
160 | return ret; | ||
161 | } | 180 | } |
162 | 181 | ||
163 | return 0; | 182 | return ret; |
164 | } | 183 | } |
165 | 184 | ||
166 | typedef int (tpl_parse_t)(struct mmc_card *, struct sdio_func *, | 185 | typedef int (tpl_parse_t)(struct mmc_card *, struct sdio_func *, |
@@ -253,21 +272,12 @@ static int sdio_read_cis(struct mmc_card *card, struct sdio_func *func) | |||
253 | for (i = 0; i < ARRAY_SIZE(cis_tpl_list); i++) | 272 | for (i = 0; i < ARRAY_SIZE(cis_tpl_list); i++) |
254 | if (cis_tpl_list[i].code == tpl_code) | 273 | if (cis_tpl_list[i].code == tpl_code) |
255 | break; | 274 | break; |
256 | if (i >= ARRAY_SIZE(cis_tpl_list)) { | 275 | if (i < ARRAY_SIZE(cis_tpl_list)) { |
257 | /* this tuple is unknown to the core */ | ||
258 | this->next = NULL; | ||
259 | this->code = tpl_code; | ||
260 | this->size = tpl_link; | ||
261 | *prev = this; | ||
262 | prev = &this->next; | ||
263 | printk(KERN_DEBUG | ||
264 | "%s: queuing CIS tuple 0x%02x length %u\n", | ||
265 | mmc_hostname(card->host), tpl_code, tpl_link); | ||
266 | } else { | ||
267 | const struct cis_tpl *tpl = cis_tpl_list + i; | 276 | const struct cis_tpl *tpl = cis_tpl_list + i; |
268 | if (tpl_link < tpl->min_size) { | 277 | if (tpl_link < tpl->min_size) { |
269 | printk(KERN_ERR | 278 | printk(KERN_ERR |
270 | "%s: bad CIS tuple 0x%02x (length = %u, expected >= %u)\n", | 279 | "%s: bad CIS tuple 0x%02x" |
280 | " (length = %u, expected >= %u)\n", | ||
271 | mmc_hostname(card->host), | 281 | mmc_hostname(card->host), |
272 | tpl_code, tpl_link, tpl->min_size); | 282 | tpl_code, tpl_link, tpl->min_size); |
273 | ret = -EINVAL; | 283 | ret = -EINVAL; |
@@ -275,7 +285,30 @@ static int sdio_read_cis(struct mmc_card *card, struct sdio_func *func) | |||
275 | ret = tpl->parse(card, func, | 285 | ret = tpl->parse(card, func, |
276 | this->data, tpl_link); | 286 | this->data, tpl_link); |
277 | } | 287 | } |
278 | kfree(this); | 288 | /* |
289 | * We don't need the tuple anymore if it was | ||
290 | * successfully parsed by the SDIO core or if it is | ||
291 | * not going to be parsed by SDIO drivers. | ||
292 | */ | ||
293 | if (!ret || ret != -EILSEQ) | ||
294 | kfree(this); | ||
295 | } else { | ||
296 | /* unknown tuple */ | ||
297 | ret = -EILSEQ; | ||
298 | } | ||
299 | |||
300 | if (ret == -EILSEQ) { | ||
301 | /* this tuple is unknown to the core or whitelisted */ | ||
302 | this->next = NULL; | ||
303 | this->code = tpl_code; | ||
304 | this->size = tpl_link; | ||
305 | *prev = this; | ||
306 | prev = &this->next; | ||
307 | printk(KERN_DEBUG | ||
308 | "%s: queuing CIS tuple 0x%02x length %u\n", | ||
309 | mmc_hostname(card->host), tpl_code, tpl_link); | ||
310 | /* keep on analyzing tuples */ | ||
311 | ret = 0; | ||
279 | } | 312 | } |
280 | 313 | ||
281 | ptr += tpl_link; | 314 | ptr += tpl_link; |
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 7cb057f3f883..432ae8358c86 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig | |||
@@ -276,6 +276,47 @@ config MMC_S3C | |||
276 | 276 | ||
277 | If unsure, say N. | 277 | If unsure, say N. |
278 | 278 | ||
279 | config MMC_S3C_HW_SDIO_IRQ | ||
280 | bool "Hardware support for SDIO IRQ" | ||
281 | depends on MMC_S3C | ||
282 | help | ||
283 | Enable the hardware support for SDIO interrupts instead of using | ||
284 | the generic polling code. | ||
285 | |||
286 | choice | ||
287 | prompt "Samsung S3C SD/MMC transfer code" | ||
288 | depends on MMC_S3C | ||
289 | |||
290 | config MMC_S3C_PIO | ||
291 | bool "Use PIO transfers only" | ||
292 | help | ||
293 | Use PIO to transfer data between memory and the hardware. | ||
294 | |||
295 | PIO is slower than DMA as it requires CPU instructions to | ||
296 | move the data. This has been the traditional default for | ||
297 | the S3C MCI driver. | ||
298 | |||
299 | config MMC_S3C_DMA | ||
300 | bool "Use DMA transfers only (EXPERIMENTAL)" | ||
301 | depends on EXPERIMENTAL | ||
302 | help | ||
303 | Use DMA to transfer data between memory and the hardare. | ||
304 | |||
305 | Currently, the DMA support in this driver seems to not be | ||
306 | working properly and needs to be debugged before this | ||
307 | option is useful. | ||
308 | |||
309 | config MMC_S3C_PIODMA | ||
310 | bool "Support for both PIO and DMA (EXPERIMENTAL)" | ||
311 | help | ||
312 | Compile both the PIO and DMA transfer routines into the | ||
313 | driver and let the platform select at run-time which one | ||
314 | is best. | ||
315 | |||
316 | See notes for the DMA option. | ||
317 | |||
318 | endchoice | ||
319 | |||
279 | config MMC_SDRICOH_CS | 320 | config MMC_SDRICOH_CS |
280 | tristate "MMC/SD driver for Ricoh Bay1Controllers (EXPERIMENTAL)" | 321 | tristate "MMC/SD driver for Ricoh Bay1Controllers (EXPERIMENTAL)" |
281 | depends on EXPERIMENTAL && PCI && PCMCIA | 322 | depends on EXPERIMENTAL && PCI && PCMCIA |
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 3d1e5329da12..705a5894a6bb 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -678,7 +678,6 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) | |||
678 | writel(0, host->base + MMCIMASK1); | 678 | writel(0, host->base + MMCIMASK1); |
679 | writel(0xfff, host->base + MMCICLEAR); | 679 | writel(0xfff, host->base + MMCICLEAR); |
680 | 680 | ||
681 | #ifdef CONFIG_GPIOLIB | ||
682 | if (gpio_is_valid(plat->gpio_cd)) { | 681 | if (gpio_is_valid(plat->gpio_cd)) { |
683 | ret = gpio_request(plat->gpio_cd, DRIVER_NAME " (cd)"); | 682 | ret = gpio_request(plat->gpio_cd, DRIVER_NAME " (cd)"); |
684 | if (ret == 0) | 683 | if (ret == 0) |
@@ -697,7 +696,6 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) | |||
697 | else if (ret != -ENOSYS) | 696 | else if (ret != -ENOSYS) |
698 | goto err_gpio_wp; | 697 | goto err_gpio_wp; |
699 | } | 698 | } |
700 | #endif | ||
701 | 699 | ||
702 | ret = request_irq(dev->irq[0], mmci_irq, IRQF_SHARED, DRIVER_NAME " (cmd)", host); | 700 | ret = request_irq(dev->irq[0], mmci_irq, IRQF_SHARED, DRIVER_NAME " (cmd)", host); |
703 | if (ret) | 701 | if (ret) |
diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c index 8c08cd7efa7f..99b74a351020 100644 --- a/drivers/mmc/host/s3cmci.c +++ b/drivers/mmc/host/s3cmci.c | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <linux/mmc/host.h> | 17 | #include <linux/mmc/host.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/cpufreq.h> | 19 | #include <linux/cpufreq.h> |
20 | #include <linux/debugfs.h> | ||
21 | #include <linux/seq_file.h> | ||
20 | #include <linux/gpio.h> | 22 | #include <linux/gpio.h> |
21 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
22 | #include <linux/io.h> | 24 | #include <linux/io.h> |
@@ -58,8 +60,6 @@ static const int dbgmap_debug = dbg_err | dbg_debug; | |||
58 | dev_dbg(&host->pdev->dev, args); \ | 60 | dev_dbg(&host->pdev->dev, args); \ |
59 | } while (0) | 61 | } while (0) |
60 | 62 | ||
61 | #define RESSIZE(ressource) (((ressource)->end - (ressource)->start)+1) | ||
62 | |||
63 | static struct s3c2410_dma_client s3cmci_dma_client = { | 63 | static struct s3c2410_dma_client s3cmci_dma_client = { |
64 | .name = "s3c-mci", | 64 | .name = "s3c-mci", |
65 | }; | 65 | }; |
@@ -164,6 +164,40 @@ static void dbg_dumpregs(struct s3cmci_host *host, char *prefix) { } | |||
164 | 164 | ||
165 | #endif /* CONFIG_MMC_DEBUG */ | 165 | #endif /* CONFIG_MMC_DEBUG */ |
166 | 166 | ||
167 | /** | ||
168 | * s3cmci_host_usedma - return whether the host is using dma or pio | ||
169 | * @host: The host state | ||
170 | * | ||
171 | * Return true if the host is using DMA to transfer data, else false | ||
172 | * to use PIO mode. Will return static data depending on the driver | ||
173 | * configuration. | ||
174 | */ | ||
175 | static inline bool s3cmci_host_usedma(struct s3cmci_host *host) | ||
176 | { | ||
177 | #ifdef CONFIG_MMC_S3C_PIO | ||
178 | return false; | ||
179 | #elif defined(CONFIG_MMC_S3C_DMA) | ||
180 | return true; | ||
181 | #else | ||
182 | return host->dodma; | ||
183 | #endif | ||
184 | } | ||
185 | |||
186 | /** | ||
187 | * s3cmci_host_canpio - return true if host has pio code available | ||
188 | * | ||
189 | * Return true if the driver has been compiled with the PIO support code | ||
190 | * available. | ||
191 | */ | ||
192 | static inline bool s3cmci_host_canpio(void) | ||
193 | { | ||
194 | #ifdef CONFIG_MMC_S3C_PIO | ||
195 | return true; | ||
196 | #else | ||
197 | return false; | ||
198 | #endif | ||
199 | } | ||
200 | |||
167 | static inline u32 enable_imask(struct s3cmci_host *host, u32 imask) | 201 | static inline u32 enable_imask(struct s3cmci_host *host, u32 imask) |
168 | { | 202 | { |
169 | u32 newmask; | 203 | u32 newmask; |
@@ -190,7 +224,33 @@ static inline u32 disable_imask(struct s3cmci_host *host, u32 imask) | |||
190 | 224 | ||
191 | static inline void clear_imask(struct s3cmci_host *host) | 225 | static inline void clear_imask(struct s3cmci_host *host) |
192 | { | 226 | { |
193 | writel(0, host->base + host->sdiimsk); | 227 | u32 mask = readl(host->base + host->sdiimsk); |
228 | |||
229 | /* preserve the SDIO IRQ mask state */ | ||
230 | mask &= S3C2410_SDIIMSK_SDIOIRQ; | ||
231 | writel(mask, host->base + host->sdiimsk); | ||
232 | } | ||
233 | |||
234 | /** | ||
235 | * s3cmci_check_sdio_irq - test whether the SDIO IRQ is being signalled | ||
236 | * @host: The host to check. | ||
237 | * | ||
238 | * Test to see if the SDIO interrupt is being signalled in case the | ||
239 | * controller has failed to re-detect a card interrupt. Read GPE8 and | ||
240 | * see if it is low and if so, signal a SDIO interrupt. | ||
241 | * | ||
242 | * This is currently called if a request is finished (we assume that the | ||
243 | * bus is now idle) and when the SDIO IRQ is enabled in case the IRQ is | ||
244 | * already being indicated. | ||
245 | */ | ||
246 | static void s3cmci_check_sdio_irq(struct s3cmci_host *host) | ||
247 | { | ||
248 | if (host->sdio_irqen) { | ||
249 | if (gpio_get_value(S3C2410_GPE(8)) == 0) { | ||
250 | printk(KERN_DEBUG "%s: signalling irq\n", __func__); | ||
251 | mmc_signal_sdio_irq(host->mmc); | ||
252 | } | ||
253 | } | ||
194 | } | 254 | } |
195 | 255 | ||
196 | static inline int get_data_buffer(struct s3cmci_host *host, | 256 | static inline int get_data_buffer(struct s3cmci_host *host, |
@@ -238,6 +298,64 @@ static inline u32 fifo_free(struct s3cmci_host *host) | |||
238 | return 63 - fifostat; | 298 | return 63 - fifostat; |
239 | } | 299 | } |
240 | 300 | ||
301 | /** | ||
302 | * s3cmci_enable_irq - enable IRQ, after having disabled it. | ||
303 | * @host: The device state. | ||
304 | * @more: True if more IRQs are expected from transfer. | ||
305 | * | ||
306 | * Enable the main IRQ if needed after it has been disabled. | ||
307 | * | ||
308 | * The IRQ can be one of the following states: | ||
309 | * - disabled during IDLE | ||
310 | * - disabled whilst processing data | ||
311 | * - enabled during transfer | ||
312 | * - enabled whilst awaiting SDIO interrupt detection | ||
313 | */ | ||
314 | static void s3cmci_enable_irq(struct s3cmci_host *host, bool more) | ||
315 | { | ||
316 | unsigned long flags; | ||
317 | bool enable = false; | ||
318 | |||
319 | local_irq_save(flags); | ||
320 | |||
321 | host->irq_enabled = more; | ||
322 | host->irq_disabled = false; | ||
323 | |||
324 | enable = more | host->sdio_irqen; | ||
325 | |||
326 | if (host->irq_state != enable) { | ||
327 | host->irq_state = enable; | ||
328 | |||
329 | if (enable) | ||
330 | enable_irq(host->irq); | ||
331 | else | ||
332 | disable_irq(host->irq); | ||
333 | } | ||
334 | |||
335 | local_irq_restore(flags); | ||
336 | } | ||
337 | |||
338 | /** | ||
339 | * | ||
340 | */ | ||
341 | static void s3cmci_disable_irq(struct s3cmci_host *host, bool transfer) | ||
342 | { | ||
343 | unsigned long flags; | ||
344 | |||
345 | local_irq_save(flags); | ||
346 | |||
347 | //printk(KERN_DEBUG "%s: transfer %d\n", __func__, transfer); | ||
348 | |||
349 | host->irq_disabled = transfer; | ||
350 | |||
351 | if (transfer && host->irq_state) { | ||
352 | host->irq_state = false; | ||
353 | disable_irq(host->irq); | ||
354 | } | ||
355 | |||
356 | local_irq_restore(flags); | ||
357 | } | ||
358 | |||
241 | static void do_pio_read(struct s3cmci_host *host) | 359 | static void do_pio_read(struct s3cmci_host *host) |
242 | { | 360 | { |
243 | int res; | 361 | int res; |
@@ -374,8 +492,7 @@ static void pio_tasklet(unsigned long data) | |||
374 | { | 492 | { |
375 | struct s3cmci_host *host = (struct s3cmci_host *) data; | 493 | struct s3cmci_host *host = (struct s3cmci_host *) data; |
376 | 494 | ||
377 | 495 | s3cmci_disable_irq(host, true); | |
378 | disable_irq(host->irq); | ||
379 | 496 | ||
380 | if (host->pio_active == XFER_WRITE) | 497 | if (host->pio_active == XFER_WRITE) |
381 | do_pio_write(host); | 498 | do_pio_write(host); |
@@ -395,9 +512,10 @@ static void pio_tasklet(unsigned long data) | |||
395 | host->mrq->data->error = -EINVAL; | 512 | host->mrq->data->error = -EINVAL; |
396 | } | 513 | } |
397 | 514 | ||
515 | s3cmci_enable_irq(host, false); | ||
398 | finalize_request(host); | 516 | finalize_request(host); |
399 | } else | 517 | } else |
400 | enable_irq(host->irq); | 518 | s3cmci_enable_irq(host, true); |
401 | } | 519 | } |
402 | 520 | ||
403 | /* | 521 | /* |
@@ -432,17 +550,27 @@ static irqreturn_t s3cmci_irq(int irq, void *dev_id) | |||
432 | struct s3cmci_host *host = dev_id; | 550 | struct s3cmci_host *host = dev_id; |
433 | struct mmc_command *cmd; | 551 | struct mmc_command *cmd; |
434 | u32 mci_csta, mci_dsta, mci_fsta, mci_dcnt, mci_imsk; | 552 | u32 mci_csta, mci_dsta, mci_fsta, mci_dcnt, mci_imsk; |
435 | u32 mci_cclear, mci_dclear; | 553 | u32 mci_cclear = 0, mci_dclear; |
436 | unsigned long iflags; | 554 | unsigned long iflags; |
437 | 555 | ||
556 | mci_dsta = readl(host->base + S3C2410_SDIDSTA); | ||
557 | mci_imsk = readl(host->base + host->sdiimsk); | ||
558 | |||
559 | if (mci_dsta & S3C2410_SDIDSTA_SDIOIRQDETECT) { | ||
560 | if (mci_imsk & S3C2410_SDIIMSK_SDIOIRQ) { | ||
561 | mci_dclear = S3C2410_SDIDSTA_SDIOIRQDETECT; | ||
562 | writel(mci_dclear, host->base + S3C2410_SDIDSTA); | ||
563 | |||
564 | mmc_signal_sdio_irq(host->mmc); | ||
565 | return IRQ_HANDLED; | ||
566 | } | ||
567 | } | ||
568 | |||
438 | spin_lock_irqsave(&host->complete_lock, iflags); | 569 | spin_lock_irqsave(&host->complete_lock, iflags); |
439 | 570 | ||
440 | mci_csta = readl(host->base + S3C2410_SDICMDSTAT); | 571 | mci_csta = readl(host->base + S3C2410_SDICMDSTAT); |
441 | mci_dsta = readl(host->base + S3C2410_SDIDSTA); | ||
442 | mci_dcnt = readl(host->base + S3C2410_SDIDCNT); | 572 | mci_dcnt = readl(host->base + S3C2410_SDIDCNT); |
443 | mci_fsta = readl(host->base + S3C2410_SDIFSTA); | 573 | mci_fsta = readl(host->base + S3C2410_SDIFSTA); |
444 | mci_imsk = readl(host->base + host->sdiimsk); | ||
445 | mci_cclear = 0; | ||
446 | mci_dclear = 0; | 574 | mci_dclear = 0; |
447 | 575 | ||
448 | if ((host->complete_what == COMPLETION_NONE) || | 576 | if ((host->complete_what == COMPLETION_NONE) || |
@@ -466,7 +594,7 @@ static irqreturn_t s3cmci_irq(int irq, void *dev_id) | |||
466 | goto irq_out; | 594 | goto irq_out; |
467 | } | 595 | } |
468 | 596 | ||
469 | if (!host->dodma) { | 597 | if (!s3cmci_host_usedma(host)) { |
470 | if ((host->pio_active == XFER_WRITE) && | 598 | if ((host->pio_active == XFER_WRITE) && |
471 | (mci_fsta & S3C2410_SDIFSTA_TFDET)) { | 599 | (mci_fsta & S3C2410_SDIFSTA_TFDET)) { |
472 | 600 | ||
@@ -673,6 +801,7 @@ static void s3cmci_dma_done_callback(struct s3c2410_dma_chan *dma_ch, | |||
673 | dbg(host, dbg_dma, "DMA FINISHED Size:%i DSTA:%08x DCNT:%08x\n", | 801 | dbg(host, dbg_dma, "DMA FINISHED Size:%i DSTA:%08x DCNT:%08x\n", |
674 | size, mci_dsta, mci_dcnt); | 802 | size, mci_dsta, mci_dcnt); |
675 | 803 | ||
804 | host->dma_complete = 1; | ||
676 | host->complete_what = COMPLETION_FINALIZE; | 805 | host->complete_what = COMPLETION_FINALIZE; |
677 | 806 | ||
678 | out: | 807 | out: |
@@ -683,9 +812,9 @@ out: | |||
683 | fail_request: | 812 | fail_request: |
684 | host->mrq->data->error = -EINVAL; | 813 | host->mrq->data->error = -EINVAL; |
685 | host->complete_what = COMPLETION_FINALIZE; | 814 | host->complete_what = COMPLETION_FINALIZE; |
686 | writel(0, host->base + host->sdiimsk); | 815 | clear_imask(host); |
687 | goto out; | ||
688 | 816 | ||
817 | goto out; | ||
689 | } | 818 | } |
690 | 819 | ||
691 | static void finalize_request(struct s3cmci_host *host) | 820 | static void finalize_request(struct s3cmci_host *host) |
@@ -702,8 +831,9 @@ static void finalize_request(struct s3cmci_host *host) | |||
702 | 831 | ||
703 | if (cmd->data && (cmd->error == 0) && | 832 | if (cmd->data && (cmd->error == 0) && |
704 | (cmd->data->error == 0)) { | 833 | (cmd->data->error == 0)) { |
705 | if (host->dodma && (!host->dma_complete)) { | 834 | if (s3cmci_host_usedma(host) && (!host->dma_complete)) { |
706 | dbg(host, dbg_dma, "DMA Missing!\n"); | 835 | dbg(host, dbg_dma, "DMA Missing (%d)!\n", |
836 | host->dma_complete); | ||
707 | return; | 837 | return; |
708 | } | 838 | } |
709 | } | 839 | } |
@@ -728,7 +858,7 @@ static void finalize_request(struct s3cmci_host *host) | |||
728 | writel(0, host->base + S3C2410_SDICMDARG); | 858 | writel(0, host->base + S3C2410_SDICMDARG); |
729 | writel(S3C2410_SDIDCON_STOP, host->base + S3C2410_SDIDCON); | 859 | writel(S3C2410_SDIDCON_STOP, host->base + S3C2410_SDIDCON); |
730 | writel(0, host->base + S3C2410_SDICMDCON); | 860 | writel(0, host->base + S3C2410_SDICMDCON); |
731 | writel(0, host->base + host->sdiimsk); | 861 | clear_imask(host); |
732 | 862 | ||
733 | if (cmd->data && cmd->error) | 863 | if (cmd->data && cmd->error) |
734 | cmd->data->error = cmd->error; | 864 | cmd->data->error = cmd->error; |
@@ -754,7 +884,7 @@ static void finalize_request(struct s3cmci_host *host) | |||
754 | /* If we had an error while transfering data we flush the | 884 | /* If we had an error while transfering data we flush the |
755 | * DMA channel and the fifo to clear out any garbage. */ | 885 | * DMA channel and the fifo to clear out any garbage. */ |
756 | if (mrq->data->error != 0) { | 886 | if (mrq->data->error != 0) { |
757 | if (host->dodma) | 887 | if (s3cmci_host_usedma(host)) |
758 | s3c2410_dma_ctrl(host->dma, S3C2410_DMAOP_FLUSH); | 888 | s3c2410_dma_ctrl(host->dma, S3C2410_DMAOP_FLUSH); |
759 | 889 | ||
760 | if (host->is2440) { | 890 | if (host->is2440) { |
@@ -776,6 +906,8 @@ static void finalize_request(struct s3cmci_host *host) | |||
776 | request_done: | 906 | request_done: |
777 | host->complete_what = COMPLETION_NONE; | 907 | host->complete_what = COMPLETION_NONE; |
778 | host->mrq = NULL; | 908 | host->mrq = NULL; |
909 | |||
910 | s3cmci_check_sdio_irq(host); | ||
779 | mmc_request_done(host->mmc, mrq); | 911 | mmc_request_done(host->mmc, mrq); |
780 | } | 912 | } |
781 | 913 | ||
@@ -872,7 +1004,7 @@ static int s3cmci_setup_data(struct s3cmci_host *host, struct mmc_data *data) | |||
872 | 1004 | ||
873 | dcon = data->blocks & S3C2410_SDIDCON_BLKNUM_MASK; | 1005 | dcon = data->blocks & S3C2410_SDIDCON_BLKNUM_MASK; |
874 | 1006 | ||
875 | if (host->dodma) | 1007 | if (s3cmci_host_usedma(host)) |
876 | dcon |= S3C2410_SDIDCON_DMAEN; | 1008 | dcon |= S3C2410_SDIDCON_DMAEN; |
877 | 1009 | ||
878 | if (host->bus_width == MMC_BUS_WIDTH_4) | 1010 | if (host->bus_width == MMC_BUS_WIDTH_4) |
@@ -950,7 +1082,7 @@ static int s3cmci_prepare_pio(struct s3cmci_host *host, struct mmc_data *data) | |||
950 | static int s3cmci_prepare_dma(struct s3cmci_host *host, struct mmc_data *data) | 1082 | static int s3cmci_prepare_dma(struct s3cmci_host *host, struct mmc_data *data) |
951 | { | 1083 | { |
952 | int dma_len, i; | 1084 | int dma_len, i; |
953 | int rw = (data->flags & MMC_DATA_WRITE) ? 1 : 0; | 1085 | int rw = data->flags & MMC_DATA_WRITE; |
954 | 1086 | ||
955 | BUG_ON((data->flags & BOTH_DIR) == BOTH_DIR); | 1087 | BUG_ON((data->flags & BOTH_DIR) == BOTH_DIR); |
956 | 1088 | ||
@@ -958,7 +1090,7 @@ static int s3cmci_prepare_dma(struct s3cmci_host *host, struct mmc_data *data) | |||
958 | s3c2410_dma_ctrl(host->dma, S3C2410_DMAOP_FLUSH); | 1090 | s3c2410_dma_ctrl(host->dma, S3C2410_DMAOP_FLUSH); |
959 | 1091 | ||
960 | dma_len = dma_map_sg(mmc_dev(host->mmc), data->sg, data->sg_len, | 1092 | dma_len = dma_map_sg(mmc_dev(host->mmc), data->sg, data->sg_len, |
961 | (rw) ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | 1093 | rw ? DMA_TO_DEVICE : DMA_FROM_DEVICE); |
962 | 1094 | ||
963 | if (dma_len == 0) | 1095 | if (dma_len == 0) |
964 | return -ENOMEM; | 1096 | return -ENOMEM; |
@@ -969,11 +1101,11 @@ static int s3cmci_prepare_dma(struct s3cmci_host *host, struct mmc_data *data) | |||
969 | for (i = 0; i < dma_len; i++) { | 1101 | for (i = 0; i < dma_len; i++) { |
970 | int res; | 1102 | int res; |
971 | 1103 | ||
972 | dbg(host, dbg_dma, "enqueue %i:%u@%u\n", i, | 1104 | dbg(host, dbg_dma, "enqueue %i: %08x@%u\n", i, |
973 | sg_dma_address(&data->sg[i]), | 1105 | sg_dma_address(&data->sg[i]), |
974 | sg_dma_len(&data->sg[i])); | 1106 | sg_dma_len(&data->sg[i])); |
975 | 1107 | ||
976 | res = s3c2410_dma_enqueue(host->dma, (void *) host, | 1108 | res = s3c2410_dma_enqueue(host->dma, host, |
977 | sg_dma_address(&data->sg[i]), | 1109 | sg_dma_address(&data->sg[i]), |
978 | sg_dma_len(&data->sg[i])); | 1110 | sg_dma_len(&data->sg[i])); |
979 | 1111 | ||
@@ -1018,7 +1150,7 @@ static void s3cmci_send_request(struct mmc_host *mmc) | |||
1018 | return; | 1150 | return; |
1019 | } | 1151 | } |
1020 | 1152 | ||
1021 | if (host->dodma) | 1153 | if (s3cmci_host_usedma(host)) |
1022 | res = s3cmci_prepare_dma(host, cmd->data); | 1154 | res = s3cmci_prepare_dma(host, cmd->data); |
1023 | else | 1155 | else |
1024 | res = s3cmci_prepare_pio(host, cmd->data); | 1156 | res = s3cmci_prepare_pio(host, cmd->data); |
@@ -1037,7 +1169,7 @@ static void s3cmci_send_request(struct mmc_host *mmc) | |||
1037 | s3cmci_send_command(host, cmd); | 1169 | s3cmci_send_command(host, cmd); |
1038 | 1170 | ||
1039 | /* Enable Interrupt */ | 1171 | /* Enable Interrupt */ |
1040 | enable_irq(host->irq); | 1172 | s3cmci_enable_irq(host, true); |
1041 | } | 1173 | } |
1042 | 1174 | ||
1043 | static int s3cmci_card_present(struct mmc_host *mmc) | 1175 | static int s3cmci_card_present(struct mmc_host *mmc) |
@@ -1049,7 +1181,7 @@ static int s3cmci_card_present(struct mmc_host *mmc) | |||
1049 | if (pdata->gpio_detect == 0) | 1181 | if (pdata->gpio_detect == 0) |
1050 | return -ENOSYS; | 1182 | return -ENOSYS; |
1051 | 1183 | ||
1052 | ret = s3c2410_gpio_getpin(pdata->gpio_detect) ? 0 : 1; | 1184 | ret = gpio_get_value(pdata->gpio_detect) ? 0 : 1; |
1053 | return ret ^ pdata->detect_invert; | 1185 | return ret ^ pdata->detect_invert; |
1054 | } | 1186 | } |
1055 | 1187 | ||
@@ -1104,12 +1236,12 @@ static void s3cmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1104 | switch (ios->power_mode) { | 1236 | switch (ios->power_mode) { |
1105 | case MMC_POWER_ON: | 1237 | case MMC_POWER_ON: |
1106 | case MMC_POWER_UP: | 1238 | case MMC_POWER_UP: |
1107 | s3c2410_gpio_cfgpin(S3C2410_GPE5, S3C2410_GPE5_SDCLK); | 1239 | s3c2410_gpio_cfgpin(S3C2410_GPE(5), S3C2410_GPE5_SDCLK); |
1108 | s3c2410_gpio_cfgpin(S3C2410_GPE6, S3C2410_GPE6_SDCMD); | 1240 | s3c2410_gpio_cfgpin(S3C2410_GPE(6), S3C2410_GPE6_SDCMD); |
1109 | s3c2410_gpio_cfgpin(S3C2410_GPE7, S3C2410_GPE7_SDDAT0); | 1241 | s3c2410_gpio_cfgpin(S3C2410_GPE(7), S3C2410_GPE7_SDDAT0); |
1110 | s3c2410_gpio_cfgpin(S3C2410_GPE8, S3C2410_GPE8_SDDAT1); | 1242 | s3c2410_gpio_cfgpin(S3C2410_GPE(8), S3C2410_GPE8_SDDAT1); |
1111 | s3c2410_gpio_cfgpin(S3C2410_GPE9, S3C2410_GPE9_SDDAT2); | 1243 | s3c2410_gpio_cfgpin(S3C2410_GPE(9), S3C2410_GPE9_SDDAT2); |
1112 | s3c2410_gpio_cfgpin(S3C2410_GPE10, S3C2410_GPE10_SDDAT3); | 1244 | s3c2410_gpio_cfgpin(S3C2410_GPE(10), S3C2410_GPE10_SDDAT3); |
1113 | 1245 | ||
1114 | if (host->pdata->set_power) | 1246 | if (host->pdata->set_power) |
1115 | host->pdata->set_power(ios->power_mode, ios->vdd); | 1247 | host->pdata->set_power(ios->power_mode, ios->vdd); |
@@ -1121,8 +1253,7 @@ static void s3cmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1121 | 1253 | ||
1122 | case MMC_POWER_OFF: | 1254 | case MMC_POWER_OFF: |
1123 | default: | 1255 | default: |
1124 | s3c2410_gpio_setpin(S3C2410_GPE5, 0); | 1256 | gpio_direction_output(S3C2410_GPE(5), 0); |
1125 | s3c2410_gpio_cfgpin(S3C2410_GPE5, S3C2410_GPIO_OUTPUT); | ||
1126 | 1257 | ||
1127 | if (host->is2440) | 1258 | if (host->is2440) |
1128 | mci_con |= S3C2440_SDICON_SDRESET; | 1259 | mci_con |= S3C2440_SDICON_SDRESET; |
@@ -1168,7 +1299,7 @@ static int s3cmci_get_ro(struct mmc_host *mmc) | |||
1168 | struct s3c24xx_mci_pdata *pdata = host->pdata; | 1299 | struct s3c24xx_mci_pdata *pdata = host->pdata; |
1169 | int ret; | 1300 | int ret; |
1170 | 1301 | ||
1171 | if (pdata->gpio_wprotect == 0) | 1302 | if (pdata->no_wprotect) |
1172 | return 0; | 1303 | return 0; |
1173 | 1304 | ||
1174 | ret = s3c2410_gpio_getpin(pdata->gpio_wprotect); | 1305 | ret = s3c2410_gpio_getpin(pdata->gpio_wprotect); |
@@ -1179,11 +1310,52 @@ static int s3cmci_get_ro(struct mmc_host *mmc) | |||
1179 | return ret; | 1310 | return ret; |
1180 | } | 1311 | } |
1181 | 1312 | ||
1313 | static void s3cmci_enable_sdio_irq(struct mmc_host *mmc, int enable) | ||
1314 | { | ||
1315 | struct s3cmci_host *host = mmc_priv(mmc); | ||
1316 | unsigned long flags; | ||
1317 | u32 con; | ||
1318 | |||
1319 | local_irq_save(flags); | ||
1320 | |||
1321 | con = readl(host->base + S3C2410_SDICON); | ||
1322 | host->sdio_irqen = enable; | ||
1323 | |||
1324 | if (enable == host->sdio_irqen) | ||
1325 | goto same_state; | ||
1326 | |||
1327 | if (enable) { | ||
1328 | con |= S3C2410_SDICON_SDIOIRQ; | ||
1329 | enable_imask(host, S3C2410_SDIIMSK_SDIOIRQ); | ||
1330 | |||
1331 | if (!host->irq_state && !host->irq_disabled) { | ||
1332 | host->irq_state = true; | ||
1333 | enable_irq(host->irq); | ||
1334 | } | ||
1335 | } else { | ||
1336 | disable_imask(host, S3C2410_SDIIMSK_SDIOIRQ); | ||
1337 | con &= ~S3C2410_SDICON_SDIOIRQ; | ||
1338 | |||
1339 | if (!host->irq_enabled && host->irq_state) { | ||
1340 | disable_irq_nosync(host->irq); | ||
1341 | host->irq_state = false; | ||
1342 | } | ||
1343 | } | ||
1344 | |||
1345 | writel(con, host->base + S3C2410_SDICON); | ||
1346 | |||
1347 | same_state: | ||
1348 | local_irq_restore(flags); | ||
1349 | |||
1350 | s3cmci_check_sdio_irq(host); | ||
1351 | } | ||
1352 | |||
1182 | static struct mmc_host_ops s3cmci_ops = { | 1353 | static struct mmc_host_ops s3cmci_ops = { |
1183 | .request = s3cmci_request, | 1354 | .request = s3cmci_request, |
1184 | .set_ios = s3cmci_set_ios, | 1355 | .set_ios = s3cmci_set_ios, |
1185 | .get_ro = s3cmci_get_ro, | 1356 | .get_ro = s3cmci_get_ro, |
1186 | .get_cd = s3cmci_card_present, | 1357 | .get_cd = s3cmci_card_present, |
1358 | .enable_sdio_irq = s3cmci_enable_sdio_irq, | ||
1187 | }; | 1359 | }; |
1188 | 1360 | ||
1189 | static struct s3c24xx_mci_pdata s3cmci_def_pdata = { | 1361 | static struct s3c24xx_mci_pdata s3cmci_def_pdata = { |
@@ -1246,11 +1418,140 @@ static inline void s3cmci_cpufreq_deregister(struct s3cmci_host *host) | |||
1246 | } | 1418 | } |
1247 | #endif | 1419 | #endif |
1248 | 1420 | ||
1249 | static int __devinit s3cmci_probe(struct platform_device *pdev, int is2440) | 1421 | |
1422 | #ifdef CONFIG_DEBUG_FS | ||
1423 | |||
1424 | static int s3cmci_state_show(struct seq_file *seq, void *v) | ||
1425 | { | ||
1426 | struct s3cmci_host *host = seq->private; | ||
1427 | |||
1428 | seq_printf(seq, "Register base = 0x%08x\n", (u32)host->base); | ||
1429 | seq_printf(seq, "Clock rate = %ld\n", host->clk_rate); | ||
1430 | seq_printf(seq, "Prescale = %d\n", host->prescaler); | ||
1431 | seq_printf(seq, "is2440 = %d\n", host->is2440); | ||
1432 | seq_printf(seq, "IRQ = %d\n", host->irq); | ||
1433 | seq_printf(seq, "IRQ enabled = %d\n", host->irq_enabled); | ||
1434 | seq_printf(seq, "IRQ disabled = %d\n", host->irq_disabled); | ||
1435 | seq_printf(seq, "IRQ state = %d\n", host->irq_state); | ||
1436 | seq_printf(seq, "CD IRQ = %d\n", host->irq_cd); | ||
1437 | seq_printf(seq, "Do DMA = %d\n", s3cmci_host_usedma(host)); | ||
1438 | seq_printf(seq, "SDIIMSK at %d\n", host->sdiimsk); | ||
1439 | seq_printf(seq, "SDIDATA at %d\n", host->sdidata); | ||
1440 | |||
1441 | return 0; | ||
1442 | } | ||
1443 | |||
1444 | static int s3cmci_state_open(struct inode *inode, struct file *file) | ||
1445 | { | ||
1446 | return single_open(file, s3cmci_state_show, inode->i_private); | ||
1447 | } | ||
1448 | |||
1449 | static const struct file_operations s3cmci_fops_state = { | ||
1450 | .owner = THIS_MODULE, | ||
1451 | .open = s3cmci_state_open, | ||
1452 | .read = seq_read, | ||
1453 | .llseek = seq_lseek, | ||
1454 | .release = single_release, | ||
1455 | }; | ||
1456 | |||
1457 | #define DBG_REG(_r) { .addr = S3C2410_SDI##_r, .name = #_r } | ||
1458 | |||
1459 | struct s3cmci_reg { | ||
1460 | unsigned short addr; | ||
1461 | unsigned char *name; | ||
1462 | } debug_regs[] = { | ||
1463 | DBG_REG(CON), | ||
1464 | DBG_REG(PRE), | ||
1465 | DBG_REG(CMDARG), | ||
1466 | DBG_REG(CMDCON), | ||
1467 | DBG_REG(CMDSTAT), | ||
1468 | DBG_REG(RSP0), | ||
1469 | DBG_REG(RSP1), | ||
1470 | DBG_REG(RSP2), | ||
1471 | DBG_REG(RSP3), | ||
1472 | DBG_REG(TIMER), | ||
1473 | DBG_REG(BSIZE), | ||
1474 | DBG_REG(DCON), | ||
1475 | DBG_REG(DCNT), | ||
1476 | DBG_REG(DSTA), | ||
1477 | DBG_REG(FSTA), | ||
1478 | {} | ||
1479 | }; | ||
1480 | |||
1481 | static int s3cmci_regs_show(struct seq_file *seq, void *v) | ||
1482 | { | ||
1483 | struct s3cmci_host *host = seq->private; | ||
1484 | struct s3cmci_reg *rptr = debug_regs; | ||
1485 | |||
1486 | for (; rptr->name; rptr++) | ||
1487 | seq_printf(seq, "SDI%s\t=0x%08x\n", rptr->name, | ||
1488 | readl(host->base + rptr->addr)); | ||
1489 | |||
1490 | seq_printf(seq, "SDIIMSK\t=0x%08x\n", readl(host->base + host->sdiimsk)); | ||
1491 | |||
1492 | return 0; | ||
1493 | } | ||
1494 | |||
1495 | static int s3cmci_regs_open(struct inode *inode, struct file *file) | ||
1496 | { | ||
1497 | return single_open(file, s3cmci_regs_show, inode->i_private); | ||
1498 | } | ||
1499 | |||
1500 | static const struct file_operations s3cmci_fops_regs = { | ||
1501 | .owner = THIS_MODULE, | ||
1502 | .open = s3cmci_regs_open, | ||
1503 | .read = seq_read, | ||
1504 | .llseek = seq_lseek, | ||
1505 | .release = single_release, | ||
1506 | }; | ||
1507 | |||
1508 | static void s3cmci_debugfs_attach(struct s3cmci_host *host) | ||
1509 | { | ||
1510 | struct device *dev = &host->pdev->dev; | ||
1511 | |||
1512 | host->debug_root = debugfs_create_dir(dev_name(dev), NULL); | ||
1513 | if (IS_ERR(host->debug_root)) { | ||
1514 | dev_err(dev, "failed to create debugfs root\n"); | ||
1515 | return; | ||
1516 | } | ||
1517 | |||
1518 | host->debug_state = debugfs_create_file("state", 0444, | ||
1519 | host->debug_root, host, | ||
1520 | &s3cmci_fops_state); | ||
1521 | |||
1522 | if (IS_ERR(host->debug_state)) | ||
1523 | dev_err(dev, "failed to create debug state file\n"); | ||
1524 | |||
1525 | host->debug_regs = debugfs_create_file("regs", 0444, | ||
1526 | host->debug_root, host, | ||
1527 | &s3cmci_fops_regs); | ||
1528 | |||
1529 | if (IS_ERR(host->debug_regs)) | ||
1530 | dev_err(dev, "failed to create debug regs file\n"); | ||
1531 | } | ||
1532 | |||
1533 | static void s3cmci_debugfs_remove(struct s3cmci_host *host) | ||
1534 | { | ||
1535 | debugfs_remove(host->debug_regs); | ||
1536 | debugfs_remove(host->debug_state); | ||
1537 | debugfs_remove(host->debug_root); | ||
1538 | } | ||
1539 | |||
1540 | #else | ||
1541 | static inline void s3cmci_debugfs_attach(struct s3cmci_host *host) { } | ||
1542 | static inline void s3cmci_debugfs_remove(struct s3cmci_host *host) { } | ||
1543 | |||
1544 | #endif /* CONFIG_DEBUG_FS */ | ||
1545 | |||
1546 | static int __devinit s3cmci_probe(struct platform_device *pdev) | ||
1250 | { | 1547 | { |
1251 | struct s3cmci_host *host; | 1548 | struct s3cmci_host *host; |
1252 | struct mmc_host *mmc; | 1549 | struct mmc_host *mmc; |
1253 | int ret; | 1550 | int ret; |
1551 | int is2440; | ||
1552 | int i; | ||
1553 | |||
1554 | is2440 = platform_get_device_id(pdev)->driver_data; | ||
1254 | 1555 | ||
1255 | mmc = mmc_alloc_host(sizeof(struct s3cmci_host), &pdev->dev); | 1556 | mmc = mmc_alloc_host(sizeof(struct s3cmci_host), &pdev->dev); |
1256 | if (!mmc) { | 1557 | if (!mmc) { |
@@ -1258,6 +1559,18 @@ static int __devinit s3cmci_probe(struct platform_device *pdev, int is2440) | |||
1258 | goto probe_out; | 1559 | goto probe_out; |
1259 | } | 1560 | } |
1260 | 1561 | ||
1562 | for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++) { | ||
1563 | ret = gpio_request(i, dev_name(&pdev->dev)); | ||
1564 | if (ret) { | ||
1565 | dev_err(&pdev->dev, "failed to get gpio %d\n", i); | ||
1566 | |||
1567 | for (i--; i >= S3C2410_GPE(5); i--) | ||
1568 | gpio_free(i); | ||
1569 | |||
1570 | goto probe_free_host; | ||
1571 | } | ||
1572 | } | ||
1573 | |||
1261 | host = mmc_priv(mmc); | 1574 | host = mmc_priv(mmc); |
1262 | host->mmc = mmc; | 1575 | host->mmc = mmc; |
1263 | host->pdev = pdev; | 1576 | host->pdev = pdev; |
@@ -1282,11 +1595,12 @@ static int __devinit s3cmci_probe(struct platform_device *pdev, int is2440) | |||
1282 | host->clk_div = 2; | 1595 | host->clk_div = 2; |
1283 | } | 1596 | } |
1284 | 1597 | ||
1285 | host->dodma = 0; | ||
1286 | host->complete_what = COMPLETION_NONE; | 1598 | host->complete_what = COMPLETION_NONE; |
1287 | host->pio_active = XFER_NONE; | 1599 | host->pio_active = XFER_NONE; |
1288 | 1600 | ||
1289 | host->dma = S3CMCI_DMA; | 1601 | #ifdef CONFIG_MMC_S3C_PIODMA |
1602 | host->dodma = host->pdata->dma; | ||
1603 | #endif | ||
1290 | 1604 | ||
1291 | host->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1605 | host->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1292 | if (!host->mem) { | 1606 | if (!host->mem) { |
@@ -1294,19 +1608,19 @@ static int __devinit s3cmci_probe(struct platform_device *pdev, int is2440) | |||
1294 | "failed to get io memory region resouce.\n"); | 1608 | "failed to get io memory region resouce.\n"); |
1295 | 1609 | ||
1296 | ret = -ENOENT; | 1610 | ret = -ENOENT; |
1297 | goto probe_free_host; | 1611 | goto probe_free_gpio; |
1298 | } | 1612 | } |
1299 | 1613 | ||
1300 | host->mem = request_mem_region(host->mem->start, | 1614 | host->mem = request_mem_region(host->mem->start, |
1301 | RESSIZE(host->mem), pdev->name); | 1615 | resource_size(host->mem), pdev->name); |
1302 | 1616 | ||
1303 | if (!host->mem) { | 1617 | if (!host->mem) { |
1304 | dev_err(&pdev->dev, "failed to request io memory region.\n"); | 1618 | dev_err(&pdev->dev, "failed to request io memory region.\n"); |
1305 | ret = -ENOENT; | 1619 | ret = -ENOENT; |
1306 | goto probe_free_host; | 1620 | goto probe_free_gpio; |
1307 | } | 1621 | } |
1308 | 1622 | ||
1309 | host->base = ioremap(host->mem->start, RESSIZE(host->mem)); | 1623 | host->base = ioremap(host->mem->start, resource_size(host->mem)); |
1310 | if (!host->base) { | 1624 | if (!host->base) { |
1311 | dev_err(&pdev->dev, "failed to ioremap() io memory region.\n"); | 1625 | dev_err(&pdev->dev, "failed to ioremap() io memory region.\n"); |
1312 | ret = -EINVAL; | 1626 | ret = -EINVAL; |
@@ -1331,31 +1645,60 @@ static int __devinit s3cmci_probe(struct platform_device *pdev, int is2440) | |||
1331 | * ensure we don't lock the system with un-serviceable requests. */ | 1645 | * ensure we don't lock the system with un-serviceable requests. */ |
1332 | 1646 | ||
1333 | disable_irq(host->irq); | 1647 | disable_irq(host->irq); |
1648 | host->irq_state = false; | ||
1334 | 1649 | ||
1335 | host->irq_cd = s3c2410_gpio_getirq(host->pdata->gpio_detect); | 1650 | if (!host->pdata->no_detect) { |
1336 | 1651 | ret = gpio_request(host->pdata->gpio_detect, "s3cmci detect"); | |
1337 | if (host->irq_cd >= 0) { | 1652 | if (ret) { |
1338 | if (request_irq(host->irq_cd, s3cmci_irq_cd, | 1653 | dev_err(&pdev->dev, "failed to get detect gpio\n"); |
1339 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
1340 | DRIVER_NAME, host)) { | ||
1341 | dev_err(&pdev->dev, "can't get card detect irq.\n"); | ||
1342 | ret = -ENOENT; | ||
1343 | goto probe_free_irq; | 1654 | goto probe_free_irq; |
1344 | } | 1655 | } |
1345 | } else { | 1656 | |
1346 | dev_warn(&pdev->dev, "host detect has no irq available\n"); | 1657 | host->irq_cd = s3c2410_gpio_getirq(host->pdata->gpio_detect); |
1347 | s3c2410_gpio_cfgpin(host->pdata->gpio_detect, | 1658 | |
1348 | S3C2410_GPIO_INPUT); | 1659 | if (host->irq_cd >= 0) { |
1660 | if (request_irq(host->irq_cd, s3cmci_irq_cd, | ||
1661 | IRQF_TRIGGER_RISING | | ||
1662 | IRQF_TRIGGER_FALLING, | ||
1663 | DRIVER_NAME, host)) { | ||
1664 | dev_err(&pdev->dev, | ||
1665 | "can't get card detect irq.\n"); | ||
1666 | ret = -ENOENT; | ||
1667 | goto probe_free_gpio_cd; | ||
1668 | } | ||
1669 | } else { | ||
1670 | dev_warn(&pdev->dev, | ||
1671 | "host detect has no irq available\n"); | ||
1672 | gpio_direction_input(host->pdata->gpio_detect); | ||
1673 | } | ||
1674 | } else | ||
1675 | host->irq_cd = -1; | ||
1676 | |||
1677 | if (!host->pdata->no_wprotect) { | ||
1678 | ret = gpio_request(host->pdata->gpio_wprotect, "s3cmci wp"); | ||
1679 | if (ret) { | ||
1680 | dev_err(&pdev->dev, "failed to get writeprotect\n"); | ||
1681 | goto probe_free_irq_cd; | ||
1682 | } | ||
1683 | |||
1684 | gpio_direction_input(host->pdata->gpio_wprotect); | ||
1349 | } | 1685 | } |
1350 | 1686 | ||
1351 | if (host->pdata->gpio_wprotect) | 1687 | /* depending on the dma state, get a dma channel to use. */ |
1352 | s3c2410_gpio_cfgpin(host->pdata->gpio_wprotect, | ||
1353 | S3C2410_GPIO_INPUT); | ||
1354 | 1688 | ||
1355 | if (s3c2410_dma_request(S3CMCI_DMA, &s3cmci_dma_client, NULL) < 0) { | 1689 | if (s3cmci_host_usedma(host)) { |
1356 | dev_err(&pdev->dev, "unable to get DMA channel.\n"); | 1690 | host->dma = s3c2410_dma_request(DMACH_SDI, &s3cmci_dma_client, |
1357 | ret = -EBUSY; | 1691 | host); |
1358 | goto probe_free_irq_cd; | 1692 | if (host->dma < 0) { |
1693 | dev_err(&pdev->dev, "cannot get DMA channel.\n"); | ||
1694 | if (!s3cmci_host_canpio()) { | ||
1695 | ret = -EBUSY; | ||
1696 | goto probe_free_gpio_wp; | ||
1697 | } else { | ||
1698 | dev_warn(&pdev->dev, "falling back to PIO.\n"); | ||
1699 | host->dodma = 0; | ||
1700 | } | ||
1701 | } | ||
1359 | } | 1702 | } |
1360 | 1703 | ||
1361 | host->clk = clk_get(&pdev->dev, "sdi"); | 1704 | host->clk = clk_get(&pdev->dev, "sdi"); |
@@ -1363,7 +1706,7 @@ static int __devinit s3cmci_probe(struct platform_device *pdev, int is2440) | |||
1363 | dev_err(&pdev->dev, "failed to find clock source.\n"); | 1706 | dev_err(&pdev->dev, "failed to find clock source.\n"); |
1364 | ret = PTR_ERR(host->clk); | 1707 | ret = PTR_ERR(host->clk); |
1365 | host->clk = NULL; | 1708 | host->clk = NULL; |
1366 | goto probe_free_host; | 1709 | goto probe_free_dma; |
1367 | } | 1710 | } |
1368 | 1711 | ||
1369 | ret = clk_enable(host->clk); | 1712 | ret = clk_enable(host->clk); |
@@ -1376,7 +1719,11 @@ static int __devinit s3cmci_probe(struct platform_device *pdev, int is2440) | |||
1376 | 1719 | ||
1377 | mmc->ops = &s3cmci_ops; | 1720 | mmc->ops = &s3cmci_ops; |
1378 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; | 1721 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; |
1722 | #ifdef CONFIG_MMC_S3C_HW_SDIO_IRQ | ||
1723 | mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ; | ||
1724 | #else | ||
1379 | mmc->caps = MMC_CAP_4_BIT_DATA; | 1725 | mmc->caps = MMC_CAP_4_BIT_DATA; |
1726 | #endif | ||
1380 | mmc->f_min = host->clk_rate / (host->clk_div * 256); | 1727 | mmc->f_min = host->clk_rate / (host->clk_div * 256); |
1381 | mmc->f_max = host->clk_rate / host->clk_div; | 1728 | mmc->f_max = host->clk_rate / host->clk_div; |
1382 | 1729 | ||
@@ -1408,8 +1755,12 @@ static int __devinit s3cmci_probe(struct platform_device *pdev, int is2440) | |||
1408 | goto free_cpufreq; | 1755 | goto free_cpufreq; |
1409 | } | 1756 | } |
1410 | 1757 | ||
1758 | s3cmci_debugfs_attach(host); | ||
1759 | |||
1411 | platform_set_drvdata(pdev, mmc); | 1760 | platform_set_drvdata(pdev, mmc); |
1412 | dev_info(&pdev->dev, "initialisation done.\n"); | 1761 | dev_info(&pdev->dev, "%s - using %s, %s SDIO IRQ\n", mmc_hostname(mmc), |
1762 | s3cmci_host_usedma(host) ? "dma" : "pio", | ||
1763 | mmc->caps & MMC_CAP_SDIO_IRQ ? "hw" : "sw"); | ||
1413 | 1764 | ||
1414 | return 0; | 1765 | return 0; |
1415 | 1766 | ||
@@ -1422,6 +1773,18 @@ static int __devinit s3cmci_probe(struct platform_device *pdev, int is2440) | |||
1422 | clk_free: | 1773 | clk_free: |
1423 | clk_put(host->clk); | 1774 | clk_put(host->clk); |
1424 | 1775 | ||
1776 | probe_free_dma: | ||
1777 | if (s3cmci_host_usedma(host)) | ||
1778 | s3c2410_dma_free(host->dma, &s3cmci_dma_client); | ||
1779 | |||
1780 | probe_free_gpio_wp: | ||
1781 | if (!host->pdata->no_wprotect) | ||
1782 | gpio_free(host->pdata->gpio_wprotect); | ||
1783 | |||
1784 | probe_free_gpio_cd: | ||
1785 | if (!host->pdata->no_detect) | ||
1786 | gpio_free(host->pdata->gpio_detect); | ||
1787 | |||
1425 | probe_free_irq_cd: | 1788 | probe_free_irq_cd: |
1426 | if (host->irq_cd >= 0) | 1789 | if (host->irq_cd >= 0) |
1427 | free_irq(host->irq_cd, host); | 1790 | free_irq(host->irq_cd, host); |
@@ -1433,10 +1796,15 @@ static int __devinit s3cmci_probe(struct platform_device *pdev, int is2440) | |||
1433 | iounmap(host->base); | 1796 | iounmap(host->base); |
1434 | 1797 | ||
1435 | probe_free_mem_region: | 1798 | probe_free_mem_region: |
1436 | release_mem_region(host->mem->start, RESSIZE(host->mem)); | 1799 | release_mem_region(host->mem->start, resource_size(host->mem)); |
1800 | |||
1801 | probe_free_gpio: | ||
1802 | for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++) | ||
1803 | gpio_free(i); | ||
1437 | 1804 | ||
1438 | probe_free_host: | 1805 | probe_free_host: |
1439 | mmc_free_host(mmc); | 1806 | mmc_free_host(mmc); |
1807 | |||
1440 | probe_out: | 1808 | probe_out: |
1441 | return ret; | 1809 | return ret; |
1442 | } | 1810 | } |
@@ -1449,6 +1817,7 @@ static void s3cmci_shutdown(struct platform_device *pdev) | |||
1449 | if (host->irq_cd >= 0) | 1817 | if (host->irq_cd >= 0) |
1450 | free_irq(host->irq_cd, host); | 1818 | free_irq(host->irq_cd, host); |
1451 | 1819 | ||
1820 | s3cmci_debugfs_remove(host); | ||
1452 | s3cmci_cpufreq_deregister(host); | 1821 | s3cmci_cpufreq_deregister(host); |
1453 | mmc_remove_host(mmc); | 1822 | mmc_remove_host(mmc); |
1454 | clk_disable(host->clk); | 1823 | clk_disable(host->clk); |
@@ -1458,104 +1827,102 @@ static int __devexit s3cmci_remove(struct platform_device *pdev) | |||
1458 | { | 1827 | { |
1459 | struct mmc_host *mmc = platform_get_drvdata(pdev); | 1828 | struct mmc_host *mmc = platform_get_drvdata(pdev); |
1460 | struct s3cmci_host *host = mmc_priv(mmc); | 1829 | struct s3cmci_host *host = mmc_priv(mmc); |
1830 | struct s3c24xx_mci_pdata *pd = host->pdata; | ||
1831 | int i; | ||
1461 | 1832 | ||
1462 | s3cmci_shutdown(pdev); | 1833 | s3cmci_shutdown(pdev); |
1463 | 1834 | ||
1464 | clk_put(host->clk); | 1835 | clk_put(host->clk); |
1465 | 1836 | ||
1466 | tasklet_disable(&host->pio_tasklet); | 1837 | tasklet_disable(&host->pio_tasklet); |
1467 | s3c2410_dma_free(S3CMCI_DMA, &s3cmci_dma_client); | 1838 | |
1839 | if (s3cmci_host_usedma(host)) | ||
1840 | s3c2410_dma_free(host->dma, &s3cmci_dma_client); | ||
1468 | 1841 | ||
1469 | free_irq(host->irq, host); | 1842 | free_irq(host->irq, host); |
1470 | 1843 | ||
1844 | if (!pd->no_wprotect) | ||
1845 | gpio_free(pd->gpio_wprotect); | ||
1846 | |||
1847 | if (!pd->no_detect) | ||
1848 | gpio_free(pd->gpio_detect); | ||
1849 | |||
1850 | for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++) | ||
1851 | gpio_free(i); | ||
1852 | |||
1853 | |||
1471 | iounmap(host->base); | 1854 | iounmap(host->base); |
1472 | release_mem_region(host->mem->start, RESSIZE(host->mem)); | 1855 | release_mem_region(host->mem->start, resource_size(host->mem)); |
1473 | 1856 | ||
1474 | mmc_free_host(mmc); | 1857 | mmc_free_host(mmc); |
1475 | return 0; | 1858 | return 0; |
1476 | } | 1859 | } |
1477 | 1860 | ||
1478 | static int __devinit s3cmci_2410_probe(struct platform_device *dev) | 1861 | static struct platform_device_id s3cmci_driver_ids[] = { |
1479 | { | 1862 | { |
1480 | return s3cmci_probe(dev, 0); | 1863 | .name = "s3c2410-sdi", |
1481 | } | 1864 | .driver_data = 0, |
1865 | }, { | ||
1866 | .name = "s3c2412-sdi", | ||
1867 | .driver_data = 1, | ||
1868 | }, { | ||
1869 | .name = "s3c2440-sdi", | ||
1870 | .driver_data = 1, | ||
1871 | }, | ||
1872 | { } | ||
1873 | }; | ||
1482 | 1874 | ||
1483 | static int __devinit s3cmci_2412_probe(struct platform_device *dev) | 1875 | MODULE_DEVICE_TABLE(platform, s3cmci_driver_ids); |
1484 | { | ||
1485 | return s3cmci_probe(dev, 1); | ||
1486 | } | ||
1487 | 1876 | ||
1488 | static int __devinit s3cmci_2440_probe(struct platform_device *dev) | ||
1489 | { | ||
1490 | return s3cmci_probe(dev, 1); | ||
1491 | } | ||
1492 | 1877 | ||
1493 | #ifdef CONFIG_PM | 1878 | #ifdef CONFIG_PM |
1494 | 1879 | ||
1495 | static int s3cmci_suspend(struct platform_device *dev, pm_message_t state) | 1880 | static int s3cmci_suspend(struct device *dev) |
1496 | { | 1881 | { |
1497 | struct mmc_host *mmc = platform_get_drvdata(dev); | 1882 | struct mmc_host *mmc = platform_get_drvdata(to_platform_device(dev)); |
1883 | struct pm_message event = { PM_EVENT_SUSPEND }; | ||
1498 | 1884 | ||
1499 | return mmc_suspend_host(mmc, state); | 1885 | return mmc_suspend_host(mmc, event); |
1500 | } | 1886 | } |
1501 | 1887 | ||
1502 | static int s3cmci_resume(struct platform_device *dev) | 1888 | static int s3cmci_resume(struct device *dev) |
1503 | { | 1889 | { |
1504 | struct mmc_host *mmc = platform_get_drvdata(dev); | 1890 | struct mmc_host *mmc = platform_get_drvdata(to_platform_device(dev)); |
1505 | 1891 | ||
1506 | return mmc_resume_host(mmc); | 1892 | return mmc_resume_host(mmc); |
1507 | } | 1893 | } |
1508 | 1894 | ||
1509 | #else /* CONFIG_PM */ | 1895 | static struct dev_pm_ops s3cmci_pm = { |
1510 | #define s3cmci_suspend NULL | ||
1511 | #define s3cmci_resume NULL | ||
1512 | #endif /* CONFIG_PM */ | ||
1513 | |||
1514 | |||
1515 | static struct platform_driver s3cmci_2410_driver = { | ||
1516 | .driver.name = "s3c2410-sdi", | ||
1517 | .driver.owner = THIS_MODULE, | ||
1518 | .probe = s3cmci_2410_probe, | ||
1519 | .remove = __devexit_p(s3cmci_remove), | ||
1520 | .shutdown = s3cmci_shutdown, | ||
1521 | .suspend = s3cmci_suspend, | 1896 | .suspend = s3cmci_suspend, |
1522 | .resume = s3cmci_resume, | 1897 | .resume = s3cmci_resume, |
1523 | }; | 1898 | }; |
1524 | 1899 | ||
1525 | static struct platform_driver s3cmci_2412_driver = { | 1900 | #define s3cmci_pm_ops &s3cmci_pm |
1526 | .driver.name = "s3c2412-sdi", | 1901 | #else /* CONFIG_PM */ |
1527 | .driver.owner = THIS_MODULE, | 1902 | #define s3cmci_pm_ops NULL |
1528 | .probe = s3cmci_2412_probe, | 1903 | #endif /* CONFIG_PM */ |
1529 | .remove = __devexit_p(s3cmci_remove), | ||
1530 | .shutdown = s3cmci_shutdown, | ||
1531 | .suspend = s3cmci_suspend, | ||
1532 | .resume = s3cmci_resume, | ||
1533 | }; | ||
1534 | 1904 | ||
1535 | static struct platform_driver s3cmci_2440_driver = { | 1905 | |
1536 | .driver.name = "s3c2440-sdi", | 1906 | static struct platform_driver s3cmci_driver = { |
1537 | .driver.owner = THIS_MODULE, | 1907 | .driver = { |
1538 | .probe = s3cmci_2440_probe, | 1908 | .name = "s3c-sdi", |
1909 | .owner = THIS_MODULE, | ||
1910 | .pm = s3cmci_pm_ops, | ||
1911 | }, | ||
1912 | .id_table = s3cmci_driver_ids, | ||
1913 | .probe = s3cmci_probe, | ||
1539 | .remove = __devexit_p(s3cmci_remove), | 1914 | .remove = __devexit_p(s3cmci_remove), |
1540 | .shutdown = s3cmci_shutdown, | 1915 | .shutdown = s3cmci_shutdown, |
1541 | .suspend = s3cmci_suspend, | ||
1542 | .resume = s3cmci_resume, | ||
1543 | }; | 1916 | }; |
1544 | 1917 | ||
1545 | |||
1546 | static int __init s3cmci_init(void) | 1918 | static int __init s3cmci_init(void) |
1547 | { | 1919 | { |
1548 | platform_driver_register(&s3cmci_2410_driver); | 1920 | return platform_driver_register(&s3cmci_driver); |
1549 | platform_driver_register(&s3cmci_2412_driver); | ||
1550 | platform_driver_register(&s3cmci_2440_driver); | ||
1551 | return 0; | ||
1552 | } | 1921 | } |
1553 | 1922 | ||
1554 | static void __exit s3cmci_exit(void) | 1923 | static void __exit s3cmci_exit(void) |
1555 | { | 1924 | { |
1556 | platform_driver_unregister(&s3cmci_2410_driver); | 1925 | platform_driver_unregister(&s3cmci_driver); |
1557 | platform_driver_unregister(&s3cmci_2412_driver); | ||
1558 | platform_driver_unregister(&s3cmci_2440_driver); | ||
1559 | } | 1926 | } |
1560 | 1927 | ||
1561 | module_init(s3cmci_init); | 1928 | module_init(s3cmci_init); |
@@ -1564,6 +1931,3 @@ module_exit(s3cmci_exit); | |||
1564 | MODULE_DESCRIPTION("Samsung S3C MMC/SD Card Interface driver"); | 1931 | MODULE_DESCRIPTION("Samsung S3C MMC/SD Card Interface driver"); |
1565 | MODULE_LICENSE("GPL v2"); | 1932 | MODULE_LICENSE("GPL v2"); |
1566 | MODULE_AUTHOR("Thomas Kleffel <tk@maintech.de>, Ben Dooks <ben-linux@fluff.org>"); | 1933 | MODULE_AUTHOR("Thomas Kleffel <tk@maintech.de>, Ben Dooks <ben-linux@fluff.org>"); |
1567 | MODULE_ALIAS("platform:s3c2410-sdi"); | ||
1568 | MODULE_ALIAS("platform:s3c2412-sdi"); | ||
1569 | MODULE_ALIAS("platform:s3c2440-sdi"); | ||
diff --git a/drivers/mmc/host/s3cmci.h b/drivers/mmc/host/s3cmci.h index ca1ba3d58cfd..c76b53dbeb61 100644 --- a/drivers/mmc/host/s3cmci.h +++ b/drivers/mmc/host/s3cmci.h | |||
@@ -8,9 +8,6 @@ | |||
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | /* FIXME: DMA Resource management ?! */ | ||
12 | #define S3CMCI_DMA 0 | ||
13 | |||
14 | enum s3cmci_waitfor { | 11 | enum s3cmci_waitfor { |
15 | COMPLETION_NONE, | 12 | COMPLETION_NONE, |
16 | COMPLETION_FINALIZE, | 13 | COMPLETION_FINALIZE, |
@@ -42,6 +39,11 @@ struct s3cmci_host { | |||
42 | int dodma; | 39 | int dodma; |
43 | int dmatogo; | 40 | int dmatogo; |
44 | 41 | ||
42 | bool irq_disabled; | ||
43 | bool irq_enabled; | ||
44 | bool irq_state; | ||
45 | int sdio_irqen; | ||
46 | |||
45 | struct mmc_request *mrq; | 47 | struct mmc_request *mrq; |
46 | int cmd_is_stop; | 48 | int cmd_is_stop; |
47 | 49 | ||
@@ -68,6 +70,12 @@ struct s3cmci_host { | |||
68 | unsigned int ccnt, dcnt; | 70 | unsigned int ccnt, dcnt; |
69 | struct tasklet_struct pio_tasklet; | 71 | struct tasklet_struct pio_tasklet; |
70 | 72 | ||
73 | #ifdef CONFIG_DEBUG_FS | ||
74 | struct dentry *debug_root; | ||
75 | struct dentry *debug_state; | ||
76 | struct dentry *debug_regs; | ||
77 | #endif | ||
78 | |||
71 | #ifdef CONFIG_CPU_FREQ | 79 | #ifdef CONFIG_CPU_FREQ |
72 | struct notifier_block freq_transition; | 80 | struct notifier_block freq_transition; |
73 | #endif | 81 | #endif |
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index b9eeadf01b74..975e25b19ebe 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -805,52 +805,54 @@ static void poll_vortex(struct net_device *dev) | |||
805 | 805 | ||
806 | #ifdef CONFIG_PM | 806 | #ifdef CONFIG_PM |
807 | 807 | ||
808 | static int vortex_suspend(struct pci_dev *pdev, pm_message_t state) | 808 | static int vortex_suspend(struct device *dev) |
809 | { | 809 | { |
810 | struct net_device *dev = pci_get_drvdata(pdev); | 810 | struct pci_dev *pdev = to_pci_dev(dev); |
811 | struct net_device *ndev = pci_get_drvdata(pdev); | ||
812 | |||
813 | if (!ndev || !netif_running(ndev)) | ||
814 | return 0; | ||
815 | |||
816 | netif_device_detach(ndev); | ||
817 | vortex_down(ndev, 1); | ||
811 | 818 | ||
812 | if (dev && netdev_priv(dev)) { | ||
813 | if (netif_running(dev)) { | ||
814 | netif_device_detach(dev); | ||
815 | vortex_down(dev, 1); | ||
816 | disable_irq(dev->irq); | ||
817 | } | ||
818 | pci_save_state(pdev); | ||
819 | pci_enable_wake(pdev, pci_choose_state(pdev, state), 0); | ||
820 | pci_disable_device(pdev); | ||
821 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | ||
822 | } | ||
823 | return 0; | 819 | return 0; |
824 | } | 820 | } |
825 | 821 | ||
826 | static int vortex_resume(struct pci_dev *pdev) | 822 | static int vortex_resume(struct device *dev) |
827 | { | 823 | { |
828 | struct net_device *dev = pci_get_drvdata(pdev); | 824 | struct pci_dev *pdev = to_pci_dev(dev); |
829 | struct vortex_private *vp = netdev_priv(dev); | 825 | struct net_device *ndev = pci_get_drvdata(pdev); |
830 | int err; | 826 | int err; |
831 | 827 | ||
832 | if (dev && vp) { | 828 | if (!ndev || !netif_running(ndev)) |
833 | pci_set_power_state(pdev, PCI_D0); | 829 | return 0; |
834 | pci_restore_state(pdev); | 830 | |
835 | err = pci_enable_device(pdev); | 831 | err = vortex_up(ndev); |
836 | if (err) { | 832 | if (err) |
837 | pr_warning("%s: Could not enable device\n", | 833 | return err; |
838 | dev->name); | 834 | |
839 | return err; | 835 | netif_device_attach(ndev); |
840 | } | 836 | |
841 | pci_set_master(pdev); | ||
842 | if (netif_running(dev)) { | ||
843 | err = vortex_up(dev); | ||
844 | if (err) | ||
845 | return err; | ||
846 | enable_irq(dev->irq); | ||
847 | netif_device_attach(dev); | ||
848 | } | ||
849 | } | ||
850 | return 0; | 837 | return 0; |
851 | } | 838 | } |
852 | 839 | ||
853 | #endif /* CONFIG_PM */ | 840 | static struct dev_pm_ops vortex_pm_ops = { |
841 | .suspend = vortex_suspend, | ||
842 | .resume = vortex_resume, | ||
843 | .freeze = vortex_suspend, | ||
844 | .thaw = vortex_resume, | ||
845 | .poweroff = vortex_suspend, | ||
846 | .restore = vortex_resume, | ||
847 | }; | ||
848 | |||
849 | #define VORTEX_PM_OPS (&vortex_pm_ops) | ||
850 | |||
851 | #else /* !CONFIG_PM */ | ||
852 | |||
853 | #define VORTEX_PM_OPS NULL | ||
854 | |||
855 | #endif /* !CONFIG_PM */ | ||
854 | 856 | ||
855 | #ifdef CONFIG_EISA | 857 | #ifdef CONFIG_EISA |
856 | static struct eisa_device_id vortex_eisa_ids[] = { | 858 | static struct eisa_device_id vortex_eisa_ids[] = { |
@@ -3199,10 +3201,7 @@ static struct pci_driver vortex_driver = { | |||
3199 | .probe = vortex_init_one, | 3201 | .probe = vortex_init_one, |
3200 | .remove = __devexit_p(vortex_remove_one), | 3202 | .remove = __devexit_p(vortex_remove_one), |
3201 | .id_table = vortex_pci_tbl, | 3203 | .id_table = vortex_pci_tbl, |
3202 | #ifdef CONFIG_PM | 3204 | .driver.pm = VORTEX_PM_OPS, |
3203 | .suspend = vortex_suspend, | ||
3204 | .resume = vortex_resume, | ||
3205 | #endif | ||
3206 | }; | 3205 | }; |
3207 | 3206 | ||
3208 | 3207 | ||
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 2bea67c134f0..712776089b46 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -1738,6 +1738,13 @@ config KS8851 | |||
1738 | help | 1738 | help |
1739 | SPI driver for Micrel KS8851 SPI attached network chip. | 1739 | SPI driver for Micrel KS8851 SPI attached network chip. |
1740 | 1740 | ||
1741 | config KS8851_MLL | ||
1742 | tristate "Micrel KS8851 MLL" | ||
1743 | depends on HAS_IOMEM | ||
1744 | help | ||
1745 | This platform driver is for Micrel KS8851 Address/data bus | ||
1746 | multiplexed network chip. | ||
1747 | |||
1741 | config VIA_RHINE | 1748 | config VIA_RHINE |
1742 | tristate "VIA Rhine support" | 1749 | tristate "VIA Rhine support" |
1743 | depends on NET_PCI && PCI | 1750 | depends on NET_PCI && PCI |
diff --git a/drivers/net/Makefile b/drivers/net/Makefile index ae8cd30f13d6..d866b8cf65d1 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile | |||
@@ -89,6 +89,7 @@ obj-$(CONFIG_SKY2) += sky2.o | |||
89 | obj-$(CONFIG_SKFP) += skfp/ | 89 | obj-$(CONFIG_SKFP) += skfp/ |
90 | obj-$(CONFIG_KS8842) += ks8842.o | 90 | obj-$(CONFIG_KS8842) += ks8842.o |
91 | obj-$(CONFIG_KS8851) += ks8851.o | 91 | obj-$(CONFIG_KS8851) += ks8851.o |
92 | obj-$(CONFIG_KS8851_MLL) += ks8851_mll.o | ||
92 | obj-$(CONFIG_VIA_RHINE) += via-rhine.o | 93 | obj-$(CONFIG_VIA_RHINE) += via-rhine.o |
93 | obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o | 94 | obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o |
94 | obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o | 95 | obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o |
diff --git a/drivers/net/bcm63xx_enet.c b/drivers/net/bcm63xx_enet.c index 09d270913c50..ba29dc319b34 100644 --- a/drivers/net/bcm63xx_enet.c +++ b/drivers/net/bcm63xx_enet.c | |||
@@ -90,7 +90,7 @@ static int do_mdio_op(struct bcm_enet_priv *priv, unsigned int data) | |||
90 | if (enet_readl(priv, ENET_IR_REG) & ENET_IR_MII) | 90 | if (enet_readl(priv, ENET_IR_REG) & ENET_IR_MII) |
91 | break; | 91 | break; |
92 | udelay(1); | 92 | udelay(1); |
93 | } while (limit-- >= 0); | 93 | } while (limit-- > 0); |
94 | 94 | ||
95 | return (limit < 0) ? 1 : 0; | 95 | return (limit < 0) ? 1 : 0; |
96 | } | 96 | } |
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h index 684c6fe24c8d..a80da0e14a52 100644 --- a/drivers/net/benet/be.h +++ b/drivers/net/benet/be.h | |||
@@ -258,6 +258,7 @@ struct be_adapter { | |||
258 | bool link_up; | 258 | bool link_up; |
259 | u32 port_num; | 259 | u32 port_num; |
260 | bool promiscuous; | 260 | bool promiscuous; |
261 | u32 cap; | ||
261 | }; | 262 | }; |
262 | 263 | ||
263 | extern const struct ethtool_ops be_ethtool_ops; | 264 | extern const struct ethtool_ops be_ethtool_ops; |
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 3dd76c4170bf..79d35d122c08 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -1068,7 +1068,7 @@ int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc) | |||
1068 | } | 1068 | } |
1069 | 1069 | ||
1070 | /* Uses mbox */ | 1070 | /* Uses mbox */ |
1071 | int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num) | 1071 | int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num, u32 *cap) |
1072 | { | 1072 | { |
1073 | struct be_mcc_wrb *wrb; | 1073 | struct be_mcc_wrb *wrb; |
1074 | struct be_cmd_req_query_fw_cfg *req; | 1074 | struct be_cmd_req_query_fw_cfg *req; |
@@ -1088,6 +1088,7 @@ int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num) | |||
1088 | if (!status) { | 1088 | if (!status) { |
1089 | struct be_cmd_resp_query_fw_cfg *resp = embedded_payload(wrb); | 1089 | struct be_cmd_resp_query_fw_cfg *resp = embedded_payload(wrb); |
1090 | *port_num = le32_to_cpu(resp->phys_port); | 1090 | *port_num = le32_to_cpu(resp->phys_port); |
1091 | *cap = le32_to_cpu(resp->function_cap); | ||
1091 | } | 1092 | } |
1092 | 1093 | ||
1093 | spin_unlock(&adapter->mbox_lock); | 1094 | spin_unlock(&adapter->mbox_lock); |
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h index 93e432f3d926..8b4c2cb9ad62 100644 --- a/drivers/net/benet/be_cmds.h +++ b/drivers/net/benet/be_cmds.h | |||
@@ -760,7 +760,8 @@ extern int be_cmd_set_flow_control(struct be_adapter *adapter, | |||
760 | u32 tx_fc, u32 rx_fc); | 760 | u32 tx_fc, u32 rx_fc); |
761 | extern int be_cmd_get_flow_control(struct be_adapter *adapter, | 761 | extern int be_cmd_get_flow_control(struct be_adapter *adapter, |
762 | u32 *tx_fc, u32 *rx_fc); | 762 | u32 *tx_fc, u32 *rx_fc); |
763 | extern int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num); | 763 | extern int be_cmd_query_fw_cfg(struct be_adapter *adapter, |
764 | u32 *port_num, u32 *cap); | ||
764 | extern int be_cmd_reset_function(struct be_adapter *adapter); | 765 | extern int be_cmd_reset_function(struct be_adapter *adapter); |
765 | extern int be_process_mcc(struct be_adapter *adapter); | 766 | extern int be_process_mcc(struct be_adapter *adapter); |
766 | extern int be_cmd_write_flashrom(struct be_adapter *adapter, | 767 | extern int be_cmd_write_flashrom(struct be_adapter *adapter, |
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 409cf0595903..2f9b50156e0c 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -747,9 +747,16 @@ static void be_rx_compl_process(struct be_adapter *adapter, | |||
747 | struct be_eth_rx_compl *rxcp) | 747 | struct be_eth_rx_compl *rxcp) |
748 | { | 748 | { |
749 | struct sk_buff *skb; | 749 | struct sk_buff *skb; |
750 | u32 vtp, vid; | 750 | u32 vlanf, vid; |
751 | u8 vtm; | ||
751 | 752 | ||
752 | vtp = AMAP_GET_BITS(struct amap_eth_rx_compl, vtp, rxcp); | 753 | vlanf = AMAP_GET_BITS(struct amap_eth_rx_compl, vtp, rxcp); |
754 | vtm = AMAP_GET_BITS(struct amap_eth_rx_compl, vtm, rxcp); | ||
755 | |||
756 | /* vlanf could be wrongly set in some cards. | ||
757 | * ignore if vtm is not set */ | ||
758 | if ((adapter->cap == 0x400) && !vtm) | ||
759 | vlanf = 0; | ||
753 | 760 | ||
754 | skb = netdev_alloc_skb(adapter->netdev, BE_HDR_LEN + NET_IP_ALIGN); | 761 | skb = netdev_alloc_skb(adapter->netdev, BE_HDR_LEN + NET_IP_ALIGN); |
755 | if (!skb) { | 762 | if (!skb) { |
@@ -772,7 +779,7 @@ static void be_rx_compl_process(struct be_adapter *adapter, | |||
772 | skb->protocol = eth_type_trans(skb, adapter->netdev); | 779 | skb->protocol = eth_type_trans(skb, adapter->netdev); |
773 | skb->dev = adapter->netdev; | 780 | skb->dev = adapter->netdev; |
774 | 781 | ||
775 | if (vtp) { | 782 | if (vlanf) { |
776 | if (!adapter->vlan_grp || adapter->num_vlans == 0) { | 783 | if (!adapter->vlan_grp || adapter->num_vlans == 0) { |
777 | kfree_skb(skb); | 784 | kfree_skb(skb); |
778 | return; | 785 | return; |
@@ -797,11 +804,18 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter, | |||
797 | struct be_eq_obj *eq_obj = &adapter->rx_eq; | 804 | struct be_eq_obj *eq_obj = &adapter->rx_eq; |
798 | u32 num_rcvd, pkt_size, remaining, vlanf, curr_frag_len; | 805 | u32 num_rcvd, pkt_size, remaining, vlanf, curr_frag_len; |
799 | u16 i, rxq_idx = 0, vid, j; | 806 | u16 i, rxq_idx = 0, vid, j; |
807 | u8 vtm; | ||
800 | 808 | ||
801 | num_rcvd = AMAP_GET_BITS(struct amap_eth_rx_compl, numfrags, rxcp); | 809 | num_rcvd = AMAP_GET_BITS(struct amap_eth_rx_compl, numfrags, rxcp); |
802 | pkt_size = AMAP_GET_BITS(struct amap_eth_rx_compl, pktsize, rxcp); | 810 | pkt_size = AMAP_GET_BITS(struct amap_eth_rx_compl, pktsize, rxcp); |
803 | vlanf = AMAP_GET_BITS(struct amap_eth_rx_compl, vtp, rxcp); | 811 | vlanf = AMAP_GET_BITS(struct amap_eth_rx_compl, vtp, rxcp); |
804 | rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp); | 812 | rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp); |
813 | vtm = AMAP_GET_BITS(struct amap_eth_rx_compl, vtm, rxcp); | ||
814 | |||
815 | /* vlanf could be wrongly set in some cards. | ||
816 | * ignore if vtm is not set */ | ||
817 | if ((adapter->cap == 0x400) && !vtm) | ||
818 | vlanf = 0; | ||
805 | 819 | ||
806 | skb = napi_get_frags(&eq_obj->napi); | 820 | skb = napi_get_frags(&eq_obj->napi); |
807 | if (!skb) { | 821 | if (!skb) { |
@@ -2045,7 +2059,8 @@ static int be_hw_up(struct be_adapter *adapter) | |||
2045 | if (status) | 2059 | if (status) |
2046 | return status; | 2060 | return status; |
2047 | 2061 | ||
2048 | status = be_cmd_query_fw_cfg(adapter, &adapter->port_num); | 2062 | status = be_cmd_query_fw_cfg(adapter, |
2063 | &adapter->port_num, &adapter->cap); | ||
2049 | return status; | 2064 | return status; |
2050 | } | 2065 | } |
2051 | 2066 | ||
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 6044e12ff9fc..ff449de6f3c0 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -1182,6 +1182,7 @@ static ssize_t bonding_store_primary(struct device *d, | |||
1182 | ": %s: Setting %s as primary slave.\n", | 1182 | ": %s: Setting %s as primary slave.\n", |
1183 | bond->dev->name, slave->dev->name); | 1183 | bond->dev->name, slave->dev->name); |
1184 | bond->primary_slave = slave; | 1184 | bond->primary_slave = slave; |
1185 | strcpy(bond->params.primary, slave->dev->name); | ||
1185 | bond_select_active_slave(bond); | 1186 | bond_select_active_slave(bond); |
1186 | goto out; | 1187 | goto out; |
1187 | } | 1188 | } |
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c index 211c8e9182fc..46c87ec7960c 100644 --- a/drivers/net/cnic.c +++ b/drivers/net/cnic.c | |||
@@ -2733,7 +2733,8 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event, | |||
2733 | cnic_ulp_init(dev); | 2733 | cnic_ulp_init(dev); |
2734 | else if (event == NETDEV_UNREGISTER) | 2734 | else if (event == NETDEV_UNREGISTER) |
2735 | cnic_ulp_exit(dev); | 2735 | cnic_ulp_exit(dev); |
2736 | else if (event == NETDEV_UP) { | 2736 | |
2737 | if (event == NETDEV_UP) { | ||
2737 | if (cnic_register_netdev(dev) != 0) { | 2738 | if (cnic_register_netdev(dev) != 0) { |
2738 | cnic_put(dev); | 2739 | cnic_put(dev); |
2739 | goto done; | 2740 | goto done; |
diff --git a/drivers/net/cnic_if.h b/drivers/net/cnic_if.h index a49235739eef..d8b09efdcb52 100644 --- a/drivers/net/cnic_if.h +++ b/drivers/net/cnic_if.h | |||
@@ -12,8 +12,8 @@ | |||
12 | #ifndef CNIC_IF_H | 12 | #ifndef CNIC_IF_H |
13 | #define CNIC_IF_H | 13 | #define CNIC_IF_H |
14 | 14 | ||
15 | #define CNIC_MODULE_VERSION "2.0.0" | 15 | #define CNIC_MODULE_VERSION "2.0.1" |
16 | #define CNIC_MODULE_RELDATE "May 21, 2009" | 16 | #define CNIC_MODULE_RELDATE "Oct 01, 2009" |
17 | 17 | ||
18 | #define CNIC_ULP_RDMA 0 | 18 | #define CNIC_ULP_RDMA 0 |
19 | #define CNIC_ULP_ISCSI 1 | 19 | #define CNIC_ULP_ISCSI 1 |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 16c193a6c95c..0687c6aa4e46 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -4982,12 +4982,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4982 | goto err_pci_reg; | 4982 | goto err_pci_reg; |
4983 | 4983 | ||
4984 | /* AER (Advanced Error Reporting) hooks */ | 4984 | /* AER (Advanced Error Reporting) hooks */ |
4985 | err = pci_enable_pcie_error_reporting(pdev); | 4985 | pci_enable_pcie_error_reporting(pdev); |
4986 | if (err) { | ||
4987 | dev_err(&pdev->dev, "pci_enable_pcie_error_reporting failed " | ||
4988 | "0x%x\n", err); | ||
4989 | /* non-fatal, continue */ | ||
4990 | } | ||
4991 | 4986 | ||
4992 | pci_set_master(pdev); | 4987 | pci_set_master(pdev); |
4993 | /* PCI config space info */ | 4988 | /* PCI config space info */ |
@@ -5263,7 +5258,6 @@ static void __devexit e1000_remove(struct pci_dev *pdev) | |||
5263 | { | 5258 | { |
5264 | struct net_device *netdev = pci_get_drvdata(pdev); | 5259 | struct net_device *netdev = pci_get_drvdata(pdev); |
5265 | struct e1000_adapter *adapter = netdev_priv(netdev); | 5260 | struct e1000_adapter *adapter = netdev_priv(netdev); |
5266 | int err; | ||
5267 | 5261 | ||
5268 | /* | 5262 | /* |
5269 | * flush_scheduled work may reschedule our watchdog task, so | 5263 | * flush_scheduled work may reschedule our watchdog task, so |
@@ -5299,10 +5293,7 @@ static void __devexit e1000_remove(struct pci_dev *pdev) | |||
5299 | free_netdev(netdev); | 5293 | free_netdev(netdev); |
5300 | 5294 | ||
5301 | /* AER disable */ | 5295 | /* AER disable */ |
5302 | err = pci_disable_pcie_error_reporting(pdev); | 5296 | pci_disable_pcie_error_reporting(pdev); |
5303 | if (err) | ||
5304 | dev_err(&pdev->dev, | ||
5305 | "pci_disable_pcie_error_reporting failed 0x%x\n", err); | ||
5306 | 5297 | ||
5307 | pci_disable_device(pdev); | 5298 | pci_disable_device(pdev); |
5308 | } | 5299 | } |
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index 33b55f729742..db4b7f1603f6 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c | |||
@@ -258,7 +258,7 @@ static void ax_bump(struct mkiss *ax) | |||
258 | } | 258 | } |
259 | if (ax->crcmode != CRC_MODE_SMACK && ax->crcauto) { | 259 | if (ax->crcmode != CRC_MODE_SMACK && ax->crcauto) { |
260 | printk(KERN_INFO | 260 | printk(KERN_INFO |
261 | "mkiss: %s: Switchting to crc-smack\n", | 261 | "mkiss: %s: Switching to crc-smack\n", |
262 | ax->dev->name); | 262 | ax->dev->name); |
263 | ax->crcmode = CRC_MODE_SMACK; | 263 | ax->crcmode = CRC_MODE_SMACK; |
264 | } | 264 | } |
@@ -272,7 +272,7 @@ static void ax_bump(struct mkiss *ax) | |||
272 | } | 272 | } |
273 | if (ax->crcmode != CRC_MODE_FLEX && ax->crcauto) { | 273 | if (ax->crcmode != CRC_MODE_FLEX && ax->crcauto) { |
274 | printk(KERN_INFO | 274 | printk(KERN_INFO |
275 | "mkiss: %s: Switchting to crc-flexnet\n", | 275 | "mkiss: %s: Switching to crc-flexnet\n", |
276 | ax->dev->name); | 276 | ax->dev->name); |
277 | ax->crcmode = CRC_MODE_FLEX; | 277 | ax->crcmode = CRC_MODE_FLEX; |
278 | } | 278 | } |
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 5d6c1530a8c0..714c3a4a44ef 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -1246,12 +1246,7 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
1246 | if (err) | 1246 | if (err) |
1247 | goto err_pci_reg; | 1247 | goto err_pci_reg; |
1248 | 1248 | ||
1249 | err = pci_enable_pcie_error_reporting(pdev); | 1249 | pci_enable_pcie_error_reporting(pdev); |
1250 | if (err) { | ||
1251 | dev_err(&pdev->dev, "pci_enable_pcie_error_reporting failed " | ||
1252 | "0x%x\n", err); | ||
1253 | /* non-fatal, continue */ | ||
1254 | } | ||
1255 | 1250 | ||
1256 | pci_set_master(pdev); | 1251 | pci_set_master(pdev); |
1257 | pci_save_state(pdev); | 1252 | pci_save_state(pdev); |
@@ -1628,7 +1623,6 @@ static void __devexit igb_remove(struct pci_dev *pdev) | |||
1628 | struct net_device *netdev = pci_get_drvdata(pdev); | 1623 | struct net_device *netdev = pci_get_drvdata(pdev); |
1629 | struct igb_adapter *adapter = netdev_priv(netdev); | 1624 | struct igb_adapter *adapter = netdev_priv(netdev); |
1630 | struct e1000_hw *hw = &adapter->hw; | 1625 | struct e1000_hw *hw = &adapter->hw; |
1631 | int err; | ||
1632 | 1626 | ||
1633 | /* flush_scheduled work may reschedule our watchdog task, so | 1627 | /* flush_scheduled work may reschedule our watchdog task, so |
1634 | * explicitly disable watchdog tasks from being rescheduled */ | 1628 | * explicitly disable watchdog tasks from being rescheduled */ |
@@ -1682,10 +1676,7 @@ static void __devexit igb_remove(struct pci_dev *pdev) | |||
1682 | 1676 | ||
1683 | free_netdev(netdev); | 1677 | free_netdev(netdev); |
1684 | 1678 | ||
1685 | err = pci_disable_pcie_error_reporting(pdev); | 1679 | pci_disable_pcie_error_reporting(pdev); |
1686 | if (err) | ||
1687 | dev_err(&pdev->dev, | ||
1688 | "pci_disable_pcie_error_reporting failed 0x%x\n", err); | ||
1689 | 1680 | ||
1690 | pci_disable_device(pdev); | 1681 | pci_disable_device(pdev); |
1691 | } | 1682 | } |
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index e36e951cbc65..aa7286bc4364 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
@@ -495,7 +495,7 @@ static void veth_take_cap_ack(struct veth_lpar_connection *cnx, | |||
495 | cnx->remote_lp); | 495 | cnx->remote_lp); |
496 | } else { | 496 | } else { |
497 | memcpy(&cnx->cap_ack_event, event, | 497 | memcpy(&cnx->cap_ack_event, event, |
498 | sizeof(&cnx->cap_ack_event)); | 498 | sizeof(cnx->cap_ack_event)); |
499 | cnx->state |= VETH_STATE_GOTCAPACK; | 499 | cnx->state |= VETH_STATE_GOTCAPACK; |
500 | veth_kick_statemachine(cnx); | 500 | veth_kick_statemachine(cnx); |
501 | } | 501 | } |
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c index 56b12f3192f1..e2d5343f1275 100644 --- a/drivers/net/ixgbe/ixgbe_82598.c +++ b/drivers/net/ixgbe/ixgbe_82598.c | |||
@@ -425,7 +425,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
425 | #endif /* CONFIG_DCB */ | 425 | #endif /* CONFIG_DCB */ |
426 | default: | 426 | default: |
427 | hw_dbg(hw, "Flow control param set incorrectly\n"); | 427 | hw_dbg(hw, "Flow control param set incorrectly\n"); |
428 | ret_val = -IXGBE_ERR_CONFIG; | 428 | ret_val = IXGBE_ERR_CONFIG; |
429 | goto out; | 429 | goto out; |
430 | break; | 430 | break; |
431 | } | 431 | } |
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c index 6621e172df3d..40ff120a9ad4 100644 --- a/drivers/net/ixgbe/ixgbe_common.c +++ b/drivers/net/ixgbe/ixgbe_common.c | |||
@@ -1355,9 +1355,7 @@ static void ixgbe_add_uc_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq) | |||
1355 | /** | 1355 | /** |
1356 | * ixgbe_update_uc_addr_list_generic - Updates MAC list of secondary addresses | 1356 | * ixgbe_update_uc_addr_list_generic - Updates MAC list of secondary addresses |
1357 | * @hw: pointer to hardware structure | 1357 | * @hw: pointer to hardware structure |
1358 | * @addr_list: the list of new addresses | 1358 | * @uc_list: the list of new addresses |
1359 | * @addr_count: number of addresses | ||
1360 | * @next: iterator function to walk the address list | ||
1361 | * | 1359 | * |
1362 | * The given list replaces any existing list. Clears the secondary addrs from | 1360 | * The given list replaces any existing list. Clears the secondary addrs from |
1363 | * receive address registers. Uses unused receive address registers for the | 1361 | * receive address registers. Uses unused receive address registers for the |
@@ -1663,7 +1661,7 @@ s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
1663 | #endif /* CONFIG_DCB */ | 1661 | #endif /* CONFIG_DCB */ |
1664 | default: | 1662 | default: |
1665 | hw_dbg(hw, "Flow control param set incorrectly\n"); | 1663 | hw_dbg(hw, "Flow control param set incorrectly\n"); |
1666 | ret_val = -IXGBE_ERR_CONFIG; | 1664 | ret_val = IXGBE_ERR_CONFIG; |
1667 | goto out; | 1665 | goto out; |
1668 | break; | 1666 | break; |
1669 | } | 1667 | } |
@@ -1734,75 +1732,140 @@ s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw) | |||
1734 | s32 ret_val = 0; | 1732 | s32 ret_val = 0; |
1735 | ixgbe_link_speed speed; | 1733 | ixgbe_link_speed speed; |
1736 | u32 pcs_anadv_reg, pcs_lpab_reg, linkstat; | 1734 | u32 pcs_anadv_reg, pcs_lpab_reg, linkstat; |
1735 | u32 links2, anlp1_reg, autoc_reg, links; | ||
1737 | bool link_up; | 1736 | bool link_up; |
1738 | 1737 | ||
1739 | /* | 1738 | /* |
1740 | * AN should have completed when the cable was plugged in. | 1739 | * AN should have completed when the cable was plugged in. |
1741 | * Look for reasons to bail out. Bail out if: | 1740 | * Look for reasons to bail out. Bail out if: |
1742 | * - FC autoneg is disabled, or if | 1741 | * - FC autoneg is disabled, or if |
1743 | * - we don't have multispeed fiber, or if | 1742 | * - link is not up. |
1744 | * - we're not running at 1G, or if | ||
1745 | * - link is not up, or if | ||
1746 | * - link is up but AN did not complete, or if | ||
1747 | * - link is up and AN completed but timed out | ||
1748 | * | 1743 | * |
1749 | * Since we're being called from an LSC, link is already know to be up. | 1744 | * Since we're being called from an LSC, link is already known to be up. |
1750 | * So use link_up_wait_to_complete=false. | 1745 | * So use link_up_wait_to_complete=false. |
1751 | */ | 1746 | */ |
1752 | hw->mac.ops.check_link(hw, &speed, &link_up, false); | 1747 | hw->mac.ops.check_link(hw, &speed, &link_up, false); |
1753 | linkstat = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA); | 1748 | |
1754 | 1749 | if (hw->fc.disable_fc_autoneg || (!link_up)) { | |
1755 | if (hw->fc.disable_fc_autoneg || | ||
1756 | !hw->phy.multispeed_fiber || | ||
1757 | (speed != IXGBE_LINK_SPEED_1GB_FULL) || | ||
1758 | !link_up || | ||
1759 | ((linkstat & IXGBE_PCS1GLSTA_AN_COMPLETE) == 0) || | ||
1760 | ((linkstat & IXGBE_PCS1GLSTA_AN_TIMED_OUT) == 1)) { | ||
1761 | hw->fc.fc_was_autonegged = false; | 1750 | hw->fc.fc_was_autonegged = false; |
1762 | hw->fc.current_mode = hw->fc.requested_mode; | 1751 | hw->fc.current_mode = hw->fc.requested_mode; |
1763 | hw_dbg(hw, "Autoneg FC was skipped.\n"); | ||
1764 | goto out; | 1752 | goto out; |
1765 | } | 1753 | } |
1766 | 1754 | ||
1767 | /* | 1755 | /* |
1756 | * On backplane, bail out if | ||
1757 | * - backplane autoneg was not completed, or if | ||
1758 | * - link partner is not AN enabled | ||
1759 | */ | ||
1760 | if (hw->phy.media_type == ixgbe_media_type_backplane) { | ||
1761 | links = IXGBE_READ_REG(hw, IXGBE_LINKS); | ||
1762 | links2 = IXGBE_READ_REG(hw, IXGBE_LINKS2); | ||
1763 | if (((links & IXGBE_LINKS_KX_AN_COMP) == 0) || | ||
1764 | ((links2 & IXGBE_LINKS2_AN_SUPPORTED) == 0)) { | ||
1765 | hw->fc.fc_was_autonegged = false; | ||
1766 | hw->fc.current_mode = hw->fc.requested_mode; | ||
1767 | goto out; | ||
1768 | } | ||
1769 | } | ||
1770 | |||
1771 | /* | ||
1772 | * On multispeed fiber at 1g, bail out if | ||
1773 | * - link is up but AN did not complete, or if | ||
1774 | * - link is up and AN completed but timed out | ||
1775 | */ | ||
1776 | if (hw->phy.multispeed_fiber && (speed == IXGBE_LINK_SPEED_1GB_FULL)) { | ||
1777 | linkstat = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA); | ||
1778 | if (((linkstat & IXGBE_PCS1GLSTA_AN_COMPLETE) == 0) || | ||
1779 | ((linkstat & IXGBE_PCS1GLSTA_AN_TIMED_OUT) == 1)) { | ||
1780 | hw->fc.fc_was_autonegged = false; | ||
1781 | hw->fc.current_mode = hw->fc.requested_mode; | ||
1782 | goto out; | ||
1783 | } | ||
1784 | } | ||
1785 | |||
1786 | /* | ||
1768 | * Read the AN advertisement and LP ability registers and resolve | 1787 | * Read the AN advertisement and LP ability registers and resolve |
1769 | * local flow control settings accordingly | 1788 | * local flow control settings accordingly |
1770 | */ | 1789 | */ |
1771 | pcs_anadv_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA); | 1790 | if ((speed == IXGBE_LINK_SPEED_1GB_FULL) && |
1772 | pcs_lpab_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANLP); | 1791 | (hw->phy.media_type != ixgbe_media_type_backplane)) { |
1773 | if ((pcs_anadv_reg & IXGBE_PCS1GANA_SYM_PAUSE) && | 1792 | pcs_anadv_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA); |
1774 | (pcs_lpab_reg & IXGBE_PCS1GANA_SYM_PAUSE)) { | 1793 | pcs_lpab_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANLP); |
1794 | if ((pcs_anadv_reg & IXGBE_PCS1GANA_SYM_PAUSE) && | ||
1795 | (pcs_lpab_reg & IXGBE_PCS1GANA_SYM_PAUSE)) { | ||
1796 | /* | ||
1797 | * Now we need to check if the user selected Rx ONLY | ||
1798 | * of pause frames. In this case, we had to advertise | ||
1799 | * FULL flow control because we could not advertise RX | ||
1800 | * ONLY. Hence, we must now check to see if we need to | ||
1801 | * turn OFF the TRANSMISSION of PAUSE frames. | ||
1802 | */ | ||
1803 | if (hw->fc.requested_mode == ixgbe_fc_full) { | ||
1804 | hw->fc.current_mode = ixgbe_fc_full; | ||
1805 | hw_dbg(hw, "Flow Control = FULL.\n"); | ||
1806 | } else { | ||
1807 | hw->fc.current_mode = ixgbe_fc_rx_pause; | ||
1808 | hw_dbg(hw, "Flow Control=RX PAUSE only\n"); | ||
1809 | } | ||
1810 | } else if (!(pcs_anadv_reg & IXGBE_PCS1GANA_SYM_PAUSE) && | ||
1811 | (pcs_anadv_reg & IXGBE_PCS1GANA_ASM_PAUSE) && | ||
1812 | (pcs_lpab_reg & IXGBE_PCS1GANA_SYM_PAUSE) && | ||
1813 | (pcs_lpab_reg & IXGBE_PCS1GANA_ASM_PAUSE)) { | ||
1814 | hw->fc.current_mode = ixgbe_fc_tx_pause; | ||
1815 | hw_dbg(hw, "Flow Control = TX PAUSE frames only.\n"); | ||
1816 | } else if ((pcs_anadv_reg & IXGBE_PCS1GANA_SYM_PAUSE) && | ||
1817 | (pcs_anadv_reg & IXGBE_PCS1GANA_ASM_PAUSE) && | ||
1818 | !(pcs_lpab_reg & IXGBE_PCS1GANA_SYM_PAUSE) && | ||
1819 | (pcs_lpab_reg & IXGBE_PCS1GANA_ASM_PAUSE)) { | ||
1820 | hw->fc.current_mode = ixgbe_fc_rx_pause; | ||
1821 | hw_dbg(hw, "Flow Control = RX PAUSE frames only.\n"); | ||
1822 | } else { | ||
1823 | hw->fc.current_mode = ixgbe_fc_none; | ||
1824 | hw_dbg(hw, "Flow Control = NONE.\n"); | ||
1825 | } | ||
1826 | } | ||
1827 | |||
1828 | if (hw->phy.media_type == ixgbe_media_type_backplane) { | ||
1775 | /* | 1829 | /* |
1776 | * Now we need to check if the user selected Rx ONLY | 1830 | * Read the 10g AN autoc and LP ability registers and resolve |
1777 | * of pause frames. In this case, we had to advertise | 1831 | * local flow control settings accordingly |
1778 | * FULL flow control because we could not advertise RX | ||
1779 | * ONLY. Hence, we must now check to see if we need to | ||
1780 | * turn OFF the TRANSMISSION of PAUSE frames. | ||
1781 | */ | 1832 | */ |
1782 | if (hw->fc.requested_mode == ixgbe_fc_full) { | 1833 | autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); |
1783 | hw->fc.current_mode = ixgbe_fc_full; | 1834 | anlp1_reg = IXGBE_READ_REG(hw, IXGBE_ANLP1); |
1784 | hw_dbg(hw, "Flow Control = FULL.\n"); | 1835 | |
1785 | } else { | 1836 | if ((autoc_reg & IXGBE_AUTOC_SYM_PAUSE) && |
1837 | (anlp1_reg & IXGBE_ANLP1_SYM_PAUSE)) { | ||
1838 | /* | ||
1839 | * Now we need to check if the user selected Rx ONLY | ||
1840 | * of pause frames. In this case, we had to advertise | ||
1841 | * FULL flow control because we could not advertise RX | ||
1842 | * ONLY. Hence, we must now check to see if we need to | ||
1843 | * turn OFF the TRANSMISSION of PAUSE frames. | ||
1844 | */ | ||
1845 | if (hw->fc.requested_mode == ixgbe_fc_full) { | ||
1846 | hw->fc.current_mode = ixgbe_fc_full; | ||
1847 | hw_dbg(hw, "Flow Control = FULL.\n"); | ||
1848 | } else { | ||
1849 | hw->fc.current_mode = ixgbe_fc_rx_pause; | ||
1850 | hw_dbg(hw, "Flow Control=RX PAUSE only\n"); | ||
1851 | } | ||
1852 | } else if (!(autoc_reg & IXGBE_AUTOC_SYM_PAUSE) && | ||
1853 | (autoc_reg & IXGBE_AUTOC_ASM_PAUSE) && | ||
1854 | (anlp1_reg & IXGBE_ANLP1_SYM_PAUSE) && | ||
1855 | (anlp1_reg & IXGBE_ANLP1_ASM_PAUSE)) { | ||
1856 | hw->fc.current_mode = ixgbe_fc_tx_pause; | ||
1857 | hw_dbg(hw, "Flow Control = TX PAUSE frames only.\n"); | ||
1858 | } else if ((autoc_reg & IXGBE_AUTOC_SYM_PAUSE) && | ||
1859 | (autoc_reg & IXGBE_AUTOC_ASM_PAUSE) && | ||
1860 | !(anlp1_reg & IXGBE_ANLP1_SYM_PAUSE) && | ||
1861 | (anlp1_reg & IXGBE_ANLP1_ASM_PAUSE)) { | ||
1786 | hw->fc.current_mode = ixgbe_fc_rx_pause; | 1862 | hw->fc.current_mode = ixgbe_fc_rx_pause; |
1787 | hw_dbg(hw, "Flow Control = RX PAUSE frames only.\n"); | 1863 | hw_dbg(hw, "Flow Control = RX PAUSE frames only.\n"); |
1864 | } else { | ||
1865 | hw->fc.current_mode = ixgbe_fc_none; | ||
1866 | hw_dbg(hw, "Flow Control = NONE.\n"); | ||
1788 | } | 1867 | } |
1789 | } else if (!(pcs_anadv_reg & IXGBE_PCS1GANA_SYM_PAUSE) && | ||
1790 | (pcs_anadv_reg & IXGBE_PCS1GANA_ASM_PAUSE) && | ||
1791 | (pcs_lpab_reg & IXGBE_PCS1GANA_SYM_PAUSE) && | ||
1792 | (pcs_lpab_reg & IXGBE_PCS1GANA_ASM_PAUSE)) { | ||
1793 | hw->fc.current_mode = ixgbe_fc_tx_pause; | ||
1794 | hw_dbg(hw, "Flow Control = TX PAUSE frames only.\n"); | ||
1795 | } else if ((pcs_anadv_reg & IXGBE_PCS1GANA_SYM_PAUSE) && | ||
1796 | (pcs_anadv_reg & IXGBE_PCS1GANA_ASM_PAUSE) && | ||
1797 | !(pcs_lpab_reg & IXGBE_PCS1GANA_SYM_PAUSE) && | ||
1798 | (pcs_lpab_reg & IXGBE_PCS1GANA_ASM_PAUSE)) { | ||
1799 | hw->fc.current_mode = ixgbe_fc_rx_pause; | ||
1800 | hw_dbg(hw, "Flow Control = RX PAUSE frames only.\n"); | ||
1801 | } else { | ||
1802 | hw->fc.current_mode = ixgbe_fc_none; | ||
1803 | hw_dbg(hw, "Flow Control = NONE.\n"); | ||
1804 | } | 1868 | } |
1805 | |||
1806 | /* Record that current_mode is the result of a successful autoneg */ | 1869 | /* Record that current_mode is the result of a successful autoneg */ |
1807 | hw->fc.fc_was_autonegged = true; | 1870 | hw->fc.fc_was_autonegged = true; |
1808 | 1871 | ||
@@ -1919,7 +1982,7 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
1919 | #endif /* CONFIG_DCB */ | 1982 | #endif /* CONFIG_DCB */ |
1920 | default: | 1983 | default: |
1921 | hw_dbg(hw, "Flow control param set incorrectly\n"); | 1984 | hw_dbg(hw, "Flow control param set incorrectly\n"); |
1922 | ret_val = -IXGBE_ERR_CONFIG; | 1985 | ret_val = IXGBE_ERR_CONFIG; |
1923 | goto out; | 1986 | goto out; |
1924 | break; | 1987 | break; |
1925 | } | 1988 | } |
@@ -1927,9 +1990,6 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
1927 | IXGBE_WRITE_REG(hw, IXGBE_PCS1GANA, reg); | 1990 | IXGBE_WRITE_REG(hw, IXGBE_PCS1GANA, reg); |
1928 | reg = IXGBE_READ_REG(hw, IXGBE_PCS1GLCTL); | 1991 | reg = IXGBE_READ_REG(hw, IXGBE_PCS1GLCTL); |
1929 | 1992 | ||
1930 | /* Enable and restart autoneg to inform the link partner */ | ||
1931 | reg |= IXGBE_PCS1GLCTL_AN_ENABLE | IXGBE_PCS1GLCTL_AN_RESTART; | ||
1932 | |||
1933 | /* Disable AN timeout */ | 1993 | /* Disable AN timeout */ |
1934 | if (hw->fc.strict_ieee) | 1994 | if (hw->fc.strict_ieee) |
1935 | reg &= ~IXGBE_PCS1GLCTL_AN_1G_TIMEOUT_EN; | 1995 | reg &= ~IXGBE_PCS1GLCTL_AN_1G_TIMEOUT_EN; |
@@ -1937,6 +1997,70 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
1937 | IXGBE_WRITE_REG(hw, IXGBE_PCS1GLCTL, reg); | 1997 | IXGBE_WRITE_REG(hw, IXGBE_PCS1GLCTL, reg); |
1938 | hw_dbg(hw, "Set up FC; PCS1GLCTL = 0x%08X\n", reg); | 1998 | hw_dbg(hw, "Set up FC; PCS1GLCTL = 0x%08X\n", reg); |
1939 | 1999 | ||
2000 | /* | ||
2001 | * Set up the 10G flow control advertisement registers so the HW | ||
2002 | * can do fc autoneg once the cable is plugged in. If we end up | ||
2003 | * using 1g instead, this is harmless. | ||
2004 | */ | ||
2005 | reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); | ||
2006 | |||
2007 | /* | ||
2008 | * The possible values of fc.requested_mode are: | ||
2009 | * 0: Flow control is completely disabled | ||
2010 | * 1: Rx flow control is enabled (we can receive pause frames, | ||
2011 | * but not send pause frames). | ||
2012 | * 2: Tx flow control is enabled (we can send pause frames but | ||
2013 | * we do not support receiving pause frames). | ||
2014 | * 3: Both Rx and Tx flow control (symmetric) are enabled. | ||
2015 | * other: Invalid. | ||
2016 | */ | ||
2017 | switch (hw->fc.requested_mode) { | ||
2018 | case ixgbe_fc_none: | ||
2019 | /* Flow control completely disabled by software override. */ | ||
2020 | reg &= ~(IXGBE_AUTOC_SYM_PAUSE | IXGBE_AUTOC_ASM_PAUSE); | ||
2021 | break; | ||
2022 | case ixgbe_fc_rx_pause: | ||
2023 | /* | ||
2024 | * Rx Flow control is enabled and Tx Flow control is | ||
2025 | * disabled by software override. Since there really | ||
2026 | * isn't a way to advertise that we are capable of RX | ||
2027 | * Pause ONLY, we will advertise that we support both | ||
2028 | * symmetric and asymmetric Rx PAUSE. Later, we will | ||
2029 | * disable the adapter's ability to send PAUSE frames. | ||
2030 | */ | ||
2031 | reg |= (IXGBE_AUTOC_SYM_PAUSE | IXGBE_AUTOC_ASM_PAUSE); | ||
2032 | break; | ||
2033 | case ixgbe_fc_tx_pause: | ||
2034 | /* | ||
2035 | * Tx Flow control is enabled, and Rx Flow control is | ||
2036 | * disabled by software override. | ||
2037 | */ | ||
2038 | reg |= (IXGBE_AUTOC_ASM_PAUSE); | ||
2039 | reg &= ~(IXGBE_AUTOC_SYM_PAUSE); | ||
2040 | break; | ||
2041 | case ixgbe_fc_full: | ||
2042 | /* Flow control (both Rx and Tx) is enabled by SW override. */ | ||
2043 | reg |= (IXGBE_AUTOC_SYM_PAUSE | IXGBE_AUTOC_ASM_PAUSE); | ||
2044 | break; | ||
2045 | #ifdef CONFIG_DCB | ||
2046 | case ixgbe_fc_pfc: | ||
2047 | goto out; | ||
2048 | break; | ||
2049 | #endif /* CONFIG_DCB */ | ||
2050 | default: | ||
2051 | hw_dbg(hw, "Flow control param set incorrectly\n"); | ||
2052 | ret_val = IXGBE_ERR_CONFIG; | ||
2053 | goto out; | ||
2054 | break; | ||
2055 | } | ||
2056 | /* | ||
2057 | * AUTOC restart handles negotiation of 1G and 10G. There is | ||
2058 | * no need to set the PCS1GCTL register. | ||
2059 | */ | ||
2060 | reg |= IXGBE_AUTOC_AN_RESTART; | ||
2061 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, reg); | ||
2062 | hw_dbg(hw, "Set up FC; IXGBE_AUTOC = 0x%08X\n", reg); | ||
2063 | |||
1940 | out: | 2064 | out: |
1941 | return ret_val; | 2065 | return ret_val; |
1942 | } | 2066 | } |
@@ -2000,7 +2124,7 @@ s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask) | |||
2000 | 2124 | ||
2001 | while (timeout) { | 2125 | while (timeout) { |
2002 | if (ixgbe_get_eeprom_semaphore(hw)) | 2126 | if (ixgbe_get_eeprom_semaphore(hw)) |
2003 | return -IXGBE_ERR_SWFW_SYNC; | 2127 | return IXGBE_ERR_SWFW_SYNC; |
2004 | 2128 | ||
2005 | gssr = IXGBE_READ_REG(hw, IXGBE_GSSR); | 2129 | gssr = IXGBE_READ_REG(hw, IXGBE_GSSR); |
2006 | if (!(gssr & (fwmask | swmask))) | 2130 | if (!(gssr & (fwmask | swmask))) |
@@ -2017,7 +2141,7 @@ s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask) | |||
2017 | 2141 | ||
2018 | if (!timeout) { | 2142 | if (!timeout) { |
2019 | hw_dbg(hw, "Driver can't access resource, GSSR timeout.\n"); | 2143 | hw_dbg(hw, "Driver can't access resource, GSSR timeout.\n"); |
2020 | return -IXGBE_ERR_SWFW_SYNC; | 2144 | return IXGBE_ERR_SWFW_SYNC; |
2021 | } | 2145 | } |
2022 | 2146 | ||
2023 | gssr |= swmask; | 2147 | gssr |= swmask; |
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index 53b0a6680254..fa314cb005a4 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -53,6 +53,10 @@ static struct ixgbe_stats ixgbe_gstrings_stats[] = { | |||
53 | {"tx_packets", IXGBE_STAT(net_stats.tx_packets)}, | 53 | {"tx_packets", IXGBE_STAT(net_stats.tx_packets)}, |
54 | {"rx_bytes", IXGBE_STAT(net_stats.rx_bytes)}, | 54 | {"rx_bytes", IXGBE_STAT(net_stats.rx_bytes)}, |
55 | {"tx_bytes", IXGBE_STAT(net_stats.tx_bytes)}, | 55 | {"tx_bytes", IXGBE_STAT(net_stats.tx_bytes)}, |
56 | {"rx_pkts_nic", IXGBE_STAT(stats.gprc)}, | ||
57 | {"tx_pkts_nic", IXGBE_STAT(stats.gptc)}, | ||
58 | {"rx_bytes_nic", IXGBE_STAT(stats.gorc)}, | ||
59 | {"tx_bytes_nic", IXGBE_STAT(stats.gotc)}, | ||
56 | {"lsc_int", IXGBE_STAT(lsc_int)}, | 60 | {"lsc_int", IXGBE_STAT(lsc_int)}, |
57 | {"tx_busy", IXGBE_STAT(tx_busy)}, | 61 | {"tx_busy", IXGBE_STAT(tx_busy)}, |
58 | {"non_eop_descs", IXGBE_STAT(non_eop_descs)}, | 62 | {"non_eop_descs", IXGBE_STAT(non_eop_descs)}, |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index c407bd9de0dd..28fbb9d281f9 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -49,7 +49,7 @@ char ixgbe_driver_name[] = "ixgbe"; | |||
49 | static const char ixgbe_driver_string[] = | 49 | static const char ixgbe_driver_string[] = |
50 | "Intel(R) 10 Gigabit PCI Express Network Driver"; | 50 | "Intel(R) 10 Gigabit PCI Express Network Driver"; |
51 | 51 | ||
52 | #define DRV_VERSION "2.0.37-k2" | 52 | #define DRV_VERSION "2.0.44-k2" |
53 | const char ixgbe_driver_version[] = DRV_VERSION; | 53 | const char ixgbe_driver_version[] = DRV_VERSION; |
54 | static char ixgbe_copyright[] = "Copyright (c) 1999-2009 Intel Corporation."; | 54 | static char ixgbe_copyright[] = "Copyright (c) 1999-2009 Intel Corporation."; |
55 | 55 | ||
@@ -1885,12 +1885,29 @@ static void ixgbe_configure_tx(struct ixgbe_adapter *adapter) | |||
1885 | IXGBE_WRITE_REG(hw, IXGBE_TDT(j), 0); | 1885 | IXGBE_WRITE_REG(hw, IXGBE_TDT(j), 0); |
1886 | adapter->tx_ring[i].head = IXGBE_TDH(j); | 1886 | adapter->tx_ring[i].head = IXGBE_TDH(j); |
1887 | adapter->tx_ring[i].tail = IXGBE_TDT(j); | 1887 | adapter->tx_ring[i].tail = IXGBE_TDT(j); |
1888 | /* Disable Tx Head Writeback RO bit, since this hoses | 1888 | /* |
1889 | * Disable Tx Head Writeback RO bit, since this hoses | ||
1889 | * bookkeeping if things aren't delivered in order. | 1890 | * bookkeeping if things aren't delivered in order. |
1890 | */ | 1891 | */ |
1891 | txctrl = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL(j)); | 1892 | switch (hw->mac.type) { |
1893 | case ixgbe_mac_82598EB: | ||
1894 | txctrl = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL(j)); | ||
1895 | break; | ||
1896 | case ixgbe_mac_82599EB: | ||
1897 | default: | ||
1898 | txctrl = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL_82599(j)); | ||
1899 | break; | ||
1900 | } | ||
1892 | txctrl &= ~IXGBE_DCA_TXCTRL_TX_WB_RO_EN; | 1901 | txctrl &= ~IXGBE_DCA_TXCTRL_TX_WB_RO_EN; |
1893 | IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL(j), txctrl); | 1902 | switch (hw->mac.type) { |
1903 | case ixgbe_mac_82598EB: | ||
1904 | IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL(j), txctrl); | ||
1905 | break; | ||
1906 | case ixgbe_mac_82599EB: | ||
1907 | default: | ||
1908 | IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL_82599(j), txctrl); | ||
1909 | break; | ||
1910 | } | ||
1894 | } | 1911 | } |
1895 | if (hw->mac.type == ixgbe_mac_82599EB) { | 1912 | if (hw->mac.type == ixgbe_mac_82599EB) { |
1896 | /* We enable 8 traffic classes, DCB only */ | 1913 | /* We enable 8 traffic classes, DCB only */ |
@@ -4432,10 +4449,13 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter) | |||
4432 | 4449 | ||
4433 | /* 82598 hardware only has a 32 bit counter in the high register */ | 4450 | /* 82598 hardware only has a 32 bit counter in the high register */ |
4434 | if (hw->mac.type == ixgbe_mac_82599EB) { | 4451 | if (hw->mac.type == ixgbe_mac_82599EB) { |
4452 | u64 tmp; | ||
4435 | adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GORCL); | 4453 | adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GORCL); |
4436 | IXGBE_READ_REG(hw, IXGBE_GORCH); /* to clear */ | 4454 | tmp = IXGBE_READ_REG(hw, IXGBE_GORCH) & 0xF; /* 4 high bits of GORC */ |
4455 | adapter->stats.gorc += (tmp << 32); | ||
4437 | adapter->stats.gotc += IXGBE_READ_REG(hw, IXGBE_GOTCL); | 4456 | adapter->stats.gotc += IXGBE_READ_REG(hw, IXGBE_GOTCL); |
4438 | IXGBE_READ_REG(hw, IXGBE_GOTCH); /* to clear */ | 4457 | tmp = IXGBE_READ_REG(hw, IXGBE_GOTCH) & 0xF; /* 4 high bits of GOTC */ |
4458 | adapter->stats.gotc += (tmp << 32); | ||
4439 | adapter->stats.tor += IXGBE_READ_REG(hw, IXGBE_TORL); | 4459 | adapter->stats.tor += IXGBE_READ_REG(hw, IXGBE_TORL); |
4440 | IXGBE_READ_REG(hw, IXGBE_TORH); /* to clear */ | 4460 | IXGBE_READ_REG(hw, IXGBE_TORH); /* to clear */ |
4441 | adapter->stats.lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXCNT); | 4461 | adapter->stats.lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXCNT); |
@@ -5071,7 +5091,6 @@ static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb, | |||
5071 | /* Right now, we support IPv4 only */ | 5091 | /* Right now, we support IPv4 only */ |
5072 | struct ixgbe_atr_input atr_input; | 5092 | struct ixgbe_atr_input atr_input; |
5073 | struct tcphdr *th; | 5093 | struct tcphdr *th; |
5074 | struct udphdr *uh; | ||
5075 | struct iphdr *iph = ip_hdr(skb); | 5094 | struct iphdr *iph = ip_hdr(skb); |
5076 | struct ethhdr *eth = (struct ethhdr *)skb->data; | 5095 | struct ethhdr *eth = (struct ethhdr *)skb->data; |
5077 | u16 vlan_id, src_port, dst_port, flex_bytes; | 5096 | u16 vlan_id, src_port, dst_port, flex_bytes; |
@@ -5085,12 +5104,6 @@ static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb, | |||
5085 | dst_port = th->dest; | 5104 | dst_port = th->dest; |
5086 | l4type |= IXGBE_ATR_L4TYPE_TCP; | 5105 | l4type |= IXGBE_ATR_L4TYPE_TCP; |
5087 | /* l4type IPv4 type is 0, no need to assign */ | 5106 | /* l4type IPv4 type is 0, no need to assign */ |
5088 | } else if(iph->protocol == IPPROTO_UDP) { | ||
5089 | uh = udp_hdr(skb); | ||
5090 | src_port = uh->source; | ||
5091 | dst_port = uh->dest; | ||
5092 | l4type |= IXGBE_ATR_L4TYPE_UDP; | ||
5093 | /* l4type IPv4 type is 0, no need to assign */ | ||
5094 | } else { | 5107 | } else { |
5095 | /* Unsupported L4 header, just bail here */ | 5108 | /* Unsupported L4 header, just bail here */ |
5096 | return; | 5109 | return; |
@@ -5494,12 +5507,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
5494 | goto err_pci_reg; | 5507 | goto err_pci_reg; |
5495 | } | 5508 | } |
5496 | 5509 | ||
5497 | err = pci_enable_pcie_error_reporting(pdev); | 5510 | pci_enable_pcie_error_reporting(pdev); |
5498 | if (err) { | ||
5499 | dev_err(&pdev->dev, "pci_enable_pcie_error_reporting failed " | ||
5500 | "0x%x\n", err); | ||
5501 | /* non-fatal, continue */ | ||
5502 | } | ||
5503 | 5511 | ||
5504 | pci_set_master(pdev); | 5512 | pci_set_master(pdev); |
5505 | pci_save_state(pdev); | 5513 | pci_save_state(pdev); |
@@ -5808,7 +5816,6 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev) | |||
5808 | { | 5816 | { |
5809 | struct net_device *netdev = pci_get_drvdata(pdev); | 5817 | struct net_device *netdev = pci_get_drvdata(pdev); |
5810 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 5818 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
5811 | int err; | ||
5812 | 5819 | ||
5813 | set_bit(__IXGBE_DOWN, &adapter->state); | 5820 | set_bit(__IXGBE_DOWN, &adapter->state); |
5814 | /* clear the module not found bit to make sure the worker won't | 5821 | /* clear the module not found bit to make sure the worker won't |
@@ -5859,10 +5866,7 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev) | |||
5859 | 5866 | ||
5860 | free_netdev(netdev); | 5867 | free_netdev(netdev); |
5861 | 5868 | ||
5862 | err = pci_disable_pcie_error_reporting(pdev); | 5869 | pci_disable_pcie_error_reporting(pdev); |
5863 | if (err) | ||
5864 | dev_err(&pdev->dev, | ||
5865 | "pci_disable_pcie_error_reporting failed 0x%x\n", err); | ||
5866 | 5870 | ||
5867 | pci_disable_device(pdev); | 5871 | pci_disable_device(pdev); |
5868 | } | 5872 | } |
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h index 8761d7899f7d..7c93e923bf2e 100644 --- a/drivers/net/ixgbe/ixgbe_type.h +++ b/drivers/net/ixgbe/ixgbe_type.h | |||
@@ -1336,6 +1336,8 @@ | |||
1336 | #define IXGBE_AUTOC_KX4_SUPP 0x80000000 | 1336 | #define IXGBE_AUTOC_KX4_SUPP 0x80000000 |
1337 | #define IXGBE_AUTOC_KX_SUPP 0x40000000 | 1337 | #define IXGBE_AUTOC_KX_SUPP 0x40000000 |
1338 | #define IXGBE_AUTOC_PAUSE 0x30000000 | 1338 | #define IXGBE_AUTOC_PAUSE 0x30000000 |
1339 | #define IXGBE_AUTOC_ASM_PAUSE 0x20000000 | ||
1340 | #define IXGBE_AUTOC_SYM_PAUSE 0x10000000 | ||
1339 | #define IXGBE_AUTOC_RF 0x08000000 | 1341 | #define IXGBE_AUTOC_RF 0x08000000 |
1340 | #define IXGBE_AUTOC_PD_TMR 0x06000000 | 1342 | #define IXGBE_AUTOC_PD_TMR 0x06000000 |
1341 | #define IXGBE_AUTOC_AN_RX_LOOSE 0x01000000 | 1343 | #define IXGBE_AUTOC_AN_RX_LOOSE 0x01000000 |
@@ -1404,6 +1406,8 @@ | |||
1404 | #define IXGBE_LINK_UP_TIME 90 /* 9.0 Seconds */ | 1406 | #define IXGBE_LINK_UP_TIME 90 /* 9.0 Seconds */ |
1405 | #define IXGBE_AUTO_NEG_TIME 45 /* 4.5 Seconds */ | 1407 | #define IXGBE_AUTO_NEG_TIME 45 /* 4.5 Seconds */ |
1406 | 1408 | ||
1409 | #define IXGBE_LINKS2_AN_SUPPORTED 0x00000040 | ||
1410 | |||
1407 | /* PCS1GLSTA Bit Masks */ | 1411 | /* PCS1GLSTA Bit Masks */ |
1408 | #define IXGBE_PCS1GLSTA_LINK_OK 1 | 1412 | #define IXGBE_PCS1GLSTA_LINK_OK 1 |
1409 | #define IXGBE_PCS1GLSTA_SYNK_OK 0x10 | 1413 | #define IXGBE_PCS1GLSTA_SYNK_OK 0x10 |
@@ -1424,6 +1428,11 @@ | |||
1424 | #define IXGBE_PCS1GLCTL_AN_ENABLE 0x10000 | 1428 | #define IXGBE_PCS1GLCTL_AN_ENABLE 0x10000 |
1425 | #define IXGBE_PCS1GLCTL_AN_RESTART 0x20000 | 1429 | #define IXGBE_PCS1GLCTL_AN_RESTART 0x20000 |
1426 | 1430 | ||
1431 | /* ANLP1 Bit Masks */ | ||
1432 | #define IXGBE_ANLP1_PAUSE 0x0C00 | ||
1433 | #define IXGBE_ANLP1_SYM_PAUSE 0x0400 | ||
1434 | #define IXGBE_ANLP1_ASM_PAUSE 0x0800 | ||
1435 | |||
1427 | /* SW Semaphore Register bitmasks */ | 1436 | /* SW Semaphore Register bitmasks */ |
1428 | #define IXGBE_SWSM_SMBI 0x00000001 /* Driver Semaphore bit */ | 1437 | #define IXGBE_SWSM_SMBI 0x00000001 /* Driver Semaphore bit */ |
1429 | #define IXGBE_SWSM_SWESMBI 0x00000002 /* FW Semaphore bit */ | 1438 | #define IXGBE_SWSM_SWESMBI 0x00000002 /* FW Semaphore bit */ |
diff --git a/drivers/net/ks8851_mll.c b/drivers/net/ks8851_mll.c new file mode 100644 index 000000000000..0be14d702beb --- /dev/null +++ b/drivers/net/ks8851_mll.c | |||
@@ -0,0 +1,1697 @@ | |||
1 | /** | ||
2 | * drivers/net/ks8851_mll.c | ||
3 | * Copyright (c) 2009 Micrel Inc. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
17 | */ | ||
18 | |||
19 | /** | ||
20 | * Supports: | ||
21 | * KS8851 16bit MLL chip from Micrel Inc. | ||
22 | */ | ||
23 | |||
24 | #include <linux/module.h> | ||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/netdevice.h> | ||
27 | #include <linux/etherdevice.h> | ||
28 | #include <linux/ethtool.h> | ||
29 | #include <linux/cache.h> | ||
30 | #include <linux/crc32.h> | ||
31 | #include <linux/mii.h> | ||
32 | #include <linux/platform_device.h> | ||
33 | #include <linux/delay.h> | ||
34 | |||
35 | #define DRV_NAME "ks8851_mll" | ||
36 | |||
37 | static u8 KS_DEFAULT_MAC_ADDRESS[] = { 0x00, 0x10, 0xA1, 0x86, 0x95, 0x11 }; | ||
38 | #define MAX_RECV_FRAMES 32 | ||
39 | #define MAX_BUF_SIZE 2048 | ||
40 | #define TX_BUF_SIZE 2000 | ||
41 | #define RX_BUF_SIZE 2000 | ||
42 | |||
43 | #define KS_CCR 0x08 | ||
44 | #define CCR_EEPROM (1 << 9) | ||
45 | #define CCR_SPI (1 << 8) | ||
46 | #define CCR_8BIT (1 << 7) | ||
47 | #define CCR_16BIT (1 << 6) | ||
48 | #define CCR_32BIT (1 << 5) | ||
49 | #define CCR_SHARED (1 << 4) | ||
50 | #define CCR_32PIN (1 << 0) | ||
51 | |||
52 | /* MAC address registers */ | ||
53 | #define KS_MARL 0x10 | ||
54 | #define KS_MARM 0x12 | ||
55 | #define KS_MARH 0x14 | ||
56 | |||
57 | #define KS_OBCR 0x20 | ||
58 | #define OBCR_ODS_16MA (1 << 6) | ||
59 | |||
60 | #define KS_EEPCR 0x22 | ||
61 | #define EEPCR_EESA (1 << 4) | ||
62 | #define EEPCR_EESB (1 << 3) | ||
63 | #define EEPCR_EEDO (1 << 2) | ||
64 | #define EEPCR_EESCK (1 << 1) | ||
65 | #define EEPCR_EECS (1 << 0) | ||
66 | |||
67 | #define KS_MBIR 0x24 | ||
68 | #define MBIR_TXMBF (1 << 12) | ||
69 | #define MBIR_TXMBFA (1 << 11) | ||
70 | #define MBIR_RXMBF (1 << 4) | ||
71 | #define MBIR_RXMBFA (1 << 3) | ||
72 | |||
73 | #define KS_GRR 0x26 | ||
74 | #define GRR_QMU (1 << 1) | ||
75 | #define GRR_GSR (1 << 0) | ||
76 | |||
77 | #define KS_WFCR 0x2A | ||
78 | #define WFCR_MPRXE (1 << 7) | ||
79 | #define WFCR_WF3E (1 << 3) | ||
80 | #define WFCR_WF2E (1 << 2) | ||
81 | #define WFCR_WF1E (1 << 1) | ||
82 | #define WFCR_WF0E (1 << 0) | ||
83 | |||
84 | #define KS_WF0CRC0 0x30 | ||
85 | #define KS_WF0CRC1 0x32 | ||
86 | #define KS_WF0BM0 0x34 | ||
87 | #define KS_WF0BM1 0x36 | ||
88 | #define KS_WF0BM2 0x38 | ||
89 | #define KS_WF0BM3 0x3A | ||
90 | |||
91 | #define KS_WF1CRC0 0x40 | ||
92 | #define KS_WF1CRC1 0x42 | ||
93 | #define KS_WF1BM0 0x44 | ||
94 | #define KS_WF1BM1 0x46 | ||
95 | #define KS_WF1BM2 0x48 | ||
96 | #define KS_WF1BM3 0x4A | ||
97 | |||
98 | #define KS_WF2CRC0 0x50 | ||
99 | #define KS_WF2CRC1 0x52 | ||
100 | #define KS_WF2BM0 0x54 | ||
101 | #define KS_WF2BM1 0x56 | ||
102 | #define KS_WF2BM2 0x58 | ||
103 | #define KS_WF2BM3 0x5A | ||
104 | |||
105 | #define KS_WF3CRC0 0x60 | ||
106 | #define KS_WF3CRC1 0x62 | ||
107 | #define KS_WF3BM0 0x64 | ||
108 | #define KS_WF3BM1 0x66 | ||
109 | #define KS_WF3BM2 0x68 | ||
110 | #define KS_WF3BM3 0x6A | ||
111 | |||
112 | #define KS_TXCR 0x70 | ||
113 | #define TXCR_TCGICMP (1 << 8) | ||
114 | #define TXCR_TCGUDP (1 << 7) | ||
115 | #define TXCR_TCGTCP (1 << 6) | ||
116 | #define TXCR_TCGIP (1 << 5) | ||
117 | #define TXCR_FTXQ (1 << 4) | ||
118 | #define TXCR_TXFCE (1 << 3) | ||
119 | #define TXCR_TXPE (1 << 2) | ||
120 | #define TXCR_TXCRC (1 << 1) | ||
121 | #define TXCR_TXE (1 << 0) | ||
122 | |||
123 | #define KS_TXSR 0x72 | ||
124 | #define TXSR_TXLC (1 << 13) | ||
125 | #define TXSR_TXMC (1 << 12) | ||
126 | #define TXSR_TXFID_MASK (0x3f << 0) | ||
127 | #define TXSR_TXFID_SHIFT (0) | ||
128 | #define TXSR_TXFID_GET(_v) (((_v) >> 0) & 0x3f) | ||
129 | |||
130 | |||
131 | #define KS_RXCR1 0x74 | ||
132 | #define RXCR1_FRXQ (1 << 15) | ||
133 | #define RXCR1_RXUDPFCC (1 << 14) | ||
134 | #define RXCR1_RXTCPFCC (1 << 13) | ||
135 | #define RXCR1_RXIPFCC (1 << 12) | ||
136 | #define RXCR1_RXPAFMA (1 << 11) | ||
137 | #define RXCR1_RXFCE (1 << 10) | ||
138 | #define RXCR1_RXEFE (1 << 9) | ||
139 | #define RXCR1_RXMAFMA (1 << 8) | ||
140 | #define RXCR1_RXBE (1 << 7) | ||
141 | #define RXCR1_RXME (1 << 6) | ||
142 | #define RXCR1_RXUE (1 << 5) | ||
143 | #define RXCR1_RXAE (1 << 4) | ||
144 | #define RXCR1_RXINVF (1 << 1) | ||
145 | #define RXCR1_RXE (1 << 0) | ||
146 | #define RXCR1_FILTER_MASK (RXCR1_RXINVF | RXCR1_RXAE | \ | ||
147 | RXCR1_RXMAFMA | RXCR1_RXPAFMA) | ||
148 | |||
149 | #define KS_RXCR2 0x76 | ||
150 | #define RXCR2_SRDBL_MASK (0x7 << 5) | ||
151 | #define RXCR2_SRDBL_SHIFT (5) | ||
152 | #define RXCR2_SRDBL_4B (0x0 << 5) | ||
153 | #define RXCR2_SRDBL_8B (0x1 << 5) | ||
154 | #define RXCR2_SRDBL_16B (0x2 << 5) | ||
155 | #define RXCR2_SRDBL_32B (0x3 << 5) | ||
156 | /* #define RXCR2_SRDBL_FRAME (0x4 << 5) */ | ||
157 | #define RXCR2_IUFFP (1 << 4) | ||
158 | #define RXCR2_RXIUFCEZ (1 << 3) | ||
159 | #define RXCR2_UDPLFE (1 << 2) | ||
160 | #define RXCR2_RXICMPFCC (1 << 1) | ||
161 | #define RXCR2_RXSAF (1 << 0) | ||
162 | |||
163 | #define KS_TXMIR 0x78 | ||
164 | |||
165 | #define KS_RXFHSR 0x7C | ||
166 | #define RXFSHR_RXFV (1 << 15) | ||
167 | #define RXFSHR_RXICMPFCS (1 << 13) | ||
168 | #define RXFSHR_RXIPFCS (1 << 12) | ||
169 | #define RXFSHR_RXTCPFCS (1 << 11) | ||
170 | #define RXFSHR_RXUDPFCS (1 << 10) | ||
171 | #define RXFSHR_RXBF (1 << 7) | ||
172 | #define RXFSHR_RXMF (1 << 6) | ||
173 | #define RXFSHR_RXUF (1 << 5) | ||
174 | #define RXFSHR_RXMR (1 << 4) | ||
175 | #define RXFSHR_RXFT (1 << 3) | ||
176 | #define RXFSHR_RXFTL (1 << 2) | ||
177 | #define RXFSHR_RXRF (1 << 1) | ||
178 | #define RXFSHR_RXCE (1 << 0) | ||
179 | #define RXFSHR_ERR (RXFSHR_RXCE | RXFSHR_RXRF |\ | ||
180 | RXFSHR_RXFTL | RXFSHR_RXMR |\ | ||
181 | RXFSHR_RXICMPFCS | RXFSHR_RXIPFCS |\ | ||
182 | RXFSHR_RXTCPFCS) | ||
183 | #define KS_RXFHBCR 0x7E | ||
184 | #define RXFHBCR_CNT_MASK 0x0FFF | ||
185 | |||
186 | #define KS_TXQCR 0x80 | ||
187 | #define TXQCR_AETFE (1 << 2) | ||
188 | #define TXQCR_TXQMAM (1 << 1) | ||
189 | #define TXQCR_METFE (1 << 0) | ||
190 | |||
191 | #define KS_RXQCR 0x82 | ||
192 | #define RXQCR_RXDTTS (1 << 12) | ||
193 | #define RXQCR_RXDBCTS (1 << 11) | ||
194 | #define RXQCR_RXFCTS (1 << 10) | ||
195 | #define RXQCR_RXIPHTOE (1 << 9) | ||
196 | #define RXQCR_RXDTTE (1 << 7) | ||
197 | #define RXQCR_RXDBCTE (1 << 6) | ||
198 | #define RXQCR_RXFCTE (1 << 5) | ||
199 | #define RXQCR_ADRFE (1 << 4) | ||
200 | #define RXQCR_SDA (1 << 3) | ||
201 | #define RXQCR_RRXEF (1 << 0) | ||
202 | #define RXQCR_CMD_CNTL (RXQCR_RXFCTE|RXQCR_ADRFE) | ||
203 | |||
204 | #define KS_TXFDPR 0x84 | ||
205 | #define TXFDPR_TXFPAI (1 << 14) | ||
206 | #define TXFDPR_TXFP_MASK (0x7ff << 0) | ||
207 | #define TXFDPR_TXFP_SHIFT (0) | ||
208 | |||
209 | #define KS_RXFDPR 0x86 | ||
210 | #define RXFDPR_RXFPAI (1 << 14) | ||
211 | |||
212 | #define KS_RXDTTR 0x8C | ||
213 | #define KS_RXDBCTR 0x8E | ||
214 | |||
215 | #define KS_IER 0x90 | ||
216 | #define KS_ISR 0x92 | ||
217 | #define IRQ_LCI (1 << 15) | ||
218 | #define IRQ_TXI (1 << 14) | ||
219 | #define IRQ_RXI (1 << 13) | ||
220 | #define IRQ_RXOI (1 << 11) | ||
221 | #define IRQ_TXPSI (1 << 9) | ||
222 | #define IRQ_RXPSI (1 << 8) | ||
223 | #define IRQ_TXSAI (1 << 6) | ||
224 | #define IRQ_RXWFDI (1 << 5) | ||
225 | #define IRQ_RXMPDI (1 << 4) | ||
226 | #define IRQ_LDI (1 << 3) | ||
227 | #define IRQ_EDI (1 << 2) | ||
228 | #define IRQ_SPIBEI (1 << 1) | ||
229 | #define IRQ_DEDI (1 << 0) | ||
230 | |||
231 | #define KS_RXFCTR 0x9C | ||
232 | #define RXFCTR_THRESHOLD_MASK 0x00FF | ||
233 | |||
234 | #define KS_RXFC 0x9D | ||
235 | #define RXFCTR_RXFC_MASK (0xff << 8) | ||
236 | #define RXFCTR_RXFC_SHIFT (8) | ||
237 | #define RXFCTR_RXFC_GET(_v) (((_v) >> 8) & 0xff) | ||
238 | #define RXFCTR_RXFCT_MASK (0xff << 0) | ||
239 | #define RXFCTR_RXFCT_SHIFT (0) | ||
240 | |||
241 | #define KS_TXNTFSR 0x9E | ||
242 | |||
243 | #define KS_MAHTR0 0xA0 | ||
244 | #define KS_MAHTR1 0xA2 | ||
245 | #define KS_MAHTR2 0xA4 | ||
246 | #define KS_MAHTR3 0xA6 | ||
247 | |||
248 | #define KS_FCLWR 0xB0 | ||
249 | #define KS_FCHWR 0xB2 | ||
250 | #define KS_FCOWR 0xB4 | ||
251 | |||
252 | #define KS_CIDER 0xC0 | ||
253 | #define CIDER_ID 0x8870 | ||
254 | #define CIDER_REV_MASK (0x7 << 1) | ||
255 | #define CIDER_REV_SHIFT (1) | ||
256 | #define CIDER_REV_GET(_v) (((_v) >> 1) & 0x7) | ||
257 | |||
258 | #define KS_CGCR 0xC6 | ||
259 | #define KS_IACR 0xC8 | ||
260 | #define IACR_RDEN (1 << 12) | ||
261 | #define IACR_TSEL_MASK (0x3 << 10) | ||
262 | #define IACR_TSEL_SHIFT (10) | ||
263 | #define IACR_TSEL_MIB (0x3 << 10) | ||
264 | #define IACR_ADDR_MASK (0x1f << 0) | ||
265 | #define IACR_ADDR_SHIFT (0) | ||
266 | |||
267 | #define KS_IADLR 0xD0 | ||
268 | #define KS_IAHDR 0xD2 | ||
269 | |||
270 | #define KS_PMECR 0xD4 | ||
271 | #define PMECR_PME_DELAY (1 << 14) | ||
272 | #define PMECR_PME_POL (1 << 12) | ||
273 | #define PMECR_WOL_WAKEUP (1 << 11) | ||
274 | #define PMECR_WOL_MAGICPKT (1 << 10) | ||
275 | #define PMECR_WOL_LINKUP (1 << 9) | ||
276 | #define PMECR_WOL_ENERGY (1 << 8) | ||
277 | #define PMECR_AUTO_WAKE_EN (1 << 7) | ||
278 | #define PMECR_WAKEUP_NORMAL (1 << 6) | ||
279 | #define PMECR_WKEVT_MASK (0xf << 2) | ||
280 | #define PMECR_WKEVT_SHIFT (2) | ||
281 | #define PMECR_WKEVT_GET(_v) (((_v) >> 2) & 0xf) | ||
282 | #define PMECR_WKEVT_ENERGY (0x1 << 2) | ||
283 | #define PMECR_WKEVT_LINK (0x2 << 2) | ||
284 | #define PMECR_WKEVT_MAGICPKT (0x4 << 2) | ||
285 | #define PMECR_WKEVT_FRAME (0x8 << 2) | ||
286 | #define PMECR_PM_MASK (0x3 << 0) | ||
287 | #define PMECR_PM_SHIFT (0) | ||
288 | #define PMECR_PM_NORMAL (0x0 << 0) | ||
289 | #define PMECR_PM_ENERGY (0x1 << 0) | ||
290 | #define PMECR_PM_SOFTDOWN (0x2 << 0) | ||
291 | #define PMECR_PM_POWERSAVE (0x3 << 0) | ||
292 | |||
293 | /* Standard MII PHY data */ | ||
294 | #define KS_P1MBCR 0xE4 | ||
295 | #define P1MBCR_FORCE_FDX (1 << 8) | ||
296 | |||
297 | #define KS_P1MBSR 0xE6 | ||
298 | #define P1MBSR_AN_COMPLETE (1 << 5) | ||
299 | #define P1MBSR_AN_CAPABLE (1 << 3) | ||
300 | #define P1MBSR_LINK_UP (1 << 2) | ||
301 | |||
302 | #define KS_PHY1ILR 0xE8 | ||
303 | #define KS_PHY1IHR 0xEA | ||
304 | #define KS_P1ANAR 0xEC | ||
305 | #define KS_P1ANLPR 0xEE | ||
306 | |||
307 | #define KS_P1SCLMD 0xF4 | ||
308 | #define P1SCLMD_LEDOFF (1 << 15) | ||
309 | #define P1SCLMD_TXIDS (1 << 14) | ||
310 | #define P1SCLMD_RESTARTAN (1 << 13) | ||
311 | #define P1SCLMD_DISAUTOMDIX (1 << 10) | ||
312 | #define P1SCLMD_FORCEMDIX (1 << 9) | ||
313 | #define P1SCLMD_AUTONEGEN (1 << 7) | ||
314 | #define P1SCLMD_FORCE100 (1 << 6) | ||
315 | #define P1SCLMD_FORCEFDX (1 << 5) | ||
316 | #define P1SCLMD_ADV_FLOW (1 << 4) | ||
317 | #define P1SCLMD_ADV_100BT_FDX (1 << 3) | ||
318 | #define P1SCLMD_ADV_100BT_HDX (1 << 2) | ||
319 | #define P1SCLMD_ADV_10BT_FDX (1 << 1) | ||
320 | #define P1SCLMD_ADV_10BT_HDX (1 << 0) | ||
321 | |||
322 | #define KS_P1CR 0xF6 | ||
323 | #define P1CR_HP_MDIX (1 << 15) | ||
324 | #define P1CR_REV_POL (1 << 13) | ||
325 | #define P1CR_OP_100M (1 << 10) | ||
326 | #define P1CR_OP_FDX (1 << 9) | ||
327 | #define P1CR_OP_MDI (1 << 7) | ||
328 | #define P1CR_AN_DONE (1 << 6) | ||
329 | #define P1CR_LINK_GOOD (1 << 5) | ||
330 | #define P1CR_PNTR_FLOW (1 << 4) | ||
331 | #define P1CR_PNTR_100BT_FDX (1 << 3) | ||
332 | #define P1CR_PNTR_100BT_HDX (1 << 2) | ||
333 | #define P1CR_PNTR_10BT_FDX (1 << 1) | ||
334 | #define P1CR_PNTR_10BT_HDX (1 << 0) | ||
335 | |||
336 | /* TX Frame control */ | ||
337 | |||
338 | #define TXFR_TXIC (1 << 15) | ||
339 | #define TXFR_TXFID_MASK (0x3f << 0) | ||
340 | #define TXFR_TXFID_SHIFT (0) | ||
341 | |||
342 | #define KS_P1SR 0xF8 | ||
343 | #define P1SR_HP_MDIX (1 << 15) | ||
344 | #define P1SR_REV_POL (1 << 13) | ||
345 | #define P1SR_OP_100M (1 << 10) | ||
346 | #define P1SR_OP_FDX (1 << 9) | ||
347 | #define P1SR_OP_MDI (1 << 7) | ||
348 | #define P1SR_AN_DONE (1 << 6) | ||
349 | #define P1SR_LINK_GOOD (1 << 5) | ||
350 | #define P1SR_PNTR_FLOW (1 << 4) | ||
351 | #define P1SR_PNTR_100BT_FDX (1 << 3) | ||
352 | #define P1SR_PNTR_100BT_HDX (1 << 2) | ||
353 | #define P1SR_PNTR_10BT_FDX (1 << 1) | ||
354 | #define P1SR_PNTR_10BT_HDX (1 << 0) | ||
355 | |||
356 | #define ENUM_BUS_NONE 0 | ||
357 | #define ENUM_BUS_8BIT 1 | ||
358 | #define ENUM_BUS_16BIT 2 | ||
359 | #define ENUM_BUS_32BIT 3 | ||
360 | |||
361 | #define MAX_MCAST_LST 32 | ||
362 | #define HW_MCAST_SIZE 8 | ||
363 | #define MAC_ADDR_LEN 6 | ||
364 | |||
365 | /** | ||
366 | * union ks_tx_hdr - tx header data | ||
367 | * @txb: The header as bytes | ||
368 | * @txw: The header as 16bit, little-endian words | ||
369 | * | ||
370 | * A dual representation of the tx header data to allow | ||
371 | * access to individual bytes, and to allow 16bit accesses | ||
372 | * with 16bit alignment. | ||
373 | */ | ||
374 | union ks_tx_hdr { | ||
375 | u8 txb[4]; | ||
376 | __le16 txw[2]; | ||
377 | }; | ||
378 | |||
379 | /** | ||
380 | * struct ks_net - KS8851 driver private data | ||
381 | * @net_device : The network device we're bound to | ||
382 | * @hw_addr : start address of data register. | ||
383 | * @hw_addr_cmd : start address of command register. | ||
384 | * @txh : temporaly buffer to save status/length. | ||
385 | * @lock : Lock to ensure that the device is not accessed when busy. | ||
386 | * @pdev : Pointer to platform device. | ||
387 | * @mii : The MII state information for the mii calls. | ||
388 | * @frame_head_info : frame header information for multi-pkt rx. | ||
389 | * @statelock : Lock on this structure for tx list. | ||
390 | * @msg_enable : The message flags controlling driver output (see ethtool). | ||
391 | * @frame_cnt : number of frames received. | ||
392 | * @bus_width : i/o bus width. | ||
393 | * @irq : irq number assigned to this device. | ||
394 | * @rc_rxqcr : Cached copy of KS_RXQCR. | ||
395 | * @rc_txcr : Cached copy of KS_TXCR. | ||
396 | * @rc_ier : Cached copy of KS_IER. | ||
397 | * @sharedbus : Multipex(addr and data bus) mode indicator. | ||
398 | * @cmd_reg_cache : command register cached. | ||
399 | * @cmd_reg_cache_int : command register cached. Used in the irq handler. | ||
400 | * @promiscuous : promiscuous mode indicator. | ||
401 | * @all_mcast : mutlicast indicator. | ||
402 | * @mcast_lst_size : size of multicast list. | ||
403 | * @mcast_lst : multicast list. | ||
404 | * @mcast_bits : multicast enabed. | ||
405 | * @mac_addr : MAC address assigned to this device. | ||
406 | * @fid : frame id. | ||
407 | * @extra_byte : number of extra byte prepended rx pkt. | ||
408 | * @enabled : indicator this device works. | ||
409 | * | ||
410 | * The @lock ensures that the chip is protected when certain operations are | ||
411 | * in progress. When the read or write packet transfer is in progress, most | ||
412 | * of the chip registers are not accessible until the transfer is finished and | ||
413 | * the DMA has been de-asserted. | ||
414 | * | ||
415 | * The @statelock is used to protect information in the structure which may | ||
416 | * need to be accessed via several sources, such as the network driver layer | ||
417 | * or one of the work queues. | ||
418 | * | ||
419 | */ | ||
420 | |||
421 | /* Receive multiplex framer header info */ | ||
422 | struct type_frame_head { | ||
423 | u16 sts; /* Frame status */ | ||
424 | u16 len; /* Byte count */ | ||
425 | }; | ||
426 | |||
427 | struct ks_net { | ||
428 | struct net_device *netdev; | ||
429 | void __iomem *hw_addr; | ||
430 | void __iomem *hw_addr_cmd; | ||
431 | union ks_tx_hdr txh ____cacheline_aligned; | ||
432 | struct mutex lock; /* spinlock to be interrupt safe */ | ||
433 | struct platform_device *pdev; | ||
434 | struct mii_if_info mii; | ||
435 | struct type_frame_head *frame_head_info; | ||
436 | spinlock_t statelock; | ||
437 | u32 msg_enable; | ||
438 | u32 frame_cnt; | ||
439 | int bus_width; | ||
440 | int irq; | ||
441 | |||
442 | u16 rc_rxqcr; | ||
443 | u16 rc_txcr; | ||
444 | u16 rc_ier; | ||
445 | u16 sharedbus; | ||
446 | u16 cmd_reg_cache; | ||
447 | u16 cmd_reg_cache_int; | ||
448 | u16 promiscuous; | ||
449 | u16 all_mcast; | ||
450 | u16 mcast_lst_size; | ||
451 | u8 mcast_lst[MAX_MCAST_LST][MAC_ADDR_LEN]; | ||
452 | u8 mcast_bits[HW_MCAST_SIZE]; | ||
453 | u8 mac_addr[6]; | ||
454 | u8 fid; | ||
455 | u8 extra_byte; | ||
456 | u8 enabled; | ||
457 | }; | ||
458 | |||
459 | static int msg_enable; | ||
460 | |||
461 | #define ks_info(_ks, _msg...) dev_info(&(_ks)->pdev->dev, _msg) | ||
462 | #define ks_warn(_ks, _msg...) dev_warn(&(_ks)->pdev->dev, _msg) | ||
463 | #define ks_dbg(_ks, _msg...) dev_dbg(&(_ks)->pdev->dev, _msg) | ||
464 | #define ks_err(_ks, _msg...) dev_err(&(_ks)->pdev->dev, _msg) | ||
465 | |||
466 | #define BE3 0x8000 /* Byte Enable 3 */ | ||
467 | #define BE2 0x4000 /* Byte Enable 2 */ | ||
468 | #define BE1 0x2000 /* Byte Enable 1 */ | ||
469 | #define BE0 0x1000 /* Byte Enable 0 */ | ||
470 | |||
471 | /** | ||
472 | * register read/write calls. | ||
473 | * | ||
474 | * All these calls issue transactions to access the chip's registers. They | ||
475 | * all require that the necessary lock is held to prevent accesses when the | ||
476 | * chip is busy transfering packet data (RX/TX FIFO accesses). | ||
477 | */ | ||
478 | |||
479 | /** | ||
480 | * ks_rdreg8 - read 8 bit register from device | ||
481 | * @ks : The chip information | ||
482 | * @offset: The register address | ||
483 | * | ||
484 | * Read a 8bit register from the chip, returning the result | ||
485 | */ | ||
486 | static u8 ks_rdreg8(struct ks_net *ks, int offset) | ||
487 | { | ||
488 | u16 data; | ||
489 | u8 shift_bit = offset & 0x03; | ||
490 | u8 shift_data = (offset & 1) << 3; | ||
491 | ks->cmd_reg_cache = (u16) offset | (u16)(BE0 << shift_bit); | ||
492 | iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd); | ||
493 | data = ioread16(ks->hw_addr); | ||
494 | return (u8)(data >> shift_data); | ||
495 | } | ||
496 | |||
497 | /** | ||
498 | * ks_rdreg16 - read 16 bit register from device | ||
499 | * @ks : The chip information | ||
500 | * @offset: The register address | ||
501 | * | ||
502 | * Read a 16bit register from the chip, returning the result | ||
503 | */ | ||
504 | |||
505 | static u16 ks_rdreg16(struct ks_net *ks, int offset) | ||
506 | { | ||
507 | ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02)); | ||
508 | iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd); | ||
509 | return ioread16(ks->hw_addr); | ||
510 | } | ||
511 | |||
512 | /** | ||
513 | * ks_wrreg8 - write 8bit register value to chip | ||
514 | * @ks: The chip information | ||
515 | * @offset: The register address | ||
516 | * @value: The value to write | ||
517 | * | ||
518 | */ | ||
519 | static void ks_wrreg8(struct ks_net *ks, int offset, u8 value) | ||
520 | { | ||
521 | u8 shift_bit = (offset & 0x03); | ||
522 | u16 value_write = (u16)(value << ((offset & 1) << 3)); | ||
523 | ks->cmd_reg_cache = (u16)offset | (BE0 << shift_bit); | ||
524 | iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd); | ||
525 | iowrite16(value_write, ks->hw_addr); | ||
526 | } | ||
527 | |||
528 | /** | ||
529 | * ks_wrreg16 - write 16bit register value to chip | ||
530 | * @ks: The chip information | ||
531 | * @offset: The register address | ||
532 | * @value: The value to write | ||
533 | * | ||
534 | */ | ||
535 | |||
536 | static void ks_wrreg16(struct ks_net *ks, int offset, u16 value) | ||
537 | { | ||
538 | ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02)); | ||
539 | iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd); | ||
540 | iowrite16(value, ks->hw_addr); | ||
541 | } | ||
542 | |||
543 | /** | ||
544 | * ks_inblk - read a block of data from QMU. This is called after sudo DMA mode enabled. | ||
545 | * @ks: The chip state | ||
546 | * @wptr: buffer address to save data | ||
547 | * @len: length in byte to read | ||
548 | * | ||
549 | */ | ||
550 | static inline void ks_inblk(struct ks_net *ks, u16 *wptr, u32 len) | ||
551 | { | ||
552 | len >>= 1; | ||
553 | while (len--) | ||
554 | *wptr++ = (u16)ioread16(ks->hw_addr); | ||
555 | } | ||
556 | |||
557 | /** | ||
558 | * ks_outblk - write data to QMU. This is called after sudo DMA mode enabled. | ||
559 | * @ks: The chip information | ||
560 | * @wptr: buffer address | ||
561 | * @len: length in byte to write | ||
562 | * | ||
563 | */ | ||
564 | static inline void ks_outblk(struct ks_net *ks, u16 *wptr, u32 len) | ||
565 | { | ||
566 | len >>= 1; | ||
567 | while (len--) | ||
568 | iowrite16(*wptr++, ks->hw_addr); | ||
569 | } | ||
570 | |||
571 | /** | ||
572 | * ks_tx_fifo_space - return the available hardware buffer size. | ||
573 | * @ks: The chip information | ||
574 | * | ||
575 | */ | ||
576 | static inline u16 ks_tx_fifo_space(struct ks_net *ks) | ||
577 | { | ||
578 | return ks_rdreg16(ks, KS_TXMIR) & 0x1fff; | ||
579 | } | ||
580 | |||
581 | /** | ||
582 | * ks_save_cmd_reg - save the command register from the cache. | ||
583 | * @ks: The chip information | ||
584 | * | ||
585 | */ | ||
586 | static inline void ks_save_cmd_reg(struct ks_net *ks) | ||
587 | { | ||
588 | /*ks8851 MLL has a bug to read back the command register. | ||
589 | * So rely on software to save the content of command register. | ||
590 | */ | ||
591 | ks->cmd_reg_cache_int = ks->cmd_reg_cache; | ||
592 | } | ||
593 | |||
594 | /** | ||
595 | * ks_restore_cmd_reg - restore the command register from the cache and | ||
596 | * write to hardware register. | ||
597 | * @ks: The chip information | ||
598 | * | ||
599 | */ | ||
600 | static inline void ks_restore_cmd_reg(struct ks_net *ks) | ||
601 | { | ||
602 | ks->cmd_reg_cache = ks->cmd_reg_cache_int; | ||
603 | iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd); | ||
604 | } | ||
605 | |||
606 | /** | ||
607 | * ks_set_powermode - set power mode of the device | ||
608 | * @ks: The chip information | ||
609 | * @pwrmode: The power mode value to write to KS_PMECR. | ||
610 | * | ||
611 | * Change the power mode of the chip. | ||
612 | */ | ||
613 | static void ks_set_powermode(struct ks_net *ks, unsigned pwrmode) | ||
614 | { | ||
615 | unsigned pmecr; | ||
616 | |||
617 | if (netif_msg_hw(ks)) | ||
618 | ks_dbg(ks, "setting power mode %d\n", pwrmode); | ||
619 | |||
620 | ks_rdreg16(ks, KS_GRR); | ||
621 | pmecr = ks_rdreg16(ks, KS_PMECR); | ||
622 | pmecr &= ~PMECR_PM_MASK; | ||
623 | pmecr |= pwrmode; | ||
624 | |||
625 | ks_wrreg16(ks, KS_PMECR, pmecr); | ||
626 | } | ||
627 | |||
628 | /** | ||
629 | * ks_read_config - read chip configuration of bus width. | ||
630 | * @ks: The chip information | ||
631 | * | ||
632 | */ | ||
633 | static void ks_read_config(struct ks_net *ks) | ||
634 | { | ||
635 | u16 reg_data = 0; | ||
636 | |||
637 | /* Regardless of bus width, 8 bit read should always work.*/ | ||
638 | reg_data = ks_rdreg8(ks, KS_CCR) & 0x00FF; | ||
639 | reg_data |= ks_rdreg8(ks, KS_CCR+1) << 8; | ||
640 | |||
641 | /* addr/data bus are multiplexed */ | ||
642 | ks->sharedbus = (reg_data & CCR_SHARED) == CCR_SHARED; | ||
643 | |||
644 | /* There are garbage data when reading data from QMU, | ||
645 | depending on bus-width. | ||
646 | */ | ||
647 | |||
648 | if (reg_data & CCR_8BIT) { | ||
649 | ks->bus_width = ENUM_BUS_8BIT; | ||
650 | ks->extra_byte = 1; | ||
651 | } else if (reg_data & CCR_16BIT) { | ||
652 | ks->bus_width = ENUM_BUS_16BIT; | ||
653 | ks->extra_byte = 2; | ||
654 | } else { | ||
655 | ks->bus_width = ENUM_BUS_32BIT; | ||
656 | ks->extra_byte = 4; | ||
657 | } | ||
658 | } | ||
659 | |||
660 | /** | ||
661 | * ks_soft_reset - issue one of the soft reset to the device | ||
662 | * @ks: The device state. | ||
663 | * @op: The bit(s) to set in the GRR | ||
664 | * | ||
665 | * Issue the relevant soft-reset command to the device's GRR register | ||
666 | * specified by @op. | ||
667 | * | ||
668 | * Note, the delays are in there as a caution to ensure that the reset | ||
669 | * has time to take effect and then complete. Since the datasheet does | ||
670 | * not currently specify the exact sequence, we have chosen something | ||
671 | * that seems to work with our device. | ||
672 | */ | ||
673 | static void ks_soft_reset(struct ks_net *ks, unsigned op) | ||
674 | { | ||
675 | /* Disable interrupt first */ | ||
676 | ks_wrreg16(ks, KS_IER, 0x0000); | ||
677 | ks_wrreg16(ks, KS_GRR, op); | ||
678 | mdelay(10); /* wait a short time to effect reset */ | ||
679 | ks_wrreg16(ks, KS_GRR, 0); | ||
680 | mdelay(1); /* wait for condition to clear */ | ||
681 | } | ||
682 | |||
683 | |||
684 | /** | ||
685 | * ks_read_qmu - read 1 pkt data from the QMU. | ||
686 | * @ks: The chip information | ||
687 | * @buf: buffer address to save 1 pkt | ||
688 | * @len: Pkt length | ||
689 | * Here is the sequence to read 1 pkt: | ||
690 | * 1. set sudo DMA mode | ||
691 | * 2. read prepend data | ||
692 | * 3. read pkt data | ||
693 | * 4. reset sudo DMA Mode | ||
694 | */ | ||
695 | static inline void ks_read_qmu(struct ks_net *ks, u16 *buf, u32 len) | ||
696 | { | ||
697 | u32 r = ks->extra_byte & 0x1 ; | ||
698 | u32 w = ks->extra_byte - r; | ||
699 | |||
700 | /* 1. set sudo DMA mode */ | ||
701 | ks_wrreg16(ks, KS_RXFDPR, RXFDPR_RXFPAI); | ||
702 | ks_wrreg8(ks, KS_RXQCR, (ks->rc_rxqcr | RXQCR_SDA) & 0xff); | ||
703 | |||
704 | /* 2. read prepend data */ | ||
705 | /** | ||
706 | * read 4 + extra bytes and discard them. | ||
707 | * extra bytes for dummy, 2 for status, 2 for len | ||
708 | */ | ||
709 | |||
710 | /* use likely(r) for 8 bit access for performance */ | ||
711 | if (unlikely(r)) | ||
712 | ioread8(ks->hw_addr); | ||
713 | ks_inblk(ks, buf, w + 2 + 2); | ||
714 | |||
715 | /* 3. read pkt data */ | ||
716 | ks_inblk(ks, buf, ALIGN(len, 4)); | ||
717 | |||
718 | /* 4. reset sudo DMA Mode */ | ||
719 | ks_wrreg8(ks, KS_RXQCR, ks->rc_rxqcr); | ||
720 | } | ||
721 | |||
722 | /** | ||
723 | * ks_rcv - read multiple pkts data from the QMU. | ||
724 | * @ks: The chip information | ||
725 | * @netdev: The network device being opened. | ||
726 | * | ||
727 | * Read all of header information before reading pkt content. | ||
728 | * It is not allowed only port of pkts in QMU after issuing | ||
729 | * interrupt ack. | ||
730 | */ | ||
731 | static void ks_rcv(struct ks_net *ks, struct net_device *netdev) | ||
732 | { | ||
733 | u32 i; | ||
734 | struct type_frame_head *frame_hdr = ks->frame_head_info; | ||
735 | struct sk_buff *skb; | ||
736 | |||
737 | ks->frame_cnt = ks_rdreg16(ks, KS_RXFCTR) >> 8; | ||
738 | |||
739 | /* read all header information */ | ||
740 | for (i = 0; i < ks->frame_cnt; i++) { | ||
741 | /* Checking Received packet status */ | ||
742 | frame_hdr->sts = ks_rdreg16(ks, KS_RXFHSR); | ||
743 | /* Get packet len from hardware */ | ||
744 | frame_hdr->len = ks_rdreg16(ks, KS_RXFHBCR); | ||
745 | frame_hdr++; | ||
746 | } | ||
747 | |||
748 | frame_hdr = ks->frame_head_info; | ||
749 | while (ks->frame_cnt--) { | ||
750 | skb = dev_alloc_skb(frame_hdr->len + 16); | ||
751 | if (likely(skb && (frame_hdr->sts & RXFSHR_RXFV) && | ||
752 | (frame_hdr->len < RX_BUF_SIZE) && frame_hdr->len)) { | ||
753 | skb_reserve(skb, 2); | ||
754 | /* read data block including CRC 4 bytes */ | ||
755 | ks_read_qmu(ks, (u16 *)skb->data, frame_hdr->len + 4); | ||
756 | skb_put(skb, frame_hdr->len); | ||
757 | skb->dev = netdev; | ||
758 | skb->protocol = eth_type_trans(skb, netdev); | ||
759 | netif_rx(skb); | ||
760 | } else { | ||
761 | printk(KERN_ERR "%s: err:skb alloc\n", __func__); | ||
762 | ks_wrreg16(ks, KS_RXQCR, (ks->rc_rxqcr | RXQCR_RRXEF)); | ||
763 | if (skb) | ||
764 | dev_kfree_skb_irq(skb); | ||
765 | } | ||
766 | frame_hdr++; | ||
767 | } | ||
768 | } | ||
769 | |||
770 | /** | ||
771 | * ks_update_link_status - link status update. | ||
772 | * @netdev: The network device being opened. | ||
773 | * @ks: The chip information | ||
774 | * | ||
775 | */ | ||
776 | |||
777 | static void ks_update_link_status(struct net_device *netdev, struct ks_net *ks) | ||
778 | { | ||
779 | /* check the status of the link */ | ||
780 | u32 link_up_status; | ||
781 | if (ks_rdreg16(ks, KS_P1SR) & P1SR_LINK_GOOD) { | ||
782 | netif_carrier_on(netdev); | ||
783 | link_up_status = true; | ||
784 | } else { | ||
785 | netif_carrier_off(netdev); | ||
786 | link_up_status = false; | ||
787 | } | ||
788 | if (netif_msg_link(ks)) | ||
789 | ks_dbg(ks, "%s: %s\n", | ||
790 | __func__, link_up_status ? "UP" : "DOWN"); | ||
791 | } | ||
792 | |||
793 | /** | ||
794 | * ks_irq - device interrupt handler | ||
795 | * @irq: Interrupt number passed from the IRQ hnalder. | ||
796 | * @pw: The private word passed to register_irq(), our struct ks_net. | ||
797 | * | ||
798 | * This is the handler invoked to find out what happened | ||
799 | * | ||
800 | * Read the interrupt status, work out what needs to be done and then clear | ||
801 | * any of the interrupts that are not needed. | ||
802 | */ | ||
803 | |||
804 | static irqreturn_t ks_irq(int irq, void *pw) | ||
805 | { | ||
806 | struct ks_net *ks = pw; | ||
807 | struct net_device *netdev = ks->netdev; | ||
808 | u16 status; | ||
809 | |||
810 | /*this should be the first in IRQ handler */ | ||
811 | ks_save_cmd_reg(ks); | ||
812 | |||
813 | status = ks_rdreg16(ks, KS_ISR); | ||
814 | if (unlikely(!status)) { | ||
815 | ks_restore_cmd_reg(ks); | ||
816 | return IRQ_NONE; | ||
817 | } | ||
818 | |||
819 | ks_wrreg16(ks, KS_ISR, status); | ||
820 | |||
821 | if (likely(status & IRQ_RXI)) | ||
822 | ks_rcv(ks, netdev); | ||
823 | |||
824 | if (unlikely(status & IRQ_LCI)) | ||
825 | ks_update_link_status(netdev, ks); | ||
826 | |||
827 | if (unlikely(status & IRQ_TXI)) | ||
828 | netif_wake_queue(netdev); | ||
829 | |||
830 | if (unlikely(status & IRQ_LDI)) { | ||
831 | |||
832 | u16 pmecr = ks_rdreg16(ks, KS_PMECR); | ||
833 | pmecr &= ~PMECR_WKEVT_MASK; | ||
834 | ks_wrreg16(ks, KS_PMECR, pmecr | PMECR_WKEVT_LINK); | ||
835 | } | ||
836 | |||
837 | /* this should be the last in IRQ handler*/ | ||
838 | ks_restore_cmd_reg(ks); | ||
839 | return IRQ_HANDLED; | ||
840 | } | ||
841 | |||
842 | |||
843 | /** | ||
844 | * ks_net_open - open network device | ||
845 | * @netdev: The network device being opened. | ||
846 | * | ||
847 | * Called when the network device is marked active, such as a user executing | ||
848 | * 'ifconfig up' on the device. | ||
849 | */ | ||
850 | static int ks_net_open(struct net_device *netdev) | ||
851 | { | ||
852 | struct ks_net *ks = netdev_priv(netdev); | ||
853 | int err; | ||
854 | |||
855 | #define KS_INT_FLAGS (IRQF_DISABLED|IRQF_TRIGGER_LOW) | ||
856 | /* lock the card, even if we may not actually do anything | ||
857 | * else at the moment. | ||
858 | */ | ||
859 | |||
860 | if (netif_msg_ifup(ks)) | ||
861 | ks_dbg(ks, "%s - entry\n", __func__); | ||
862 | |||
863 | /* reset the HW */ | ||
864 | err = request_irq(ks->irq, ks_irq, KS_INT_FLAGS, DRV_NAME, ks); | ||
865 | |||
866 | if (err) { | ||
867 | printk(KERN_ERR "Failed to request IRQ: %d: %d\n", | ||
868 | ks->irq, err); | ||
869 | return err; | ||
870 | } | ||
871 | |||
872 | if (netif_msg_ifup(ks)) | ||
873 | ks_dbg(ks, "network device %s up\n", netdev->name); | ||
874 | |||
875 | return 0; | ||
876 | } | ||
877 | |||
878 | /** | ||
879 | * ks_net_stop - close network device | ||
880 | * @netdev: The device being closed. | ||
881 | * | ||
882 | * Called to close down a network device which has been active. Cancell any | ||
883 | * work, shutdown the RX and TX process and then place the chip into a low | ||
884 | * power state whilst it is not being used. | ||
885 | */ | ||
886 | static int ks_net_stop(struct net_device *netdev) | ||
887 | { | ||
888 | struct ks_net *ks = netdev_priv(netdev); | ||
889 | |||
890 | if (netif_msg_ifdown(ks)) | ||
891 | ks_info(ks, "%s: shutting down\n", netdev->name); | ||
892 | |||
893 | netif_stop_queue(netdev); | ||
894 | |||
895 | kfree(ks->frame_head_info); | ||
896 | |||
897 | mutex_lock(&ks->lock); | ||
898 | |||
899 | /* turn off the IRQs and ack any outstanding */ | ||
900 | ks_wrreg16(ks, KS_IER, 0x0000); | ||
901 | ks_wrreg16(ks, KS_ISR, 0xffff); | ||
902 | |||
903 | /* shutdown RX process */ | ||
904 | ks_wrreg16(ks, KS_RXCR1, 0x0000); | ||
905 | |||
906 | /* shutdown TX process */ | ||
907 | ks_wrreg16(ks, KS_TXCR, 0x0000); | ||
908 | |||
909 | /* set powermode to soft power down to save power */ | ||
910 | ks_set_powermode(ks, PMECR_PM_SOFTDOWN); | ||
911 | free_irq(ks->irq, netdev); | ||
912 | mutex_unlock(&ks->lock); | ||
913 | return 0; | ||
914 | } | ||
915 | |||
916 | |||
917 | /** | ||
918 | * ks_write_qmu - write 1 pkt data to the QMU. | ||
919 | * @ks: The chip information | ||
920 | * @pdata: buffer address to save 1 pkt | ||
921 | * @len: Pkt length in byte | ||
922 | * Here is the sequence to write 1 pkt: | ||
923 | * 1. set sudo DMA mode | ||
924 | * 2. write status/length | ||
925 | * 3. write pkt data | ||
926 | * 4. reset sudo DMA Mode | ||
927 | * 5. reset sudo DMA mode | ||
928 | * 6. Wait until pkt is out | ||
929 | */ | ||
930 | static void ks_write_qmu(struct ks_net *ks, u8 *pdata, u16 len) | ||
931 | { | ||
932 | unsigned fid = ks->fid; | ||
933 | |||
934 | fid = ks->fid; | ||
935 | ks->fid = (ks->fid + 1) & TXFR_TXFID_MASK; | ||
936 | |||
937 | /* reduce the tx interrupt occurrances. */ | ||
938 | if (!fid) | ||
939 | fid |= TXFR_TXIC; /* irq on completion */ | ||
940 | |||
941 | /* start header at txb[0] to align txw entries */ | ||
942 | ks->txh.txw[0] = cpu_to_le16(fid); | ||
943 | ks->txh.txw[1] = cpu_to_le16(len); | ||
944 | |||
945 | /* 1. set sudo-DMA mode */ | ||
946 | ks_wrreg8(ks, KS_RXQCR, (ks->rc_rxqcr | RXQCR_SDA) & 0xff); | ||
947 | /* 2. write status/lenth info */ | ||
948 | ks_outblk(ks, ks->txh.txw, 4); | ||
949 | /* 3. write pkt data */ | ||
950 | ks_outblk(ks, (u16 *)pdata, ALIGN(len, 4)); | ||
951 | /* 4. reset sudo-DMA mode */ | ||
952 | ks_wrreg8(ks, KS_RXQCR, ks->rc_rxqcr); | ||
953 | /* 5. Enqueue Tx(move the pkt from TX buffer into TXQ) */ | ||
954 | ks_wrreg16(ks, KS_TXQCR, TXQCR_METFE); | ||
955 | /* 6. wait until TXQCR_METFE is auto-cleared */ | ||
956 | while (ks_rdreg16(ks, KS_TXQCR) & TXQCR_METFE) | ||
957 | ; | ||
958 | } | ||
959 | |||
960 | static void ks_disable_int(struct ks_net *ks) | ||
961 | { | ||
962 | ks_wrreg16(ks, KS_IER, 0x0000); | ||
963 | } /* ks_disable_int */ | ||
964 | |||
965 | static void ks_enable_int(struct ks_net *ks) | ||
966 | { | ||
967 | ks_wrreg16(ks, KS_IER, ks->rc_ier); | ||
968 | } /* ks_enable_int */ | ||
969 | |||
970 | /** | ||
971 | * ks_start_xmit - transmit packet | ||
972 | * @skb : The buffer to transmit | ||
973 | * @netdev : The device used to transmit the packet. | ||
974 | * | ||
975 | * Called by the network layer to transmit the @skb. | ||
976 | * spin_lock_irqsave is required because tx and rx should be mutual exclusive. | ||
977 | * So while tx is in-progress, prevent IRQ interrupt from happenning. | ||
978 | */ | ||
979 | static int ks_start_xmit(struct sk_buff *skb, struct net_device *netdev) | ||
980 | { | ||
981 | int retv = NETDEV_TX_OK; | ||
982 | struct ks_net *ks = netdev_priv(netdev); | ||
983 | |||
984 | disable_irq(netdev->irq); | ||
985 | ks_disable_int(ks); | ||
986 | spin_lock(&ks->statelock); | ||
987 | |||
988 | /* Extra space are required: | ||
989 | * 4 byte for alignment, 4 for status/length, 4 for CRC | ||
990 | */ | ||
991 | |||
992 | if (likely(ks_tx_fifo_space(ks) >= skb->len + 12)) { | ||
993 | ks_write_qmu(ks, skb->data, skb->len); | ||
994 | dev_kfree_skb(skb); | ||
995 | } else | ||
996 | retv = NETDEV_TX_BUSY; | ||
997 | spin_unlock(&ks->statelock); | ||
998 | ks_enable_int(ks); | ||
999 | enable_irq(netdev->irq); | ||
1000 | return retv; | ||
1001 | } | ||
1002 | |||
1003 | /** | ||
1004 | * ks_start_rx - ready to serve pkts | ||
1005 | * @ks : The chip information | ||
1006 | * | ||
1007 | */ | ||
1008 | static void ks_start_rx(struct ks_net *ks) | ||
1009 | { | ||
1010 | u16 cntl; | ||
1011 | |||
1012 | /* Enables QMU Receive (RXCR1). */ | ||
1013 | cntl = ks_rdreg16(ks, KS_RXCR1); | ||
1014 | cntl |= RXCR1_RXE ; | ||
1015 | ks_wrreg16(ks, KS_RXCR1, cntl); | ||
1016 | } /* ks_start_rx */ | ||
1017 | |||
1018 | /** | ||
1019 | * ks_stop_rx - stop to serve pkts | ||
1020 | * @ks : The chip information | ||
1021 | * | ||
1022 | */ | ||
1023 | static void ks_stop_rx(struct ks_net *ks) | ||
1024 | { | ||
1025 | u16 cntl; | ||
1026 | |||
1027 | /* Disables QMU Receive (RXCR1). */ | ||
1028 | cntl = ks_rdreg16(ks, KS_RXCR1); | ||
1029 | cntl &= ~RXCR1_RXE ; | ||
1030 | ks_wrreg16(ks, KS_RXCR1, cntl); | ||
1031 | |||
1032 | } /* ks_stop_rx */ | ||
1033 | |||
1034 | static unsigned long const ethernet_polynomial = 0x04c11db7U; | ||
1035 | |||
1036 | static unsigned long ether_gen_crc(int length, u8 *data) | ||
1037 | { | ||
1038 | long crc = -1; | ||
1039 | while (--length >= 0) { | ||
1040 | u8 current_octet = *data++; | ||
1041 | int bit; | ||
1042 | |||
1043 | for (bit = 0; bit < 8; bit++, current_octet >>= 1) { | ||
1044 | crc = (crc << 1) ^ | ||
1045 | ((crc < 0) ^ (current_octet & 1) ? | ||
1046 | ethernet_polynomial : 0); | ||
1047 | } | ||
1048 | } | ||
1049 | return (unsigned long)crc; | ||
1050 | } /* ether_gen_crc */ | ||
1051 | |||
1052 | /** | ||
1053 | * ks_set_grpaddr - set multicast information | ||
1054 | * @ks : The chip information | ||
1055 | */ | ||
1056 | |||
1057 | static void ks_set_grpaddr(struct ks_net *ks) | ||
1058 | { | ||
1059 | u8 i; | ||
1060 | u32 index, position, value; | ||
1061 | |||
1062 | memset(ks->mcast_bits, 0, sizeof(u8) * HW_MCAST_SIZE); | ||
1063 | |||
1064 | for (i = 0; i < ks->mcast_lst_size; i++) { | ||
1065 | position = (ether_gen_crc(6, ks->mcast_lst[i]) >> 26) & 0x3f; | ||
1066 | index = position >> 3; | ||
1067 | value = 1 << (position & 7); | ||
1068 | ks->mcast_bits[index] |= (u8)value; | ||
1069 | } | ||
1070 | |||
1071 | for (i = 0; i < HW_MCAST_SIZE; i++) { | ||
1072 | if (i & 1) { | ||
1073 | ks_wrreg16(ks, (u16)((KS_MAHTR0 + i) & ~1), | ||
1074 | (ks->mcast_bits[i] << 8) | | ||
1075 | ks->mcast_bits[i - 1]); | ||
1076 | } | ||
1077 | } | ||
1078 | } /* ks_set_grpaddr */ | ||
1079 | |||
1080 | /* | ||
1081 | * ks_clear_mcast - clear multicast information | ||
1082 | * | ||
1083 | * @ks : The chip information | ||
1084 | * This routine removes all mcast addresses set in the hardware. | ||
1085 | */ | ||
1086 | |||
1087 | static void ks_clear_mcast(struct ks_net *ks) | ||
1088 | { | ||
1089 | u16 i, mcast_size; | ||
1090 | for (i = 0; i < HW_MCAST_SIZE; i++) | ||
1091 | ks->mcast_bits[i] = 0; | ||
1092 | |||
1093 | mcast_size = HW_MCAST_SIZE >> 2; | ||
1094 | for (i = 0; i < mcast_size; i++) | ||
1095 | ks_wrreg16(ks, KS_MAHTR0 + (2*i), 0); | ||
1096 | } | ||
1097 | |||
1098 | static void ks_set_promis(struct ks_net *ks, u16 promiscuous_mode) | ||
1099 | { | ||
1100 | u16 cntl; | ||
1101 | ks->promiscuous = promiscuous_mode; | ||
1102 | ks_stop_rx(ks); /* Stop receiving for reconfiguration */ | ||
1103 | cntl = ks_rdreg16(ks, KS_RXCR1); | ||
1104 | |||
1105 | cntl &= ~RXCR1_FILTER_MASK; | ||
1106 | if (promiscuous_mode) | ||
1107 | /* Enable Promiscuous mode */ | ||
1108 | cntl |= RXCR1_RXAE | RXCR1_RXINVF; | ||
1109 | else | ||
1110 | /* Disable Promiscuous mode (default normal mode) */ | ||
1111 | cntl |= RXCR1_RXPAFMA; | ||
1112 | |||
1113 | ks_wrreg16(ks, KS_RXCR1, cntl); | ||
1114 | |||
1115 | if (ks->enabled) | ||
1116 | ks_start_rx(ks); | ||
1117 | |||
1118 | } /* ks_set_promis */ | ||
1119 | |||
1120 | static void ks_set_mcast(struct ks_net *ks, u16 mcast) | ||
1121 | { | ||
1122 | u16 cntl; | ||
1123 | |||
1124 | ks->all_mcast = mcast; | ||
1125 | ks_stop_rx(ks); /* Stop receiving for reconfiguration */ | ||
1126 | cntl = ks_rdreg16(ks, KS_RXCR1); | ||
1127 | cntl &= ~RXCR1_FILTER_MASK; | ||
1128 | if (mcast) | ||
1129 | /* Enable "Perfect with Multicast address passed mode" */ | ||
1130 | cntl |= (RXCR1_RXAE | RXCR1_RXMAFMA | RXCR1_RXPAFMA); | ||
1131 | else | ||
1132 | /** | ||
1133 | * Disable "Perfect with Multicast address passed | ||
1134 | * mode" (normal mode). | ||
1135 | */ | ||
1136 | cntl |= RXCR1_RXPAFMA; | ||
1137 | |||
1138 | ks_wrreg16(ks, KS_RXCR1, cntl); | ||
1139 | |||
1140 | if (ks->enabled) | ||
1141 | ks_start_rx(ks); | ||
1142 | } /* ks_set_mcast */ | ||
1143 | |||
1144 | static void ks_set_rx_mode(struct net_device *netdev) | ||
1145 | { | ||
1146 | struct ks_net *ks = netdev_priv(netdev); | ||
1147 | struct dev_mc_list *ptr; | ||
1148 | |||
1149 | /* Turn on/off promiscuous mode. */ | ||
1150 | if ((netdev->flags & IFF_PROMISC) == IFF_PROMISC) | ||
1151 | ks_set_promis(ks, | ||
1152 | (u16)((netdev->flags & IFF_PROMISC) == IFF_PROMISC)); | ||
1153 | /* Turn on/off all mcast mode. */ | ||
1154 | else if ((netdev->flags & IFF_ALLMULTI) == IFF_ALLMULTI) | ||
1155 | ks_set_mcast(ks, | ||
1156 | (u16)((netdev->flags & IFF_ALLMULTI) == IFF_ALLMULTI)); | ||
1157 | else | ||
1158 | ks_set_promis(ks, false); | ||
1159 | |||
1160 | if ((netdev->flags & IFF_MULTICAST) && netdev->mc_count) { | ||
1161 | if (netdev->mc_count <= MAX_MCAST_LST) { | ||
1162 | int i = 0; | ||
1163 | for (ptr = netdev->mc_list; ptr; ptr = ptr->next) { | ||
1164 | if (!(*ptr->dmi_addr & 1)) | ||
1165 | continue; | ||
1166 | if (i >= MAX_MCAST_LST) | ||
1167 | break; | ||
1168 | memcpy(ks->mcast_lst[i++], ptr->dmi_addr, | ||
1169 | MAC_ADDR_LEN); | ||
1170 | } | ||
1171 | ks->mcast_lst_size = (u8)i; | ||
1172 | ks_set_grpaddr(ks); | ||
1173 | } else { | ||
1174 | /** | ||
1175 | * List too big to support so | ||
1176 | * turn on all mcast mode. | ||
1177 | */ | ||
1178 | ks->mcast_lst_size = MAX_MCAST_LST; | ||
1179 | ks_set_mcast(ks, true); | ||
1180 | } | ||
1181 | } else { | ||
1182 | ks->mcast_lst_size = 0; | ||
1183 | ks_clear_mcast(ks); | ||
1184 | } | ||
1185 | } /* ks_set_rx_mode */ | ||
1186 | |||
1187 | static void ks_set_mac(struct ks_net *ks, u8 *data) | ||
1188 | { | ||
1189 | u16 *pw = (u16 *)data; | ||
1190 | u16 w, u; | ||
1191 | |||
1192 | ks_stop_rx(ks); /* Stop receiving for reconfiguration */ | ||
1193 | |||
1194 | u = *pw++; | ||
1195 | w = ((u & 0xFF) << 8) | ((u >> 8) & 0xFF); | ||
1196 | ks_wrreg16(ks, KS_MARH, w); | ||
1197 | |||
1198 | u = *pw++; | ||
1199 | w = ((u & 0xFF) << 8) | ((u >> 8) & 0xFF); | ||
1200 | ks_wrreg16(ks, KS_MARM, w); | ||
1201 | |||
1202 | u = *pw; | ||
1203 | w = ((u & 0xFF) << 8) | ((u >> 8) & 0xFF); | ||
1204 | ks_wrreg16(ks, KS_MARL, w); | ||
1205 | |||
1206 | memcpy(ks->mac_addr, data, 6); | ||
1207 | |||
1208 | if (ks->enabled) | ||
1209 | ks_start_rx(ks); | ||
1210 | } | ||
1211 | |||
1212 | static int ks_set_mac_address(struct net_device *netdev, void *paddr) | ||
1213 | { | ||
1214 | struct ks_net *ks = netdev_priv(netdev); | ||
1215 | struct sockaddr *addr = paddr; | ||
1216 | u8 *da; | ||
1217 | |||
1218 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); | ||
1219 | |||
1220 | da = (u8 *)netdev->dev_addr; | ||
1221 | |||
1222 | ks_set_mac(ks, da); | ||
1223 | return 0; | ||
1224 | } | ||
1225 | |||
1226 | static int ks_net_ioctl(struct net_device *netdev, struct ifreq *req, int cmd) | ||
1227 | { | ||
1228 | struct ks_net *ks = netdev_priv(netdev); | ||
1229 | |||
1230 | if (!netif_running(netdev)) | ||
1231 | return -EINVAL; | ||
1232 | |||
1233 | return generic_mii_ioctl(&ks->mii, if_mii(req), cmd, NULL); | ||
1234 | } | ||
1235 | |||
1236 | static const struct net_device_ops ks_netdev_ops = { | ||
1237 | .ndo_open = ks_net_open, | ||
1238 | .ndo_stop = ks_net_stop, | ||
1239 | .ndo_do_ioctl = ks_net_ioctl, | ||
1240 | .ndo_start_xmit = ks_start_xmit, | ||
1241 | .ndo_set_mac_address = ks_set_mac_address, | ||
1242 | .ndo_set_rx_mode = ks_set_rx_mode, | ||
1243 | .ndo_change_mtu = eth_change_mtu, | ||
1244 | .ndo_validate_addr = eth_validate_addr, | ||
1245 | }; | ||
1246 | |||
1247 | /* ethtool support */ | ||
1248 | |||
1249 | static void ks_get_drvinfo(struct net_device *netdev, | ||
1250 | struct ethtool_drvinfo *di) | ||
1251 | { | ||
1252 | strlcpy(di->driver, DRV_NAME, sizeof(di->driver)); | ||
1253 | strlcpy(di->version, "1.00", sizeof(di->version)); | ||
1254 | strlcpy(di->bus_info, dev_name(netdev->dev.parent), | ||
1255 | sizeof(di->bus_info)); | ||
1256 | } | ||
1257 | |||
1258 | static u32 ks_get_msglevel(struct net_device *netdev) | ||
1259 | { | ||
1260 | struct ks_net *ks = netdev_priv(netdev); | ||
1261 | return ks->msg_enable; | ||
1262 | } | ||
1263 | |||
1264 | static void ks_set_msglevel(struct net_device *netdev, u32 to) | ||
1265 | { | ||
1266 | struct ks_net *ks = netdev_priv(netdev); | ||
1267 | ks->msg_enable = to; | ||
1268 | } | ||
1269 | |||
1270 | static int ks_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) | ||
1271 | { | ||
1272 | struct ks_net *ks = netdev_priv(netdev); | ||
1273 | return mii_ethtool_gset(&ks->mii, cmd); | ||
1274 | } | ||
1275 | |||
1276 | static int ks_set_settings(struct net_device *netdev, struct ethtool_cmd *cmd) | ||
1277 | { | ||
1278 | struct ks_net *ks = netdev_priv(netdev); | ||
1279 | return mii_ethtool_sset(&ks->mii, cmd); | ||
1280 | } | ||
1281 | |||
1282 | static u32 ks_get_link(struct net_device *netdev) | ||
1283 | { | ||
1284 | struct ks_net *ks = netdev_priv(netdev); | ||
1285 | return mii_link_ok(&ks->mii); | ||
1286 | } | ||
1287 | |||
1288 | static int ks_nway_reset(struct net_device *netdev) | ||
1289 | { | ||
1290 | struct ks_net *ks = netdev_priv(netdev); | ||
1291 | return mii_nway_restart(&ks->mii); | ||
1292 | } | ||
1293 | |||
1294 | static const struct ethtool_ops ks_ethtool_ops = { | ||
1295 | .get_drvinfo = ks_get_drvinfo, | ||
1296 | .get_msglevel = ks_get_msglevel, | ||
1297 | .set_msglevel = ks_set_msglevel, | ||
1298 | .get_settings = ks_get_settings, | ||
1299 | .set_settings = ks_set_settings, | ||
1300 | .get_link = ks_get_link, | ||
1301 | .nway_reset = ks_nway_reset, | ||
1302 | }; | ||
1303 | |||
1304 | /* MII interface controls */ | ||
1305 | |||
1306 | /** | ||
1307 | * ks_phy_reg - convert MII register into a KS8851 register | ||
1308 | * @reg: MII register number. | ||
1309 | * | ||
1310 | * Return the KS8851 register number for the corresponding MII PHY register | ||
1311 | * if possible. Return zero if the MII register has no direct mapping to the | ||
1312 | * KS8851 register set. | ||
1313 | */ | ||
1314 | static int ks_phy_reg(int reg) | ||
1315 | { | ||
1316 | switch (reg) { | ||
1317 | case MII_BMCR: | ||
1318 | return KS_P1MBCR; | ||
1319 | case MII_BMSR: | ||
1320 | return KS_P1MBSR; | ||
1321 | case MII_PHYSID1: | ||
1322 | return KS_PHY1ILR; | ||
1323 | case MII_PHYSID2: | ||
1324 | return KS_PHY1IHR; | ||
1325 | case MII_ADVERTISE: | ||
1326 | return KS_P1ANAR; | ||
1327 | case MII_LPA: | ||
1328 | return KS_P1ANLPR; | ||
1329 | } | ||
1330 | |||
1331 | return 0x0; | ||
1332 | } | ||
1333 | |||
1334 | /** | ||
1335 | * ks_phy_read - MII interface PHY register read. | ||
1336 | * @netdev: The network device the PHY is on. | ||
1337 | * @phy_addr: Address of PHY (ignored as we only have one) | ||
1338 | * @reg: The register to read. | ||
1339 | * | ||
1340 | * This call reads data from the PHY register specified in @reg. Since the | ||
1341 | * device does not support all the MII registers, the non-existant values | ||
1342 | * are always returned as zero. | ||
1343 | * | ||
1344 | * We return zero for unsupported registers as the MII code does not check | ||
1345 | * the value returned for any error status, and simply returns it to the | ||
1346 | * caller. The mii-tool that the driver was tested with takes any -ve error | ||
1347 | * as real PHY capabilities, thus displaying incorrect data to the user. | ||
1348 | */ | ||
1349 | static int ks_phy_read(struct net_device *netdev, int phy_addr, int reg) | ||
1350 | { | ||
1351 | struct ks_net *ks = netdev_priv(netdev); | ||
1352 | int ksreg; | ||
1353 | int result; | ||
1354 | |||
1355 | ksreg = ks_phy_reg(reg); | ||
1356 | if (!ksreg) | ||
1357 | return 0x0; /* no error return allowed, so use zero */ | ||
1358 | |||
1359 | mutex_lock(&ks->lock); | ||
1360 | result = ks_rdreg16(ks, ksreg); | ||
1361 | mutex_unlock(&ks->lock); | ||
1362 | |||
1363 | return result; | ||
1364 | } | ||
1365 | |||
1366 | static void ks_phy_write(struct net_device *netdev, | ||
1367 | int phy, int reg, int value) | ||
1368 | { | ||
1369 | struct ks_net *ks = netdev_priv(netdev); | ||
1370 | int ksreg; | ||
1371 | |||
1372 | ksreg = ks_phy_reg(reg); | ||
1373 | if (ksreg) { | ||
1374 | mutex_lock(&ks->lock); | ||
1375 | ks_wrreg16(ks, ksreg, value); | ||
1376 | mutex_unlock(&ks->lock); | ||
1377 | } | ||
1378 | } | ||
1379 | |||
1380 | /** | ||
1381 | * ks_read_selftest - read the selftest memory info. | ||
1382 | * @ks: The device state | ||
1383 | * | ||
1384 | * Read and check the TX/RX memory selftest information. | ||
1385 | */ | ||
1386 | static int ks_read_selftest(struct ks_net *ks) | ||
1387 | { | ||
1388 | unsigned both_done = MBIR_TXMBF | MBIR_RXMBF; | ||
1389 | int ret = 0; | ||
1390 | unsigned rd; | ||
1391 | |||
1392 | rd = ks_rdreg16(ks, KS_MBIR); | ||
1393 | |||
1394 | if ((rd & both_done) != both_done) { | ||
1395 | ks_warn(ks, "Memory selftest not finished\n"); | ||
1396 | return 0; | ||
1397 | } | ||
1398 | |||
1399 | if (rd & MBIR_TXMBFA) { | ||
1400 | ks_err(ks, "TX memory selftest fails\n"); | ||
1401 | ret |= 1; | ||
1402 | } | ||
1403 | |||
1404 | if (rd & MBIR_RXMBFA) { | ||
1405 | ks_err(ks, "RX memory selftest fails\n"); | ||
1406 | ret |= 2; | ||
1407 | } | ||
1408 | |||
1409 | ks_info(ks, "the selftest passes\n"); | ||
1410 | return ret; | ||
1411 | } | ||
1412 | |||
1413 | static void ks_disable(struct ks_net *ks) | ||
1414 | { | ||
1415 | u16 w; | ||
1416 | |||
1417 | w = ks_rdreg16(ks, KS_TXCR); | ||
1418 | |||
1419 | /* Disables QMU Transmit (TXCR). */ | ||
1420 | w &= ~TXCR_TXE; | ||
1421 | ks_wrreg16(ks, KS_TXCR, w); | ||
1422 | |||
1423 | /* Disables QMU Receive (RXCR1). */ | ||
1424 | w = ks_rdreg16(ks, KS_RXCR1); | ||
1425 | w &= ~RXCR1_RXE ; | ||
1426 | ks_wrreg16(ks, KS_RXCR1, w); | ||
1427 | |||
1428 | ks->enabled = false; | ||
1429 | |||
1430 | } /* ks_disable */ | ||
1431 | |||
1432 | static void ks_setup(struct ks_net *ks) | ||
1433 | { | ||
1434 | u16 w; | ||
1435 | |||
1436 | /** | ||
1437 | * Configure QMU Transmit | ||
1438 | */ | ||
1439 | |||
1440 | /* Setup Transmit Frame Data Pointer Auto-Increment (TXFDPR) */ | ||
1441 | ks_wrreg16(ks, KS_TXFDPR, TXFDPR_TXFPAI); | ||
1442 | |||
1443 | /* Setup Receive Frame Data Pointer Auto-Increment */ | ||
1444 | ks_wrreg16(ks, KS_RXFDPR, RXFDPR_RXFPAI); | ||
1445 | |||
1446 | /* Setup Receive Frame Threshold - 1 frame (RXFCTFC) */ | ||
1447 | ks_wrreg16(ks, KS_RXFCTR, 1 & RXFCTR_THRESHOLD_MASK); | ||
1448 | |||
1449 | /* Setup RxQ Command Control (RXQCR) */ | ||
1450 | ks->rc_rxqcr = RXQCR_CMD_CNTL; | ||
1451 | ks_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr); | ||
1452 | |||
1453 | /** | ||
1454 | * set the force mode to half duplex, default is full duplex | ||
1455 | * because if the auto-negotiation fails, most switch uses | ||
1456 | * half-duplex. | ||
1457 | */ | ||
1458 | |||
1459 | w = ks_rdreg16(ks, KS_P1MBCR); | ||
1460 | w &= ~P1MBCR_FORCE_FDX; | ||
1461 | ks_wrreg16(ks, KS_P1MBCR, w); | ||
1462 | |||
1463 | w = TXCR_TXFCE | TXCR_TXPE | TXCR_TXCRC | TXCR_TCGIP; | ||
1464 | ks_wrreg16(ks, KS_TXCR, w); | ||
1465 | |||
1466 | w = RXCR1_RXFCE | RXCR1_RXBE | RXCR1_RXUE; | ||
1467 | |||
1468 | if (ks->promiscuous) /* bPromiscuous */ | ||
1469 | w |= (RXCR1_RXAE | RXCR1_RXINVF); | ||
1470 | else if (ks->all_mcast) /* Multicast address passed mode */ | ||
1471 | w |= (RXCR1_RXAE | RXCR1_RXMAFMA | RXCR1_RXPAFMA); | ||
1472 | else /* Normal mode */ | ||
1473 | w |= RXCR1_RXPAFMA; | ||
1474 | |||
1475 | ks_wrreg16(ks, KS_RXCR1, w); | ||
1476 | } /*ks_setup */ | ||
1477 | |||
1478 | |||
1479 | static void ks_setup_int(struct ks_net *ks) | ||
1480 | { | ||
1481 | ks->rc_ier = 0x00; | ||
1482 | /* Clear the interrupts status of the hardware. */ | ||
1483 | ks_wrreg16(ks, KS_ISR, 0xffff); | ||
1484 | |||
1485 | /* Enables the interrupts of the hardware. */ | ||
1486 | ks->rc_ier = (IRQ_LCI | IRQ_TXI | IRQ_RXI); | ||
1487 | } /* ks_setup_int */ | ||
1488 | |||
1489 | void ks_enable(struct ks_net *ks) | ||
1490 | { | ||
1491 | u16 w; | ||
1492 | |||
1493 | w = ks_rdreg16(ks, KS_TXCR); | ||
1494 | /* Enables QMU Transmit (TXCR). */ | ||
1495 | ks_wrreg16(ks, KS_TXCR, w | TXCR_TXE); | ||
1496 | |||
1497 | /* | ||
1498 | * RX Frame Count Threshold Enable and Auto-Dequeue RXQ Frame | ||
1499 | * Enable | ||
1500 | */ | ||
1501 | |||
1502 | w = ks_rdreg16(ks, KS_RXQCR); | ||
1503 | ks_wrreg16(ks, KS_RXQCR, w | RXQCR_RXFCTE); | ||
1504 | |||
1505 | /* Enables QMU Receive (RXCR1). */ | ||
1506 | w = ks_rdreg16(ks, KS_RXCR1); | ||
1507 | ks_wrreg16(ks, KS_RXCR1, w | RXCR1_RXE); | ||
1508 | ks->enabled = true; | ||
1509 | } /* ks_enable */ | ||
1510 | |||
1511 | static int ks_hw_init(struct ks_net *ks) | ||
1512 | { | ||
1513 | #define MHEADER_SIZE (sizeof(struct type_frame_head) * MAX_RECV_FRAMES) | ||
1514 | ks->promiscuous = 0; | ||
1515 | ks->all_mcast = 0; | ||
1516 | ks->mcast_lst_size = 0; | ||
1517 | |||
1518 | ks->frame_head_info = (struct type_frame_head *) \ | ||
1519 | kmalloc(MHEADER_SIZE, GFP_KERNEL); | ||
1520 | if (!ks->frame_head_info) { | ||
1521 | printk(KERN_ERR "Error: Fail to allocate frame memory\n"); | ||
1522 | return false; | ||
1523 | } | ||
1524 | |||
1525 | ks_set_mac(ks, KS_DEFAULT_MAC_ADDRESS); | ||
1526 | return true; | ||
1527 | } | ||
1528 | |||
1529 | |||
1530 | static int __devinit ks8851_probe(struct platform_device *pdev) | ||
1531 | { | ||
1532 | int err = -ENOMEM; | ||
1533 | struct resource *io_d, *io_c; | ||
1534 | struct net_device *netdev; | ||
1535 | struct ks_net *ks; | ||
1536 | u16 id, data; | ||
1537 | |||
1538 | io_d = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1539 | io_c = platform_get_resource(pdev, IORESOURCE_MEM, 1); | ||
1540 | |||
1541 | if (!request_mem_region(io_d->start, resource_size(io_d), DRV_NAME)) | ||
1542 | goto err_mem_region; | ||
1543 | |||
1544 | if (!request_mem_region(io_c->start, resource_size(io_c), DRV_NAME)) | ||
1545 | goto err_mem_region1; | ||
1546 | |||
1547 | netdev = alloc_etherdev(sizeof(struct ks_net)); | ||
1548 | if (!netdev) | ||
1549 | goto err_alloc_etherdev; | ||
1550 | |||
1551 | SET_NETDEV_DEV(netdev, &pdev->dev); | ||
1552 | |||
1553 | ks = netdev_priv(netdev); | ||
1554 | ks->netdev = netdev; | ||
1555 | ks->hw_addr = ioremap(io_d->start, resource_size(io_d)); | ||
1556 | |||
1557 | if (!ks->hw_addr) | ||
1558 | goto err_ioremap; | ||
1559 | |||
1560 | ks->hw_addr_cmd = ioremap(io_c->start, resource_size(io_c)); | ||
1561 | if (!ks->hw_addr_cmd) | ||
1562 | goto err_ioremap1; | ||
1563 | |||
1564 | ks->irq = platform_get_irq(pdev, 0); | ||
1565 | |||
1566 | if (ks->irq < 0) { | ||
1567 | err = ks->irq; | ||
1568 | goto err_get_irq; | ||
1569 | } | ||
1570 | |||
1571 | ks->pdev = pdev; | ||
1572 | |||
1573 | mutex_init(&ks->lock); | ||
1574 | spin_lock_init(&ks->statelock); | ||
1575 | |||
1576 | netdev->netdev_ops = &ks_netdev_ops; | ||
1577 | netdev->ethtool_ops = &ks_ethtool_ops; | ||
1578 | |||
1579 | /* setup mii state */ | ||
1580 | ks->mii.dev = netdev; | ||
1581 | ks->mii.phy_id = 1, | ||
1582 | ks->mii.phy_id_mask = 1; | ||
1583 | ks->mii.reg_num_mask = 0xf; | ||
1584 | ks->mii.mdio_read = ks_phy_read; | ||
1585 | ks->mii.mdio_write = ks_phy_write; | ||
1586 | |||
1587 | ks_info(ks, "message enable is %d\n", msg_enable); | ||
1588 | /* set the default message enable */ | ||
1589 | ks->msg_enable = netif_msg_init(msg_enable, (NETIF_MSG_DRV | | ||
1590 | NETIF_MSG_PROBE | | ||
1591 | NETIF_MSG_LINK)); | ||
1592 | ks_read_config(ks); | ||
1593 | |||
1594 | /* simple check for a valid chip being connected to the bus */ | ||
1595 | if ((ks_rdreg16(ks, KS_CIDER) & ~CIDER_REV_MASK) != CIDER_ID) { | ||
1596 | ks_err(ks, "failed to read device ID\n"); | ||
1597 | err = -ENODEV; | ||
1598 | goto err_register; | ||
1599 | } | ||
1600 | |||
1601 | if (ks_read_selftest(ks)) { | ||
1602 | ks_err(ks, "failed to read device ID\n"); | ||
1603 | err = -ENODEV; | ||
1604 | goto err_register; | ||
1605 | } | ||
1606 | |||
1607 | err = register_netdev(netdev); | ||
1608 | if (err) | ||
1609 | goto err_register; | ||
1610 | |||
1611 | platform_set_drvdata(pdev, netdev); | ||
1612 | |||
1613 | ks_soft_reset(ks, GRR_GSR); | ||
1614 | ks_hw_init(ks); | ||
1615 | ks_disable(ks); | ||
1616 | ks_setup(ks); | ||
1617 | ks_setup_int(ks); | ||
1618 | ks_enable_int(ks); | ||
1619 | ks_enable(ks); | ||
1620 | memcpy(netdev->dev_addr, ks->mac_addr, 6); | ||
1621 | |||
1622 | data = ks_rdreg16(ks, KS_OBCR); | ||
1623 | ks_wrreg16(ks, KS_OBCR, data | OBCR_ODS_16MA); | ||
1624 | |||
1625 | /** | ||
1626 | * If you want to use the default MAC addr, | ||
1627 | * comment out the 2 functions below. | ||
1628 | */ | ||
1629 | |||
1630 | random_ether_addr(netdev->dev_addr); | ||
1631 | ks_set_mac(ks, netdev->dev_addr); | ||
1632 | |||
1633 | id = ks_rdreg16(ks, KS_CIDER); | ||
1634 | |||
1635 | printk(KERN_INFO DRV_NAME | ||
1636 | " Found chip, family: 0x%x, id: 0x%x, rev: 0x%x\n", | ||
1637 | (id >> 8) & 0xff, (id >> 4) & 0xf, (id >> 1) & 0x7); | ||
1638 | return 0; | ||
1639 | |||
1640 | err_register: | ||
1641 | err_get_irq: | ||
1642 | iounmap(ks->hw_addr_cmd); | ||
1643 | err_ioremap1: | ||
1644 | iounmap(ks->hw_addr); | ||
1645 | err_ioremap: | ||
1646 | free_netdev(netdev); | ||
1647 | err_alloc_etherdev: | ||
1648 | release_mem_region(io_c->start, resource_size(io_c)); | ||
1649 | err_mem_region1: | ||
1650 | release_mem_region(io_d->start, resource_size(io_d)); | ||
1651 | err_mem_region: | ||
1652 | return err; | ||
1653 | } | ||
1654 | |||
1655 | static int __devexit ks8851_remove(struct platform_device *pdev) | ||
1656 | { | ||
1657 | struct net_device *netdev = platform_get_drvdata(pdev); | ||
1658 | struct ks_net *ks = netdev_priv(netdev); | ||
1659 | struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1660 | |||
1661 | unregister_netdev(netdev); | ||
1662 | iounmap(ks->hw_addr); | ||
1663 | free_netdev(netdev); | ||
1664 | release_mem_region(iomem->start, resource_size(iomem)); | ||
1665 | platform_set_drvdata(pdev, NULL); | ||
1666 | return 0; | ||
1667 | |||
1668 | } | ||
1669 | |||
1670 | static struct platform_driver ks8851_platform_driver = { | ||
1671 | .driver = { | ||
1672 | .name = DRV_NAME, | ||
1673 | .owner = THIS_MODULE, | ||
1674 | }, | ||
1675 | .probe = ks8851_probe, | ||
1676 | .remove = __devexit_p(ks8851_remove), | ||
1677 | }; | ||
1678 | |||
1679 | static int __init ks8851_init(void) | ||
1680 | { | ||
1681 | return platform_driver_register(&ks8851_platform_driver); | ||
1682 | } | ||
1683 | |||
1684 | static void __exit ks8851_exit(void) | ||
1685 | { | ||
1686 | platform_driver_unregister(&ks8851_platform_driver); | ||
1687 | } | ||
1688 | |||
1689 | module_init(ks8851_init); | ||
1690 | module_exit(ks8851_exit); | ||
1691 | |||
1692 | MODULE_DESCRIPTION("KS8851 MLL Network driver"); | ||
1693 | MODULE_AUTHOR("David Choi <david.choi@micrel.com>"); | ||
1694 | MODULE_LICENSE("GPL"); | ||
1695 | module_param_named(message, msg_enable, int, 0); | ||
1696 | MODULE_PARM_DESC(message, "Message verbosity level (0=none, 31=all)"); | ||
1697 | |||
diff --git a/drivers/net/meth.c b/drivers/net/meth.c index 92ceb689b4d4..2af81735386b 100644 --- a/drivers/net/meth.c +++ b/drivers/net/meth.c | |||
@@ -828,7 +828,7 @@ static int __exit meth_remove(struct platform_device *pdev) | |||
828 | 828 | ||
829 | static struct platform_driver meth_driver = { | 829 | static struct platform_driver meth_driver = { |
830 | .probe = meth_probe, | 830 | .probe = meth_probe, |
831 | .remove = __devexit_p(meth_remove), | 831 | .remove = __exit_p(meth_remove), |
832 | .driver = { | 832 | .driver = { |
833 | .name = "meth", | 833 | .name = "meth", |
834 | .owner = THIS_MODULE, | 834 | .owner = THIS_MODULE, |
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c index cc394d073755..5910df60c93e 100644 --- a/drivers/net/pppol2tp.c +++ b/drivers/net/pppol2tp.c | |||
@@ -2179,7 +2179,7 @@ static int pppol2tp_session_setsockopt(struct sock *sk, | |||
2179 | * session or the special tunnel type. | 2179 | * session or the special tunnel type. |
2180 | */ | 2180 | */ |
2181 | static int pppol2tp_setsockopt(struct socket *sock, int level, int optname, | 2181 | static int pppol2tp_setsockopt(struct socket *sock, int level, int optname, |
2182 | char __user *optval, int optlen) | 2182 | char __user *optval, unsigned int optlen) |
2183 | { | 2183 | { |
2184 | struct sock *sk = sock->sk; | 2184 | struct sock *sk = sock->sk; |
2185 | struct pppol2tp_session *session = sk->sk_user_data; | 2185 | struct pppol2tp_session *session = sk->sk_user_data; |
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h index a9845a2f243f..30d5585beeee 100644 --- a/drivers/net/qlge/qlge.h +++ b/drivers/net/qlge/qlge.h | |||
@@ -1381,15 +1381,15 @@ struct intr_context { | |||
1381 | 1381 | ||
1382 | /* adapter flags definitions. */ | 1382 | /* adapter flags definitions. */ |
1383 | enum { | 1383 | enum { |
1384 | QL_ADAPTER_UP = (1 << 0), /* Adapter has been brought up. */ | 1384 | QL_ADAPTER_UP = 0, /* Adapter has been brought up. */ |
1385 | QL_LEGACY_ENABLED = (1 << 3), | 1385 | QL_LEGACY_ENABLED = 1, |
1386 | QL_MSI_ENABLED = (1 << 3), | 1386 | QL_MSI_ENABLED = 2, |
1387 | QL_MSIX_ENABLED = (1 << 4), | 1387 | QL_MSIX_ENABLED = 3, |
1388 | QL_DMA64 = (1 << 5), | 1388 | QL_DMA64 = 4, |
1389 | QL_PROMISCUOUS = (1 << 6), | 1389 | QL_PROMISCUOUS = 5, |
1390 | QL_ALLMULTI = (1 << 7), | 1390 | QL_ALLMULTI = 6, |
1391 | QL_PORT_CFG = (1 << 8), | 1391 | QL_PORT_CFG = 7, |
1392 | QL_CAM_RT_SET = (1 << 9), | 1392 | QL_CAM_RT_SET = 8, |
1393 | }; | 1393 | }; |
1394 | 1394 | ||
1395 | /* link_status bit definitions */ | 1395 | /* link_status bit definitions */ |
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 7783c5db81dc..3d0efea32111 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
@@ -3142,14 +3142,14 @@ static int ql_route_initialize(struct ql_adapter *qdev) | |||
3142 | { | 3142 | { |
3143 | int status = 0; | 3143 | int status = 0; |
3144 | 3144 | ||
3145 | status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK); | 3145 | /* Clear all the entries in the routing table. */ |
3146 | status = ql_clear_routing_entries(qdev); | ||
3146 | if (status) | 3147 | if (status) |
3147 | return status; | 3148 | return status; |
3148 | 3149 | ||
3149 | /* Clear all the entries in the routing table. */ | 3150 | status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK); |
3150 | status = ql_clear_routing_entries(qdev); | ||
3151 | if (status) | 3151 | if (status) |
3152 | goto exit; | 3152 | return status; |
3153 | 3153 | ||
3154 | status = ql_set_routing_reg(qdev, RT_IDX_ALL_ERR_SLOT, RT_IDX_ERR, 1); | 3154 | status = ql_set_routing_reg(qdev, RT_IDX_ALL_ERR_SLOT, RT_IDX_ERR, 1); |
3155 | if (status) { | 3155 | if (status) { |
@@ -3380,12 +3380,10 @@ static int ql_adapter_down(struct ql_adapter *qdev) | |||
3380 | 3380 | ||
3381 | ql_free_rx_buffers(qdev); | 3381 | ql_free_rx_buffers(qdev); |
3382 | 3382 | ||
3383 | spin_lock(&qdev->hw_lock); | ||
3384 | status = ql_adapter_reset(qdev); | 3383 | status = ql_adapter_reset(qdev); |
3385 | if (status) | 3384 | if (status) |
3386 | QPRINTK(qdev, IFDOWN, ERR, "reset(func #%d) FAILED!\n", | 3385 | QPRINTK(qdev, IFDOWN, ERR, "reset(func #%d) FAILED!\n", |
3387 | qdev->func); | 3386 | qdev->func); |
3388 | spin_unlock(&qdev->hw_lock); | ||
3389 | return status; | 3387 | return status; |
3390 | } | 3388 | } |
3391 | 3389 | ||
@@ -3705,7 +3703,7 @@ static void ql_asic_reset_work(struct work_struct *work) | |||
3705 | struct ql_adapter *qdev = | 3703 | struct ql_adapter *qdev = |
3706 | container_of(work, struct ql_adapter, asic_reset_work.work); | 3704 | container_of(work, struct ql_adapter, asic_reset_work.work); |
3707 | int status; | 3705 | int status; |
3708 | 3706 | rtnl_lock(); | |
3709 | status = ql_adapter_down(qdev); | 3707 | status = ql_adapter_down(qdev); |
3710 | if (status) | 3708 | if (status) |
3711 | goto error; | 3709 | goto error; |
@@ -3713,12 +3711,12 @@ static void ql_asic_reset_work(struct work_struct *work) | |||
3713 | status = ql_adapter_up(qdev); | 3711 | status = ql_adapter_up(qdev); |
3714 | if (status) | 3712 | if (status) |
3715 | goto error; | 3713 | goto error; |
3716 | 3714 | rtnl_unlock(); | |
3717 | return; | 3715 | return; |
3718 | error: | 3716 | error: |
3719 | QPRINTK(qdev, IFUP, ALERT, | 3717 | QPRINTK(qdev, IFUP, ALERT, |
3720 | "Driver up/down cycle failed, closing device\n"); | 3718 | "Driver up/down cycle failed, closing device\n"); |
3721 | rtnl_lock(); | 3719 | |
3722 | set_bit(QL_ADAPTER_UP, &qdev->flags); | 3720 | set_bit(QL_ADAPTER_UP, &qdev->flags); |
3723 | dev_close(qdev->ndev); | 3721 | dev_close(qdev->ndev); |
3724 | rtnl_unlock(); | 3722 | rtnl_unlock(); |
@@ -3834,11 +3832,14 @@ static int __devinit ql_init_device(struct pci_dev *pdev, | |||
3834 | return err; | 3832 | return err; |
3835 | } | 3833 | } |
3836 | 3834 | ||
3835 | qdev->ndev = ndev; | ||
3836 | qdev->pdev = pdev; | ||
3837 | pci_set_drvdata(pdev, ndev); | ||
3837 | pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); | 3838 | pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); |
3838 | if (pos <= 0) { | 3839 | if (pos <= 0) { |
3839 | dev_err(&pdev->dev, PFX "Cannot find PCI Express capability, " | 3840 | dev_err(&pdev->dev, PFX "Cannot find PCI Express capability, " |
3840 | "aborting.\n"); | 3841 | "aborting.\n"); |
3841 | goto err_out; | 3842 | return pos; |
3842 | } else { | 3843 | } else { |
3843 | pci_read_config_word(pdev, pos + PCI_EXP_DEVCTL, &val16); | 3844 | pci_read_config_word(pdev, pos + PCI_EXP_DEVCTL, &val16); |
3844 | val16 &= ~PCI_EXP_DEVCTL_NOSNOOP_EN; | 3845 | val16 &= ~PCI_EXP_DEVCTL_NOSNOOP_EN; |
@@ -3851,7 +3852,7 @@ static int __devinit ql_init_device(struct pci_dev *pdev, | |||
3851 | err = pci_request_regions(pdev, DRV_NAME); | 3852 | err = pci_request_regions(pdev, DRV_NAME); |
3852 | if (err) { | 3853 | if (err) { |
3853 | dev_err(&pdev->dev, "PCI region request failed.\n"); | 3854 | dev_err(&pdev->dev, "PCI region request failed.\n"); |
3854 | goto err_out; | 3855 | return err; |
3855 | } | 3856 | } |
3856 | 3857 | ||
3857 | pci_set_master(pdev); | 3858 | pci_set_master(pdev); |
@@ -3869,7 +3870,6 @@ static int __devinit ql_init_device(struct pci_dev *pdev, | |||
3869 | goto err_out; | 3870 | goto err_out; |
3870 | } | 3871 | } |
3871 | 3872 | ||
3872 | pci_set_drvdata(pdev, ndev); | ||
3873 | qdev->reg_base = | 3873 | qdev->reg_base = |
3874 | ioremap_nocache(pci_resource_start(pdev, 1), | 3874 | ioremap_nocache(pci_resource_start(pdev, 1), |
3875 | pci_resource_len(pdev, 1)); | 3875 | pci_resource_len(pdev, 1)); |
@@ -3889,8 +3889,6 @@ static int __devinit ql_init_device(struct pci_dev *pdev, | |||
3889 | goto err_out; | 3889 | goto err_out; |
3890 | } | 3890 | } |
3891 | 3891 | ||
3892 | qdev->ndev = ndev; | ||
3893 | qdev->pdev = pdev; | ||
3894 | err = ql_get_board_info(qdev); | 3892 | err = ql_get_board_info(qdev); |
3895 | if (err) { | 3893 | if (err) { |
3896 | dev_err(&pdev->dev, "Register access failed.\n"); | 3894 | dev_err(&pdev->dev, "Register access failed.\n"); |
diff --git a/drivers/net/sgiseeq.c b/drivers/net/sgiseeq.c index ecf3279fbef5..f4dfd1f679a9 100644 --- a/drivers/net/sgiseeq.c +++ b/drivers/net/sgiseeq.c | |||
@@ -826,7 +826,7 @@ static int __exit sgiseeq_remove(struct platform_device *pdev) | |||
826 | 826 | ||
827 | static struct platform_driver sgiseeq_driver = { | 827 | static struct platform_driver sgiseeq_driver = { |
828 | .probe = sgiseeq_probe, | 828 | .probe = sgiseeq_probe, |
829 | .remove = __devexit_p(sgiseeq_remove), | 829 | .remove = __exit_p(sgiseeq_remove), |
830 | .driver = { | 830 | .driver = { |
831 | .name = "sgiseeq", | 831 | .name = "sgiseeq", |
832 | .owner = THIS_MODULE, | 832 | .owner = THIS_MODULE, |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 55bad4081966..01f6811f1324 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -3935,11 +3935,14 @@ static int __devinit skge_probe(struct pci_dev *pdev, | |||
3935 | #endif | 3935 | #endif |
3936 | 3936 | ||
3937 | err = -ENOMEM; | 3937 | err = -ENOMEM; |
3938 | hw = kzalloc(sizeof(*hw), GFP_KERNEL); | 3938 | /* space for skge@pci:0000:04:00.0 */ |
3939 | hw = kzalloc(sizeof(*hw) + strlen(DRV_NAME "@pci:" ) | ||
3940 | + strlen(pci_name(pdev)) + 1, GFP_KERNEL); | ||
3939 | if (!hw) { | 3941 | if (!hw) { |
3940 | dev_err(&pdev->dev, "cannot allocate hardware struct\n"); | 3942 | dev_err(&pdev->dev, "cannot allocate hardware struct\n"); |
3941 | goto err_out_free_regions; | 3943 | goto err_out_free_regions; |
3942 | } | 3944 | } |
3945 | sprintf(hw->irq_name, DRV_NAME "@pci:%s", pci_name(pdev)); | ||
3943 | 3946 | ||
3944 | hw->pdev = pdev; | 3947 | hw->pdev = pdev; |
3945 | spin_lock_init(&hw->hw_lock); | 3948 | spin_lock_init(&hw->hw_lock); |
@@ -3974,7 +3977,7 @@ static int __devinit skge_probe(struct pci_dev *pdev, | |||
3974 | goto err_out_free_netdev; | 3977 | goto err_out_free_netdev; |
3975 | } | 3978 | } |
3976 | 3979 | ||
3977 | err = request_irq(pdev->irq, skge_intr, IRQF_SHARED, dev->name, hw); | 3980 | err = request_irq(pdev->irq, skge_intr, IRQF_SHARED, hw->irq_name, hw); |
3978 | if (err) { | 3981 | if (err) { |
3979 | dev_err(&pdev->dev, "%s: cannot assign irq %d\n", | 3982 | dev_err(&pdev->dev, "%s: cannot assign irq %d\n", |
3980 | dev->name, pdev->irq); | 3983 | dev->name, pdev->irq); |
@@ -3982,14 +3985,17 @@ static int __devinit skge_probe(struct pci_dev *pdev, | |||
3982 | } | 3985 | } |
3983 | skge_show_addr(dev); | 3986 | skge_show_addr(dev); |
3984 | 3987 | ||
3985 | if (hw->ports > 1 && (dev1 = skge_devinit(hw, 1, using_dac))) { | 3988 | if (hw->ports > 1) { |
3986 | if (register_netdev(dev1) == 0) | 3989 | dev1 = skge_devinit(hw, 1, using_dac); |
3990 | if (dev1 && register_netdev(dev1) == 0) | ||
3987 | skge_show_addr(dev1); | 3991 | skge_show_addr(dev1); |
3988 | else { | 3992 | else { |
3989 | /* Failure to register second port need not be fatal */ | 3993 | /* Failure to register second port need not be fatal */ |
3990 | dev_warn(&pdev->dev, "register of second port failed\n"); | 3994 | dev_warn(&pdev->dev, "register of second port failed\n"); |
3991 | hw->dev[1] = NULL; | 3995 | hw->dev[1] = NULL; |
3992 | free_netdev(dev1); | 3996 | hw->ports = 1; |
3997 | if (dev1) | ||
3998 | free_netdev(dev1); | ||
3993 | } | 3999 | } |
3994 | } | 4000 | } |
3995 | pci_set_drvdata(pdev, hw); | 4001 | pci_set_drvdata(pdev, hw); |
diff --git a/drivers/net/skge.h b/drivers/net/skge.h index 17caccbb7685..831de1b6e96e 100644 --- a/drivers/net/skge.h +++ b/drivers/net/skge.h | |||
@@ -2423,6 +2423,8 @@ struct skge_hw { | |||
2423 | u16 phy_addr; | 2423 | u16 phy_addr; |
2424 | spinlock_t phy_lock; | 2424 | spinlock_t phy_lock; |
2425 | struct tasklet_struct phy_task; | 2425 | struct tasklet_struct phy_task; |
2426 | |||
2427 | char irq_name[0]; /* skge@pci:000:04:00.0 */ | ||
2426 | }; | 2428 | }; |
2427 | 2429 | ||
2428 | enum pause_control { | 2430 | enum pause_control { |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index ef1165718dd7..2ab5c39f33ca 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -4487,13 +4487,16 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
4487 | wol_default = device_may_wakeup(&pdev->dev) ? WAKE_MAGIC : 0; | 4487 | wol_default = device_may_wakeup(&pdev->dev) ? WAKE_MAGIC : 0; |
4488 | 4488 | ||
4489 | err = -ENOMEM; | 4489 | err = -ENOMEM; |
4490 | hw = kzalloc(sizeof(*hw), GFP_KERNEL); | 4490 | |
4491 | hw = kzalloc(sizeof(*hw) + strlen(DRV_NAME "@pci:") | ||
4492 | + strlen(pci_name(pdev)) + 1, GFP_KERNEL); | ||
4491 | if (!hw) { | 4493 | if (!hw) { |
4492 | dev_err(&pdev->dev, "cannot allocate hardware struct\n"); | 4494 | dev_err(&pdev->dev, "cannot allocate hardware struct\n"); |
4493 | goto err_out_free_regions; | 4495 | goto err_out_free_regions; |
4494 | } | 4496 | } |
4495 | 4497 | ||
4496 | hw->pdev = pdev; | 4498 | hw->pdev = pdev; |
4499 | sprintf(hw->irq_name, DRV_NAME "@pci:%s", pci_name(pdev)); | ||
4497 | 4500 | ||
4498 | hw->regs = ioremap_nocache(pci_resource_start(pdev, 0), 0x4000); | 4501 | hw->regs = ioremap_nocache(pci_resource_start(pdev, 0), 0x4000); |
4499 | if (!hw->regs) { | 4502 | if (!hw->regs) { |
@@ -4539,7 +4542,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
4539 | 4542 | ||
4540 | err = request_irq(pdev->irq, sky2_intr, | 4543 | err = request_irq(pdev->irq, sky2_intr, |
4541 | (hw->flags & SKY2_HW_USE_MSI) ? 0 : IRQF_SHARED, | 4544 | (hw->flags & SKY2_HW_USE_MSI) ? 0 : IRQF_SHARED, |
4542 | dev->name, hw); | 4545 | hw->irq_name, hw); |
4543 | if (err) { | 4546 | if (err) { |
4544 | dev_err(&pdev->dev, "cannot assign irq %d\n", pdev->irq); | 4547 | dev_err(&pdev->dev, "cannot assign irq %d\n", pdev->irq); |
4545 | goto err_out_unregister; | 4548 | goto err_out_unregister; |
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index e0f23a101043..ed54129698b4 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h | |||
@@ -2085,6 +2085,8 @@ struct sky2_hw { | |||
2085 | struct timer_list watchdog_timer; | 2085 | struct timer_list watchdog_timer; |
2086 | struct work_struct restart_work; | 2086 | struct work_struct restart_work; |
2087 | wait_queue_head_t msi_wait; | 2087 | wait_queue_head_t msi_wait; |
2088 | |||
2089 | char irq_name[0]; | ||
2088 | }; | 2090 | }; |
2089 | 2091 | ||
2090 | static inline int sky2_is_copper(const struct sky2_hw *hw) | 2092 | static inline int sky2_is_copper(const struct sky2_hw *hw) |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 82b45d8797b4..524691cd9896 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -2412,7 +2412,6 @@ struct ring_info { | |||
2412 | 2412 | ||
2413 | struct tx_ring_info { | 2413 | struct tx_ring_info { |
2414 | struct sk_buff *skb; | 2414 | struct sk_buff *skb; |
2415 | u32 prev_vlan_tag; | ||
2416 | }; | 2415 | }; |
2417 | 2416 | ||
2418 | struct tg3_config_info { | 2417 | struct tg3_config_info { |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index d445845f2779..8d009760277c 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -948,7 +948,7 @@ free: | |||
948 | return err; | 948 | return err; |
949 | } | 949 | } |
950 | 950 | ||
951 | static void virtnet_remove(struct virtio_device *vdev) | 951 | static void __devexit virtnet_remove(struct virtio_device *vdev) |
952 | { | 952 | { |
953 | struct virtnet_info *vi = vdev->priv; | 953 | struct virtnet_info *vi = vdev->priv; |
954 | struct sk_buff *skb; | 954 | struct sk_buff *skb; |
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index 49ea9c92b7e6..d7a764a2fc1a 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
@@ -31,13 +31,12 @@ config STRIP | |||
31 | ---help--- | 31 | ---help--- |
32 | Say Y if you have a Metricom radio and intend to use Starmode Radio | 32 | Say Y if you have a Metricom radio and intend to use Starmode Radio |
33 | IP. STRIP is a radio protocol developed for the MosquitoNet project | 33 | IP. STRIP is a radio protocol developed for the MosquitoNet project |
34 | (on the WWW at <http://mosquitonet.stanford.edu/>) to send Internet | 34 | to send Internet traffic using Metricom radios. Metricom radios are |
35 | traffic using Metricom radios. Metricom radios are small, battery | 35 | small, battery powered, 100kbit/sec packet radio transceivers, about |
36 | powered, 100kbit/sec packet radio transceivers, about the size and | 36 | the size and weight of a cellular telephone. (You may also have heard |
37 | weight of a cellular telephone. (You may also have heard them called | 37 | them called "Metricom modems" but we avoid the term "modem" because |
38 | "Metricom modems" but we avoid the term "modem" because it misleads | 38 | it misleads many people into thinking that you can plug a Metricom |
39 | many people into thinking that you can plug a Metricom modem into a | 39 | modem into a phone line and use it as a modem.) |
40 | phone line and use it as a modem.) | ||
41 | 40 | ||
42 | You can use STRIP on any Linux machine with a serial port, although | 41 | You can use STRIP on any Linux machine with a serial port, although |
43 | it is obviously most useful for people with laptop computers. If you | 42 | it is obviously most useful for people with laptop computers. If you |
diff --git a/drivers/net/wireless/ath/ar9170/phy.c b/drivers/net/wireless/ath/ar9170/phy.c index b3e5cf3735b0..dbd488da18b1 100644 --- a/drivers/net/wireless/ath/ar9170/phy.c +++ b/drivers/net/wireless/ath/ar9170/phy.c | |||
@@ -1141,7 +1141,8 @@ static int ar9170_set_freq_cal_data(struct ar9170 *ar, | |||
1141 | u8 vpds[2][AR5416_PD_GAIN_ICEPTS]; | 1141 | u8 vpds[2][AR5416_PD_GAIN_ICEPTS]; |
1142 | u8 pwrs[2][AR5416_PD_GAIN_ICEPTS]; | 1142 | u8 pwrs[2][AR5416_PD_GAIN_ICEPTS]; |
1143 | int chain, idx, i; | 1143 | int chain, idx, i; |
1144 | u8 f; | 1144 | u32 phy_data = 0; |
1145 | u8 f, tmp; | ||
1145 | 1146 | ||
1146 | switch (channel->band) { | 1147 | switch (channel->band) { |
1147 | case IEEE80211_BAND_2GHZ: | 1148 | case IEEE80211_BAND_2GHZ: |
@@ -1208,9 +1209,6 @@ static int ar9170_set_freq_cal_data(struct ar9170 *ar, | |||
1208 | } | 1209 | } |
1209 | 1210 | ||
1210 | for (i = 0; i < 76; i++) { | 1211 | for (i = 0; i < 76; i++) { |
1211 | u32 phy_data; | ||
1212 | u8 tmp; | ||
1213 | |||
1214 | if (i < 25) { | 1212 | if (i < 25) { |
1215 | tmp = ar9170_interpolate_val(i, &pwrs[0][0], | 1213 | tmp = ar9170_interpolate_val(i, &pwrs[0][0], |
1216 | &vpds[0][0]); | 1214 | &vpds[0][0]); |
diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c index e96091b31499..9c1397996e0a 100644 --- a/drivers/net/wireless/b43/pio.c +++ b/drivers/net/wireless/b43/pio.c | |||
@@ -340,10 +340,15 @@ static u16 tx_write_2byte_queue(struct b43_pio_txqueue *q, | |||
340 | q->mmio_base + B43_PIO_TXDATA, | 340 | q->mmio_base + B43_PIO_TXDATA, |
341 | sizeof(u16)); | 341 | sizeof(u16)); |
342 | if (data_len & 1) { | 342 | if (data_len & 1) { |
343 | u8 tail[2] = { 0, }; | ||
344 | |||
343 | /* Write the last byte. */ | 345 | /* Write the last byte. */ |
344 | ctl &= ~B43_PIO_TXCTL_WRITEHI; | 346 | ctl &= ~B43_PIO_TXCTL_WRITEHI; |
345 | b43_piotx_write16(q, B43_PIO_TXCTL, ctl); | 347 | b43_piotx_write16(q, B43_PIO_TXCTL, ctl); |
346 | b43_piotx_write16(q, B43_PIO_TXDATA, data[data_len - 1]); | 348 | tail[0] = data[data_len - 1]; |
349 | ssb_block_write(dev->dev, tail, 2, | ||
350 | q->mmio_base + B43_PIO_TXDATA, | ||
351 | sizeof(u16)); | ||
347 | } | 352 | } |
348 | 353 | ||
349 | return ctl; | 354 | return ctl; |
@@ -386,26 +391,31 @@ static u32 tx_write_4byte_queue(struct b43_pio_txqueue *q, | |||
386 | q->mmio_base + B43_PIO8_TXDATA, | 391 | q->mmio_base + B43_PIO8_TXDATA, |
387 | sizeof(u32)); | 392 | sizeof(u32)); |
388 | if (data_len & 3) { | 393 | if (data_len & 3) { |
389 | u32 value = 0; | 394 | u8 tail[4] = { 0, }; |
390 | 395 | ||
391 | /* Write the last few bytes. */ | 396 | /* Write the last few bytes. */ |
392 | ctl &= ~(B43_PIO8_TXCTL_8_15 | B43_PIO8_TXCTL_16_23 | | 397 | ctl &= ~(B43_PIO8_TXCTL_8_15 | B43_PIO8_TXCTL_16_23 | |
393 | B43_PIO8_TXCTL_24_31); | 398 | B43_PIO8_TXCTL_24_31); |
394 | data = &(data[data_len - 1]); | ||
395 | switch (data_len & 3) { | 399 | switch (data_len & 3) { |
396 | case 3: | 400 | case 3: |
397 | ctl |= B43_PIO8_TXCTL_16_23; | 401 | ctl |= B43_PIO8_TXCTL_16_23 | B43_PIO8_TXCTL_8_15; |
398 | value |= (u32)(*data) << 16; | 402 | tail[0] = data[data_len - 3]; |
399 | data--; | 403 | tail[1] = data[data_len - 2]; |
404 | tail[2] = data[data_len - 1]; | ||
405 | break; | ||
400 | case 2: | 406 | case 2: |
401 | ctl |= B43_PIO8_TXCTL_8_15; | 407 | ctl |= B43_PIO8_TXCTL_8_15; |
402 | value |= (u32)(*data) << 8; | 408 | tail[0] = data[data_len - 2]; |
403 | data--; | 409 | tail[1] = data[data_len - 1]; |
410 | break; | ||
404 | case 1: | 411 | case 1: |
405 | value |= (u32)(*data); | 412 | tail[0] = data[data_len - 1]; |
413 | break; | ||
406 | } | 414 | } |
407 | b43_piotx_write32(q, B43_PIO8_TXCTL, ctl); | 415 | b43_piotx_write32(q, B43_PIO8_TXCTL, ctl); |
408 | b43_piotx_write32(q, B43_PIO8_TXDATA, value); | 416 | ssb_block_write(dev->dev, tail, 4, |
417 | q->mmio_base + B43_PIO8_TXDATA, | ||
418 | sizeof(u32)); | ||
409 | } | 419 | } |
410 | 420 | ||
411 | return ctl; | 421 | return ctl; |
@@ -693,21 +703,25 @@ data_ready: | |||
693 | q->mmio_base + B43_PIO8_RXDATA, | 703 | q->mmio_base + B43_PIO8_RXDATA, |
694 | sizeof(u32)); | 704 | sizeof(u32)); |
695 | if (len & 3) { | 705 | if (len & 3) { |
696 | u32 value; | 706 | u8 tail[4] = { 0, }; |
697 | char *data; | ||
698 | 707 | ||
699 | /* Read the last few bytes. */ | 708 | /* Read the last few bytes. */ |
700 | value = b43_piorx_read32(q, B43_PIO8_RXDATA); | 709 | ssb_block_read(dev->dev, tail, 4, |
701 | data = &(skb->data[len + padding - 1]); | 710 | q->mmio_base + B43_PIO8_RXDATA, |
711 | sizeof(u32)); | ||
702 | switch (len & 3) { | 712 | switch (len & 3) { |
703 | case 3: | 713 | case 3: |
704 | *data = (value >> 16); | 714 | skb->data[len + padding - 3] = tail[0]; |
705 | data--; | 715 | skb->data[len + padding - 2] = tail[1]; |
716 | skb->data[len + padding - 1] = tail[2]; | ||
717 | break; | ||
706 | case 2: | 718 | case 2: |
707 | *data = (value >> 8); | 719 | skb->data[len + padding - 2] = tail[0]; |
708 | data--; | 720 | skb->data[len + padding - 1] = tail[1]; |
721 | break; | ||
709 | case 1: | 722 | case 1: |
710 | *data = value; | 723 | skb->data[len + padding - 1] = tail[0]; |
724 | break; | ||
711 | } | 725 | } |
712 | } | 726 | } |
713 | } else { | 727 | } else { |
@@ -715,11 +729,13 @@ data_ready: | |||
715 | q->mmio_base + B43_PIO_RXDATA, | 729 | q->mmio_base + B43_PIO_RXDATA, |
716 | sizeof(u16)); | 730 | sizeof(u16)); |
717 | if (len & 1) { | 731 | if (len & 1) { |
718 | u16 value; | 732 | u8 tail[2] = { 0, }; |
719 | 733 | ||
720 | /* Read the last byte. */ | 734 | /* Read the last byte. */ |
721 | value = b43_piorx_read16(q, B43_PIO_RXDATA); | 735 | ssb_block_read(dev->dev, tail, 2, |
722 | skb->data[len + padding - 1] = value; | 736 | q->mmio_base + B43_PIO_RXDATA, |
737 | sizeof(u16)); | ||
738 | skb->data[len + padding - 1] = tail[0]; | ||
723 | } | 739 | } |
724 | } | 740 | } |
725 | 741 | ||
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 896f532182f0..38cfd79e0590 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -631,6 +631,9 @@ static void mac80211_hwsim_bss_info_changed(struct ieee80211_hw *hw, | |||
631 | data->beacon_int = 1024 * info->beacon_int / 1000 * HZ / 1000; | 631 | data->beacon_int = 1024 * info->beacon_int / 1000 * HZ / 1000; |
632 | if (WARN_ON(!data->beacon_int)) | 632 | if (WARN_ON(!data->beacon_int)) |
633 | data->beacon_int = 1; | 633 | data->beacon_int = 1; |
634 | if (data->started) | ||
635 | mod_timer(&data->beacon_timer, | ||
636 | jiffies + data->beacon_int); | ||
634 | } | 637 | } |
635 | 638 | ||
636 | if (changed & BSS_CHANGED_ERP_CTS_PROT) { | 639 | if (changed & BSS_CHANGED_ERP_CTS_PROT) { |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 1cbd9b4a3efc..b8f5ee33445e 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -2381,6 +2381,7 @@ static struct usb_device_id rt73usb_device_table[] = { | |||
2381 | /* Huawei-3Com */ | 2381 | /* Huawei-3Com */ |
2382 | { USB_DEVICE(0x1472, 0x0009), USB_DEVICE_DATA(&rt73usb_ops) }, | 2382 | { USB_DEVICE(0x1472, 0x0009), USB_DEVICE_DATA(&rt73usb_ops) }, |
2383 | /* Hercules */ | 2383 | /* Hercules */ |
2384 | { USB_DEVICE(0x06f8, 0xe002), USB_DEVICE_DATA(&rt73usb_ops) }, | ||
2384 | { USB_DEVICE(0x06f8, 0xe010), USB_DEVICE_DATA(&rt73usb_ops) }, | 2385 | { USB_DEVICE(0x06f8, 0xe010), USB_DEVICE_DATA(&rt73usb_ops) }, |
2385 | { USB_DEVICE(0x06f8, 0xe020), USB_DEVICE_DATA(&rt73usb_ops) }, | 2386 | { USB_DEVICE(0x06f8, 0xe020), USB_DEVICE_DATA(&rt73usb_ops) }, |
2386 | /* Linksys */ | 2387 | /* Linksys */ |
diff --git a/drivers/pcmcia/sa1100_assabet.c b/drivers/pcmcia/sa1100_assabet.c index f424146a2bc9..ac8aa09ba0da 100644 --- a/drivers/pcmcia/sa1100_assabet.c +++ b/drivers/pcmcia/sa1100_assabet.c | |||
@@ -130,7 +130,7 @@ static struct pcmcia_low_level assabet_pcmcia_ops = { | |||
130 | .socket_suspend = assabet_pcmcia_socket_suspend, | 130 | .socket_suspend = assabet_pcmcia_socket_suspend, |
131 | }; | 131 | }; |
132 | 132 | ||
133 | int __init pcmcia_assabet_init(struct device *dev) | 133 | int pcmcia_assabet_init(struct device *dev) |
134 | { | 134 | { |
135 | int ret = -ENODEV; | 135 | int ret = -ENODEV; |
136 | 136 | ||
diff --git a/drivers/pcmcia/sa1100_neponset.c b/drivers/pcmcia/sa1100_neponset.c index 4c41e86ccff9..0c76d337815b 100644 --- a/drivers/pcmcia/sa1100_neponset.c +++ b/drivers/pcmcia/sa1100_neponset.c | |||
@@ -123,7 +123,7 @@ static struct pcmcia_low_level neponset_pcmcia_ops = { | |||
123 | .socket_suspend = sa1111_pcmcia_socket_suspend, | 123 | .socket_suspend = sa1111_pcmcia_socket_suspend, |
124 | }; | 124 | }; |
125 | 125 | ||
126 | int __init pcmcia_neponset_init(struct sa1111_dev *sadev) | 126 | int pcmcia_neponset_init(struct sa1111_dev *sadev) |
127 | { | 127 | { |
128 | int ret = -ENODEV; | 128 | int ret = -ENODEV; |
129 | 129 | ||
diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c index 1b78f639ead3..76769978285f 100644 --- a/drivers/s390/cio/qdio_debug.c +++ b/drivers/s390/cio/qdio_debug.c | |||
@@ -125,7 +125,7 @@ static int qstat_seq_open(struct inode *inode, struct file *filp) | |||
125 | filp->f_path.dentry->d_inode->i_private); | 125 | filp->f_path.dentry->d_inode->i_private); |
126 | } | 126 | } |
127 | 127 | ||
128 | static struct file_operations debugfs_fops = { | 128 | static const struct file_operations debugfs_fops = { |
129 | .owner = THIS_MODULE, | 129 | .owner = THIS_MODULE, |
130 | .open = qstat_seq_open, | 130 | .open = qstat_seq_open, |
131 | .read = seq_read, | 131 | .read = seq_read, |
diff --git a/drivers/s390/cio/qdio_perf.c b/drivers/s390/cio/qdio_perf.c index eff943923c6f..968e3c7c2632 100644 --- a/drivers/s390/cio/qdio_perf.c +++ b/drivers/s390/cio/qdio_perf.c | |||
@@ -84,7 +84,7 @@ static int qdio_perf_seq_open(struct inode *inode, struct file *filp) | |||
84 | return single_open(filp, qdio_perf_proc_show, NULL); | 84 | return single_open(filp, qdio_perf_proc_show, NULL); |
85 | } | 85 | } |
86 | 86 | ||
87 | static struct file_operations qdio_perf_proc_fops = { | 87 | static const struct file_operations qdio_perf_proc_fops = { |
88 | .owner = THIS_MODULE, | 88 | .owner = THIS_MODULE, |
89 | .open = qdio_perf_seq_open, | 89 | .open = qdio_perf_seq_open, |
90 | .read = seq_read, | 90 | .read = seq_read, |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 0cb049f5cc56..747a5e5c1276 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -1317,7 +1317,7 @@ static void sg_rq_end_io(struct request *rq, int uptodate) | |||
1317 | } | 1317 | } |
1318 | } | 1318 | } |
1319 | 1319 | ||
1320 | static struct file_operations sg_fops = { | 1320 | static const struct file_operations sg_fops = { |
1321 | .owner = THIS_MODULE, | 1321 | .owner = THIS_MODULE, |
1322 | .read = sg_read, | 1322 | .read = sg_read, |
1323 | .write = sg_write, | 1323 | .write = sg_write, |
@@ -2194,9 +2194,11 @@ static int sg_proc_seq_show_int(struct seq_file *s, void *v); | |||
2194 | static int sg_proc_single_open_adio(struct inode *inode, struct file *file); | 2194 | static int sg_proc_single_open_adio(struct inode *inode, struct file *file); |
2195 | static ssize_t sg_proc_write_adio(struct file *filp, const char __user *buffer, | 2195 | static ssize_t sg_proc_write_adio(struct file *filp, const char __user *buffer, |
2196 | size_t count, loff_t *off); | 2196 | size_t count, loff_t *off); |
2197 | static struct file_operations adio_fops = { | 2197 | static const struct file_operations adio_fops = { |
2198 | /* .owner, .read and .llseek added in sg_proc_init() */ | 2198 | .owner = THIS_MODULE, |
2199 | .open = sg_proc_single_open_adio, | 2199 | .open = sg_proc_single_open_adio, |
2200 | .read = seq_read, | ||
2201 | .llseek = seq_lseek, | ||
2200 | .write = sg_proc_write_adio, | 2202 | .write = sg_proc_write_adio, |
2201 | .release = single_release, | 2203 | .release = single_release, |
2202 | }; | 2204 | }; |
@@ -2204,23 +2206,32 @@ static struct file_operations adio_fops = { | |||
2204 | static int sg_proc_single_open_dressz(struct inode *inode, struct file *file); | 2206 | static int sg_proc_single_open_dressz(struct inode *inode, struct file *file); |
2205 | static ssize_t sg_proc_write_dressz(struct file *filp, | 2207 | static ssize_t sg_proc_write_dressz(struct file *filp, |
2206 | const char __user *buffer, size_t count, loff_t *off); | 2208 | const char __user *buffer, size_t count, loff_t *off); |
2207 | static struct file_operations dressz_fops = { | 2209 | static const struct file_operations dressz_fops = { |
2210 | .owner = THIS_MODULE, | ||
2208 | .open = sg_proc_single_open_dressz, | 2211 | .open = sg_proc_single_open_dressz, |
2212 | .read = seq_read, | ||
2213 | .llseek = seq_lseek, | ||
2209 | .write = sg_proc_write_dressz, | 2214 | .write = sg_proc_write_dressz, |
2210 | .release = single_release, | 2215 | .release = single_release, |
2211 | }; | 2216 | }; |
2212 | 2217 | ||
2213 | static int sg_proc_seq_show_version(struct seq_file *s, void *v); | 2218 | static int sg_proc_seq_show_version(struct seq_file *s, void *v); |
2214 | static int sg_proc_single_open_version(struct inode *inode, struct file *file); | 2219 | static int sg_proc_single_open_version(struct inode *inode, struct file *file); |
2215 | static struct file_operations version_fops = { | 2220 | static const struct file_operations version_fops = { |
2221 | .owner = THIS_MODULE, | ||
2216 | .open = sg_proc_single_open_version, | 2222 | .open = sg_proc_single_open_version, |
2223 | .read = seq_read, | ||
2224 | .llseek = seq_lseek, | ||
2217 | .release = single_release, | 2225 | .release = single_release, |
2218 | }; | 2226 | }; |
2219 | 2227 | ||
2220 | static int sg_proc_seq_show_devhdr(struct seq_file *s, void *v); | 2228 | static int sg_proc_seq_show_devhdr(struct seq_file *s, void *v); |
2221 | static int sg_proc_single_open_devhdr(struct inode *inode, struct file *file); | 2229 | static int sg_proc_single_open_devhdr(struct inode *inode, struct file *file); |
2222 | static struct file_operations devhdr_fops = { | 2230 | static const struct file_operations devhdr_fops = { |
2231 | .owner = THIS_MODULE, | ||
2223 | .open = sg_proc_single_open_devhdr, | 2232 | .open = sg_proc_single_open_devhdr, |
2233 | .read = seq_read, | ||
2234 | .llseek = seq_lseek, | ||
2224 | .release = single_release, | 2235 | .release = single_release, |
2225 | }; | 2236 | }; |
2226 | 2237 | ||
@@ -2229,8 +2240,11 @@ static int sg_proc_open_dev(struct inode *inode, struct file *file); | |||
2229 | static void * dev_seq_start(struct seq_file *s, loff_t *pos); | 2240 | static void * dev_seq_start(struct seq_file *s, loff_t *pos); |
2230 | static void * dev_seq_next(struct seq_file *s, void *v, loff_t *pos); | 2241 | static void * dev_seq_next(struct seq_file *s, void *v, loff_t *pos); |
2231 | static void dev_seq_stop(struct seq_file *s, void *v); | 2242 | static void dev_seq_stop(struct seq_file *s, void *v); |
2232 | static struct file_operations dev_fops = { | 2243 | static const struct file_operations dev_fops = { |
2244 | .owner = THIS_MODULE, | ||
2233 | .open = sg_proc_open_dev, | 2245 | .open = sg_proc_open_dev, |
2246 | .read = seq_read, | ||
2247 | .llseek = seq_lseek, | ||
2234 | .release = seq_release, | 2248 | .release = seq_release, |
2235 | }; | 2249 | }; |
2236 | static const struct seq_operations dev_seq_ops = { | 2250 | static const struct seq_operations dev_seq_ops = { |
@@ -2242,8 +2256,11 @@ static const struct seq_operations dev_seq_ops = { | |||
2242 | 2256 | ||
2243 | static int sg_proc_seq_show_devstrs(struct seq_file *s, void *v); | 2257 | static int sg_proc_seq_show_devstrs(struct seq_file *s, void *v); |
2244 | static int sg_proc_open_devstrs(struct inode *inode, struct file *file); | 2258 | static int sg_proc_open_devstrs(struct inode *inode, struct file *file); |
2245 | static struct file_operations devstrs_fops = { | 2259 | static const struct file_operations devstrs_fops = { |
2260 | .owner = THIS_MODULE, | ||
2246 | .open = sg_proc_open_devstrs, | 2261 | .open = sg_proc_open_devstrs, |
2262 | .read = seq_read, | ||
2263 | .llseek = seq_lseek, | ||
2247 | .release = seq_release, | 2264 | .release = seq_release, |
2248 | }; | 2265 | }; |
2249 | static const struct seq_operations devstrs_seq_ops = { | 2266 | static const struct seq_operations devstrs_seq_ops = { |
@@ -2255,8 +2272,11 @@ static const struct seq_operations devstrs_seq_ops = { | |||
2255 | 2272 | ||
2256 | static int sg_proc_seq_show_debug(struct seq_file *s, void *v); | 2273 | static int sg_proc_seq_show_debug(struct seq_file *s, void *v); |
2257 | static int sg_proc_open_debug(struct inode *inode, struct file *file); | 2274 | static int sg_proc_open_debug(struct inode *inode, struct file *file); |
2258 | static struct file_operations debug_fops = { | 2275 | static const struct file_operations debug_fops = { |
2276 | .owner = THIS_MODULE, | ||
2259 | .open = sg_proc_open_debug, | 2277 | .open = sg_proc_open_debug, |
2278 | .read = seq_read, | ||
2279 | .llseek = seq_lseek, | ||
2260 | .release = seq_release, | 2280 | .release = seq_release, |
2261 | }; | 2281 | }; |
2262 | static const struct seq_operations debug_seq_ops = { | 2282 | static const struct seq_operations debug_seq_ops = { |
@@ -2269,7 +2289,7 @@ static const struct seq_operations debug_seq_ops = { | |||
2269 | 2289 | ||
2270 | struct sg_proc_leaf { | 2290 | struct sg_proc_leaf { |
2271 | const char * name; | 2291 | const char * name; |
2272 | struct file_operations * fops; | 2292 | const struct file_operations * fops; |
2273 | }; | 2293 | }; |
2274 | 2294 | ||
2275 | static struct sg_proc_leaf sg_proc_leaf_arr[] = { | 2295 | static struct sg_proc_leaf sg_proc_leaf_arr[] = { |
@@ -2295,9 +2315,6 @@ sg_proc_init(void) | |||
2295 | for (k = 0; k < num_leaves; ++k) { | 2315 | for (k = 0; k < num_leaves; ++k) { |
2296 | leaf = &sg_proc_leaf_arr[k]; | 2316 | leaf = &sg_proc_leaf_arr[k]; |
2297 | mask = leaf->fops->write ? S_IRUGO | S_IWUSR : S_IRUGO; | 2317 | mask = leaf->fops->write ? S_IRUGO | S_IWUSR : S_IRUGO; |
2298 | leaf->fops->owner = THIS_MODULE; | ||
2299 | leaf->fops->read = seq_read; | ||
2300 | leaf->fops->llseek = seq_lseek; | ||
2301 | proc_create(leaf->name, mask, sg_proc_sgp, leaf->fops); | 2318 | proc_create(leaf->name, mask, sg_proc_sgp, leaf->fops); |
2302 | } | 2319 | } |
2303 | return 0; | 2320 | return 0; |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 2209620d2349..b1ae774016f1 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -64,6 +64,8 @@ static int serial_index(struct uart_port *port) | |||
64 | return (serial8250_reg.minor - 64) + port->line; | 64 | return (serial8250_reg.minor - 64) + port->line; |
65 | } | 65 | } |
66 | 66 | ||
67 | static unsigned int skip_txen_test; /* force skip of txen test at init time */ | ||
68 | |||
67 | /* | 69 | /* |
68 | * Debugging. | 70 | * Debugging. |
69 | */ | 71 | */ |
@@ -2108,7 +2110,7 @@ static int serial8250_startup(struct uart_port *port) | |||
2108 | is variable. So, let's just don't test if we receive | 2110 | is variable. So, let's just don't test if we receive |
2109 | TX irq. This way, we'll never enable UART_BUG_TXEN. | 2111 | TX irq. This way, we'll never enable UART_BUG_TXEN. |
2110 | */ | 2112 | */ |
2111 | if (up->port.flags & UPF_NO_TXEN_TEST) | 2113 | if (skip_txen_test || up->port.flags & UPF_NO_TXEN_TEST) |
2112 | goto dont_test_tx_en; | 2114 | goto dont_test_tx_en; |
2113 | 2115 | ||
2114 | /* | 2116 | /* |
@@ -3248,6 +3250,9 @@ MODULE_PARM_DESC(share_irqs, "Share IRQs with other non-8250/16x50 devices" | |||
3248 | module_param(nr_uarts, uint, 0644); | 3250 | module_param(nr_uarts, uint, 0644); |
3249 | MODULE_PARM_DESC(nr_uarts, "Maximum number of UARTs supported. (1-" __MODULE_STRING(CONFIG_SERIAL_8250_NR_UARTS) ")"); | 3251 | MODULE_PARM_DESC(nr_uarts, "Maximum number of UARTs supported. (1-" __MODULE_STRING(CONFIG_SERIAL_8250_NR_UARTS) ")"); |
3250 | 3252 | ||
3253 | module_param(skip_txen_test, uint, 0644); | ||
3254 | MODULE_PARM_DESC(skip_txen_test, "Skip checking for the TXEN bug at init time"); | ||
3255 | |||
3251 | #ifdef CONFIG_SERIAL_8250_RSA | 3256 | #ifdef CONFIG_SERIAL_8250_RSA |
3252 | module_param_array(probe_rsa, ulong, &probe_rsa_count, 0444); | 3257 | module_param_array(probe_rsa, ulong, &probe_rsa_count, 0444); |
3253 | MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA"); | 3258 | MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA"); |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index e70712044a7e..e52257257279 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -862,7 +862,7 @@ config SERIAL_IMX_CONSOLE | |||
862 | 862 | ||
863 | config SERIAL_UARTLITE | 863 | config SERIAL_UARTLITE |
864 | tristate "Xilinx uartlite serial port support" | 864 | tristate "Xilinx uartlite serial port support" |
865 | depends on PPC32 || MICROBLAZE | 865 | depends on PPC32 || MICROBLAZE || MFD_TIMBERDALE |
866 | select SERIAL_CORE | 866 | select SERIAL_CORE |
867 | help | 867 | help |
868 | Say Y here if you want to use the Xilinx uartlite serial controller. | 868 | Say Y here if you want to use the Xilinx uartlite serial controller. |
diff --git a/drivers/serial/icom.c b/drivers/serial/icom.c index 2d7feecaf492..0028b6f89ce6 100644 --- a/drivers/serial/icom.c +++ b/drivers/serial/icom.c | |||
@@ -307,7 +307,7 @@ static void stop_processor(struct icom_port *icom_port) | |||
307 | if (port < 4) { | 307 | if (port < 4) { |
308 | temp = readl(stop_proc[port].global_control_reg); | 308 | temp = readl(stop_proc[port].global_control_reg); |
309 | temp = | 309 | temp = |
310 | (temp & ~start_proc[port].processor_id) | stop_proc[port].processor_id; | 310 | (temp & ~start_proc[port].processor_id) | stop_proc[port].processor_id; |
311 | writel(temp, stop_proc[port].global_control_reg); | 311 | writel(temp, stop_proc[port].global_control_reg); |
312 | 312 | ||
313 | /* write flush */ | 313 | /* write flush */ |
@@ -336,7 +336,7 @@ static void start_processor(struct icom_port *icom_port) | |||
336 | if (port < 4) { | 336 | if (port < 4) { |
337 | temp = readl(start_proc[port].global_control_reg); | 337 | temp = readl(start_proc[port].global_control_reg); |
338 | temp = | 338 | temp = |
339 | (temp & ~stop_proc[port].processor_id) | start_proc[port].processor_id; | 339 | (temp & ~stop_proc[port].processor_id) | start_proc[port].processor_id; |
340 | writel(temp, start_proc[port].global_control_reg); | 340 | writel(temp, start_proc[port].global_control_reg); |
341 | 341 | ||
342 | /* write flush */ | 342 | /* write flush */ |
@@ -509,8 +509,8 @@ static void load_code(struct icom_port *icom_port) | |||
509 | dev_err(&icom_port->adapter->pci_dev->dev,"Port not opertional\n"); | 509 | dev_err(&icom_port->adapter->pci_dev->dev,"Port not opertional\n"); |
510 | } | 510 | } |
511 | 511 | ||
512 | if (new_page != NULL) | 512 | if (new_page != NULL) |
513 | pci_free_consistent(dev, 4096, new_page, temp_pci); | 513 | pci_free_consistent(dev, 4096, new_page, temp_pci); |
514 | } | 514 | } |
515 | 515 | ||
516 | static int startup(struct icom_port *icom_port) | 516 | static int startup(struct icom_port *icom_port) |
@@ -1493,15 +1493,15 @@ static int __devinit icom_probe(struct pci_dev *dev, | |||
1493 | const struct pci_device_id *ent) | 1493 | const struct pci_device_id *ent) |
1494 | { | 1494 | { |
1495 | int index; | 1495 | int index; |
1496 | unsigned int command_reg; | 1496 | unsigned int command_reg; |
1497 | int retval; | 1497 | int retval; |
1498 | struct icom_adapter *icom_adapter; | 1498 | struct icom_adapter *icom_adapter; |
1499 | struct icom_port *icom_port; | 1499 | struct icom_port *icom_port; |
1500 | 1500 | ||
1501 | retval = pci_enable_device(dev); | 1501 | retval = pci_enable_device(dev); |
1502 | if (retval) { | 1502 | if (retval) { |
1503 | dev_err(&dev->dev, "Device enable FAILED\n"); | 1503 | dev_err(&dev->dev, "Device enable FAILED\n"); |
1504 | return retval; | 1504 | return retval; |
1505 | } | 1505 | } |
1506 | 1506 | ||
1507 | if ( (retval = pci_request_regions(dev, "icom"))) { | 1507 | if ( (retval = pci_request_regions(dev, "icom"))) { |
@@ -1510,23 +1510,23 @@ static int __devinit icom_probe(struct pci_dev *dev, | |||
1510 | return retval; | 1510 | return retval; |
1511 | } | 1511 | } |
1512 | 1512 | ||
1513 | pci_set_master(dev); | 1513 | pci_set_master(dev); |
1514 | 1514 | ||
1515 | if ( (retval = pci_read_config_dword(dev, PCI_COMMAND, &command_reg))) { | 1515 | if ( (retval = pci_read_config_dword(dev, PCI_COMMAND, &command_reg))) { |
1516 | dev_err(&dev->dev, "PCI Config read FAILED\n"); | 1516 | dev_err(&dev->dev, "PCI Config read FAILED\n"); |
1517 | return retval; | 1517 | return retval; |
1518 | } | 1518 | } |
1519 | 1519 | ||
1520 | pci_write_config_dword(dev, PCI_COMMAND, | 1520 | pci_write_config_dword(dev, PCI_COMMAND, |
1521 | command_reg | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | 1521 | command_reg | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
1522 | | PCI_COMMAND_PARITY | PCI_COMMAND_SERR); | 1522 | | PCI_COMMAND_PARITY | PCI_COMMAND_SERR); |
1523 | 1523 | ||
1524 | if (ent->driver_data == ADAPTER_V1) { | 1524 | if (ent->driver_data == ADAPTER_V1) { |
1525 | pci_write_config_dword(dev, 0x44, 0x8300830A); | 1525 | pci_write_config_dword(dev, 0x44, 0x8300830A); |
1526 | } else { | 1526 | } else { |
1527 | pci_write_config_dword(dev, 0x44, 0x42004200); | 1527 | pci_write_config_dword(dev, 0x44, 0x42004200); |
1528 | pci_write_config_dword(dev, 0x48, 0x42004200); | 1528 | pci_write_config_dword(dev, 0x48, 0x42004200); |
1529 | } | 1529 | } |
1530 | 1530 | ||
1531 | 1531 | ||
1532 | retval = icom_alloc_adapter(&icom_adapter); | 1532 | retval = icom_alloc_adapter(&icom_adapter); |
@@ -1536,10 +1536,10 @@ static int __devinit icom_probe(struct pci_dev *dev, | |||
1536 | goto probe_exit0; | 1536 | goto probe_exit0; |
1537 | } | 1537 | } |
1538 | 1538 | ||
1539 | icom_adapter->base_addr_pci = pci_resource_start(dev, 0); | 1539 | icom_adapter->base_addr_pci = pci_resource_start(dev, 0); |
1540 | icom_adapter->pci_dev = dev; | 1540 | icom_adapter->pci_dev = dev; |
1541 | icom_adapter->version = ent->driver_data; | 1541 | icom_adapter->version = ent->driver_data; |
1542 | icom_adapter->subsystem_id = ent->subdevice; | 1542 | icom_adapter->subsystem_id = ent->subdevice; |
1543 | 1543 | ||
1544 | 1544 | ||
1545 | retval = icom_init_ports(icom_adapter); | 1545 | retval = icom_init_ports(icom_adapter); |
@@ -1548,7 +1548,7 @@ static int __devinit icom_probe(struct pci_dev *dev, | |||
1548 | goto probe_exit1; | 1548 | goto probe_exit1; |
1549 | } | 1549 | } |
1550 | 1550 | ||
1551 | icom_adapter->base_addr = pci_ioremap_bar(dev, 0); | 1551 | icom_adapter->base_addr = pci_ioremap_bar(dev, 0); |
1552 | 1552 | ||
1553 | if (!icom_adapter->base_addr) | 1553 | if (!icom_adapter->base_addr) |
1554 | goto probe_exit1; | 1554 | goto probe_exit1; |
@@ -1562,7 +1562,7 @@ static int __devinit icom_probe(struct pci_dev *dev, | |||
1562 | 1562 | ||
1563 | retval = icom_load_ports(icom_adapter); | 1563 | retval = icom_load_ports(icom_adapter); |
1564 | 1564 | ||
1565 | for (index = 0; index < icom_adapter->numb_ports; index++) { | 1565 | for (index = 0; index < icom_adapter->numb_ports; index++) { |
1566 | icom_port = &icom_adapter->port_info[index]; | 1566 | icom_port = &icom_adapter->port_info[index]; |
1567 | 1567 | ||
1568 | if (icom_port->status == ICOM_PORT_ACTIVE) { | 1568 | if (icom_port->status == ICOM_PORT_ACTIVE) { |
@@ -1579,7 +1579,7 @@ static int __devinit icom_probe(struct pci_dev *dev, | |||
1579 | icom_port->status = ICOM_PORT_OFF; | 1579 | icom_port->status = ICOM_PORT_OFF; |
1580 | dev_err(&dev->dev, "Device add failed\n"); | 1580 | dev_err(&dev->dev, "Device add failed\n"); |
1581 | } else | 1581 | } else |
1582 | dev_info(&dev->dev, "Device added\n"); | 1582 | dev_info(&dev->dev, "Device added\n"); |
1583 | } | 1583 | } |
1584 | } | 1584 | } |
1585 | 1585 | ||
@@ -1595,9 +1595,7 @@ probe_exit0: | |||
1595 | pci_release_regions(dev); | 1595 | pci_release_regions(dev); |
1596 | pci_disable_device(dev); | 1596 | pci_disable_device(dev); |
1597 | 1597 | ||
1598 | return retval; | 1598 | return retval; |
1599 | |||
1600 | |||
1601 | } | 1599 | } |
1602 | 1600 | ||
1603 | static void __devexit icom_remove(struct pci_dev *dev) | 1601 | static void __devexit icom_remove(struct pci_dev *dev) |
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c index 7f5e26873220..2199d819a987 100644 --- a/drivers/serial/sa1100.c +++ b/drivers/serial/sa1100.c | |||
@@ -638,7 +638,7 @@ static void __init sa1100_init_ports(void) | |||
638 | PPSR |= PPC_TXD1 | PPC_TXD3; | 638 | PPSR |= PPC_TXD1 | PPC_TXD3; |
639 | } | 639 | } |
640 | 640 | ||
641 | void __init sa1100_register_uart_fns(struct sa1100_port_fns *fns) | 641 | void __devinit sa1100_register_uart_fns(struct sa1100_port_fns *fns) |
642 | { | 642 | { |
643 | if (fns->get_mctrl) | 643 | if (fns->get_mctrl) |
644 | sa1100_pops.get_mctrl = fns->get_mctrl; | 644 | sa1100_pops.get_mctrl = fns->get_mctrl; |
diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c index 0f7cf4c453e6..c50e9fbbf743 100644 --- a/drivers/serial/serial_txx9.c +++ b/drivers/serial/serial_txx9.c | |||
@@ -221,21 +221,26 @@ sio_quot_set(struct uart_txx9_port *up, int quot) | |||
221 | sio_out(up, TXX9_SIBGR, 0xff | TXX9_SIBGR_BCLK_T6); | 221 | sio_out(up, TXX9_SIBGR, 0xff | TXX9_SIBGR_BCLK_T6); |
222 | } | 222 | } |
223 | 223 | ||
224 | static struct uart_txx9_port *to_uart_txx9_port(struct uart_port *port) | ||
225 | { | ||
226 | return container_of(port, struct uart_txx9_port, port); | ||
227 | } | ||
228 | |||
224 | static void serial_txx9_stop_tx(struct uart_port *port) | 229 | static void serial_txx9_stop_tx(struct uart_port *port) |
225 | { | 230 | { |
226 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | 231 | struct uart_txx9_port *up = to_uart_txx9_port(port); |
227 | sio_mask(up, TXX9_SIDICR, TXX9_SIDICR_TIE); | 232 | sio_mask(up, TXX9_SIDICR, TXX9_SIDICR_TIE); |
228 | } | 233 | } |
229 | 234 | ||
230 | static void serial_txx9_start_tx(struct uart_port *port) | 235 | static void serial_txx9_start_tx(struct uart_port *port) |
231 | { | 236 | { |
232 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | 237 | struct uart_txx9_port *up = to_uart_txx9_port(port); |
233 | sio_set(up, TXX9_SIDICR, TXX9_SIDICR_TIE); | 238 | sio_set(up, TXX9_SIDICR, TXX9_SIDICR_TIE); |
234 | } | 239 | } |
235 | 240 | ||
236 | static void serial_txx9_stop_rx(struct uart_port *port) | 241 | static void serial_txx9_stop_rx(struct uart_port *port) |
237 | { | 242 | { |
238 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | 243 | struct uart_txx9_port *up = to_uart_txx9_port(port); |
239 | up->port.read_status_mask &= ~TXX9_SIDISR_RDIS; | 244 | up->port.read_status_mask &= ~TXX9_SIDISR_RDIS; |
240 | } | 245 | } |
241 | 246 | ||
@@ -246,7 +251,7 @@ static void serial_txx9_enable_ms(struct uart_port *port) | |||
246 | 251 | ||
247 | static void serial_txx9_initialize(struct uart_port *port) | 252 | static void serial_txx9_initialize(struct uart_port *port) |
248 | { | 253 | { |
249 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | 254 | struct uart_txx9_port *up = to_uart_txx9_port(port); |
250 | unsigned int tmout = 10000; | 255 | unsigned int tmout = 10000; |
251 | 256 | ||
252 | sio_out(up, TXX9_SIFCR, TXX9_SIFCR_SWRST); | 257 | sio_out(up, TXX9_SIFCR, TXX9_SIFCR_SWRST); |
@@ -414,7 +419,7 @@ static irqreturn_t serial_txx9_interrupt(int irq, void *dev_id) | |||
414 | 419 | ||
415 | static unsigned int serial_txx9_tx_empty(struct uart_port *port) | 420 | static unsigned int serial_txx9_tx_empty(struct uart_port *port) |
416 | { | 421 | { |
417 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | 422 | struct uart_txx9_port *up = to_uart_txx9_port(port); |
418 | unsigned long flags; | 423 | unsigned long flags; |
419 | unsigned int ret; | 424 | unsigned int ret; |
420 | 425 | ||
@@ -427,7 +432,7 @@ static unsigned int serial_txx9_tx_empty(struct uart_port *port) | |||
427 | 432 | ||
428 | static unsigned int serial_txx9_get_mctrl(struct uart_port *port) | 433 | static unsigned int serial_txx9_get_mctrl(struct uart_port *port) |
429 | { | 434 | { |
430 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | 435 | struct uart_txx9_port *up = to_uart_txx9_port(port); |
431 | unsigned int ret; | 436 | unsigned int ret; |
432 | 437 | ||
433 | /* no modem control lines */ | 438 | /* no modem control lines */ |
@@ -440,7 +445,7 @@ static unsigned int serial_txx9_get_mctrl(struct uart_port *port) | |||
440 | 445 | ||
441 | static void serial_txx9_set_mctrl(struct uart_port *port, unsigned int mctrl) | 446 | static void serial_txx9_set_mctrl(struct uart_port *port, unsigned int mctrl) |
442 | { | 447 | { |
443 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | 448 | struct uart_txx9_port *up = to_uart_txx9_port(port); |
444 | 449 | ||
445 | if (mctrl & TIOCM_RTS) | 450 | if (mctrl & TIOCM_RTS) |
446 | sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSSC); | 451 | sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSSC); |
@@ -450,7 +455,7 @@ static void serial_txx9_set_mctrl(struct uart_port *port, unsigned int mctrl) | |||
450 | 455 | ||
451 | static void serial_txx9_break_ctl(struct uart_port *port, int break_state) | 456 | static void serial_txx9_break_ctl(struct uart_port *port, int break_state) |
452 | { | 457 | { |
453 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | 458 | struct uart_txx9_port *up = to_uart_txx9_port(port); |
454 | unsigned long flags; | 459 | unsigned long flags; |
455 | 460 | ||
456 | spin_lock_irqsave(&up->port.lock, flags); | 461 | spin_lock_irqsave(&up->port.lock, flags); |
@@ -494,7 +499,7 @@ static int serial_txx9_get_poll_char(struct uart_port *port) | |||
494 | { | 499 | { |
495 | unsigned int ier; | 500 | unsigned int ier; |
496 | unsigned char c; | 501 | unsigned char c; |
497 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | 502 | struct uart_txx9_port *up = to_uart_txx9_port(port); |
498 | 503 | ||
499 | /* | 504 | /* |
500 | * First save the IER then disable the interrupts | 505 | * First save the IER then disable the interrupts |
@@ -520,7 +525,7 @@ static int serial_txx9_get_poll_char(struct uart_port *port) | |||
520 | static void serial_txx9_put_poll_char(struct uart_port *port, unsigned char c) | 525 | static void serial_txx9_put_poll_char(struct uart_port *port, unsigned char c) |
521 | { | 526 | { |
522 | unsigned int ier; | 527 | unsigned int ier; |
523 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | 528 | struct uart_txx9_port *up = to_uart_txx9_port(port); |
524 | 529 | ||
525 | /* | 530 | /* |
526 | * First save the IER then disable the interrupts | 531 | * First save the IER then disable the interrupts |
@@ -551,7 +556,7 @@ static void serial_txx9_put_poll_char(struct uart_port *port, unsigned char c) | |||
551 | 556 | ||
552 | static int serial_txx9_startup(struct uart_port *port) | 557 | static int serial_txx9_startup(struct uart_port *port) |
553 | { | 558 | { |
554 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | 559 | struct uart_txx9_port *up = to_uart_txx9_port(port); |
555 | unsigned long flags; | 560 | unsigned long flags; |
556 | int retval; | 561 | int retval; |
557 | 562 | ||
@@ -596,7 +601,7 @@ static int serial_txx9_startup(struct uart_port *port) | |||
596 | 601 | ||
597 | static void serial_txx9_shutdown(struct uart_port *port) | 602 | static void serial_txx9_shutdown(struct uart_port *port) |
598 | { | 603 | { |
599 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | 604 | struct uart_txx9_port *up = to_uart_txx9_port(port); |
600 | unsigned long flags; | 605 | unsigned long flags; |
601 | 606 | ||
602 | /* | 607 | /* |
@@ -636,7 +641,7 @@ static void | |||
636 | serial_txx9_set_termios(struct uart_port *port, struct ktermios *termios, | 641 | serial_txx9_set_termios(struct uart_port *port, struct ktermios *termios, |
637 | struct ktermios *old) | 642 | struct ktermios *old) |
638 | { | 643 | { |
639 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | 644 | struct uart_txx9_port *up = to_uart_txx9_port(port); |
640 | unsigned int cval, fcr = 0; | 645 | unsigned int cval, fcr = 0; |
641 | unsigned long flags; | 646 | unsigned long flags; |
642 | unsigned int baud, quot; | 647 | unsigned int baud, quot; |
@@ -814,19 +819,19 @@ static void serial_txx9_release_resource(struct uart_txx9_port *up) | |||
814 | 819 | ||
815 | static void serial_txx9_release_port(struct uart_port *port) | 820 | static void serial_txx9_release_port(struct uart_port *port) |
816 | { | 821 | { |
817 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | 822 | struct uart_txx9_port *up = to_uart_txx9_port(port); |
818 | serial_txx9_release_resource(up); | 823 | serial_txx9_release_resource(up); |
819 | } | 824 | } |
820 | 825 | ||
821 | static int serial_txx9_request_port(struct uart_port *port) | 826 | static int serial_txx9_request_port(struct uart_port *port) |
822 | { | 827 | { |
823 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | 828 | struct uart_txx9_port *up = to_uart_txx9_port(port); |
824 | return serial_txx9_request_resource(up); | 829 | return serial_txx9_request_resource(up); |
825 | } | 830 | } |
826 | 831 | ||
827 | static void serial_txx9_config_port(struct uart_port *port, int uflags) | 832 | static void serial_txx9_config_port(struct uart_port *port, int uflags) |
828 | { | 833 | { |
829 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | 834 | struct uart_txx9_port *up = to_uart_txx9_port(port); |
830 | int ret; | 835 | int ret; |
831 | 836 | ||
832 | /* | 837 | /* |
@@ -897,7 +902,7 @@ static void __init serial_txx9_register_ports(struct uart_driver *drv, | |||
897 | 902 | ||
898 | static void serial_txx9_console_putchar(struct uart_port *port, int ch) | 903 | static void serial_txx9_console_putchar(struct uart_port *port, int ch) |
899 | { | 904 | { |
900 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | 905 | struct uart_txx9_port *up = to_uart_txx9_port(port); |
901 | 906 | ||
902 | wait_for_xmitr(up); | 907 | wait_for_xmitr(up); |
903 | sio_out(up, TXX9_SITFIFO, ch); | 908 | sio_out(up, TXX9_SITFIFO, ch); |
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index 6d7a3f82c54b..21a118269cac 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile | |||
@@ -17,7 +17,7 @@ obj-$(CONFIG_SPI_BITBANG) += spi_bitbang.o | |||
17 | obj-$(CONFIG_SPI_AU1550) += au1550_spi.o | 17 | obj-$(CONFIG_SPI_AU1550) += au1550_spi.o |
18 | obj-$(CONFIG_SPI_BUTTERFLY) += spi_butterfly.o | 18 | obj-$(CONFIG_SPI_BUTTERFLY) += spi_butterfly.o |
19 | obj-$(CONFIG_SPI_GPIO) += spi_gpio.o | 19 | obj-$(CONFIG_SPI_GPIO) += spi_gpio.o |
20 | obj-$(CONFIG_SPI_IMX) += mxc_spi.o | 20 | obj-$(CONFIG_SPI_IMX) += spi_imx.o |
21 | obj-$(CONFIG_SPI_LM70_LLP) += spi_lm70llp.o | 21 | obj-$(CONFIG_SPI_LM70_LLP) += spi_lm70llp.o |
22 | obj-$(CONFIG_SPI_PXA2XX) += pxa2xx_spi.o | 22 | obj-$(CONFIG_SPI_PXA2XX) += pxa2xx_spi.o |
23 | obj-$(CONFIG_SPI_OMAP_UWIRE) += omap_uwire.o | 23 | obj-$(CONFIG_SPI_OMAP_UWIRE) += omap_uwire.o |
diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/spi_imx.c index b1447236ae81..89c22efedfb0 100644 --- a/drivers/spi/mxc_spi.c +++ b/drivers/spi/spi_imx.c | |||
@@ -48,14 +48,14 @@ | |||
48 | #define MXC_INT_RR (1 << 0) /* Receive data ready interrupt */ | 48 | #define MXC_INT_RR (1 << 0) /* Receive data ready interrupt */ |
49 | #define MXC_INT_TE (1 << 1) /* Transmit FIFO empty interrupt */ | 49 | #define MXC_INT_TE (1 << 1) /* Transmit FIFO empty interrupt */ |
50 | 50 | ||
51 | struct mxc_spi_config { | 51 | struct spi_imx_config { |
52 | unsigned int speed_hz; | 52 | unsigned int speed_hz; |
53 | unsigned int bpw; | 53 | unsigned int bpw; |
54 | unsigned int mode; | 54 | unsigned int mode; |
55 | int cs; | 55 | int cs; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | struct mxc_spi_data { | 58 | struct spi_imx_data { |
59 | struct spi_bitbang bitbang; | 59 | struct spi_bitbang bitbang; |
60 | 60 | ||
61 | struct completion xfer_done; | 61 | struct completion xfer_done; |
@@ -66,43 +66,43 @@ struct mxc_spi_data { | |||
66 | int *chipselect; | 66 | int *chipselect; |
67 | 67 | ||
68 | unsigned int count; | 68 | unsigned int count; |
69 | void (*tx)(struct mxc_spi_data *); | 69 | void (*tx)(struct spi_imx_data *); |
70 | void (*rx)(struct mxc_spi_data *); | 70 | void (*rx)(struct spi_imx_data *); |
71 | void *rx_buf; | 71 | void *rx_buf; |
72 | const void *tx_buf; | 72 | const void *tx_buf; |
73 | unsigned int txfifo; /* number of words pushed in tx FIFO */ | 73 | unsigned int txfifo; /* number of words pushed in tx FIFO */ |
74 | 74 | ||
75 | /* SoC specific functions */ | 75 | /* SoC specific functions */ |
76 | void (*intctrl)(struct mxc_spi_data *, int); | 76 | void (*intctrl)(struct spi_imx_data *, int); |
77 | int (*config)(struct mxc_spi_data *, struct mxc_spi_config *); | 77 | int (*config)(struct spi_imx_data *, struct spi_imx_config *); |
78 | void (*trigger)(struct mxc_spi_data *); | 78 | void (*trigger)(struct spi_imx_data *); |
79 | int (*rx_available)(struct mxc_spi_data *); | 79 | int (*rx_available)(struct spi_imx_data *); |
80 | }; | 80 | }; |
81 | 81 | ||
82 | #define MXC_SPI_BUF_RX(type) \ | 82 | #define MXC_SPI_BUF_RX(type) \ |
83 | static void mxc_spi_buf_rx_##type(struct mxc_spi_data *mxc_spi) \ | 83 | static void spi_imx_buf_rx_##type(struct spi_imx_data *spi_imx) \ |
84 | { \ | 84 | { \ |
85 | unsigned int val = readl(mxc_spi->base + MXC_CSPIRXDATA); \ | 85 | unsigned int val = readl(spi_imx->base + MXC_CSPIRXDATA); \ |
86 | \ | 86 | \ |
87 | if (mxc_spi->rx_buf) { \ | 87 | if (spi_imx->rx_buf) { \ |
88 | *(type *)mxc_spi->rx_buf = val; \ | 88 | *(type *)spi_imx->rx_buf = val; \ |
89 | mxc_spi->rx_buf += sizeof(type); \ | 89 | spi_imx->rx_buf += sizeof(type); \ |
90 | } \ | 90 | } \ |
91 | } | 91 | } |
92 | 92 | ||
93 | #define MXC_SPI_BUF_TX(type) \ | 93 | #define MXC_SPI_BUF_TX(type) \ |
94 | static void mxc_spi_buf_tx_##type(struct mxc_spi_data *mxc_spi) \ | 94 | static void spi_imx_buf_tx_##type(struct spi_imx_data *spi_imx) \ |
95 | { \ | 95 | { \ |
96 | type val = 0; \ | 96 | type val = 0; \ |
97 | \ | 97 | \ |
98 | if (mxc_spi->tx_buf) { \ | 98 | if (spi_imx->tx_buf) { \ |
99 | val = *(type *)mxc_spi->tx_buf; \ | 99 | val = *(type *)spi_imx->tx_buf; \ |
100 | mxc_spi->tx_buf += sizeof(type); \ | 100 | spi_imx->tx_buf += sizeof(type); \ |
101 | } \ | 101 | } \ |
102 | \ | 102 | \ |
103 | mxc_spi->count -= sizeof(type); \ | 103 | spi_imx->count -= sizeof(type); \ |
104 | \ | 104 | \ |
105 | writel(val, mxc_spi->base + MXC_CSPITXDATA); \ | 105 | writel(val, spi_imx->base + MXC_CSPITXDATA); \ |
106 | } | 106 | } |
107 | 107 | ||
108 | MXC_SPI_BUF_RX(u8) | 108 | MXC_SPI_BUF_RX(u8) |
@@ -119,7 +119,7 @@ static int mxc_clkdivs[] = {0, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, | |||
119 | 256, 384, 512, 768, 1024}; | 119 | 256, 384, 512, 768, 1024}; |
120 | 120 | ||
121 | /* MX21, MX27 */ | 121 | /* MX21, MX27 */ |
122 | static unsigned int mxc_spi_clkdiv_1(unsigned int fin, | 122 | static unsigned int spi_imx_clkdiv_1(unsigned int fin, |
123 | unsigned int fspi) | 123 | unsigned int fspi) |
124 | { | 124 | { |
125 | int i, max; | 125 | int i, max; |
@@ -137,7 +137,7 @@ static unsigned int mxc_spi_clkdiv_1(unsigned int fin, | |||
137 | } | 137 | } |
138 | 138 | ||
139 | /* MX1, MX31, MX35 */ | 139 | /* MX1, MX31, MX35 */ |
140 | static unsigned int mxc_spi_clkdiv_2(unsigned int fin, | 140 | static unsigned int spi_imx_clkdiv_2(unsigned int fin, |
141 | unsigned int fspi) | 141 | unsigned int fspi) |
142 | { | 142 | { |
143 | int i, div = 4; | 143 | int i, div = 4; |
@@ -174,7 +174,7 @@ static unsigned int mxc_spi_clkdiv_2(unsigned int fin, | |||
174 | * the i.MX35 has a slightly different register layout for bits | 174 | * the i.MX35 has a slightly different register layout for bits |
175 | * we do not use here. | 175 | * we do not use here. |
176 | */ | 176 | */ |
177 | static void mx31_intctrl(struct mxc_spi_data *mxc_spi, int enable) | 177 | static void mx31_intctrl(struct spi_imx_data *spi_imx, int enable) |
178 | { | 178 | { |
179 | unsigned int val = 0; | 179 | unsigned int val = 0; |
180 | 180 | ||
@@ -183,24 +183,24 @@ static void mx31_intctrl(struct mxc_spi_data *mxc_spi, int enable) | |||
183 | if (enable & MXC_INT_RR) | 183 | if (enable & MXC_INT_RR) |
184 | val |= MX31_INTREG_RREN; | 184 | val |= MX31_INTREG_RREN; |
185 | 185 | ||
186 | writel(val, mxc_spi->base + MXC_CSPIINT); | 186 | writel(val, spi_imx->base + MXC_CSPIINT); |
187 | } | 187 | } |
188 | 188 | ||
189 | static void mx31_trigger(struct mxc_spi_data *mxc_spi) | 189 | static void mx31_trigger(struct spi_imx_data *spi_imx) |
190 | { | 190 | { |
191 | unsigned int reg; | 191 | unsigned int reg; |
192 | 192 | ||
193 | reg = readl(mxc_spi->base + MXC_CSPICTRL); | 193 | reg = readl(spi_imx->base + MXC_CSPICTRL); |
194 | reg |= MX31_CSPICTRL_XCH; | 194 | reg |= MX31_CSPICTRL_XCH; |
195 | writel(reg, mxc_spi->base + MXC_CSPICTRL); | 195 | writel(reg, spi_imx->base + MXC_CSPICTRL); |
196 | } | 196 | } |
197 | 197 | ||
198 | static int mx31_config(struct mxc_spi_data *mxc_spi, | 198 | static int mx31_config(struct spi_imx_data *spi_imx, |
199 | struct mxc_spi_config *config) | 199 | struct spi_imx_config *config) |
200 | { | 200 | { |
201 | unsigned int reg = MX31_CSPICTRL_ENABLE | MX31_CSPICTRL_MASTER; | 201 | unsigned int reg = MX31_CSPICTRL_ENABLE | MX31_CSPICTRL_MASTER; |
202 | 202 | ||
203 | reg |= mxc_spi_clkdiv_2(mxc_spi->spi_clk, config->speed_hz) << | 203 | reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, config->speed_hz) << |
204 | MX31_CSPICTRL_DR_SHIFT; | 204 | MX31_CSPICTRL_DR_SHIFT; |
205 | 205 | ||
206 | if (cpu_is_mx31()) | 206 | if (cpu_is_mx31()) |
@@ -223,14 +223,14 @@ static int mx31_config(struct mxc_spi_data *mxc_spi, | |||
223 | reg |= (config->cs + 32) << MX35_CSPICTRL_CS_SHIFT; | 223 | reg |= (config->cs + 32) << MX35_CSPICTRL_CS_SHIFT; |
224 | } | 224 | } |
225 | 225 | ||
226 | writel(reg, mxc_spi->base + MXC_CSPICTRL); | 226 | writel(reg, spi_imx->base + MXC_CSPICTRL); |
227 | 227 | ||
228 | return 0; | 228 | return 0; |
229 | } | 229 | } |
230 | 230 | ||
231 | static int mx31_rx_available(struct mxc_spi_data *mxc_spi) | 231 | static int mx31_rx_available(struct spi_imx_data *spi_imx) |
232 | { | 232 | { |
233 | return readl(mxc_spi->base + MX31_CSPISTATUS) & MX31_STATUS_RR; | 233 | return readl(spi_imx->base + MX31_CSPISTATUS) & MX31_STATUS_RR; |
234 | } | 234 | } |
235 | 235 | ||
236 | #define MX27_INTREG_RR (1 << 4) | 236 | #define MX27_INTREG_RR (1 << 4) |
@@ -246,7 +246,7 @@ static int mx31_rx_available(struct mxc_spi_data *mxc_spi) | |||
246 | #define MX27_CSPICTRL_DR_SHIFT 14 | 246 | #define MX27_CSPICTRL_DR_SHIFT 14 |
247 | #define MX27_CSPICTRL_CS_SHIFT 19 | 247 | #define MX27_CSPICTRL_CS_SHIFT 19 |
248 | 248 | ||
249 | static void mx27_intctrl(struct mxc_spi_data *mxc_spi, int enable) | 249 | static void mx27_intctrl(struct spi_imx_data *spi_imx, int enable) |
250 | { | 250 | { |
251 | unsigned int val = 0; | 251 | unsigned int val = 0; |
252 | 252 | ||
@@ -255,24 +255,24 @@ static void mx27_intctrl(struct mxc_spi_data *mxc_spi, int enable) | |||
255 | if (enable & MXC_INT_RR) | 255 | if (enable & MXC_INT_RR) |
256 | val |= MX27_INTREG_RREN; | 256 | val |= MX27_INTREG_RREN; |
257 | 257 | ||
258 | writel(val, mxc_spi->base + MXC_CSPIINT); | 258 | writel(val, spi_imx->base + MXC_CSPIINT); |
259 | } | 259 | } |
260 | 260 | ||
261 | static void mx27_trigger(struct mxc_spi_data *mxc_spi) | 261 | static void mx27_trigger(struct spi_imx_data *spi_imx) |
262 | { | 262 | { |
263 | unsigned int reg; | 263 | unsigned int reg; |
264 | 264 | ||
265 | reg = readl(mxc_spi->base + MXC_CSPICTRL); | 265 | reg = readl(spi_imx->base + MXC_CSPICTRL); |
266 | reg |= MX27_CSPICTRL_XCH; | 266 | reg |= MX27_CSPICTRL_XCH; |
267 | writel(reg, mxc_spi->base + MXC_CSPICTRL); | 267 | writel(reg, spi_imx->base + MXC_CSPICTRL); |
268 | } | 268 | } |
269 | 269 | ||
270 | static int mx27_config(struct mxc_spi_data *mxc_spi, | 270 | static int mx27_config(struct spi_imx_data *spi_imx, |
271 | struct mxc_spi_config *config) | 271 | struct spi_imx_config *config) |
272 | { | 272 | { |
273 | unsigned int reg = MX27_CSPICTRL_ENABLE | MX27_CSPICTRL_MASTER; | 273 | unsigned int reg = MX27_CSPICTRL_ENABLE | MX27_CSPICTRL_MASTER; |
274 | 274 | ||
275 | reg |= mxc_spi_clkdiv_1(mxc_spi->spi_clk, config->speed_hz) << | 275 | reg |= spi_imx_clkdiv_1(spi_imx->spi_clk, config->speed_hz) << |
276 | MX27_CSPICTRL_DR_SHIFT; | 276 | MX27_CSPICTRL_DR_SHIFT; |
277 | reg |= config->bpw - 1; | 277 | reg |= config->bpw - 1; |
278 | 278 | ||
@@ -285,14 +285,14 @@ static int mx27_config(struct mxc_spi_data *mxc_spi, | |||
285 | if (config->cs < 0) | 285 | if (config->cs < 0) |
286 | reg |= (config->cs + 32) << MX27_CSPICTRL_CS_SHIFT; | 286 | reg |= (config->cs + 32) << MX27_CSPICTRL_CS_SHIFT; |
287 | 287 | ||
288 | writel(reg, mxc_spi->base + MXC_CSPICTRL); | 288 | writel(reg, spi_imx->base + MXC_CSPICTRL); |
289 | 289 | ||
290 | return 0; | 290 | return 0; |
291 | } | 291 | } |
292 | 292 | ||
293 | static int mx27_rx_available(struct mxc_spi_data *mxc_spi) | 293 | static int mx27_rx_available(struct spi_imx_data *spi_imx) |
294 | { | 294 | { |
295 | return readl(mxc_spi->base + MXC_CSPIINT) & MX27_INTREG_RR; | 295 | return readl(spi_imx->base + MXC_CSPIINT) & MX27_INTREG_RR; |
296 | } | 296 | } |
297 | 297 | ||
298 | #define MX1_INTREG_RR (1 << 3) | 298 | #define MX1_INTREG_RR (1 << 3) |
@@ -306,7 +306,7 @@ static int mx27_rx_available(struct mxc_spi_data *mxc_spi) | |||
306 | #define MX1_CSPICTRL_MASTER (1 << 10) | 306 | #define MX1_CSPICTRL_MASTER (1 << 10) |
307 | #define MX1_CSPICTRL_DR_SHIFT 13 | 307 | #define MX1_CSPICTRL_DR_SHIFT 13 |
308 | 308 | ||
309 | static void mx1_intctrl(struct mxc_spi_data *mxc_spi, int enable) | 309 | static void mx1_intctrl(struct spi_imx_data *spi_imx, int enable) |
310 | { | 310 | { |
311 | unsigned int val = 0; | 311 | unsigned int val = 0; |
312 | 312 | ||
@@ -315,24 +315,24 @@ static void mx1_intctrl(struct mxc_spi_data *mxc_spi, int enable) | |||
315 | if (enable & MXC_INT_RR) | 315 | if (enable & MXC_INT_RR) |
316 | val |= MX1_INTREG_RREN; | 316 | val |= MX1_INTREG_RREN; |
317 | 317 | ||
318 | writel(val, mxc_spi->base + MXC_CSPIINT); | 318 | writel(val, spi_imx->base + MXC_CSPIINT); |
319 | } | 319 | } |
320 | 320 | ||
321 | static void mx1_trigger(struct mxc_spi_data *mxc_spi) | 321 | static void mx1_trigger(struct spi_imx_data *spi_imx) |
322 | { | 322 | { |
323 | unsigned int reg; | 323 | unsigned int reg; |
324 | 324 | ||
325 | reg = readl(mxc_spi->base + MXC_CSPICTRL); | 325 | reg = readl(spi_imx->base + MXC_CSPICTRL); |
326 | reg |= MX1_CSPICTRL_XCH; | 326 | reg |= MX1_CSPICTRL_XCH; |
327 | writel(reg, mxc_spi->base + MXC_CSPICTRL); | 327 | writel(reg, spi_imx->base + MXC_CSPICTRL); |
328 | } | 328 | } |
329 | 329 | ||
330 | static int mx1_config(struct mxc_spi_data *mxc_spi, | 330 | static int mx1_config(struct spi_imx_data *spi_imx, |
331 | struct mxc_spi_config *config) | 331 | struct spi_imx_config *config) |
332 | { | 332 | { |
333 | unsigned int reg = MX1_CSPICTRL_ENABLE | MX1_CSPICTRL_MASTER; | 333 | unsigned int reg = MX1_CSPICTRL_ENABLE | MX1_CSPICTRL_MASTER; |
334 | 334 | ||
335 | reg |= mxc_spi_clkdiv_2(mxc_spi->spi_clk, config->speed_hz) << | 335 | reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, config->speed_hz) << |
336 | MX1_CSPICTRL_DR_SHIFT; | 336 | MX1_CSPICTRL_DR_SHIFT; |
337 | reg |= config->bpw - 1; | 337 | reg |= config->bpw - 1; |
338 | 338 | ||
@@ -341,156 +341,151 @@ static int mx1_config(struct mxc_spi_data *mxc_spi, | |||
341 | if (config->mode & SPI_CPOL) | 341 | if (config->mode & SPI_CPOL) |
342 | reg |= MX1_CSPICTRL_POL; | 342 | reg |= MX1_CSPICTRL_POL; |
343 | 343 | ||
344 | writel(reg, mxc_spi->base + MXC_CSPICTRL); | 344 | writel(reg, spi_imx->base + MXC_CSPICTRL); |
345 | 345 | ||
346 | return 0; | 346 | return 0; |
347 | } | 347 | } |
348 | 348 | ||
349 | static int mx1_rx_available(struct mxc_spi_data *mxc_spi) | 349 | static int mx1_rx_available(struct spi_imx_data *spi_imx) |
350 | { | 350 | { |
351 | return readl(mxc_spi->base + MXC_CSPIINT) & MX1_INTREG_RR; | 351 | return readl(spi_imx->base + MXC_CSPIINT) & MX1_INTREG_RR; |
352 | } | 352 | } |
353 | 353 | ||
354 | static void mxc_spi_chipselect(struct spi_device *spi, int is_active) | 354 | static void spi_imx_chipselect(struct spi_device *spi, int is_active) |
355 | { | 355 | { |
356 | struct mxc_spi_data *mxc_spi = spi_master_get_devdata(spi->master); | 356 | struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master); |
357 | unsigned int cs = 0; | 357 | int gpio = spi_imx->chipselect[spi->chip_select]; |
358 | int gpio = mxc_spi->chipselect[spi->chip_select]; | 358 | int active = is_active != BITBANG_CS_INACTIVE; |
359 | struct mxc_spi_config config; | 359 | int dev_is_lowactive = !(spi->mode & SPI_CS_HIGH); |
360 | 360 | ||
361 | if (spi->mode & SPI_CS_HIGH) | 361 | if (gpio < 0) |
362 | cs = 1; | ||
363 | |||
364 | if (is_active == BITBANG_CS_INACTIVE) { | ||
365 | if (gpio >= 0) | ||
366 | gpio_set_value(gpio, !cs); | ||
367 | return; | 362 | return; |
368 | } | ||
369 | |||
370 | config.bpw = spi->bits_per_word; | ||
371 | config.speed_hz = spi->max_speed_hz; | ||
372 | config.mode = spi->mode; | ||
373 | config.cs = mxc_spi->chipselect[spi->chip_select]; | ||
374 | |||
375 | mxc_spi->config(mxc_spi, &config); | ||
376 | |||
377 | /* Initialize the functions for transfer */ | ||
378 | if (config.bpw <= 8) { | ||
379 | mxc_spi->rx = mxc_spi_buf_rx_u8; | ||
380 | mxc_spi->tx = mxc_spi_buf_tx_u8; | ||
381 | } else if (config.bpw <= 16) { | ||
382 | mxc_spi->rx = mxc_spi_buf_rx_u16; | ||
383 | mxc_spi->tx = mxc_spi_buf_tx_u16; | ||
384 | } else if (config.bpw <= 32) { | ||
385 | mxc_spi->rx = mxc_spi_buf_rx_u32; | ||
386 | mxc_spi->tx = mxc_spi_buf_tx_u32; | ||
387 | } else | ||
388 | BUG(); | ||
389 | 363 | ||
390 | if (gpio >= 0) | 364 | gpio_set_value(gpio, dev_is_lowactive ^ active); |
391 | gpio_set_value(gpio, cs); | ||
392 | |||
393 | return; | ||
394 | } | 365 | } |
395 | 366 | ||
396 | static void mxc_spi_push(struct mxc_spi_data *mxc_spi) | 367 | static void spi_imx_push(struct spi_imx_data *spi_imx) |
397 | { | 368 | { |
398 | while (mxc_spi->txfifo < 8) { | 369 | while (spi_imx->txfifo < 8) { |
399 | if (!mxc_spi->count) | 370 | if (!spi_imx->count) |
400 | break; | 371 | break; |
401 | mxc_spi->tx(mxc_spi); | 372 | spi_imx->tx(spi_imx); |
402 | mxc_spi->txfifo++; | 373 | spi_imx->txfifo++; |
403 | } | 374 | } |
404 | 375 | ||
405 | mxc_spi->trigger(mxc_spi); | 376 | spi_imx->trigger(spi_imx); |
406 | } | 377 | } |
407 | 378 | ||
408 | static irqreturn_t mxc_spi_isr(int irq, void *dev_id) | 379 | static irqreturn_t spi_imx_isr(int irq, void *dev_id) |
409 | { | 380 | { |
410 | struct mxc_spi_data *mxc_spi = dev_id; | 381 | struct spi_imx_data *spi_imx = dev_id; |
411 | 382 | ||
412 | while (mxc_spi->rx_available(mxc_spi)) { | 383 | while (spi_imx->rx_available(spi_imx)) { |
413 | mxc_spi->rx(mxc_spi); | 384 | spi_imx->rx(spi_imx); |
414 | mxc_spi->txfifo--; | 385 | spi_imx->txfifo--; |
415 | } | 386 | } |
416 | 387 | ||
417 | if (mxc_spi->count) { | 388 | if (spi_imx->count) { |
418 | mxc_spi_push(mxc_spi); | 389 | spi_imx_push(spi_imx); |
419 | return IRQ_HANDLED; | 390 | return IRQ_HANDLED; |
420 | } | 391 | } |
421 | 392 | ||
422 | if (mxc_spi->txfifo) { | 393 | if (spi_imx->txfifo) { |
423 | /* No data left to push, but still waiting for rx data, | 394 | /* No data left to push, but still waiting for rx data, |
424 | * enable receive data available interrupt. | 395 | * enable receive data available interrupt. |
425 | */ | 396 | */ |
426 | mxc_spi->intctrl(mxc_spi, MXC_INT_RR); | 397 | spi_imx->intctrl(spi_imx, MXC_INT_RR); |
427 | return IRQ_HANDLED; | 398 | return IRQ_HANDLED; |
428 | } | 399 | } |
429 | 400 | ||
430 | mxc_spi->intctrl(mxc_spi, 0); | 401 | spi_imx->intctrl(spi_imx, 0); |
431 | complete(&mxc_spi->xfer_done); | 402 | complete(&spi_imx->xfer_done); |
432 | 403 | ||
433 | return IRQ_HANDLED; | 404 | return IRQ_HANDLED; |
434 | } | 405 | } |
435 | 406 | ||
436 | static int mxc_spi_setupxfer(struct spi_device *spi, | 407 | static int spi_imx_setupxfer(struct spi_device *spi, |
437 | struct spi_transfer *t) | 408 | struct spi_transfer *t) |
438 | { | 409 | { |
439 | struct mxc_spi_data *mxc_spi = spi_master_get_devdata(spi->master); | 410 | struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master); |
440 | struct mxc_spi_config config; | 411 | struct spi_imx_config config; |
441 | 412 | ||
442 | config.bpw = t ? t->bits_per_word : spi->bits_per_word; | 413 | config.bpw = t ? t->bits_per_word : spi->bits_per_word; |
443 | config.speed_hz = t ? t->speed_hz : spi->max_speed_hz; | 414 | config.speed_hz = t ? t->speed_hz : spi->max_speed_hz; |
444 | config.mode = spi->mode; | 415 | config.mode = spi->mode; |
416 | config.cs = spi_imx->chipselect[spi->chip_select]; | ||
417 | |||
418 | if (!config.speed_hz) | ||
419 | config.speed_hz = spi->max_speed_hz; | ||
420 | if (!config.bpw) | ||
421 | config.bpw = spi->bits_per_word; | ||
422 | if (!config.speed_hz) | ||
423 | config.speed_hz = spi->max_speed_hz; | ||
424 | |||
425 | /* Initialize the functions for transfer */ | ||
426 | if (config.bpw <= 8) { | ||
427 | spi_imx->rx = spi_imx_buf_rx_u8; | ||
428 | spi_imx->tx = spi_imx_buf_tx_u8; | ||
429 | } else if (config.bpw <= 16) { | ||
430 | spi_imx->rx = spi_imx_buf_rx_u16; | ||
431 | spi_imx->tx = spi_imx_buf_tx_u16; | ||
432 | } else if (config.bpw <= 32) { | ||
433 | spi_imx->rx = spi_imx_buf_rx_u32; | ||
434 | spi_imx->tx = spi_imx_buf_tx_u32; | ||
435 | } else | ||
436 | BUG(); | ||
445 | 437 | ||
446 | mxc_spi->config(mxc_spi, &config); | 438 | spi_imx->config(spi_imx, &config); |
447 | 439 | ||
448 | return 0; | 440 | return 0; |
449 | } | 441 | } |
450 | 442 | ||
451 | static int mxc_spi_transfer(struct spi_device *spi, | 443 | static int spi_imx_transfer(struct spi_device *spi, |
452 | struct spi_transfer *transfer) | 444 | struct spi_transfer *transfer) |
453 | { | 445 | { |
454 | struct mxc_spi_data *mxc_spi = spi_master_get_devdata(spi->master); | 446 | struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master); |
455 | 447 | ||
456 | mxc_spi->tx_buf = transfer->tx_buf; | 448 | spi_imx->tx_buf = transfer->tx_buf; |
457 | mxc_spi->rx_buf = transfer->rx_buf; | 449 | spi_imx->rx_buf = transfer->rx_buf; |
458 | mxc_spi->count = transfer->len; | 450 | spi_imx->count = transfer->len; |
459 | mxc_spi->txfifo = 0; | 451 | spi_imx->txfifo = 0; |
460 | 452 | ||
461 | init_completion(&mxc_spi->xfer_done); | 453 | init_completion(&spi_imx->xfer_done); |
462 | 454 | ||
463 | mxc_spi_push(mxc_spi); | 455 | spi_imx_push(spi_imx); |
464 | 456 | ||
465 | mxc_spi->intctrl(mxc_spi, MXC_INT_TE); | 457 | spi_imx->intctrl(spi_imx, MXC_INT_TE); |
466 | 458 | ||
467 | wait_for_completion(&mxc_spi->xfer_done); | 459 | wait_for_completion(&spi_imx->xfer_done); |
468 | 460 | ||
469 | return transfer->len; | 461 | return transfer->len; |
470 | } | 462 | } |
471 | 463 | ||
472 | static int mxc_spi_setup(struct spi_device *spi) | 464 | static int spi_imx_setup(struct spi_device *spi) |
473 | { | 465 | { |
474 | if (!spi->bits_per_word) | 466 | struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master); |
475 | spi->bits_per_word = 8; | 467 | int gpio = spi_imx->chipselect[spi->chip_select]; |
476 | 468 | ||
477 | pr_debug("%s: mode %d, %u bpw, %d hz\n", __func__, | 469 | pr_debug("%s: mode %d, %u bpw, %d hz\n", __func__, |
478 | spi->mode, spi->bits_per_word, spi->max_speed_hz); | 470 | spi->mode, spi->bits_per_word, spi->max_speed_hz); |
479 | 471 | ||
480 | mxc_spi_chipselect(spi, BITBANG_CS_INACTIVE); | 472 | if (gpio >= 0) |
473 | gpio_direction_output(gpio, spi->mode & SPI_CS_HIGH ? 0 : 1); | ||
474 | |||
475 | spi_imx_chipselect(spi, BITBANG_CS_INACTIVE); | ||
481 | 476 | ||
482 | return 0; | 477 | return 0; |
483 | } | 478 | } |
484 | 479 | ||
485 | static void mxc_spi_cleanup(struct spi_device *spi) | 480 | static void spi_imx_cleanup(struct spi_device *spi) |
486 | { | 481 | { |
487 | } | 482 | } |
488 | 483 | ||
489 | static int __init mxc_spi_probe(struct platform_device *pdev) | 484 | static int __init spi_imx_probe(struct platform_device *pdev) |
490 | { | 485 | { |
491 | struct spi_imx_master *mxc_platform_info; | 486 | struct spi_imx_master *mxc_platform_info; |
492 | struct spi_master *master; | 487 | struct spi_master *master; |
493 | struct mxc_spi_data *mxc_spi; | 488 | struct spi_imx_data *spi_imx; |
494 | struct resource *res; | 489 | struct resource *res; |
495 | int i, ret; | 490 | int i, ret; |
496 | 491 | ||
@@ -500,7 +495,7 @@ static int __init mxc_spi_probe(struct platform_device *pdev) | |||
500 | return -EINVAL; | 495 | return -EINVAL; |
501 | } | 496 | } |
502 | 497 | ||
503 | master = spi_alloc_master(&pdev->dev, sizeof(struct mxc_spi_data)); | 498 | master = spi_alloc_master(&pdev->dev, sizeof(struct spi_imx_data)); |
504 | if (!master) | 499 | if (!master) |
505 | return -ENOMEM; | 500 | return -ENOMEM; |
506 | 501 | ||
@@ -509,32 +504,32 @@ static int __init mxc_spi_probe(struct platform_device *pdev) | |||
509 | master->bus_num = pdev->id; | 504 | master->bus_num = pdev->id; |
510 | master->num_chipselect = mxc_platform_info->num_chipselect; | 505 | master->num_chipselect = mxc_platform_info->num_chipselect; |
511 | 506 | ||
512 | mxc_spi = spi_master_get_devdata(master); | 507 | spi_imx = spi_master_get_devdata(master); |
513 | mxc_spi->bitbang.master = spi_master_get(master); | 508 | spi_imx->bitbang.master = spi_master_get(master); |
514 | mxc_spi->chipselect = mxc_platform_info->chipselect; | 509 | spi_imx->chipselect = mxc_platform_info->chipselect; |
515 | 510 | ||
516 | for (i = 0; i < master->num_chipselect; i++) { | 511 | for (i = 0; i < master->num_chipselect; i++) { |
517 | if (mxc_spi->chipselect[i] < 0) | 512 | if (spi_imx->chipselect[i] < 0) |
518 | continue; | 513 | continue; |
519 | ret = gpio_request(mxc_spi->chipselect[i], DRIVER_NAME); | 514 | ret = gpio_request(spi_imx->chipselect[i], DRIVER_NAME); |
520 | if (ret) { | 515 | if (ret) { |
521 | i--; | 516 | i--; |
522 | while (i > 0) | 517 | while (i > 0) |
523 | if (mxc_spi->chipselect[i] >= 0) | 518 | if (spi_imx->chipselect[i] >= 0) |
524 | gpio_free(mxc_spi->chipselect[i--]); | 519 | gpio_free(spi_imx->chipselect[i--]); |
525 | dev_err(&pdev->dev, "can't get cs gpios"); | 520 | dev_err(&pdev->dev, "can't get cs gpios"); |
526 | goto out_master_put; | 521 | goto out_master_put; |
527 | } | 522 | } |
528 | gpio_direction_output(mxc_spi->chipselect[i], 1); | ||
529 | } | 523 | } |
530 | 524 | ||
531 | mxc_spi->bitbang.chipselect = mxc_spi_chipselect; | 525 | spi_imx->bitbang.chipselect = spi_imx_chipselect; |
532 | mxc_spi->bitbang.setup_transfer = mxc_spi_setupxfer; | 526 | spi_imx->bitbang.setup_transfer = spi_imx_setupxfer; |
533 | mxc_spi->bitbang.txrx_bufs = mxc_spi_transfer; | 527 | spi_imx->bitbang.txrx_bufs = spi_imx_transfer; |
534 | mxc_spi->bitbang.master->setup = mxc_spi_setup; | 528 | spi_imx->bitbang.master->setup = spi_imx_setup; |
535 | mxc_spi->bitbang.master->cleanup = mxc_spi_cleanup; | 529 | spi_imx->bitbang.master->cleanup = spi_imx_cleanup; |
530 | spi_imx->bitbang.master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; | ||
536 | 531 | ||
537 | init_completion(&mxc_spi->xfer_done); | 532 | init_completion(&spi_imx->xfer_done); |
538 | 533 | ||
539 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 534 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
540 | if (!res) { | 535 | if (!res) { |
@@ -549,58 +544,58 @@ static int __init mxc_spi_probe(struct platform_device *pdev) | |||
549 | goto out_gpio_free; | 544 | goto out_gpio_free; |
550 | } | 545 | } |
551 | 546 | ||
552 | mxc_spi->base = ioremap(res->start, resource_size(res)); | 547 | spi_imx->base = ioremap(res->start, resource_size(res)); |
553 | if (!mxc_spi->base) { | 548 | if (!spi_imx->base) { |
554 | ret = -EINVAL; | 549 | ret = -EINVAL; |
555 | goto out_release_mem; | 550 | goto out_release_mem; |
556 | } | 551 | } |
557 | 552 | ||
558 | mxc_spi->irq = platform_get_irq(pdev, 0); | 553 | spi_imx->irq = platform_get_irq(pdev, 0); |
559 | if (!mxc_spi->irq) { | 554 | if (!spi_imx->irq) { |
560 | ret = -EINVAL; | 555 | ret = -EINVAL; |
561 | goto out_iounmap; | 556 | goto out_iounmap; |
562 | } | 557 | } |
563 | 558 | ||
564 | ret = request_irq(mxc_spi->irq, mxc_spi_isr, 0, DRIVER_NAME, mxc_spi); | 559 | ret = request_irq(spi_imx->irq, spi_imx_isr, 0, DRIVER_NAME, spi_imx); |
565 | if (ret) { | 560 | if (ret) { |
566 | dev_err(&pdev->dev, "can't get irq%d: %d\n", mxc_spi->irq, ret); | 561 | dev_err(&pdev->dev, "can't get irq%d: %d\n", spi_imx->irq, ret); |
567 | goto out_iounmap; | 562 | goto out_iounmap; |
568 | } | 563 | } |
569 | 564 | ||
570 | if (cpu_is_mx31() || cpu_is_mx35()) { | 565 | if (cpu_is_mx31() || cpu_is_mx35()) { |
571 | mxc_spi->intctrl = mx31_intctrl; | 566 | spi_imx->intctrl = mx31_intctrl; |
572 | mxc_spi->config = mx31_config; | 567 | spi_imx->config = mx31_config; |
573 | mxc_spi->trigger = mx31_trigger; | 568 | spi_imx->trigger = mx31_trigger; |
574 | mxc_spi->rx_available = mx31_rx_available; | 569 | spi_imx->rx_available = mx31_rx_available; |
575 | } else if (cpu_is_mx27() || cpu_is_mx21()) { | 570 | } else if (cpu_is_mx27() || cpu_is_mx21()) { |
576 | mxc_spi->intctrl = mx27_intctrl; | 571 | spi_imx->intctrl = mx27_intctrl; |
577 | mxc_spi->config = mx27_config; | 572 | spi_imx->config = mx27_config; |
578 | mxc_spi->trigger = mx27_trigger; | 573 | spi_imx->trigger = mx27_trigger; |
579 | mxc_spi->rx_available = mx27_rx_available; | 574 | spi_imx->rx_available = mx27_rx_available; |
580 | } else if (cpu_is_mx1()) { | 575 | } else if (cpu_is_mx1()) { |
581 | mxc_spi->intctrl = mx1_intctrl; | 576 | spi_imx->intctrl = mx1_intctrl; |
582 | mxc_spi->config = mx1_config; | 577 | spi_imx->config = mx1_config; |
583 | mxc_spi->trigger = mx1_trigger; | 578 | spi_imx->trigger = mx1_trigger; |
584 | mxc_spi->rx_available = mx1_rx_available; | 579 | spi_imx->rx_available = mx1_rx_available; |
585 | } else | 580 | } else |
586 | BUG(); | 581 | BUG(); |
587 | 582 | ||
588 | mxc_spi->clk = clk_get(&pdev->dev, NULL); | 583 | spi_imx->clk = clk_get(&pdev->dev, NULL); |
589 | if (IS_ERR(mxc_spi->clk)) { | 584 | if (IS_ERR(spi_imx->clk)) { |
590 | dev_err(&pdev->dev, "unable to get clock\n"); | 585 | dev_err(&pdev->dev, "unable to get clock\n"); |
591 | ret = PTR_ERR(mxc_spi->clk); | 586 | ret = PTR_ERR(spi_imx->clk); |
592 | goto out_free_irq; | 587 | goto out_free_irq; |
593 | } | 588 | } |
594 | 589 | ||
595 | clk_enable(mxc_spi->clk); | 590 | clk_enable(spi_imx->clk); |
596 | mxc_spi->spi_clk = clk_get_rate(mxc_spi->clk); | 591 | spi_imx->spi_clk = clk_get_rate(spi_imx->clk); |
597 | 592 | ||
598 | if (!cpu_is_mx31() || !cpu_is_mx35()) | 593 | if (!cpu_is_mx31() || !cpu_is_mx35()) |
599 | writel(1, mxc_spi->base + MXC_RESET); | 594 | writel(1, spi_imx->base + MXC_RESET); |
600 | 595 | ||
601 | mxc_spi->intctrl(mxc_spi, 0); | 596 | spi_imx->intctrl(spi_imx, 0); |
602 | 597 | ||
603 | ret = spi_bitbang_start(&mxc_spi->bitbang); | 598 | ret = spi_bitbang_start(&spi_imx->bitbang); |
604 | if (ret) { | 599 | if (ret) { |
605 | dev_err(&pdev->dev, "bitbang start failed with %d\n", ret); | 600 | dev_err(&pdev->dev, "bitbang start failed with %d\n", ret); |
606 | goto out_clk_put; | 601 | goto out_clk_put; |
@@ -611,18 +606,18 @@ static int __init mxc_spi_probe(struct platform_device *pdev) | |||
611 | return ret; | 606 | return ret; |
612 | 607 | ||
613 | out_clk_put: | 608 | out_clk_put: |
614 | clk_disable(mxc_spi->clk); | 609 | clk_disable(spi_imx->clk); |
615 | clk_put(mxc_spi->clk); | 610 | clk_put(spi_imx->clk); |
616 | out_free_irq: | 611 | out_free_irq: |
617 | free_irq(mxc_spi->irq, mxc_spi); | 612 | free_irq(spi_imx->irq, spi_imx); |
618 | out_iounmap: | 613 | out_iounmap: |
619 | iounmap(mxc_spi->base); | 614 | iounmap(spi_imx->base); |
620 | out_release_mem: | 615 | out_release_mem: |
621 | release_mem_region(res->start, resource_size(res)); | 616 | release_mem_region(res->start, resource_size(res)); |
622 | out_gpio_free: | 617 | out_gpio_free: |
623 | for (i = 0; i < master->num_chipselect; i++) | 618 | for (i = 0; i < master->num_chipselect; i++) |
624 | if (mxc_spi->chipselect[i] >= 0) | 619 | if (spi_imx->chipselect[i] >= 0) |
625 | gpio_free(mxc_spi->chipselect[i]); | 620 | gpio_free(spi_imx->chipselect[i]); |
626 | out_master_put: | 621 | out_master_put: |
627 | spi_master_put(master); | 622 | spi_master_put(master); |
628 | kfree(master); | 623 | kfree(master); |
@@ -630,24 +625,24 @@ out_master_put: | |||
630 | return ret; | 625 | return ret; |
631 | } | 626 | } |
632 | 627 | ||
633 | static int __exit mxc_spi_remove(struct platform_device *pdev) | 628 | static int __exit spi_imx_remove(struct platform_device *pdev) |
634 | { | 629 | { |
635 | struct spi_master *master = platform_get_drvdata(pdev); | 630 | struct spi_master *master = platform_get_drvdata(pdev); |
636 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 631 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
637 | struct mxc_spi_data *mxc_spi = spi_master_get_devdata(master); | 632 | struct spi_imx_data *spi_imx = spi_master_get_devdata(master); |
638 | int i; | 633 | int i; |
639 | 634 | ||
640 | spi_bitbang_stop(&mxc_spi->bitbang); | 635 | spi_bitbang_stop(&spi_imx->bitbang); |
641 | 636 | ||
642 | writel(0, mxc_spi->base + MXC_CSPICTRL); | 637 | writel(0, spi_imx->base + MXC_CSPICTRL); |
643 | clk_disable(mxc_spi->clk); | 638 | clk_disable(spi_imx->clk); |
644 | clk_put(mxc_spi->clk); | 639 | clk_put(spi_imx->clk); |
645 | free_irq(mxc_spi->irq, mxc_spi); | 640 | free_irq(spi_imx->irq, spi_imx); |
646 | iounmap(mxc_spi->base); | 641 | iounmap(spi_imx->base); |
647 | 642 | ||
648 | for (i = 0; i < master->num_chipselect; i++) | 643 | for (i = 0; i < master->num_chipselect; i++) |
649 | if (mxc_spi->chipselect[i] >= 0) | 644 | if (spi_imx->chipselect[i] >= 0) |
650 | gpio_free(mxc_spi->chipselect[i]); | 645 | gpio_free(spi_imx->chipselect[i]); |
651 | 646 | ||
652 | spi_master_put(master); | 647 | spi_master_put(master); |
653 | 648 | ||
@@ -658,27 +653,27 @@ static int __exit mxc_spi_remove(struct platform_device *pdev) | |||
658 | return 0; | 653 | return 0; |
659 | } | 654 | } |
660 | 655 | ||
661 | static struct platform_driver mxc_spi_driver = { | 656 | static struct platform_driver spi_imx_driver = { |
662 | .driver = { | 657 | .driver = { |
663 | .name = DRIVER_NAME, | 658 | .name = DRIVER_NAME, |
664 | .owner = THIS_MODULE, | 659 | .owner = THIS_MODULE, |
665 | }, | 660 | }, |
666 | .probe = mxc_spi_probe, | 661 | .probe = spi_imx_probe, |
667 | .remove = __exit_p(mxc_spi_remove), | 662 | .remove = __exit_p(spi_imx_remove), |
668 | }; | 663 | }; |
669 | 664 | ||
670 | static int __init mxc_spi_init(void) | 665 | static int __init spi_imx_init(void) |
671 | { | 666 | { |
672 | return platform_driver_register(&mxc_spi_driver); | 667 | return platform_driver_register(&spi_imx_driver); |
673 | } | 668 | } |
674 | 669 | ||
675 | static void __exit mxc_spi_exit(void) | 670 | static void __exit spi_imx_exit(void) |
676 | { | 671 | { |
677 | platform_driver_unregister(&mxc_spi_driver); | 672 | platform_driver_unregister(&spi_imx_driver); |
678 | } | 673 | } |
679 | 674 | ||
680 | module_init(mxc_spi_init); | 675 | module_init(spi_imx_init); |
681 | module_exit(mxc_spi_exit); | 676 | module_exit(spi_imx_exit); |
682 | 677 | ||
683 | MODULE_DESCRIPTION("SPI Master Controller driver"); | 678 | MODULE_DESCRIPTION("SPI Master Controller driver"); |
684 | MODULE_AUTHOR("Sascha Hauer, Pengutronix"); | 679 | MODULE_AUTHOR("Sascha Hauer, Pengutronix"); |
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index f921bd1109e1..5d23983f02fc 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c | |||
@@ -537,7 +537,7 @@ static int spidev_release(struct inode *inode, struct file *filp) | |||
537 | return status; | 537 | return status; |
538 | } | 538 | } |
539 | 539 | ||
540 | static struct file_operations spidev_fops = { | 540 | static const struct file_operations spidev_fops = { |
541 | .owner = THIS_MODULE, | 541 | .owner = THIS_MODULE, |
542 | /* REVISIT switch to aio primitives, so that userspace | 542 | /* REVISIT switch to aio primitives, so that userspace |
543 | * gets more complete API coverage. It'll simplify things | 543 | * gets more complete API coverage. It'll simplify things |
diff --git a/drivers/staging/dst/dcore.c b/drivers/staging/dst/dcore.c index ac8577358ba0..ee1601026fb0 100644 --- a/drivers/staging/dst/dcore.c +++ b/drivers/staging/dst/dcore.c | |||
@@ -847,7 +847,7 @@ static dst_command_func dst_commands[] = { | |||
847 | /* | 847 | /* |
848 | * Configuration parser. | 848 | * Configuration parser. |
849 | */ | 849 | */ |
850 | static void cn_dst_callback(struct cn_msg *msg) | 850 | static void cn_dst_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) |
851 | { | 851 | { |
852 | struct dst_ctl *ctl; | 852 | struct dst_ctl *ctl; |
853 | int err; | 853 | int err; |
@@ -855,6 +855,11 @@ static void cn_dst_callback(struct cn_msg *msg) | |||
855 | struct dst_node *n = NULL, *tmp; | 855 | struct dst_node *n = NULL, *tmp; |
856 | unsigned int hash; | 856 | unsigned int hash; |
857 | 857 | ||
858 | if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN)) { | ||
859 | err = -EPERM; | ||
860 | goto out; | ||
861 | } | ||
862 | |||
858 | if (msg->len < sizeof(struct dst_ctl)) { | 863 | if (msg->len < sizeof(struct dst_ctl)) { |
859 | err = -EBADMSG; | 864 | err = -EBADMSG; |
860 | goto out; | 865 | goto out; |
diff --git a/drivers/staging/pohmelfs/config.c b/drivers/staging/pohmelfs/config.c index 90f962ee5fd8..5d04bf5b021a 100644 --- a/drivers/staging/pohmelfs/config.c +++ b/drivers/staging/pohmelfs/config.c | |||
@@ -527,10 +527,13 @@ out_unlock: | |||
527 | return err; | 527 | return err; |
528 | } | 528 | } |
529 | 529 | ||
530 | static void pohmelfs_cn_callback(struct cn_msg *msg) | 530 | static void pohmelfs_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) |
531 | { | 531 | { |
532 | int err; | 532 | int err; |
533 | 533 | ||
534 | if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN)) | ||
535 | return; | ||
536 | |||
534 | switch (msg->flags) { | 537 | switch (msg->flags) { |
535 | case POHMELFS_FLAGS_ADD: | 538 | case POHMELFS_FLAGS_ADD: |
536 | case POHMELFS_FLAGS_DEL: | 539 | case POHMELFS_FLAGS_DEL: |
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 333ee02e7b2b..864f0ba6a344 100644 --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class/usbtmc.c | |||
@@ -993,7 +993,7 @@ skip_io_on_zombie: | |||
993 | return retval; | 993 | return retval; |
994 | } | 994 | } |
995 | 995 | ||
996 | static struct file_operations fops = { | 996 | static const struct file_operations fops = { |
997 | .owner = THIS_MODULE, | 997 | .owner = THIS_MODULE, |
998 | .read = usbtmc_read, | 998 | .read = usbtmc_read, |
999 | .write = usbtmc_write, | 999 | .write = usbtmc_write, |
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c index 29500154d00c..2d867fd22413 100644 --- a/drivers/usb/gadget/printer.c +++ b/drivers/usb/gadget/printer.c | |||
@@ -875,7 +875,7 @@ printer_ioctl(struct file *fd, unsigned int code, unsigned long arg) | |||
875 | } | 875 | } |
876 | 876 | ||
877 | /* used after endpoint configuration */ | 877 | /* used after endpoint configuration */ |
878 | static struct file_operations printer_io_operations = { | 878 | static const struct file_operations printer_io_operations = { |
879 | .owner = THIS_MODULE, | 879 | .owner = THIS_MODULE, |
880 | .open = printer_open, | 880 | .open = printer_open, |
881 | .read = printer_read, | 881 | .read = printer_read, |
diff --git a/drivers/usb/host/whci/debug.c b/drivers/usb/host/whci/debug.c index cf2d45946c57..2273c815941f 100644 --- a/drivers/usb/host/whci/debug.c +++ b/drivers/usb/host/whci/debug.c | |||
@@ -134,7 +134,7 @@ static int pzl_open(struct inode *inode, struct file *file) | |||
134 | return single_open(file, pzl_print, inode->i_private); | 134 | return single_open(file, pzl_print, inode->i_private); |
135 | } | 135 | } |
136 | 136 | ||
137 | static struct file_operations di_fops = { | 137 | static const struct file_operations di_fops = { |
138 | .open = di_open, | 138 | .open = di_open, |
139 | .read = seq_read, | 139 | .read = seq_read, |
140 | .llseek = seq_lseek, | 140 | .llseek = seq_lseek, |
@@ -142,7 +142,7 @@ static struct file_operations di_fops = { | |||
142 | .owner = THIS_MODULE, | 142 | .owner = THIS_MODULE, |
143 | }; | 143 | }; |
144 | 144 | ||
145 | static struct file_operations asl_fops = { | 145 | static const struct file_operations asl_fops = { |
146 | .open = asl_open, | 146 | .open = asl_open, |
147 | .read = seq_read, | 147 | .read = seq_read, |
148 | .llseek = seq_lseek, | 148 | .llseek = seq_lseek, |
@@ -150,7 +150,7 @@ static struct file_operations asl_fops = { | |||
150 | .owner = THIS_MODULE, | 150 | .owner = THIS_MODULE, |
151 | }; | 151 | }; |
152 | 152 | ||
153 | static struct file_operations pzl_fops = { | 153 | static const struct file_operations pzl_fops = { |
154 | .open = pzl_open, | 154 | .open = pzl_open, |
155 | .read = seq_read, | 155 | .read = seq_read, |
156 | .llseek = seq_lseek, | 156 | .llseek = seq_lseek, |
diff --git a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c index d645f3899fe1..32d0199d0c32 100644 --- a/drivers/usb/misc/rio500.c +++ b/drivers/usb/misc/rio500.c | |||
@@ -429,8 +429,7 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos) | |||
429 | return read_count; | 429 | return read_count; |
430 | } | 430 | } |
431 | 431 | ||
432 | static struct | 432 | static const struct file_operations usb_rio_fops = { |
433 | file_operations usb_rio_fops = { | ||
434 | .owner = THIS_MODULE, | 433 | .owner = THIS_MODULE, |
435 | .read = read_rio, | 434 | .read = read_rio, |
436 | .write = write_rio, | 435 | .write = write_rio, |
diff --git a/drivers/uwb/uwb-debug.c b/drivers/uwb/uwb-debug.c index 4a42993700c1..2eecec0c13c9 100644 --- a/drivers/uwb/uwb-debug.c +++ b/drivers/uwb/uwb-debug.c | |||
@@ -205,7 +205,7 @@ static ssize_t command_write(struct file *file, const char __user *buf, | |||
205 | return ret < 0 ? ret : len; | 205 | return ret < 0 ? ret : len; |
206 | } | 206 | } |
207 | 207 | ||
208 | static struct file_operations command_fops = { | 208 | static const struct file_operations command_fops = { |
209 | .open = command_open, | 209 | .open = command_open, |
210 | .write = command_write, | 210 | .write = command_write, |
211 | .read = NULL, | 211 | .read = NULL, |
@@ -255,7 +255,7 @@ static int reservations_open(struct inode *inode, struct file *file) | |||
255 | return single_open(file, reservations_print, inode->i_private); | 255 | return single_open(file, reservations_print, inode->i_private); |
256 | } | 256 | } |
257 | 257 | ||
258 | static struct file_operations reservations_fops = { | 258 | static const struct file_operations reservations_fops = { |
259 | .open = reservations_open, | 259 | .open = reservations_open, |
260 | .read = seq_read, | 260 | .read = seq_read, |
261 | .llseek = seq_lseek, | 261 | .llseek = seq_lseek, |
@@ -283,7 +283,7 @@ static int drp_avail_open(struct inode *inode, struct file *file) | |||
283 | return single_open(file, drp_avail_print, inode->i_private); | 283 | return single_open(file, drp_avail_print, inode->i_private); |
284 | } | 284 | } |
285 | 285 | ||
286 | static struct file_operations drp_avail_fops = { | 286 | static const struct file_operations drp_avail_fops = { |
287 | .open = drp_avail_open, | 287 | .open = drp_avail_open, |
288 | .read = seq_read, | 288 | .read = seq_read, |
289 | .llseek = seq_lseek, | 289 | .llseek = seq_lseek, |
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index e98baf6916b8..e35232a18571 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c | |||
@@ -67,11 +67,14 @@ static DEFINE_MUTEX(uvfb_lock); | |||
67 | * find the kernel part of the task struct, copy the registers and | 67 | * find the kernel part of the task struct, copy the registers and |
68 | * the buffer contents and then complete the task. | 68 | * the buffer contents and then complete the task. |
69 | */ | 69 | */ |
70 | static void uvesafb_cn_callback(struct cn_msg *msg) | 70 | static void uvesafb_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) |
71 | { | 71 | { |
72 | struct uvesafb_task *utask; | 72 | struct uvesafb_task *utask; |
73 | struct uvesafb_ktask *task; | 73 | struct uvesafb_ktask *task; |
74 | 74 | ||
75 | if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN)) | ||
76 | return; | ||
77 | |||
75 | if (msg->seq >= UVESAFB_TASKS_MAX) | 78 | if (msg->seq >= UVESAFB_TASKS_MAX) |
76 | return; | 79 | return; |
77 | 80 | ||
diff --git a/drivers/w1/w1_netlink.c b/drivers/w1/w1_netlink.c index 52ccb3d3a963..45c126fea31d 100644 --- a/drivers/w1/w1_netlink.c +++ b/drivers/w1/w1_netlink.c | |||
@@ -306,7 +306,7 @@ static int w1_netlink_send_error(struct cn_msg *rcmsg, struct w1_netlink_msg *rm | |||
306 | return error; | 306 | return error; |
307 | } | 307 | } |
308 | 308 | ||
309 | static void w1_cn_callback(struct cn_msg *msg) | 309 | static void w1_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) |
310 | { | 310 | { |
311 | struct w1_netlink_msg *m = (struct w1_netlink_msg *)(msg + 1); | 311 | struct w1_netlink_msg *m = (struct w1_netlink_msg *)(msg + 1); |
312 | struct w1_netlink_cmd *cmd; | 312 | struct w1_netlink_cmd *cmd; |