aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-16 14:53:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-16 14:53:32 -0400
commitd19d5efd8c8840aa4f38a6dfbfe500d8cc27de46 (patch)
tree2e2f4f57de790c7de2ccd6d1afbec8695b2c7a46 /drivers
parent34c9a0ffc75ad25b6a60f61e27c4a4b1189b8085 (diff)
parent2fe0753d49402aee325cc39c476b46fd51a8afec (diff)
Merge tag 'powerpc-4.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux
Pull powerpc updates from Michael Ellerman: - Numerous minor fixes, cleanups etc. - More EEH work from Gavin to remove its dependency on device_nodes. - Memory hotplug implemented entirely in the kernel from Nathan Fontenot. - Removal of redundant CONFIG_PPC_OF by Kevin Hao. - Rewrite of VPHN parsing logic & tests from Greg Kurz. - A fix from Nish Aravamudan to reduce memory usage by clamping nodes_possible_map. - Support for pstore on powernv from Hari Bathini. - Removal of old powerpc specific byte swap routines by David Gibson. - Fix from Vasant Hegde to prevent the flash driver telling you it was flashing your firmware when it wasn't. - Patch from Ben Herrenschmidt to add an OPAL heartbeat driver. - Fix for an oops causing get/put_cpu_var() imbalance in perf by Jan Stancek. - Some fixes for migration from Tyrel Datwyler. - A new syscall to switch the cpu endian by Michael Ellerman. - Large series from Wei Yang to implement SRIOV, reviewed and acked by Bjorn. - A fix for the OPAL sensor driver from Cédric Le Goater. - Fixes to get STRICT_MM_TYPECHECKS building again by Michael Ellerman. - Large series from Daniel Axtens to make our PCI hooks per PHB rather than per machine. - Small patch from Sam Bobroff to explicitly abort non-suspended transactions on syscalls, plus a test to exercise it. - Numerous reworks and fixes for the 24x7 PMU from Sukadev Bhattiprolu. - Small patch to enable the hard lockup detector from Anton Blanchard. - Fix from Dave Olson for missing L2 cache information on some CPUs. - Some fixes from Michael Ellerman to get Cell machines booting again. - Freescale updates from Scott: Highlights include BMan device tree nodes, an MSI erratum workaround, a couple minor performance improvements, config updates, and misc fixes/cleanup. * tag 'powerpc-4.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux: (196 commits) powerpc/powermac: Fix build error seen with powermac smp builds powerpc/pseries: Fix compile of memory hotplug without CONFIG_MEMORY_HOTREMOVE powerpc: Remove PPC32 code from pseries specific find_and_init_phbs() powerpc/cell: Fix iommu breakage caused by controller_ops change powerpc/eeh: Fix crash in eeh_add_device_early() on Cell powerpc/perf: Cap 64bit userspace backtraces to PERF_MAX_STACK_DEPTH powerpc/perf/hv-24x7: Fail 24x7 initcall if create_events_from_catalog() fails powerpc/pseries: Correct memory hotplug locking powerpc: Fix missing L2 cache size in /sys/devices/system/cpu powerpc: Add ppc64 hard lockup detector support oprofile: Disable oprofile NMI timer on ppc64 powerpc/perf/hv-24x7: Add missing put_cpu_var() powerpc/perf/hv-24x7: Break up single_24x7_request powerpc/perf/hv-24x7: Define update_event_count() powerpc/perf/hv-24x7: Whitespace cleanup powerpc/perf/hv-24x7: Define add_event_to_24x7_request() powerpc/perf/hv-24x7: Rename hv_24x7_event_update powerpc/perf/hv-24x7: Move debug prints to separate function powerpc/perf/hv-24x7: Drop event_24x7_request() powerpc/perf/hv-24x7: Use pr_devel() to log message ... Conflicts: tools/testing/selftests/powerpc/Makefile tools/testing/selftests/powerpc/tm/Makefile
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/pata_macio.c10
-rw-r--r--drivers/ata/sata_svw.c11
-rw-r--r--drivers/block/swim3.c12
-rw-r--r--drivers/ide/pmac.c10
-rw-r--r--drivers/macintosh/rack-meter.c30
-rw-r--r--drivers/macintosh/smu.c3
-rw-r--r--drivers/macintosh/via-pmu.c25
-rw-r--r--drivers/media/pci/bt8xx/bt878.c12
-rw-r--r--drivers/media/pci/bt8xx/bt878.h11
-rw-r--r--drivers/mmc/host/mxcmmc.c2
-rw-r--r--drivers/net/ethernet/apple/bmac.c30
-rw-r--r--drivers/net/ethernet/apple/mace.c44
-rw-r--r--drivers/net/ethernet/ibm/emac/core.c12
-rw-r--r--drivers/net/ethernet/sfc/efx.c4
-rw-r--r--drivers/net/ethernet/sfc/siena.c3
-rw-r--r--drivers/pci/hotplug/rpadlpar_core.c2
-rw-r--r--drivers/pci/iov.c155
-rw-r--r--drivers/pci/pci.h2
-rw-r--r--drivers/pci/setup-bus.c95
-rw-r--r--drivers/ps3/ps3-lpm.c4
-rw-r--r--drivers/scsi/mac53c94.c10
-rw-r--r--drivers/scsi/mesh.c14
-rw-r--r--drivers/video/fbdev/Kconfig4
-rw-r--r--drivers/video/fbdev/aty/aty128fb.c4
-rw-r--r--drivers/video/fbdev/aty/radeon_base.c24
-rw-r--r--drivers/video/fbdev/aty/radeon_monitor.c20
-rw-r--r--drivers/video/fbdev/aty/radeon_pm.c16
-rw-r--r--drivers/video/fbdev/aty/radeonfb.h4
-rw-r--r--drivers/video/fbdev/controlfb.c2
-rw-r--r--drivers/video/fbdev/core/fbmon.c4
-rw-r--r--drivers/video/fbdev/imsttfb.c6
-rw-r--r--drivers/video/fbdev/nvidia/Makefile3
-rw-r--r--drivers/video/fbdev/nvidia/nv_of.c3
-rw-r--r--drivers/video/fbdev/nvidia/nv_proto.h8
-rw-r--r--drivers/video/fbdev/nvidia/nvidia.c4
-rw-r--r--drivers/video/fbdev/platinumfb.c2
-rw-r--r--drivers/video/fbdev/riva/fbdev.c17
37 files changed, 346 insertions, 276 deletions
diff --git a/drivers/ata/pata_macio.c b/drivers/ata/pata_macio.c
index a02f76fdcfcd..b0028588ff1c 100644
--- a/drivers/ata/pata_macio.c
+++ b/drivers/ata/pata_macio.c
@@ -540,9 +540,9 @@ static void pata_macio_qc_prep(struct ata_queued_cmd *qc)
540 BUG_ON (pi++ >= MAX_DCMDS); 540 BUG_ON (pi++ >= MAX_DCMDS);
541 541
542 len = (sg_len < MAX_DBDMA_SEG) ? sg_len : MAX_DBDMA_SEG; 542 len = (sg_len < MAX_DBDMA_SEG) ? sg_len : MAX_DBDMA_SEG;
543 st_le16(&table->command, write ? OUTPUT_MORE: INPUT_MORE); 543 table->command = cpu_to_le16(write ? OUTPUT_MORE: INPUT_MORE);
544 st_le16(&table->req_count, len); 544 table->req_count = cpu_to_le16(len);
545 st_le32(&table->phy_addr, addr); 545 table->phy_addr = cpu_to_le32(addr);
546 table->cmd_dep = 0; 546 table->cmd_dep = 0;
547 table->xfer_status = 0; 547 table->xfer_status = 0;
548 table->res_count = 0; 548 table->res_count = 0;
@@ -557,12 +557,12 @@ static void pata_macio_qc_prep(struct ata_queued_cmd *qc)
557 557
558 /* Convert the last command to an input/output */ 558 /* Convert the last command to an input/output */
559 table--; 559 table--;
560 st_le16(&table->command, write ? OUTPUT_LAST: INPUT_LAST); 560 table->command = cpu_to_le16(write ? OUTPUT_LAST: INPUT_LAST);
561 table++; 561 table++;
562 562
563 /* Add the stop command to the end of the list */ 563 /* Add the stop command to the end of the list */
564 memset(table, 0, sizeof(struct dbdma_cmd)); 564 memset(table, 0, sizeof(struct dbdma_cmd));
565 st_le16(&table->command, DBDMA_STOP); 565 table->command = cpu_to_le16(DBDMA_STOP);
566 566
567 dev_dbgdma(priv->dev, "%s: %d DMA list entries\n", __func__, pi); 567 dev_dbgdma(priv->dev, "%s: %d DMA list entries\n", __func__, pi);
568} 568}
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
index ff8307b30ff0..ff614be55d0f 100644
--- a/drivers/ata/sata_svw.c
+++ b/drivers/ata/sata_svw.c
@@ -47,11 +47,7 @@
47#include <scsi/scsi_cmnd.h> 47#include <scsi/scsi_cmnd.h>
48#include <scsi/scsi.h> 48#include <scsi/scsi.h>
49#include <linux/libata.h> 49#include <linux/libata.h>
50 50#include <linux/of.h>
51#ifdef CONFIG_PPC_OF
52#include <asm/prom.h>
53#include <asm/pci-bridge.h>
54#endif /* CONFIG_PPC_OF */
55 51
56#define DRV_NAME "sata_svw" 52#define DRV_NAME "sata_svw"
57#define DRV_VERSION "2.3" 53#define DRV_VERSION "2.3"
@@ -320,7 +316,6 @@ static u8 k2_stat_check_status(struct ata_port *ap)
320 return readl(ap->ioaddr.status_addr); 316 return readl(ap->ioaddr.status_addr);
321} 317}
322 318
323#ifdef CONFIG_PPC_OF
324static int k2_sata_show_info(struct seq_file *m, struct Scsi_Host *shost) 319static int k2_sata_show_info(struct seq_file *m, struct Scsi_Host *shost)
325{ 320{
326 struct ata_port *ap; 321 struct ata_port *ap;
@@ -350,14 +345,10 @@ static int k2_sata_show_info(struct seq_file *m, struct Scsi_Host *shost)
350 } 345 }
351 return 0; 346 return 0;
352} 347}
353#endif /* CONFIG_PPC_OF */
354
355 348
356static struct scsi_host_template k2_sata_sht = { 349static struct scsi_host_template k2_sata_sht = {
357 ATA_BMDMA_SHT(DRV_NAME), 350 ATA_BMDMA_SHT(DRV_NAME),
358#ifdef CONFIG_PPC_OF
359 .show_info = k2_sata_show_info, 351 .show_info = k2_sata_show_info,
360#endif
361}; 352};
362 353
363 354
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index 523ee8fd4c15..c264f2d284a7 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -440,9 +440,9 @@ static inline void seek_track(struct floppy_state *fs, int n)
440static inline void init_dma(struct dbdma_cmd *cp, int cmd, 440static inline void init_dma(struct dbdma_cmd *cp, int cmd,
441 void *buf, int count) 441 void *buf, int count)
442{ 442{
443 st_le16(&cp->req_count, count); 443 cp->req_count = cpu_to_le16(count);
444 st_le16(&cp->command, cmd); 444 cp->command = cpu_to_le16(cmd);
445 st_le32(&cp->phy_addr, virt_to_bus(buf)); 445 cp->phy_addr = cpu_to_le32(virt_to_bus(buf));
446 cp->xfer_status = 0; 446 cp->xfer_status = 0;
447} 447}
448 448
@@ -771,8 +771,8 @@ static irqreturn_t swim3_interrupt(int irq, void *dev_id)
771 } 771 }
772 /* turn off DMA */ 772 /* turn off DMA */
773 out_le32(&dr->control, (RUN | PAUSE) << 16); 773 out_le32(&dr->control, (RUN | PAUSE) << 16);
774 stat = ld_le16(&cp->xfer_status); 774 stat = le16_to_cpu(cp->xfer_status);
775 resid = ld_le16(&cp->res_count); 775 resid = le16_to_cpu(cp->res_count);
776 if (intr & ERROR_INTR) { 776 if (intr & ERROR_INTR) {
777 n = fs->scount - 1 - resid / 512; 777 n = fs->scount - 1 - resid / 512;
778 if (n > 0) { 778 if (n > 0) {
@@ -1170,7 +1170,7 @@ static int swim3_add_device(struct macio_dev *mdev, int index)
1170 1170
1171 fs->dma_cmd = (struct dbdma_cmd *) DBDMA_ALIGN(fs->dbdma_cmd_space); 1171 fs->dma_cmd = (struct dbdma_cmd *) DBDMA_ALIGN(fs->dbdma_cmd_space);
1172 memset(fs->dma_cmd, 0, 2 * sizeof(struct dbdma_cmd)); 1172 memset(fs->dma_cmd, 0, 2 * sizeof(struct dbdma_cmd));
1173 st_le16(&fs->dma_cmd[1].command, DBDMA_STOP); 1173 fs->dma_cmd[1].command = cpu_to_le16(DBDMA_STOP);
1174 1174
1175 if (mdev->media_bay == NULL || check_media_bay(mdev->media_bay) == MB_FD) 1175 if (mdev->media_bay == NULL || check_media_bay(mdev->media_bay) == MB_FD)
1176 swim3_mb_event(mdev, MB_FD); 1176 swim3_mb_event(mdev, MB_FD);
diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c
index 2db803cd095c..d24a3f8b49bc 100644
--- a/drivers/ide/pmac.c
+++ b/drivers/ide/pmac.c
@@ -1497,9 +1497,9 @@ static int pmac_ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
1497 drive->name); 1497 drive->name);
1498 return 0; 1498 return 0;
1499 } 1499 }
1500 st_le16(&table->command, wr? OUTPUT_MORE: INPUT_MORE); 1500 table->command = cpu_to_le16(wr? OUTPUT_MORE: INPUT_MORE);
1501 st_le16(&table->req_count, tc); 1501 table->req_count = cpu_to_le16(tc);
1502 st_le32(&table->phy_addr, cur_addr); 1502 table->phy_addr = cpu_to_le32(cur_addr);
1503 table->cmd_dep = 0; 1503 table->cmd_dep = 0;
1504 table->xfer_status = 0; 1504 table->xfer_status = 0;
1505 table->res_count = 0; 1505 table->res_count = 0;
@@ -1513,10 +1513,10 @@ static int pmac_ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
1513 1513
1514 /* convert the last command to an input/output last command */ 1514 /* convert the last command to an input/output last command */
1515 if (count) { 1515 if (count) {
1516 st_le16(&table[-1].command, wr? OUTPUT_LAST: INPUT_LAST); 1516 table[-1].command = cpu_to_le16(wr? OUTPUT_LAST: INPUT_LAST);
1517 /* add the stop command to the end of the list */ 1517 /* add the stop command to the end of the list */
1518 memset(table, 0, sizeof(struct dbdma_cmd)); 1518 memset(table, 0, sizeof(struct dbdma_cmd));
1519 st_le16(&table->command, DBDMA_STOP); 1519 table->command = cpu_to_le16(DBDMA_STOP);
1520 mb(); 1520 mb();
1521 writel(hwif->dmatable_dma, &dma->cmdptr); 1521 writel(hwif->dmatable_dma, &dma->cmdptr);
1522 return 1; 1522 return 1;
diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c
index 4192901cab40..048901a1111a 100644
--- a/drivers/macintosh/rack-meter.c
+++ b/drivers/macintosh/rack-meter.c
@@ -182,31 +182,31 @@ static void rackmeter_setup_dbdma(struct rackmeter *rm)
182 182
183 /* Prepare 4 dbdma commands for the 2 buffers */ 183 /* Prepare 4 dbdma commands for the 2 buffers */
184 memset(cmd, 0, 4 * sizeof(struct dbdma_cmd)); 184 memset(cmd, 0, 4 * sizeof(struct dbdma_cmd));
185 st_le16(&cmd->req_count, 4); 185 cmd->req_count = cpu_to_le16(4);
186 st_le16(&cmd->command, STORE_WORD | INTR_ALWAYS | KEY_SYSTEM); 186 cmd->command = cpu_to_le16(STORE_WORD | INTR_ALWAYS | KEY_SYSTEM);
187 st_le32(&cmd->phy_addr, rm->dma_buf_p + 187 cmd->phy_addr = cpu_to_le32(rm->dma_buf_p +
188 offsetof(struct rackmeter_dma, mark)); 188 offsetof(struct rackmeter_dma, mark));
189 st_le32(&cmd->cmd_dep, 0x02000000); 189 cmd->cmd_dep = cpu_to_le32(0x02000000);
190 cmd++; 190 cmd++;
191 191
192 st_le16(&cmd->req_count, SAMPLE_COUNT * 4); 192 cmd->req_count = cpu_to_le16(SAMPLE_COUNT * 4);
193 st_le16(&cmd->command, OUTPUT_MORE); 193 cmd->command = cpu_to_le16(OUTPUT_MORE);
194 st_le32(&cmd->phy_addr, rm->dma_buf_p + 194 cmd->phy_addr = cpu_to_le32(rm->dma_buf_p +
195 offsetof(struct rackmeter_dma, buf1)); 195 offsetof(struct rackmeter_dma, buf1));
196 cmd++; 196 cmd++;
197 197
198 st_le16(&cmd->req_count, 4); 198 cmd->req_count = cpu_to_le16(4);
199 st_le16(&cmd->command, STORE_WORD | INTR_ALWAYS | KEY_SYSTEM); 199 cmd->command = cpu_to_le16(STORE_WORD | INTR_ALWAYS | KEY_SYSTEM);
200 st_le32(&cmd->phy_addr, rm->dma_buf_p + 200 cmd->phy_addr = cpu_to_le32(rm->dma_buf_p +
201 offsetof(struct rackmeter_dma, mark)); 201 offsetof(struct rackmeter_dma, mark));
202 st_le32(&cmd->cmd_dep, 0x01000000); 202 cmd->cmd_dep = cpu_to_le32(0x01000000);
203 cmd++; 203 cmd++;
204 204
205 st_le16(&cmd->req_count, SAMPLE_COUNT * 4); 205 cmd->req_count = cpu_to_le16(SAMPLE_COUNT * 4);
206 st_le16(&cmd->command, OUTPUT_MORE | BR_ALWAYS); 206 cmd->command = cpu_to_le16(OUTPUT_MORE | BR_ALWAYS);
207 st_le32(&cmd->phy_addr, rm->dma_buf_p + 207 cmd->phy_addr = cpu_to_le32(rm->dma_buf_p +
208 offsetof(struct rackmeter_dma, buf2)); 208 offsetof(struct rackmeter_dma, buf2));
209 st_le32(&cmd->cmd_dep, rm->dma_buf_p); 209 cmd->cmd_dep = cpu_to_le32(rm->dma_buf_p);
210 210
211 rackmeter_do_pause(rm, 0); 211 rackmeter_do_pause(rm, 0);
212} 212}
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 10ae69bcbbd2..d531f804455d 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -557,8 +557,7 @@ int __init smu_init (void)
557 return 0; 557 return 0;
558 558
559fail_msg_node: 559fail_msg_node:
560 if (smu->msg_node) 560 of_node_put(smu->msg_node);
561 of_node_put(smu->msg_node);
562fail_db_node: 561fail_db_node:
563 of_node_put(smu->db_node); 562 of_node_put(smu->db_node);
564fail_bootmem: 563fail_bootmem:
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index dee88e59f0d3..f9512bfa6c3c 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -329,10 +329,11 @@ int __init find_via_pmu(void)
329 gaddr = of_translate_address(gpiop, reg); 329 gaddr = of_translate_address(gpiop, reg);
330 if (gaddr != OF_BAD_ADDR) 330 if (gaddr != OF_BAD_ADDR)
331 gpio_reg = ioremap(gaddr, 0x10); 331 gpio_reg = ioremap(gaddr, 0x10);
332 of_node_put(gpiop);
332 } 333 }
333 if (gpio_reg == NULL) { 334 if (gpio_reg == NULL) {
334 printk(KERN_ERR "via-pmu: Can't find GPIO reg !\n"); 335 printk(KERN_ERR "via-pmu: Can't find GPIO reg !\n");
335 goto fail_gpio; 336 goto fail;
336 } 337 }
337 } else 338 } else
338 pmu_kind = PMU_UNKNOWN; 339 pmu_kind = PMU_UNKNOWN;
@@ -340,7 +341,7 @@ int __init find_via_pmu(void)
340 via = ioremap(taddr, 0x2000); 341 via = ioremap(taddr, 0x2000);
341 if (via == NULL) { 342 if (via == NULL) {
342 printk(KERN_ERR "via-pmu: Can't map address !\n"); 343 printk(KERN_ERR "via-pmu: Can't map address !\n");
343 goto fail; 344 goto fail_via_remap;
344 } 345 }
345 346
346 out_8(&via[IER], IER_CLR | 0x7f); /* disable all intrs */ 347 out_8(&via[IER], IER_CLR | 0x7f); /* disable all intrs */
@@ -348,10 +349,8 @@ int __init find_via_pmu(void)
348 349
349 pmu_state = idle; 350 pmu_state = idle;
350 351
351 if (!init_pmu()) { 352 if (!init_pmu())
352 via = NULL; 353 goto fail_init;
353 return 0;
354 }
355 354
356 printk(KERN_INFO "PMU driver v%d initialized for %s, firmware: %02x\n", 355 printk(KERN_INFO "PMU driver v%d initialized for %s, firmware: %02x\n",
357 PMU_DRIVER_VERSION, pbook_type[pmu_kind], pmu_version); 356 PMU_DRIVER_VERSION, pbook_type[pmu_kind], pmu_version);
@@ -359,11 +358,15 @@ int __init find_via_pmu(void)
359 sys_ctrler = SYS_CTRLER_PMU; 358 sys_ctrler = SYS_CTRLER_PMU;
360 359
361 return 1; 360 return 1;
362 fail: 361
363 of_node_put(vias); 362 fail_init:
363 iounmap(via);
364 via = NULL;
365 fail_via_remap:
364 iounmap(gpio_reg); 366 iounmap(gpio_reg);
365 gpio_reg = NULL; 367 gpio_reg = NULL;
366 fail_gpio: 368 fail:
369 of_node_put(vias);
367 vias = NULL; 370 vias = NULL;
368 return 0; 371 return 0;
369} 372}
@@ -2109,7 +2112,7 @@ pmu_read(struct file *file, char __user *buf,
2109 2112
2110 spin_lock_irqsave(&pp->lock, flags); 2113 spin_lock_irqsave(&pp->lock, flags);
2111 add_wait_queue(&pp->wait, &wait); 2114 add_wait_queue(&pp->wait, &wait);
2112 current->state = TASK_INTERRUPTIBLE; 2115 set_current_state(TASK_INTERRUPTIBLE);
2113 2116
2114 for (;;) { 2117 for (;;) {
2115 ret = -EAGAIN; 2118 ret = -EAGAIN;
@@ -2138,7 +2141,7 @@ pmu_read(struct file *file, char __user *buf,
2138 schedule(); 2141 schedule();
2139 spin_lock_irqsave(&pp->lock, flags); 2142 spin_lock_irqsave(&pp->lock, flags);
2140 } 2143 }
2141 current->state = TASK_RUNNING; 2144 __set_current_state(TASK_RUNNING);
2142 remove_wait_queue(&pp->wait, &wait); 2145 remove_wait_queue(&pp->wait, &wait);
2143 spin_unlock_irqrestore(&pp->lock, flags); 2146 spin_unlock_irqrestore(&pp->lock, flags);
2144 2147
diff --git a/drivers/media/pci/bt8xx/bt878.c b/drivers/media/pci/bt8xx/bt878.c
index 0939d399b774..8aa726651630 100644
--- a/drivers/media/pci/bt8xx/bt878.c
+++ b/drivers/media/pci/bt8xx/bt878.c
@@ -416,9 +416,6 @@ static int bt878_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)
416 int result = 0; 416 int result = 0;
417 unsigned char lat; 417 unsigned char lat;
418 struct bt878 *bt; 418 struct bt878 *bt;
419#if defined(__powerpc__)
420 unsigned int cmd;
421#endif
422 unsigned int cardid; 419 unsigned int cardid;
423 420
424 printk(KERN_INFO "bt878: Bt878 AUDIO function found (%d).\n", 421 printk(KERN_INFO "bt878: Bt878 AUDIO function found (%d).\n",
@@ -461,15 +458,6 @@ static int bt878_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)
461 printk("irq: %d, latency: %d, memory: 0x%lx\n", 458 printk("irq: %d, latency: %d, memory: 0x%lx\n",
462 bt->irq, lat, bt->bt878_adr); 459 bt->irq, lat, bt->bt878_adr);
463 460
464
465#if defined(__powerpc__)
466 /* on OpenFirmware machines (PowerMac at least), PCI memory cycle */
467 /* response on cards with no firmware is not enabled by OF */
468 pci_read_config_dword(dev, PCI_COMMAND, &cmd);
469 cmd = (cmd | PCI_COMMAND_MEMORY);
470 pci_write_config_dword(dev, PCI_COMMAND, cmd);
471#endif
472
473#ifdef __sparc__ 461#ifdef __sparc__
474 bt->bt878_mem = (unsigned char *) bt->bt878_adr; 462 bt->bt878_mem = (unsigned char *) bt->bt878_adr;
475#else 463#else
diff --git a/drivers/media/pci/bt8xx/bt878.h b/drivers/media/pci/bt8xx/bt878.h
index d19b59299d78..49af240b5894 100644
--- a/drivers/media/pci/bt8xx/bt878.h
+++ b/drivers/media/pci/bt8xx/bt878.h
@@ -142,18 +142,7 @@ void bt878_start(struct bt878 *bt, u32 controlreg, u32 op_sync_orin,
142 u32 irq_err_ignore); 142 u32 irq_err_ignore);
143void bt878_stop(struct bt878 *bt); 143void bt878_stop(struct bt878 *bt);
144 144
145#if defined(__powerpc__) /* big-endian */
146static inline void io_st_le32(volatile unsigned __iomem *addr, unsigned val)
147{
148 st_le32(addr, val);
149 eieio();
150}
151
152#define bmtwrite(dat,adr) io_st_le32((adr),(dat))
153#define bmtread(adr) ld_le32((adr))
154#else
155#define bmtwrite(dat,adr) writel((dat), (adr)) 145#define bmtwrite(dat,adr) writel((dat), (adr))
156#define bmtread(adr) readl(adr) 146#define bmtread(adr) readl(adr)
157#endif
158 147
159#endif 148#endif
diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index 5316d9b9e7b4..317d709f7550 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -281,7 +281,7 @@ static inline void buffer_swap32(u32 *buf, int len)
281 int i; 281 int i;
282 282
283 for (i = 0; i < ((len + 3) / 4); i++) { 283 for (i = 0; i < ((len + 3) / 4); i++) {
284 st_le32(buf, *buf); 284 *buf = swab32(*buf);
285 buf++; 285 buf++;
286 } 286 }
287} 287}
diff --git a/drivers/net/ethernet/apple/bmac.c b/drivers/net/ethernet/apple/bmac.c
index 2f98846e2d89..a65d7a60f116 100644
--- a/drivers/net/ethernet/apple/bmac.c
+++ b/drivers/net/ethernet/apple/bmac.c
@@ -483,8 +483,8 @@ static int bmac_suspend(struct macio_dev *mdev, pm_message_t state)
483 bmwrite(dev, TXCFG, (config & ~TxMACEnable)); 483 bmwrite(dev, TXCFG, (config & ~TxMACEnable));
484 bmwrite(dev, INTDISABLE, DisableAll); /* disable all intrs */ 484 bmwrite(dev, INTDISABLE, DisableAll); /* disable all intrs */
485 /* disable rx and tx dma */ 485 /* disable rx and tx dma */
486 st_le32(&rd->control, DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */ 486 rd->control = cpu_to_le32(DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */
487 st_le32(&td->control, DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */ 487 td->control = cpu_to_le32(DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */
488 /* free some skb's */ 488 /* free some skb's */
489 for (i=0; i<N_RX_RING; i++) { 489 for (i=0; i<N_RX_RING; i++) {
490 if (bp->rx_bufs[i] != NULL) { 490 if (bp->rx_bufs[i] != NULL) {
@@ -699,8 +699,8 @@ static irqreturn_t bmac_rxdma_intr(int irq, void *dev_id)
699 699
700 while (1) { 700 while (1) {
701 cp = &bp->rx_cmds[i]; 701 cp = &bp->rx_cmds[i];
702 stat = ld_le16(&cp->xfer_status); 702 stat = le16_to_cpu(cp->xfer_status);
703 residual = ld_le16(&cp->res_count); 703 residual = le16_to_cpu(cp->res_count);
704 if ((stat & ACTIVE) == 0) 704 if ((stat & ACTIVE) == 0)
705 break; 705 break;
706 nb = RX_BUFLEN - residual - 2; 706 nb = RX_BUFLEN - residual - 2;
@@ -728,8 +728,8 @@ static irqreturn_t bmac_rxdma_intr(int irq, void *dev_id)
728 skb_reserve(bp->rx_bufs[i], 2); 728 skb_reserve(bp->rx_bufs[i], 2);
729 } 729 }
730 bmac_construct_rxbuff(skb, &bp->rx_cmds[i]); 730 bmac_construct_rxbuff(skb, &bp->rx_cmds[i]);
731 st_le16(&cp->res_count, 0); 731 cp->res_count = cpu_to_le16(0);
732 st_le16(&cp->xfer_status, 0); 732 cp->xfer_status = cpu_to_le16(0);
733 last = i; 733 last = i;
734 if (++i >= N_RX_RING) i = 0; 734 if (++i >= N_RX_RING) i = 0;
735 } 735 }
@@ -769,7 +769,7 @@ static irqreturn_t bmac_txdma_intr(int irq, void *dev_id)
769 769
770 while (1) { 770 while (1) {
771 cp = &bp->tx_cmds[bp->tx_empty]; 771 cp = &bp->tx_cmds[bp->tx_empty];
772 stat = ld_le16(&cp->xfer_status); 772 stat = le16_to_cpu(cp->xfer_status);
773 if (txintcount < 10) { 773 if (txintcount < 10) {
774 XXDEBUG(("bmac_txdma_xfer_stat=%#0x\n", stat)); 774 XXDEBUG(("bmac_txdma_xfer_stat=%#0x\n", stat));
775 } 775 }
@@ -1411,8 +1411,8 @@ static int bmac_close(struct net_device *dev)
1411 bmwrite(dev, INTDISABLE, DisableAll); /* disable all intrs */ 1411 bmwrite(dev, INTDISABLE, DisableAll); /* disable all intrs */
1412 1412
1413 /* disable rx and tx dma */ 1413 /* disable rx and tx dma */
1414 st_le32(&rd->control, DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */ 1414 rd->control = cpu_to_le32(DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */
1415 st_le32(&td->control, DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */ 1415 td->control = cpu_to_le32(DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */
1416 1416
1417 /* free some skb's */ 1417 /* free some skb's */
1418 XXDEBUG(("bmac: free rx bufs\n")); 1418 XXDEBUG(("bmac: free rx bufs\n"));
@@ -1493,7 +1493,7 @@ static void bmac_tx_timeout(unsigned long data)
1493 1493
1494 cp = &bp->tx_cmds[bp->tx_empty]; 1494 cp = &bp->tx_cmds[bp->tx_empty];
1495/* XXDEBUG((KERN_DEBUG "bmac: tx dmastat=%x %x runt=%d pr=%x fs=%x fc=%x\n", */ 1495/* XXDEBUG((KERN_DEBUG "bmac: tx dmastat=%x %x runt=%d pr=%x fs=%x fc=%x\n", */
1496/* ld_le32(&td->status), ld_le16(&cp->xfer_status), bp->tx_bad_runt, */ 1496/* le32_to_cpu(td->status), le16_to_cpu(cp->xfer_status), bp->tx_bad_runt, */
1497/* mb->pr, mb->xmtfs, mb->fifofc)); */ 1497/* mb->pr, mb->xmtfs, mb->fifofc)); */
1498 1498
1499 /* turn off both tx and rx and reset the chip */ 1499 /* turn off both tx and rx and reset the chip */
@@ -1506,7 +1506,7 @@ static void bmac_tx_timeout(unsigned long data)
1506 bmac_enable_and_reset_chip(dev); 1506 bmac_enable_and_reset_chip(dev);
1507 1507
1508 /* restart rx dma */ 1508 /* restart rx dma */
1509 cp = bus_to_virt(ld_le32(&rd->cmdptr)); 1509 cp = bus_to_virt(le32_to_cpu(rd->cmdptr));
1510 out_le32(&rd->control, DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE|ACTIVE|DEAD)); 1510 out_le32(&rd->control, DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE|ACTIVE|DEAD));
1511 out_le16(&cp->xfer_status, 0); 1511 out_le16(&cp->xfer_status, 0);
1512 out_le32(&rd->cmdptr, virt_to_bus(cp)); 1512 out_le32(&rd->cmdptr, virt_to_bus(cp));
@@ -1553,10 +1553,10 @@ static void dump_dbdma(volatile struct dbdma_cmd *cp,int count)
1553 ip = (int*)(cp+i); 1553 ip = (int*)(cp+i);
1554 1554
1555 printk("dbdma req 0x%x addr 0x%x baddr 0x%x xfer/res 0x%x\n", 1555 printk("dbdma req 0x%x addr 0x%x baddr 0x%x xfer/res 0x%x\n",
1556 ld_le32(ip+0), 1556 le32_to_cpup(ip+0),
1557 ld_le32(ip+1), 1557 le32_to_cpup(ip+1),
1558 ld_le32(ip+2), 1558 le32_to_cpup(ip+2),
1559 ld_le32(ip+3)); 1559 le32_to_cpup(ip+3));
1560 } 1560 }
1561 1561
1562} 1562}
diff --git a/drivers/net/ethernet/apple/mace.c b/drivers/net/ethernet/apple/mace.c
index a18948286682..e58a7c73766e 100644
--- a/drivers/net/ethernet/apple/mace.c
+++ b/drivers/net/ethernet/apple/mace.c
@@ -310,7 +310,7 @@ static void dbdma_reset(volatile struct dbdma_regs __iomem *dma)
310 * way on some machines. 310 * way on some machines.
311 */ 311 */
312 for (i = 200; i > 0; --i) 312 for (i = 200; i > 0; --i)
313 if (ld_le32(&dma->control) & RUN) 313 if (le32_to_cpu(dma->control) & RUN)
314 udelay(1); 314 udelay(1);
315} 315}
316 316
@@ -452,21 +452,21 @@ static int mace_open(struct net_device *dev)
452 data = skb->data; 452 data = skb->data;
453 } 453 }
454 mp->rx_bufs[i] = skb; 454 mp->rx_bufs[i] = skb;
455 st_le16(&cp->req_count, RX_BUFLEN); 455 cp->req_count = cpu_to_le16(RX_BUFLEN);
456 st_le16(&cp->command, INPUT_LAST + INTR_ALWAYS); 456 cp->command = cpu_to_le16(INPUT_LAST + INTR_ALWAYS);
457 st_le32(&cp->phy_addr, virt_to_bus(data)); 457 cp->phy_addr = cpu_to_le32(virt_to_bus(data));
458 cp->xfer_status = 0; 458 cp->xfer_status = 0;
459 ++cp; 459 ++cp;
460 } 460 }
461 mp->rx_bufs[i] = NULL; 461 mp->rx_bufs[i] = NULL;
462 st_le16(&cp->command, DBDMA_STOP); 462 cp->command = cpu_to_le16(DBDMA_STOP);
463 mp->rx_fill = i; 463 mp->rx_fill = i;
464 mp->rx_empty = 0; 464 mp->rx_empty = 0;
465 465
466 /* Put a branch back to the beginning of the receive command list */ 466 /* Put a branch back to the beginning of the receive command list */
467 ++cp; 467 ++cp;
468 st_le16(&cp->command, DBDMA_NOP + BR_ALWAYS); 468 cp->command = cpu_to_le16(DBDMA_NOP + BR_ALWAYS);
469 st_le32(&cp->cmd_dep, virt_to_bus(mp->rx_cmds)); 469 cp->cmd_dep = cpu_to_le32(virt_to_bus(mp->rx_cmds));
470 470
471 /* start rx dma */ 471 /* start rx dma */
472 out_le32(&rd->control, (RUN|PAUSE|FLUSH|WAKE) << 16); /* clear run bit */ 472 out_le32(&rd->control, (RUN|PAUSE|FLUSH|WAKE) << 16); /* clear run bit */
@@ -475,8 +475,8 @@ static int mace_open(struct net_device *dev)
475 475
476 /* put a branch at the end of the tx command list */ 476 /* put a branch at the end of the tx command list */
477 cp = mp->tx_cmds + NCMDS_TX * N_TX_RING; 477 cp = mp->tx_cmds + NCMDS_TX * N_TX_RING;
478 st_le16(&cp->command, DBDMA_NOP + BR_ALWAYS); 478 cp->command = cpu_to_le16(DBDMA_NOP + BR_ALWAYS);
479 st_le32(&cp->cmd_dep, virt_to_bus(mp->tx_cmds)); 479 cp->cmd_dep = cpu_to_le32(virt_to_bus(mp->tx_cmds));
480 480
481 /* reset tx dma */ 481 /* reset tx dma */
482 out_le32(&td->control, (RUN|PAUSE|FLUSH|WAKE) << 16); 482 out_le32(&td->control, (RUN|PAUSE|FLUSH|WAKE) << 16);
@@ -507,8 +507,8 @@ static int mace_close(struct net_device *dev)
507 out_8(&mb->imr, 0xff); /* disable all intrs */ 507 out_8(&mb->imr, 0xff); /* disable all intrs */
508 508
509 /* disable rx and tx dma */ 509 /* disable rx and tx dma */
510 st_le32(&rd->control, (RUN|PAUSE|FLUSH|WAKE) << 16); /* clear run bit */ 510 rd->control = cpu_to_le32((RUN|PAUSE|FLUSH|WAKE) << 16); /* clear run bit */
511 st_le32(&td->control, (RUN|PAUSE|FLUSH|WAKE) << 16); /* clear run bit */ 511 td->control = cpu_to_le32((RUN|PAUSE|FLUSH|WAKE) << 16); /* clear run bit */
512 512
513 mace_clean_rings(mp); 513 mace_clean_rings(mp);
514 514
@@ -558,8 +558,8 @@ static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev)
558 } 558 }
559 mp->tx_bufs[fill] = skb; 559 mp->tx_bufs[fill] = skb;
560 cp = mp->tx_cmds + NCMDS_TX * fill; 560 cp = mp->tx_cmds + NCMDS_TX * fill;
561 st_le16(&cp->req_count, len); 561 cp->req_count = cpu_to_le16(len);
562 st_le32(&cp->phy_addr, virt_to_bus(skb->data)); 562 cp->phy_addr = cpu_to_le32(virt_to_bus(skb->data));
563 563
564 np = mp->tx_cmds + NCMDS_TX * next; 564 np = mp->tx_cmds + NCMDS_TX * next;
565 out_le16(&np->command, DBDMA_STOP); 565 out_le16(&np->command, DBDMA_STOP);
@@ -691,7 +691,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id)
691 out_8(&mb->xmtfc, AUTO_PAD_XMIT); 691 out_8(&mb->xmtfc, AUTO_PAD_XMIT);
692 continue; 692 continue;
693 } 693 }
694 dstat = ld_le32(&td->status); 694 dstat = le32_to_cpu(td->status);
695 /* stop DMA controller */ 695 /* stop DMA controller */
696 out_le32(&td->control, RUN << 16); 696 out_le32(&td->control, RUN << 16);
697 /* 697 /*
@@ -724,7 +724,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id)
724 */ 724 */
725 } 725 }
726 cp = mp->tx_cmds + NCMDS_TX * i; 726 cp = mp->tx_cmds + NCMDS_TX * i;
727 stat = ld_le16(&cp->xfer_status); 727 stat = le16_to_cpu(cp->xfer_status);
728 if ((fs & (UFLO|LCOL|LCAR|RTRY)) || (dstat & DEAD) || xcount == 0) { 728 if ((fs & (UFLO|LCOL|LCAR|RTRY)) || (dstat & DEAD) || xcount == 0) {
729 /* 729 /*
730 * Check whether there were in fact 2 bytes written to 730 * Check whether there were in fact 2 bytes written to
@@ -830,7 +830,7 @@ static void mace_tx_timeout(unsigned long data)
830 mace_reset(dev); 830 mace_reset(dev);
831 831
832 /* restart rx dma */ 832 /* restart rx dma */
833 cp = bus_to_virt(ld_le32(&rd->cmdptr)); 833 cp = bus_to_virt(le32_to_cpu(rd->cmdptr));
834 dbdma_reset(rd); 834 dbdma_reset(rd);
835 out_le16(&cp->xfer_status, 0); 835 out_le16(&cp->xfer_status, 0);
836 out_le32(&rd->cmdptr, virt_to_bus(cp)); 836 out_le32(&rd->cmdptr, virt_to_bus(cp));
@@ -889,20 +889,20 @@ static irqreturn_t mace_rxdma_intr(int irq, void *dev_id)
889 spin_lock_irqsave(&mp->lock, flags); 889 spin_lock_irqsave(&mp->lock, flags);
890 for (i = mp->rx_empty; i != mp->rx_fill; ) { 890 for (i = mp->rx_empty; i != mp->rx_fill; ) {
891 cp = mp->rx_cmds + i; 891 cp = mp->rx_cmds + i;
892 stat = ld_le16(&cp->xfer_status); 892 stat = le16_to_cpu(cp->xfer_status);
893 if ((stat & ACTIVE) == 0) { 893 if ((stat & ACTIVE) == 0) {
894 next = i + 1; 894 next = i + 1;
895 if (next >= N_RX_RING) 895 if (next >= N_RX_RING)
896 next = 0; 896 next = 0;
897 np = mp->rx_cmds + next; 897 np = mp->rx_cmds + next;
898 if (next != mp->rx_fill && 898 if (next != mp->rx_fill &&
899 (ld_le16(&np->xfer_status) & ACTIVE) != 0) { 899 (le16_to_cpu(np->xfer_status) & ACTIVE) != 0) {
900 printk(KERN_DEBUG "mace: lost a status word\n"); 900 printk(KERN_DEBUG "mace: lost a status word\n");
901 ++mace_lost_status; 901 ++mace_lost_status;
902 } else 902 } else
903 break; 903 break;
904 } 904 }
905 nb = ld_le16(&cp->req_count) - ld_le16(&cp->res_count); 905 nb = le16_to_cpu(cp->req_count) - le16_to_cpu(cp->res_count);
906 out_le16(&cp->command, DBDMA_STOP); 906 out_le16(&cp->command, DBDMA_STOP);
907 /* got a packet, have a look at it */ 907 /* got a packet, have a look at it */
908 skb = mp->rx_bufs[i]; 908 skb = mp->rx_bufs[i];
@@ -962,13 +962,13 @@ static irqreturn_t mace_rxdma_intr(int irq, void *dev_id)
962 mp->rx_bufs[i] = skb; 962 mp->rx_bufs[i] = skb;
963 } 963 }
964 } 964 }
965 st_le16(&cp->req_count, RX_BUFLEN); 965 cp->req_count = cpu_to_le16(RX_BUFLEN);
966 data = skb? skb->data: dummy_buf; 966 data = skb? skb->data: dummy_buf;
967 st_le32(&cp->phy_addr, virt_to_bus(data)); 967 cp->phy_addr = cpu_to_le32(virt_to_bus(data));
968 out_le16(&cp->xfer_status, 0); 968 out_le16(&cp->xfer_status, 0);
969 out_le16(&cp->command, INPUT_LAST + INTR_ALWAYS); 969 out_le16(&cp->command, INPUT_LAST + INTR_ALWAYS);
970#if 0 970#if 0
971 if ((ld_le32(&rd->status) & ACTIVE) != 0) { 971 if ((le32_to_cpu(rd->status) & ACTIVE) != 0) {
972 out_le32(&rd->control, (PAUSE << 16) | PAUSE); 972 out_le32(&rd->control, (PAUSE << 16) | PAUSE);
973 while ((in_le32(&rd->status) & ACTIVE) != 0) 973 while ((in_le32(&rd->status) & ACTIVE) != 0)
974 ; 974 ;
diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
index 8a17b97baa20..de7919322190 100644
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -79,13 +79,6 @@ MODULE_AUTHOR
79 ("Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>"); 79 ("Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>");
80MODULE_LICENSE("GPL"); 80MODULE_LICENSE("GPL");
81 81
82/*
83 * PPC64 doesn't (yet) have a cacheable_memcpy
84 */
85#ifdef CONFIG_PPC64
86#define cacheable_memcpy(d,s,n) memcpy((d),(s),(n))
87#endif
88
89/* minimum number of free TX descriptors required to wake up TX process */ 82/* minimum number of free TX descriptors required to wake up TX process */
90#define EMAC_TX_WAKEUP_THRESH (NUM_TX_BUFF / 4) 83#define EMAC_TX_WAKEUP_THRESH (NUM_TX_BUFF / 4)
91 84
@@ -1673,7 +1666,7 @@ static inline int emac_rx_sg_append(struct emac_instance *dev, int slot)
1673 dev_kfree_skb(dev->rx_sg_skb); 1666 dev_kfree_skb(dev->rx_sg_skb);
1674 dev->rx_sg_skb = NULL; 1667 dev->rx_sg_skb = NULL;
1675 } else { 1668 } else {
1676 cacheable_memcpy(skb_tail_pointer(dev->rx_sg_skb), 1669 memcpy(skb_tail_pointer(dev->rx_sg_skb),
1677 dev->rx_skb[slot]->data, len); 1670 dev->rx_skb[slot]->data, len);
1678 skb_put(dev->rx_sg_skb, len); 1671 skb_put(dev->rx_sg_skb, len);
1679 emac_recycle_rx_skb(dev, slot, len); 1672 emac_recycle_rx_skb(dev, slot, len);
@@ -1730,8 +1723,7 @@ static int emac_poll_rx(void *param, int budget)
1730 goto oom; 1723 goto oom;
1731 1724
1732 skb_reserve(copy_skb, EMAC_RX_SKB_HEADROOM + 2); 1725 skb_reserve(copy_skb, EMAC_RX_SKB_HEADROOM + 2);
1733 cacheable_memcpy(copy_skb->data - 2, skb->data - 2, 1726 memcpy(copy_skb->data - 2, skb->data - 2, len + 2);
1734 len + 2);
1735 emac_recycle_rx_skb(dev, slot, len); 1727 emac_recycle_rx_skb(dev, slot, len);
1736 skb = copy_skb; 1728 skb = copy_skb;
1737 } else if (unlikely(emac_alloc_rx_skb(dev, slot, GFP_ATOMIC))) 1729 } else if (unlikely(emac_alloc_rx_skb(dev, slot, GFP_ATOMIC)))
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index 33d2f9aa1b53..4b00545a3ace 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -2523,9 +2523,7 @@ int efx_try_recovery(struct efx_nic *efx)
2523 * schedule a 'recover or reset', leading to this recovery handler. 2523 * schedule a 'recover or reset', leading to this recovery handler.
2524 * Manually call the eeh failure check function. 2524 * Manually call the eeh failure check function.
2525 */ 2525 */
2526 struct eeh_dev *eehdev = 2526 struct eeh_dev *eehdev = pci_dev_to_eeh_dev(efx->pci_dev);
2527 of_node_to_eeh_dev(pci_device_to_OF_node(efx->pci_dev));
2528
2529 if (eeh_dev_check_failure(eehdev)) { 2527 if (eeh_dev_check_failure(eehdev)) {
2530 /* The EEH mechanisms will handle the error and reset the 2528 /* The EEH mechanisms will handle the error and reset the
2531 * device if necessary. 2529 * device if necessary.
diff --git a/drivers/net/ethernet/sfc/siena.c b/drivers/net/ethernet/sfc/siena.c
index 3583f0208a6e..f12c811938d2 100644
--- a/drivers/net/ethernet/sfc/siena.c
+++ b/drivers/net/ethernet/sfc/siena.c
@@ -205,8 +205,7 @@ static int siena_map_reset_flags(u32 *flags)
205 */ 205 */
206static void siena_monitor(struct efx_nic *efx) 206static void siena_monitor(struct efx_nic *efx)
207{ 207{
208 struct eeh_dev *eehdev = 208 struct eeh_dev *eehdev = pci_dev_to_eeh_dev(efx->pci_dev);
209 of_node_to_eeh_dev(pci_device_to_OF_node(efx->pci_dev));
210 209
211 eeh_dev_check_failure(eehdev); 210 eeh_dev_check_failure(eehdev);
212} 211}
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c
index 7660232ef460..e12bafdc42e0 100644
--- a/drivers/pci/hotplug/rpadlpar_core.c
+++ b/drivers/pci/hotplug/rpadlpar_core.c
@@ -146,7 +146,7 @@ static void dlpar_pci_add_bus(struct device_node *dn)
146 struct pci_controller *phb = pdn->phb; 146 struct pci_controller *phb = pdn->phb;
147 struct pci_dev *dev = NULL; 147 struct pci_dev *dev = NULL;
148 148
149 eeh_add_device_tree_early(dn); 149 eeh_add_device_tree_early(pdn);
150 150
151 /* Add EADS device to PHB bus, adding new entry to bus->devices */ 151 /* Add EADS device to PHB bus, adding new entry to bus->devices */
152 dev = of_create_pci_dev(dn, phb->bus, pdn->devfn); 152 dev = of_create_pci_dev(dn, phb->bus, pdn->devfn);
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 4b3a4eaad996..ee0ebff103a4 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -19,16 +19,59 @@
19 19
20#define VIRTFN_ID_LEN 16 20#define VIRTFN_ID_LEN 16
21 21
22static inline u8 virtfn_bus(struct pci_dev *dev, int id) 22int pci_iov_virtfn_bus(struct pci_dev *dev, int vf_id)
23{ 23{
24 if (!dev->is_physfn)
25 return -EINVAL;
24 return dev->bus->number + ((dev->devfn + dev->sriov->offset + 26 return dev->bus->number + ((dev->devfn + dev->sriov->offset +
25 dev->sriov->stride * id) >> 8); 27 dev->sriov->stride * vf_id) >> 8);
26} 28}
27 29
28static inline u8 virtfn_devfn(struct pci_dev *dev, int id) 30int pci_iov_virtfn_devfn(struct pci_dev *dev, int vf_id)
29{ 31{
32 if (!dev->is_physfn)
33 return -EINVAL;
30 return (dev->devfn + dev->sriov->offset + 34 return (dev->devfn + dev->sriov->offset +
31 dev->sriov->stride * id) & 0xff; 35 dev->sriov->stride * vf_id) & 0xff;
36}
37
38/*
39 * Per SR-IOV spec sec 3.3.10 and 3.3.11, First VF Offset and VF Stride may
40 * change when NumVFs changes.
41 *
42 * Update iov->offset and iov->stride when NumVFs is written.
43 */
44static inline void pci_iov_set_numvfs(struct pci_dev *dev, int nr_virtfn)
45{
46 struct pci_sriov *iov = dev->sriov;
47
48 pci_write_config_word(dev, iov->pos + PCI_SRIOV_NUM_VF, nr_virtfn);
49 pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_OFFSET, &iov->offset);
50 pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_STRIDE, &iov->stride);
51}
52
53/*
54 * The PF consumes one bus number. NumVFs, First VF Offset, and VF Stride
55 * determine how many additional bus numbers will be consumed by VFs.
56 *
57 * Iterate over all valid NumVFs and calculate the maximum number of bus
58 * numbers that could ever be required.
59 */
60static inline u8 virtfn_max_buses(struct pci_dev *dev)
61{
62 struct pci_sriov *iov = dev->sriov;
63 int nr_virtfn;
64 u8 max = 0;
65 int busnr;
66
67 for (nr_virtfn = 1; nr_virtfn <= iov->total_VFs; nr_virtfn++) {
68 pci_iov_set_numvfs(dev, nr_virtfn);
69 busnr = pci_iov_virtfn_bus(dev, nr_virtfn - 1);
70 if (busnr > max)
71 max = busnr;
72 }
73
74 return max;
32} 75}
33 76
34static struct pci_bus *virtfn_add_bus(struct pci_bus *bus, int busnr) 77static struct pci_bus *virtfn_add_bus(struct pci_bus *bus, int busnr)
@@ -57,6 +100,14 @@ static void virtfn_remove_bus(struct pci_bus *physbus, struct pci_bus *virtbus)
57 pci_remove_bus(virtbus); 100 pci_remove_bus(virtbus);
58} 101}
59 102
103resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno)
104{
105 if (!dev->is_physfn)
106 return 0;
107
108 return dev->sriov->barsz[resno - PCI_IOV_RESOURCES];
109}
110
60static int virtfn_add(struct pci_dev *dev, int id, int reset) 111static int virtfn_add(struct pci_dev *dev, int id, int reset)
61{ 112{
62 int i; 113 int i;
@@ -69,7 +120,7 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
69 struct pci_bus *bus; 120 struct pci_bus *bus;
70 121
71 mutex_lock(&iov->dev->sriov->lock); 122 mutex_lock(&iov->dev->sriov->lock);
72 bus = virtfn_add_bus(dev->bus, virtfn_bus(dev, id)); 123 bus = virtfn_add_bus(dev->bus, pci_iov_virtfn_bus(dev, id));
73 if (!bus) 124 if (!bus)
74 goto failed; 125 goto failed;
75 126
@@ -77,7 +128,7 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
77 if (!virtfn) 128 if (!virtfn)
78 goto failed0; 129 goto failed0;
79 130
80 virtfn->devfn = virtfn_devfn(dev, id); 131 virtfn->devfn = pci_iov_virtfn_devfn(dev, id);
81 virtfn->vendor = dev->vendor; 132 virtfn->vendor = dev->vendor;
82 pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_DID, &virtfn->device); 133 pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_DID, &virtfn->device);
83 pci_setup_device(virtfn); 134 pci_setup_device(virtfn);
@@ -87,13 +138,12 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
87 virtfn->multifunction = 0; 138 virtfn->multifunction = 0;
88 139
89 for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) { 140 for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) {
90 res = dev->resource + PCI_IOV_RESOURCES + i; 141 res = &dev->resource[i + PCI_IOV_RESOURCES];
91 if (!res->parent) 142 if (!res->parent)
92 continue; 143 continue;
93 virtfn->resource[i].name = pci_name(virtfn); 144 virtfn->resource[i].name = pci_name(virtfn);
94 virtfn->resource[i].flags = res->flags; 145 virtfn->resource[i].flags = res->flags;
95 size = resource_size(res); 146 size = pci_iov_resource_size(dev, i + PCI_IOV_RESOURCES);
96 do_div(size, iov->total_VFs);
97 virtfn->resource[i].start = res->start + size * id; 147 virtfn->resource[i].start = res->start + size * id;
98 virtfn->resource[i].end = virtfn->resource[i].start + size - 1; 148 virtfn->resource[i].end = virtfn->resource[i].start + size - 1;
99 rc = request_resource(res, &virtfn->resource[i]); 149 rc = request_resource(res, &virtfn->resource[i]);
@@ -140,8 +190,8 @@ static void virtfn_remove(struct pci_dev *dev, int id, int reset)
140 struct pci_sriov *iov = dev->sriov; 190 struct pci_sriov *iov = dev->sriov;
141 191
142 virtfn = pci_get_domain_bus_and_slot(pci_domain_nr(dev->bus), 192 virtfn = pci_get_domain_bus_and_slot(pci_domain_nr(dev->bus),
143 virtfn_bus(dev, id), 193 pci_iov_virtfn_bus(dev, id),
144 virtfn_devfn(dev, id)); 194 pci_iov_virtfn_devfn(dev, id));
145 if (!virtfn) 195 if (!virtfn)
146 return; 196 return;
147 197
@@ -170,6 +220,11 @@ static void virtfn_remove(struct pci_dev *dev, int id, int reset)
170 pci_dev_put(dev); 220 pci_dev_put(dev);
171} 221}
172 222
223int __weak pcibios_sriov_enable(struct pci_dev *pdev, u16 num_vfs)
224{
225 return 0;
226}
227
173static int sriov_enable(struct pci_dev *dev, int nr_virtfn) 228static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
174{ 229{
175 int rc; 230 int rc;
@@ -180,6 +235,8 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
180 struct pci_dev *pdev; 235 struct pci_dev *pdev;
181 struct pci_sriov *iov = dev->sriov; 236 struct pci_sriov *iov = dev->sriov;
182 int bars = 0; 237 int bars = 0;
238 int bus;
239 int retval;
183 240
184 if (!nr_virtfn) 241 if (!nr_virtfn)
185 return 0; 242 return 0;
@@ -204,7 +261,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
204 nres = 0; 261 nres = 0;
205 for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) { 262 for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) {
206 bars |= (1 << (i + PCI_IOV_RESOURCES)); 263 bars |= (1 << (i + PCI_IOV_RESOURCES));
207 res = dev->resource + PCI_IOV_RESOURCES + i; 264 res = &dev->resource[i + PCI_IOV_RESOURCES];
208 if (res->parent) 265 if (res->parent)
209 nres++; 266 nres++;
210 } 267 }
@@ -216,8 +273,10 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
216 iov->offset = offset; 273 iov->offset = offset;
217 iov->stride = stride; 274 iov->stride = stride;
218 275
219 if (virtfn_bus(dev, nr_virtfn - 1) > dev->bus->busn_res.end) { 276 bus = pci_iov_virtfn_bus(dev, nr_virtfn - 1);
220 dev_err(&dev->dev, "SR-IOV: bus number out of range\n"); 277 if (bus > dev->bus->busn_res.end) {
278 dev_err(&dev->dev, "can't enable %d VFs (bus %02x out of range of %pR)\n",
279 nr_virtfn, bus, &dev->bus->busn_res);
221 return -ENOMEM; 280 return -ENOMEM;
222 } 281 }
223 282
@@ -243,7 +302,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
243 return rc; 302 return rc;
244 } 303 }
245 304
246 pci_write_config_word(dev, iov->pos + PCI_SRIOV_NUM_VF, nr_virtfn); 305 pci_iov_set_numvfs(dev, nr_virtfn);
247 iov->ctrl |= PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE; 306 iov->ctrl |= PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE;
248 pci_cfg_access_lock(dev); 307 pci_cfg_access_lock(dev);
249 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl); 308 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl);
@@ -254,6 +313,12 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
254 if (nr_virtfn < initial) 313 if (nr_virtfn < initial)
255 initial = nr_virtfn; 314 initial = nr_virtfn;
256 315
316 if ((retval = pcibios_sriov_enable(dev, initial))) {
317 dev_err(&dev->dev, "failure %d from pcibios_sriov_enable()\n",
318 retval);
319 return retval;
320 }
321
257 for (i = 0; i < initial; i++) { 322 for (i = 0; i < initial; i++) {
258 rc = virtfn_add(dev, i, 0); 323 rc = virtfn_add(dev, i, 0);
259 if (rc) 324 if (rc)
@@ -272,7 +337,7 @@ failed:
272 iov->ctrl &= ~(PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE); 337 iov->ctrl &= ~(PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE);
273 pci_cfg_access_lock(dev); 338 pci_cfg_access_lock(dev);
274 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl); 339 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl);
275 pci_write_config_word(dev, iov->pos + PCI_SRIOV_NUM_VF, 0); 340 pci_iov_set_numvfs(dev, 0);
276 ssleep(1); 341 ssleep(1);
277 pci_cfg_access_unlock(dev); 342 pci_cfg_access_unlock(dev);
278 343
@@ -282,6 +347,11 @@ failed:
282 return rc; 347 return rc;
283} 348}
284 349
350int __weak pcibios_sriov_disable(struct pci_dev *pdev)
351{
352 return 0;
353}
354
285static void sriov_disable(struct pci_dev *dev) 355static void sriov_disable(struct pci_dev *dev)
286{ 356{
287 int i; 357 int i;
@@ -293,6 +363,8 @@ static void sriov_disable(struct pci_dev *dev)
293 for (i = 0; i < iov->num_VFs; i++) 363 for (i = 0; i < iov->num_VFs; i++)
294 virtfn_remove(dev, i, 0); 364 virtfn_remove(dev, i, 0);
295 365
366 pcibios_sriov_disable(dev);
367
296 iov->ctrl &= ~(PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE); 368 iov->ctrl &= ~(PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE);
297 pci_cfg_access_lock(dev); 369 pci_cfg_access_lock(dev);
298 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl); 370 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl);
@@ -303,12 +375,12 @@ static void sriov_disable(struct pci_dev *dev)
303 sysfs_remove_link(&dev->dev.kobj, "dep_link"); 375 sysfs_remove_link(&dev->dev.kobj, "dep_link");
304 376
305 iov->num_VFs = 0; 377 iov->num_VFs = 0;
306 pci_write_config_word(dev, iov->pos + PCI_SRIOV_NUM_VF, 0); 378 pci_iov_set_numvfs(dev, 0);
307} 379}
308 380
309static int sriov_init(struct pci_dev *dev, int pos) 381static int sriov_init(struct pci_dev *dev, int pos)
310{ 382{
311 int i; 383 int i, bar64;
312 int rc; 384 int rc;
313 int nres; 385 int nres;
314 u32 pgsz; 386 u32 pgsz;
@@ -357,27 +429,29 @@ found:
357 pgsz &= ~(pgsz - 1); 429 pgsz &= ~(pgsz - 1);
358 pci_write_config_dword(dev, pos + PCI_SRIOV_SYS_PGSIZE, pgsz); 430 pci_write_config_dword(dev, pos + PCI_SRIOV_SYS_PGSIZE, pgsz);
359 431
432 iov = kzalloc(sizeof(*iov), GFP_KERNEL);
433 if (!iov)
434 return -ENOMEM;
435
360 nres = 0; 436 nres = 0;
361 for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) { 437 for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) {
362 res = dev->resource + PCI_IOV_RESOURCES + i; 438 res = &dev->resource[i + PCI_IOV_RESOURCES];
363 i += __pci_read_base(dev, pci_bar_unknown, res, 439 bar64 = __pci_read_base(dev, pci_bar_unknown, res,
364 pos + PCI_SRIOV_BAR + i * 4); 440 pos + PCI_SRIOV_BAR + i * 4);
365 if (!res->flags) 441 if (!res->flags)
366 continue; 442 continue;
367 if (resource_size(res) & (PAGE_SIZE - 1)) { 443 if (resource_size(res) & (PAGE_SIZE - 1)) {
368 rc = -EIO; 444 rc = -EIO;
369 goto failed; 445 goto failed;
370 } 446 }
447 iov->barsz[i] = resource_size(res);
371 res->end = res->start + resource_size(res) * total - 1; 448 res->end = res->start + resource_size(res) * total - 1;
449 dev_info(&dev->dev, "VF(n) BAR%d space: %pR (contains BAR%d for %d VFs)\n",
450 i, res, i, total);
451 i += bar64;
372 nres++; 452 nres++;
373 } 453 }
374 454
375 iov = kzalloc(sizeof(*iov), GFP_KERNEL);
376 if (!iov) {
377 rc = -ENOMEM;
378 goto failed;
379 }
380
381 iov->pos = pos; 455 iov->pos = pos;
382 iov->nres = nres; 456 iov->nres = nres;
383 iov->ctrl = ctrl; 457 iov->ctrl = ctrl;
@@ -400,15 +474,17 @@ found:
400 474
401 dev->sriov = iov; 475 dev->sriov = iov;
402 dev->is_physfn = 1; 476 dev->is_physfn = 1;
477 iov->max_VF_buses = virtfn_max_buses(dev);
403 478
404 return 0; 479 return 0;
405 480
406failed: 481failed:
407 for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) { 482 for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) {
408 res = dev->resource + PCI_IOV_RESOURCES + i; 483 res = &dev->resource[i + PCI_IOV_RESOURCES];
409 res->flags = 0; 484 res->flags = 0;
410 } 485 }
411 486
487 kfree(iov);
412 return rc; 488 return rc;
413} 489}
414 490
@@ -439,7 +515,7 @@ static void sriov_restore_state(struct pci_dev *dev)
439 pci_update_resource(dev, i); 515 pci_update_resource(dev, i);
440 516
441 pci_write_config_dword(dev, iov->pos + PCI_SRIOV_SYS_PGSIZE, iov->pgsz); 517 pci_write_config_dword(dev, iov->pos + PCI_SRIOV_SYS_PGSIZE, iov->pgsz);
442 pci_write_config_word(dev, iov->pos + PCI_SRIOV_NUM_VF, iov->num_VFs); 518 pci_iov_set_numvfs(dev, iov->num_VFs);
443 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl); 519 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl);
444 if (iov->ctrl & PCI_SRIOV_CTRL_VFE) 520 if (iov->ctrl & PCI_SRIOV_CTRL_VFE)
445 msleep(100); 521 msleep(100);
@@ -493,6 +569,12 @@ int pci_iov_resource_bar(struct pci_dev *dev, int resno)
493 4 * (resno - PCI_IOV_RESOURCES); 569 4 * (resno - PCI_IOV_RESOURCES);
494} 570}
495 571
572resource_size_t __weak pcibios_iov_resource_alignment(struct pci_dev *dev,
573 int resno)
574{
575 return pci_iov_resource_size(dev, resno);
576}
577
496/** 578/**
497 * pci_sriov_resource_alignment - get resource alignment for VF BAR 579 * pci_sriov_resource_alignment - get resource alignment for VF BAR
498 * @dev: the PCI device 580 * @dev: the PCI device
@@ -505,14 +587,7 @@ int pci_iov_resource_bar(struct pci_dev *dev, int resno)
505 */ 587 */
506resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno) 588resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno)
507{ 589{
508 struct resource tmp; 590 return pcibios_iov_resource_alignment(dev, resno);
509 int reg = pci_iov_resource_bar(dev, resno);
510
511 if (!reg)
512 return 0;
513
514 __pci_read_base(dev, pci_bar_unknown, &tmp, reg);
515 return resource_alignment(&tmp);
516} 591}
517 592
518/** 593/**
@@ -535,15 +610,13 @@ void pci_restore_iov_state(struct pci_dev *dev)
535int pci_iov_bus_range(struct pci_bus *bus) 610int pci_iov_bus_range(struct pci_bus *bus)
536{ 611{
537 int max = 0; 612 int max = 0;
538 u8 busnr;
539 struct pci_dev *dev; 613 struct pci_dev *dev;
540 614
541 list_for_each_entry(dev, &bus->devices, bus_list) { 615 list_for_each_entry(dev, &bus->devices, bus_list) {
542 if (!dev->is_physfn) 616 if (!dev->is_physfn)
543 continue; 617 continue;
544 busnr = virtfn_bus(dev, dev->sriov->total_VFs - 1); 618 if (dev->sriov->max_VF_buses > max)
545 if (busnr > max) 619 max = dev->sriov->max_VF_buses;
546 max = busnr;
547 } 620 }
548 621
549 return max ? max - bus->number : 0; 622 return max ? max - bus->number : 0;
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index d72f849174a4..9bd762c237ab 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -243,10 +243,12 @@ struct pci_sriov {
243 u16 stride; /* following VF stride */ 243 u16 stride; /* following VF stride */
244 u32 pgsz; /* page size for BAR alignment */ 244 u32 pgsz; /* page size for BAR alignment */
245 u8 link; /* Function Dependency Link */ 245 u8 link; /* Function Dependency Link */
246 u8 max_VF_buses; /* max buses consumed by VFs */
246 u16 driver_max_VFs; /* max num VFs driver supports */ 247 u16 driver_max_VFs; /* max num VFs driver supports */
247 struct pci_dev *dev; /* lowest numbered PF */ 248 struct pci_dev *dev; /* lowest numbered PF */
248 struct pci_dev *self; /* this PF */ 249 struct pci_dev *self; /* this PF */
249 struct mutex lock; /* lock for VF bus */ 250 struct mutex lock; /* lock for VF bus */
251 resource_size_t barsz[PCI_SRIOV_NUM_BARS]; /* VF BAR size */
250}; 252};
251 253
252#ifdef CONFIG_PCI_ATS 254#ifdef CONFIG_PCI_ATS
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 8169597e47cb..4fd0cacf7ca0 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -99,8 +99,8 @@ static void remove_from_list(struct list_head *head,
99 } 99 }
100} 100}
101 101
102static resource_size_t get_res_add_size(struct list_head *head, 102static struct pci_dev_resource *res_to_dev_res(struct list_head *head,
103 struct resource *res) 103 struct resource *res)
104{ 104{
105 struct pci_dev_resource *dev_res; 105 struct pci_dev_resource *dev_res;
106 106
@@ -109,17 +109,37 @@ static resource_size_t get_res_add_size(struct list_head *head,
109 int idx = res - &dev_res->dev->resource[0]; 109 int idx = res - &dev_res->dev->resource[0];
110 110
111 dev_printk(KERN_DEBUG, &dev_res->dev->dev, 111 dev_printk(KERN_DEBUG, &dev_res->dev->dev,
112 "res[%d]=%pR get_res_add_size add_size %llx\n", 112 "res[%d]=%pR res_to_dev_res add_size %llx min_align %llx\n",
113 idx, dev_res->res, 113 idx, dev_res->res,
114 (unsigned long long)dev_res->add_size); 114 (unsigned long long)dev_res->add_size,
115 (unsigned long long)dev_res->min_align);
115 116
116 return dev_res->add_size; 117 return dev_res;
117 } 118 }
118 } 119 }
119 120
120 return 0; 121 return NULL;
121} 122}
122 123
124static resource_size_t get_res_add_size(struct list_head *head,
125 struct resource *res)
126{
127 struct pci_dev_resource *dev_res;
128
129 dev_res = res_to_dev_res(head, res);
130 return dev_res ? dev_res->add_size : 0;
131}
132
133static resource_size_t get_res_add_align(struct list_head *head,
134 struct resource *res)
135{
136 struct pci_dev_resource *dev_res;
137
138 dev_res = res_to_dev_res(head, res);
139 return dev_res ? dev_res->min_align : 0;
140}
141
142
123/* Sort resources by alignment */ 143/* Sort resources by alignment */
124static void pdev_sort_resources(struct pci_dev *dev, struct list_head *head) 144static void pdev_sort_resources(struct pci_dev *dev, struct list_head *head)
125{ 145{
@@ -215,7 +235,7 @@ static void reassign_resources_sorted(struct list_head *realloc_head,
215 struct resource *res; 235 struct resource *res;
216 struct pci_dev_resource *add_res, *tmp; 236 struct pci_dev_resource *add_res, *tmp;
217 struct pci_dev_resource *dev_res; 237 struct pci_dev_resource *dev_res;
218 resource_size_t add_size; 238 resource_size_t add_size, align;
219 int idx; 239 int idx;
220 240
221 list_for_each_entry_safe(add_res, tmp, realloc_head, list) { 241 list_for_each_entry_safe(add_res, tmp, realloc_head, list) {
@@ -238,13 +258,13 @@ static void reassign_resources_sorted(struct list_head *realloc_head,
238 258
239 idx = res - &add_res->dev->resource[0]; 259 idx = res - &add_res->dev->resource[0];
240 add_size = add_res->add_size; 260 add_size = add_res->add_size;
261 align = add_res->min_align;
241 if (!resource_size(res)) { 262 if (!resource_size(res)) {
242 res->start = add_res->start; 263 res->start = align;
243 res->end = res->start + add_size - 1; 264 res->end = res->start + add_size - 1;
244 if (pci_assign_resource(add_res->dev, idx)) 265 if (pci_assign_resource(add_res->dev, idx))
245 reset_resource(res); 266 reset_resource(res);
246 } else { 267 } else {
247 resource_size_t align = add_res->min_align;
248 res->flags |= add_res->flags & 268 res->flags |= add_res->flags &
249 (IORESOURCE_STARTALIGN|IORESOURCE_SIZEALIGN); 269 (IORESOURCE_STARTALIGN|IORESOURCE_SIZEALIGN);
250 if (pci_reassign_resource(add_res->dev, idx, 270 if (pci_reassign_resource(add_res->dev, idx,
@@ -368,8 +388,9 @@ static void __assign_resources_sorted(struct list_head *head,
368 LIST_HEAD(save_head); 388 LIST_HEAD(save_head);
369 LIST_HEAD(local_fail_head); 389 LIST_HEAD(local_fail_head);
370 struct pci_dev_resource *save_res; 390 struct pci_dev_resource *save_res;
371 struct pci_dev_resource *dev_res, *tmp_res; 391 struct pci_dev_resource *dev_res, *tmp_res, *dev_res2;
372 unsigned long fail_type; 392 unsigned long fail_type;
393 resource_size_t add_align, align;
373 394
374 /* Check if optional add_size is there */ 395 /* Check if optional add_size is there */
375 if (!realloc_head || list_empty(realloc_head)) 396 if (!realloc_head || list_empty(realloc_head))
@@ -384,10 +405,44 @@ static void __assign_resources_sorted(struct list_head *head,
384 } 405 }
385 406
386 /* Update res in head list with add_size in realloc_head list */ 407 /* Update res in head list with add_size in realloc_head list */
387 list_for_each_entry(dev_res, head, list) 408 list_for_each_entry_safe(dev_res, tmp_res, head, list) {
388 dev_res->res->end += get_res_add_size(realloc_head, 409 dev_res->res->end += get_res_add_size(realloc_head,
389 dev_res->res); 410 dev_res->res);
390 411
412 /*
413 * There are two kinds of additional resources in the list:
414 * 1. bridge resource -- IORESOURCE_STARTALIGN
415 * 2. SR-IOV resource -- IORESOURCE_SIZEALIGN
416 * Here just fix the additional alignment for bridge
417 */
418 if (!(dev_res->res->flags & IORESOURCE_STARTALIGN))
419 continue;
420
421 add_align = get_res_add_align(realloc_head, dev_res->res);
422
423 /*
424 * The "head" list is sorted by the alignment to make sure
425 * resources with bigger alignment will be assigned first.
426 * After we change the alignment of a dev_res in "head" list,
427 * we need to reorder the list by alignment to make it
428 * consistent.
429 */
430 if (add_align > dev_res->res->start) {
431 dev_res->res->start = add_align;
432 dev_res->res->end = add_align +
433 resource_size(dev_res->res);
434
435 list_for_each_entry(dev_res2, head, list) {
436 align = pci_resource_alignment(dev_res2->dev,
437 dev_res2->res);
438 if (add_align > align)
439 list_move_tail(&dev_res->list,
440 &dev_res2->list);
441 }
442 }
443
444 }
445
391 /* Try updated head list with add_size added */ 446 /* Try updated head list with add_size added */
392 assign_requested_resources_sorted(head, &local_fail_head); 447 assign_requested_resources_sorted(head, &local_fail_head);
393 448
@@ -962,6 +1017,8 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
962 struct resource *b_res = find_free_bus_resource(bus, 1017 struct resource *b_res = find_free_bus_resource(bus,
963 mask | IORESOURCE_PREFETCH, type); 1018 mask | IORESOURCE_PREFETCH, type);
964 resource_size_t children_add_size = 0; 1019 resource_size_t children_add_size = 0;
1020 resource_size_t children_add_align = 0;
1021 resource_size_t add_align = 0;
965 1022
966 if (!b_res) 1023 if (!b_res)
967 return -ENOSPC; 1024 return -ENOSPC;
@@ -986,6 +1043,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
986 /* put SRIOV requested res to the optional list */ 1043 /* put SRIOV requested res to the optional list */
987 if (realloc_head && i >= PCI_IOV_RESOURCES && 1044 if (realloc_head && i >= PCI_IOV_RESOURCES &&
988 i <= PCI_IOV_RESOURCE_END) { 1045 i <= PCI_IOV_RESOURCE_END) {
1046 add_align = max(pci_resource_alignment(dev, r), add_align);
989 r->end = r->start - 1; 1047 r->end = r->start - 1;
990 add_to_list(realloc_head, dev, r, r_size, 0/* don't care */); 1048 add_to_list(realloc_head, dev, r, r_size, 0/* don't care */);
991 children_add_size += r_size; 1049 children_add_size += r_size;
@@ -1016,19 +1074,23 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
1016 if (order > max_order) 1074 if (order > max_order)
1017 max_order = order; 1075 max_order = order;
1018 1076
1019 if (realloc_head) 1077 if (realloc_head) {
1020 children_add_size += get_res_add_size(realloc_head, r); 1078 children_add_size += get_res_add_size(realloc_head, r);
1079 children_add_align = get_res_add_align(realloc_head, r);
1080 add_align = max(add_align, children_add_align);
1081 }
1021 } 1082 }
1022 } 1083 }
1023 1084
1024 min_align = calculate_mem_align(aligns, max_order); 1085 min_align = calculate_mem_align(aligns, max_order);
1025 min_align = max(min_align, window_alignment(bus, b_res->flags)); 1086 min_align = max(min_align, window_alignment(bus, b_res->flags));
1026 size0 = calculate_memsize(size, min_size, 0, resource_size(b_res), min_align); 1087 size0 = calculate_memsize(size, min_size, 0, resource_size(b_res), min_align);
1088 add_align = max(min_align, add_align);
1027 if (children_add_size > add_size) 1089 if (children_add_size > add_size)
1028 add_size = children_add_size; 1090 add_size = children_add_size;
1029 size1 = (!realloc_head || (realloc_head && !add_size)) ? size0 : 1091 size1 = (!realloc_head || (realloc_head && !add_size)) ? size0 :
1030 calculate_memsize(size, min_size, add_size, 1092 calculate_memsize(size, min_size, add_size,
1031 resource_size(b_res), min_align); 1093 resource_size(b_res), add_align);
1032 if (!size0 && !size1) { 1094 if (!size0 && !size1) {
1033 if (b_res->start || b_res->end) 1095 if (b_res->start || b_res->end)
1034 dev_info(&bus->self->dev, "disabling bridge window %pR to %pR (unused)\n", 1096 dev_info(&bus->self->dev, "disabling bridge window %pR to %pR (unused)\n",
@@ -1040,10 +1102,11 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
1040 b_res->end = size0 + min_align - 1; 1102 b_res->end = size0 + min_align - 1;
1041 b_res->flags |= IORESOURCE_STARTALIGN; 1103 b_res->flags |= IORESOURCE_STARTALIGN;
1042 if (size1 > size0 && realloc_head) { 1104 if (size1 > size0 && realloc_head) {
1043 add_to_list(realloc_head, bus->self, b_res, size1-size0, min_align); 1105 add_to_list(realloc_head, bus->self, b_res, size1-size0, add_align);
1044 dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window %pR to %pR add_size %llx\n", 1106 dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window %pR to %pR add_size %llx add_align %llx\n",
1045 b_res, &bus->busn_res, 1107 b_res, &bus->busn_res,
1046 (unsigned long long)size1-size0); 1108 (unsigned long long) (size1 - size0),
1109 (unsigned long long) add_align);
1047 } 1110 }
1048 return 0; 1111 return 0;
1049} 1112}
diff --git a/drivers/ps3/ps3-lpm.c b/drivers/ps3/ps3-lpm.c
index b139b7792e9f..cb7d3a67380d 100644
--- a/drivers/ps3/ps3-lpm.c
+++ b/drivers/ps3/ps3-lpm.c
@@ -105,7 +105,7 @@ struct ps3_lpm_shadow_regs {
105 * @open: An atomic variable indicating the lpm driver has been opened. 105 * @open: An atomic variable indicating the lpm driver has been opened.
106 * @rights: The lpm rigths granted by the system policy module. A logical 106 * @rights: The lpm rigths granted by the system policy module. A logical
107 * OR of enum ps3_lpm_rights. 107 * OR of enum ps3_lpm_rights.
108 * @node_id: The node id of a BE prosessor whose performance monitor this 108 * @node_id: The node id of a BE processor whose performance monitor this
109 * lpar has the right to use. 109 * lpar has the right to use.
110 * @pu_id: The lv1 id of the logical PU. 110 * @pu_id: The lv1 id of the logical PU.
111 * @lpm_id: The lv1 id of this lpm instance. 111 * @lpm_id: The lv1 id of this lpm instance.
@@ -412,7 +412,7 @@ u32 ps3_read_pm(u32 cpu, enum pm_reg_name reg)
412 result = lv1_set_lpm_interval(lpm_priv->lpm_id, 0, 0, &val); 412 result = lv1_set_lpm_interval(lpm_priv->lpm_id, 0, 0, &val);
413 if (result) { 413 if (result) {
414 val = 0; 414 val = 0;
415 dev_dbg(sbd_core(), "%s:%u: lv1 set_inteval failed: " 415 dev_dbg(sbd_core(), "%s:%u: lv1 set_interval failed: "
416 "reg %u, %s\n", __func__, __LINE__, reg, 416 "reg %u, %s\n", __func__, __LINE__, reg,
417 ps3_result(result)); 417 ps3_result(result));
418 } 418 }
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c
index e5cd8d8d4ce7..0adb2e015597 100644
--- a/drivers/scsi/mac53c94.c
+++ b/drivers/scsi/mac53c94.c
@@ -382,16 +382,16 @@ static void set_dma_cmds(struct fsc_state *state, struct scsi_cmnd *cmd)
382 if (dma_len > 0xffff) 382 if (dma_len > 0xffff)
383 panic("mac53c94: scatterlist element >= 64k"); 383 panic("mac53c94: scatterlist element >= 64k");
384 total += dma_len; 384 total += dma_len;
385 st_le16(&dcmds->req_count, dma_len); 385 dcmds->req_count = cpu_to_le16(dma_len);
386 st_le16(&dcmds->command, dma_cmd); 386 dcmds->command = cpu_to_le16(dma_cmd);
387 st_le32(&dcmds->phy_addr, dma_addr); 387 dcmds->phy_addr = cpu_to_le32(dma_addr);
388 dcmds->xfer_status = 0; 388 dcmds->xfer_status = 0;
389 ++dcmds; 389 ++dcmds;
390 } 390 }
391 391
392 dma_cmd += OUTPUT_LAST - OUTPUT_MORE; 392 dma_cmd += OUTPUT_LAST - OUTPUT_MORE;
393 st_le16(&dcmds[-1].command, dma_cmd); 393 dcmds[-1].command = cpu_to_le16(dma_cmd);
394 st_le16(&dcmds->command, DBDMA_STOP); 394 dcmds->command = cpu_to_le16(DBDMA_STOP);
395 cmd->SCp.this_residual = total; 395 cmd->SCp.this_residual = total;
396} 396}
397 397
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c
index 57a95e2c3442..555367f00228 100644
--- a/drivers/scsi/mesh.c
+++ b/drivers/scsi/mesh.c
@@ -1287,9 +1287,9 @@ static void set_dma_cmds(struct mesh_state *ms, struct scsi_cmnd *cmd)
1287 } 1287 }
1288 if (dma_len > 0xffff) 1288 if (dma_len > 0xffff)
1289 panic("mesh: scatterlist element >= 64k"); 1289 panic("mesh: scatterlist element >= 64k");
1290 st_le16(&dcmds->req_count, dma_len - off); 1290 dcmds->req_count = cpu_to_le16(dma_len - off);
1291 st_le16(&dcmds->command, dma_cmd); 1291 dcmds->command = cpu_to_le16(dma_cmd);
1292 st_le32(&dcmds->phy_addr, dma_addr + off); 1292 dcmds->phy_addr = cpu_to_le32(dma_addr + off);
1293 dcmds->xfer_status = 0; 1293 dcmds->xfer_status = 0;
1294 ++dcmds; 1294 ++dcmds;
1295 dtot += dma_len - off; 1295 dtot += dma_len - off;
@@ -1303,15 +1303,15 @@ static void set_dma_cmds(struct mesh_state *ms, struct scsi_cmnd *cmd)
1303 static char mesh_extra_buf[64]; 1303 static char mesh_extra_buf[64];
1304 1304
1305 dtot = sizeof(mesh_extra_buf); 1305 dtot = sizeof(mesh_extra_buf);
1306 st_le16(&dcmds->req_count, dtot); 1306 dcmds->req_count = cpu_to_le16(dtot);
1307 st_le32(&dcmds->phy_addr, virt_to_phys(mesh_extra_buf)); 1307 dcmds->phy_addr = cpu_to_le32(virt_to_phys(mesh_extra_buf));
1308 dcmds->xfer_status = 0; 1308 dcmds->xfer_status = 0;
1309 ++dcmds; 1309 ++dcmds;
1310 } 1310 }
1311 dma_cmd += OUTPUT_LAST - OUTPUT_MORE; 1311 dma_cmd += OUTPUT_LAST - OUTPUT_MORE;
1312 st_le16(&dcmds[-1].command, dma_cmd); 1312 dcmds[-1].command = cpu_to_le16(dma_cmd);
1313 memset(dcmds, 0, sizeof(*dcmds)); 1313 memset(dcmds, 0, sizeof(*dcmds));
1314 st_le16(&dcmds->command, DBDMA_STOP); 1314 dcmds->command = cpu_to_le16(DBDMA_STOP);
1315 ms->dma_count = dtot; 1315 ms->dma_count = dtot;
1316} 1316}
1317 1317
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index b3dd417b4719..109462303087 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -479,7 +479,7 @@ config FB_ATARI
479 479
480config FB_OF 480config FB_OF
481 bool "Open Firmware frame buffer device support" 481 bool "Open Firmware frame buffer device support"
482 depends on (FB = y) && (PPC64 || PPC_OF) && (!PPC_PSERIES || PCI) 482 depends on (FB = y) && PPC && (!PPC_PSERIES || PCI)
483 select FB_CFB_FILLRECT 483 select FB_CFB_FILLRECT
484 select FB_CFB_COPYAREA 484 select FB_CFB_COPYAREA
485 select FB_CFB_IMAGEBLIT 485 select FB_CFB_IMAGEBLIT
@@ -1333,7 +1333,7 @@ config FB_RADEON
1333 select FB_CFB_FILLRECT 1333 select FB_CFB_FILLRECT
1334 select FB_CFB_COPYAREA 1334 select FB_CFB_COPYAREA
1335 select FB_CFB_IMAGEBLIT 1335 select FB_CFB_IMAGEBLIT
1336 select FB_MACMODES if PPC_OF 1336 select FB_MACMODES if PPC
1337 help 1337 help
1338 Choose this option if you want to use an ATI Radeon graphics card as 1338 Choose this option if you want to use an ATI Radeon graphics card as
1339 a framebuffer device. There are both PCI and AGP versions. You 1339 a framebuffer device. There are both PCI and AGP versions. You
diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c
index aedf2fbf9bf6..0156954bf340 100644
--- a/drivers/video/fbdev/aty/aty128fb.c
+++ b/drivers/video/fbdev/aty/aty128fb.c
@@ -965,7 +965,7 @@ static void __iomem *aty128_find_mem_vbios(struct aty128fb_par *par)
965/* fill in known card constants if pll_block is not available */ 965/* fill in known card constants if pll_block is not available */
966static void aty128_timings(struct aty128fb_par *par) 966static void aty128_timings(struct aty128fb_par *par)
967{ 967{
968#ifdef CONFIG_PPC_OF 968#ifdef CONFIG_PPC
969 /* instead of a table lookup, assume OF has properly 969 /* instead of a table lookup, assume OF has properly
970 * setup the PLL registers and use their values 970 * setup the PLL registers and use their values
971 * to set the XCLK values and reference divider values */ 971 * to set the XCLK values and reference divider values */
@@ -979,7 +979,7 @@ static void aty128_timings(struct aty128fb_par *par)
979 if (!par->constants.ref_clk) 979 if (!par->constants.ref_clk)
980 par->constants.ref_clk = 2950; 980 par->constants.ref_clk = 2950;
981 981
982#ifdef CONFIG_PPC_OF 982#ifdef CONFIG_PPC
983 x_mpll_ref_fb_div = aty_ld_pll(X_MPLL_REF_FB_DIV); 983 x_mpll_ref_fb_div = aty_ld_pll(X_MPLL_REF_FB_DIV);
984 xclk_cntl = aty_ld_pll(XCLK_CNTL) & 0x7; 984 xclk_cntl = aty_ld_pll(XCLK_CNTL) & 0x7;
985 Nx = (x_mpll_ref_fb_div & 0x00ff00) >> 8; 985 Nx = (x_mpll_ref_fb_div & 0x00ff00) >> 8;
diff --git a/drivers/video/fbdev/aty/radeon_base.c b/drivers/video/fbdev/aty/radeon_base.c
index 26d80a4486fb..01237c8fcdc6 100644
--- a/drivers/video/fbdev/aty/radeon_base.c
+++ b/drivers/video/fbdev/aty/radeon_base.c
@@ -74,7 +74,7 @@
74#include <asm/io.h> 74#include <asm/io.h>
75#include <linux/uaccess.h> 75#include <linux/uaccess.h>
76 76
77#ifdef CONFIG_PPC_OF 77#ifdef CONFIG_PPC
78 78
79#include <asm/pci-bridge.h> 79#include <asm/pci-bridge.h>
80#include "../macmodes.h" 80#include "../macmodes.h"
@@ -83,7 +83,7 @@
83#include <asm/btext.h> 83#include <asm/btext.h>
84#endif 84#endif
85 85
86#endif /* CONFIG_PPC_OF */ 86#endif /* CONFIG_PPC */
87 87
88#ifdef CONFIG_MTRR 88#ifdef CONFIG_MTRR
89#include <asm/mtrr.h> 89#include <asm/mtrr.h>
@@ -418,7 +418,7 @@ static int radeon_find_mem_vbios(struct radeonfb_info *rinfo)
418} 418}
419#endif 419#endif
420 420
421#if defined(CONFIG_PPC_OF) || defined(CONFIG_SPARC) 421#if defined(CONFIG_PPC) || defined(CONFIG_SPARC)
422/* 422/*
423 * Read XTAL (ref clock), SCLK and MCLK from Open Firmware device 423 * Read XTAL (ref clock), SCLK and MCLK from Open Firmware device
424 * tree. Hopefully, ATI OF driver is kind enough to fill these 424 * tree. Hopefully, ATI OF driver is kind enough to fill these
@@ -448,7 +448,7 @@ static int radeon_read_xtal_OF(struct radeonfb_info *rinfo)
448 448
449 return 0; 449 return 0;
450} 450}
451#endif /* CONFIG_PPC_OF || CONFIG_SPARC */ 451#endif /* CONFIG_PPC || CONFIG_SPARC */
452 452
453/* 453/*
454 * Read PLL infos from chip registers 454 * Read PLL infos from chip registers
@@ -653,7 +653,7 @@ static void radeon_get_pllinfo(struct radeonfb_info *rinfo)
653 rinfo->pll.ref_div = INPLL(PPLL_REF_DIV) & PPLL_REF_DIV_MASK; 653 rinfo->pll.ref_div = INPLL(PPLL_REF_DIV) & PPLL_REF_DIV_MASK;
654 654
655 655
656#if defined(CONFIG_PPC_OF) || defined(CONFIG_SPARC) 656#if defined(CONFIG_PPC) || defined(CONFIG_SPARC)
657 /* 657 /*
658 * Retrieve PLL infos from Open Firmware first 658 * Retrieve PLL infos from Open Firmware first
659 */ 659 */
@@ -661,7 +661,7 @@ static void radeon_get_pllinfo(struct radeonfb_info *rinfo)
661 printk(KERN_INFO "radeonfb: Retrieved PLL infos from Open Firmware\n"); 661 printk(KERN_INFO "radeonfb: Retrieved PLL infos from Open Firmware\n");
662 goto found; 662 goto found;
663 } 663 }
664#endif /* CONFIG_PPC_OF || CONFIG_SPARC */ 664#endif /* CONFIG_PPC || CONFIG_SPARC */
665 665
666 /* 666 /*
667 * Check out if we have an X86 which gave us some PLL informations 667 * Check out if we have an X86 which gave us some PLL informations
@@ -1910,7 +1910,7 @@ static int radeon_set_fbinfo(struct radeonfb_info *rinfo)
1910 * I put the card's memory at 0 in card space and AGP at some random high 1910 * I put the card's memory at 0 in card space and AGP at some random high
1911 * local (0xe0000000 for now) that will be changed by XFree/DRI anyway 1911 * local (0xe0000000 for now) that will be changed by XFree/DRI anyway
1912 */ 1912 */
1913#ifdef CONFIG_PPC_OF 1913#ifdef CONFIG_PPC
1914#undef SET_MC_FB_FROM_APERTURE 1914#undef SET_MC_FB_FROM_APERTURE
1915static void fixup_memory_mappings(struct radeonfb_info *rinfo) 1915static void fixup_memory_mappings(struct radeonfb_info *rinfo)
1916{ 1916{
@@ -1984,7 +1984,7 @@ static void fixup_memory_mappings(struct radeonfb_info *rinfo)
1984 ((aper_base + aper_size - 1) & 0xffff0000) | (aper_base >> 16), 1984 ((aper_base + aper_size - 1) & 0xffff0000) | (aper_base >> 16),
1985 0xffff0000 | (agp_base >> 16)); 1985 0xffff0000 | (agp_base >> 16));
1986} 1986}
1987#endif /* CONFIG_PPC_OF */ 1987#endif /* CONFIG_PPC */
1988 1988
1989 1989
1990static void radeon_identify_vram(struct radeonfb_info *rinfo) 1990static void radeon_identify_vram(struct radeonfb_info *rinfo)
@@ -2236,7 +2236,7 @@ static int radeonfb_pci_register(struct pci_dev *pdev,
2236 rinfo->family == CHIP_FAMILY_RS200) 2236 rinfo->family == CHIP_FAMILY_RS200)
2237 rinfo->errata |= CHIP_ERRATA_PLL_DELAY; 2237 rinfo->errata |= CHIP_ERRATA_PLL_DELAY;
2238 2238
2239#if defined(CONFIG_PPC_OF) || defined(CONFIG_SPARC) 2239#if defined(CONFIG_PPC) || defined(CONFIG_SPARC)
2240 /* On PPC, we obtain the OF device-node pointer to the firmware 2240 /* On PPC, we obtain the OF device-node pointer to the firmware
2241 * data for this chip 2241 * data for this chip
2242 */ 2242 */
@@ -2245,14 +2245,14 @@ static int radeonfb_pci_register(struct pci_dev *pdev,
2245 printk(KERN_WARNING "radeonfb (%s): Cannot match card to OF node !\n", 2245 printk(KERN_WARNING "radeonfb (%s): Cannot match card to OF node !\n",
2246 pci_name(rinfo->pdev)); 2246 pci_name(rinfo->pdev));
2247 2247
2248#endif /* CONFIG_PPC_OF || CONFIG_SPARC */ 2248#endif /* CONFIG_PPC || CONFIG_SPARC */
2249#ifdef CONFIG_PPC_OF 2249#ifdef CONFIG_PPC
2250 /* On PPC, the firmware sets up a memory mapping that tends 2250 /* On PPC, the firmware sets up a memory mapping that tends
2251 * to cause lockups when enabling the engine. We reconfigure 2251 * to cause lockups when enabling the engine. We reconfigure
2252 * the card internal memory mappings properly 2252 * the card internal memory mappings properly
2253 */ 2253 */
2254 fixup_memory_mappings(rinfo); 2254 fixup_memory_mappings(rinfo);
2255#endif /* CONFIG_PPC_OF */ 2255#endif /* CONFIG_PPC */
2256 2256
2257 /* Get VRAM size and type */ 2257 /* Get VRAM size and type */
2258 radeon_identify_vram(rinfo); 2258 radeon_identify_vram(rinfo);
diff --git a/drivers/video/fbdev/aty/radeon_monitor.c b/drivers/video/fbdev/aty/radeon_monitor.c
index bc078d50d8f1..f1ce229de78d 100644
--- a/drivers/video/fbdev/aty/radeon_monitor.c
+++ b/drivers/video/fbdev/aty/radeon_monitor.c
@@ -55,7 +55,7 @@ static char *radeon_get_mon_name(int type)
55} 55}
56 56
57 57
58#if defined(CONFIG_PPC_OF) || defined(CONFIG_SPARC) 58#if defined(CONFIG_PPC) || defined(CONFIG_SPARC)
59/* 59/*
60 * Try to find monitor informations & EDID data out of the Open Firmware 60 * Try to find monitor informations & EDID data out of the Open Firmware
61 * device-tree. This also contains some "hacks" to work around a few machine 61 * device-tree. This also contains some "hacks" to work around a few machine
@@ -160,7 +160,7 @@ static int radeon_probe_OF_head(struct radeonfb_info *rinfo, int head_no,
160 } 160 }
161 return MT_NONE; 161 return MT_NONE;
162} 162}
163#endif /* CONFIG_PPC_OF || CONFIG_SPARC */ 163#endif /* CONFIG_PPC || CONFIG_SPARC */
164 164
165 165
166static int radeon_get_panel_info_BIOS(struct radeonfb_info *rinfo) 166static int radeon_get_panel_info_BIOS(struct radeonfb_info *rinfo)
@@ -499,11 +499,11 @@ void radeon_probe_screens(struct radeonfb_info *rinfo,
499 * Old single head cards 499 * Old single head cards
500 */ 500 */
501 if (!rinfo->has_CRTC2) { 501 if (!rinfo->has_CRTC2) {
502#if defined(CONFIG_PPC_OF) || defined(CONFIG_SPARC) 502#if defined(CONFIG_PPC) || defined(CONFIG_SPARC)
503 if (rinfo->mon1_type == MT_NONE) 503 if (rinfo->mon1_type == MT_NONE)
504 rinfo->mon1_type = radeon_probe_OF_head(rinfo, 0, 504 rinfo->mon1_type = radeon_probe_OF_head(rinfo, 0,
505 &rinfo->mon1_EDID); 505 &rinfo->mon1_EDID);
506#endif /* CONFIG_PPC_OF || CONFIG_SPARC */ 506#endif /* CONFIG_PPC || CONFIG_SPARC */
507#ifdef CONFIG_FB_RADEON_I2C 507#ifdef CONFIG_FB_RADEON_I2C
508 if (rinfo->mon1_type == MT_NONE) 508 if (rinfo->mon1_type == MT_NONE)
509 rinfo->mon1_type = 509 rinfo->mon1_type =
@@ -548,11 +548,11 @@ void radeon_probe_screens(struct radeonfb_info *rinfo,
548 /* 548 /*
549 * Probe primary head (DVI or laptop internal panel) 549 * Probe primary head (DVI or laptop internal panel)
550 */ 550 */
551#if defined(CONFIG_PPC_OF) || defined(CONFIG_SPARC) 551#if defined(CONFIG_PPC) || defined(CONFIG_SPARC)
552 if (rinfo->mon1_type == MT_NONE) 552 if (rinfo->mon1_type == MT_NONE)
553 rinfo->mon1_type = radeon_probe_OF_head(rinfo, 0, 553 rinfo->mon1_type = radeon_probe_OF_head(rinfo, 0,
554 &rinfo->mon1_EDID); 554 &rinfo->mon1_EDID);
555#endif /* CONFIG_PPC_OF || CONFIG_SPARC */ 555#endif /* CONFIG_PPC || CONFIG_SPARC */
556#ifdef CONFIG_FB_RADEON_I2C 556#ifdef CONFIG_FB_RADEON_I2C
557 if (rinfo->mon1_type == MT_NONE) 557 if (rinfo->mon1_type == MT_NONE)
558 rinfo->mon1_type = radeon_probe_i2c_connector(rinfo, ddc_dvi, 558 rinfo->mon1_type = radeon_probe_i2c_connector(rinfo, ddc_dvi,
@@ -576,11 +576,11 @@ void radeon_probe_screens(struct radeonfb_info *rinfo,
576 /* 576 /*
577 * Probe secondary head (mostly VGA, can be DVI) 577 * Probe secondary head (mostly VGA, can be DVI)
578 */ 578 */
579#if defined(CONFIG_PPC_OF) || defined(CONFIG_SPARC) 579#if defined(CONFIG_PPC) || defined(CONFIG_SPARC)
580 if (rinfo->mon2_type == MT_NONE) 580 if (rinfo->mon2_type == MT_NONE)
581 rinfo->mon2_type = radeon_probe_OF_head(rinfo, 1, 581 rinfo->mon2_type = radeon_probe_OF_head(rinfo, 1,
582 &rinfo->mon2_EDID); 582 &rinfo->mon2_EDID);
583#endif /* CONFIG_PPC_OF || defined(CONFIG_SPARC) */ 583#endif /* CONFIG_PPC || defined(CONFIG_SPARC) */
584#ifdef CONFIG_FB_RADEON_I2C 584#ifdef CONFIG_FB_RADEON_I2C
585 if (rinfo->mon2_type == MT_NONE) 585 if (rinfo->mon2_type == MT_NONE)
586 rinfo->mon2_type = radeon_probe_i2c_connector(rinfo, ddc_vga, 586 rinfo->mon2_type = radeon_probe_i2c_connector(rinfo, ddc_vga,
@@ -653,7 +653,7 @@ void radeon_probe_screens(struct radeonfb_info *rinfo,
653 */ 653 */
654static void radeon_fixup_panel_info(struct radeonfb_info *rinfo) 654static void radeon_fixup_panel_info(struct radeonfb_info *rinfo)
655{ 655{
656#ifdef CONFIG_PPC_OF 656#ifdef CONFIG_PPC
657 /* 657 /*
658 * LCD Flat panels should use fixed dividers, we enfore that on 658 * LCD Flat panels should use fixed dividers, we enfore that on
659 * PPC only for now... 659 * PPC only for now...
@@ -676,7 +676,7 @@ static void radeon_fixup_panel_info(struct radeonfb_info *rinfo)
676 (rinfo->panel_info.post_divider << 16), 676 (rinfo->panel_info.post_divider << 16),
677 ppll_div_sel); 677 ppll_div_sel);
678 } 678 }
679#endif /* CONFIG_PPC_OF */ 679#endif /* CONFIG_PPC */
680} 680}
681 681
682 682
diff --git a/drivers/video/fbdev/aty/radeon_pm.c b/drivers/video/fbdev/aty/radeon_pm.c
index 46a12f1a93c3..1417542738fc 100644
--- a/drivers/video/fbdev/aty/radeon_pm.c
+++ b/drivers/video/fbdev/aty/radeon_pm.c
@@ -523,7 +523,7 @@ static void radeon_pm_enable_dynamic_mode(struct radeonfb_info *rinfo)
523 OUTPLL(pllVCLK_ECP_CNTL, tmp); 523 OUTPLL(pllVCLK_ECP_CNTL, tmp);
524 524
525 /* X doesn't do that ... hrm, we do on mobility && Macs */ 525 /* X doesn't do that ... hrm, we do on mobility && Macs */
526#ifdef CONFIG_PPC_OF 526#ifdef CONFIG_PPC
527 if (rinfo->is_mobility) { 527 if (rinfo->is_mobility) {
528 tmp = INPLL(pllMCLK_CNTL); 528 tmp = INPLL(pllMCLK_CNTL);
529 tmp &= ~(MCLK_CNTL__FORCE_MCLKA | 529 tmp &= ~(MCLK_CNTL__FORCE_MCLKA |
@@ -541,7 +541,7 @@ static void radeon_pm_enable_dynamic_mode(struct radeonfb_info *rinfo)
541 OUTPLL(pllMCLK_MISC, tmp); 541 OUTPLL(pllMCLK_MISC, tmp);
542 radeon_msleep(15); 542 radeon_msleep(15);
543 } 543 }
544#endif /* CONFIG_PPC_OF */ 544#endif /* CONFIG_PPC */
545} 545}
546 546
547#ifdef CONFIG_PM 547#ifdef CONFIG_PM
@@ -1288,7 +1288,7 @@ static void radeon_pm_full_reset_sdram(struct radeonfb_info *rinfo)
1288 radeon_pm_enable_dll_m10(rinfo); 1288 radeon_pm_enable_dll_m10(rinfo);
1289 radeon_pm_yclk_mclk_sync_m10(rinfo); 1289 radeon_pm_yclk_mclk_sync_m10(rinfo);
1290 1290
1291#ifdef CONFIG_PPC_OF 1291#ifdef CONFIG_PPC
1292 if (rinfo->of_node != NULL) { 1292 if (rinfo->of_node != NULL) {
1293 int size; 1293 int size;
1294 1294
@@ -1298,7 +1298,7 @@ static void radeon_pm_full_reset_sdram(struct radeonfb_info *rinfo)
1298 else 1298 else
1299 mrtable = default_mrtable; 1299 mrtable = default_mrtable;
1300 } 1300 }
1301#endif /* CONFIG_PPC_OF */ 1301#endif /* CONFIG_PPC */
1302 1302
1303 /* Program the SDRAM */ 1303 /* Program the SDRAM */
1304 sdram_mode_reg = mrtable[0]; 1304 sdram_mode_reg = mrtable[0];
@@ -1943,7 +1943,7 @@ static void radeon_reinitialize_M10(struct radeonfb_info *rinfo)
1943} 1943}
1944#endif 1944#endif
1945 1945
1946#ifdef CONFIG_PPC_OF 1946#ifdef CONFIG_PPC
1947#ifdef CONFIG_PPC_PMAC 1947#ifdef CONFIG_PPC_PMAC
1948static void radeon_pm_m9p_reconfigure_mc(struct radeonfb_info *rinfo) 1948static void radeon_pm_m9p_reconfigure_mc(struct radeonfb_info *rinfo)
1949{ 1949{
@@ -2512,7 +2512,7 @@ static void radeon_reinitialize_QW(struct radeonfb_info *rinfo)
2512} 2512}
2513#endif /* 0 */ 2513#endif /* 0 */
2514 2514
2515#endif /* CONFIG_PPC_OF */ 2515#endif /* CONFIG_PPC */
2516 2516
2517static void radeonfb_whack_power_state(struct radeonfb_info *rinfo, pci_power_t state) 2517static void radeonfb_whack_power_state(struct radeonfb_info *rinfo, pci_power_t state)
2518{ 2518{
@@ -2793,7 +2793,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
2793 return rc; 2793 return rc;
2794} 2794}
2795 2795
2796#ifdef CONFIG_PPC_OF__disabled 2796#ifdef CONFIG_PPC__disabled
2797static void radeonfb_early_resume(void *data) 2797static void radeonfb_early_resume(void *data)
2798{ 2798{
2799 struct radeonfb_info *rinfo = data; 2799 struct radeonfb_info *rinfo = data;
@@ -2803,7 +2803,7 @@ static void radeonfb_early_resume(void *data)
2803 radeonfb_pci_resume(rinfo->pdev); 2803 radeonfb_pci_resume(rinfo->pdev);
2804 rinfo->no_schedule = 0; 2804 rinfo->no_schedule = 0;
2805} 2805}
2806#endif /* CONFIG_PPC_OF */ 2806#endif /* CONFIG_PPC */
2807 2807
2808#endif /* CONFIG_PM */ 2808#endif /* CONFIG_PM */
2809 2809
diff --git a/drivers/video/fbdev/aty/radeonfb.h b/drivers/video/fbdev/aty/radeonfb.h
index cb846044f57c..039def41c920 100644
--- a/drivers/video/fbdev/aty/radeonfb.h
+++ b/drivers/video/fbdev/aty/radeonfb.h
@@ -20,7 +20,7 @@
20 20
21#include <asm/io.h> 21#include <asm/io.h>
22 22
23#if defined(CONFIG_PPC_OF) || defined(CONFIG_SPARC) 23#if defined(CONFIG_PPC) || defined(CONFIG_SPARC)
24#include <asm/prom.h> 24#include <asm/prom.h>
25#endif 25#endif
26 26
@@ -301,7 +301,7 @@ struct radeonfb_info {
301 unsigned long fb_local_base; 301 unsigned long fb_local_base;
302 302
303 struct pci_dev *pdev; 303 struct pci_dev *pdev;
304#if defined(CONFIG_PPC_OF) || defined(CONFIG_SPARC) 304#if defined(CONFIG_PPC) || defined(CONFIG_SPARC)
305 struct device_node *of_node; 305 struct device_node *of_node;
306#endif 306#endif
307 307
diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c
index 080fdd2a70f3..8d14b29aafea 100644
--- a/drivers/video/fbdev/controlfb.c
+++ b/drivers/video/fbdev/controlfb.c
@@ -315,7 +315,7 @@ static int controlfb_blank(int blank_mode, struct fb_info *info)
315 container_of(info, struct fb_info_control, info); 315 container_of(info, struct fb_info_control, info);
316 unsigned ctrl; 316 unsigned ctrl;
317 317
318 ctrl = ld_le32(CNTRL_REG(p,ctrl)); 318 ctrl = le32_to_cpup(CNTRL_REG(p,ctrl));
319 if (blank_mode > 0) 319 if (blank_mode > 0)
320 switch (blank_mode) { 320 switch (blank_mode) {
321 case FB_BLANK_VSYNC_SUSPEND: 321 case FB_BLANK_VSYNC_SUSPEND:
diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c
index 868facdec638..01ef1b953390 100644
--- a/drivers/video/fbdev/core/fbmon.c
+++ b/drivers/video/fbdev/core/fbmon.c
@@ -33,10 +33,6 @@
33#include <video/edid.h> 33#include <video/edid.h>
34#include <video/of_videomode.h> 34#include <video/of_videomode.h>
35#include <video/videomode.h> 35#include <video/videomode.h>
36#ifdef CONFIG_PPC_OF
37#include <asm/prom.h>
38#include <asm/pci-bridge.h>
39#endif
40#include "../edid.h" 36#include "../edid.h"
41 37
42/* 38/*
diff --git a/drivers/video/fbdev/imsttfb.c b/drivers/video/fbdev/imsttfb.c
index aae10ce74f14..9b167f7ef6c6 100644
--- a/drivers/video/fbdev/imsttfb.c
+++ b/drivers/video/fbdev/imsttfb.c
@@ -1470,15 +1470,13 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1470 unsigned long addr, size; 1470 unsigned long addr, size;
1471 struct imstt_par *par; 1471 struct imstt_par *par;
1472 struct fb_info *info; 1472 struct fb_info *info;
1473#ifdef CONFIG_PPC_OF
1474 struct device_node *dp; 1473 struct device_node *dp;
1475 1474
1476 dp = pci_device_to_OF_node(pdev); 1475 dp = pci_device_to_OF_node(pdev);
1477 if(dp) 1476 if(dp)
1478 printk(KERN_INFO "%s: OF name %s\n",__func__, dp->name); 1477 printk(KERN_INFO "%s: OF name %s\n",__func__, dp->name);
1479 else 1478 else if (IS_ENABLED(CONFIG_OF))
1480 printk(KERN_ERR "imsttfb: no OF node for pci device\n"); 1479 printk(KERN_ERR "imsttfb: no OF node for pci device\n");
1481#endif /* CONFIG_PPC_OF */
1482 1480
1483 info = framebuffer_alloc(sizeof(struct imstt_par), &pdev->dev); 1481 info = framebuffer_alloc(sizeof(struct imstt_par), &pdev->dev);
1484 1482
@@ -1501,11 +1499,9 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1501 switch (pdev->device) { 1499 switch (pdev->device) {
1502 case PCI_DEVICE_ID_IMS_TT128: /* IMS,tt128mbA */ 1500 case PCI_DEVICE_ID_IMS_TT128: /* IMS,tt128mbA */
1503 par->ramdac = IBM; 1501 par->ramdac = IBM;
1504#ifdef CONFIG_PPC_OF
1505 if (dp && ((strcmp(dp->name, "IMS,tt128mb8") == 0) || 1502 if (dp && ((strcmp(dp->name, "IMS,tt128mb8") == 0) ||
1506 (strcmp(dp->name, "IMS,tt128mb8A") == 0))) 1503 (strcmp(dp->name, "IMS,tt128mb8A") == 0)))
1507 par->ramdac = TVP; 1504 par->ramdac = TVP;
1508#endif /* CONFIG_PPC_OF */
1509 break; 1505 break;
1510 case PCI_DEVICE_ID_IMS_TT3D: /* IMS,tt3d */ 1506 case PCI_DEVICE_ID_IMS_TT3D: /* IMS,tt3d */
1511 par->ramdac = TVP; 1507 par->ramdac = TVP;
diff --git a/drivers/video/fbdev/nvidia/Makefile b/drivers/video/fbdev/nvidia/Makefile
index ca47432113e0..917d3eb05feb 100644
--- a/drivers/video/fbdev/nvidia/Makefile
+++ b/drivers/video/fbdev/nvidia/Makefile
@@ -5,9 +5,8 @@
5obj-$(CONFIG_FB_NVIDIA) += nvidiafb.o 5obj-$(CONFIG_FB_NVIDIA) += nvidiafb.o
6 6
7nvidiafb-y := nvidia.o nv_hw.o nv_setup.o \ 7nvidiafb-y := nvidia.o nv_hw.o nv_setup.o \
8 nv_accel.o 8 nv_accel.o nv_of.o
9nvidiafb-$(CONFIG_FB_NVIDIA_I2C) += nv_i2c.o 9nvidiafb-$(CONFIG_FB_NVIDIA_I2C) += nv_i2c.o
10nvidiafb-$(CONFIG_FB_NVIDIA_BACKLIGHT) += nv_backlight.o 10nvidiafb-$(CONFIG_FB_NVIDIA_BACKLIGHT) += nv_backlight.o
11nvidiafb-$(CONFIG_PPC_OF) += nv_of.o
12 11
13nvidiafb-objs := $(nvidiafb-y) 12nvidiafb-objs := $(nvidiafb-y)
diff --git a/drivers/video/fbdev/nvidia/nv_of.c b/drivers/video/fbdev/nvidia/nv_of.c
index 3bc13df4b120..5f3e5179c25a 100644
--- a/drivers/video/fbdev/nvidia/nv_of.c
+++ b/drivers/video/fbdev/nvidia/nv_of.c
@@ -19,9 +19,6 @@
19 19
20#include <asm/io.h> 20#include <asm/io.h>
21 21
22#include <asm/prom.h>
23#include <asm/pci-bridge.h>
24
25#include "nv_type.h" 22#include "nv_type.h"
26#include "nv_local.h" 23#include "nv_local.h"
27#include "nv_proto.h" 24#include "nv_proto.h"
diff --git a/drivers/video/fbdev/nvidia/nv_proto.h b/drivers/video/fbdev/nvidia/nv_proto.h
index ff5c410355ea..878a5ce02299 100644
--- a/drivers/video/fbdev/nvidia/nv_proto.h
+++ b/drivers/video/fbdev/nvidia/nv_proto.h
@@ -42,16 +42,8 @@ int nvidia_probe_i2c_connector(struct fb_info *info, int conn,
42#define nvidia_probe_i2c_connector(p, c, edid) (-1) 42#define nvidia_probe_i2c_connector(p, c, edid) (-1)
43#endif 43#endif
44 44
45#ifdef CONFIG_PPC_OF
46int nvidia_probe_of_connector(struct fb_info *info, int conn, 45int nvidia_probe_of_connector(struct fb_info *info, int conn,
47 u8 ** out_edid); 46 u8 ** out_edid);
48#else
49static inline int nvidia_probe_of_connector(struct fb_info *info, int conn,
50 u8 ** out_edid)
51{
52 return -1;
53}
54#endif
55 47
56/* in nv_accel.c */ 48/* in nv_accel.c */
57extern void NVResetGraphics(struct fb_info *info); 49extern void NVResetGraphics(struct fb_info *info);
diff --git a/drivers/video/fbdev/nvidia/nvidia.c b/drivers/video/fbdev/nvidia/nvidia.c
index def041204676..4273c6ee8cf6 100644
--- a/drivers/video/fbdev/nvidia/nvidia.c
+++ b/drivers/video/fbdev/nvidia/nvidia.c
@@ -24,10 +24,6 @@
24#ifdef CONFIG_MTRR 24#ifdef CONFIG_MTRR
25#include <asm/mtrr.h> 25#include <asm/mtrr.h>
26#endif 26#endif
27#ifdef CONFIG_PPC_OF
28#include <asm/prom.h>
29#include <asm/pci-bridge.h>
30#endif
31#ifdef CONFIG_BOOTX_TEXT 27#ifdef CONFIG_BOOTX_TEXT
32#include <asm/btext.h> 28#include <asm/btext.h>
33#endif 29#endif
diff --git a/drivers/video/fbdev/platinumfb.c b/drivers/video/fbdev/platinumfb.c
index 518d1fd38a81..377d3399a3ad 100644
--- a/drivers/video/fbdev/platinumfb.c
+++ b/drivers/video/fbdev/platinumfb.c
@@ -168,7 +168,7 @@ static int platinumfb_blank(int blank, struct fb_info *fb)
168 struct fb_info_platinum *info = (struct fb_info_platinum *) fb; 168 struct fb_info_platinum *info = (struct fb_info_platinum *) fb;
169 int ctrl; 169 int ctrl;
170 170
171 ctrl = ld_le32(&info->platinum_regs->ctrl.r) | 0x33; 171 ctrl = le32_to_cpup(&info->platinum_regs->ctrl.r) | 0x33;
172 if (blank) 172 if (blank)
173 --blank_mode; 173 --blank_mode;
174 if (blank & VESA_VSYNC_SUSPEND) 174 if (blank & VESA_VSYNC_SUSPEND)
diff --git a/drivers/video/fbdev/riva/fbdev.c b/drivers/video/fbdev/riva/fbdev.c
index be73727c7227..294a80908c8c 100644
--- a/drivers/video/fbdev/riva/fbdev.c
+++ b/drivers/video/fbdev/riva/fbdev.c
@@ -44,10 +44,6 @@
44#ifdef CONFIG_MTRR 44#ifdef CONFIG_MTRR
45#include <asm/mtrr.h> 45#include <asm/mtrr.h>
46#endif 46#endif
47#ifdef CONFIG_PPC_OF
48#include <asm/prom.h>
49#include <asm/pci-bridge.h>
50#endif
51#ifdef CONFIG_PMAC_BACKLIGHT 47#ifdef CONFIG_PMAC_BACKLIGHT
52#include <asm/machdep.h> 48#include <asm/machdep.h>
53#include <asm/backlight.h> 49#include <asm/backlight.h>
@@ -1735,7 +1731,6 @@ static int riva_set_fbinfo(struct fb_info *info)
1735 return (rivafb_check_var(&info->var, info)); 1731 return (rivafb_check_var(&info->var, info));
1736} 1732}
1737 1733
1738#ifdef CONFIG_PPC_OF
1739static int riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd) 1734static int riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd)
1740{ 1735{
1741 struct riva_par *par = info->par; 1736 struct riva_par *par = info->par;
@@ -1766,9 +1761,8 @@ static int riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd)
1766 NVTRACE_LEAVE(); 1761 NVTRACE_LEAVE();
1767 return 0; 1762 return 0;
1768} 1763}
1769#endif /* CONFIG_PPC_OF */
1770 1764
1771#if defined(CONFIG_FB_RIVA_I2C) && !defined(CONFIG_PPC_OF) 1765#if defined(CONFIG_FB_RIVA_I2C)
1772static int riva_get_EDID_i2c(struct fb_info *info) 1766static int riva_get_EDID_i2c(struct fb_info *info)
1773{ 1767{
1774 struct riva_par *par = info->par; 1768 struct riva_par *par = info->par;
@@ -1828,10 +1822,13 @@ static void riva_update_default_var(struct fb_var_screeninfo *var,
1828static void riva_get_EDID(struct fb_info *info, struct pci_dev *pdev) 1822static void riva_get_EDID(struct fb_info *info, struct pci_dev *pdev)
1829{ 1823{
1830 NVTRACE_ENTER(); 1824 NVTRACE_ENTER();
1831#ifdef CONFIG_PPC_OF 1825 if (riva_get_EDID_OF(info, pdev)) {
1832 if (!riva_get_EDID_OF(info, pdev)) 1826 NVTRACE_LEAVE();
1827 return;
1828 }
1829 if (IS_ENABLED(CONFIG_OF))
1833 printk(PFX "could not retrieve EDID from OF\n"); 1830 printk(PFX "could not retrieve EDID from OF\n");
1834#elif defined(CONFIG_FB_RIVA_I2C) 1831#if defined(CONFIG_FB_RIVA_I2C)
1835 if (!riva_get_EDID_i2c(info)) 1832 if (!riva_get_EDID_i2c(info))
1836 printk(PFX "could not retrieve EDID from DDC/I2C\n"); 1833 printk(PFX "could not retrieve EDID from DDC/I2C\n");
1837#endif 1834#endif