aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-11-11 03:16:20 -0500
committerIngo Molnar <mingo@elte.hu>2008-11-11 03:16:20 -0500
commit45b86a96f17cb2900f291129b0e67287400e45b2 (patch)
treef7968bf36e3947ee42251f7eebc6ea5f24aca202 /drivers
parent072ba49838b42c873c496d72c91bb237914cf3b6 (diff)
parent4143c5cb36331155a1823af8b3a8c761a59fed71 (diff)
Merge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/urgent
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/libata-core.c72
-rw-r--r--drivers/ata/libata-scsi.c30
-rw-r--r--drivers/ata/libata.h19
-rw-r--r--drivers/ata/sata_nv.c53
-rw-r--r--drivers/ata/sata_promise.c20
-rw-r--r--drivers/ata/sata_via.c4
-rw-r--r--drivers/block/cciss.c28
-rw-r--r--drivers/block/cpqarray.c7
-rw-r--r--drivers/char/vt.c10
-rw-r--r--drivers/cpuidle/cpuidle.c4
-rw-r--r--drivers/firewire/fw-device.c14
-rw-r--r--drivers/firewire/fw-ohci.c2
-rw-r--r--drivers/firewire/fw-sbp2.c2
-rw-r--r--drivers/firmware/dmi_scan.c6
-rw-r--r--drivers/hwmon/applesmc.c36
-rw-r--r--drivers/ieee1394/dv1394.c10
-rw-r--r--drivers/ieee1394/hosts.c4
-rw-r--r--drivers/ieee1394/nodemgr.c14
-rw-r--r--drivers/ieee1394/raw1394.c9
-rw-r--r--drivers/md/linear.c2
-rw-r--r--drivers/md/md.c6
-rw-r--r--drivers/md/raid10.c2
-rw-r--r--drivers/message/fusion/mptlan.c108
-rw-r--r--drivers/mmc/core/bus.c3
-rw-r--r--drivers/mmc/core/core.c6
-rw-r--r--drivers/mmc/core/host.c5
-rw-r--r--drivers/mmc/core/sdio_bus.c3
-rw-r--r--drivers/mmc/host/mmc_spi.c2
-rw-r--r--drivers/mmc/host/sdhci.c2
-rw-r--r--drivers/mmc/host/tifm_sd.c16
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0002.c13
-rw-r--r--drivers/mtd/chips/jedec_probe.c10
-rw-r--r--drivers/mtd/onenand/omap2.c1
-rw-r--r--drivers/net/Kconfig18
-rw-r--r--drivers/net/atl1e/atl1e.h1
-rw-r--r--drivers/net/bnx2x_init.h9
-rw-r--r--drivers/net/bnx2x_main.c10
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c6
-rw-r--r--drivers/net/mv643xx_eth.c9
-rw-r--r--drivers/net/niu.c6
-rw-r--r--drivers/net/smc911x.c2
-rw-r--r--drivers/net/smc91x.c2
-rw-r--r--drivers/net/ucc_geth_ethtool.c1
-rw-r--r--drivers/net/wireless/ath5k/base.c4
-rw-r--r--drivers/net/wireless/ath5k/desc.c16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c15
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c2
-rw-r--r--drivers/oprofile/event_buffer.c6
-rw-r--r--drivers/pci/pci-sysfs.c2
-rw-r--r--drivers/pci/quirks.c36
-rw-r--r--drivers/pci/rom.c6
-rw-r--r--drivers/pnp/interface.c1
-rw-r--r--drivers/ps3/ps3-lpm.c1
-rw-r--r--drivers/regulator/Kconfig15
-rw-r--r--drivers/rtc/interface.c2
-rw-r--r--drivers/rtc/rtc-cmos.c2
-rw-r--r--drivers/sbus/char/jsflash.c1
-rw-r--r--drivers/serial/atmel_serial.c17
-rw-r--r--drivers/staging/Kconfig20
-rw-r--r--drivers/staging/echo/echo.c1
-rw-r--r--drivers/staging/me4000/me4000.c1
-rw-r--r--drivers/staging/usbip/Kconfig2
-rw-r--r--drivers/video/Kconfig32
-rw-r--r--drivers/video/Makefile1
-rw-r--r--drivers/video/fbmem.c63
-rw-r--r--drivers/video/mb862xx/Makefile5
-rw-r--r--drivers/video/mb862xx/mb862xx_reg.h138
-rw-r--r--drivers/video/mb862xx/mb862xxfb.c1061
-rw-r--r--drivers/video/mb862xx/mb862xxfb.h83
-rw-r--r--drivers/watchdog/Kconfig8
-rw-r--r--drivers/watchdog/at91sam9_wdt.c2
-rw-r--r--drivers/xen/balloon.c1
74 files changed, 1767 insertions, 377 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 82af7011f2dd..0cd3ad497136 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1712,6 +1712,8 @@ unsigned ata_exec_internal_sg(struct ata_device *dev,
1712 else 1712 else
1713 tag = 0; 1713 tag = 0;
1714 1714
1715 if (test_and_set_bit(tag, &ap->qc_allocated))
1716 BUG();
1715 qc = __ata_qc_from_tag(ap, tag); 1717 qc = __ata_qc_from_tag(ap, tag);
1716 1718
1717 qc->tag = tag; 1719 qc->tag = tag;
@@ -4024,6 +4026,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
4024 4026
4025 /* Weird ATAPI devices */ 4027 /* Weird ATAPI devices */
4026 { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, 4028 { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 },
4029 { "QUANTUM DAT DAT72-000", NULL, ATA_HORKAGE_ATAPI_MOD16_DMA },
4027 4030
4028 /* Devices we expect to fail diagnostics */ 4031 /* Devices we expect to fail diagnostics */
4029 4032
@@ -4444,7 +4447,8 @@ int atapi_check_dma(struct ata_queued_cmd *qc)
4444 /* Don't allow DMA if it isn't multiple of 16 bytes. Quite a 4447 /* Don't allow DMA if it isn't multiple of 16 bytes. Quite a
4445 * few ATAPI devices choke on such DMA requests. 4448 * few ATAPI devices choke on such DMA requests.
4446 */ 4449 */
4447 if (unlikely(qc->nbytes & 15)) 4450 if (!(qc->dev->horkage & ATA_HORKAGE_ATAPI_MOD16_DMA) &&
4451 unlikely(qc->nbytes & 15))
4448 return 1; 4452 return 1;
4449 4453
4450 if (ap->ops->check_atapi_dma) 4454 if (ap->ops->check_atapi_dma)
@@ -4561,6 +4565,37 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words)
4561} 4565}
4562 4566
4563/** 4567/**
4568 * ata_qc_new - Request an available ATA command, for queueing
4569 * @ap: Port associated with device @dev
4570 * @dev: Device from whom we request an available command structure
4571 *
4572 * LOCKING:
4573 * None.
4574 */
4575
4576static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap)
4577{
4578 struct ata_queued_cmd *qc = NULL;
4579 unsigned int i;
4580
4581 /* no command while frozen */
4582 if (unlikely(ap->pflags & ATA_PFLAG_FROZEN))
4583 return NULL;
4584
4585 /* the last tag is reserved for internal command. */
4586 for (i = 0; i < ATA_MAX_QUEUE - 1; i++)
4587 if (!test_and_set_bit(i, &ap->qc_allocated)) {
4588 qc = __ata_qc_from_tag(ap, i);
4589 break;
4590 }
4591
4592 if (qc)
4593 qc->tag = i;
4594
4595 return qc;
4596}
4597
4598/**
4564 * ata_qc_new_init - Request an available ATA command, and initialize it 4599 * ata_qc_new_init - Request an available ATA command, and initialize it
4565 * @dev: Device from whom we request an available command structure 4600 * @dev: Device from whom we request an available command structure
4566 * @tag: command tag 4601 * @tag: command tag
@@ -4569,20 +4604,16 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words)
4569 * None. 4604 * None.
4570 */ 4605 */
4571 4606
4572struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag) 4607struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev)
4573{ 4608{
4574 struct ata_port *ap = dev->link->ap; 4609 struct ata_port *ap = dev->link->ap;
4575 struct ata_queued_cmd *qc; 4610 struct ata_queued_cmd *qc;
4576 4611
4577 if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) 4612 qc = ata_qc_new(ap);
4578 return NULL;
4579
4580 qc = __ata_qc_from_tag(ap, tag);
4581 if (qc) { 4613 if (qc) {
4582 qc->scsicmd = NULL; 4614 qc->scsicmd = NULL;
4583 qc->ap = ap; 4615 qc->ap = ap;
4584 qc->dev = dev; 4616 qc->dev = dev;
4585 qc->tag = tag;
4586 4617
4587 ata_qc_reinit(qc); 4618 ata_qc_reinit(qc);
4588 } 4619 }
@@ -4590,6 +4621,31 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag)
4590 return qc; 4621 return qc;
4591} 4622}
4592 4623
4624/**
4625 * ata_qc_free - free unused ata_queued_cmd
4626 * @qc: Command to complete
4627 *
4628 * Designed to free unused ata_queued_cmd object
4629 * in case something prevents using it.
4630 *
4631 * LOCKING:
4632 * spin_lock_irqsave(host lock)
4633 */
4634void ata_qc_free(struct ata_queued_cmd *qc)
4635{
4636 struct ata_port *ap = qc->ap;
4637 unsigned int tag;
4638
4639 WARN_ON(qc == NULL); /* ata_qc_from_tag _might_ return NULL */
4640
4641 qc->flags = 0;
4642 tag = qc->tag;
4643 if (likely(ata_tag_valid(tag))) {
4644 qc->tag = ATA_TAG_POISON;
4645 clear_bit(tag, &ap->qc_allocated);
4646 }
4647}
4648
4593void __ata_qc_complete(struct ata_queued_cmd *qc) 4649void __ata_qc_complete(struct ata_queued_cmd *qc)
4594{ 4650{
4595 struct ata_port *ap = qc->ap; 4651 struct ata_port *ap = qc->ap;
@@ -5934,7 +5990,7 @@ static void ata_port_detach(struct ata_port *ap)
5934 * to us. Restore SControl and disable all existing devices. 5990 * to us. Restore SControl and disable all existing devices.
5935 */ 5991 */
5936 __ata_port_for_each_link(link, ap) { 5992 __ata_port_for_each_link(link, ap) {
5937 sata_scr_write(link, SCR_CONTROL, link->saved_scontrol); 5993 sata_scr_write(link, SCR_CONTROL, link->saved_scontrol & 0xff0);
5938 ata_link_for_each_dev(dev, link) 5994 ata_link_for_each_dev(dev, link)
5939 ata_dev_disable(dev); 5995 ata_dev_disable(dev);
5940 } 5996 }
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index bbb30d882f05..47c7afcb36f2 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -190,7 +190,7 @@ static ssize_t ata_scsi_park_show(struct device *device,
190 struct ata_port *ap; 190 struct ata_port *ap;
191 struct ata_link *link; 191 struct ata_link *link;
192 struct ata_device *dev; 192 struct ata_device *dev;
193 unsigned long flags; 193 unsigned long flags, now;
194 unsigned int uninitialized_var(msecs); 194 unsigned int uninitialized_var(msecs);
195 int rc = 0; 195 int rc = 0;
196 196
@@ -208,10 +208,11 @@ static ssize_t ata_scsi_park_show(struct device *device,
208 } 208 }
209 209
210 link = dev->link; 210 link = dev->link;
211 now = jiffies;
211 if (ap->pflags & ATA_PFLAG_EH_IN_PROGRESS && 212 if (ap->pflags & ATA_PFLAG_EH_IN_PROGRESS &&
212 link->eh_context.unloaded_mask & (1 << dev->devno) && 213 link->eh_context.unloaded_mask & (1 << dev->devno) &&
213 time_after(dev->unpark_deadline, jiffies)) 214 time_after(dev->unpark_deadline, now))
214 msecs = jiffies_to_msecs(dev->unpark_deadline - jiffies); 215 msecs = jiffies_to_msecs(dev->unpark_deadline - now);
215 else 216 else
216 msecs = 0; 217 msecs = 0;
217 218
@@ -708,11 +709,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
708{ 709{
709 struct ata_queued_cmd *qc; 710 struct ata_queued_cmd *qc;
710 711
711 if (cmd->request->tag != -1) 712 qc = ata_qc_new_init(dev);
712 qc = ata_qc_new_init(dev, cmd->request->tag);
713 else
714 qc = ata_qc_new_init(dev, 0);
715
716 if (qc) { 713 if (qc) {
717 qc->scsicmd = cmd; 714 qc->scsicmd = cmd;
718 qc->scsidone = done; 715 qc->scsidone = done;
@@ -1107,17 +1104,7 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
1107 1104
1108 depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id)); 1105 depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id));
1109 depth = min(ATA_MAX_QUEUE - 1, depth); 1106 depth = min(ATA_MAX_QUEUE - 1, depth);
1110 1107 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth);
1111 /*
1112 * If this device is behind a port multiplier, we have
1113 * to share the tag map between all devices on that PMP.
1114 * Set up the shared tag map here and we get automatic.
1115 */
1116 if (dev->link->ap->pmp_link)
1117 scsi_init_shared_tag_map(sdev->host, ATA_MAX_QUEUE - 1);
1118
1119 scsi_set_tag_type(sdev, MSG_SIMPLE_TAG);
1120 scsi_activate_tcq(sdev, depth);
1121 } 1108 }
1122 1109
1123 return 0; 1110 return 0;
@@ -1957,11 +1944,6 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
1957 hdr[1] |= (1 << 7); 1944 hdr[1] |= (1 << 7);
1958 1945
1959 memcpy(rbuf, hdr, sizeof(hdr)); 1946 memcpy(rbuf, hdr, sizeof(hdr));
1960
1961 /* if ncq, set tags supported */
1962 if (ata_id_has_ncq(args->id))
1963 rbuf[7] |= (1 << 1);
1964
1965 memcpy(&rbuf[8], "ATA ", 8); 1947 memcpy(&rbuf[8], "ATA ", 8);
1966 ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16); 1948 ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16);
1967 ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4); 1949 ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4);
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index d3831d39bdaa..fe2839e58774 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -74,7 +74,7 @@ extern struct ata_link *ata_dev_phys_link(struct ata_device *dev);
74extern void ata_force_cbl(struct ata_port *ap); 74extern void ata_force_cbl(struct ata_port *ap);
75extern u64 ata_tf_to_lba(const struct ata_taskfile *tf); 75extern u64 ata_tf_to_lba(const struct ata_taskfile *tf);
76extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf); 76extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf);
77extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag); 77extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev);
78extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, 78extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
79 u64 block, u32 n_block, unsigned int tf_flags, 79 u64 block, u32 n_block, unsigned int tf_flags,
80 unsigned int tag); 80 unsigned int tag);
@@ -103,6 +103,7 @@ extern int ata_dev_configure(struct ata_device *dev);
103extern int sata_down_spd_limit(struct ata_link *link); 103extern int sata_down_spd_limit(struct ata_link *link);
104extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel); 104extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel);
105extern void ata_sg_clean(struct ata_queued_cmd *qc); 105extern void ata_sg_clean(struct ata_queued_cmd *qc);
106extern void ata_qc_free(struct ata_queued_cmd *qc);
106extern void ata_qc_issue(struct ata_queued_cmd *qc); 107extern void ata_qc_issue(struct ata_queued_cmd *qc);
107extern void __ata_qc_complete(struct ata_queued_cmd *qc); 108extern void __ata_qc_complete(struct ata_queued_cmd *qc);
108extern int atapi_check_dma(struct ata_queued_cmd *qc); 109extern int atapi_check_dma(struct ata_queued_cmd *qc);
@@ -118,22 +119,6 @@ extern struct ata_port *ata_port_alloc(struct ata_host *host);
118extern void ata_dev_enable_pm(struct ata_device *dev, enum link_pm policy); 119extern void ata_dev_enable_pm(struct ata_device *dev, enum link_pm policy);
119extern void ata_lpm_schedule(struct ata_port *ap, enum link_pm); 120extern void ata_lpm_schedule(struct ata_port *ap, enum link_pm);
120 121
121/**
122 * ata_qc_free - free unused ata_queued_cmd
123 * @qc: Command to complete
124 *
125 * Designed to free unused ata_queued_cmd object
126 * in case something prevents using it.
127 *
128 * LOCKING:
129 * spin_lock_irqsave(host lock)
130 */
131static inline void ata_qc_free(struct ata_queued_cmd *qc)
132{
133 qc->flags = 0;
134 qc->tag = ATA_TAG_POISON;
135}
136
137/* libata-acpi.c */ 122/* libata-acpi.c */
138#ifdef CONFIG_ATA_ACPI 123#ifdef CONFIG_ATA_ACPI
139extern void ata_acpi_associate_sata_port(struct ata_port *ap); 124extern void ata_acpi_associate_sata_port(struct ata_port *ap);
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index fae3841de0d8..6f1460614325 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -307,10 +307,10 @@ static int nv_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
307 307
308static void nv_nf2_freeze(struct ata_port *ap); 308static void nv_nf2_freeze(struct ata_port *ap);
309static void nv_nf2_thaw(struct ata_port *ap); 309static void nv_nf2_thaw(struct ata_port *ap);
310static int nv_nf2_hardreset(struct ata_link *link, unsigned int *class,
311 unsigned long deadline);
310static void nv_ck804_freeze(struct ata_port *ap); 312static void nv_ck804_freeze(struct ata_port *ap);
311static void nv_ck804_thaw(struct ata_port *ap); 313static void nv_ck804_thaw(struct ata_port *ap);
312static int nv_hardreset(struct ata_link *link, unsigned int *class,
313 unsigned long deadline);
314static int nv_adma_slave_config(struct scsi_device *sdev); 314static int nv_adma_slave_config(struct scsi_device *sdev);
315static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc); 315static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc);
316static void nv_adma_qc_prep(struct ata_queued_cmd *qc); 316static void nv_adma_qc_prep(struct ata_queued_cmd *qc);
@@ -405,17 +405,8 @@ static struct scsi_host_template nv_swncq_sht = {
405 .slave_configure = nv_swncq_slave_config, 405 .slave_configure = nv_swncq_slave_config,
406}; 406};
407 407
408/* OSDL bz3352 reports that some nv controllers can't determine device
409 * signature reliably and nv_hardreset is implemented to work around
410 * the problem. This was reported on nf3 and it's unclear whether any
411 * other controllers are affected. However, the workaround has been
412 * applied to all variants and there isn't much to gain by trying to
413 * find out exactly which ones are affected at this point especially
414 * because NV has moved over to ahci for newer controllers.
415 */
416static struct ata_port_operations nv_common_ops = { 408static struct ata_port_operations nv_common_ops = {
417 .inherits = &ata_bmdma_port_ops, 409 .inherits = &ata_bmdma_port_ops,
418 .hardreset = nv_hardreset,
419 .scr_read = nv_scr_read, 410 .scr_read = nv_scr_read,
420 .scr_write = nv_scr_write, 411 .scr_write = nv_scr_write,
421}; 412};
@@ -429,12 +420,22 @@ static struct ata_port_operations nv_generic_ops = {
429 .hardreset = ATA_OP_NULL, 420 .hardreset = ATA_OP_NULL,
430}; 421};
431 422
423/* OSDL bz3352 reports that nf2/3 controllers can't determine device
424 * signature reliably. Also, the following thread reports detection
425 * failure on cold boot with the standard debouncing timing.
426 *
427 * http://thread.gmane.org/gmane.linux.ide/34098
428 *
429 * Debounce with hotplug timing and request follow-up SRST.
430 */
432static struct ata_port_operations nv_nf2_ops = { 431static struct ata_port_operations nv_nf2_ops = {
433 .inherits = &nv_common_ops, 432 .inherits = &nv_common_ops,
434 .freeze = nv_nf2_freeze, 433 .freeze = nv_nf2_freeze,
435 .thaw = nv_nf2_thaw, 434 .thaw = nv_nf2_thaw,
435 .hardreset = nv_nf2_hardreset,
436}; 436};
437 437
438/* CK804 finally gets hardreset right */
438static struct ata_port_operations nv_ck804_ops = { 439static struct ata_port_operations nv_ck804_ops = {
439 .inherits = &nv_common_ops, 440 .inherits = &nv_common_ops,
440 .freeze = nv_ck804_freeze, 441 .freeze = nv_ck804_freeze,
@@ -443,7 +444,7 @@ static struct ata_port_operations nv_ck804_ops = {
443}; 444};
444 445
445static struct ata_port_operations nv_adma_ops = { 446static struct ata_port_operations nv_adma_ops = {
446 .inherits = &nv_common_ops, 447 .inherits = &nv_ck804_ops,
447 448
448 .check_atapi_dma = nv_adma_check_atapi_dma, 449 .check_atapi_dma = nv_adma_check_atapi_dma,
449 .sff_tf_read = nv_adma_tf_read, 450 .sff_tf_read = nv_adma_tf_read,
@@ -467,7 +468,7 @@ static struct ata_port_operations nv_adma_ops = {
467}; 468};
468 469
469static struct ata_port_operations nv_swncq_ops = { 470static struct ata_port_operations nv_swncq_ops = {
470 .inherits = &nv_common_ops, 471 .inherits = &nv_generic_ops,
471 472
472 .qc_defer = ata_std_qc_defer, 473 .qc_defer = ata_std_qc_defer,
473 .qc_prep = nv_swncq_qc_prep, 474 .qc_prep = nv_swncq_qc_prep,
@@ -1553,6 +1554,17 @@ static void nv_nf2_thaw(struct ata_port *ap)
1553 iowrite8(mask, scr_addr + NV_INT_ENABLE); 1554 iowrite8(mask, scr_addr + NV_INT_ENABLE);
1554} 1555}
1555 1556
1557static int nv_nf2_hardreset(struct ata_link *link, unsigned int *class,
1558 unsigned long deadline)
1559{
1560 bool online;
1561 int rc;
1562
1563 rc = sata_link_hardreset(link, sata_deb_timing_hotplug, deadline,
1564 &online, NULL);
1565 return online ? -EAGAIN : rc;
1566}
1567
1556static void nv_ck804_freeze(struct ata_port *ap) 1568static void nv_ck804_freeze(struct ata_port *ap)
1557{ 1569{
1558 void __iomem *mmio_base = ap->host->iomap[NV_MMIO_BAR]; 1570 void __iomem *mmio_base = ap->host->iomap[NV_MMIO_BAR];
@@ -1605,21 +1617,6 @@ static void nv_mcp55_thaw(struct ata_port *ap)
1605 ata_sff_thaw(ap); 1617 ata_sff_thaw(ap);
1606} 1618}
1607 1619
1608static int nv_hardreset(struct ata_link *link, unsigned int *class,
1609 unsigned long deadline)
1610{
1611 int rc;
1612
1613 /* SATA hardreset fails to retrieve proper device signature on
1614 * some controllers. Request follow up SRST. For more info,
1615 * see http://bugzilla.kernel.org/show_bug.cgi?id=3352
1616 */
1617 rc = sata_sff_hardreset(link, class, deadline);
1618 if (rc)
1619 return rc;
1620 return -EAGAIN;
1621}
1622
1623static void nv_adma_error_handler(struct ata_port *ap) 1620static void nv_adma_error_handler(struct ata_port *ap)
1624{ 1621{
1625 struct nv_adma_port_priv *pp = ap->private_data; 1622 struct nv_adma_port_priv *pp = ap->private_data;
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 750d8cdc00cd..ba9a2570a742 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -153,6 +153,10 @@ static void pdc_freeze(struct ata_port *ap);
153static void pdc_sata_freeze(struct ata_port *ap); 153static void pdc_sata_freeze(struct ata_port *ap);
154static void pdc_thaw(struct ata_port *ap); 154static void pdc_thaw(struct ata_port *ap);
155static void pdc_sata_thaw(struct ata_port *ap); 155static void pdc_sata_thaw(struct ata_port *ap);
156static int pdc_pata_softreset(struct ata_link *link, unsigned int *class,
157 unsigned long deadline);
158static int pdc_sata_hardreset(struct ata_link *link, unsigned int *class,
159 unsigned long deadline);
156static void pdc_error_handler(struct ata_port *ap); 160static void pdc_error_handler(struct ata_port *ap);
157static void pdc_post_internal_cmd(struct ata_queued_cmd *qc); 161static void pdc_post_internal_cmd(struct ata_queued_cmd *qc);
158static int pdc_pata_cable_detect(struct ata_port *ap); 162static int pdc_pata_cable_detect(struct ata_port *ap);
@@ -186,6 +190,7 @@ static struct ata_port_operations pdc_sata_ops = {
186 .scr_read = pdc_sata_scr_read, 190 .scr_read = pdc_sata_scr_read,
187 .scr_write = pdc_sata_scr_write, 191 .scr_write = pdc_sata_scr_write,
188 .port_start = pdc_sata_port_start, 192 .port_start = pdc_sata_port_start,
193 .hardreset = pdc_sata_hardreset,
189}; 194};
190 195
191/* First-generation chips need a more restrictive ->check_atapi_dma op */ 196/* First-generation chips need a more restrictive ->check_atapi_dma op */
@@ -200,6 +205,7 @@ static struct ata_port_operations pdc_pata_ops = {
200 .freeze = pdc_freeze, 205 .freeze = pdc_freeze,
201 .thaw = pdc_thaw, 206 .thaw = pdc_thaw,
202 .port_start = pdc_common_port_start, 207 .port_start = pdc_common_port_start,
208 .softreset = pdc_pata_softreset,
203}; 209};
204 210
205static const struct ata_port_info pdc_port_info[] = { 211static const struct ata_port_info pdc_port_info[] = {
@@ -693,6 +699,20 @@ static void pdc_sata_thaw(struct ata_port *ap)
693 readl(host_mmio + hotplug_offset); /* flush */ 699 readl(host_mmio + hotplug_offset); /* flush */
694} 700}
695 701
702static int pdc_pata_softreset(struct ata_link *link, unsigned int *class,
703 unsigned long deadline)
704{
705 pdc_reset_port(link->ap);
706 return ata_sff_softreset(link, class, deadline);
707}
708
709static int pdc_sata_hardreset(struct ata_link *link, unsigned int *class,
710 unsigned long deadline)
711{
712 pdc_reset_port(link->ap);
713 return sata_sff_hardreset(link, class, deadline);
714}
715
696static void pdc_error_handler(struct ata_port *ap) 716static void pdc_error_handler(struct ata_port *ap)
697{ 717{
698 if (!(ap->pflags & ATA_PFLAG_FROZEN)) 718 if (!(ap->pflags & ATA_PFLAG_FROZEN))
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 62367fe4d5dc..c18935f0bda2 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -602,8 +602,10 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
602 rc = vt8251_prepare_host(pdev, &host); 602 rc = vt8251_prepare_host(pdev, &host);
603 break; 603 break;
604 default: 604 default:
605 return -EINVAL; 605 rc = -EINVAL;
606 } 606 }
607 if (rc)
608 return rc;
607 609
608 svia_configure(pdev); 610 svia_configure(pdev);
609 611
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 4023885353e0..12de1fdaa6c6 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -96,6 +96,8 @@ static const struct pci_device_id cciss_pci_device_id[] = {
96 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3245}, 96 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3245},
97 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3247}, 97 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3247},
98 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3249}, 98 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3249},
99 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324A},
100 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324B},
99 {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 101 {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
100 PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0}, 102 PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0},
101 {0,} 103 {0,}
@@ -133,6 +135,8 @@ static struct board_type products[] = {
133 {0x3245103C, "Smart Array P410i", &SA5_access}, 135 {0x3245103C, "Smart Array P410i", &SA5_access},
134 {0x3247103C, "Smart Array P411", &SA5_access}, 136 {0x3247103C, "Smart Array P411", &SA5_access},
135 {0x3249103C, "Smart Array P812", &SA5_access}, 137 {0x3249103C, "Smart Array P812", &SA5_access},
138 {0x324A103C, "Smart Array P712m", &SA5_access},
139 {0x324B103C, "Smart Array P711m", &SA5_access},
136 {0xFFFF103C, "Unknown Smart Array", &SA5_access}, 140 {0xFFFF103C, "Unknown Smart Array", &SA5_access},
137}; 141};
138 142
@@ -1366,6 +1370,7 @@ static void cciss_add_disk(ctlr_info_t *h, struct gendisk *disk,
1366 disk->first_minor = drv_index << NWD_SHIFT; 1370 disk->first_minor = drv_index << NWD_SHIFT;
1367 disk->fops = &cciss_fops; 1371 disk->fops = &cciss_fops;
1368 disk->private_data = &h->drv[drv_index]; 1372 disk->private_data = &h->drv[drv_index];
1373 disk->driverfs_dev = &h->pdev->dev;
1369 1374
1370 /* Set up queue information */ 1375 /* Set up queue information */
1371 blk_queue_bounce_limit(disk->queue, h->pdev->dma_mask); 1376 blk_queue_bounce_limit(disk->queue, h->pdev->dma_mask);
@@ -3404,7 +3409,8 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3404 int i; 3409 int i;
3405 int j = 0; 3410 int j = 0;
3406 int rc; 3411 int rc;
3407 int dac; 3412 int dac, return_code;
3413 InquiryData_struct *inq_buff = NULL;
3408 3414
3409 i = alloc_cciss_hba(); 3415 i = alloc_cciss_hba();
3410 if (i < 0) 3416 if (i < 0)
@@ -3510,6 +3516,25 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3510 /* Turn the interrupts on so we can service requests */ 3516 /* Turn the interrupts on so we can service requests */
3511 hba[i]->access.set_intr_mask(hba[i], CCISS_INTR_ON); 3517 hba[i]->access.set_intr_mask(hba[i], CCISS_INTR_ON);
3512 3518
3519 /* Get the firmware version */
3520 inq_buff = kzalloc(sizeof(InquiryData_struct), GFP_KERNEL);
3521 if (inq_buff == NULL) {
3522 printk(KERN_ERR "cciss: out of memory\n");
3523 goto clean4;
3524 }
3525
3526 return_code = sendcmd_withirq(CISS_INQUIRY, i, inq_buff,
3527 sizeof(InquiryData_struct), 0, 0 , 0, TYPE_CMD);
3528 if (return_code == IO_OK) {
3529 hba[i]->firm_ver[0] = inq_buff->data_byte[32];
3530 hba[i]->firm_ver[1] = inq_buff->data_byte[33];
3531 hba[i]->firm_ver[2] = inq_buff->data_byte[34];
3532 hba[i]->firm_ver[3] = inq_buff->data_byte[35];
3533 } else { /* send command failed */
3534 printk(KERN_WARNING "cciss: unable to determine firmware"
3535 " version of controller\n");
3536 }
3537
3513 cciss_procinit(i); 3538 cciss_procinit(i);
3514 3539
3515 hba[i]->cciss_max_sectors = 2048; 3540 hba[i]->cciss_max_sectors = 2048;
@@ -3520,6 +3545,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3520 return 1; 3545 return 1;
3521 3546
3522clean4: 3547clean4:
3548 kfree(inq_buff);
3523#ifdef CONFIG_CISS_SCSI_TAPE 3549#ifdef CONFIG_CISS_SCSI_TAPE
3524 kfree(hba[i]->scsi_rejects.complete); 3550 kfree(hba[i]->scsi_rejects.complete);
3525#endif 3551#endif
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
index 47d233c6d0b3..5d39df14ed90 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -567,7 +567,12 @@ static int __init cpqarray_init(void)
567 num_cntlrs_reg++; 567 num_cntlrs_reg++;
568 } 568 }
569 569
570 return(num_cntlrs_reg); 570 if (num_cntlrs_reg)
571 return 0;
572 else {
573 pci_unregister_driver(&cpqarray_pci_driver);
574 return -ENODEV;
575 }
571} 576}
572 577
573/* Function to find the first free pointer into our hba[] array */ 578/* Function to find the first free pointer into our hba[] array */
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index d8f83e26e4a4..a5af6072e2b3 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -1644,7 +1644,10 @@ static void reset_terminal(struct vc_data *vc, int do_clear)
1644 vc->vc_tab_stop[1] = 1644 vc->vc_tab_stop[1] =
1645 vc->vc_tab_stop[2] = 1645 vc->vc_tab_stop[2] =
1646 vc->vc_tab_stop[3] = 1646 vc->vc_tab_stop[3] =
1647 vc->vc_tab_stop[4] = 0x01010101; 1647 vc->vc_tab_stop[4] =
1648 vc->vc_tab_stop[5] =
1649 vc->vc_tab_stop[6] =
1650 vc->vc_tab_stop[7] = 0x01010101;
1648 1651
1649 vc->vc_bell_pitch = DEFAULT_BELL_PITCH; 1652 vc->vc_bell_pitch = DEFAULT_BELL_PITCH;
1650 vc->vc_bell_duration = DEFAULT_BELL_DURATION; 1653 vc->vc_bell_duration = DEFAULT_BELL_DURATION;
@@ -1935,7 +1938,10 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
1935 vc->vc_tab_stop[1] = 1938 vc->vc_tab_stop[1] =
1936 vc->vc_tab_stop[2] = 1939 vc->vc_tab_stop[2] =
1937 vc->vc_tab_stop[3] = 1940 vc->vc_tab_stop[3] =
1938 vc->vc_tab_stop[4] = 0; 1941 vc->vc_tab_stop[4] =
1942 vc->vc_tab_stop[5] =
1943 vc->vc_tab_stop[6] =
1944 vc->vc_tab_stop[7] = 0;
1939 } 1945 }
1940 return; 1946 return;
1941 case 'm': 1947 case 'm':
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 5bed73329ef8..8504a2108557 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -65,12 +65,14 @@ static void cpuidle_idle_call(void)
65 return; 65 return;
66 } 66 }
67 67
68#if 0
69 /* shows regressions, re-enable for 2.6.29 */
68 /* 70 /*
69 * run any timers that can be run now, at this point 71 * run any timers that can be run now, at this point
70 * before calculating the idle duration etc. 72 * before calculating the idle duration etc.
71 */ 73 */
72 hrtimer_peek_ahead_timers(); 74 hrtimer_peek_ahead_timers();
73 75#endif
74 /* ask the governor for the next state */ 76 /* ask the governor for the next state */
75 next_state = cpuidle_curr_governor->select(dev); 77 next_state = cpuidle_curr_governor->select(dev);
76 if (need_resched()) 78 if (need_resched())
diff --git a/drivers/firewire/fw-device.c b/drivers/firewire/fw-device.c
index 3fccdd484100..6b9be42c7b98 100644
--- a/drivers/firewire/fw-device.c
+++ b/drivers/firewire/fw-device.c
@@ -587,8 +587,7 @@ static void create_units(struct fw_device *device)
587 unit->device.bus = &fw_bus_type; 587 unit->device.bus = &fw_bus_type;
588 unit->device.type = &fw_unit_type; 588 unit->device.type = &fw_unit_type;
589 unit->device.parent = &device->device; 589 unit->device.parent = &device->device;
590 snprintf(unit->device.bus_id, sizeof(unit->device.bus_id), 590 dev_set_name(&unit->device, "%s.%d", dev_name(&device->device), i++);
591 "%s.%d", device->device.bus_id, i++);
592 591
593 init_fw_attribute_group(&unit->device, 592 init_fw_attribute_group(&unit->device,
594 fw_unit_attributes, 593 fw_unit_attributes,
@@ -711,8 +710,7 @@ static void fw_device_init(struct work_struct *work)
711 device->device.type = &fw_device_type; 710 device->device.type = &fw_device_type;
712 device->device.parent = device->card->device; 711 device->device.parent = device->card->device;
713 device->device.devt = MKDEV(fw_cdev_major, minor); 712 device->device.devt = MKDEV(fw_cdev_major, minor);
714 snprintf(device->device.bus_id, sizeof(device->device.bus_id), 713 dev_set_name(&device->device, "fw%d", minor);
715 "fw%d", minor);
716 714
717 init_fw_attribute_group(&device->device, 715 init_fw_attribute_group(&device->device,
718 fw_device_attributes, 716 fw_device_attributes,
@@ -741,13 +739,13 @@ static void fw_device_init(struct work_struct *work)
741 if (device->config_rom_retries) 739 if (device->config_rom_retries)
742 fw_notify("created device %s: GUID %08x%08x, S%d00, " 740 fw_notify("created device %s: GUID %08x%08x, S%d00, "
743 "%d config ROM retries\n", 741 "%d config ROM retries\n",
744 device->device.bus_id, 742 dev_name(&device->device),
745 device->config_rom[3], device->config_rom[4], 743 device->config_rom[3], device->config_rom[4],
746 1 << device->max_speed, 744 1 << device->max_speed,
747 device->config_rom_retries); 745 device->config_rom_retries);
748 else 746 else
749 fw_notify("created device %s: GUID %08x%08x, S%d00\n", 747 fw_notify("created device %s: GUID %08x%08x, S%d00\n",
750 device->device.bus_id, 748 dev_name(&device->device),
751 device->config_rom[3], device->config_rom[4], 749 device->config_rom[3], device->config_rom[4],
752 1 << device->max_speed); 750 1 << device->max_speed);
753 device->config_rom_retries = 0; 751 device->config_rom_retries = 0;
@@ -883,12 +881,12 @@ static void fw_device_refresh(struct work_struct *work)
883 FW_DEVICE_RUNNING) == FW_DEVICE_SHUTDOWN) 881 FW_DEVICE_RUNNING) == FW_DEVICE_SHUTDOWN)
884 goto gone; 882 goto gone;
885 883
886 fw_notify("refreshed device %s\n", device->device.bus_id); 884 fw_notify("refreshed device %s\n", dev_name(&device->device));
887 device->config_rom_retries = 0; 885 device->config_rom_retries = 0;
888 goto out; 886 goto out;
889 887
890 give_up: 888 give_up:
891 fw_notify("giving up on refresh of device %s\n", device->device.bus_id); 889 fw_notify("giving up on refresh of device %s\n", dev_name(&device->device));
892 gone: 890 gone:
893 atomic_set(&device->state, FW_DEVICE_SHUTDOWN); 891 atomic_set(&device->state, FW_DEVICE_SHUTDOWN);
894 fw_device_shutdown(work); 892 fw_device_shutdown(work);
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index 8e16bfbdcb3d..46610b090415 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -2468,7 +2468,7 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
2468 goto fail_self_id; 2468 goto fail_self_id;
2469 2469
2470 fw_notify("Added fw-ohci device %s, OHCI version %x.%x\n", 2470 fw_notify("Added fw-ohci device %s, OHCI version %x.%x\n",
2471 dev->dev.bus_id, version >> 16, version & 0xff); 2471 dev_name(&dev->dev), version >> 16, version & 0xff);
2472 return 0; 2472 return 0;
2473 2473
2474 fail_self_id: 2474 fail_self_id:
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index d334cac5e1fc..97df6dac3a82 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -1135,7 +1135,7 @@ static int sbp2_probe(struct device *dev)
1135 tgt->unit = unit; 1135 tgt->unit = unit;
1136 kref_init(&tgt->kref); 1136 kref_init(&tgt->kref);
1137 INIT_LIST_HEAD(&tgt->lu_list); 1137 INIT_LIST_HEAD(&tgt->lu_list);
1138 tgt->bus_id = unit->device.bus_id; 1138 tgt->bus_id = dev_name(&unit->device);
1139 tgt->guid = (u64)device->config_rom[3] << 32 | device->config_rom[4]; 1139 tgt->guid = (u64)device->config_rom[3] << 32 | device->config_rom[4];
1140 1140
1141 if (fw_device_enable_phys_dma(device) < 0) 1141 if (fw_device_enable_phys_dma(device) < 0)
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 3e526b6d00cb..8daf4793ac32 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -81,9 +81,9 @@ static void dmi_table(u8 *buf, int len, int num,
81 const struct dmi_header *dm = (const struct dmi_header *)data; 81 const struct dmi_header *dm = (const struct dmi_header *)data;
82 82
83 /* 83 /*
84 * We want to know the total length (formated area and strings) 84 * We want to know the total length (formatted area and
85 * before decoding to make sure we won't run off the table in 85 * strings) before decoding to make sure we won't run off the
86 * dmi_decode or dmi_string 86 * table in dmi_decode or dmi_string
87 */ 87 */
88 data += dm->length; 88 data += dm->length;
89 while ((data - buf < len - 1) && (data[0] || data[1])) 89 while ((data - buf < len - 1) && (data[0] || data[1]))
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index bc011da79e14..be3285912cb7 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -116,6 +116,18 @@ static const char* temperature_sensors_sets[][36] = {
116/* Set 9: Macbook Pro 3,1 (Santa Rosa) */ 116/* Set 9: Macbook Pro 3,1 (Santa Rosa) */
117 { "TALP", "TB0T", "TC0D", "TC0P", "TG0D", "TG0H", "TTF0", "TW0P", 117 { "TALP", "TB0T", "TC0D", "TC0P", "TG0D", "TG0H", "TTF0", "TW0P",
118 "Th0H", "Th1H", "Th2H", "Tm0P", "Ts0P", NULL }, 118 "Th0H", "Th1H", "Th2H", "Tm0P", "Ts0P", NULL },
119/* Set 10: iMac 5,1 */
120 { "TA0P", "TC0D", "TC0P", "TG0D", "TH0P", "TO0P", "Tm0P", NULL },
121/* Set 11: Macbook 5,1 */
122 { "TB0T", "TB1T", "TB2T", "TB3T", "TC0D", "TC0P", "TN0D", "TN0P",
123 "TTF0", "Th0H", "Th1H", "ThFH", "Ts0P", "Ts0S", NULL },
124/* Set 12: Macbook Pro 5,1 */
125 { "TB0T", "TB1T", "TB2T", "TB3T", "TC0D", "TC0F", "TC0P", "TG0D",
126 "TG0F", "TG0H", "TG0P", "TG0T", "TG1H", "TN0D", "TN0P", "TTF0",
127 "Th2H", "Tm0P", "Ts0P", "Ts0S", NULL },
128/* Set 13: iMac 8,1 */
129 { "TA0P", "TC0D", "TC0H", "TC0P", "TG0D", "TG0H", "TG0P", "TH0P",
130 "TL0P", "TO0P", "TW0P", "Tm0P", "Tp0P", NULL },
119}; 131};
120 132
121/* List of keys used to read/write fan speeds */ 133/* List of keys used to read/write fan speeds */
@@ -1276,6 +1288,14 @@ static __initdata struct dmi_match_data applesmc_dmi_data[] = {
1276 { .accelerometer = 1, .light = 1, .temperature_set = 8 }, 1288 { .accelerometer = 1, .light = 1, .temperature_set = 8 },
1277/* MacBook Pro 3: accelerometer, backlight and temperature set 9 */ 1289/* MacBook Pro 3: accelerometer, backlight and temperature set 9 */
1278 { .accelerometer = 1, .light = 1, .temperature_set = 9 }, 1290 { .accelerometer = 1, .light = 1, .temperature_set = 9 },
1291/* iMac 5: light sensor only, temperature set 10 */
1292 { .accelerometer = 0, .light = 0, .temperature_set = 10 },
1293/* MacBook 5: accelerometer, backlight and temperature set 11 */
1294 { .accelerometer = 1, .light = 1, .temperature_set = 11 },
1295/* MacBook Pro 5: accelerometer, backlight and temperature set 12 */
1296 { .accelerometer = 1, .light = 1, .temperature_set = 12 },
1297/* iMac 8: light sensor only, temperature set 13 */
1298 { .accelerometer = 0, .light = 0, .temperature_set = 13 },
1279}; 1299};
1280 1300
1281/* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". 1301/* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
@@ -1285,6 +1305,10 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = {
1285 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), 1305 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
1286 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir") }, 1306 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir") },
1287 &applesmc_dmi_data[7]}, 1307 &applesmc_dmi_data[7]},
1308 { applesmc_dmi_match, "Apple MacBook Pro 5", {
1309 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
1310 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5") },
1311 &applesmc_dmi_data[12]},
1288 { applesmc_dmi_match, "Apple MacBook Pro 4", { 1312 { applesmc_dmi_match, "Apple MacBook Pro 4", {
1289 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), 1313 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
1290 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro4") }, 1314 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro4") },
@@ -1305,6 +1329,10 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = {
1305 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), 1329 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
1306 DMI_MATCH(DMI_PRODUCT_NAME,"MacBook3") }, 1330 DMI_MATCH(DMI_PRODUCT_NAME,"MacBook3") },
1307 &applesmc_dmi_data[6]}, 1331 &applesmc_dmi_data[6]},
1332 { applesmc_dmi_match, "Apple MacBook 5", {
1333 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
1334 DMI_MATCH(DMI_PRODUCT_NAME, "MacBook5") },
1335 &applesmc_dmi_data[11]},
1308 { applesmc_dmi_match, "Apple MacBook", { 1336 { applesmc_dmi_match, "Apple MacBook", {
1309 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), 1337 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
1310 DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") }, 1338 DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") },
@@ -1317,6 +1345,14 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = {
1317 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), 1345 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
1318 DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") }, 1346 DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") },
1319 &applesmc_dmi_data[4]}, 1347 &applesmc_dmi_data[4]},
1348 { applesmc_dmi_match, "Apple iMac 8", {
1349 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
1350 DMI_MATCH(DMI_PRODUCT_NAME, "iMac8") },
1351 &applesmc_dmi_data[13]},
1352 { applesmc_dmi_match, "Apple iMac 5", {
1353 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
1354 DMI_MATCH(DMI_PRODUCT_NAME, "iMac5") },
1355 &applesmc_dmi_data[10]},
1320 { applesmc_dmi_match, "Apple iMac", { 1356 { applesmc_dmi_match, "Apple iMac", {
1321 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), 1357 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
1322 DMI_MATCH(DMI_PRODUCT_NAME,"iMac") }, 1358 DMI_MATCH(DMI_PRODUCT_NAME,"iMac") },
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c
index 965cfdb84ebc..c19f23267157 100644
--- a/drivers/ieee1394/dv1394.c
+++ b/drivers/ieee1394/dv1394.c
@@ -1270,8 +1270,14 @@ static int dv1394_mmap(struct file *file, struct vm_area_struct *vma)
1270 struct video_card *video = file_to_video_card(file); 1270 struct video_card *video = file_to_video_card(file);
1271 int retval = -EINVAL; 1271 int retval = -EINVAL;
1272 1272
1273 /* serialize mmap */ 1273 /*
1274 mutex_lock(&video->mtx); 1274 * We cannot use the blocking variant mutex_lock here because .mmap
1275 * is called with mmap_sem held, while .ioctl, .read, .write acquire
1276 * video->mtx and subsequently call copy_to/from_user which will
1277 * grab mmap_sem in case of a page fault.
1278 */
1279 if (!mutex_trylock(&video->mtx))
1280 return -EAGAIN;
1275 1281
1276 if ( ! video_card_initialized(video) ) { 1282 if ( ! video_card_initialized(video) ) {
1277 retval = do_dv1394_init_default(video); 1283 retval = do_dv1394_init_default(video);
diff --git a/drivers/ieee1394/hosts.c b/drivers/ieee1394/hosts.c
index 8dd09d850419..237d0c9d69c6 100644
--- a/drivers/ieee1394/hosts.c
+++ b/drivers/ieee1394/hosts.c
@@ -155,11 +155,11 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra,
155 memcpy(&h->device, &nodemgr_dev_template_host, sizeof(h->device)); 155 memcpy(&h->device, &nodemgr_dev_template_host, sizeof(h->device));
156 h->device.parent = dev; 156 h->device.parent = dev;
157 set_dev_node(&h->device, dev_to_node(dev)); 157 set_dev_node(&h->device, dev_to_node(dev));
158 snprintf(h->device.bus_id, BUS_ID_SIZE, "fw-host%d", h->id); 158 dev_set_name(&h->device, "fw-host%d", h->id);
159 159
160 h->host_dev.parent = &h->device; 160 h->host_dev.parent = &h->device;
161 h->host_dev.class = &hpsb_host_class; 161 h->host_dev.class = &hpsb_host_class;
162 snprintf(h->host_dev.bus_id, BUS_ID_SIZE, "fw-host%d", h->id); 162 dev_set_name(&h->host_dev, "fw-host%d", h->id);
163 163
164 if (device_register(&h->device)) 164 if (device_register(&h->device))
165 goto fail; 165 goto fail;
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
index 2376b729e876..9e39f73282ee 100644
--- a/drivers/ieee1394/nodemgr.c
+++ b/drivers/ieee1394/nodemgr.c
@@ -826,13 +826,11 @@ static struct node_entry *nodemgr_create_node(octlet_t guid,
826 memcpy(&ne->device, &nodemgr_dev_template_ne, 826 memcpy(&ne->device, &nodemgr_dev_template_ne,
827 sizeof(ne->device)); 827 sizeof(ne->device));
828 ne->device.parent = &host->device; 828 ne->device.parent = &host->device;
829 snprintf(ne->device.bus_id, BUS_ID_SIZE, "%016Lx", 829 dev_set_name(&ne->device, "%016Lx", (unsigned long long)(ne->guid));
830 (unsigned long long)(ne->guid));
831 830
832 ne->node_dev.parent = &ne->device; 831 ne->node_dev.parent = &ne->device;
833 ne->node_dev.class = &nodemgr_ne_class; 832 ne->node_dev.class = &nodemgr_ne_class;
834 snprintf(ne->node_dev.bus_id, BUS_ID_SIZE, "%016Lx", 833 dev_set_name(&ne->node_dev, "%016Lx", (unsigned long long)(ne->guid));
835 (unsigned long long)(ne->guid));
836 834
837 if (device_register(&ne->device)) 835 if (device_register(&ne->device))
838 goto fail_devreg; 836 goto fail_devreg;
@@ -932,13 +930,11 @@ static void nodemgr_register_device(struct node_entry *ne,
932 930
933 ud->device.parent = parent; 931 ud->device.parent = parent;
934 932
935 snprintf(ud->device.bus_id, BUS_ID_SIZE, "%s-%u", 933 dev_set_name(&ud->device, "%s-%u", dev_name(&ne->device), ud->id);
936 ne->device.bus_id, ud->id);
937 934
938 ud->unit_dev.parent = &ud->device; 935 ud->unit_dev.parent = &ud->device;
939 ud->unit_dev.class = &nodemgr_ud_class; 936 ud->unit_dev.class = &nodemgr_ud_class;
940 snprintf(ud->unit_dev.bus_id, BUS_ID_SIZE, "%s-%u", 937 dev_set_name(&ud->unit_dev, "%s-%u", dev_name(&ne->device), ud->id);
941 ne->device.bus_id, ud->id);
942 938
943 if (device_register(&ud->device)) 939 if (device_register(&ud->device))
944 goto fail_devreg; 940 goto fail_devreg;
@@ -953,7 +949,7 @@ static void nodemgr_register_device(struct node_entry *ne,
953fail_classdevreg: 949fail_classdevreg:
954 device_unregister(&ud->device); 950 device_unregister(&ud->device);
955fail_devreg: 951fail_devreg:
956 HPSB_ERR("Failed to create unit %s", ud->device.bus_id); 952 HPSB_ERR("Failed to create unit %s", dev_name(&ud->device));
957} 953}
958 954
959 955
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c
index 9f19ac492106..bf7e761c12b1 100644
--- a/drivers/ieee1394/raw1394.c
+++ b/drivers/ieee1394/raw1394.c
@@ -2268,7 +2268,8 @@ static ssize_t raw1394_write(struct file *file, const char __user * buffer,
2268 return -EFAULT; 2268 return -EFAULT;
2269 } 2269 }
2270 2270
2271 mutex_lock(&fi->state_mutex); 2271 if (!mutex_trylock(&fi->state_mutex))
2272 return -EAGAIN;
2272 2273
2273 switch (fi->state) { 2274 switch (fi->state) {
2274 case opened: 2275 case opened:
@@ -2548,7 +2549,8 @@ static int raw1394_mmap(struct file *file, struct vm_area_struct *vma)
2548 struct file_info *fi = file->private_data; 2549 struct file_info *fi = file->private_data;
2549 int ret; 2550 int ret;
2550 2551
2551 mutex_lock(&fi->state_mutex); 2552 if (!mutex_trylock(&fi->state_mutex))
2553 return -EAGAIN;
2552 2554
2553 if (fi->iso_state == RAW1394_ISO_INACTIVE) 2555 if (fi->iso_state == RAW1394_ISO_INACTIVE)
2554 ret = -EINVAL; 2556 ret = -EINVAL;
@@ -2669,7 +2671,8 @@ static long raw1394_ioctl(struct file *file, unsigned int cmd,
2669 break; 2671 break;
2670 } 2672 }
2671 2673
2672 mutex_lock(&fi->state_mutex); 2674 if (!mutex_trylock(&fi->state_mutex))
2675 return -EAGAIN;
2673 2676
2674 switch (fi->iso_state) { 2677 switch (fi->iso_state) {
2675 case RAW1394_ISO_INACTIVE: 2678 case RAW1394_ISO_INACTIVE:
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index 190147c79e79..3b90c5c924ec 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -148,6 +148,8 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
148 148
149 min_sectors = conf->array_sectors; 149 min_sectors = conf->array_sectors;
150 sector_div(min_sectors, PAGE_SIZE/sizeof(struct dev_info *)); 150 sector_div(min_sectors, PAGE_SIZE/sizeof(struct dev_info *));
151 if (min_sectors == 0)
152 min_sectors = 1;
151 153
152 /* min_sectors is the minimum spacing that will fit the hash 154 /* min_sectors is the minimum spacing that will fit the hash
153 * table in one PAGE. This may be much smaller than needed. 155 * table in one PAGE. This may be much smaller than needed.
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 9abf6ed16535..1b1d32694f6f 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3884,7 +3884,6 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
3884 if (mode == 0) { 3884 if (mode == 0) {
3885 mdk_rdev_t *rdev; 3885 mdk_rdev_t *rdev;
3886 struct list_head *tmp; 3886 struct list_head *tmp;
3887 struct block_device *bdev;
3888 3887
3889 printk(KERN_INFO "md: %s stopped.\n", mdname(mddev)); 3888 printk(KERN_INFO "md: %s stopped.\n", mdname(mddev));
3890 3889
@@ -3941,11 +3940,6 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
3941 mddev->degraded = 0; 3940 mddev->degraded = 0;
3942 mddev->barriers_work = 0; 3941 mddev->barriers_work = 0;
3943 mddev->safemode = 0; 3942 mddev->safemode = 0;
3944 bdev = bdget_disk(mddev->gendisk, 0);
3945 if (bdev) {
3946 blkdev_ioctl(bdev, 0, BLKRRPART, 0);
3947 bdput(bdev);
3948 }
3949 kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE); 3943 kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE);
3950 3944
3951 } else if (mddev->pers) 3945 } else if (mddev->pers)
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index da5129a24b18..970a96ef9b18 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1137,7 +1137,7 @@ static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
1137 if (!enough(conf)) 1137 if (!enough(conf))
1138 return -EINVAL; 1138 return -EINVAL;
1139 1139
1140 if (rdev->raid_disk) 1140 if (rdev->raid_disk >= 0)
1141 first = last = rdev->raid_disk; 1141 first = last = rdev->raid_disk;
1142 1142
1143 if (rdev->saved_raid_disk >= 0 && 1143 if (rdev->saved_raid_disk >= 0 &&
diff --git a/drivers/message/fusion/mptlan.c b/drivers/message/fusion/mptlan.c
index a1abf95cf751..603ffd008c73 100644
--- a/drivers/message/fusion/mptlan.c
+++ b/drivers/message/fusion/mptlan.c
@@ -77,12 +77,6 @@ MODULE_VERSION(my_VERSION);
77 * Fusion MPT LAN private structures 77 * Fusion MPT LAN private structures
78 */ 78 */
79 79
80struct NAA_Hosed {
81 u16 NAA;
82 u8 ieee[FC_ALEN];
83 struct NAA_Hosed *next;
84};
85
86struct BufferControl { 80struct BufferControl {
87 struct sk_buff *skb; 81 struct sk_buff *skb;
88 dma_addr_t dma; 82 dma_addr_t dma;
@@ -159,11 +153,6 @@ static u8 LanCtx = MPT_MAX_PROTOCOL_DRIVERS;
159static u32 max_buckets_out = 127; 153static u32 max_buckets_out = 127;
160static u32 tx_max_out_p = 127 - 16; 154static u32 tx_max_out_p = 127 - 16;
161 155
162#ifdef QLOGIC_NAA_WORKAROUND
163static struct NAA_Hosed *mpt_bad_naa = NULL;
164DEFINE_RWLOCK(bad_naa_lock);
165#endif
166
167/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 156/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
168/** 157/**
169 * lan_reply - Handle all data sent from the hardware. 158 * lan_reply - Handle all data sent from the hardware.
@@ -780,30 +769,6 @@ mpt_lan_sdu_send (struct sk_buff *skb, struct net_device *dev)
780// ctx, skb, skb->data)); 769// ctx, skb, skb->data));
781 770
782 mac = skb_mac_header(skb); 771 mac = skb_mac_header(skb);
783#ifdef QLOGIC_NAA_WORKAROUND
784{
785 struct NAA_Hosed *nh;
786
787 /* Munge the NAA for Tx packets to QLogic boards, which don't follow
788 RFC 2625. The longer I look at this, the more my opinion of Qlogic
789 drops. */
790 read_lock_irq(&bad_naa_lock);
791 for (nh = mpt_bad_naa; nh != NULL; nh=nh->next) {
792 if ((nh->ieee[0] == mac[0]) &&
793 (nh->ieee[1] == mac[1]) &&
794 (nh->ieee[2] == mac[2]) &&
795 (nh->ieee[3] == mac[3]) &&
796 (nh->ieee[4] == mac[4]) &&
797 (nh->ieee[5] == mac[5])) {
798 cur_naa = nh->NAA;
799 dlprintk ((KERN_INFO "mptlan/sdu_send: using NAA value "
800 "= %04x.\n", cur_naa));
801 break;
802 }
803 }
804 read_unlock_irq(&bad_naa_lock);
805}
806#endif
807 772
808 pTrans->TransactionDetails[0] = cpu_to_le32((cur_naa << 16) | 773 pTrans->TransactionDetails[0] = cpu_to_le32((cur_naa << 16) |
809 (mac[0] << 8) | 774 (mac[0] << 8) |
@@ -1572,79 +1537,6 @@ mpt_lan_type_trans(struct sk_buff *skb, struct net_device *dev)
1572 1537
1573 fcllc = (struct fcllc *)skb->data; 1538 fcllc = (struct fcllc *)skb->data;
1574 1539
1575#ifdef QLOGIC_NAA_WORKAROUND
1576{
1577 u16 source_naa = fch->stype, found = 0;
1578
1579 /* Workaround for QLogic not following RFC 2625 in regards to the NAA
1580 value. */
1581
1582 if ((source_naa & 0xF000) == 0)
1583 source_naa = swab16(source_naa);
1584
1585 if (fcllc->ethertype == htons(ETH_P_ARP))
1586 dlprintk ((KERN_INFO "mptlan/type_trans: got arp req/rep w/ naa of "
1587 "%04x.\n", source_naa));
1588
1589 if ((fcllc->ethertype == htons(ETH_P_ARP)) &&
1590 ((source_naa >> 12) != MPT_LAN_NAA_RFC2625)){
1591 struct NAA_Hosed *nh, *prevnh;
1592 int i;
1593
1594 dlprintk ((KERN_INFO "mptlan/type_trans: ARP Req/Rep from "
1595 "system with non-RFC 2625 NAA value (%04x).\n",
1596 source_naa));
1597
1598 write_lock_irq(&bad_naa_lock);
1599 for (prevnh = nh = mpt_bad_naa; nh != NULL;
1600 prevnh=nh, nh=nh->next) {
1601 if ((nh->ieee[0] == fch->saddr[0]) &&
1602 (nh->ieee[1] == fch->saddr[1]) &&
1603 (nh->ieee[2] == fch->saddr[2]) &&
1604 (nh->ieee[3] == fch->saddr[3]) &&
1605 (nh->ieee[4] == fch->saddr[4]) &&
1606 (nh->ieee[5] == fch->saddr[5])) {
1607 found = 1;
1608 dlprintk ((KERN_INFO "mptlan/type_trans: ARP Re"
1609 "q/Rep w/ bad NAA from system already"
1610 " in DB.\n"));
1611 break;
1612 }
1613 }
1614
1615 if ((!found) && (nh == NULL)) {
1616
1617 nh = kmalloc(sizeof(struct NAA_Hosed), GFP_KERNEL);
1618 dlprintk ((KERN_INFO "mptlan/type_trans: ARP Req/Rep w/"
1619 " bad NAA from system not yet in DB.\n"));
1620
1621 if (nh != NULL) {
1622 nh->next = NULL;
1623 if (!mpt_bad_naa)
1624 mpt_bad_naa = nh;
1625 if (prevnh)
1626 prevnh->next = nh;
1627
1628 nh->NAA = source_naa; /* Set the S_NAA value. */
1629 for (i = 0; i < FC_ALEN; i++)
1630 nh->ieee[i] = fch->saddr[i];
1631 dlprintk ((KERN_INFO "Got ARP from %02x:%02x:%02x:%02x:"
1632 "%02x:%02x with non-compliant S_NAA value.\n",
1633 fch->saddr[0], fch->saddr[1], fch->saddr[2],
1634 fch->saddr[3], fch->saddr[4],fch->saddr[5]));
1635 } else {
1636 printk (KERN_ERR "mptlan/type_trans: Unable to"
1637 " kmalloc a NAA_Hosed struct.\n");
1638 }
1639 } else if (!found) {
1640 printk (KERN_ERR "mptlan/type_trans: found not"
1641 " set, but nh isn't null. Evil "
1642 "funkiness abounds.\n");
1643 }
1644 write_unlock_irq(&bad_naa_lock);
1645 }
1646}
1647#endif
1648 1540
1649 /* Strip the SNAP header from ARP packets since we don't 1541 /* Strip the SNAP header from ARP packets since we don't
1650 * pass them through to the 802.2/SNAP layers. 1542 * pass them through to the 802.2/SNAP layers.
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 0d9b2d6f9ebf..f210a8ee6861 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -216,8 +216,7 @@ int mmc_add_card(struct mmc_card *card)
216 int ret; 216 int ret;
217 const char *type; 217 const char *type;
218 218
219 snprintf(card->dev.bus_id, sizeof(card->dev.bus_id), 219 dev_set_name(&card->dev, "%s:%04x", mmc_hostname(card->host), card->rca);
220 "%s:%04x", mmc_hostname(card->host), card->rca);
221 220
222 switch (card->type) { 221 switch (card->type) {
223 case MMC_TYPE_MMC: 222 case MMC_TYPE_MMC:
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 044d84eeed7c..f7284b905eb3 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -280,7 +280,11 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card)
280 (card->host->ios.clock / 1000); 280 (card->host->ios.clock / 1000);
281 281
282 if (data->flags & MMC_DATA_WRITE) 282 if (data->flags & MMC_DATA_WRITE)
283 limit_us = 250000; 283 /*
284 * The limit is really 250 ms, but that is
285 * insufficient for some crappy cards.
286 */
287 limit_us = 300000;
284 else 288 else
285 limit_us = 100000; 289 limit_us = 100000;
286 290
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 6da80fd4d974..5e945e64ead7 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -73,8 +73,7 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
73 if (err) 73 if (err)
74 goto free; 74 goto free;
75 75
76 snprintf(host->class_dev.bus_id, BUS_ID_SIZE, 76 dev_set_name(&host->class_dev, "mmc%d", host->index);
77 "mmc%d", host->index);
78 77
79 host->parent = dev; 78 host->parent = dev;
80 host->class_dev.parent = dev; 79 host->class_dev.parent = dev;
@@ -121,7 +120,7 @@ int mmc_add_host(struct mmc_host *host)
121 WARN_ON((host->caps & MMC_CAP_SDIO_IRQ) && 120 WARN_ON((host->caps & MMC_CAP_SDIO_IRQ) &&
122 !host->ops->enable_sdio_irq); 121 !host->ops->enable_sdio_irq);
123 122
124 led_trigger_register_simple(host->class_dev.bus_id, &host->led); 123 led_trigger_register_simple(dev_name(&host->class_dev), &host->led);
125 124
126 err = device_add(&host->class_dev); 125 err = device_add(&host->class_dev);
127 if (err) 126 if (err)
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
index 233d0f9b3c4b..46284b527397 100644
--- a/drivers/mmc/core/sdio_bus.c
+++ b/drivers/mmc/core/sdio_bus.c
@@ -239,8 +239,7 @@ int sdio_add_func(struct sdio_func *func)
239{ 239{
240 int ret; 240 int ret;
241 241
242 snprintf(func->dev.bus_id, sizeof(func->dev.bus_id), 242 dev_set_name(&func->dev, "%s:%d", mmc_card_id(func->card), func->num);
243 "%s:%d", mmc_card_id(func->card), func->num);
244 243
245 ret = device_add(&func->dev); 244 ret = device_add(&func->dev);
246 if (ret == 0) 245 if (ret == 0)
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 07faf5412a1f..ad00e1632317 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1348,7 +1348,7 @@ static int mmc_spi_probe(struct spi_device *spi)
1348 goto fail_add_host; 1348 goto fail_add_host;
1349 1349
1350 dev_info(&spi->dev, "SD/MMC host %s%s%s%s%s\n", 1350 dev_info(&spi->dev, "SD/MMC host %s%s%s%s%s\n",
1351 mmc->class_dev.bus_id, 1351 dev_name(&mmc->class_dev),
1352 host->dma_dev ? "" : ", no DMA", 1352 host->dma_dev ? "" : ", no DMA",
1353 (host->pdata && host->pdata->get_ro) 1353 (host->pdata && host->pdata->get_ro)
1354 ? "" : ", no WP", 1354 ? "" : ", no WP",
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 30f64b1f2354..4d010a984bed 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1733,7 +1733,7 @@ int sdhci_add_host(struct sdhci_host *host)
1733 mmc_add_host(mmc); 1733 mmc_add_host(mmc);
1734 1734
1735 printk(KERN_INFO "%s: SDHCI controller on %s [%s] using %s%s\n", 1735 printk(KERN_INFO "%s: SDHCI controller on %s [%s] using %s%s\n",
1736 mmc_hostname(mmc), host->hw_name, mmc_dev(mmc)->bus_id, 1736 mmc_hostname(mmc), host->hw_name, dev_name(mmc_dev(mmc)),
1737 (host->flags & SDHCI_USE_ADMA)?"A":"", 1737 (host->flags & SDHCI_USE_ADMA)?"A":"",
1738 (host->flags & SDHCI_USE_DMA)?"DMA":"PIO"); 1738 (host->flags & SDHCI_USE_DMA)?"DMA":"PIO");
1739 1739
diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c
index 13844843e8de..82554ddec6b3 100644
--- a/drivers/mmc/host/tifm_sd.c
+++ b/drivers/mmc/host/tifm_sd.c
@@ -632,7 +632,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
632 632
633 if (host->req) { 633 if (host->req) {
634 printk(KERN_ERR "%s : unfinished request detected\n", 634 printk(KERN_ERR "%s : unfinished request detected\n",
635 sock->dev.bus_id); 635 dev_name(&sock->dev));
636 mrq->cmd->error = -ETIMEDOUT; 636 mrq->cmd->error = -ETIMEDOUT;
637 goto err_out; 637 goto err_out;
638 } 638 }
@@ -672,7 +672,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
672 ? PCI_DMA_TODEVICE 672 ? PCI_DMA_TODEVICE
673 : PCI_DMA_FROMDEVICE)) { 673 : PCI_DMA_FROMDEVICE)) {
674 printk(KERN_ERR "%s : scatterlist map failed\n", 674 printk(KERN_ERR "%s : scatterlist map failed\n",
675 sock->dev.bus_id); 675 dev_name(&sock->dev));
676 mrq->cmd->error = -ENOMEM; 676 mrq->cmd->error = -ENOMEM;
677 goto err_out; 677 goto err_out;
678 } 678 }
@@ -684,7 +684,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
684 : PCI_DMA_FROMDEVICE); 684 : PCI_DMA_FROMDEVICE);
685 if (host->sg_len < 1) { 685 if (host->sg_len < 1) {
686 printk(KERN_ERR "%s : scatterlist map failed\n", 686 printk(KERN_ERR "%s : scatterlist map failed\n",
687 sock->dev.bus_id); 687 dev_name(&sock->dev));
688 tifm_unmap_sg(sock, &host->bounce_buf, 1, 688 tifm_unmap_sg(sock, &host->bounce_buf, 1,
689 r_data->flags & MMC_DATA_WRITE 689 r_data->flags & MMC_DATA_WRITE
690 ? PCI_DMA_TODEVICE 690 ? PCI_DMA_TODEVICE
@@ -748,7 +748,7 @@ static void tifm_sd_end_cmd(unsigned long data)
748 748
749 if (!mrq) { 749 if (!mrq) {
750 printk(KERN_ERR " %s : no request to complete?\n", 750 printk(KERN_ERR " %s : no request to complete?\n",
751 sock->dev.bus_id); 751 dev_name(&sock->dev));
752 spin_unlock_irqrestore(&sock->lock, flags); 752 spin_unlock_irqrestore(&sock->lock, flags);
753 return; 753 return;
754 } 754 }
@@ -789,7 +789,7 @@ static void tifm_sd_abort(unsigned long data)
789 printk(KERN_ERR 789 printk(KERN_ERR
790 "%s : card failed to respond for a long period of time " 790 "%s : card failed to respond for a long period of time "
791 "(%x, %x)\n", 791 "(%x, %x)\n",
792 host->dev->dev.bus_id, host->req->cmd->opcode, host->cmd_flags); 792 dev_name(&host->dev->dev), host->req->cmd->opcode, host->cmd_flags);
793 793
794 tifm_eject(host->dev); 794 tifm_eject(host->dev);
795} 795}
@@ -906,7 +906,7 @@ static int tifm_sd_initialize_host(struct tifm_sd *host)
906 906
907 if (rc) { 907 if (rc) {
908 printk(KERN_ERR "%s : controller failed to reset\n", 908 printk(KERN_ERR "%s : controller failed to reset\n",
909 sock->dev.bus_id); 909 dev_name(&sock->dev));
910 return -ENODEV; 910 return -ENODEV;
911 } 911 }
912 912
@@ -933,7 +933,7 @@ static int tifm_sd_initialize_host(struct tifm_sd *host)
933 if (rc) { 933 if (rc) {
934 printk(KERN_ERR 934 printk(KERN_ERR
935 "%s : card not ready - probe failed on initialization\n", 935 "%s : card not ready - probe failed on initialization\n",
936 sock->dev.bus_id); 936 dev_name(&sock->dev));
937 return -ENODEV; 937 return -ENODEV;
938 } 938 }
939 939
@@ -954,7 +954,7 @@ static int tifm_sd_probe(struct tifm_dev *sock)
954 if (!(TIFM_SOCK_STATE_OCCUPIED 954 if (!(TIFM_SOCK_STATE_OCCUPIED
955 & readl(sock->addr + SOCK_PRESENT_STATE))) { 955 & readl(sock->addr + SOCK_PRESENT_STATE))) {
956 printk(KERN_WARNING "%s : card gone, unexpectedly\n", 956 printk(KERN_WARNING "%s : card gone, unexpectedly\n",
957 sock->dev.bus_id); 957 dev_name(&sock->dev));
958 return rc; 958 return rc;
959 } 959 }
960 960
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index 3e6f5d8609e8..d74ec46aa032 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -406,19 +406,6 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
406 /* Set the default CFI lock/unlock addresses */ 406 /* Set the default CFI lock/unlock addresses */
407 cfi->addr_unlock1 = 0x555; 407 cfi->addr_unlock1 = 0x555;
408 cfi->addr_unlock2 = 0x2aa; 408 cfi->addr_unlock2 = 0x2aa;
409 /* Modify the unlock address if we are in compatibility mode */
410 if ( /* x16 in x8 mode */
411 ((cfi->device_type == CFI_DEVICETYPE_X8) &&
412 (cfi->cfiq->InterfaceDesc ==
413 CFI_INTERFACE_X8_BY_X16_ASYNC)) ||
414 /* x32 in x16 mode */
415 ((cfi->device_type == CFI_DEVICETYPE_X16) &&
416 (cfi->cfiq->InterfaceDesc ==
417 CFI_INTERFACE_X16_BY_X32_ASYNC)))
418 {
419 cfi->addr_unlock1 = 0xaaa;
420 cfi->addr_unlock2 = 0x555;
421 }
422 409
423 } /* CFI mode */ 410 } /* CFI mode */
424 else if (cfi->cfi_mode == CFI_MODE_JEDEC) { 411 else if (cfi->cfi_mode == CFI_MODE_JEDEC) {
diff --git a/drivers/mtd/chips/jedec_probe.c b/drivers/mtd/chips/jedec_probe.c
index f84ab6182148..2f3f2f719ba4 100644
--- a/drivers/mtd/chips/jedec_probe.c
+++ b/drivers/mtd/chips/jedec_probe.c
@@ -1808,9 +1808,7 @@ static inline u32 jedec_read_mfr(struct map_info *map, uint32_t base,
1808 * several first banks can contain 0x7f instead of actual ID 1808 * several first banks can contain 0x7f instead of actual ID
1809 */ 1809 */
1810 do { 1810 do {
1811 uint32_t ofs = cfi_build_cmd_addr(0 + (bank << 8), 1811 uint32_t ofs = cfi_build_cmd_addr(0 + (bank << 8), map, cfi);
1812 cfi_interleave(cfi),
1813 cfi->device_type);
1814 mask = (1 << (cfi->device_type * 8)) - 1; 1812 mask = (1 << (cfi->device_type * 8)) - 1;
1815 result = map_read(map, base + ofs); 1813 result = map_read(map, base + ofs);
1816 bank++; 1814 bank++;
@@ -1824,7 +1822,7 @@ static inline u32 jedec_read_id(struct map_info *map, uint32_t base,
1824{ 1822{
1825 map_word result; 1823 map_word result;
1826 unsigned long mask; 1824 unsigned long mask;
1827 u32 ofs = cfi_build_cmd_addr(1, cfi_interleave(cfi), cfi->device_type); 1825 u32 ofs = cfi_build_cmd_addr(1, map, cfi);
1828 mask = (1 << (cfi->device_type * 8)) -1; 1826 mask = (1 << (cfi->device_type * 8)) -1;
1829 result = map_read(map, base + ofs); 1827 result = map_read(map, base + ofs);
1830 return result.x[0] & mask; 1828 return result.x[0] & mask;
@@ -2067,8 +2065,8 @@ static int jedec_probe_chip(struct map_info *map, __u32 base,
2067 2065
2068 } 2066 }
2069 /* Ensure the unlock addresses we try stay inside the map */ 2067 /* Ensure the unlock addresses we try stay inside the map */
2070 probe_offset1 = cfi_build_cmd_addr(cfi->addr_unlock1, cfi_interleave(cfi), cfi->device_type); 2068 probe_offset1 = cfi_build_cmd_addr(cfi->addr_unlock1, map, cfi);
2071 probe_offset2 = cfi_build_cmd_addr(cfi->addr_unlock2, cfi_interleave(cfi), cfi->device_type); 2069 probe_offset2 = cfi_build_cmd_addr(cfi->addr_unlock2, map, cfi);
2072 if ( ((base + probe_offset1 + map_bankwidth(map)) >= map->size) || 2070 if ( ((base + probe_offset1 + map_bankwidth(map)) >= map->size) ||
2073 ((base + probe_offset2 + map_bankwidth(map)) >= map->size)) 2071 ((base + probe_offset2 + map_bankwidth(map)) >= map->size))
2074 goto retry; 2072 goto retry;
diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
index 8387e05daae2..e39b21d3e168 100644
--- a/drivers/mtd/onenand/omap2.c
+++ b/drivers/mtd/onenand/omap2.c
@@ -38,7 +38,6 @@
38#include <asm/arch/gpmc.h> 38#include <asm/arch/gpmc.h>
39#include <asm/arch/onenand.h> 39#include <asm/arch/onenand.h>
40#include <asm/arch/gpio.h> 40#include <asm/arch/gpio.h>
41#include <asm/arch/gpmc.h>
42#include <asm/arch/pm.h> 41#include <asm/arch/pm.h>
43 42
44#include <linux/dma-mapping.h> 43#include <linux/dma-mapping.h>
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index f749b40f954e..11f143f4adf6 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2010,9 +2010,13 @@ config IGB_LRO
2010 If in doubt, say N. 2010 If in doubt, say N.
2011 2011
2012config IGB_DCA 2012config IGB_DCA
2013 bool "Enable DCA" 2013 bool "Direct Cache Access (DCA) Support"
2014 default y 2014 default y
2015 depends on IGB && DCA && !(IGB=y && DCA=m) 2015 depends on IGB && DCA && !(IGB=y && DCA=m)
2016 ---help---
2017 Say Y here if you want to use Direct Cache Access (DCA) in the
2018 driver. DCA is a method for warming the CPU cache before data
2019 is used, with the intent of lessening the impact of cache misses.
2016 2020
2017source "drivers/net/ixp2000/Kconfig" 2021source "drivers/net/ixp2000/Kconfig"
2018 2022
@@ -2437,9 +2441,13 @@ config IXGBE
2437 will be called ixgbe. 2441 will be called ixgbe.
2438 2442
2439config IXGBE_DCA 2443config IXGBE_DCA
2440 bool 2444 bool "Direct Cache Access (DCA) Support"
2441 default y 2445 default y
2442 depends on IXGBE && DCA && !(IXGBE=y && DCA=m) 2446 depends on IXGBE && DCA && !(IXGBE=y && DCA=m)
2447 ---help---
2448 Say Y here if you want to use Direct Cache Access (DCA) in the
2449 driver. DCA is a method for warming the CPU cache before data
2450 is used, with the intent of lessening the impact of cache misses.
2443 2451
2444config IXGB 2452config IXGB
2445 tristate "Intel(R) PRO/10GbE support" 2453 tristate "Intel(R) PRO/10GbE support"
@@ -2489,9 +2497,13 @@ config MYRI10GE
2489 will be called myri10ge. 2497 will be called myri10ge.
2490 2498
2491config MYRI10GE_DCA 2499config MYRI10GE_DCA
2492 bool 2500 bool "Direct Cache Access (DCA) Support"
2493 default y 2501 default y
2494 depends on MYRI10GE && DCA && !(MYRI10GE=y && DCA=m) 2502 depends on MYRI10GE && DCA && !(MYRI10GE=y && DCA=m)
2503 ---help---
2504 Say Y here if you want to use Direct Cache Access (DCA) in the
2505 driver. DCA is a method for warming the CPU cache before data
2506 is used, with the intent of lessening the impact of cache misses.
2495 2507
2496config NETXEN_NIC 2508config NETXEN_NIC
2497 tristate "NetXen Multi port (1/10) Gigabit Ethernet NIC" 2509 tristate "NetXen Multi port (1/10) Gigabit Ethernet NIC"
diff --git a/drivers/net/atl1e/atl1e.h b/drivers/net/atl1e/atl1e.h
index b645fa0f3f64..c49550d507a0 100644
--- a/drivers/net/atl1e/atl1e.h
+++ b/drivers/net/atl1e/atl1e.h
@@ -46,7 +46,6 @@
46#include <linux/vmalloc.h> 46#include <linux/vmalloc.h>
47#include <linux/pagemap.h> 47#include <linux/pagemap.h>
48#include <linux/tcp.h> 48#include <linux/tcp.h>
49#include <linux/mii.h>
50#include <linux/ethtool.h> 49#include <linux/ethtool.h>
51#include <linux/if_vlan.h> 50#include <linux/if_vlan.h>
52#include <linux/workqueue.h> 51#include <linux/workqueue.h>
diff --git a/drivers/net/bnx2x_init.h b/drivers/net/bnx2x_init.h
index 130927cfc75b..a6c0b3abba29 100644
--- a/drivers/net/bnx2x_init.h
+++ b/drivers/net/bnx2x_init.h
@@ -564,14 +564,15 @@ static const struct arb_line write_arb_addr[NUM_WR_Q-1] = {
564 564
565static void bnx2x_init_pxp(struct bnx2x *bp) 565static void bnx2x_init_pxp(struct bnx2x *bp)
566{ 566{
567 u16 devctl;
567 int r_order, w_order; 568 int r_order, w_order;
568 u32 val, i; 569 u32 val, i;
569 570
570 pci_read_config_word(bp->pdev, 571 pci_read_config_word(bp->pdev,
571 bp->pcie_cap + PCI_EXP_DEVCTL, (u16 *)&val); 572 bp->pcie_cap + PCI_EXP_DEVCTL, &devctl);
572 DP(NETIF_MSG_HW, "read 0x%x from devctl\n", (u16)val); 573 DP(NETIF_MSG_HW, "read 0x%x from devctl\n", devctl);
573 w_order = ((val & PCI_EXP_DEVCTL_PAYLOAD) >> 5); 574 w_order = ((devctl & PCI_EXP_DEVCTL_PAYLOAD) >> 5);
574 r_order = ((val & PCI_EXP_DEVCTL_READRQ) >> 12); 575 r_order = ((devctl & PCI_EXP_DEVCTL_READRQ) >> 12);
575 576
576 if (r_order > MAX_RD_ORD) { 577 if (r_order > MAX_RD_ORD) {
577 DP(NETIF_MSG_HW, "read order of %d order adjusted to %d\n", 578 DP(NETIF_MSG_HW, "read order of %d order adjusted to %d\n",
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index fce745148ff9..600210d7eff9 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -59,8 +59,8 @@
59#include "bnx2x.h" 59#include "bnx2x.h"
60#include "bnx2x_init.h" 60#include "bnx2x_init.h"
61 61
62#define DRV_MODULE_VERSION "1.45.22" 62#define DRV_MODULE_VERSION "1.45.23"
63#define DRV_MODULE_RELDATE "2008/09/09" 63#define DRV_MODULE_RELDATE "2008/11/03"
64#define BNX2X_BC_VER 0x040200 64#define BNX2X_BC_VER 0x040200
65 65
66/* Time in jiffies before concluding the transmitter is hung */ 66/* Time in jiffies before concluding the transmitter is hung */
@@ -6481,6 +6481,7 @@ load_int_disable:
6481 bnx2x_free_irq(bp); 6481 bnx2x_free_irq(bp);
6482load_error: 6482load_error:
6483 bnx2x_free_mem(bp); 6483 bnx2x_free_mem(bp);
6484 bp->port.pmf = 0;
6484 6485
6485 /* TBD we really need to reset the chip 6486 /* TBD we really need to reset the chip
6486 if we want to recover from this */ 6487 if we want to recover from this */
@@ -6791,6 +6792,7 @@ unload_error:
6791 /* Report UNLOAD_DONE to MCP */ 6792 /* Report UNLOAD_DONE to MCP */
6792 if (!BP_NOMCP(bp)) 6793 if (!BP_NOMCP(bp))
6793 bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE); 6794 bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE);
6795 bp->port.pmf = 0;
6794 6796
6795 /* Free SKBs, SGEs, TPA pool and driver internals */ 6797 /* Free SKBs, SGEs, TPA pool and driver internals */
6796 bnx2x_free_skbs(bp); 6798 bnx2x_free_skbs(bp);
@@ -10204,8 +10206,6 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
10204 return -ENOMEM; 10206 return -ENOMEM;
10205 } 10207 }
10206 10208
10207 netif_carrier_off(dev);
10208
10209 bp = netdev_priv(dev); 10209 bp = netdev_priv(dev);
10210 bp->msglevel = debug; 10210 bp->msglevel = debug;
10211 10211
@@ -10229,6 +10229,8 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
10229 goto init_one_exit; 10229 goto init_one_exit;
10230 } 10230 }
10231 10231
10232 netif_carrier_off(dev);
10233
10232 bp->common.name = board_info[ent->driver_data].name; 10234 bp->common.name = board_info[ent->driver_data].name;
10233 printk(KERN_INFO "%s: %s (%c%d) PCI-E x%d %s found at mem %lx," 10235 printk(KERN_INFO "%s: %s (%c%d) PCI-E x%d %s found at mem %lx,"
10234 " IRQ %d, ", dev->name, bp->common.name, 10236 " IRQ %d, ", dev->name, bp->common.name,
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index cb51c1fb0338..a6f49d025787 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -1099,7 +1099,9 @@ static int __devinit fs_enet_probe(struct of_device *ofdev,
1099 ndev->stop = fs_enet_close; 1099 ndev->stop = fs_enet_close;
1100 ndev->get_stats = fs_enet_get_stats; 1100 ndev->get_stats = fs_enet_get_stats;
1101 ndev->set_multicast_list = fs_set_multicast_list; 1101 ndev->set_multicast_list = fs_set_multicast_list;
1102 1102#ifdef CONFIG_NET_POLL_CONTROLLER
1103 ndev->poll_controller = fs_enet_netpoll;
1104#endif
1103 if (fpi->use_napi) 1105 if (fpi->use_napi)
1104 netif_napi_add(ndev, &fep->napi, fs_enet_rx_napi, 1106 netif_napi_add(ndev, &fep->napi, fs_enet_rx_napi,
1105 fpi->napi_weight); 1107 fpi->napi_weight);
@@ -1209,7 +1211,7 @@ static void __exit fs_cleanup(void)
1209static void fs_enet_netpoll(struct net_device *dev) 1211static void fs_enet_netpoll(struct net_device *dev)
1210{ 1212{
1211 disable_irq(dev->irq); 1213 disable_irq(dev->irq);
1212 fs_enet_interrupt(dev->irq, dev, NULL); 1214 fs_enet_interrupt(dev->irq, dev);
1213 enable_irq(dev->irq); 1215 enable_irq(dev->irq);
1214} 1216}
1215#endif 1217#endif
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index a9c8c08044b1..b9dcdbd369f8 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -1066,9 +1066,12 @@ static int smi_wait_ready(struct mv643xx_eth_shared_private *msp)
1066 return 0; 1066 return 0;
1067 } 1067 }
1068 1068
1069 if (!wait_event_timeout(msp->smi_busy_wait, smi_is_done(msp), 1069 if (!smi_is_done(msp)) {
1070 msecs_to_jiffies(100))) 1070 wait_event_timeout(msp->smi_busy_wait, smi_is_done(msp),
1071 return -ETIMEDOUT; 1071 msecs_to_jiffies(100));
1072 if (!smi_is_done(msp))
1073 return -ETIMEDOUT;
1074 }
1072 1075
1073 return 0; 1076 return 0;
1074} 1077}
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index ebc812702903..9acb5d70a3ae 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -8667,7 +8667,6 @@ static void __devinit niu_device_announce(struct niu *np)
8667static int __devinit niu_pci_init_one(struct pci_dev *pdev, 8667static int __devinit niu_pci_init_one(struct pci_dev *pdev,
8668 const struct pci_device_id *ent) 8668 const struct pci_device_id *ent)
8669{ 8669{
8670 unsigned long niureg_base, niureg_len;
8671 union niu_parent_id parent_id; 8670 union niu_parent_id parent_id;
8672 struct net_device *dev; 8671 struct net_device *dev;
8673 struct niu *np; 8672 struct niu *np;
@@ -8758,10 +8757,7 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev,
8758 8757
8759 dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM); 8758 dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM);
8760 8759
8761 niureg_base = pci_resource_start(pdev, 0); 8760 np->regs = pci_ioremap_bar(pdev, 0);
8762 niureg_len = pci_resource_len(pdev, 0);
8763
8764 np->regs = ioremap_nocache(niureg_base, niureg_len);
8765 if (!np->regs) { 8761 if (!np->regs) {
8766 dev_err(&pdev->dev, PFX "Cannot map device registers, " 8762 dev_err(&pdev->dev, PFX "Cannot map device registers, "
8767 "aborting.\n"); 8763 "aborting.\n");
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index f59c7772f344..5051554ff05b 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -499,7 +499,7 @@ static void smc911x_hardware_send_pkt(struct net_device *dev)
499#else 499#else
500 SMC_PUSH_DATA(lp, buf, len); 500 SMC_PUSH_DATA(lp, buf, len);
501 dev->trans_start = jiffies; 501 dev->trans_start = jiffies;
502 dev_kfree_skb(skb); 502 dev_kfree_skb_irq(skb);
503#endif 503#endif
504 if (!lp->tx_throttle) { 504 if (!lp->tx_throttle) {
505 netif_wake_queue(dev); 505 netif_wake_queue(dev);
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 6f9895d4e5bd..fc80f250da31 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -2060,6 +2060,7 @@ static int smc_request_attrib(struct platform_device *pdev,
2060 struct net_device *ndev) 2060 struct net_device *ndev)
2061{ 2061{
2062 struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib"); 2062 struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib");
2063 struct smc_local *lp __maybe_unused = netdev_priv(ndev);
2063 2064
2064 if (!res) 2065 if (!res)
2065 return 0; 2066 return 0;
@@ -2074,6 +2075,7 @@ static void smc_release_attrib(struct platform_device *pdev,
2074 struct net_device *ndev) 2075 struct net_device *ndev)
2075{ 2076{
2076 struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib"); 2077 struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib");
2078 struct smc_local *lp __maybe_unused = netdev_priv(ndev);
2077 2079
2078 if (res) 2080 if (res)
2079 release_mem_region(res->start, ATTRIB_SIZE); 2081 release_mem_region(res->start, ATTRIB_SIZE);
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c
index cfbbfee55836..85f38a6b6a49 100644
--- a/drivers/net/ucc_geth_ethtool.c
+++ b/drivers/net/ucc_geth_ethtool.c
@@ -37,7 +37,6 @@
37#include <asm/irq.h> 37#include <asm/irq.h>
38#include <asm/uaccess.h> 38#include <asm/uaccess.h>
39#include <asm/types.h> 39#include <asm/types.h>
40#include <asm/uaccess.h>
41 40
42#include "ucc_geth.h" 41#include "ucc_geth.h"
43#include "ucc_geth_mii.h" 42#include "ucc_geth_mii.h"
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 9e47d727e220..cfd4d052d666 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -2942,8 +2942,10 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw,
2942 sc->opmode != NL80211_IFTYPE_MESH_POINT && 2942 sc->opmode != NL80211_IFTYPE_MESH_POINT &&
2943 test_bit(ATH_STAT_PROMISC, sc->status)) 2943 test_bit(ATH_STAT_PROMISC, sc->status))
2944 rfilt |= AR5K_RX_FILTER_PROM; 2944 rfilt |= AR5K_RX_FILTER_PROM;
2945 if (sc->opmode == NL80211_IFTYPE_ADHOC) 2945 if (sc->opmode == NL80211_IFTYPE_STATION ||
2946 sc->opmode == NL80211_IFTYPE_ADHOC) {
2946 rfilt |= AR5K_RX_FILTER_BEACON; 2947 rfilt |= AR5K_RX_FILTER_BEACON;
2948 }
2947 2949
2948 /* Set filters */ 2950 /* Set filters */
2949 ath5k_hw_set_rx_filter(ah,rfilt); 2951 ath5k_hw_set_rx_filter(ah,rfilt);
diff --git a/drivers/net/wireless/ath5k/desc.c b/drivers/net/wireless/ath5k/desc.c
index dd1374052ba9..5e362a7a3620 100644
--- a/drivers/net/wireless/ath5k/desc.c
+++ b/drivers/net/wireless/ath5k/desc.c
@@ -531,10 +531,10 @@ static int ath5k_hw_proc_5210_rx_status(struct ath5k_hw *ah,
531 AR5K_5210_RX_DESC_STATUS0_RECEIVE_SIGNAL); 531 AR5K_5210_RX_DESC_STATUS0_RECEIVE_SIGNAL);
532 rs->rs_rate = AR5K_REG_MS(rx_status->rx_status_0, 532 rs->rs_rate = AR5K_REG_MS(rx_status->rx_status_0,
533 AR5K_5210_RX_DESC_STATUS0_RECEIVE_RATE); 533 AR5K_5210_RX_DESC_STATUS0_RECEIVE_RATE);
534 rs->rs_antenna = rx_status->rx_status_0 & 534 rs->rs_antenna = AR5K_REG_MS(rx_status->rx_status_0,
535 AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANTENNA; 535 AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANTENNA);
536 rs->rs_more = rx_status->rx_status_0 & 536 rs->rs_more = !!(rx_status->rx_status_0 &
537 AR5K_5210_RX_DESC_STATUS0_MORE; 537 AR5K_5210_RX_DESC_STATUS0_MORE);
538 /* TODO: this timestamp is 13 bit, later on we assume 15 bit */ 538 /* TODO: this timestamp is 13 bit, later on we assume 15 bit */
539 rs->rs_tstamp = AR5K_REG_MS(rx_status->rx_status_1, 539 rs->rs_tstamp = AR5K_REG_MS(rx_status->rx_status_1,
540 AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP); 540 AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP);
@@ -607,10 +607,10 @@ static int ath5k_hw_proc_5212_rx_status(struct ath5k_hw *ah,
607 AR5K_5212_RX_DESC_STATUS0_RECEIVE_SIGNAL); 607 AR5K_5212_RX_DESC_STATUS0_RECEIVE_SIGNAL);
608 rs->rs_rate = AR5K_REG_MS(rx_status->rx_status_0, 608 rs->rs_rate = AR5K_REG_MS(rx_status->rx_status_0,
609 AR5K_5212_RX_DESC_STATUS0_RECEIVE_RATE); 609 AR5K_5212_RX_DESC_STATUS0_RECEIVE_RATE);
610 rs->rs_antenna = rx_status->rx_status_0 & 610 rs->rs_antenna = AR5K_REG_MS(rx_status->rx_status_0,
611 AR5K_5212_RX_DESC_STATUS0_RECEIVE_ANTENNA; 611 AR5K_5212_RX_DESC_STATUS0_RECEIVE_ANTENNA);
612 rs->rs_more = rx_status->rx_status_0 & 612 rs->rs_more = !!(rx_status->rx_status_0 &
613 AR5K_5212_RX_DESC_STATUS0_MORE; 613 AR5K_5212_RX_DESC_STATUS0_MORE);
614 rs->rs_tstamp = AR5K_REG_MS(rx_status->rx_status_1, 614 rs->rs_tstamp = AR5K_REG_MS(rx_status->rx_status_1,
615 AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP); 615 AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP);
616 rs->rs_status = 0; 616 rs->rs_status = 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 321dbc8c034a..8d690a0eb1a9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3252,7 +3252,11 @@ static void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw,
3252 return; 3252 return;
3253 } 3253 }
3254 3254
3255 iwl_scan_cancel_timeout(priv, 100); 3255 if (iwl_scan_cancel(priv)) {
3256 /* cancel scan failed, just live w/ bad key and rely
3257 briefly on SW decryption */
3258 return;
3259 }
3256 3260
3257 key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK); 3261 key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
3258 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); 3262 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 3b0bee331a33..c89365e2ca58 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -896,6 +896,13 @@ static void iwl_bg_request_scan(struct work_struct *data)
896 return; 896 return;
897 897
898 done: 898 done:
899 /* Cannot perform scan. Make sure we clear scanning
900 * bits from status so next scan request can be performed.
901 * If we don't clear scanning status bit here all next scan
902 * will fail
903 */
904 clear_bit(STATUS_SCAN_HW, &priv->status);
905 clear_bit(STATUS_SCANNING, &priv->status);
899 /* inform mac80211 scan aborted */ 906 /* inform mac80211 scan aborted */
900 queue_work(priv->workqueue, &priv->scan_completed); 907 queue_work(priv->workqueue, &priv->scan_completed);
901 mutex_unlock(&priv->mutex); 908 mutex_unlock(&priv->mutex);
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index d15a2c997954..285b53e7e261 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -5768,7 +5768,6 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv)
5768 if (priv->error_recovering) 5768 if (priv->error_recovering)
5769 iwl3945_error_recovery(priv); 5769 iwl3945_error_recovery(priv);
5770 5770
5771 ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC);
5772 return; 5771 return;
5773 5772
5774 restart: 5773 restart:
@@ -6013,6 +6012,7 @@ static void iwl3945_bg_alive_start(struct work_struct *data)
6013 mutex_lock(&priv->mutex); 6012 mutex_lock(&priv->mutex);
6014 iwl3945_alive_start(priv); 6013 iwl3945_alive_start(priv);
6015 mutex_unlock(&priv->mutex); 6014 mutex_unlock(&priv->mutex);
6015 ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC);
6016} 6016}
6017 6017
6018static void iwl3945_bg_rf_kill(struct work_struct *work) 6018static void iwl3945_bg_rf_kill(struct work_struct *work)
@@ -6256,6 +6256,11 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
6256 n_probes, 6256 n_probes,
6257 (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); 6257 (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]);
6258 6258
6259 if (scan->channel_count == 0) {
6260 IWL_DEBUG_SCAN("channel count %d\n", scan->channel_count);
6261 goto done;
6262 }
6263
6259 cmd.len += le16_to_cpu(scan->tx_cmd.len) + 6264 cmd.len += le16_to_cpu(scan->tx_cmd.len) +
6260 scan->channel_count * sizeof(struct iwl3945_scan_channel); 6265 scan->channel_count * sizeof(struct iwl3945_scan_channel);
6261 cmd.data = scan; 6266 cmd.data = scan;
@@ -6273,6 +6278,14 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
6273 return; 6278 return;
6274 6279
6275 done: 6280 done:
6281 /* can not perform scan make sure we clear scanning
6282 * bits from status so next scan request can be performed.
6283 * if we dont clear scanning status bit here all next scan
6284 * will fail
6285 */
6286 clear_bit(STATUS_SCAN_HW, &priv->status);
6287 clear_bit(STATUS_SCANNING, &priv->status);
6288
6276 /* inform mac80211 scan aborted */ 6289 /* inform mac80211 scan aborted */
6277 queue_work(priv->workqueue, &priv->scan_completed); 6290 queue_work(priv->workqueue, &priv->scan_completed);
6278 mutex_unlock(&priv->mutex); 6291 mutex_unlock(&priv->mutex);
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index a60ae86bd5c9..a3ccd8c1c716 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -61,6 +61,7 @@ static struct usb_device_id usb_ids[] = {
61 { USB_DEVICE(0x0105, 0x145f), .driver_info = DEVICE_ZD1211 }, 61 { USB_DEVICE(0x0105, 0x145f), .driver_info = DEVICE_ZD1211 },
62 /* ZD1211B */ 62 /* ZD1211B */
63 { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B }, 63 { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B },
64 { USB_DEVICE(0x0ace, 0xb215), .driver_info = DEVICE_ZD1211B },
64 { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B }, 65 { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B },
65 { USB_DEVICE(0x079b, 0x0062), .driver_info = DEVICE_ZD1211B }, 66 { USB_DEVICE(0x079b, 0x0062), .driver_info = DEVICE_ZD1211B },
66 { USB_DEVICE(0x1582, 0x6003), .driver_info = DEVICE_ZD1211B }, 67 { USB_DEVICE(0x1582, 0x6003), .driver_info = DEVICE_ZD1211B },
@@ -82,6 +83,7 @@ static struct usb_device_id usb_ids[] = {
82 { USB_DEVICE(0x0cde, 0x001a), .driver_info = DEVICE_ZD1211B }, 83 { USB_DEVICE(0x0cde, 0x001a), .driver_info = DEVICE_ZD1211B },
83 { USB_DEVICE(0x0586, 0x340a), .driver_info = DEVICE_ZD1211B }, 84 { USB_DEVICE(0x0586, 0x340a), .driver_info = DEVICE_ZD1211B },
84 { USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B }, 85 { USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B },
86 { USB_DEVICE(0x07fa, 0x1196), .driver_info = DEVICE_ZD1211B },
85 /* "Driverless" devices that need ejecting */ 87 /* "Driverless" devices that need ejecting */
86 { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, 88 { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER },
87 { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER }, 89 { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER },
diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c
index d962ba0dd87a..191a3202cecc 100644
--- a/drivers/oprofile/event_buffer.c
+++ b/drivers/oprofile/event_buffer.c
@@ -105,7 +105,7 @@ static int event_buffer_open(struct inode *inode, struct file *file)
105 if (!capable(CAP_SYS_ADMIN)) 105 if (!capable(CAP_SYS_ADMIN))
106 return -EPERM; 106 return -EPERM;
107 107
108 if (test_and_set_bit(0, &buffer_opened)) 108 if (test_and_set_bit_lock(0, &buffer_opened))
109 return -EBUSY; 109 return -EBUSY;
110 110
111 /* Register as a user of dcookies 111 /* Register as a user of dcookies
@@ -129,7 +129,7 @@ static int event_buffer_open(struct inode *inode, struct file *file)
129fail: 129fail:
130 dcookie_unregister(file->private_data); 130 dcookie_unregister(file->private_data);
131out: 131out:
132 clear_bit(0, &buffer_opened); 132 __clear_bit_unlock(0, &buffer_opened);
133 return err; 133 return err;
134} 134}
135 135
@@ -141,7 +141,7 @@ static int event_buffer_release(struct inode *inode, struct file *file)
141 dcookie_unregister(file->private_data); 141 dcookie_unregister(file->private_data);
142 buffer_pos = 0; 142 buffer_pos = 0;
143 atomic_set(&buffer_ready, 0); 143 atomic_set(&buffer_ready, 0);
144 clear_bit(0, &buffer_opened); 144 __clear_bit_unlock(0, &buffer_opened);
145 return 0; 145 return 0;
146} 146}
147 147
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 110022d78689..5d72866897a8 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -575,7 +575,7 @@ static int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct
575 575
576 nr = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 576 nr = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
577 start = vma->vm_pgoff; 577 start = vma->vm_pgoff;
578 size = pci_resource_len(pdev, resno) >> PAGE_SHIFT; 578 size = ((pci_resource_len(pdev, resno) - 1) >> PAGE_SHIFT) + 1;
579 if (start < size && size - start >= nr) 579 if (start < size && size - start >= nr)
580 return 1; 580 return 1;
581 WARN(1, "process \"%s\" tried to map 0x%08lx-0x%08lx on %s BAR %d (size 0x%08lx)\n", 581 WARN(1, "process \"%s\" tried to map 0x%08lx-0x%08lx on %s BAR %d (size 0x%08lx)\n",
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index bbf66ea8fd87..5049a47030ac 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1692,24 +1692,24 @@ static void __devinit quirk_brcm_570x_limit_vpd(struct pci_dev *dev)
1692 } 1692 }
1693} 1693}
1694 1694
1695DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 1695DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
1696 PCI_DEVICE_ID_NX2_5706, 1696 PCI_DEVICE_ID_NX2_5706,
1697 quirk_brcm_570x_limit_vpd); 1697 quirk_brcm_570x_limit_vpd);
1698DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 1698DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
1699 PCI_DEVICE_ID_NX2_5706S, 1699 PCI_DEVICE_ID_NX2_5706S,
1700 quirk_brcm_570x_limit_vpd); 1700 quirk_brcm_570x_limit_vpd);
1701DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 1701DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
1702 PCI_DEVICE_ID_NX2_5708, 1702 PCI_DEVICE_ID_NX2_5708,
1703 quirk_brcm_570x_limit_vpd); 1703 quirk_brcm_570x_limit_vpd);
1704DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 1704DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
1705 PCI_DEVICE_ID_NX2_5708S, 1705 PCI_DEVICE_ID_NX2_5708S,
1706 quirk_brcm_570x_limit_vpd); 1706 quirk_brcm_570x_limit_vpd);
1707DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 1707DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
1708 PCI_DEVICE_ID_NX2_5709, 1708 PCI_DEVICE_ID_NX2_5709,
1709 quirk_brcm_570x_limit_vpd); 1709 quirk_brcm_570x_limit_vpd);
1710DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 1710DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
1711 PCI_DEVICE_ID_NX2_5709S, 1711 PCI_DEVICE_ID_NX2_5709S,
1712 quirk_brcm_570x_limit_vpd); 1712 quirk_brcm_570x_limit_vpd);
1713 1713
1714#ifdef CONFIG_PCI_MSI 1714#ifdef CONFIG_PCI_MSI
1715/* Some chipsets do not support MSI. We cannot easily rely on setting 1715/* Some chipsets do not support MSI. We cannot easily rely on setting
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index 1f5f6143f35c..132a78159b60 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -100,7 +100,8 @@ size_t pci_get_rom_size(void __iomem *rom, size_t size)
100 * pci_map_rom - map a PCI ROM to kernel space 100 * pci_map_rom - map a PCI ROM to kernel space
101 * @pdev: pointer to pci device struct 101 * @pdev: pointer to pci device struct
102 * @size: pointer to receive size of pci window over ROM 102 * @size: pointer to receive size of pci window over ROM
103 * @return: kernel virtual pointer to image of ROM 103 *
104 * Return: kernel virtual pointer to image of ROM
104 * 105 *
105 * Map a PCI ROM into kernel space. If ROM is boot video ROM, 106 * Map a PCI ROM into kernel space. If ROM is boot video ROM,
106 * the shadow BIOS copy will be returned instead of the 107 * the shadow BIOS copy will be returned instead of the
@@ -167,7 +168,8 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
167 * pci_map_rom_copy - map a PCI ROM to kernel space, create a copy 168 * pci_map_rom_copy - map a PCI ROM to kernel space, create a copy
168 * @pdev: pointer to pci device struct 169 * @pdev: pointer to pci device struct
169 * @size: pointer to receive size of pci window over ROM 170 * @size: pointer to receive size of pci window over ROM
170 * @return: kernel virtual pointer to image of ROM 171 *
172 * Return: kernel virtual pointer to image of ROM
171 * 173 *
172 * Map a PCI ROM into kernel space. If ROM is boot video ROM, 174 * Map a PCI ROM into kernel space. If ROM is boot video ROM,
173 * the shadow BIOS copy will be returned instead of the 175 * the shadow BIOS copy will be returned instead of the
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index 478a4a739c00..c3f1c8e9d254 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -12,7 +12,6 @@
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/list.h> 13#include <linux/list.h>
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/pnp.h>
16#include <linux/stat.h> 15#include <linux/stat.h>
17#include <linux/ctype.h> 16#include <linux/ctype.h>
18#include <linux/slab.h> 17#include <linux/slab.h>
diff --git a/drivers/ps3/ps3-lpm.c b/drivers/ps3/ps3-lpm.c
index 85edf945ab86..204158cf7a55 100644
--- a/drivers/ps3/ps3-lpm.c
+++ b/drivers/ps3/ps3-lpm.c
@@ -22,6 +22,7 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/uaccess.h> 24#include <linux/uaccess.h>
25#include <asm/smp.h>
25#include <asm/time.h> 26#include <asm/time.h>
26#include <asm/ps3.h> 27#include <asm/ps3.h>
27#include <asm/lv1call.h> 28#include <asm/lv1call.h>
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 4dada6ee1119..39360e2a4540 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -1,6 +1,4 @@
1menu "Voltage and Current regulators" 1menuconfig REGULATOR
2
3config REGULATOR
4 bool "Voltage and Current Regulator Support" 2 bool "Voltage and Current Regulator Support"
5 default n 3 default n
6 help 4 help
@@ -23,21 +21,20 @@ config REGULATOR
23 21
24 If unsure, say no. 22 If unsure, say no.
25 23
24if REGULATOR
25
26config REGULATOR_DEBUG 26config REGULATOR_DEBUG
27 bool "Regulator debug support" 27 bool "Regulator debug support"
28 depends on REGULATOR
29 help 28 help
30 Say yes here to enable debugging support. 29 Say yes here to enable debugging support.
31 30
32config REGULATOR_FIXED_VOLTAGE 31config REGULATOR_FIXED_VOLTAGE
33 tristate 32 tristate
34 default n 33 default n
35 select REGULATOR
36 34
37config REGULATOR_VIRTUAL_CONSUMER 35config REGULATOR_VIRTUAL_CONSUMER
38 tristate "Virtual regulator consumer support" 36 tristate "Virtual regulator consumer support"
39 default n 37 default n
40 select REGULATOR
41 help 38 help
42 This driver provides a virtual consumer for the voltage and 39 This driver provides a virtual consumer for the voltage and
43 current regulator API which provides sysfs controls for 40 current regulator API which provides sysfs controls for
@@ -49,7 +46,6 @@ config REGULATOR_VIRTUAL_CONSUMER
49config REGULATOR_BQ24022 46config REGULATOR_BQ24022
50 tristate "TI bq24022 Dual Input 1-Cell Li-Ion Charger IC" 47 tristate "TI bq24022 Dual Input 1-Cell Li-Ion Charger IC"
51 default n 48 default n
52 select REGULATOR
53 help 49 help
54 This driver controls a TI bq24022 Charger attached via 50 This driver controls a TI bq24022 Charger attached via
55 GPIOs. The provided current regulator can enable/disable 51 GPIOs. The provided current regulator can enable/disable
@@ -59,7 +55,6 @@ config REGULATOR_BQ24022
59config REGULATOR_WM8350 55config REGULATOR_WM8350
60 tristate "Wolfson Microelectroncis WM8350 AudioPlus PMIC" 56 tristate "Wolfson Microelectroncis WM8350 AudioPlus PMIC"
61 depends on MFD_WM8350 57 depends on MFD_WM8350
62 select REGULATOR
63 help 58 help
64 This driver provides support for the voltage and current regulators 59 This driver provides support for the voltage and current regulators
65 of the WM8350 AudioPlus PMIC. 60 of the WM8350 AudioPlus PMIC.
@@ -67,7 +62,6 @@ config REGULATOR_WM8350
67config REGULATOR_WM8400 62config REGULATOR_WM8400
68 tristate "Wolfson Microelectroncis WM8400 AudioPlus PMIC" 63 tristate "Wolfson Microelectroncis WM8400 AudioPlus PMIC"
69 depends on MFD_WM8400 64 depends on MFD_WM8400
70 select REGULATOR
71 help 65 help
72 This driver provides support for the voltage regulators of the 66 This driver provides support for the voltage regulators of the
73 WM8400 AudioPlus PMIC. 67 WM8400 AudioPlus PMIC.
@@ -75,9 +69,8 @@ config REGULATOR_WM8400
75config REGULATOR_DA903X 69config REGULATOR_DA903X
76 tristate "Support regulators on Dialog Semiconductor DA9030/DA9034 PMIC" 70 tristate "Support regulators on Dialog Semiconductor DA9030/DA9034 PMIC"
77 depends on PMIC_DA903X 71 depends on PMIC_DA903X
78 select REGULATOR
79 help 72 help
80 Say y here to support the BUCKs and LDOs regulators found on 73 Say y here to support the BUCKs and LDOs regulators found on
81 Dialog Semiconductor DA9030/DA9034 PMIC. 74 Dialog Semiconductor DA9030/DA9034 PMIC.
82 75
83endmenu 76endif
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 7af60b98d8a4..a04c1b6b1575 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -271,7 +271,7 @@ int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
271 dev_dbg(&rtc->dev, "alarm rollover: %s\n", "year"); 271 dev_dbg(&rtc->dev, "alarm rollover: %s\n", "year");
272 do { 272 do {
273 alarm->time.tm_year++; 273 alarm->time.tm_year++;
274 } while (!rtc_valid_tm(&alarm->time)); 274 } while (rtc_valid_tm(&alarm->time) != 0);
275 break; 275 break;
276 276
277 default: 277 default:
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 5549231179a2..6cf8e282338f 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -794,7 +794,7 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
794 goto cleanup2; 794 goto cleanup2;
795 } 795 }
796 796
797 pr_info("%s: alarms up to one %s%s, %zd bytes nvram, %s irqs\n", 797 pr_info("%s: alarms up to one %s%s, %zd bytes nvram%s\n",
798 cmos_rtc.rtc->dev.bus_id, 798 cmos_rtc.rtc->dev.bus_id,
799 is_valid_irq(rtc_irq) 799 is_valid_irq(rtc_irq)
800 ? (cmos_rtc.mon_alrm 800 ? (cmos_rtc.mon_alrm
diff --git a/drivers/sbus/char/jsflash.c b/drivers/sbus/char/jsflash.c
index 2bec9ccc0293..a9a9893a5f95 100644
--- a/drivers/sbus/char/jsflash.c
+++ b/drivers/sbus/char/jsflash.c
@@ -36,7 +36,6 @@
36#include <linux/poll.h> 36#include <linux/poll.h>
37#include <linux/init.h> 37#include <linux/init.h>
38#include <linux/string.h> 38#include <linux/string.h>
39#include <linux/smp_lock.h>
40#include <linux/genhd.h> 39#include <linux/genhd.h>
41#include <linux/blkdev.h> 40#include <linux/blkdev.h>
42 41
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 61fb8b6d19af..d5efd6c77904 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -1258,6 +1258,8 @@ static void __devinit atmel_init_port(struct atmel_uart_port *atmel_port,
1258 atmel_port->clk = clk_get(&pdev->dev, "usart"); 1258 atmel_port->clk = clk_get(&pdev->dev, "usart");
1259 clk_enable(atmel_port->clk); 1259 clk_enable(atmel_port->clk);
1260 port->uartclk = clk_get_rate(atmel_port->clk); 1260 port->uartclk = clk_get_rate(atmel_port->clk);
1261 clk_disable(atmel_port->clk);
1262 /* only enable clock when USART is in use */
1261 } 1263 }
1262 1264
1263 atmel_port->use_dma_rx = data->use_dma_rx; 1265 atmel_port->use_dma_rx = data->use_dma_rx;
@@ -1379,6 +1381,8 @@ static int __init atmel_console_setup(struct console *co, char *options)
1379 return -ENODEV; 1381 return -ENODEV;
1380 } 1382 }
1381 1383
1384 clk_enable(atmel_ports[co->index].clk);
1385
1382 UART_PUT_IDR(port, -1); 1386 UART_PUT_IDR(port, -1);
1383 UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); 1387 UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX);
1384 UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN); 1388 UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN);
@@ -1403,7 +1407,7 @@ static struct console atmel_console = {
1403 .data = &atmel_uart, 1407 .data = &atmel_uart,
1404}; 1408};
1405 1409
1406#define ATMEL_CONSOLE_DEVICE &atmel_console 1410#define ATMEL_CONSOLE_DEVICE (&atmel_console)
1407 1411
1408/* 1412/*
1409 * Early console initialization (before VM subsystem initialized). 1413 * Early console initialization (before VM subsystem initialized).
@@ -1534,6 +1538,15 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev)
1534 if (ret) 1538 if (ret)
1535 goto err_add_port; 1539 goto err_add_port;
1536 1540
1541 if (atmel_is_console_port(&port->uart)
1542 && ATMEL_CONSOLE_DEVICE->flags & CON_ENABLED) {
1543 /*
1544 * The serial core enabled the clock for us, so undo
1545 * the clk_enable() in atmel_console_setup()
1546 */
1547 clk_disable(port->clk);
1548 }
1549
1537 device_init_wakeup(&pdev->dev, 1); 1550 device_init_wakeup(&pdev->dev, 1);
1538 platform_set_drvdata(pdev, port); 1551 platform_set_drvdata(pdev, port);
1539 1552
@@ -1544,7 +1557,6 @@ err_add_port:
1544 port->rx_ring.buf = NULL; 1557 port->rx_ring.buf = NULL;
1545err_alloc_ring: 1558err_alloc_ring:
1546 if (!atmel_is_console_port(&port->uart)) { 1559 if (!atmel_is_console_port(&port->uart)) {
1547 clk_disable(port->clk);
1548 clk_put(port->clk); 1560 clk_put(port->clk);
1549 port->clk = NULL; 1561 port->clk = NULL;
1550 } 1562 }
@@ -1568,7 +1580,6 @@ static int __devexit atmel_serial_remove(struct platform_device *pdev)
1568 1580
1569 /* "port" is allocated statically, so we shouldn't free it */ 1581 /* "port" is allocated statically, so we shouldn't free it */
1570 1582
1571 clk_disable(atmel_port->clk);
1572 clk_put(atmel_port->clk); 1583 clk_put(atmel_port->clk);
1573 1584
1574 return ret; 1585 return ret;
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index e1654f59eb70..c95b286a1239 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -21,7 +21,23 @@ menuconfig STAGING
21 21
22 If in doubt, say N here. 22 If in doubt, say N here.
23 23
24if STAGING 24
25config STAGING_EXCLUDE_BUILD
26 bool "Exclude Staging drivers from being built" if STAGING
27 default y
28 ---help---
29 Are you sure you really want to build the staging drivers?
30 They taint your kernel, don't live up to the normal Linux
31 kernel quality standards, are a bit crufty around the edges,
32 and might go off and kick your dog when you aren't paying
33 attention.
34
35 Say N here to be able to select and build the Staging drivers.
36 This option is primarily here to prevent them from being built
37 when selecting 'make allyesconfg' and 'make allmodconfig' so
38 don't be all that put off, your dog will be just fine.
39
40if !STAGING_EXCLUDE_BUILD
25 41
26source "drivers/staging/et131x/Kconfig" 42source "drivers/staging/et131x/Kconfig"
27 43
@@ -45,4 +61,4 @@ source "drivers/staging/at76_usb/Kconfig"
45 61
46source "drivers/staging/poch/Kconfig" 62source "drivers/staging/poch/Kconfig"
47 63
48endif # STAGING 64endif # !STAGING_EXCLUDE_BUILD
diff --git a/drivers/staging/echo/echo.c b/drivers/staging/echo/echo.c
index b8f2c5e9dee5..fd4007e329e7 100644
--- a/drivers/staging/echo/echo.c
+++ b/drivers/staging/echo/echo.c
@@ -106,7 +106,6 @@
106 106
107#include <linux/kernel.h> /* We're doing kernel work */ 107#include <linux/kernel.h> /* We're doing kernel work */
108#include <linux/module.h> 108#include <linux/module.h>
109#include <linux/kernel.h>
110#include <linux/slab.h> 109#include <linux/slab.h>
111 110
112#include "bit_operations.h" 111#include "bit_operations.h"
diff --git a/drivers/staging/me4000/me4000.c b/drivers/staging/me4000/me4000.c
index cf8b01bcac8d..0394e2709278 100644
--- a/drivers/staging/me4000/me4000.c
+++ b/drivers/staging/me4000/me4000.c
@@ -39,7 +39,6 @@
39#include <asm/uaccess.h> 39#include <asm/uaccess.h>
40#include <asm/io.h> 40#include <asm/io.h>
41#include <asm/system.h> 41#include <asm/system.h>
42#include <asm/uaccess.h>
43 42
44/* Include-File for the Meilhaus ME-4000 I/O board */ 43/* Include-File for the Meilhaus ME-4000 I/O board */
45#include "me4000.h" 44#include "me4000.h"
diff --git a/drivers/staging/usbip/Kconfig b/drivers/staging/usbip/Kconfig
index 7426235ccc44..217fb7e62c2f 100644
--- a/drivers/staging/usbip/Kconfig
+++ b/drivers/staging/usbip/Kconfig
@@ -1,6 +1,6 @@
1config USB_IP_COMMON 1config USB_IP_COMMON
2 tristate "USB IP support (EXPERIMENTAL)" 2 tristate "USB IP support (EXPERIMENTAL)"
3 depends on USB && EXPERIMENTAL 3 depends on USB && NET && EXPERIMENTAL
4 default N 4 default N
5 ---help--- 5 ---help---
6 This enables pushing USB packets over IP to allow remote 6 This enables pushing USB packets over IP to allow remote
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 0f13448c6f79..3f3ce13fef43 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -2083,6 +2083,38 @@ config FB_METRONOME
2083 controller. The pre-release name for this device was 8track 2083 controller. The pre-release name for this device was 8track
2084 and could also have been called by some vendors as PVI-nnnn. 2084 and could also have been called by some vendors as PVI-nnnn.
2085 2085
2086config FB_MB862XX
2087 tristate "Fujitsu MB862xx GDC support"
2088 depends on FB
2089 select FB_CFB_FILLRECT
2090 select FB_CFB_COPYAREA
2091 select FB_CFB_IMAGEBLIT
2092 ---help---
2093 Frame buffer driver for Fujitsu Carmine/Coral-P(A)/Lime controllers.
2094
2095config FB_MB862XX_PCI_GDC
2096 bool "Carmine/Coral-P(A) GDC"
2097 depends on PCI && FB_MB862XX
2098 ---help---
2099 This enables framebuffer support for Fujitsu Carmine/Coral-P(A)
2100 PCI graphics controller devices.
2101
2102config FB_MB862XX_LIME
2103 bool "Lime GDC"
2104 depends on FB_MB862XX
2105 depends on OF && !FB_MB862XX_PCI_GDC
2106 select FB_FOREIGN_ENDIAN
2107 select FB_LITTLE_ENDIAN
2108 ---help---
2109 Framebuffer support for Fujitsu Lime GDC on host CPU bus.
2110
2111config FB_PRE_INIT_FB
2112 bool "Don't reinitialize, use bootloader's GDC/Display configuration"
2113 depends on FB_MB862XX_LIME
2114 ---help---
2115 Select this option if display contents should be inherited as set by
2116 the bootloader.
2117
2086source "drivers/video/omap/Kconfig" 2118source "drivers/video/omap/Kconfig"
2087 2119
2088source "drivers/video/backlight/Kconfig" 2120source "drivers/video/backlight/Kconfig"
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 248bddc8d0b0..e39e33e797da 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -122,6 +122,7 @@ obj-$(CONFIG_FB_SH_MOBILE_LCDC) += sh_mobile_lcdcfb.o
122obj-$(CONFIG_FB_OMAP) += omap/ 122obj-$(CONFIG_FB_OMAP) += omap/
123obj-$(CONFIG_XEN_FBDEV_FRONTEND) += xen-fbfront.o 123obj-$(CONFIG_XEN_FBDEV_FRONTEND) += xen-fbfront.o
124obj-$(CONFIG_FB_CARMINE) += carminefb.o 124obj-$(CONFIG_FB_CARMINE) += carminefb.o
125obj-$(CONFIG_FB_MB862XX) += mb862xx/
125 126
126# Platform or fallback drivers go here 127# Platform or fallback drivers go here
127obj-$(CONFIG_FB_UVESA) += uvesafb.o 128obj-$(CONFIG_FB_UVESA) += uvesafb.o
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 6048b55f2878..1d5ae39cb271 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -1002,13 +1002,9 @@ fb_blank(struct fb_info *info, int blank)
1002 return ret; 1002 return ret;
1003} 1003}
1004 1004
1005static long 1005static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
1006fb_ioctl(struct file *file, unsigned int cmd, 1006 unsigned long arg)
1007 unsigned long arg)
1008{ 1007{
1009 struct inode *inode = file->f_path.dentry->d_inode;
1010 int fbidx = iminor(inode);
1011 struct fb_info *info;
1012 struct fb_ops *fb; 1008 struct fb_ops *fb;
1013 struct fb_var_screeninfo var; 1009 struct fb_var_screeninfo var;
1014 struct fb_fix_screeninfo fix; 1010 struct fb_fix_screeninfo fix;
@@ -1018,14 +1014,10 @@ fb_ioctl(struct file *file, unsigned int cmd,
1018 void __user *argp = (void __user *)arg; 1014 void __user *argp = (void __user *)arg;
1019 long ret = 0; 1015 long ret = 0;
1020 1016
1021 info = registered_fb[fbidx];
1022 mutex_lock(&info->lock);
1023 fb = info->fbops; 1017 fb = info->fbops;
1024 1018 if (!fb)
1025 if (!fb) {
1026 mutex_unlock(&info->lock);
1027 return -ENODEV; 1019 return -ENODEV;
1028 } 1020
1029 switch (cmd) { 1021 switch (cmd) {
1030 case FBIOGET_VSCREENINFO: 1022 case FBIOGET_VSCREENINFO:
1031 ret = copy_to_user(argp, &info->var, 1023 ret = copy_to_user(argp, &info->var,
@@ -1126,6 +1118,21 @@ fb_ioctl(struct file *file, unsigned int cmd,
1126 else 1118 else
1127 ret = fb->fb_ioctl(info, cmd, arg); 1119 ret = fb->fb_ioctl(info, cmd, arg);
1128 } 1120 }
1121 return ret;
1122}
1123
1124static long fb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1125__acquires(&info->lock)
1126__releases(&info->lock)
1127{
1128 struct inode *inode = file->f_path.dentry->d_inode;
1129 int fbidx = iminor(inode);
1130 struct fb_info *info;
1131 long ret;
1132
1133 info = registered_fb[fbidx];
1134 mutex_lock(&info->lock);
1135 ret = do_fb_ioctl(info, cmd, arg);
1129 mutex_unlock(&info->lock); 1136 mutex_unlock(&info->lock);
1130 return ret; 1137 return ret;
1131} 1138}
@@ -1157,8 +1164,8 @@ struct fb_cmap32 {
1157 compat_caddr_t transp; 1164 compat_caddr_t transp;
1158}; 1165};
1159 1166
1160static int fb_getput_cmap(struct inode *inode, struct file *file, 1167static int fb_getput_cmap(struct fb_info *info, unsigned int cmd,
1161 unsigned int cmd, unsigned long arg) 1168 unsigned long arg)
1162{ 1169{
1163 struct fb_cmap_user __user *cmap; 1170 struct fb_cmap_user __user *cmap;
1164 struct fb_cmap32 __user *cmap32; 1171 struct fb_cmap32 __user *cmap32;
@@ -1181,7 +1188,7 @@ static int fb_getput_cmap(struct inode *inode, struct file *file,
1181 put_user(compat_ptr(data), &cmap->transp)) 1188 put_user(compat_ptr(data), &cmap->transp))
1182 return -EFAULT; 1189 return -EFAULT;
1183 1190
1184 err = fb_ioctl(file, cmd, (unsigned long) cmap); 1191 err = do_fb_ioctl(info, cmd, (unsigned long) cmap);
1185 1192
1186 if (!err) { 1193 if (!err) {
1187 if (copy_in_user(&cmap32->start, 1194 if (copy_in_user(&cmap32->start,
@@ -1223,8 +1230,8 @@ static int do_fscreeninfo_to_user(struct fb_fix_screeninfo *fix,
1223 return err; 1230 return err;
1224} 1231}
1225 1232
1226static int fb_get_fscreeninfo(struct inode *inode, struct file *file, 1233static int fb_get_fscreeninfo(struct fb_info *info, unsigned int cmd,
1227 unsigned int cmd, unsigned long arg) 1234 unsigned long arg)
1228{ 1235{
1229 mm_segment_t old_fs; 1236 mm_segment_t old_fs;
1230 struct fb_fix_screeninfo fix; 1237 struct fb_fix_screeninfo fix;
@@ -1235,7 +1242,7 @@ static int fb_get_fscreeninfo(struct inode *inode, struct file *file,
1235 1242
1236 old_fs = get_fs(); 1243 old_fs = get_fs();
1237 set_fs(KERNEL_DS); 1244 set_fs(KERNEL_DS);
1238 err = fb_ioctl(file, cmd, (unsigned long) &fix); 1245 err = do_fb_ioctl(info, cmd, (unsigned long) &fix);
1239 set_fs(old_fs); 1246 set_fs(old_fs);
1240 1247
1241 if (!err) 1248 if (!err)
@@ -1244,8 +1251,10 @@ static int fb_get_fscreeninfo(struct inode *inode, struct file *file,
1244 return err; 1251 return err;
1245} 1252}
1246 1253
1247static long 1254static long fb_compat_ioctl(struct file *file, unsigned int cmd,
1248fb_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 1255 unsigned long arg)
1256__acquires(&info->lock)
1257__releases(&info->lock)
1249{ 1258{
1250 struct inode *inode = file->f_path.dentry->d_inode; 1259 struct inode *inode = file->f_path.dentry->d_inode;
1251 int fbidx = iminor(inode); 1260 int fbidx = iminor(inode);
@@ -1262,16 +1271,16 @@ fb_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1262 case FBIOPUT_CON2FBMAP: 1271 case FBIOPUT_CON2FBMAP:
1263 arg = (unsigned long) compat_ptr(arg); 1272 arg = (unsigned long) compat_ptr(arg);
1264 case FBIOBLANK: 1273 case FBIOBLANK:
1265 mutex_unlock(&info->lock); 1274 ret = do_fb_ioctl(info, cmd, arg);
1266 return fb_ioctl(file, cmd, arg); 1275 break;
1267 1276
1268 case FBIOGET_FSCREENINFO: 1277 case FBIOGET_FSCREENINFO:
1269 ret = fb_get_fscreeninfo(inode, file, cmd, arg); 1278 ret = fb_get_fscreeninfo(info, cmd, arg);
1270 break; 1279 break;
1271 1280
1272 case FBIOGETCMAP: 1281 case FBIOGETCMAP:
1273 case FBIOPUTCMAP: 1282 case FBIOPUTCMAP:
1274 ret = fb_getput_cmap(inode, file, cmd, arg); 1283 ret = fb_getput_cmap(info, cmd, arg);
1275 break; 1284 break;
1276 1285
1277 default: 1286 default:
@@ -1286,6 +1295,8 @@ fb_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1286 1295
1287static int 1296static int
1288fb_mmap(struct file *file, struct vm_area_struct * vma) 1297fb_mmap(struct file *file, struct vm_area_struct * vma)
1298__acquires(&info->lock)
1299__releases(&info->lock)
1289{ 1300{
1290 int fbidx = iminor(file->f_path.dentry->d_inode); 1301 int fbidx = iminor(file->f_path.dentry->d_inode);
1291 struct fb_info *info = registered_fb[fbidx]; 1302 struct fb_info *info = registered_fb[fbidx];
@@ -1339,6 +1350,8 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
1339 1350
1340static int 1351static int
1341fb_open(struct inode *inode, struct file *file) 1352fb_open(struct inode *inode, struct file *file)
1353__acquires(&info->lock)
1354__releases(&info->lock)
1342{ 1355{
1343 int fbidx = iminor(inode); 1356 int fbidx = iminor(inode);
1344 struct fb_info *info; 1357 struct fb_info *info;
@@ -1374,6 +1387,8 @@ out:
1374 1387
1375static int 1388static int
1376fb_release(struct inode *inode, struct file *file) 1389fb_release(struct inode *inode, struct file *file)
1390__acquires(&info->lock)
1391__releases(&info->lock)
1377{ 1392{
1378 struct fb_info * const info = file->private_data; 1393 struct fb_info * const info = file->private_data;
1379 1394
diff --git a/drivers/video/mb862xx/Makefile b/drivers/video/mb862xx/Makefile
new file mode 100644
index 000000000000..07664814bb1d
--- /dev/null
+++ b/drivers/video/mb862xx/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for the MB862xx framebuffer driver
3#
4
5obj-$(CONFIG_FB_MB862XX) := mb862xxfb.o
diff --git a/drivers/video/mb862xx/mb862xx_reg.h b/drivers/video/mb862xx/mb862xx_reg.h
new file mode 100644
index 000000000000..2ba65e118500
--- /dev/null
+++ b/drivers/video/mb862xx/mb862xx_reg.h
@@ -0,0 +1,138 @@
1/*
2 * Fujitsu MB862xx Graphics Controller Registers/Bits
3 */
4
5#ifndef _MB862XX_REG_H
6#define _MB862XX_REG_H
7
8#ifdef MB862XX_MMIO_BOTTOM
9#define MB862XX_MMIO_BASE 0x03fc0000
10#else
11#define MB862XX_MMIO_BASE 0x01fc0000
12#endif
13#define MB862XX_I2C_BASE 0x0000c000
14#define MB862XX_DISP_BASE 0x00010000
15#define MB862XX_CAP_BASE 0x00018000
16#define MB862XX_DRAW_BASE 0x00030000
17#define MB862XX_GEO_BASE 0x00038000
18#define MB862XX_PIO_BASE 0x00038000
19#define MB862XX_MMIO_SIZE 0x40000
20
21/* Host interface/pio registers */
22#define GC_IST 0x00000020
23#define GC_IMASK 0x00000024
24#define GC_SRST 0x0000002c
25#define GC_CCF 0x00000038
26#define GC_CID 0x000000f0
27#define GC_REVISION 0x00000084
28
29#define GC_CCF_CGE_100 0x00000000
30#define GC_CCF_CGE_133 0x00040000
31#define GC_CCF_CGE_166 0x00080000
32#define GC_CCF_COT_100 0x00000000
33#define GC_CCF_COT_133 0x00010000
34#define GC_CID_CNAME_MSK 0x0000ff00
35#define GC_CID_VERSION_MSK 0x000000ff
36
37/* define enabled interrupts hereby */
38#define GC_INT_EN 0x00000000
39
40/* Memory interface mode register */
41#define GC_MMR 0x0000fffc
42
43/* Display Controller registers */
44#define GC_DCM0 0x00000000
45#define GC_HTP 0x00000004
46#define GC_HDB_HDP 0x00000008
47#define GC_VSW_HSW_HSP 0x0000000c
48#define GC_VTR 0x00000010
49#define GC_VDP_VSP 0x00000014
50#define GC_WY_WX 0x00000018
51#define GC_WH_WW 0x0000001c
52#define GC_L0M 0x00000020
53#define GC_L0OA0 0x00000024
54#define GC_L0DA0 0x00000028
55#define GC_L0DY_L0DX 0x0000002c
56#define GC_DCM1 0x00000100
57#define GC_L0EM 0x00000110
58#define GC_L0WY_L0WX 0x00000114
59#define GC_L0WH_L0WW 0x00000118
60#define GC_DCM2 0x00000104
61#define GC_DCM3 0x00000108
62#define GC_CPM_CUTC 0x000000a0
63#define GC_CUOA0 0x000000a4
64#define GC_CUY0_CUX0 0x000000a8
65#define GC_CUOA1 0x000000ac
66#define GC_CUY1_CUX1 0x000000b0
67#define GC_L0PAL0 0x00000400
68
69#define GC_CPM_CEN0 0x00100000
70#define GC_CPM_CEN1 0x00200000
71
72#define GC_DCM01_ESY 0x00000004
73#define GC_DCM01_SC 0x00003f00
74#define GC_DCM01_RESV 0x00004000
75#define GC_DCM01_CKS 0x00008000
76#define GC_DCM01_L0E 0x00010000
77#define GC_DCM01_DEN 0x80000000
78#define GC_L0M_L0C_8 0x00000000
79#define GC_L0M_L0C_16 0x80000000
80#define GC_L0EM_L0EC_24 0x40000000
81#define GC_L0M_L0W_UNIT 64
82
83#define GC_DISP_REFCLK_400 400
84
85/* Carmine specific */
86#define MB86297_DRAW_BASE 0x00020000
87#define MB86297_DISP0_BASE 0x00100000
88#define MB86297_DISP1_BASE 0x00140000
89#define MB86297_WRBACK_BASE 0x00180000
90#define MB86297_CAP0_BASE 0x00200000
91#define MB86297_CAP1_BASE 0x00280000
92#define MB86297_DRAMCTRL_BASE 0x00300000
93#define MB86297_CTRL_BASE 0x00400000
94#define MB86297_I2C_BASE 0x00500000
95
96#define GC_CTRL_STATUS 0x00000000
97#define GC_CTRL_INT_MASK 0x00000004
98#define GC_CTRL_CLK_ENABLE 0x0000000c
99#define GC_CTRL_SOFT_RST 0x00000010
100
101#define GC_CTRL_CLK_EN_DRAM 0x00000001
102#define GC_CTRL_CLK_EN_2D3D 0x00000002
103#define GC_CTRL_CLK_EN_DISP0 0x00000020
104#define GC_CTRL_CLK_EN_DISP1 0x00000040
105
106#define GC_2D3D_REV 0x000004b4
107#define GC_RE_REVISION 0x24240200
108
109/* define enabled interrupts hereby */
110#define GC_CARMINE_INT_EN 0x00000004
111
112/* DRAM controller */
113#define GC_DCTL_MODE_ADD 0x00000000
114#define GC_DCTL_SETTIME1_EMODE 0x00000004
115#define GC_DCTL_REFRESH_SETTIME2 0x00000008
116#define GC_DCTL_RSV0_STATES 0x0000000C
117#define GC_DCTL_RSV2_RSV1 0x00000010
118#define GC_DCTL_DDRIF2_DDRIF1 0x00000014
119#define GC_DCTL_IOCONT1_IOCONT0 0x00000024
120
121#define GC_DCTL_STATES_MSK 0x0000000f
122#define GC_DCTL_INIT_WAIT_CNT 3000
123#define GC_DCTL_INIT_WAIT_INTERVAL 1
124
125/* DRAM ctrl values for Carmine PCI Eval. board */
126#define GC_EVB_DCTL_MODE_ADD 0x012105c3
127#define GC_EVB_DCTL_MODE_ADD_AFT_RST 0x002105c3
128#define GC_EVB_DCTL_SETTIME1_EMODE 0x47498000
129#define GC_EVB_DCTL_REFRESH_SETTIME2 0x00422a22
130#define GC_EVB_DCTL_RSV0_STATES 0x00200003
131#define GC_EVB_DCTL_RSV0_STATES_AFT_RST 0x00200002
132#define GC_EVB_DCTL_RSV2_RSV1 0x0000000f
133#define GC_EVB_DCTL_DDRIF2_DDRIF1 0x00556646
134#define GC_EVB_DCTL_IOCONT1_IOCONT0 0x05550555
135
136#define GC_DISP_REFCLK_533 533
137
138#endif
diff --git a/drivers/video/mb862xx/mb862xxfb.c b/drivers/video/mb862xx/mb862xxfb.c
new file mode 100644
index 000000000000..38718d95fbb9
--- /dev/null
+++ b/drivers/video/mb862xx/mb862xxfb.c
@@ -0,0 +1,1061 @@
1/*
2 * drivers/mb862xx/mb862xxfb.c
3 *
4 * Fujitsu Carmine/Coral-P(A)/Lime framebuffer driver
5 *
6 * (C) 2008 Anatolij Gustschin <agust@denx.de>
7 * DENX Software Engineering
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14
15#undef DEBUG
16
17#include <linux/fb.h>
18#include <linux/delay.h>
19#include <linux/init.h>
20#include <linux/interrupt.h>
21#include <linux/pci.h>
22#if defined(CONFIG_PPC_OF)
23#include <linux/of_platform.h>
24#endif
25#include "mb862xxfb.h"
26#include "mb862xx_reg.h"
27
28#define NR_PALETTE 256
29#define MB862XX_MEM_SIZE 0x1000000
30#define CORALP_MEM_SIZE 0x4000000
31#define CARMINE_MEM_SIZE 0x8000000
32#define DRV_NAME "mb862xxfb"
33
34#if defined(CONFIG_LWMON5)
35static struct mb862xx_gc_mode lwmon5_gc_mode = {
36 /* Mode for Sharp LQ104V1DG61 TFT LCD Panel */
37 { "640x480", 60, 640, 480, 40000, 48, 16, 32, 11, 96, 2, 0, 0, 0 },
38 /* 16 bits/pixel, 32MB, 100MHz, SDRAM memory mode value */
39 16, 0x2000000, GC_CCF_COT_100, 0x414fb7f2
40};
41#endif
42
43#if defined(CONFIG_SOCRATES)
44static struct mb862xx_gc_mode socrates_gc_mode = {
45 /* Mode for Prime View PM070WL4 TFT LCD Panel */
46 { "800x480", 45, 800, 480, 40000, 86, 42, 33, 10, 128, 2, 0, 0, 0 },
47 /* 16 bits/pixel, 16MB, 133MHz, SDRAM memory mode value */
48 16, 0x1000000, GC_CCF_COT_133, 0x4157ba63
49};
50#endif
51
52/* Helpers */
53static inline int h_total(struct fb_var_screeninfo *var)
54{
55 return var->xres + var->left_margin +
56 var->right_margin + var->hsync_len;
57}
58
59static inline int v_total(struct fb_var_screeninfo *var)
60{
61 return var->yres + var->upper_margin +
62 var->lower_margin + var->vsync_len;
63}
64
65static inline int hsp(struct fb_var_screeninfo *var)
66{
67 return var->xres + var->right_margin - 1;
68}
69
70static inline int vsp(struct fb_var_screeninfo *var)
71{
72 return var->yres + var->lower_margin - 1;
73}
74
75static inline int d_pitch(struct fb_var_screeninfo *var)
76{
77 return var->xres * var->bits_per_pixel / 8;
78}
79
80static inline unsigned int chan_to_field(unsigned int chan,
81 struct fb_bitfield *bf)
82{
83 chan &= 0xffff;
84 chan >>= 16 - bf->length;
85 return chan << bf->offset;
86}
87
88static int mb862xxfb_setcolreg(unsigned regno,
89 unsigned red, unsigned green, unsigned blue,
90 unsigned transp, struct fb_info *info)
91{
92 struct mb862xxfb_par *par = info->par;
93 unsigned int val;
94
95 switch (info->fix.visual) {
96 case FB_VISUAL_TRUECOLOR:
97 if (regno < 16) {
98 val = chan_to_field(red, &info->var.red);
99 val |= chan_to_field(green, &info->var.green);
100 val |= chan_to_field(blue, &info->var.blue);
101 par->pseudo_palette[regno] = val;
102 }
103 break;
104 case FB_VISUAL_PSEUDOCOLOR:
105 if (regno < 256) {
106 val = (red >> 8) << 16;
107 val |= (green >> 8) << 8;
108 val |= blue >> 8;
109 outreg(disp, GC_L0PAL0 + (regno * 4), val);
110 }
111 break;
112 default:
113 return 1; /* unsupported type */
114 }
115 return 0;
116}
117
118static int mb862xxfb_check_var(struct fb_var_screeninfo *var,
119 struct fb_info *fbi)
120{
121 unsigned long tmp;
122
123 if (fbi->dev)
124 dev_dbg(fbi->dev, "%s\n", __func__);
125
126 /* check if these values fit into the registers */
127 if (var->hsync_len > 255 || var->vsync_len > 255)
128 return -EINVAL;
129
130 if ((var->xres + var->right_margin) >= 4096)
131 return -EINVAL;
132
133 if ((var->yres + var->lower_margin) > 4096)
134 return -EINVAL;
135
136 if (h_total(var) > 4096 || v_total(var) > 4096)
137 return -EINVAL;
138
139 if (var->xres_virtual > 4096 || var->yres_virtual > 4096)
140 return -EINVAL;
141
142 if (var->bits_per_pixel <= 8)
143 var->bits_per_pixel = 8;
144 else if (var->bits_per_pixel <= 16)
145 var->bits_per_pixel = 16;
146 else if (var->bits_per_pixel <= 32)
147 var->bits_per_pixel = 32;
148
149 /*
150 * can cope with 8,16 or 24/32bpp if resulting
151 * pitch is divisible by 64 without remainder
152 */
153 if (d_pitch(&fbi->var) % GC_L0M_L0W_UNIT) {
154 int r;
155
156 var->bits_per_pixel = 0;
157 do {
158 var->bits_per_pixel += 8;
159 r = d_pitch(&fbi->var) % GC_L0M_L0W_UNIT;
160 } while (r && var->bits_per_pixel <= 32);
161
162 if (d_pitch(&fbi->var) % GC_L0M_L0W_UNIT)
163 return -EINVAL;
164 }
165
166 /* line length is going to be 128 bit aligned */
167 tmp = (var->xres * var->bits_per_pixel) / 8;
168 if ((tmp & 15) != 0)
169 return -EINVAL;
170
171 /* set r/g/b positions and validate bpp */
172 switch (var->bits_per_pixel) {
173 case 8:
174 var->red.length = var->bits_per_pixel;
175 var->green.length = var->bits_per_pixel;
176 var->blue.length = var->bits_per_pixel;
177 var->red.offset = 0;
178 var->green.offset = 0;
179 var->blue.offset = 0;
180 var->transp.length = 0;
181 break;
182 case 16:
183 var->red.length = 5;
184 var->green.length = 5;
185 var->blue.length = 5;
186 var->red.offset = 10;
187 var->green.offset = 5;
188 var->blue.offset = 0;
189 var->transp.length = 0;
190 break;
191 case 24:
192 case 32:
193 var->transp.length = 8;
194 var->red.length = 8;
195 var->green.length = 8;
196 var->blue.length = 8;
197 var->transp.offset = 24;
198 var->red.offset = 16;
199 var->green.offset = 8;
200 var->blue.offset = 0;
201 break;
202 default:
203 return -EINVAL;
204 }
205 return 0;
206}
207
208/*
209 * set display parameters
210 */
211static int mb862xxfb_set_par(struct fb_info *fbi)
212{
213 struct mb862xxfb_par *par = fbi->par;
214 unsigned long reg, sc;
215
216 dev_dbg(par->dev, "%s\n", __func__);
217
218 if (par->pre_init)
219 return 0;
220
221 /* disp off */
222 reg = inreg(disp, GC_DCM1);
223 reg &= ~GC_DCM01_DEN;
224 outreg(disp, GC_DCM1, reg);
225
226 /* set display reference clock div. */
227 sc = par->refclk / (1000000 / fbi->var.pixclock) - 1;
228 reg = inreg(disp, GC_DCM1);
229 reg &= ~(GC_DCM01_CKS | GC_DCM01_RESV | GC_DCM01_SC);
230 reg |= sc << 8;
231 outreg(disp, GC_DCM1, reg);
232 dev_dbg(par->dev, "SC 0x%lx\n", sc);
233
234 /* disp dimension, format */
235 reg = pack(d_pitch(&fbi->var) / GC_L0M_L0W_UNIT,
236 (fbi->var.yres - 1));
237 if (fbi->var.bits_per_pixel == 16)
238 reg |= GC_L0M_L0C_16;
239 outreg(disp, GC_L0M, reg);
240
241 if (fbi->var.bits_per_pixel == 32) {
242 reg = inreg(disp, GC_L0EM);
243 outreg(disp, GC_L0EM, reg | GC_L0EM_L0EC_24);
244 }
245 outreg(disp, GC_WY_WX, 0);
246 reg = pack(fbi->var.yres - 1, fbi->var.xres);
247 outreg(disp, GC_WH_WW, reg);
248 outreg(disp, GC_L0OA0, 0);
249 outreg(disp, GC_L0DA0, 0);
250 outreg(disp, GC_L0DY_L0DX, 0);
251 outreg(disp, GC_L0WY_L0WX, 0);
252 outreg(disp, GC_L0WH_L0WW, reg);
253
254 /* both HW-cursors off */
255 reg = inreg(disp, GC_CPM_CUTC);
256 reg &= ~(GC_CPM_CEN0 | GC_CPM_CEN1);
257 outreg(disp, GC_CPM_CUTC, reg);
258
259 /* timings */
260 reg = pack(fbi->var.xres - 1, fbi->var.xres - 1);
261 outreg(disp, GC_HDB_HDP, reg);
262 reg = pack((fbi->var.yres - 1), vsp(&fbi->var));
263 outreg(disp, GC_VDP_VSP, reg);
264 reg = ((fbi->var.vsync_len - 1) << 24) |
265 pack((fbi->var.hsync_len - 1), hsp(&fbi->var));
266 outreg(disp, GC_VSW_HSW_HSP, reg);
267 outreg(disp, GC_HTP, pack(h_total(&fbi->var) - 1, 0));
268 outreg(disp, GC_VTR, pack(v_total(&fbi->var) - 1, 0));
269
270 /* display on */
271 reg = inreg(disp, GC_DCM1);
272 reg |= GC_DCM01_DEN | GC_DCM01_L0E;
273 reg &= ~GC_DCM01_ESY;
274 outreg(disp, GC_DCM1, reg);
275 return 0;
276}
277
278static int mb862xxfb_pan(struct fb_var_screeninfo *var,
279 struct fb_info *info)
280{
281 struct mb862xxfb_par *par = info->par;
282 unsigned long reg;
283
284 reg = pack(var->yoffset, var->xoffset);
285 outreg(disp, GC_L0WY_L0WX, reg);
286
287 reg = pack(var->yres_virtual, var->xres_virtual);
288 outreg(disp, GC_L0WH_L0WW, reg);
289 return 0;
290}
291
292static int mb862xxfb_blank(int mode, struct fb_info *fbi)
293{
294 struct mb862xxfb_par *par = fbi->par;
295 unsigned long reg;
296
297 dev_dbg(fbi->dev, "blank mode=%d\n", mode);
298
299 switch (mode) {
300 case FB_BLANK_POWERDOWN:
301 reg = inreg(disp, GC_DCM1);
302 reg &= ~GC_DCM01_DEN;
303 outreg(disp, GC_DCM1, reg);
304 break;
305 case FB_BLANK_UNBLANK:
306 reg = inreg(disp, GC_DCM1);
307 reg |= GC_DCM01_DEN;
308 outreg(disp, GC_DCM1, reg);
309 break;
310 case FB_BLANK_NORMAL:
311 case FB_BLANK_VSYNC_SUSPEND:
312 case FB_BLANK_HSYNC_SUSPEND:
313 default:
314 return 1;
315 }
316 return 0;
317}
318
319/* framebuffer ops */
320static struct fb_ops mb862xxfb_ops = {
321 .owner = THIS_MODULE,
322 .fb_check_var = mb862xxfb_check_var,
323 .fb_set_par = mb862xxfb_set_par,
324 .fb_setcolreg = mb862xxfb_setcolreg,
325 .fb_blank = mb862xxfb_blank,
326 .fb_pan_display = mb862xxfb_pan,
327 .fb_fillrect = cfb_fillrect,
328 .fb_copyarea = cfb_copyarea,
329 .fb_imageblit = cfb_imageblit,
330};
331
332/* initialize fb_info data */
333static int mb862xxfb_init_fbinfo(struct fb_info *fbi)
334{
335 struct mb862xxfb_par *par = fbi->par;
336 struct mb862xx_gc_mode *mode = par->gc_mode;
337 unsigned long reg;
338
339 fbi->fbops = &mb862xxfb_ops;
340 fbi->pseudo_palette = par->pseudo_palette;
341 fbi->screen_base = par->fb_base;
342 fbi->screen_size = par->mapped_vram;
343
344 strcpy(fbi->fix.id, DRV_NAME);
345 fbi->fix.smem_start = (unsigned long)par->fb_base_phys;
346 fbi->fix.smem_len = par->mapped_vram;
347 fbi->fix.mmio_start = (unsigned long)par->mmio_base_phys;
348 fbi->fix.mmio_len = par->mmio_len;
349 fbi->fix.accel = FB_ACCEL_NONE;
350 fbi->fix.type = FB_TYPE_PACKED_PIXELS;
351 fbi->fix.type_aux = 0;
352 fbi->fix.xpanstep = 1;
353 fbi->fix.ypanstep = 1;
354 fbi->fix.ywrapstep = 0;
355
356 reg = inreg(disp, GC_DCM1);
357 if (reg & GC_DCM01_DEN && reg & GC_DCM01_L0E) {
358 /* get the disp mode from active display cfg */
359 unsigned long sc = ((reg & GC_DCM01_SC) >> 8) + 1;
360 unsigned long hsp, vsp, ht, vt;
361
362 dev_dbg(par->dev, "using bootloader's disp. mode\n");
363 fbi->var.pixclock = (sc * 1000000) / par->refclk;
364 fbi->var.xres = (inreg(disp, GC_HDB_HDP) & 0x0fff) + 1;
365 reg = inreg(disp, GC_VDP_VSP);
366 fbi->var.yres = ((reg >> 16) & 0x0fff) + 1;
367 vsp = (reg & 0x0fff) + 1;
368 fbi->var.xres_virtual = fbi->var.xres;
369 fbi->var.yres_virtual = fbi->var.yres;
370 reg = inreg(disp, GC_L0EM);
371 if (reg & GC_L0EM_L0EC_24) {
372 fbi->var.bits_per_pixel = 32;
373 } else {
374 reg = inreg(disp, GC_L0M);
375 if (reg & GC_L0M_L0C_16)
376 fbi->var.bits_per_pixel = 16;
377 else
378 fbi->var.bits_per_pixel = 8;
379 }
380 reg = inreg(disp, GC_VSW_HSW_HSP);
381 fbi->var.hsync_len = ((reg & 0xff0000) >> 16) + 1;
382 fbi->var.vsync_len = ((reg & 0x3f000000) >> 24) + 1;
383 hsp = (reg & 0xffff) + 1;
384 ht = ((inreg(disp, GC_HTP) & 0xfff0000) >> 16) + 1;
385 fbi->var.right_margin = hsp - fbi->var.xres;
386 fbi->var.left_margin = ht - hsp - fbi->var.hsync_len;
387 vt = ((inreg(disp, GC_VTR) & 0xfff0000) >> 16) + 1;
388 fbi->var.lower_margin = vsp - fbi->var.yres;
389 fbi->var.upper_margin = vt - vsp - fbi->var.vsync_len;
390 } else if (mode) {
391 dev_dbg(par->dev, "using supplied mode\n");
392 fb_videomode_to_var(&fbi->var, (struct fb_videomode *)mode);
393 fbi->var.bits_per_pixel = mode->def_bpp ? mode->def_bpp : 8;
394 } else {
395 int ret;
396
397 ret = fb_find_mode(&fbi->var, fbi, "640x480-16@60",
398 NULL, 0, NULL, 16);
399 if (ret == 0 || ret == 4) {
400 dev_err(par->dev,
401 "failed to get initial mode\n");
402 return -EINVAL;
403 }
404 }
405
406 fbi->var.xoffset = 0;
407 fbi->var.yoffset = 0;
408 fbi->var.grayscale = 0;
409 fbi->var.nonstd = 0;
410 fbi->var.height = -1;
411 fbi->var.width = -1;
412 fbi->var.accel_flags = 0;
413 fbi->var.vmode = FB_VMODE_NONINTERLACED;
414 fbi->var.activate = FB_ACTIVATE_NOW;
415 fbi->flags = FBINFO_DEFAULT |
416#ifdef __BIG_ENDIAN
417 FBINFO_FOREIGN_ENDIAN |
418#endif
419 FBINFO_HWACCEL_XPAN |
420 FBINFO_HWACCEL_YPAN;
421
422 /* check and possibly fix bpp */
423 if ((fbi->fbops->fb_check_var)(&fbi->var, fbi))
424 dev_err(par->dev, "check_var() failed on initial setup?\n");
425
426 fbi->fix.visual = fbi->var.bits_per_pixel == 8 ?
427 FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
428 fbi->fix.line_length = (fbi->var.xres_virtual *
429 fbi->var.bits_per_pixel) / 8;
430 return 0;
431}
432
433/*
434 * show some display controller and cursor registers
435 */
436static ssize_t mb862xxfb_show_dispregs(struct device *dev,
437 struct device_attribute *attr, char *buf)
438{
439 struct fb_info *fbi = dev_get_drvdata(dev);
440 struct mb862xxfb_par *par = fbi->par;
441 char *ptr = buf;
442 unsigned int reg;
443
444 for (reg = GC_DCM0; reg <= GC_L0DY_L0DX; reg += 4)
445 ptr += sprintf(ptr, "%08x = %08x\n",
446 reg, inreg(disp, reg));
447
448 for (reg = GC_CPM_CUTC; reg <= GC_CUY1_CUX1; reg += 4)
449 ptr += sprintf(ptr, "%08x = %08x\n",
450 reg, inreg(disp, reg));
451
452 for (reg = GC_DCM1; reg <= GC_L0WH_L0WW; reg += 4)
453 ptr += sprintf(ptr, "%08x = %08x\n",
454 reg, inreg(disp, reg));
455
456 return ptr - buf;
457}
458
459static DEVICE_ATTR(dispregs, 0444, mb862xxfb_show_dispregs, NULL);
460
461irqreturn_t mb862xx_intr(int irq, void *dev_id)
462{
463 struct mb862xxfb_par *par = (struct mb862xxfb_par *) dev_id;
464 unsigned long reg_ist, mask;
465
466 if (!par)
467 return IRQ_NONE;
468
469 if (par->type == BT_CARMINE) {
470 /* Get Interrupt Status */
471 reg_ist = inreg(ctrl, GC_CTRL_STATUS);
472 mask = inreg(ctrl, GC_CTRL_INT_MASK);
473 if (reg_ist == 0)
474 return IRQ_HANDLED;
475
476 reg_ist &= mask;
477 if (reg_ist == 0)
478 return IRQ_HANDLED;
479
480 /* Clear interrupt status */
481 outreg(ctrl, 0x0, reg_ist);
482 } else {
483 /* Get status */
484 reg_ist = inreg(host, GC_IST);
485 mask = inreg(host, GC_IMASK);
486
487 reg_ist &= mask;
488 if (reg_ist == 0)
489 return IRQ_HANDLED;
490
491 /* Clear status */
492 outreg(host, GC_IST, ~reg_ist);
493 }
494 return IRQ_HANDLED;
495}
496
497#if defined(CONFIG_FB_MB862XX_LIME)
498/*
499 * GDC (Lime, Coral(B/Q), Mint, ...) on host bus
500 */
501static int mb862xx_gdc_init(struct mb862xxfb_par *par)
502{
503 unsigned long ccf, mmr;
504 unsigned long ver, rev;
505
506 if (!par)
507 return -ENODEV;
508
509#if defined(CONFIG_FB_PRE_INIT_FB)
510 par->pre_init = 1;
511#endif
512 par->host = par->mmio_base;
513 par->i2c = par->mmio_base + MB862XX_I2C_BASE;
514 par->disp = par->mmio_base + MB862XX_DISP_BASE;
515 par->cap = par->mmio_base + MB862XX_CAP_BASE;
516 par->draw = par->mmio_base + MB862XX_DRAW_BASE;
517 par->geo = par->mmio_base + MB862XX_GEO_BASE;
518 par->pio = par->mmio_base + MB862XX_PIO_BASE;
519
520 par->refclk = GC_DISP_REFCLK_400;
521
522 ver = inreg(host, GC_CID);
523 rev = inreg(pio, GC_REVISION);
524 if ((ver == 0x303) && (rev & 0xffffff00) == 0x20050100) {
525 dev_info(par->dev, "Fujitsu Lime v1.%d found\n",
526 (int)rev & 0xff);
527 par->type = BT_LIME;
528 ccf = par->gc_mode ? par->gc_mode->ccf : GC_CCF_COT_100;
529 mmr = par->gc_mode ? par->gc_mode->mmr : 0x414fb7f2;
530 } else {
531 dev_info(par->dev, "? GDC, CID/Rev.: 0x%lx/0x%lx \n", ver, rev);
532 return -ENODEV;
533 }
534
535 if (!par->pre_init) {
536 outreg(host, GC_CCF, ccf);
537 udelay(200);
538 outreg(host, GC_MMR, mmr);
539 udelay(10);
540 }
541
542 /* interrupt status */
543 outreg(host, GC_IST, 0);
544 outreg(host, GC_IMASK, GC_INT_EN);
545 return 0;
546}
547
548static int __devinit of_platform_mb862xx_probe(struct of_device *ofdev,
549 const struct of_device_id *id)
550{
551 struct device_node *np = ofdev->node;
552 struct device *dev = &ofdev->dev;
553 struct mb862xxfb_par *par;
554 struct fb_info *info;
555 struct resource res;
556 resource_size_t res_size;
557 unsigned long ret = -ENODEV;
558
559 if (of_address_to_resource(np, 0, &res)) {
560 dev_err(dev, "Invalid address\n");
561 return -ENXIO;
562 }
563
564 info = framebuffer_alloc(sizeof(struct mb862xxfb_par), dev);
565 if (info == NULL) {
566 dev_err(dev, "cannot allocate framebuffer\n");
567 return -ENOMEM;
568 }
569
570 par = info->par;
571 par->info = info;
572 par->dev = dev;
573
574 par->irq = irq_of_parse_and_map(np, 0);
575 if (par->irq == NO_IRQ) {
576 dev_err(dev, "failed to map irq\n");
577 ret = -ENODEV;
578 goto fbrel;
579 }
580
581 res_size = 1 + res.end - res.start;
582 par->res = request_mem_region(res.start, res_size, DRV_NAME);
583 if (par->res == NULL) {
584 dev_err(dev, "Cannot claim framebuffer/mmio\n");
585 ret = -ENXIO;
586 goto irqdisp;
587 }
588
589#if defined(CONFIG_LWMON5)
590 par->gc_mode = &lwmon5_gc_mode;
591#endif
592
593#if defined(CONFIG_SOCRATES)
594 par->gc_mode = &socrates_gc_mode;
595#endif
596
597 par->fb_base_phys = res.start;
598 par->mmio_base_phys = res.start + MB862XX_MMIO_BASE;
599 par->mmio_len = MB862XX_MMIO_SIZE;
600 if (par->gc_mode)
601 par->mapped_vram = par->gc_mode->max_vram;
602 else
603 par->mapped_vram = MB862XX_MEM_SIZE;
604
605 par->fb_base = ioremap(par->fb_base_phys, par->mapped_vram);
606 if (par->fb_base == NULL) {
607 dev_err(dev, "Cannot map framebuffer\n");
608 goto rel_reg;
609 }
610
611 par->mmio_base = ioremap(par->mmio_base_phys, par->mmio_len);
612 if (par->mmio_base == NULL) {
613 dev_err(dev, "Cannot map registers\n");
614 goto fb_unmap;
615 }
616
617 dev_dbg(dev, "fb phys 0x%llx 0x%lx\n",
618 (u64)par->fb_base_phys, (ulong)par->mapped_vram);
619 dev_dbg(dev, "mmio phys 0x%llx 0x%lx, (irq = %d)\n",
620 (u64)par->mmio_base_phys, (ulong)par->mmio_len, par->irq);
621
622 if (mb862xx_gdc_init(par))
623 goto io_unmap;
624
625 if (request_irq(par->irq, mb862xx_intr, IRQF_DISABLED,
626 DRV_NAME, (void *)par)) {
627 dev_err(dev, "Cannot request irq\n");
628 goto io_unmap;
629 }
630
631 mb862xxfb_init_fbinfo(info);
632
633 if (fb_alloc_cmap(&info->cmap, NR_PALETTE, 0) < 0) {
634 dev_err(dev, "Could not allocate cmap for fb_info.\n");
635 goto free_irq;
636 }
637
638 if ((info->fbops->fb_set_par)(info))
639 dev_err(dev, "set_var() failed on initial setup?\n");
640
641 if (register_framebuffer(info)) {
642 dev_err(dev, "failed to register framebuffer\n");
643 goto rel_cmap;
644 }
645
646 dev_set_drvdata(dev, info);
647
648 if (device_create_file(dev, &dev_attr_dispregs))
649 dev_err(dev, "Can't create sysfs regdump file\n");
650 return 0;
651
652rel_cmap:
653 fb_dealloc_cmap(&info->cmap);
654free_irq:
655 outreg(host, GC_IMASK, 0);
656 free_irq(par->irq, (void *)par);
657io_unmap:
658 iounmap(par->mmio_base);
659fb_unmap:
660 iounmap(par->fb_base);
661rel_reg:
662 release_mem_region(res.start, res_size);
663irqdisp:
664 irq_dispose_mapping(par->irq);
665fbrel:
666 dev_set_drvdata(dev, NULL);
667 framebuffer_release(info);
668 return ret;
669}
670
671static int __devexit of_platform_mb862xx_remove(struct of_device *ofdev)
672{
673 struct fb_info *fbi = dev_get_drvdata(&ofdev->dev);
674 struct mb862xxfb_par *par = fbi->par;
675 resource_size_t res_size = 1 + par->res->end - par->res->start;
676 unsigned long reg;
677
678 dev_dbg(fbi->dev, "%s release\n", fbi->fix.id);
679
680 /* display off */
681 reg = inreg(disp, GC_DCM1);
682 reg &= ~(GC_DCM01_DEN | GC_DCM01_L0E);
683 outreg(disp, GC_DCM1, reg);
684
685 /* disable interrupts */
686 outreg(host, GC_IMASK, 0);
687
688 free_irq(par->irq, (void *)par);
689 irq_dispose_mapping(par->irq);
690
691 device_remove_file(&ofdev->dev, &dev_attr_dispregs);
692
693 unregister_framebuffer(fbi);
694 fb_dealloc_cmap(&fbi->cmap);
695
696 iounmap(par->mmio_base);
697 iounmap(par->fb_base);
698
699 dev_set_drvdata(&ofdev->dev, NULL);
700 release_mem_region(par->res->start, res_size);
701 framebuffer_release(fbi);
702 return 0;
703}
704
705/*
706 * common types
707 */
708static struct of_device_id __devinitdata of_platform_mb862xx_tbl[] = {
709 { .compatible = "fujitsu,MB86276", },
710 { .compatible = "fujitsu,lime", },
711 { .compatible = "fujitsu,MB86277", },
712 { .compatible = "fujitsu,mint", },
713 { .compatible = "fujitsu,MB86293", },
714 { .compatible = "fujitsu,MB86294", },
715 { .compatible = "fujitsu,coral", },
716 { /* end */ }
717};
718
719static struct of_platform_driver of_platform_mb862xxfb_driver = {
720 .owner = THIS_MODULE,
721 .name = DRV_NAME,
722 .match_table = of_platform_mb862xx_tbl,
723 .probe = of_platform_mb862xx_probe,
724 .remove = __devexit_p(of_platform_mb862xx_remove),
725};
726#endif
727
728#if defined(CONFIG_FB_MB862XX_PCI_GDC)
729static int coralp_init(struct mb862xxfb_par *par)
730{
731 int cn, ver;
732
733 par->host = par->mmio_base;
734 par->i2c = par->mmio_base + MB862XX_I2C_BASE;
735 par->disp = par->mmio_base + MB862XX_DISP_BASE;
736 par->cap = par->mmio_base + MB862XX_CAP_BASE;
737 par->draw = par->mmio_base + MB862XX_DRAW_BASE;
738 par->geo = par->mmio_base + MB862XX_GEO_BASE;
739 par->pio = par->mmio_base + MB862XX_PIO_BASE;
740
741 par->refclk = GC_DISP_REFCLK_400;
742
743 ver = inreg(host, GC_CID);
744 cn = (ver & GC_CID_CNAME_MSK) >> 8;
745 ver = ver & GC_CID_VERSION_MSK;
746 if (cn == 3) {
747 dev_info(par->dev, "Fujitsu Coral-%s GDC Rev.%d found\n",\
748 (ver == 6) ? "P" : (ver == 8) ? "PA" : "?",
749 par->pdev->revision);
750 outreg(host, GC_CCF, GC_CCF_CGE_166 | GC_CCF_COT_133);
751 udelay(200);
752 outreg(host, GC_MMR, GC_MMR_CORALP_EVB_VAL);
753 udelay(10);
754 /* Clear interrupt status */
755 outreg(host, GC_IST, 0);
756 } else {
757 return -ENODEV;
758 }
759 return 0;
760}
761
762static int init_dram_ctrl(struct mb862xxfb_par *par)
763{
764 unsigned long i = 0;
765
766 /*
767 * Set io mode first! Spec. says IC may be destroyed
768 * if not set to SSTL2/LVCMOS before init.
769 */
770 outreg(dram_ctrl, GC_DCTL_IOCONT1_IOCONT0, GC_EVB_DCTL_IOCONT1_IOCONT0);
771
772 /* DRAM init */
773 outreg(dram_ctrl, GC_DCTL_MODE_ADD, GC_EVB_DCTL_MODE_ADD);
774 outreg(dram_ctrl, GC_DCTL_SETTIME1_EMODE, GC_EVB_DCTL_SETTIME1_EMODE);
775 outreg(dram_ctrl, GC_DCTL_REFRESH_SETTIME2,
776 GC_EVB_DCTL_REFRESH_SETTIME2);
777 outreg(dram_ctrl, GC_DCTL_RSV2_RSV1, GC_EVB_DCTL_RSV2_RSV1);
778 outreg(dram_ctrl, GC_DCTL_DDRIF2_DDRIF1, GC_EVB_DCTL_DDRIF2_DDRIF1);
779 outreg(dram_ctrl, GC_DCTL_RSV0_STATES, GC_EVB_DCTL_RSV0_STATES);
780
781 /* DLL reset done? */
782 while ((inreg(dram_ctrl, GC_DCTL_RSV0_STATES) & GC_DCTL_STATES_MSK)) {
783 udelay(GC_DCTL_INIT_WAIT_INTERVAL);
784 if (i++ > GC_DCTL_INIT_WAIT_CNT) {
785 dev_err(par->dev, "VRAM init failed.\n");
786 return -EINVAL;
787 }
788 }
789 outreg(dram_ctrl, GC_DCTL_MODE_ADD, GC_EVB_DCTL_MODE_ADD_AFT_RST);
790 outreg(dram_ctrl, GC_DCTL_RSV0_STATES, GC_EVB_DCTL_RSV0_STATES_AFT_RST);
791 return 0;
792}
793
794static int carmine_init(struct mb862xxfb_par *par)
795{
796 unsigned long reg;
797
798 par->ctrl = par->mmio_base + MB86297_CTRL_BASE;
799 par->i2c = par->mmio_base + MB86297_I2C_BASE;
800 par->disp = par->mmio_base + MB86297_DISP0_BASE;
801 par->disp1 = par->mmio_base + MB86297_DISP1_BASE;
802 par->cap = par->mmio_base + MB86297_CAP0_BASE;
803 par->cap1 = par->mmio_base + MB86297_CAP1_BASE;
804 par->draw = par->mmio_base + MB86297_DRAW_BASE;
805 par->dram_ctrl = par->mmio_base + MB86297_DRAMCTRL_BASE;
806 par->wrback = par->mmio_base + MB86297_WRBACK_BASE;
807
808 par->refclk = GC_DISP_REFCLK_533;
809
810 /* warm up */
811 reg = GC_CTRL_CLK_EN_DRAM | GC_CTRL_CLK_EN_2D3D | GC_CTRL_CLK_EN_DISP0;
812 outreg(ctrl, GC_CTRL_CLK_ENABLE, reg);
813
814 /* check for engine module revision */
815 if (inreg(draw, GC_2D3D_REV) == GC_RE_REVISION)
816 dev_info(par->dev, "Fujitsu Carmine GDC Rev.%d found\n",
817 par->pdev->revision);
818 else
819 goto err_init;
820
821 reg &= ~GC_CTRL_CLK_EN_2D3D;
822 outreg(ctrl, GC_CTRL_CLK_ENABLE, reg);
823
824 /* set up vram */
825 if (init_dram_ctrl(par) < 0)
826 goto err_init;
827
828 outreg(ctrl, GC_CTRL_INT_MASK, 0);
829 return 0;
830
831err_init:
832 outreg(ctrl, GC_CTRL_CLK_ENABLE, 0);
833 return -EINVAL;
834}
835
836static inline int mb862xx_pci_gdc_init(struct mb862xxfb_par *par)
837{
838 switch (par->type) {
839 case BT_CORALP:
840 return coralp_init(par);
841 case BT_CARMINE:
842 return carmine_init(par);
843 default:
844 return -ENODEV;
845 }
846}
847
848#define CHIP_ID(id) \
849 { PCI_DEVICE(PCI_VENDOR_ID_FUJITSU_LIMITED, id) }
850
851static struct pci_device_id mb862xx_pci_tbl[] __devinitdata = {
852 /* MB86295/MB86296 */
853 CHIP_ID(PCI_DEVICE_ID_FUJITSU_CORALP),
854 CHIP_ID(PCI_DEVICE_ID_FUJITSU_CORALPA),
855 /* MB86297 */
856 CHIP_ID(PCI_DEVICE_ID_FUJITSU_CARMINE),
857 { 0, }
858};
859
860MODULE_DEVICE_TABLE(pci, mb862xx_pci_tbl);
861
862static int __devinit mb862xx_pci_probe(struct pci_dev *pdev,
863 const struct pci_device_id *ent)
864{
865 struct mb862xxfb_par *par;
866 struct fb_info *info;
867 struct device *dev = &pdev->dev;
868 int ret;
869
870 ret = pci_enable_device(pdev);
871 if (ret < 0) {
872 dev_err(dev, "Cannot enable PCI device\n");
873 goto out;
874 }
875
876 info = framebuffer_alloc(sizeof(struct mb862xxfb_par), dev);
877 if (!info) {
878 dev_err(dev, "framebuffer alloc failed\n");
879 ret = -ENOMEM;
880 goto dis_dev;
881 }
882
883 par = info->par;
884 par->info = info;
885 par->dev = dev;
886 par->pdev = pdev;
887 par->irq = pdev->irq;
888
889 ret = pci_request_regions(pdev, DRV_NAME);
890 if (ret < 0) {
891 dev_err(dev, "Cannot reserve region(s) for PCI device\n");
892 goto rel_fb;
893 }
894
895 switch (pdev->device) {
896 case PCI_DEVICE_ID_FUJITSU_CORALP:
897 case PCI_DEVICE_ID_FUJITSU_CORALPA:
898 par->fb_base_phys = pci_resource_start(par->pdev, 0);
899 par->mapped_vram = CORALP_MEM_SIZE;
900 par->mmio_base_phys = par->fb_base_phys + MB862XX_MMIO_BASE;
901 par->mmio_len = MB862XX_MMIO_SIZE;
902 par->type = BT_CORALP;
903 break;
904 case PCI_DEVICE_ID_FUJITSU_CARMINE:
905 par->fb_base_phys = pci_resource_start(par->pdev, 2);
906 par->mmio_base_phys = pci_resource_start(par->pdev, 3);
907 par->mmio_len = pci_resource_len(par->pdev, 3);
908 par->mapped_vram = CARMINE_MEM_SIZE;
909 par->type = BT_CARMINE;
910 break;
911 default:
912 /* should never occur */
913 goto rel_reg;
914 }
915
916 par->fb_base = ioremap(par->fb_base_phys, par->mapped_vram);
917 if (par->fb_base == NULL) {
918 dev_err(dev, "Cannot map framebuffer\n");
919 goto rel_reg;
920 }
921
922 par->mmio_base = ioremap(par->mmio_base_phys, par->mmio_len);
923 if (par->mmio_base == NULL) {
924 dev_err(dev, "Cannot map registers\n");
925 ret = -EIO;
926 goto fb_unmap;
927 }
928
929 dev_dbg(dev, "fb phys 0x%llx 0x%lx\n",
930 (u64)par->fb_base_phys, (ulong)par->mapped_vram);
931 dev_dbg(dev, "mmio phys 0x%llx 0x%lx\n",
932 (u64)par->mmio_base_phys, (ulong)par->mmio_len);
933
934 if (mb862xx_pci_gdc_init(par))
935 goto io_unmap;
936
937 if (request_irq(par->irq, mb862xx_intr, IRQF_DISABLED | IRQF_SHARED,
938 DRV_NAME, (void *)par)) {
939 dev_err(dev, "Cannot request irq\n");
940 goto io_unmap;
941 }
942
943 mb862xxfb_init_fbinfo(info);
944
945 if (fb_alloc_cmap(&info->cmap, NR_PALETTE, 0) < 0) {
946 dev_err(dev, "Could not allocate cmap for fb_info.\n");
947 ret = -ENOMEM;
948 goto free_irq;
949 }
950
951 if ((info->fbops->fb_set_par)(info))
952 dev_err(dev, "set_var() failed on initial setup?\n");
953
954 ret = register_framebuffer(info);
955 if (ret < 0) {
956 dev_err(dev, "failed to register framebuffer\n");
957 goto rel_cmap;
958 }
959
960 pci_set_drvdata(pdev, info);
961
962 if (device_create_file(dev, &dev_attr_dispregs))
963 dev_err(dev, "Can't create sysfs regdump file\n");
964
965 if (par->type == BT_CARMINE)
966 outreg(ctrl, GC_CTRL_INT_MASK, GC_CARMINE_INT_EN);
967 else
968 outreg(host, GC_IMASK, GC_INT_EN);
969
970 return 0;
971
972rel_cmap:
973 fb_dealloc_cmap(&info->cmap);
974free_irq:
975 free_irq(par->irq, (void *)par);
976io_unmap:
977 iounmap(par->mmio_base);
978fb_unmap:
979 iounmap(par->fb_base);
980rel_reg:
981 pci_release_regions(pdev);
982rel_fb:
983 framebuffer_release(info);
984dis_dev:
985 pci_disable_device(pdev);
986out:
987 return ret;
988}
989
990static void __devexit mb862xx_pci_remove(struct pci_dev *pdev)
991{
992 struct fb_info *fbi = pci_get_drvdata(pdev);
993 struct mb862xxfb_par *par = fbi->par;
994 unsigned long reg;
995
996 dev_dbg(fbi->dev, "%s release\n", fbi->fix.id);
997
998 /* display off */
999 reg = inreg(disp, GC_DCM1);
1000 reg &= ~(GC_DCM01_DEN | GC_DCM01_L0E);
1001 outreg(disp, GC_DCM1, reg);
1002
1003 if (par->type == BT_CARMINE) {
1004 outreg(ctrl, GC_CTRL_INT_MASK, 0);
1005 outreg(ctrl, GC_CTRL_CLK_ENABLE, 0);
1006 } else {
1007 outreg(host, GC_IMASK, 0);
1008 }
1009
1010 device_remove_file(&pdev->dev, &dev_attr_dispregs);
1011
1012 pci_set_drvdata(pdev, NULL);
1013 unregister_framebuffer(fbi);
1014 fb_dealloc_cmap(&fbi->cmap);
1015
1016 free_irq(par->irq, (void *)par);
1017 iounmap(par->mmio_base);
1018 iounmap(par->fb_base);
1019
1020 pci_release_regions(pdev);
1021 framebuffer_release(fbi);
1022 pci_disable_device(pdev);
1023}
1024
1025static struct pci_driver mb862xxfb_pci_driver = {
1026 .name = DRV_NAME,
1027 .id_table = mb862xx_pci_tbl,
1028 .probe = mb862xx_pci_probe,
1029 .remove = __devexit_p(mb862xx_pci_remove),
1030};
1031#endif
1032
1033static int __devinit mb862xxfb_init(void)
1034{
1035 int ret = -ENODEV;
1036
1037#if defined(CONFIG_FB_MB862XX_LIME)
1038 ret = of_register_platform_driver(&of_platform_mb862xxfb_driver);
1039#endif
1040#if defined(CONFIG_FB_MB862XX_PCI_GDC)
1041 ret = pci_register_driver(&mb862xxfb_pci_driver);
1042#endif
1043 return ret;
1044}
1045
1046static void __exit mb862xxfb_exit(void)
1047{
1048#if defined(CONFIG_FB_MB862XX_LIME)
1049 of_unregister_platform_driver(&of_platform_mb862xxfb_driver);
1050#endif
1051#if defined(CONFIG_FB_MB862XX_PCI_GDC)
1052 pci_unregister_driver(&mb862xxfb_pci_driver);
1053#endif
1054}
1055
1056module_init(mb862xxfb_init);
1057module_exit(mb862xxfb_exit);
1058
1059MODULE_DESCRIPTION("Fujitsu MB862xx Framebuffer driver");
1060MODULE_AUTHOR("Anatolij Gustschin <agust@denx.de>");
1061MODULE_LICENSE("GPL v2");
diff --git a/drivers/video/mb862xx/mb862xxfb.h b/drivers/video/mb862xx/mb862xxfb.h
new file mode 100644
index 000000000000..c4c8f4dd2217
--- /dev/null
+++ b/drivers/video/mb862xx/mb862xxfb.h
@@ -0,0 +1,83 @@
1#ifndef __MB862XX_H__
2#define __MB862XX_H__
3
4#define PCI_VENDOR_ID_FUJITSU_LIMITED 0x10cf
5#define PCI_DEVICE_ID_FUJITSU_CORALP 0x2019
6#define PCI_DEVICE_ID_FUJITSU_CORALPA 0x201e
7#define PCI_DEVICE_ID_FUJITSU_CARMINE 0x202b
8
9#define GC_MMR_CORALP_EVB_VAL 0x11d7fa13
10
11enum gdctype {
12 BT_NONE,
13 BT_LIME,
14 BT_MINT,
15 BT_CORAL,
16 BT_CORALP,
17 BT_CARMINE,
18};
19
20struct mb862xx_gc_mode {
21 struct fb_videomode def_mode; /* mode of connected display */
22 unsigned int def_bpp; /* default depth */
23 unsigned long max_vram; /* connected SDRAM size */
24 unsigned long ccf; /* gdc clk */
25 unsigned long mmr; /* memory mode for SDRAM */
26};
27
28/* private data */
29struct mb862xxfb_par {
30 struct fb_info *info; /* fb info head */
31 struct device *dev;
32 struct pci_dev *pdev;
33 struct resource *res; /* framebuffer/mmio resource */
34
35 resource_size_t fb_base_phys; /* fb base, 36-bit PPC440EPx */
36 resource_size_t mmio_base_phys; /* io base addr */
37 void __iomem *fb_base; /* remapped framebuffer */
38 void __iomem *mmio_base; /* remapped registers */
39 size_t mapped_vram; /* length of remapped vram */
40 size_t mmio_len; /* length of register region */
41
42 void __iomem *host; /* relocatable reg. bases */
43 void __iomem *i2c;
44 void __iomem *disp;
45 void __iomem *disp1;
46 void __iomem *cap;
47 void __iomem *cap1;
48 void __iomem *draw;
49 void __iomem *geo;
50 void __iomem *pio;
51 void __iomem *ctrl;
52 void __iomem *dram_ctrl;
53 void __iomem *wrback;
54
55 unsigned int irq;
56 unsigned int type; /* GDC type */
57 unsigned int refclk; /* disp. reference clock */
58 struct mb862xx_gc_mode *gc_mode; /* GDC mode init data */
59 int pre_init; /* don't init display if 1 */
60
61 u32 pseudo_palette[16];
62};
63
64#if defined(CONFIG_FB_MB862XX_LIME) && defined(CONFIG_FB_MB862XX_PCI_GDC)
65#error "Select Lime GDC or CoralP/Carmine support, but not both together"
66#endif
67#if defined(CONFIG_FB_MB862XX_LIME)
68#define gdc_read __raw_readl
69#define gdc_write __raw_writel
70#else
71#define gdc_read readl
72#define gdc_write writel
73#endif
74
75#define inreg(type, off) \
76 gdc_read((par->type + (off)))
77
78#define outreg(type, off, val) \
79 gdc_write((val), (par->type + (off)))
80
81#define pack(a, b) (((a) << 16) | (b))
82
83#endif
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 1a22fe782a27..4fd3fa5546b1 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -67,11 +67,11 @@ config AT91RM9200_WATCHDOG
67 system when the timeout is reached. 67 system when the timeout is reached.
68 68
69config AT91SAM9X_WATCHDOG 69config AT91SAM9X_WATCHDOG
70 tristate "AT91SAM9X watchdog" 70 tristate "AT91SAM9X / AT91CAP9 watchdog"
71 depends on WATCHDOG && (ARCH_AT91SAM9260 || ARCH_AT91SAM9261) 71 depends on ARCH_AT91 && !ARCH_AT91RM9200
72 help 72 help
73 Watchdog timer embedded into AT91SAM9X chips. This will reboot your 73 Watchdog timer embedded into AT91SAM9X and AT91CAP9 chips. This will
74 system when the timeout is reached. 74 reboot your system when the timeout is reached.
75 75
76config 21285_WATCHDOG 76config 21285_WATCHDOG
77 tristate "DC21285 watchdog" 77 tristate "DC21285 watchdog"
diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
index b4babfc31586..b1da287f90ec 100644
--- a/drivers/watchdog/at91sam9_wdt.c
+++ b/drivers/watchdog/at91sam9_wdt.c
@@ -30,7 +30,7 @@
30#include <linux/bitops.h> 30#include <linux/bitops.h>
31#include <linux/uaccess.h> 31#include <linux/uaccess.h>
32 32
33#include <asm/arch/at91_wdt.h> 33#include <mach/at91_wdt.h>
34 34
35#define DRV_NAME "AT91SAM9 Watchdog" 35#define DRV_NAME "AT91SAM9 Watchdog"
36 36
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 8c83abc73400..a0fb5eac407c 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -41,7 +41,6 @@
41#include <linux/pagemap.h> 41#include <linux/pagemap.h>
42#include <linux/highmem.h> 42#include <linux/highmem.h>
43#include <linux/mutex.h> 43#include <linux/mutex.h>
44#include <linux/highmem.h>
45#include <linux/list.h> 44#include <linux/list.h>
46#include <linux/sysdev.h> 45#include <linux/sysdev.h>
47 46