aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/viodasd.c9
-rw-r--r--drivers/cdrom/viocd.c9
-rw-r--r--drivers/char/hvc_vio.c2
-rw-r--r--drivers/char/hvcs.c5
-rw-r--r--drivers/char/mem.c4
-rw-r--r--drivers/char/viotape.c9
-rw-r--r--drivers/ide/ppc/pmac.c80
-rw-r--r--drivers/macintosh/ans-lcd.c10
-rw-r--r--drivers/macintosh/apm_emu.c8
-rw-r--r--drivers/macintosh/macio_sysfs.c26
-rw-r--r--drivers/macintosh/mediabay.c56
-rw-r--r--drivers/macintosh/smu.c4
-rw-r--r--drivers/macintosh/via-cuda.c1
-rw-r--r--drivers/macintosh/via-pmu.c142
-rw-r--r--drivers/macintosh/via-pmu68k.c15
-rw-r--r--drivers/net/bmac.c1
-rw-r--r--drivers/net/ibmveth.c14
-rw-r--r--drivers/net/iseries_veth.c18
-rw-r--r--drivers/net/mace.c1
-rw-r--r--drivers/net/mv643xx_eth.c3
-rw-r--r--drivers/pcmcia/Kconfig10
-rw-r--r--drivers/pcmcia/Makefile1
-rw-r--r--drivers/pcmcia/m8xx_pcmcia.c1290
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c9
-rw-r--r--drivers/video/fbmem.c2
25 files changed, 1535 insertions, 194 deletions
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c
index e46ecd23b3ac..709f809f79f1 100644
--- a/drivers/block/viodasd.c
+++ b/drivers/block/viodasd.c
@@ -778,13 +778,16 @@ static struct vio_device_id viodasd_device_table[] __devinitdata = {
778 { "viodasd", "" }, 778 { "viodasd", "" },
779 { "", "" } 779 { "", "" }
780}; 780};
781
782MODULE_DEVICE_TABLE(vio, viodasd_device_table); 781MODULE_DEVICE_TABLE(vio, viodasd_device_table);
782
783static struct vio_driver viodasd_driver = { 783static struct vio_driver viodasd_driver = {
784 .name = "viodasd",
785 .id_table = viodasd_device_table, 784 .id_table = viodasd_device_table,
786 .probe = viodasd_probe, 785 .probe = viodasd_probe,
787 .remove = viodasd_remove 786 .remove = viodasd_remove,
787 .driver = {
788 .name = "viodasd",
789 .owner = THIS_MODULE,
790 }
788}; 791};
789 792
790/* 793/*
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
index 0829db58462f..36f31d202223 100644
--- a/drivers/cdrom/viocd.c
+++ b/drivers/cdrom/viocd.c
@@ -736,13 +736,16 @@ static struct vio_device_id viocd_device_table[] __devinitdata = {
736 { "viocd", "" }, 736 { "viocd", "" },
737 { "", "" } 737 { "", "" }
738}; 738};
739
740MODULE_DEVICE_TABLE(vio, viocd_device_table); 739MODULE_DEVICE_TABLE(vio, viocd_device_table);
740
741static struct vio_driver viocd_driver = { 741static struct vio_driver viocd_driver = {
742 .name = "viocd",
743 .id_table = viocd_device_table, 742 .id_table = viocd_device_table,
744 .probe = viocd_probe, 743 .probe = viocd_probe,
745 .remove = viocd_remove 744 .remove = viocd_remove,
745 .driver = {
746 .name = "viocd",
747 .owner = THIS_MODULE,
748 }
746}; 749};
747 750
748static int __init viocd_init(void) 751static int __init viocd_init(void)
diff --git a/drivers/char/hvc_vio.c b/drivers/char/hvc_vio.c
index 78d681dc35a8..f5212eb2b41d 100644
--- a/drivers/char/hvc_vio.c
+++ b/drivers/char/hvc_vio.c
@@ -95,11 +95,11 @@ static int __devexit hvc_vio_remove(struct vio_dev *vdev)
95} 95}
96 96
97static struct vio_driver hvc_vio_driver = { 97static struct vio_driver hvc_vio_driver = {
98 .name = hvc_driver_name,
99 .id_table = hvc_driver_table, 98 .id_table = hvc_driver_table,
100 .probe = hvc_vio_probe, 99 .probe = hvc_vio_probe,
101 .remove = hvc_vio_remove, 100 .remove = hvc_vio_remove,
102 .driver = { 101 .driver = {
102 .name = hvc_driver_name,
103 .owner = THIS_MODULE, 103 .owner = THIS_MODULE,
104 } 104 }
105}; 105};
diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c
index f47f009f9259..53dc77c760fc 100644
--- a/drivers/char/hvcs.c
+++ b/drivers/char/hvcs.c
@@ -720,10 +720,13 @@ static int __devexit hvcs_remove(struct vio_dev *dev)
720}; 720};
721 721
722static struct vio_driver hvcs_vio_driver = { 722static struct vio_driver hvcs_vio_driver = {
723 .name = hvcs_driver_name,
724 .id_table = hvcs_driver_table, 723 .id_table = hvcs_driver_table,
725 .probe = hvcs_probe, 724 .probe = hvcs_probe,
726 .remove = hvcs_remove, 725 .remove = hvcs_remove,
726 .driver = {
727 .name = hvcs_driver_name,
728 .owner = THIS_MODULE,
729 }
727}; 730};
728 731
729/* Only called from hvcs_get_pi please */ 732/* Only called from hvcs_get_pi please */
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 38be4b0dbd1c..91dd669273e0 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -231,9 +231,7 @@ static ssize_t write_mem(struct file * file, const char __user * buf,
231static int mmap_mem(struct file * file, struct vm_area_struct * vma) 231static int mmap_mem(struct file * file, struct vm_area_struct * vma)
232{ 232{
233#if defined(__HAVE_PHYS_MEM_ACCESS_PROT) 233#if defined(__HAVE_PHYS_MEM_ACCESS_PROT)
234 unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; 234 vma->vm_page_prot = phys_mem_access_prot(file, vma->vm_pgoff,
235
236 vma->vm_page_prot = phys_mem_access_prot(file, offset,
237 vma->vm_end - vma->vm_start, 235 vma->vm_end - vma->vm_start,
238 vma->vm_page_prot); 236 vma->vm_page_prot);
239#elif defined(pgprot_noncached) 237#elif defined(pgprot_noncached)
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c
index a5e104f428f8..51abd3defc1c 100644
--- a/drivers/char/viotape.c
+++ b/drivers/char/viotape.c
@@ -993,13 +993,16 @@ static struct vio_device_id viotape_device_table[] __devinitdata = {
993 { "viotape", "" }, 993 { "viotape", "" },
994 { "", "" } 994 { "", "" }
995}; 995};
996
997MODULE_DEVICE_TABLE(vio, viotape_device_table); 996MODULE_DEVICE_TABLE(vio, viotape_device_table);
997
998static struct vio_driver viotape_driver = { 998static struct vio_driver viotape_driver = {
999 .name = "viotape",
1000 .id_table = viotape_device_table, 999 .id_table = viotape_device_table,
1001 .probe = viotape_probe, 1000 .probe = viotape_probe,
1002 .remove = viotape_remove 1001 .remove = viotape_remove,
1002 .driver = {
1003 .name = "viotape",
1004 .owner = THIS_MODULE,
1005 }
1003}; 1006};
1004 1007
1005 1008
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 87d1f8a1f41e..d8c3d8ebad30 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -81,7 +81,7 @@ typedef struct pmac_ide_hwif {
81 81
82} pmac_ide_hwif_t; 82} pmac_ide_hwif_t;
83 83
84static pmac_ide_hwif_t pmac_ide[MAX_HWIFS] __pmacdata; 84static pmac_ide_hwif_t pmac_ide[MAX_HWIFS];
85static int pmac_ide_count; 85static int pmac_ide_count;
86 86
87enum { 87enum {
@@ -242,7 +242,7 @@ struct mdma_timings_t {
242 int cycleTime; 242 int cycleTime;
243}; 243};
244 244
245struct mdma_timings_t mdma_timings_33[] __pmacdata = 245struct mdma_timings_t mdma_timings_33[] =
246{ 246{
247 { 240, 240, 480 }, 247 { 240, 240, 480 },
248 { 180, 180, 360 }, 248 { 180, 180, 360 },
@@ -255,7 +255,7 @@ struct mdma_timings_t mdma_timings_33[] __pmacdata =
255 { 0, 0, 0 } 255 { 0, 0, 0 }
256}; 256};
257 257
258struct mdma_timings_t mdma_timings_33k[] __pmacdata = 258struct mdma_timings_t mdma_timings_33k[] =
259{ 259{
260 { 240, 240, 480 }, 260 { 240, 240, 480 },
261 { 180, 180, 360 }, 261 { 180, 180, 360 },
@@ -268,7 +268,7 @@ struct mdma_timings_t mdma_timings_33k[] __pmacdata =
268 { 0, 0, 0 } 268 { 0, 0, 0 }
269}; 269};
270 270
271struct mdma_timings_t mdma_timings_66[] __pmacdata = 271struct mdma_timings_t mdma_timings_66[] =
272{ 272{
273 { 240, 240, 480 }, 273 { 240, 240, 480 },
274 { 180, 180, 360 }, 274 { 180, 180, 360 },
@@ -286,7 +286,7 @@ struct {
286 int addrSetup; /* ??? */ 286 int addrSetup; /* ??? */
287 int rdy2pause; 287 int rdy2pause;
288 int wrDataSetup; 288 int wrDataSetup;
289} kl66_udma_timings[] __pmacdata = 289} kl66_udma_timings[] =
290{ 290{
291 { 0, 180, 120 }, /* Mode 0 */ 291 { 0, 180, 120 }, /* Mode 0 */
292 { 0, 150, 90 }, /* 1 */ 292 { 0, 150, 90 }, /* 1 */
@@ -301,7 +301,7 @@ struct kauai_timing {
301 u32 timing_reg; 301 u32 timing_reg;
302}; 302};
303 303
304static struct kauai_timing kauai_pio_timings[] __pmacdata = 304static struct kauai_timing kauai_pio_timings[] =
305{ 305{
306 { 930 , 0x08000fff }, 306 { 930 , 0x08000fff },
307 { 600 , 0x08000a92 }, 307 { 600 , 0x08000a92 },
@@ -316,7 +316,7 @@ static struct kauai_timing kauai_pio_timings[] __pmacdata =
316 { 120 , 0x04000148 } 316 { 120 , 0x04000148 }
317}; 317};
318 318
319static struct kauai_timing kauai_mdma_timings[] __pmacdata = 319static struct kauai_timing kauai_mdma_timings[] =
320{ 320{
321 { 1260 , 0x00fff000 }, 321 { 1260 , 0x00fff000 },
322 { 480 , 0x00618000 }, 322 { 480 , 0x00618000 },
@@ -330,7 +330,7 @@ static struct kauai_timing kauai_mdma_timings[] __pmacdata =
330 { 0 , 0 }, 330 { 0 , 0 },
331}; 331};
332 332
333static struct kauai_timing kauai_udma_timings[] __pmacdata = 333static struct kauai_timing kauai_udma_timings[] =
334{ 334{
335 { 120 , 0x000070c0 }, 335 { 120 , 0x000070c0 },
336 { 90 , 0x00005d80 }, 336 { 90 , 0x00005d80 },
@@ -341,7 +341,7 @@ static struct kauai_timing kauai_udma_timings[] __pmacdata =
341 { 0 , 0 }, 341 { 0 , 0 },
342}; 342};
343 343
344static struct kauai_timing shasta_pio_timings[] __pmacdata = 344static struct kauai_timing shasta_pio_timings[] =
345{ 345{
346 { 930 , 0x08000fff }, 346 { 930 , 0x08000fff },
347 { 600 , 0x0A000c97 }, 347 { 600 , 0x0A000c97 },
@@ -356,7 +356,7 @@ static struct kauai_timing shasta_pio_timings[] __pmacdata =
356 { 120 , 0x0400010a } 356 { 120 , 0x0400010a }
357}; 357};
358 358
359static struct kauai_timing shasta_mdma_timings[] __pmacdata = 359static struct kauai_timing shasta_mdma_timings[] =
360{ 360{
361 { 1260 , 0x00fff000 }, 361 { 1260 , 0x00fff000 },
362 { 480 , 0x00820800 }, 362 { 480 , 0x00820800 },
@@ -370,7 +370,7 @@ static struct kauai_timing shasta_mdma_timings[] __pmacdata =
370 { 0 , 0 }, 370 { 0 , 0 },
371}; 371};
372 372
373static struct kauai_timing shasta_udma133_timings[] __pmacdata = 373static struct kauai_timing shasta_udma133_timings[] =
374{ 374{
375 { 120 , 0x00035901, }, 375 { 120 , 0x00035901, },
376 { 90 , 0x000348b1, }, 376 { 90 , 0x000348b1, },
@@ -522,7 +522,7 @@ pmu_hd_blink_init(void)
522 * N.B. this can't be an initfunc, because the media-bay task can 522 * N.B. this can't be an initfunc, because the media-bay task can
523 * call ide_[un]register at any time. 523 * call ide_[un]register at any time.
524 */ 524 */
525void __pmac 525void
526pmac_ide_init_hwif_ports(hw_regs_t *hw, 526pmac_ide_init_hwif_ports(hw_regs_t *hw,
527 unsigned long data_port, unsigned long ctrl_port, 527 unsigned long data_port, unsigned long ctrl_port,
528 int *irq) 528 int *irq)
@@ -559,7 +559,7 @@ pmac_ide_init_hwif_ports(hw_regs_t *hw,
559 * timing register when selecting that unit. This version is for 559 * timing register when selecting that unit. This version is for
560 * ASICs with a single timing register 560 * ASICs with a single timing register
561 */ 561 */
562static void __pmac 562static void
563pmac_ide_selectproc(ide_drive_t *drive) 563pmac_ide_selectproc(ide_drive_t *drive)
564{ 564{
565 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; 565 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
@@ -579,7 +579,7 @@ pmac_ide_selectproc(ide_drive_t *drive)
579 * timing register when selecting that unit. This version is for 579 * timing register when selecting that unit. This version is for
580 * ASICs with a dual timing register (Kauai) 580 * ASICs with a dual timing register (Kauai)
581 */ 581 */
582static void __pmac 582static void
583pmac_ide_kauai_selectproc(ide_drive_t *drive) 583pmac_ide_kauai_selectproc(ide_drive_t *drive)
584{ 584{
585 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; 585 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
@@ -600,7 +600,7 @@ pmac_ide_kauai_selectproc(ide_drive_t *drive)
600/* 600/*
601 * Force an update of controller timing values for a given drive 601 * Force an update of controller timing values for a given drive
602 */ 602 */
603static void __pmac 603static void
604pmac_ide_do_update_timings(ide_drive_t *drive) 604pmac_ide_do_update_timings(ide_drive_t *drive)
605{ 605{
606 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; 606 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
@@ -633,7 +633,7 @@ pmac_outbsync(ide_drive_t *drive, u8 value, unsigned long port)
633 * to sort that out sooner or later and see if I can finally get the 633 * to sort that out sooner or later and see if I can finally get the
634 * common version to work properly in all cases 634 * common version to work properly in all cases
635 */ 635 */
636static int __pmac 636static int
637pmac_ide_do_setfeature(ide_drive_t *drive, u8 command) 637pmac_ide_do_setfeature(ide_drive_t *drive, u8 command)
638{ 638{
639 ide_hwif_t *hwif = HWIF(drive); 639 ide_hwif_t *hwif = HWIF(drive);
@@ -710,7 +710,7 @@ out:
710/* 710/*
711 * Old tuning functions (called on hdparm -p), sets up drive PIO timings 711 * Old tuning functions (called on hdparm -p), sets up drive PIO timings
712 */ 712 */
713static void __pmac 713static void
714pmac_ide_tuneproc(ide_drive_t *drive, u8 pio) 714pmac_ide_tuneproc(ide_drive_t *drive, u8 pio)
715{ 715{
716 ide_pio_data_t d; 716 ide_pio_data_t d;
@@ -801,7 +801,7 @@ pmac_ide_tuneproc(ide_drive_t *drive, u8 pio)
801/* 801/*
802 * Calculate KeyLargo ATA/66 UDMA timings 802 * Calculate KeyLargo ATA/66 UDMA timings
803 */ 803 */
804static int __pmac 804static int
805set_timings_udma_ata4(u32 *timings, u8 speed) 805set_timings_udma_ata4(u32 *timings, u8 speed)
806{ 806{
807 unsigned rdyToPauseTicks, wrDataSetupTicks, addrTicks; 807 unsigned rdyToPauseTicks, wrDataSetupTicks, addrTicks;
@@ -829,7 +829,7 @@ set_timings_udma_ata4(u32 *timings, u8 speed)
829/* 829/*
830 * Calculate Kauai ATA/100 UDMA timings 830 * Calculate Kauai ATA/100 UDMA timings
831 */ 831 */
832static int __pmac 832static int
833set_timings_udma_ata6(u32 *pio_timings, u32 *ultra_timings, u8 speed) 833set_timings_udma_ata6(u32 *pio_timings, u32 *ultra_timings, u8 speed)
834{ 834{
835 struct ide_timing *t = ide_timing_find_mode(speed); 835 struct ide_timing *t = ide_timing_find_mode(speed);
@@ -849,7 +849,7 @@ set_timings_udma_ata6(u32 *pio_timings, u32 *ultra_timings, u8 speed)
849/* 849/*
850 * Calculate Shasta ATA/133 UDMA timings 850 * Calculate Shasta ATA/133 UDMA timings
851 */ 851 */
852static int __pmac 852static int
853set_timings_udma_shasta(u32 *pio_timings, u32 *ultra_timings, u8 speed) 853set_timings_udma_shasta(u32 *pio_timings, u32 *ultra_timings, u8 speed)
854{ 854{
855 struct ide_timing *t = ide_timing_find_mode(speed); 855 struct ide_timing *t = ide_timing_find_mode(speed);
@@ -869,7 +869,7 @@ set_timings_udma_shasta(u32 *pio_timings, u32 *ultra_timings, u8 speed)
869/* 869/*
870 * Calculate MDMA timings for all cells 870 * Calculate MDMA timings for all cells
871 */ 871 */
872static int __pmac 872static int
873set_timings_mdma(ide_drive_t *drive, int intf_type, u32 *timings, u32 *timings2, 873set_timings_mdma(ide_drive_t *drive, int intf_type, u32 *timings, u32 *timings2,
874 u8 speed, int drive_cycle_time) 874 u8 speed, int drive_cycle_time)
875{ 875{
@@ -1014,7 +1014,7 @@ set_timings_mdma(ide_drive_t *drive, int intf_type, u32 *timings, u32 *timings2,
1014 * our dedicated function is more precise as it uses the drive provided 1014 * our dedicated function is more precise as it uses the drive provided
1015 * cycle time value. We should probably fix this one to deal with that too... 1015 * cycle time value. We should probably fix this one to deal with that too...
1016 */ 1016 */
1017static int __pmac 1017static int
1018pmac_ide_tune_chipset (ide_drive_t *drive, byte speed) 1018pmac_ide_tune_chipset (ide_drive_t *drive, byte speed)
1019{ 1019{
1020 int unit = (drive->select.b.unit & 0x01); 1020 int unit = (drive->select.b.unit & 0x01);
@@ -1092,7 +1092,7 @@ pmac_ide_tune_chipset (ide_drive_t *drive, byte speed)
1092 * Blast some well known "safe" values to the timing registers at init or 1092 * Blast some well known "safe" values to the timing registers at init or
1093 * wakeup from sleep time, before we do real calculation 1093 * wakeup from sleep time, before we do real calculation
1094 */ 1094 */
1095static void __pmac 1095static void
1096sanitize_timings(pmac_ide_hwif_t *pmif) 1096sanitize_timings(pmac_ide_hwif_t *pmif)
1097{ 1097{
1098 unsigned int value, value2 = 0; 1098 unsigned int value, value2 = 0;
@@ -1123,13 +1123,13 @@ sanitize_timings(pmac_ide_hwif_t *pmif)
1123 pmif->timings[2] = pmif->timings[3] = value2; 1123 pmif->timings[2] = pmif->timings[3] = value2;
1124} 1124}
1125 1125
1126unsigned long __pmac 1126unsigned long
1127pmac_ide_get_base(int index) 1127pmac_ide_get_base(int index)
1128{ 1128{
1129 return pmac_ide[index].regbase; 1129 return pmac_ide[index].regbase;
1130} 1130}
1131 1131
1132int __pmac 1132int
1133pmac_ide_check_base(unsigned long base) 1133pmac_ide_check_base(unsigned long base)
1134{ 1134{
1135 int ix; 1135 int ix;
@@ -1140,7 +1140,7 @@ pmac_ide_check_base(unsigned long base)
1140 return -1; 1140 return -1;
1141} 1141}
1142 1142
1143int __pmac 1143int
1144pmac_ide_get_irq(unsigned long base) 1144pmac_ide_get_irq(unsigned long base)
1145{ 1145{
1146 int ix; 1146 int ix;
@@ -1151,7 +1151,7 @@ pmac_ide_get_irq(unsigned long base)
1151 return 0; 1151 return 0;
1152} 1152}
1153 1153
1154static int ide_majors[] __pmacdata = { 3, 22, 33, 34, 56, 57 }; 1154static int ide_majors[] = { 3, 22, 33, 34, 56, 57 };
1155 1155
1156dev_t __init 1156dev_t __init
1157pmac_find_ide_boot(char *bootdevice, int n) 1157pmac_find_ide_boot(char *bootdevice, int n)
@@ -1701,7 +1701,7 @@ pmac_ide_probe(void)
1701 * pmac_ide_build_dmatable builds the DBDMA command list 1701 * pmac_ide_build_dmatable builds the DBDMA command list
1702 * for a transfer and sets the DBDMA channel to point to it. 1702 * for a transfer and sets the DBDMA channel to point to it.
1703 */ 1703 */
1704static int __pmac 1704static int
1705pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq) 1705pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq)
1706{ 1706{
1707 struct dbdma_cmd *table; 1707 struct dbdma_cmd *table;
@@ -1785,7 +1785,7 @@ pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq)
1785} 1785}
1786 1786
1787/* Teardown mappings after DMA has completed. */ 1787/* Teardown mappings after DMA has completed. */
1788static void __pmac 1788static void
1789pmac_ide_destroy_dmatable (ide_drive_t *drive) 1789pmac_ide_destroy_dmatable (ide_drive_t *drive)
1790{ 1790{
1791 ide_hwif_t *hwif = drive->hwif; 1791 ide_hwif_t *hwif = drive->hwif;
@@ -1802,7 +1802,7 @@ pmac_ide_destroy_dmatable (ide_drive_t *drive)
1802/* 1802/*
1803 * Pick up best MDMA timing for the drive and apply it 1803 * Pick up best MDMA timing for the drive and apply it
1804 */ 1804 */
1805static int __pmac 1805static int
1806pmac_ide_mdma_enable(ide_drive_t *drive, u16 mode) 1806pmac_ide_mdma_enable(ide_drive_t *drive, u16 mode)
1807{ 1807{
1808 ide_hwif_t *hwif = HWIF(drive); 1808 ide_hwif_t *hwif = HWIF(drive);
@@ -1859,7 +1859,7 @@ pmac_ide_mdma_enable(ide_drive_t *drive, u16 mode)
1859/* 1859/*
1860 * Pick up best UDMA timing for the drive and apply it 1860 * Pick up best UDMA timing for the drive and apply it
1861 */ 1861 */
1862static int __pmac 1862static int
1863pmac_ide_udma_enable(ide_drive_t *drive, u16 mode) 1863pmac_ide_udma_enable(ide_drive_t *drive, u16 mode)
1864{ 1864{
1865 ide_hwif_t *hwif = HWIF(drive); 1865 ide_hwif_t *hwif = HWIF(drive);
@@ -1915,7 +1915,7 @@ pmac_ide_udma_enable(ide_drive_t *drive, u16 mode)
1915 * Check what is the best DMA timing setting for the drive and 1915 * Check what is the best DMA timing setting for the drive and
1916 * call appropriate functions to apply it. 1916 * call appropriate functions to apply it.
1917 */ 1917 */
1918static int __pmac 1918static int
1919pmac_ide_dma_check(ide_drive_t *drive) 1919pmac_ide_dma_check(ide_drive_t *drive)
1920{ 1920{
1921 struct hd_driveid *id = drive->id; 1921 struct hd_driveid *id = drive->id;
@@ -1967,7 +1967,7 @@ pmac_ide_dma_check(ide_drive_t *drive)
1967 * Prepare a DMA transfer. We build the DMA table, adjust the timings for 1967 * Prepare a DMA transfer. We build the DMA table, adjust the timings for
1968 * a read on KeyLargo ATA/66 and mark us as waiting for DMA completion 1968 * a read on KeyLargo ATA/66 and mark us as waiting for DMA completion
1969 */ 1969 */
1970static int __pmac 1970static int
1971pmac_ide_dma_setup(ide_drive_t *drive) 1971pmac_ide_dma_setup(ide_drive_t *drive)
1972{ 1972{
1973 ide_hwif_t *hwif = HWIF(drive); 1973 ide_hwif_t *hwif = HWIF(drive);
@@ -1997,7 +1997,7 @@ pmac_ide_dma_setup(ide_drive_t *drive)
1997 return 0; 1997 return 0;
1998} 1998}
1999 1999
2000static void __pmac 2000static void
2001pmac_ide_dma_exec_cmd(ide_drive_t *drive, u8 command) 2001pmac_ide_dma_exec_cmd(ide_drive_t *drive, u8 command)
2002{ 2002{
2003 /* issue cmd to drive */ 2003 /* issue cmd to drive */
@@ -2008,7 +2008,7 @@ pmac_ide_dma_exec_cmd(ide_drive_t *drive, u8 command)
2008 * Kick the DMA controller into life after the DMA command has been issued 2008 * Kick the DMA controller into life after the DMA command has been issued
2009 * to the drive. 2009 * to the drive.
2010 */ 2010 */
2011static void __pmac 2011static void
2012pmac_ide_dma_start(ide_drive_t *drive) 2012pmac_ide_dma_start(ide_drive_t *drive)
2013{ 2013{
2014 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; 2014 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
@@ -2024,7 +2024,7 @@ pmac_ide_dma_start(ide_drive_t *drive)
2024/* 2024/*
2025 * After a DMA transfer, make sure the controller is stopped 2025 * After a DMA transfer, make sure the controller is stopped
2026 */ 2026 */
2027static int __pmac 2027static int
2028pmac_ide_dma_end (ide_drive_t *drive) 2028pmac_ide_dma_end (ide_drive_t *drive)
2029{ 2029{
2030 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; 2030 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
@@ -2052,7 +2052,7 @@ pmac_ide_dma_end (ide_drive_t *drive)
2052 * that's not implemented yet), on the other hand, we don't have shared interrupts 2052 * that's not implemented yet), on the other hand, we don't have shared interrupts
2053 * so it's not really a problem 2053 * so it's not really a problem
2054 */ 2054 */
2055static int __pmac 2055static int
2056pmac_ide_dma_test_irq (ide_drive_t *drive) 2056pmac_ide_dma_test_irq (ide_drive_t *drive)
2057{ 2057{
2058 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; 2058 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
@@ -2108,19 +2108,19 @@ pmac_ide_dma_test_irq (ide_drive_t *drive)
2108 return 1; 2108 return 1;
2109} 2109}
2110 2110
2111static int __pmac 2111static int
2112pmac_ide_dma_host_off (ide_drive_t *drive) 2112pmac_ide_dma_host_off (ide_drive_t *drive)
2113{ 2113{
2114 return 0; 2114 return 0;
2115} 2115}
2116 2116
2117static int __pmac 2117static int
2118pmac_ide_dma_host_on (ide_drive_t *drive) 2118pmac_ide_dma_host_on (ide_drive_t *drive)
2119{ 2119{
2120 return 0; 2120 return 0;
2121} 2121}
2122 2122
2123static int __pmac 2123static int
2124pmac_ide_dma_lostirq (ide_drive_t *drive) 2124pmac_ide_dma_lostirq (ide_drive_t *drive)
2125{ 2125{
2126 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; 2126 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
diff --git a/drivers/macintosh/ans-lcd.c b/drivers/macintosh/ans-lcd.c
index 5e0811dc6536..2b8a6e821d44 100644
--- a/drivers/macintosh/ans-lcd.c
+++ b/drivers/macintosh/ans-lcd.c
@@ -27,7 +27,7 @@ static volatile unsigned char __iomem *anslcd_ptr;
27 27
28#undef DEBUG 28#undef DEBUG
29 29
30static void __pmac 30static void
31anslcd_write_byte_ctrl ( unsigned char c ) 31anslcd_write_byte_ctrl ( unsigned char c )
32{ 32{
33#ifdef DEBUG 33#ifdef DEBUG
@@ -43,14 +43,14 @@ anslcd_write_byte_ctrl ( unsigned char c )
43 } 43 }
44} 44}
45 45
46static void __pmac 46static void
47anslcd_write_byte_data ( unsigned char c ) 47anslcd_write_byte_data ( unsigned char c )
48{ 48{
49 out_8(anslcd_ptr + ANSLCD_DATA_IX, c); 49 out_8(anslcd_ptr + ANSLCD_DATA_IX, c);
50 udelay(anslcd_short_delay); 50 udelay(anslcd_short_delay);
51} 51}
52 52
53static ssize_t __pmac 53static ssize_t
54anslcd_write( struct file * file, const char __user * buf, 54anslcd_write( struct file * file, const char __user * buf,
55 size_t count, loff_t *ppos ) 55 size_t count, loff_t *ppos )
56{ 56{
@@ -73,7 +73,7 @@ anslcd_write( struct file * file, const char __user * buf,
73 return p - buf; 73 return p - buf;
74} 74}
75 75
76static int __pmac 76static int
77anslcd_ioctl( struct inode * inode, struct file * file, 77anslcd_ioctl( struct inode * inode, struct file * file,
78 unsigned int cmd, unsigned long arg ) 78 unsigned int cmd, unsigned long arg )
79{ 79{
@@ -115,7 +115,7 @@ anslcd_ioctl( struct inode * inode, struct file * file,
115 } 115 }
116} 116}
117 117
118static int __pmac 118static int
119anslcd_open( struct inode * inode, struct file * file ) 119anslcd_open( struct inode * inode, struct file * file )
120{ 120{
121 return 0; 121 return 0;
diff --git a/drivers/macintosh/apm_emu.c b/drivers/macintosh/apm_emu.c
index 19d3e05d6825..e5a2bbf99399 100644
--- a/drivers/macintosh/apm_emu.c
+++ b/drivers/macintosh/apm_emu.c
@@ -430,8 +430,8 @@ static int apm_emu_get_info(char *buf, char **start, off_t fpos, int length)
430 -1: Unknown 430 -1: Unknown
431 8) min = minutes; sec = seconds */ 431 8) min = minutes; sec = seconds */
432 432
433 unsigned short ac_line_status = 0xff; 433 unsigned short ac_line_status;
434 unsigned short battery_status = 0xff; 434 unsigned short battery_status = 0;
435 unsigned short battery_flag = 0xff; 435 unsigned short battery_flag = 0xff;
436 int percentage = -1; 436 int percentage = -1;
437 int time_units = -1; 437 int time_units = -1;
@@ -446,6 +446,7 @@ static int apm_emu_get_info(char *buf, char **start, off_t fpos, int length)
446 ac_line_status = ((pmu_power_flags & PMU_PWR_AC_PRESENT) != 0); 446 ac_line_status = ((pmu_power_flags & PMU_PWR_AC_PRESENT) != 0);
447 for (i=0; i<pmu_battery_count; i++) { 447 for (i=0; i<pmu_battery_count; i++) {
448 if (pmu_batteries[i].flags & PMU_BATT_PRESENT) { 448 if (pmu_batteries[i].flags & PMU_BATT_PRESENT) {
449 battery_status++;
449 if (percentage < 0) 450 if (percentage < 0)
450 percentage = 0; 451 percentage = 0;
451 if (charge < 0) 452 if (charge < 0)
@@ -461,6 +462,9 @@ static int apm_emu_get_info(char *buf, char **start, off_t fpos, int length)
461 charging++; 462 charging++;
462 } 463 }
463 } 464 }
465 if (0 == battery_status)
466 ac_line_status = 1;
467 battery_status = 0xff;
464 if (real_count) { 468 if (real_count) {
465 if (amperage < 0) { 469 if (amperage < 0) {
466 if (btype == PMU_BATT_TYPE_SMART) 470 if (btype == PMU_BATT_TYPE_SMART)
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c
index 97d22bb4516a..7f7d4eaca870 100644
--- a/drivers/macintosh/macio_sysfs.c
+++ b/drivers/macintosh/macio_sysfs.c
@@ -39,6 +39,31 @@ compatible_show (struct device *dev, struct device_attribute *attr, char *buf)
39 return length; 39 return length;
40} 40}
41 41
42static ssize_t modalias_show (struct device *dev, struct device_attribute *attr,
43 char *buf)
44{
45 struct of_device *of;
46 char *compat;
47 int cplen;
48 int length;
49
50 of = &to_macio_device (dev)->ofdev;
51 compat = (char *) get_property (of->node, "compatible", &cplen);
52 if (!compat) compat = "", cplen = 1;
53 length = sprintf (buf, "of:N%sT%s", of->node->name, of->node->type);
54 buf += length;
55 while (cplen > 0) {
56 int l;
57 length += sprintf (buf, "C%s", compat);
58 buf += length;
59 l = strlen (compat) + 1;
60 compat += l;
61 cplen -= l;
62 }
63
64 return length;
65}
66
42macio_config_of_attr (name, "%s\n"); 67macio_config_of_attr (name, "%s\n");
43macio_config_of_attr (type, "%s\n"); 68macio_config_of_attr (type, "%s\n");
44 69
@@ -46,5 +71,6 @@ struct device_attribute macio_dev_attrs[] = {
46 __ATTR_RO(name), 71 __ATTR_RO(name),
47 __ATTR_RO(type), 72 __ATTR_RO(type),
48 __ATTR_RO(compatible), 73 __ATTR_RO(compatible),
74 __ATTR_RO(modalias),
49 __ATTR_NULL 75 __ATTR_NULL
50}; 76};
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
index c0712a1ea5af..b856bb67169c 100644
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -167,19 +167,19 @@ enum {
167 * Functions for polling content of media bay 167 * Functions for polling content of media bay
168 */ 168 */
169 169
170static u8 __pmac 170static u8
171ohare_mb_content(struct media_bay_info *bay) 171ohare_mb_content(struct media_bay_info *bay)
172{ 172{
173 return (MB_IN32(bay, OHARE_MBCR) >> 12) & 7; 173 return (MB_IN32(bay, OHARE_MBCR) >> 12) & 7;
174} 174}
175 175
176static u8 __pmac 176static u8
177heathrow_mb_content(struct media_bay_info *bay) 177heathrow_mb_content(struct media_bay_info *bay)
178{ 178{
179 return (MB_IN32(bay, HEATHROW_MBCR) >> 12) & 7; 179 return (MB_IN32(bay, HEATHROW_MBCR) >> 12) & 7;
180} 180}
181 181
182static u8 __pmac 182static u8
183keylargo_mb_content(struct media_bay_info *bay) 183keylargo_mb_content(struct media_bay_info *bay)
184{ 184{
185 int new_gpio; 185 int new_gpio;
@@ -205,7 +205,7 @@ keylargo_mb_content(struct media_bay_info *bay)
205 * into reset state as well 205 * into reset state as well
206 */ 206 */
207 207
208static void __pmac 208static void
209ohare_mb_power(struct media_bay_info* bay, int on_off) 209ohare_mb_power(struct media_bay_info* bay, int on_off)
210{ 210{
211 if (on_off) { 211 if (on_off) {
@@ -224,7 +224,7 @@ ohare_mb_power(struct media_bay_info* bay, int on_off)
224 MB_BIC(bay, OHARE_MBCR, 0x00000F00); 224 MB_BIC(bay, OHARE_MBCR, 0x00000F00);
225} 225}
226 226
227static void __pmac 227static void
228heathrow_mb_power(struct media_bay_info* bay, int on_off) 228heathrow_mb_power(struct media_bay_info* bay, int on_off)
229{ 229{
230 if (on_off) { 230 if (on_off) {
@@ -243,7 +243,7 @@ heathrow_mb_power(struct media_bay_info* bay, int on_off)
243 MB_BIC(bay, HEATHROW_MBCR, 0x00000F00); 243 MB_BIC(bay, HEATHROW_MBCR, 0x00000F00);
244} 244}
245 245
246static void __pmac 246static void
247keylargo_mb_power(struct media_bay_info* bay, int on_off) 247keylargo_mb_power(struct media_bay_info* bay, int on_off)
248{ 248{
249 if (on_off) { 249 if (on_off) {
@@ -267,7 +267,7 @@ keylargo_mb_power(struct media_bay_info* bay, int on_off)
267 * enable the related busses 267 * enable the related busses
268 */ 268 */
269 269
270static int __pmac 270static int
271ohare_mb_setup_bus(struct media_bay_info* bay, u8 device_id) 271ohare_mb_setup_bus(struct media_bay_info* bay, u8 device_id)
272{ 272{
273 switch(device_id) { 273 switch(device_id) {
@@ -287,7 +287,7 @@ ohare_mb_setup_bus(struct media_bay_info* bay, u8 device_id)
287 return -ENODEV; 287 return -ENODEV;
288} 288}
289 289
290static int __pmac 290static int
291heathrow_mb_setup_bus(struct media_bay_info* bay, u8 device_id) 291heathrow_mb_setup_bus(struct media_bay_info* bay, u8 device_id)
292{ 292{
293 switch(device_id) { 293 switch(device_id) {
@@ -307,7 +307,7 @@ heathrow_mb_setup_bus(struct media_bay_info* bay, u8 device_id)
307 return -ENODEV; 307 return -ENODEV;
308} 308}
309 309
310static int __pmac 310static int
311keylargo_mb_setup_bus(struct media_bay_info* bay, u8 device_id) 311keylargo_mb_setup_bus(struct media_bay_info* bay, u8 device_id)
312{ 312{
313 switch(device_id) { 313 switch(device_id) {
@@ -330,43 +330,43 @@ keylargo_mb_setup_bus(struct media_bay_info* bay, u8 device_id)
330 * Functions for tweaking resets 330 * Functions for tweaking resets
331 */ 331 */
332 332
333static void __pmac 333static void
334ohare_mb_un_reset(struct media_bay_info* bay) 334ohare_mb_un_reset(struct media_bay_info* bay)
335{ 335{
336 MB_BIS(bay, OHARE_FCR, OH_BAY_RESET_N); 336 MB_BIS(bay, OHARE_FCR, OH_BAY_RESET_N);
337} 337}
338 338
339static void __pmac keylargo_mb_init(struct media_bay_info *bay) 339static void keylargo_mb_init(struct media_bay_info *bay)
340{ 340{
341 MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_ENABLE); 341 MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_ENABLE);
342} 342}
343 343
344static void __pmac heathrow_mb_un_reset(struct media_bay_info* bay) 344static void heathrow_mb_un_reset(struct media_bay_info* bay)
345{ 345{
346 MB_BIS(bay, HEATHROW_FCR, HRW_BAY_RESET_N); 346 MB_BIS(bay, HEATHROW_FCR, HRW_BAY_RESET_N);
347} 347}
348 348
349static void __pmac keylargo_mb_un_reset(struct media_bay_info* bay) 349static void keylargo_mb_un_reset(struct media_bay_info* bay)
350{ 350{
351 MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_DEV_RESET); 351 MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_DEV_RESET);
352} 352}
353 353
354static void __pmac ohare_mb_un_reset_ide(struct media_bay_info* bay) 354static void ohare_mb_un_reset_ide(struct media_bay_info* bay)
355{ 355{
356 MB_BIS(bay, OHARE_FCR, OH_IDE1_RESET_N); 356 MB_BIS(bay, OHARE_FCR, OH_IDE1_RESET_N);
357} 357}
358 358
359static void __pmac heathrow_mb_un_reset_ide(struct media_bay_info* bay) 359static void heathrow_mb_un_reset_ide(struct media_bay_info* bay)
360{ 360{
361 MB_BIS(bay, HEATHROW_FCR, HRW_IDE1_RESET_N); 361 MB_BIS(bay, HEATHROW_FCR, HRW_IDE1_RESET_N);
362} 362}
363 363
364static void __pmac keylargo_mb_un_reset_ide(struct media_bay_info* bay) 364static void keylargo_mb_un_reset_ide(struct media_bay_info* bay)
365{ 365{
366 MB_BIS(bay, KEYLARGO_FCR1, KL1_EIDE0_RESET_N); 366 MB_BIS(bay, KEYLARGO_FCR1, KL1_EIDE0_RESET_N);
367} 367}
368 368
369static inline void __pmac set_mb_power(struct media_bay_info* bay, int onoff) 369static inline void set_mb_power(struct media_bay_info* bay, int onoff)
370{ 370{
371 /* Power up up and assert the bay reset line */ 371 /* Power up up and assert the bay reset line */
372 if (onoff) { 372 if (onoff) {
@@ -382,7 +382,7 @@ static inline void __pmac set_mb_power(struct media_bay_info* bay, int onoff)
382 bay->timer = msecs_to_jiffies(MB_POWER_DELAY); 382 bay->timer = msecs_to_jiffies(MB_POWER_DELAY);
383} 383}
384 384
385static void __pmac poll_media_bay(struct media_bay_info* bay) 385static void poll_media_bay(struct media_bay_info* bay)
386{ 386{
387 int id = bay->ops->content(bay); 387 int id = bay->ops->content(bay);
388 388
@@ -415,7 +415,7 @@ static void __pmac poll_media_bay(struct media_bay_info* bay)
415 } 415 }
416} 416}
417 417
418int __pmac check_media_bay(struct device_node *which_bay, int what) 418int check_media_bay(struct device_node *which_bay, int what)
419{ 419{
420#ifdef CONFIG_BLK_DEV_IDE 420#ifdef CONFIG_BLK_DEV_IDE
421 int i; 421 int i;
@@ -432,7 +432,7 @@ int __pmac check_media_bay(struct device_node *which_bay, int what)
432} 432}
433EXPORT_SYMBOL(check_media_bay); 433EXPORT_SYMBOL(check_media_bay);
434 434
435int __pmac check_media_bay_by_base(unsigned long base, int what) 435int check_media_bay_by_base(unsigned long base, int what)
436{ 436{
437#ifdef CONFIG_BLK_DEV_IDE 437#ifdef CONFIG_BLK_DEV_IDE
438 int i; 438 int i;
@@ -449,7 +449,7 @@ int __pmac check_media_bay_by_base(unsigned long base, int what)
449 return -ENODEV; 449 return -ENODEV;
450} 450}
451 451
452int __pmac media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base, 452int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base,
453 int irq, int index) 453 int irq, int index)
454{ 454{
455#ifdef CONFIG_BLK_DEV_IDE 455#ifdef CONFIG_BLK_DEV_IDE
@@ -489,7 +489,7 @@ int __pmac media_bay_set_ide_infos(struct device_node* which_bay, unsigned long
489 return -ENODEV; 489 return -ENODEV;
490} 490}
491 491
492static void __pmac media_bay_step(int i) 492static void media_bay_step(int i)
493{ 493{
494 struct media_bay_info* bay = &media_bays[i]; 494 struct media_bay_info* bay = &media_bays[i];
495 495
@@ -619,7 +619,7 @@ static void __pmac media_bay_step(int i)
619 * with the IDE driver. It needs to be a thread because 619 * with the IDE driver. It needs to be a thread because
620 * ide_register can't be called from interrupt context. 620 * ide_register can't be called from interrupt context.
621 */ 621 */
622static int __pmac media_bay_task(void *x) 622static int media_bay_task(void *x)
623{ 623{
624 int i; 624 int i;
625 625
@@ -704,7 +704,7 @@ static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_de
704 704
705} 705}
706 706
707static int __pmac media_bay_suspend(struct macio_dev *mdev, pm_message_t state) 707static int media_bay_suspend(struct macio_dev *mdev, pm_message_t state)
708{ 708{
709 struct media_bay_info *bay = macio_get_drvdata(mdev); 709 struct media_bay_info *bay = macio_get_drvdata(mdev);
710 710
@@ -719,7 +719,7 @@ static int __pmac media_bay_suspend(struct macio_dev *mdev, pm_message_t state)
719 return 0; 719 return 0;
720} 720}
721 721
722static int __pmac media_bay_resume(struct macio_dev *mdev) 722static int media_bay_resume(struct macio_dev *mdev)
723{ 723{
724 struct media_bay_info *bay = macio_get_drvdata(mdev); 724 struct media_bay_info *bay = macio_get_drvdata(mdev);
725 725
@@ -760,7 +760,7 @@ static int __pmac media_bay_resume(struct macio_dev *mdev)
760 760
761/* Definitions of "ops" structures. 761/* Definitions of "ops" structures.
762 */ 762 */
763static struct mb_ops ohare_mb_ops __pmacdata = { 763static struct mb_ops ohare_mb_ops = {
764 .name = "Ohare", 764 .name = "Ohare",
765 .content = ohare_mb_content, 765 .content = ohare_mb_content,
766 .power = ohare_mb_power, 766 .power = ohare_mb_power,
@@ -769,7 +769,7 @@ static struct mb_ops ohare_mb_ops __pmacdata = {
769 .un_reset_ide = ohare_mb_un_reset_ide, 769 .un_reset_ide = ohare_mb_un_reset_ide,
770}; 770};
771 771
772static struct mb_ops heathrow_mb_ops __pmacdata = { 772static struct mb_ops heathrow_mb_ops = {
773 .name = "Heathrow", 773 .name = "Heathrow",
774 .content = heathrow_mb_content, 774 .content = heathrow_mb_content,
775 .power = heathrow_mb_power, 775 .power = heathrow_mb_power,
@@ -778,7 +778,7 @@ static struct mb_ops heathrow_mb_ops __pmacdata = {
778 .un_reset_ide = heathrow_mb_un_reset_ide, 778 .un_reset_ide = heathrow_mb_un_reset_ide,
779}; 779};
780 780
781static struct mb_ops keylargo_mb_ops __pmacdata = { 781static struct mb_ops keylargo_mb_ops = {
782 .name = "KeyLargo", 782 .name = "KeyLargo",
783 .init = keylargo_mb_init, 783 .init = keylargo_mb_init,
784 .content = keylargo_mb_content, 784 .content = keylargo_mb_content,
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 9b38674fbf75..34f3c7e2d832 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -1094,7 +1094,7 @@ static int smu_release(struct inode *inode, struct file *file)
1094} 1094}
1095 1095
1096 1096
1097static struct file_operations smu_device_fops __pmacdata = { 1097static struct file_operations smu_device_fops = {
1098 .llseek = no_llseek, 1098 .llseek = no_llseek,
1099 .read = smu_read, 1099 .read = smu_read,
1100 .write = smu_write, 1100 .write = smu_write,
@@ -1103,7 +1103,7 @@ static struct file_operations smu_device_fops __pmacdata = {
1103 .release = smu_release, 1103 .release = smu_release,
1104}; 1104};
1105 1105
1106static struct miscdevice pmu_device __pmacdata = { 1106static struct miscdevice pmu_device = {
1107 MISC_DYNAMIC_MINOR, "smu", &smu_device_fops 1107 MISC_DYNAMIC_MINOR, "smu", &smu_device_fops
1108}; 1108};
1109 1109
diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c
index 417deb5de108..d843a6c9c6df 100644
--- a/drivers/macintosh/via-cuda.c
+++ b/drivers/macintosh/via-cuda.c
@@ -37,7 +37,6 @@ static DEFINE_SPINLOCK(cuda_lock);
37 37
38#ifdef CONFIG_MAC 38#ifdef CONFIG_MAC
39#define CUDA_IRQ IRQ_MAC_ADB 39#define CUDA_IRQ IRQ_MAC_ADB
40#define __openfirmware
41#define eieio() 40#define eieio()
42#else 41#else
43#define CUDA_IRQ vias->intrs[0].line 42#define CUDA_IRQ vias->intrs[0].line
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 645a2e5c70ab..91920a1140fa 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -244,7 +244,7 @@ int pmu_wink(struct adb_request *req);
244 * - the number of response bytes which the PMU will return, or 244 * - the number of response bytes which the PMU will return, or
245 * -1 if it will send a length byte. 245 * -1 if it will send a length byte.
246 */ 246 */
247static const s8 pmu_data_len[256][2] __openfirmwaredata = { 247static const s8 pmu_data_len[256][2] = {
248/* 0 1 2 3 4 5 6 7 */ 248/* 0 1 2 3 4 5 6 7 */
249/*00*/ {-1, 0},{-1, 0},{-1, 0},{-1, 0},{-1, 0},{-1, 0},{-1, 0},{-1, 0}, 249/*00*/ {-1, 0},{-1, 0},{-1, 0},{-1, 0},{-1, 0},{-1, 0},{-1, 0},{-1, 0},
250/*08*/ {-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1}, 250/*08*/ {-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},
@@ -295,7 +295,7 @@ static struct backlight_controller pmu_backlight_controller = {
295}; 295};
296#endif /* CONFIG_PMAC_BACKLIGHT */ 296#endif /* CONFIG_PMAC_BACKLIGHT */
297 297
298int __openfirmware 298int
299find_via_pmu(void) 299find_via_pmu(void)
300{ 300{
301 if (via != 0) 301 if (via != 0)
@@ -374,7 +374,7 @@ find_via_pmu(void)
374} 374}
375 375
376#ifdef CONFIG_ADB 376#ifdef CONFIG_ADB
377static int __openfirmware 377static int
378pmu_probe(void) 378pmu_probe(void)
379{ 379{
380 return vias == NULL? -ENODEV: 0; 380 return vias == NULL? -ENODEV: 0;
@@ -405,7 +405,7 @@ static int __init via_pmu_start(void)
405 bright_req_2.complete = 1; 405 bright_req_2.complete = 1;
406 batt_req.complete = 1; 406 batt_req.complete = 1;
407 407
408#ifdef CONFIG_PPC32 408#if defined(CONFIG_PPC32) && !defined(CONFIG_PPC_MERGE)
409 if (pmu_kind == PMU_KEYLARGO_BASED) 409 if (pmu_kind == PMU_KEYLARGO_BASED)
410 openpic_set_irq_priority(vias->intrs[0].line, 410 openpic_set_irq_priority(vias->intrs[0].line,
411 OPENPIC_PRIORITY_DEFAULT + 1); 411 OPENPIC_PRIORITY_DEFAULT + 1);
@@ -520,7 +520,7 @@ static int __init via_pmu_dev_init(void)
520 520
521device_initcall(via_pmu_dev_init); 521device_initcall(via_pmu_dev_init);
522 522
523static int __openfirmware 523static int
524init_pmu(void) 524init_pmu(void)
525{ 525{
526 int timeout; 526 int timeout;
@@ -588,17 +588,6 @@ pmu_get_model(void)
588 return pmu_kind; 588 return pmu_kind;
589} 589}
590 590
591#ifndef CONFIG_PPC64
592static inline void wakeup_decrementer(void)
593{
594 set_dec(tb_ticks_per_jiffy);
595 /* No currently-supported powerbook has a 601,
596 * so use get_tbl, not native
597 */
598 last_jiffy_stamp(0) = tb_last_stamp = get_tbl();
599}
600#endif
601
602static void pmu_set_server_mode(int server_mode) 591static void pmu_set_server_mode(int server_mode)
603{ 592{
604 struct adb_request req; 593 struct adb_request req;
@@ -625,7 +614,7 @@ static void pmu_set_server_mode(int server_mode)
625/* This new version of the code for 2400/3400/3500 powerbooks 614/* This new version of the code for 2400/3400/3500 powerbooks
626 * is inspired from the implementation in gkrellm-pmu 615 * is inspired from the implementation in gkrellm-pmu
627 */ 616 */
628static void __pmac 617static void
629done_battery_state_ohare(struct adb_request* req) 618done_battery_state_ohare(struct adb_request* req)
630{ 619{
631 /* format: 620 /* format:
@@ -713,7 +702,7 @@ done_battery_state_ohare(struct adb_request* req)
713 clear_bit(0, &async_req_locks); 702 clear_bit(0, &async_req_locks);
714} 703}
715 704
716static void __pmac 705static void
717done_battery_state_smart(struct adb_request* req) 706done_battery_state_smart(struct adb_request* req)
718{ 707{
719 /* format: 708 /* format:
@@ -791,7 +780,7 @@ done_battery_state_smart(struct adb_request* req)
791 clear_bit(0, &async_req_locks); 780 clear_bit(0, &async_req_locks);
792} 781}
793 782
794static void __pmac 783static void
795query_battery_state(void) 784query_battery_state(void)
796{ 785{
797 if (test_and_set_bit(0, &async_req_locks)) 786 if (test_and_set_bit(0, &async_req_locks))
@@ -804,7 +793,7 @@ query_battery_state(void)
804 2, PMU_SMART_BATTERY_STATE, pmu_cur_battery+1); 793 2, PMU_SMART_BATTERY_STATE, pmu_cur_battery+1);
805} 794}
806 795
807static int __pmac 796static int
808proc_get_info(char *page, char **start, off_t off, 797proc_get_info(char *page, char **start, off_t off,
809 int count, int *eof, void *data) 798 int count, int *eof, void *data)
810{ 799{
@@ -819,7 +808,7 @@ proc_get_info(char *page, char **start, off_t off,
819 return p - page; 808 return p - page;
820} 809}
821 810
822static int __pmac 811static int
823proc_get_irqstats(char *page, char **start, off_t off, 812proc_get_irqstats(char *page, char **start, off_t off,
824 int count, int *eof, void *data) 813 int count, int *eof, void *data)
825{ 814{
@@ -846,7 +835,7 @@ proc_get_irqstats(char *page, char **start, off_t off,
846 return p - page; 835 return p - page;
847} 836}
848 837
849static int __pmac 838static int
850proc_get_batt(char *page, char **start, off_t off, 839proc_get_batt(char *page, char **start, off_t off,
851 int count, int *eof, void *data) 840 int count, int *eof, void *data)
852{ 841{
@@ -870,7 +859,7 @@ proc_get_batt(char *page, char **start, off_t off,
870 return p - page; 859 return p - page;
871} 860}
872 861
873static int __pmac 862static int
874proc_read_options(char *page, char **start, off_t off, 863proc_read_options(char *page, char **start, off_t off,
875 int count, int *eof, void *data) 864 int count, int *eof, void *data)
876{ 865{
@@ -887,7 +876,7 @@ proc_read_options(char *page, char **start, off_t off,
887 return p - page; 876 return p - page;
888} 877}
889 878
890static int __pmac 879static int
891proc_write_options(struct file *file, const char __user *buffer, 880proc_write_options(struct file *file, const char __user *buffer,
892 unsigned long count, void *data) 881 unsigned long count, void *data)
893{ 882{
@@ -934,7 +923,7 @@ proc_write_options(struct file *file, const char __user *buffer,
934 923
935#ifdef CONFIG_ADB 924#ifdef CONFIG_ADB
936/* Send an ADB command */ 925/* Send an ADB command */
937static int __pmac 926static int
938pmu_send_request(struct adb_request *req, int sync) 927pmu_send_request(struct adb_request *req, int sync)
939{ 928{
940 int i, ret; 929 int i, ret;
@@ -1014,7 +1003,7 @@ pmu_send_request(struct adb_request *req, int sync)
1014} 1003}
1015 1004
1016/* Enable/disable autopolling */ 1005/* Enable/disable autopolling */
1017static int __pmac 1006static int
1018pmu_adb_autopoll(int devs) 1007pmu_adb_autopoll(int devs)
1019{ 1008{
1020 struct adb_request req; 1009 struct adb_request req;
@@ -1037,7 +1026,7 @@ pmu_adb_autopoll(int devs)
1037} 1026}
1038 1027
1039/* Reset the ADB bus */ 1028/* Reset the ADB bus */
1040static int __pmac 1029static int
1041pmu_adb_reset_bus(void) 1030pmu_adb_reset_bus(void)
1042{ 1031{
1043 struct adb_request req; 1032 struct adb_request req;
@@ -1072,7 +1061,7 @@ pmu_adb_reset_bus(void)
1072#endif /* CONFIG_ADB */ 1061#endif /* CONFIG_ADB */
1073 1062
1074/* Construct and send a pmu request */ 1063/* Construct and send a pmu request */
1075int __openfirmware 1064int
1076pmu_request(struct adb_request *req, void (*done)(struct adb_request *), 1065pmu_request(struct adb_request *req, void (*done)(struct adb_request *),
1077 int nbytes, ...) 1066 int nbytes, ...)
1078{ 1067{
@@ -1098,7 +1087,7 @@ pmu_request(struct adb_request *req, void (*done)(struct adb_request *),
1098 return pmu_queue_request(req); 1087 return pmu_queue_request(req);
1099} 1088}
1100 1089
1101int __pmac 1090int
1102pmu_queue_request(struct adb_request *req) 1091pmu_queue_request(struct adb_request *req)
1103{ 1092{
1104 unsigned long flags; 1093 unsigned long flags;
@@ -1190,7 +1179,7 @@ pmu_done(struct adb_request *req)
1190 (*done)(req); 1179 (*done)(req);
1191} 1180}
1192 1181
1193static void __pmac 1182static void
1194pmu_start(void) 1183pmu_start(void)
1195{ 1184{
1196 struct adb_request *req; 1185 struct adb_request *req;
@@ -1214,7 +1203,7 @@ pmu_start(void)
1214 send_byte(req->data[0]); 1203 send_byte(req->data[0]);
1215} 1204}
1216 1205
1217void __openfirmware 1206void
1218pmu_poll(void) 1207pmu_poll(void)
1219{ 1208{
1220 if (!via) 1209 if (!via)
@@ -1224,7 +1213,7 @@ pmu_poll(void)
1224 via_pmu_interrupt(0, NULL, NULL); 1213 via_pmu_interrupt(0, NULL, NULL);
1225} 1214}
1226 1215
1227void __openfirmware 1216void
1228pmu_poll_adb(void) 1217pmu_poll_adb(void)
1229{ 1218{
1230 if (!via) 1219 if (!via)
@@ -1239,7 +1228,7 @@ pmu_poll_adb(void)
1239 || req_awaiting_reply)); 1228 || req_awaiting_reply));
1240} 1229}
1241 1230
1242void __openfirmware 1231void
1243pmu_wait_complete(struct adb_request *req) 1232pmu_wait_complete(struct adb_request *req)
1244{ 1233{
1245 if (!via) 1234 if (!via)
@@ -1253,7 +1242,7 @@ pmu_wait_complete(struct adb_request *req)
1253 * This is done to avoid spurrious shutdowns when we know we'll have 1242 * This is done to avoid spurrious shutdowns when we know we'll have
1254 * interrupts switched off for a long time 1243 * interrupts switched off for a long time
1255 */ 1244 */
1256void __openfirmware 1245void
1257pmu_suspend(void) 1246pmu_suspend(void)
1258{ 1247{
1259 unsigned long flags; 1248 unsigned long flags;
@@ -1293,7 +1282,7 @@ pmu_suspend(void)
1293 } while (1); 1282 } while (1);
1294} 1283}
1295 1284
1296void __openfirmware 1285void
1297pmu_resume(void) 1286pmu_resume(void)
1298{ 1287{
1299 unsigned long flags; 1288 unsigned long flags;
@@ -1323,7 +1312,7 @@ pmu_resume(void)
1323} 1312}
1324 1313
1325/* Interrupt data could be the result data from an ADB cmd */ 1314/* Interrupt data could be the result data from an ADB cmd */
1326static void __pmac 1315static void
1327pmu_handle_data(unsigned char *data, int len, struct pt_regs *regs) 1316pmu_handle_data(unsigned char *data, int len, struct pt_regs *regs)
1328{ 1317{
1329 unsigned char ints, pirq; 1318 unsigned char ints, pirq;
@@ -1435,7 +1424,7 @@ next:
1435 goto next; 1424 goto next;
1436} 1425}
1437 1426
1438static struct adb_request* __pmac 1427static struct adb_request*
1439pmu_sr_intr(struct pt_regs *regs) 1428pmu_sr_intr(struct pt_regs *regs)
1440{ 1429{
1441 struct adb_request *req; 1430 struct adb_request *req;
@@ -1541,7 +1530,7 @@ pmu_sr_intr(struct pt_regs *regs)
1541 return NULL; 1530 return NULL;
1542} 1531}
1543 1532
1544static irqreturn_t __pmac 1533static irqreturn_t
1545via_pmu_interrupt(int irq, void *arg, struct pt_regs *regs) 1534via_pmu_interrupt(int irq, void *arg, struct pt_regs *regs)
1546{ 1535{
1547 unsigned long flags; 1536 unsigned long flags;
@@ -1629,7 +1618,7 @@ no_free_slot:
1629 return IRQ_RETVAL(handled); 1618 return IRQ_RETVAL(handled);
1630} 1619}
1631 1620
1632void __pmac 1621void
1633pmu_unlock(void) 1622pmu_unlock(void)
1634{ 1623{
1635 unsigned long flags; 1624 unsigned long flags;
@@ -1642,7 +1631,7 @@ pmu_unlock(void)
1642} 1631}
1643 1632
1644 1633
1645static irqreturn_t __pmac 1634static irqreturn_t
1646gpio1_interrupt(int irq, void *arg, struct pt_regs *regs) 1635gpio1_interrupt(int irq, void *arg, struct pt_regs *regs)
1647{ 1636{
1648 unsigned long flags; 1637 unsigned long flags;
@@ -1663,12 +1652,12 @@ gpio1_interrupt(int irq, void *arg, struct pt_regs *regs)
1663} 1652}
1664 1653
1665#ifdef CONFIG_PMAC_BACKLIGHT 1654#ifdef CONFIG_PMAC_BACKLIGHT
1666static int backlight_to_bright[] __pmacdata = { 1655static int backlight_to_bright[] = {
1667 0x7f, 0x46, 0x42, 0x3e, 0x3a, 0x36, 0x32, 0x2e, 1656 0x7f, 0x46, 0x42, 0x3e, 0x3a, 0x36, 0x32, 0x2e,
1668 0x2a, 0x26, 0x22, 0x1e, 0x1a, 0x16, 0x12, 0x0e 1657 0x2a, 0x26, 0x22, 0x1e, 0x1a, 0x16, 0x12, 0x0e
1669}; 1658};
1670 1659
1671static int __openfirmware 1660static int
1672pmu_set_backlight_enable(int on, int level, void* data) 1661pmu_set_backlight_enable(int on, int level, void* data)
1673{ 1662{
1674 struct adb_request req; 1663 struct adb_request req;
@@ -1688,7 +1677,7 @@ pmu_set_backlight_enable(int on, int level, void* data)
1688 return 0; 1677 return 0;
1689} 1678}
1690 1679
1691static void __openfirmware 1680static void
1692pmu_bright_complete(struct adb_request *req) 1681pmu_bright_complete(struct adb_request *req)
1693{ 1682{
1694 if (req == &bright_req_1) 1683 if (req == &bright_req_1)
@@ -1697,7 +1686,7 @@ pmu_bright_complete(struct adb_request *req)
1697 clear_bit(2, &async_req_locks); 1686 clear_bit(2, &async_req_locks);
1698} 1687}
1699 1688
1700static int __openfirmware 1689static int
1701pmu_set_backlight_level(int level, void* data) 1690pmu_set_backlight_level(int level, void* data)
1702{ 1691{
1703 if (vias == NULL) 1692 if (vias == NULL)
@@ -1717,7 +1706,7 @@ pmu_set_backlight_level(int level, void* data)
1717} 1706}
1718#endif /* CONFIG_PMAC_BACKLIGHT */ 1707#endif /* CONFIG_PMAC_BACKLIGHT */
1719 1708
1720void __pmac 1709void
1721pmu_enable_irled(int on) 1710pmu_enable_irled(int on)
1722{ 1711{
1723 struct adb_request req; 1712 struct adb_request req;
@@ -1732,7 +1721,7 @@ pmu_enable_irled(int on)
1732 pmu_wait_complete(&req); 1721 pmu_wait_complete(&req);
1733} 1722}
1734 1723
1735void __pmac 1724void
1736pmu_restart(void) 1725pmu_restart(void)
1737{ 1726{
1738 struct adb_request req; 1727 struct adb_request req;
@@ -1757,7 +1746,7 @@ pmu_restart(void)
1757 ; 1746 ;
1758} 1747}
1759 1748
1760void __pmac 1749void
1761pmu_shutdown(void) 1750pmu_shutdown(void)
1762{ 1751{
1763 struct adb_request req; 1752 struct adb_request req;
@@ -2076,7 +2065,7 @@ pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* n)
2076} 2065}
2077 2066
2078/* Sleep is broadcast last-to-first */ 2067/* Sleep is broadcast last-to-first */
2079static int __pmac 2068static int
2080broadcast_sleep(int when, int fallback) 2069broadcast_sleep(int when, int fallback)
2081{ 2070{
2082 int ret = PBOOK_SLEEP_OK; 2071 int ret = PBOOK_SLEEP_OK;
@@ -2101,7 +2090,7 @@ broadcast_sleep(int when, int fallback)
2101} 2090}
2102 2091
2103/* Wake is broadcast first-to-last */ 2092/* Wake is broadcast first-to-last */
2104static int __pmac 2093static int
2105broadcast_wake(void) 2094broadcast_wake(void)
2106{ 2095{
2107 int ret = PBOOK_SLEEP_OK; 2096 int ret = PBOOK_SLEEP_OK;
@@ -2132,7 +2121,7 @@ static struct pci_save {
2132} *pbook_pci_saves; 2121} *pbook_pci_saves;
2133static int pbook_npci_saves; 2122static int pbook_npci_saves;
2134 2123
2135static void __pmac 2124static void
2136pbook_alloc_pci_save(void) 2125pbook_alloc_pci_save(void)
2137{ 2126{
2138 int npci; 2127 int npci;
@@ -2149,7 +2138,7 @@ pbook_alloc_pci_save(void)
2149 pbook_npci_saves = npci; 2138 pbook_npci_saves = npci;
2150} 2139}
2151 2140
2152static void __pmac 2141static void
2153pbook_free_pci_save(void) 2142pbook_free_pci_save(void)
2154{ 2143{
2155 if (pbook_pci_saves == NULL) 2144 if (pbook_pci_saves == NULL)
@@ -2159,7 +2148,7 @@ pbook_free_pci_save(void)
2159 pbook_npci_saves = 0; 2148 pbook_npci_saves = 0;
2160} 2149}
2161 2150
2162static void __pmac 2151static void
2163pbook_pci_save(void) 2152pbook_pci_save(void)
2164{ 2153{
2165 struct pci_save *ps = pbook_pci_saves; 2154 struct pci_save *ps = pbook_pci_saves;
@@ -2190,7 +2179,7 @@ pbook_pci_save(void)
2190 * during boot, it will be in the pci dev list. If it's disabled at this point 2179 * during boot, it will be in the pci dev list. If it's disabled at this point
2191 * (and it will probably be), then you can't access it's config space. 2180 * (and it will probably be), then you can't access it's config space.
2192 */ 2181 */
2193static void __pmac 2182static void
2194pbook_pci_restore(void) 2183pbook_pci_restore(void)
2195{ 2184{
2196 u16 cmd; 2185 u16 cmd;
@@ -2238,7 +2227,7 @@ pbook_pci_restore(void)
2238 2227
2239#ifdef DEBUG_SLEEP 2228#ifdef DEBUG_SLEEP
2240/* N.B. This doesn't work on the 3400 */ 2229/* N.B. This doesn't work on the 3400 */
2241void __pmac 2230void
2242pmu_blink(int n) 2231pmu_blink(int n)
2243{ 2232{
2244 struct adb_request req; 2233 struct adb_request req;
@@ -2277,9 +2266,9 @@ pmu_blink(int n)
2277 * Put the powerbook to sleep. 2266 * Put the powerbook to sleep.
2278 */ 2267 */
2279 2268
2280static u32 save_via[8] __pmacdata; 2269static u32 save_via[8];
2281 2270
2282static void __pmac 2271static void
2283save_via_state(void) 2272save_via_state(void)
2284{ 2273{
2285 save_via[0] = in_8(&via[ANH]); 2274 save_via[0] = in_8(&via[ANH]);
@@ -2291,7 +2280,7 @@ save_via_state(void)
2291 save_via[6] = in_8(&via[T1CL]); 2280 save_via[6] = in_8(&via[T1CL]);
2292 save_via[7] = in_8(&via[T1CH]); 2281 save_via[7] = in_8(&via[T1CH]);
2293} 2282}
2294static void __pmac 2283static void
2295restore_via_state(void) 2284restore_via_state(void)
2296{ 2285{
2297 out_8(&via[ANH], save_via[0]); 2286 out_8(&via[ANH], save_via[0]);
@@ -2307,7 +2296,7 @@ restore_via_state(void)
2307 out_8(&via[IER], IER_SET | SR_INT | CB1_INT); 2296 out_8(&via[IER], IER_SET | SR_INT | CB1_INT);
2308} 2297}
2309 2298
2310static int __pmac 2299static int
2311pmac_suspend_devices(void) 2300pmac_suspend_devices(void)
2312{ 2301{
2313 int ret; 2302 int ret;
@@ -2397,7 +2386,7 @@ pmac_suspend_devices(void)
2397 return 0; 2386 return 0;
2398} 2387}
2399 2388
2400static int __pmac 2389static int
2401pmac_wakeup_devices(void) 2390pmac_wakeup_devices(void)
2402{ 2391{
2403 mdelay(100); 2392 mdelay(100);
@@ -2436,7 +2425,7 @@ pmac_wakeup_devices(void)
2436#define GRACKLE_NAP (1<<4) 2425#define GRACKLE_NAP (1<<4)
2437#define GRACKLE_SLEEP (1<<3) 2426#define GRACKLE_SLEEP (1<<3)
2438 2427
2439int __pmac 2428int
2440powerbook_sleep_grackle(void) 2429powerbook_sleep_grackle(void)
2441{ 2430{
2442 unsigned long save_l2cr; 2431 unsigned long save_l2cr;
@@ -2520,7 +2509,7 @@ powerbook_sleep_grackle(void)
2520 return 0; 2509 return 0;
2521} 2510}
2522 2511
2523static int __pmac 2512static int
2524powerbook_sleep_Core99(void) 2513powerbook_sleep_Core99(void)
2525{ 2514{
2526 unsigned long save_l2cr; 2515 unsigned long save_l2cr;
@@ -2620,7 +2609,7 @@ powerbook_sleep_Core99(void)
2620#define PB3400_MEM_CTRL 0xf8000000 2609#define PB3400_MEM_CTRL 0xf8000000
2621#define PB3400_MEM_CTRL_SLEEP 0x70 2610#define PB3400_MEM_CTRL_SLEEP 0x70
2622 2611
2623static int __pmac 2612static int
2624powerbook_sleep_3400(void) 2613powerbook_sleep_3400(void)
2625{ 2614{
2626 int ret, i, x; 2615 int ret, i, x;
@@ -2720,9 +2709,9 @@ struct pmu_private {
2720}; 2709};
2721 2710
2722static LIST_HEAD(all_pmu_pvt); 2711static LIST_HEAD(all_pmu_pvt);
2723static DEFINE_SPINLOCK(all_pvt_lock __pmacdata); 2712static DEFINE_SPINLOCK(all_pvt_lock);
2724 2713
2725static void __pmac 2714static void
2726pmu_pass_intr(unsigned char *data, int len) 2715pmu_pass_intr(unsigned char *data, int len)
2727{ 2716{
2728 struct pmu_private *pp; 2717 struct pmu_private *pp;
@@ -2751,7 +2740,7 @@ pmu_pass_intr(unsigned char *data, int len)
2751 spin_unlock_irqrestore(&all_pvt_lock, flags); 2740 spin_unlock_irqrestore(&all_pvt_lock, flags);
2752} 2741}
2753 2742
2754static int __pmac 2743static int
2755pmu_open(struct inode *inode, struct file *file) 2744pmu_open(struct inode *inode, struct file *file)
2756{ 2745{
2757 struct pmu_private *pp; 2746 struct pmu_private *pp;
@@ -2773,7 +2762,7 @@ pmu_open(struct inode *inode, struct file *file)
2773 return 0; 2762 return 0;
2774} 2763}
2775 2764
2776static ssize_t __pmac 2765static ssize_t
2777pmu_read(struct file *file, char __user *buf, 2766pmu_read(struct file *file, char __user *buf,
2778 size_t count, loff_t *ppos) 2767 size_t count, loff_t *ppos)
2779{ 2768{
@@ -2825,14 +2814,14 @@ pmu_read(struct file *file, char __user *buf,
2825 return ret; 2814 return ret;
2826} 2815}
2827 2816
2828static ssize_t __pmac 2817static ssize_t
2829pmu_write(struct file *file, const char __user *buf, 2818pmu_write(struct file *file, const char __user *buf,
2830 size_t count, loff_t *ppos) 2819 size_t count, loff_t *ppos)
2831{ 2820{
2832 return 0; 2821 return 0;
2833} 2822}
2834 2823
2835static unsigned int __pmac 2824static unsigned int
2836pmu_fpoll(struct file *filp, poll_table *wait) 2825pmu_fpoll(struct file *filp, poll_table *wait)
2837{ 2826{
2838 struct pmu_private *pp = filp->private_data; 2827 struct pmu_private *pp = filp->private_data;
@@ -2849,7 +2838,7 @@ pmu_fpoll(struct file *filp, poll_table *wait)
2849 return mask; 2838 return mask;
2850} 2839}
2851 2840
2852static int __pmac 2841static int
2853pmu_release(struct inode *inode, struct file *file) 2842pmu_release(struct inode *inode, struct file *file)
2854{ 2843{
2855 struct pmu_private *pp = file->private_data; 2844 struct pmu_private *pp = file->private_data;
@@ -2874,8 +2863,7 @@ pmu_release(struct inode *inode, struct file *file)
2874 return 0; 2863 return 0;
2875} 2864}
2876 2865
2877/* Note: removed __openfirmware here since it causes link errors */ 2866static int
2878static int __pmac
2879pmu_ioctl(struct inode * inode, struct file *filp, 2867pmu_ioctl(struct inode * inode, struct file *filp,
2880 u_int cmd, u_long arg) 2868 u_int cmd, u_long arg)
2881{ 2869{
@@ -2957,7 +2945,7 @@ pmu_ioctl(struct inode * inode, struct file *filp,
2957 return error; 2945 return error;
2958} 2946}
2959 2947
2960static struct file_operations pmu_device_fops __pmacdata = { 2948static struct file_operations pmu_device_fops = {
2961 .read = pmu_read, 2949 .read = pmu_read,
2962 .write = pmu_write, 2950 .write = pmu_write,
2963 .poll = pmu_fpoll, 2951 .poll = pmu_fpoll,
@@ -2966,7 +2954,7 @@ static struct file_operations pmu_device_fops __pmacdata = {
2966 .release = pmu_release, 2954 .release = pmu_release,
2967}; 2955};
2968 2956
2969static struct miscdevice pmu_device __pmacdata = { 2957static struct miscdevice pmu_device = {
2970 PMU_MINOR, "pmu", &pmu_device_fops 2958 PMU_MINOR, "pmu", &pmu_device_fops
2971}; 2959};
2972 2960
@@ -2982,7 +2970,7 @@ device_initcall(pmu_device_init);
2982 2970
2983 2971
2984#ifdef DEBUG_SLEEP 2972#ifdef DEBUG_SLEEP
2985static inline void __pmac 2973static inline void
2986polled_handshake(volatile unsigned char __iomem *via) 2974polled_handshake(volatile unsigned char __iomem *via)
2987{ 2975{
2988 via[B] &= ~TREQ; eieio(); 2976 via[B] &= ~TREQ; eieio();
@@ -2993,7 +2981,7 @@ polled_handshake(volatile unsigned char __iomem *via)
2993 ; 2981 ;
2994} 2982}
2995 2983
2996static inline void __pmac 2984static inline void
2997polled_send_byte(volatile unsigned char __iomem *via, int x) 2985polled_send_byte(volatile unsigned char __iomem *via, int x)
2998{ 2986{
2999 via[ACR] |= SR_OUT | SR_EXT; eieio(); 2987 via[ACR] |= SR_OUT | SR_EXT; eieio();
@@ -3001,7 +2989,7 @@ polled_send_byte(volatile unsigned char __iomem *via, int x)
3001 polled_handshake(via); 2989 polled_handshake(via);
3002} 2990}
3003 2991
3004static inline int __pmac 2992static inline int
3005polled_recv_byte(volatile unsigned char __iomem *via) 2993polled_recv_byte(volatile unsigned char __iomem *via)
3006{ 2994{
3007 int x; 2995 int x;
@@ -3013,7 +3001,7 @@ polled_recv_byte(volatile unsigned char __iomem *via)
3013 return x; 3001 return x;
3014} 3002}
3015 3003
3016int __pmac 3004int
3017pmu_polled_request(struct adb_request *req) 3005pmu_polled_request(struct adb_request *req)
3018{ 3006{
3019 unsigned long flags; 3007 unsigned long flags;
diff --git a/drivers/macintosh/via-pmu68k.c b/drivers/macintosh/via-pmu68k.c
index 820dc52e30bc..6f80d76ac17c 100644
--- a/drivers/macintosh/via-pmu68k.c
+++ b/drivers/macintosh/via-pmu68k.c
@@ -835,7 +835,7 @@ static struct pci_save {
835} *pbook_pci_saves; 835} *pbook_pci_saves;
836static int n_pbook_pci_saves; 836static int n_pbook_pci_saves;
837 837
838static inline void __openfirmware 838static inline void
839pbook_pci_save(void) 839pbook_pci_save(void)
840{ 840{
841 int npci; 841 int npci;
@@ -863,7 +863,7 @@ pbook_pci_save(void)
863 } 863 }
864} 864}
865 865
866static inline void __openfirmware 866static inline void
867pbook_pci_restore(void) 867pbook_pci_restore(void)
868{ 868{
869 u16 cmd; 869 u16 cmd;
@@ -902,7 +902,7 @@ pbook_pci_restore(void)
902#define IRQ_ENABLE ((unsigned int *)0xf3000024) 902#define IRQ_ENABLE ((unsigned int *)0xf3000024)
903#define MEM_CTRL ((unsigned int *)0xf8000070) 903#define MEM_CTRL ((unsigned int *)0xf8000070)
904 904
905int __openfirmware powerbook_sleep(void) 905int powerbook_sleep(void)
906{ 906{
907 int ret, i, x; 907 int ret, i, x;
908 static int save_backlight; 908 static int save_backlight;
@@ -1001,25 +1001,24 @@ int __openfirmware powerbook_sleep(void)
1001/* 1001/*
1002 * Support for /dev/pmu device 1002 * Support for /dev/pmu device
1003 */ 1003 */
1004static int __openfirmware pmu_open(struct inode *inode, struct file *file) 1004static int pmu_open(struct inode *inode, struct file *file)
1005{ 1005{
1006 return 0; 1006 return 0;
1007} 1007}
1008 1008
1009static ssize_t __openfirmware pmu_read(struct file *file, char *buf, 1009static ssize_t pmu_read(struct file *file, char *buf,
1010 size_t count, loff_t *ppos) 1010 size_t count, loff_t *ppos)
1011{ 1011{
1012 return 0; 1012 return 0;
1013} 1013}
1014 1014
1015static ssize_t __openfirmware pmu_write(struct file *file, const char *buf, 1015static ssize_t pmu_write(struct file *file, const char *buf,
1016 size_t count, loff_t *ppos) 1016 size_t count, loff_t *ppos)
1017{ 1017{
1018 return 0; 1018 return 0;
1019} 1019}
1020 1020
1021/* Note: removed __openfirmware here since it causes link errors */ 1021static int pmu_ioctl(struct inode * inode, struct file *filp,
1022static int /*__openfirmware*/ pmu_ioctl(struct inode * inode, struct file *filp,
1023 u_int cmd, u_long arg) 1022 u_int cmd, u_long arg)
1024{ 1023{
1025 int error; 1024 int error;
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c
index 73f2fcfc557f..bbca8ae8018c 100644
--- a/drivers/net/bmac.c
+++ b/drivers/net/bmac.c
@@ -1658,6 +1658,7 @@ static struct of_device_id bmac_match[] =
1658 }, 1658 },
1659 {}, 1659 {},
1660}; 1660};
1661MODULE_DEVICE_TABLE (of, bmac_match);
1661 1662
1662static struct macio_driver bmac_driver = 1663static struct macio_driver bmac_driver =
1663{ 1664{
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 36da54ad2b7b..e5246f227c98 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -514,7 +514,7 @@ static int ibmveth_open(struct net_device *netdev)
514 514
515 if(lpar_rc != H_Success) { 515 if(lpar_rc != H_Success) {
516 ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc); 516 ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc);
517 ibmveth_error_printk("buffer TCE:0x%x filter TCE:0x%x rxq desc:0x%lx MAC:0x%lx\n", 517 ibmveth_error_printk("buffer TCE:0x%lx filter TCE:0x%lx rxq desc:0x%lx MAC:0x%lx\n",
518 adapter->buffer_list_dma, 518 adapter->buffer_list_dma,
519 adapter->filter_list_dma, 519 adapter->filter_list_dma,
520 rxq_desc.desc, 520 rxq_desc.desc,
@@ -1174,14 +1174,16 @@ static struct vio_device_id ibmveth_device_table[] __devinitdata= {
1174 { "network", "IBM,l-lan"}, 1174 { "network", "IBM,l-lan"},
1175 { "", "" } 1175 { "", "" }
1176}; 1176};
1177
1178MODULE_DEVICE_TABLE(vio, ibmveth_device_table); 1177MODULE_DEVICE_TABLE(vio, ibmveth_device_table);
1179 1178
1180static struct vio_driver ibmveth_driver = { 1179static struct vio_driver ibmveth_driver = {
1181 .name = (char *)ibmveth_driver_name, 1180 .id_table = ibmveth_device_table,
1182 .id_table = ibmveth_device_table, 1181 .probe = ibmveth_probe,
1183 .probe = ibmveth_probe, 1182 .remove = ibmveth_remove,
1184 .remove = ibmveth_remove 1183 .driver = {
1184 .name = ibmveth_driver_name,
1185 .owner = THIS_MODULE,
1186 }
1185}; 1187};
1186 1188
1187static int __init ibmveth_module_init(void) 1189static int __init ibmveth_module_init(void)
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c
index 3d56cf5a4e23..f5ea39ff1017 100644
--- a/drivers/net/iseries_veth.c
+++ b/drivers/net/iseries_veth.c
@@ -70,8 +70,9 @@
70#include <linux/delay.h> 70#include <linux/delay.h>
71#include <linux/mm.h> 71#include <linux/mm.h>
72#include <linux/ethtool.h> 72#include <linux/ethtool.h>
73
74#include <asm/abs_addr.h>
73#include <asm/iSeries/mf.h> 75#include <asm/iSeries/mf.h>
74#include <asm/iSeries/iSeries_pci.h>
75#include <asm/uaccess.h> 76#include <asm/uaccess.h>
76 77
77#include <asm/iSeries/HvLpConfig.h> 78#include <asm/iSeries/HvLpConfig.h>
@@ -1397,13 +1398,13 @@ static inline void veth_build_dma_list(struct dma_chunk *list,
1397 * it just at the granularity of iSeries real->absolute 1398 * it just at the granularity of iSeries real->absolute
1398 * mapping? Indeed, given the way the allocator works, can we 1399 * mapping? Indeed, given the way the allocator works, can we
1399 * count on them being absolutely contiguous? */ 1400 * count on them being absolutely contiguous? */
1400 list[0].addr = ISERIES_HV_ADDR(p); 1401 list[0].addr = iseries_hv_addr(p);
1401 list[0].size = min(length, 1402 list[0].size = min(length,
1402 PAGE_SIZE - ((unsigned long)p & ~PAGE_MASK)); 1403 PAGE_SIZE - ((unsigned long)p & ~PAGE_MASK));
1403 1404
1404 done = list[0].size; 1405 done = list[0].size;
1405 while (done < length) { 1406 while (done < length) {
1406 list[i].addr = ISERIES_HV_ADDR(p + done); 1407 list[i].addr = iseries_hv_addr(p + done);
1407 list[i].size = min(length-done, PAGE_SIZE); 1408 list[i].size = min(length-done, PAGE_SIZE);
1408 done += list[i].size; 1409 done += list[i].size;
1409 i++; 1410 i++;
@@ -1496,8 +1497,8 @@ static void veth_receive(struct veth_lpar_connection *cnx,
1496 cnx->dst_inst, 1497 cnx->dst_inst,
1497 HvLpDma_AddressType_RealAddress, 1498 HvLpDma_AddressType_RealAddress,
1498 HvLpDma_AddressType_TceIndex, 1499 HvLpDma_AddressType_TceIndex,
1499 ISERIES_HV_ADDR(&local_list), 1500 iseries_hv_addr(&local_list),
1500 ISERIES_HV_ADDR(&remote_list), 1501 iseries_hv_addr(&remote_list),
1501 length); 1502 length);
1502 if (rc != HvLpDma_Rc_Good) { 1503 if (rc != HvLpDma_Rc_Good) {
1503 dev_kfree_skb_irq(skb); 1504 dev_kfree_skb_irq(skb);
@@ -1647,10 +1648,13 @@ static struct vio_device_id veth_device_table[] __devinitdata = {
1647MODULE_DEVICE_TABLE(vio, veth_device_table); 1648MODULE_DEVICE_TABLE(vio, veth_device_table);
1648 1649
1649static struct vio_driver veth_driver = { 1650static struct vio_driver veth_driver = {
1650 .name = DRV_NAME,
1651 .id_table = veth_device_table, 1651 .id_table = veth_device_table,
1652 .probe = veth_probe, 1652 .probe = veth_probe,
1653 .remove = veth_remove 1653 .remove = veth_remove,
1654 .driver = {
1655 .name = DRV_NAME,
1656 .owner = THIS_MODULE,
1657 }
1654}; 1658};
1655 1659
1656/* 1660/*
diff --git a/drivers/net/mace.c b/drivers/net/mace.c
index 09b1e7b364e5..2a5add257b8f 100644
--- a/drivers/net/mace.c
+++ b/drivers/net/mace.c
@@ -1016,6 +1016,7 @@ static struct of_device_id mace_match[] =
1016 }, 1016 },
1017 {}, 1017 {},
1018}; 1018};
1019MODULE_DEVICE_TABLE (of, mace_match);
1019 1020
1020static struct macio_driver mace_driver = 1021static struct macio_driver mace_driver =
1021{ 1022{
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 25c9a99c377b..8fbba21d975b 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -1533,6 +1533,9 @@ static int mv643xx_eth_probe(struct device *ddev)
1533 printk(KERN_NOTICE "%s: RX NAPI Enabled \n", dev->name); 1533 printk(KERN_NOTICE "%s: RX NAPI Enabled \n", dev->name);
1534#endif 1534#endif
1535 1535
1536 if (mp->tx_sram_size > 0)
1537 printk(KERN_NOTICE "%s: Using SRAM\n", dev->name);
1538
1536 return 0; 1539 return 0;
1537 1540
1538out: 1541out:
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig
index 36cc9a96a338..ccf20039e909 100644
--- a/drivers/pcmcia/Kconfig
+++ b/drivers/pcmcia/Kconfig
@@ -154,6 +154,16 @@ config TCIC
154 "Bridge" is the name used for the hardware inside your computer that 154 "Bridge" is the name used for the hardware inside your computer that
155 PCMCIA cards are plugged into. If unsure, say N. 155 PCMCIA cards are plugged into. If unsure, say N.
156 156
157config PCMCIA_M8XX
158 tristate "MPC8xx PCMCIA support"
159 depends on PCMCIA && PPC
160 select PCCARD_NONSTATIC
161 help
162 Say Y here to include support for PowerPC 8xx series PCMCIA
163 controller.
164
165 This driver is also available as a module called m8xx_pcmcia.
166
157config HD64465_PCMCIA 167config HD64465_PCMCIA
158 tristate "HD64465 host bridge support" 168 tristate "HD64465 host bridge support"
159 depends on HD64465 && PCMCIA 169 depends on HD64465 && PCMCIA
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile
index da7a8f2dab24..fe37541abbfe 100644
--- a/drivers/pcmcia/Makefile
+++ b/drivers/pcmcia/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_PD6729) += pd6729.o
25obj-$(CONFIG_I82365) += i82365.o 25obj-$(CONFIG_I82365) += i82365.o
26obj-$(CONFIG_I82092) += i82092.o 26obj-$(CONFIG_I82092) += i82092.o
27obj-$(CONFIG_TCIC) += tcic.o 27obj-$(CONFIG_TCIC) += tcic.o
28obj-$(CONFIG_PCMCIA_M8XX) += m8xx_pcmcia.o
28obj-$(CONFIG_HD64465_PCMCIA) += hd64465_ss.o 29obj-$(CONFIG_HD64465_PCMCIA) += hd64465_ss.o
29obj-$(CONFIG_PCMCIA_SA1100) += sa11xx_core.o sa1100_cs.o 30obj-$(CONFIG_PCMCIA_SA1100) += sa11xx_core.o sa1100_cs.o
30obj-$(CONFIG_PCMCIA_SA1111) += sa11xx_core.o sa1111_cs.o 31obj-$(CONFIG_PCMCIA_SA1111) += sa11xx_core.o sa1111_cs.o
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
new file mode 100644
index 000000000000..f8bed87cf2f1
--- /dev/null
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -0,0 +1,1290 @@
1/*
2 * m8xx_pcmcia.c - Linux PCMCIA socket driver for the mpc8xx series.
3 *
4 * (C) 1999-2000 Magnus Damm <damm@bitsmart.com>
5 * (C) 2001-2002 Montavista Software, Inc.
6 * <mlocke@mvista.com>
7 *
8 * Support for two slots by Cyclades Corporation
9 * <oliver.kurth@cyclades.de>
10 * Further fixes, v2.6 kernel port
11 * <marcelo.tosatti@cyclades.com>
12 *
13 * "The ExCA standard specifies that socket controllers should provide
14 * two IO and five memory windows per socket, which can be independently
15 * configured and positioned in the host address space and mapped to
16 * arbitrary segments of card address space. " - David A Hinds. 1999
17 *
18 * This controller does _not_ meet the ExCA standard.
19 *
20 * m8xx pcmcia controller brief info:
21 * + 8 windows (attrib, mem, i/o)
22 * + up to two slots (SLOT_A and SLOT_B)
23 * + inputpins, outputpins, event and mask registers.
24 * - no offset register. sigh.
25 *
26 * Because of the lacking offset register we must map the whole card.
27 * We assign each memory window PCMCIA_MEM_WIN_SIZE address space.
28 * Make sure there is (PCMCIA_MEM_WIN_SIZE * PCMCIA_MEM_WIN_NO
29 * * PCMCIA_SOCKETS_NO) bytes at PCMCIA_MEM_WIN_BASE.
30 * The i/o windows are dynamically allocated at PCMCIA_IO_WIN_BASE.
31 * They are maximum 64KByte each...
32 */
33
34#include <linux/module.h>
35#include <linux/init.h>
36#include <linux/types.h>
37#include <linux/fcntl.h>
38#include <linux/string.h>
39
40#include <asm/io.h>
41#include <asm/bitops.h>
42#include <asm/segment.h>
43#include <asm/system.h>
44
45#include <linux/kernel.h>
46#include <linux/errno.h>
47#include <linux/sched.h>
48#include <linux/slab.h>
49#include <linux/timer.h>
50#include <linux/ioport.h>
51#include <linux/delay.h>
52#include <linux/interrupt.h>
53
54#include <asm/mpc8xx.h>
55#include <asm/8xx_immap.h>
56#include <asm/irq.h>
57
58#include <pcmcia/version.h>
59#include <pcmcia/cs_types.h>
60#include <pcmcia/cs.h>
61#include <pcmcia/ss.h>
62
63#ifdef PCMCIA_DEBUG
64static int pc_debug = PCMCIA_DEBUG;
65module_param(pc_debug, int, 0);
66#define dprintk(args...) printk(KERN_DEBUG "m8xx_pcmcia: " args);
67#else
68#define dprintk(args...)
69#endif
70
71#define pcmcia_info(args...) printk(KERN_INFO "m8xx_pcmcia: "args)
72#define pcmcia_error(args...) printk(KERN_ERR "m8xx_pcmcia: "args)
73
74static const char *version = "Version 0.06, Aug 2005";
75MODULE_LICENSE("Dual MPL/GPL");
76
77#if !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B)
78
79/* The RPX series use SLOT_B */
80#if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_RPXLITE)
81#define CONFIG_PCMCIA_SLOT_B
82#define CONFIG_BD_IS_MHZ
83#endif
84
85/* The ADS board use SLOT_A */
86#ifdef CONFIG_ADS
87#define CONFIG_PCMCIA_SLOT_A
88#define CONFIG_BD_IS_MHZ
89#endif
90
91/* The FADS series are a mess */
92#ifdef CONFIG_FADS
93#if defined(CONFIG_MPC860T) || defined(CONFIG_MPC860) || defined(CONFIG_MPC821)
94#define CONFIG_PCMCIA_SLOT_A
95#else
96#define CONFIG_PCMCIA_SLOT_B
97#endif
98#endif
99
100/* Cyclades ACS uses both slots */
101#ifdef CONFIG_PRxK
102#define CONFIG_PCMCIA_SLOT_A
103#define CONFIG_PCMCIA_SLOT_B
104#endif
105
106#endif /* !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) */
107
108#if defined(CONFIG_PCMCIA_SLOT_A) && defined(CONFIG_PCMCIA_SLOT_B)
109
110#define PCMCIA_SOCKETS_NO 2
111/* We have only 8 windows, dualsocket support will be limited. */
112#define PCMCIA_MEM_WIN_NO 2
113#define PCMCIA_IO_WIN_NO 2
114#define PCMCIA_SLOT_MSG "SLOT_A and SLOT_B"
115
116#elif defined(CONFIG_PCMCIA_SLOT_A) || defined(CONFIG_PCMCIA_SLOT_B)
117
118#define PCMCIA_SOCKETS_NO 1
119/* full support for one slot */
120#define PCMCIA_MEM_WIN_NO 5
121#define PCMCIA_IO_WIN_NO 2
122
123/* define _slot_ to be able to optimize macros */
124
125#ifdef CONFIG_PCMCIA_SLOT_A
126#define _slot_ 0
127#define PCMCIA_SLOT_MSG "SLOT_A"
128#else
129#define _slot_ 1
130#define PCMCIA_SLOT_MSG "SLOT_B"
131#endif
132
133#else
134#error m8xx_pcmcia: Bad configuration!
135#endif
136
137/* ------------------------------------------------------------------------- */
138
139#define PCMCIA_MEM_WIN_BASE 0xe0000000 /* base address for memory window 0 */
140#define PCMCIA_MEM_WIN_SIZE 0x04000000 /* each memory window is 64 MByte */
141#define PCMCIA_IO_WIN_BASE _IO_BASE /* base address for io window 0 */
142
143#define PCMCIA_SCHLVL PCMCIA_INTERRUPT /* Status Change Interrupt Level */
144
145/* ------------------------------------------------------------------------- */
146
147/* 2.4.x and newer has this always in HZ */
148#define M8XX_BUSFREQ ((((bd_t *)&(__res))->bi_busfreq))
149
150static int pcmcia_schlvl = PCMCIA_SCHLVL;
151
152static spinlock_t events_lock = SPIN_LOCK_UNLOCKED;
153
154
155#define PCMCIA_SOCKET_KEY_5V 1
156#define PCMCIA_SOCKET_KEY_LV 2
157
158/* look up table for pgcrx registers */
159static u32 *m8xx_pgcrx[2] = {
160 &((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pgcra,
161 &((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pgcrb
162};
163
164/*
165 * This structure is used to address each window in the PCMCIA controller.
166 *
167 * Keep in mind that we assume that pcmcia_win[n+1] is mapped directly
168 * after pcmcia_win[n]...
169 */
170
171struct pcmcia_win {
172 u32 br;
173 u32 or;
174};
175
176/*
177 * For some reason the hardware guys decided to make both slots share
178 * some registers.
179 *
180 * Could someone invent object oriented hardware ?
181 *
182 * The macros are used to get the right bit from the registers.
183 * SLOT_A : slot = 0
184 * SLOT_B : slot = 1
185 */
186
187#define M8XX_PCMCIA_VS1(slot) (0x80000000 >> (slot << 4))
188#define M8XX_PCMCIA_VS2(slot) (0x40000000 >> (slot << 4))
189#define M8XX_PCMCIA_VS_MASK(slot) (0xc0000000 >> (slot << 4))
190#define M8XX_PCMCIA_VS_SHIFT(slot) (30 - (slot << 4))
191
192#define M8XX_PCMCIA_WP(slot) (0x20000000 >> (slot << 4))
193#define M8XX_PCMCIA_CD2(slot) (0x10000000 >> (slot << 4))
194#define M8XX_PCMCIA_CD1(slot) (0x08000000 >> (slot << 4))
195#define M8XX_PCMCIA_BVD2(slot) (0x04000000 >> (slot << 4))
196#define M8XX_PCMCIA_BVD1(slot) (0x02000000 >> (slot << 4))
197#define M8XX_PCMCIA_RDY(slot) (0x01000000 >> (slot << 4))
198#define M8XX_PCMCIA_RDY_L(slot) (0x00800000 >> (slot << 4))
199#define M8XX_PCMCIA_RDY_H(slot) (0x00400000 >> (slot << 4))
200#define M8XX_PCMCIA_RDY_R(slot) (0x00200000 >> (slot << 4))
201#define M8XX_PCMCIA_RDY_F(slot) (0x00100000 >> (slot << 4))
202#define M8XX_PCMCIA_MASK(slot) (0xFFFF0000 >> (slot << 4))
203
204#define M8XX_PCMCIA_POR_VALID 0x00000001
205#define M8XX_PCMCIA_POR_WRPROT 0x00000002
206#define M8XX_PCMCIA_POR_ATTRMEM 0x00000010
207#define M8XX_PCMCIA_POR_IO 0x00000018
208#define M8XX_PCMCIA_POR_16BIT 0x00000040
209
210#define M8XX_PGCRX(slot) m8xx_pgcrx[slot]
211
212#define M8XX_PGCRX_CXOE 0x00000080
213#define M8XX_PGCRX_CXRESET 0x00000040
214
215/* we keep one lookup table per socket to check flags */
216
217#define PCMCIA_EVENTS_MAX 5 /* 4 max at a time + termination */
218
219struct event_table {
220 u32 regbit;
221 u32 eventbit;
222};
223
224struct socket_info {
225 void (*handler)(void *info, u32 events);
226 void *info;
227
228 u32 slot;
229
230 socket_state_t state;
231 struct pccard_mem_map mem_win[PCMCIA_MEM_WIN_NO];
232 struct pccard_io_map io_win[PCMCIA_IO_WIN_NO];
233 struct event_table events[PCMCIA_EVENTS_MAX];
234 struct pcmcia_socket socket;
235};
236
237static struct socket_info socket[PCMCIA_SOCKETS_NO];
238
239/*
240 * Search this table to see if the windowsize is
241 * supported...
242 */
243
244#define M8XX_SIZES_NO 32
245
246static const u32 m8xx_size_to_gray[M8XX_SIZES_NO] =
247{
248 0x00000001, 0x00000002, 0x00000008, 0x00000004,
249 0x00000080, 0x00000040, 0x00000010, 0x00000020,
250 0x00008000, 0x00004000, 0x00001000, 0x00002000,
251 0x00000100, 0x00000200, 0x00000800, 0x00000400,
252
253 0x0fffffff, 0xffffffff, 0xffffffff, 0xffffffff,
254 0x01000000, 0x02000000, 0xffffffff, 0x04000000,
255 0x00010000, 0x00020000, 0x00080000, 0x00040000,
256 0x00800000, 0x00400000, 0x00100000, 0x00200000
257};
258
259/* ------------------------------------------------------------------------- */
260
261static irqreturn_t m8xx_interrupt(int irq, void *dev, struct pt_regs *regs);
262
263#define PCMCIA_BMT_LIMIT (15*4) /* Bus Monitor Timeout value */
264
265/* ------------------------------------------------------------------------- */
266/* board specific stuff: */
267/* voltage_set(), hardware_enable() and hardware_disable() */
268/* ------------------------------------------------------------------------- */
269/* RPX Boards from Embedded Planet */
270
271#if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_RPXLITE)
272
273/* The RPX boards seems to have it's bus monitor timeout set to 6*8 clocks.
274 * SYPCR is write once only, therefore must the slowest memory be faster
275 * than the bus monitor or we will get a machine check due to the bus timeout.
276 */
277
278#define PCMCIA_BOARD_MSG "RPX CLASSIC or RPX LITE"
279
280#undef PCMCIA_BMT_LIMIT
281#define PCMCIA_BMT_LIMIT (6*8)
282
283static int voltage_set(int slot, int vcc, int vpp)
284{
285 u32 reg = 0;
286
287 switch(vcc) {
288 case 0: break;
289 case 33:
290 reg |= BCSR1_PCVCTL4;
291 break;
292 case 50:
293 reg |= BCSR1_PCVCTL5;
294 break;
295 default:
296 return 1;
297 }
298
299 switch(vpp) {
300 case 0: break;
301 case 33:
302 case 50:
303 if(vcc == vpp)
304 reg |= BCSR1_PCVCTL6;
305 else
306 return 1;
307 break;
308 case 120:
309 reg |= BCSR1_PCVCTL7;
310 default:
311 return 1;
312 }
313
314 if(!((vcc == 50) || (vcc == 0)))
315 return 1;
316
317 /* first, turn off all power */
318
319 out_be32(((u32 *)RPX_CSR_ADDR), in_be32(((u32 *)RPX_CSR_ADDR)) & ~(BCSR1_PCVCTL4 | BCSR1_PCVCTL5 | BCSR1_PCVCTL6 | BCSR1_PCVCTL7));
320
321 /* enable new powersettings */
322
323 out_be32(((u32 *)RPX_CSR_ADDR), in_be32(((u32 *)RPX_CSR_ADDR)) | reg);
324
325 return 0;
326}
327
328#define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
329#define hardware_enable(_slot_) /* No hardware to enable */
330#define hardware_disable(_slot_) /* No hardware to disable */
331
332#endif /* CONFIG_RPXCLASSIC */
333
334/* FADS Boards from Motorola */
335
336#if defined(CONFIG_FADS)
337
338#define PCMCIA_BOARD_MSG "FADS"
339
340static int voltage_set(int slot, int vcc, int vpp)
341{
342 u32 reg = 0;
343
344 switch(vcc) {
345 case 0:
346 break;
347 case 33:
348 reg |= BCSR1_PCCVCC0;
349 break;
350 case 50:
351 reg |= BCSR1_PCCVCC1;
352 break;
353 default:
354 return 1;
355 }
356
357 switch(vpp) {
358 case 0:
359 break;
360 case 33:
361 case 50:
362 if(vcc == vpp)
363 reg |= BCSR1_PCCVPP1;
364 else
365 return 1;
366 break;
367 case 120:
368 if ((vcc == 33) || (vcc == 50))
369 reg |= BCSR1_PCCVPP0;
370 else
371 return 1;
372 default:
373 return 1;
374 }
375
376 /* first, turn off all power */
377 out_be32(&((u32 *)BCSR1), in_be32(&((u32 *)BCSR1)) & ~(BCSR1_PCCVCC_MASK | BCSR1_PCCVPP_MASK));
378
379 /* enable new powersettings */
380 out_be32(&((u32 *)BCSR1), in_be32(&((u32 *)BCSR1)) | reg);
381
382 return 0;
383}
384
385#define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
386
387static void hardware_enable(int slot)
388{
389 out_be32(&((u32 *)BCSR1), in_be32(&((u32 *)BCSR1)) & ~BCSR1_PCCEN);
390}
391
392static void hardware_disable(int slot)
393{
394 out_be32(&((u32 *)BCSR1), in_be32(&((u32 *)BCSR1)) | BCSR1_PCCEN);
395}
396
397#endif
398
399/* ------------------------------------------------------------------------- */
400/* Motorola MBX860 */
401
402#if defined(CONFIG_MBX)
403
404#define PCMCIA_BOARD_MSG "MBX"
405
406static int voltage_set(int slot, int vcc, int vpp)
407{
408 u8 reg = 0;
409
410 switch(vcc) {
411 case 0:
412 break;
413 case 33:
414 reg |= CSR2_VCC_33;
415 break;
416 case 50:
417 reg |= CSR2_VCC_50;
418 break;
419 default:
420 return 1;
421 }
422
423 switch(vpp) {
424 case 0:
425 break;
426 case 33:
427 case 50:
428 if(vcc == vpp)
429 reg |= CSR2_VPP_VCC;
430 else
431 return 1;
432 break;
433 case 120:
434 if ((vcc == 33) || (vcc == 50))
435 reg |= CSR2_VPP_12;
436 else
437 return 1;
438 default:
439 return 1;
440 }
441
442 /* first, turn off all power */
443 out_8(&((u8 *)MBX_CSR2_ADDR), in_8(&((u8 *)MBX_CSR2_ADDR)) & ~(CSR2_VCC_MASK | CSR2_VPP_MASK));
444
445 /* enable new powersettings */
446 out_8(&((u8 *)MBX_CSR2_ADDR), in_8(&((u8 *)MBX_CSR2_ADDR)) | reg);
447
448 return 0;
449}
450
451#define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
452#define hardware_enable(_slot_) /* No hardware to enable */
453#define hardware_disable(_slot_) /* No hardware to disable */
454
455#endif /* CONFIG_MBX */
456
457#if defined(CONFIG_PRxK)
458#include <asm/cpld.h>
459extern volatile fpga_pc_regs *fpga_pc;
460
461#define PCMCIA_BOARD_MSG "MPC855T"
462
463static int voltage_set(int slot, int vcc, int vpp)
464{
465 u8 reg = 0;
466 u8 regread;
467 cpld_regs *ccpld = get_cpld();
468
469 switch(vcc) {
470 case 0:
471 break;
472 case 33:
473 reg |= PCMCIA_VCC_33;
474 break;
475 case 50:
476 reg |= PCMCIA_VCC_50;
477 break;
478 default:
479 return 1;
480 }
481
482 switch(vpp) {
483 case 0:
484 break;
485 case 33:
486 case 50:
487 if(vcc == vpp)
488 reg |= PCMCIA_VPP_VCC;
489 else
490 return 1;
491 break;
492 case 120:
493 if ((vcc == 33) || (vcc == 50))
494 reg |= PCMCIA_VPP_12;
495 else
496 return 1;
497 default:
498 return 1;
499 }
500
501 reg = reg >> (slot << 2);
502 regread = in_8(&ccpld->fpga_pc_ctl);
503 if (reg != (regread & ((PCMCIA_VCC_MASK | PCMCIA_VPP_MASK) >> (slot << 2)))) {
504 /* enable new powersettings */
505 regread = regread & ~((PCMCIA_VCC_MASK | PCMCIA_VPP_MASK) >> (slot << 2));
506 out_8(&ccpld->fpga_pc_ctl, reg | regread);
507 msleep(100);
508 }
509
510 return 0;
511}
512
513#define socket_get(_slot_) PCMCIA_SOCKET_KEY_LV
514#define hardware_enable(_slot_) /* No hardware to enable */
515#define hardware_disable(_slot_) /* No hardware to disable */
516
517#endif /* CONFIG_PRxK */
518
519static void m8xx_shutdown(void)
520{
521 u32 m, i;
522 struct pcmcia_win *w;
523
524 for(i = 0; i < PCMCIA_SOCKETS_NO; i++){
525 w = (void *) &((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pbr0;
526
527 out_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pscr, M8XX_PCMCIA_MASK(i));
528 out_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_per, in_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_per) & ~M8XX_PCMCIA_MASK(i));
529
530 /* turn off interrupt and disable CxOE */
531 out_be32(M8XX_PGCRX(i), M8XX_PGCRX_CXOE);
532
533 /* turn off memory windows */
534 for(m = 0; m < PCMCIA_MEM_WIN_NO; m++) {
535 out_be32(&w->or, 0); /* set to not valid */
536 w++;
537 }
538
539 /* turn off voltage */
540 voltage_set(i, 0, 0);
541
542 /* disable external hardware */
543 hardware_disable(i);
544 }
545
546 free_irq(pcmcia_schlvl, NULL);
547}
548
549/* copied from tcic.c */
550
551static int m8xx_drv_suspend(struct device *dev, pm_message_t state, u32 level)
552{
553 int ret = 0;
554 if (level == SUSPEND_SAVE_STATE)
555 ret = pcmcia_socket_dev_suspend(dev, state);
556 return ret;
557}
558
559static int m8xx_drv_resume(struct device *dev, u32 level)
560{
561 int ret = 0;
562 if (level == RESUME_RESTORE_STATE)
563 ret = pcmcia_socket_dev_resume(dev);
564 return ret;
565}
566
567static struct device_driver m8xx_driver = {
568 .name = "m8xx-pcmcia",
569 .bus = &platform_bus_type,
570 .suspend = m8xx_drv_suspend,
571 .resume = m8xx_drv_resume,
572};
573
574static struct platform_device m8xx_device = {
575 .name = "m8xx-pcmcia",
576 .id = 0,
577};
578
579static u32 pending_events[PCMCIA_SOCKETS_NO];
580static spinlock_t pending_event_lock = SPIN_LOCK_UNLOCKED;
581
582static irqreturn_t m8xx_interrupt(int irq, void *dev, struct pt_regs *regs)
583{
584 struct socket_info *s;
585 struct event_table *e;
586 unsigned int i, events, pscr, pipr, per;
587
588 dprintk("Interrupt!\n");
589 /* get interrupt sources */
590
591 pscr = in_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pscr);
592 pipr = in_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pipr);
593 per = in_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_per);
594
595 for(i = 0; i < PCMCIA_SOCKETS_NO; i++) {
596 s = &socket[i];
597 e = &s->events[0];
598 events = 0;
599
600 while(e->regbit) {
601 if(pscr & e->regbit)
602 events |= e->eventbit;
603
604 e++;
605 }
606
607 /*
608 * report only if both card detect signals are the same
609 * not too nice done,
610 * we depend on that CD2 is the bit to the left of CD1...
611 */
612 if(events & SS_DETECT)
613 if(((pipr & M8XX_PCMCIA_CD2(i)) >> 1) ^
614 (pipr & M8XX_PCMCIA_CD1(i)))
615 {
616 events &= ~SS_DETECT;
617 }
618
619#ifdef PCMCIA_GLITCHY_CD
620 /*
621 * I've experienced CD problems with my ADS board.
622 * We make an extra check to see if there was a
623 * real change of Card detection.
624 */
625
626 if((events & SS_DETECT) &&
627 ((pipr &
628 (M8XX_PCMCIA_CD2(i) | M8XX_PCMCIA_CD1(i))) == 0) &&
629 (s->state.Vcc | s->state.Vpp)) {
630 events &= ~SS_DETECT;
631 /*printk( "CD glitch workaround - CD = 0x%08x!\n",
632 (pipr & (M8XX_PCMCIA_CD2(i)
633 | M8XX_PCMCIA_CD1(i))));*/
634 }
635#endif
636
637 /* call the handler */
638
639 dprintk("slot %u: events = 0x%02x, pscr = 0x%08x, "
640 "pipr = 0x%08x\n",
641 i, events, pscr, pipr);
642
643 if(events) {
644 spin_lock(&pending_event_lock);
645 pending_events[i] |= events;
646 spin_unlock(&pending_event_lock);
647 /*
648 * Turn off RDY_L bits in the PER mask on
649 * CD interrupt receival.
650 *
651 * They can generate bad interrupts on the
652 * ACS4,8,16,32. - marcelo
653 */
654 per &= ~M8XX_PCMCIA_RDY_L(0);
655 per &= ~M8XX_PCMCIA_RDY_L(1);
656
657 out_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_per, per);
658
659 if (events)
660 pcmcia_parse_events(&socket[i].socket, events);
661 }
662 }
663
664 /* clear the interrupt sources */
665 out_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pscr, pscr);
666
667 dprintk("Interrupt done.\n");
668
669 return IRQ_HANDLED;
670}
671
672static u32 m8xx_get_graycode(u32 size)
673{
674 u32 k;
675
676 for(k = 0; k < M8XX_SIZES_NO; k++)
677 if(m8xx_size_to_gray[k] == size)
678 break;
679
680 if((k == M8XX_SIZES_NO) || (m8xx_size_to_gray[k] == -1))
681 k = -1;
682
683 return k;
684}
685
686static u32 m8xx_get_speed(u32 ns, u32 is_io)
687{
688 u32 reg, clocks, psst, psl, psht;
689
690 if(!ns) {
691
692 /*
693 * We get called with IO maps setup to 0ns
694 * if not specified by the user.
695 * They should be 255ns.
696 */
697
698 if(is_io)
699 ns = 255;
700 else
701 ns = 100; /* fast memory if 0 */
702 }
703
704 /*
705 * In PSST, PSL, PSHT fields we tell the controller
706 * timing parameters in CLKOUT clock cycles.
707 * CLKOUT is the same as GCLK2_50.
708 */
709
710/* how we want to adjust the timing - in percent */
711
712#define ADJ 180 /* 80 % longer accesstime - to be sure */
713
714 clocks = ((M8XX_BUSFREQ / 1000) * ns) / 1000;
715 clocks = (clocks * ADJ) / (100*1000);
716 if(clocks >= PCMCIA_BMT_LIMIT) {
717 printk( "Max access time limit reached\n");
718 clocks = PCMCIA_BMT_LIMIT-1;
719 }
720
721 psst = clocks / 7; /* setup time */
722 psht = clocks / 7; /* hold time */
723 psl = (clocks * 5) / 7; /* strobe length */
724
725 psst += clocks - (psst + psht + psl);
726
727 reg = psst << 12;
728 reg |= psl << 7;
729 reg |= psht << 16;
730
731 return reg;
732}
733
734static int m8xx_get_status(struct pcmcia_socket *sock, unsigned int *value)
735{
736 int lsock = container_of(sock, struct socket_info, socket)->slot;
737 struct socket_info *s = &socket[lsock];
738 unsigned int pipr, reg;
739
740 pipr = in_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pipr);
741
742 *value = ((pipr & (M8XX_PCMCIA_CD1(lsock)
743 | M8XX_PCMCIA_CD2(lsock))) == 0) ? SS_DETECT : 0;
744 *value |= (pipr & M8XX_PCMCIA_WP(lsock)) ? SS_WRPROT : 0;
745
746 if (s->state.flags & SS_IOCARD)
747 *value |= (pipr & M8XX_PCMCIA_BVD1(lsock)) ? SS_STSCHG : 0;
748 else {
749 *value |= (pipr & M8XX_PCMCIA_RDY(lsock)) ? SS_READY : 0;
750 *value |= (pipr & M8XX_PCMCIA_BVD1(lsock)) ? SS_BATDEAD : 0;
751 *value |= (pipr & M8XX_PCMCIA_BVD2(lsock)) ? SS_BATWARN : 0;
752 }
753
754 if (s->state.Vcc | s->state.Vpp)
755 *value |= SS_POWERON;
756
757 /*
758 * Voltage detection:
759 * This driver only supports 16-Bit pc-cards.
760 * Cardbus is not handled here.
761 *
762 * To determine what voltage to use we must read the VS1 and VS2 pin.
763 * Depending on what socket type is present,
764 * different combinations mean different things.
765 *
766 * Card Key Socket Key VS1 VS2 Card Vcc for CIS parse
767 *
768 * 5V 5V, LV* NC NC 5V only 5V (if available)
769 *
770 * 5V 5V, LV* GND NC 5 or 3.3V as low as possible
771 *
772 * 5V 5V, LV* GND GND 5, 3.3, x.xV as low as possible
773 *
774 * LV* 5V - - shall not fit into socket
775 *
776 * LV* LV* GND NC 3.3V only 3.3V
777 *
778 * LV* LV* NC GND x.xV x.xV (if avail.)
779 *
780 * LV* LV* GND GND 3.3 or x.xV as low as possible
781 *
782 * *LV means Low Voltage
783 *
784 *
785 * That gives us the following table:
786 *
787 * Socket VS1 VS2 Voltage
788 *
789 * 5V NC NC 5V
790 * 5V NC GND none (should not be possible)
791 * 5V GND NC >= 3.3V
792 * 5V GND GND >= x.xV
793 *
794 * LV NC NC 5V (if available)
795 * LV NC GND x.xV (if available)
796 * LV GND NC 3.3V
797 * LV GND GND >= x.xV
798 *
799 * So, how do I determine if I have a 5V or a LV
800 * socket on my board? Look at the socket!
801 *
802 *
803 * Socket with 5V key:
804 * ++--------------------------------------------+
805 * || |
806 * || ||
807 * || ||
808 * | |
809 * +---------------------------------------------+
810 *
811 * Socket with LV key:
812 * ++--------------------------------------------+
813 * || |
814 * | ||
815 * | ||
816 * | |
817 * +---------------------------------------------+
818 *
819 *
820 * With other words - LV only cards does not fit
821 * into the 5V socket!
822 */
823
824 /* read out VS1 and VS2 */
825
826 reg = (pipr & M8XX_PCMCIA_VS_MASK(lsock))
827 >> M8XX_PCMCIA_VS_SHIFT(lsock);
828
829 if(socket_get(lsock) == PCMCIA_SOCKET_KEY_LV) {
830 switch(reg) {
831 case 1:
832 *value |= SS_3VCARD;
833 break; /* GND, NC - 3.3V only */
834 case 2:
835 *value |= SS_XVCARD;
836 break; /* NC. GND - x.xV only */
837 };
838 }
839
840 dprintk("GetStatus(%d) = %#2.2x\n", lsock, *value);
841 return 0;
842}
843
844static int m8xx_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
845{
846 int lsock = container_of(sock, struct socket_info, socket)->slot;
847 *state = socket[lsock].state; /* copy the whole structure */
848
849 dprintk("GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, "
850 "io_irq %d, csc_mask %#2.2x\n", lsock, state->flags,
851 state->Vcc, state->Vpp, state->io_irq, state->csc_mask);
852 return 0;
853}
854
855static int m8xx_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
856{
857 int lsock = container_of(sock, struct socket_info, socket)->slot;
858 struct socket_info *s = &socket[lsock];
859 struct event_table *e;
860 unsigned int reg;
861 unsigned long flags;
862
863 dprintk( "SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, "
864 "io_irq %d, csc_mask %#2.2x)\n", lsock, state->flags,
865 state->Vcc, state->Vpp, state->io_irq, state->csc_mask);
866
867 /* First, set voltage - bail out if invalid */
868 if(voltage_set(lsock, state->Vcc, state->Vpp))
869 return -EINVAL;
870
871 /* Take care of reset... */
872 if(state->flags & SS_RESET)
873 out_be32(M8XX_PGCRX(lsock), in_be32(M8XX_PGCRX(lsock)) | M8XX_PGCRX_CXRESET); /* active high */
874 else
875 out_be32(M8XX_PGCRX(lsock), in_be32(M8XX_PGCRX(lsock)) & ~M8XX_PGCRX_CXRESET);
876
877 /* ... and output enable. */
878
879 /* The CxOE signal is connected to a 74541 on the ADS.
880 I guess most other boards used the ADS as a reference.
881 I tried to control the CxOE signal with SS_OUTPUT_ENA,
882 but the reset signal seems connected via the 541.
883 If the CxOE is left high are some signals tristated and
884 no pullups are present -> the cards act wierd.
885 So right now the buffers are enabled if the power is on. */
886
887 if(state->Vcc || state->Vpp)
888 out_be32(M8XX_PGCRX(lsock), in_be32(M8XX_PGCRX(lsock)) & ~M8XX_PGCRX_CXOE); /* active low */
889 else
890 out_be32(M8XX_PGCRX(lsock), in_be32(M8XX_PGCRX(lsock)) | M8XX_PGCRX_CXOE);
891
892 /*
893 * We'd better turn off interrupts before
894 * we mess with the events-table..
895 */
896
897 spin_lock_irqsave(&events_lock, flags);
898
899 /*
900 * Play around with the interrupt mask to be able to
901 * give the events the generic pcmcia driver wants us to.
902 */
903
904 e = &s->events[0];
905 reg = 0;
906
907 if(state->csc_mask & SS_DETECT) {
908 e->eventbit = SS_DETECT;
909 reg |= e->regbit = (M8XX_PCMCIA_CD2(lsock)
910 | M8XX_PCMCIA_CD1(lsock));
911 e++;
912 }
913 if(state->flags & SS_IOCARD) {
914 /*
915 * I/O card
916 */
917 if(state->csc_mask & SS_STSCHG) {
918 e->eventbit = SS_STSCHG;
919 reg |= e->regbit = M8XX_PCMCIA_BVD1(lsock);
920 e++;
921 }
922 /*
923 * If io_irq is non-zero we should enable irq.
924 */
925 if(state->io_irq) {
926 out_be32(M8XX_PGCRX(lsock), in_be32(M8XX_PGCRX(lsock)) | mk_int_int_mask(state->io_irq) << 24);
927 /*
928 * Strange thing here:
929 * The manual does not tell us which interrupt
930 * the sources generate.
931 * Anyhow, I found out that RDY_L generates IREQLVL.
932 *
933 * We use level triggerd interrupts, and they don't
934 * have to be cleared in PSCR in the interrupt handler.
935 */
936 reg |= M8XX_PCMCIA_RDY_L(lsock);
937 }
938 else
939 out_be32(M8XX_PGCRX(lsock), in_be32(M8XX_PGCRX(lsock)) & 0x00ffffff);
940 }
941 else {
942 /*
943 * Memory card
944 */
945 if(state->csc_mask & SS_BATDEAD) {
946 e->eventbit = SS_BATDEAD;
947 reg |= e->regbit = M8XX_PCMCIA_BVD1(lsock);
948 e++;
949 }
950 if(state->csc_mask & SS_BATWARN) {
951 e->eventbit = SS_BATWARN;
952 reg |= e->regbit = M8XX_PCMCIA_BVD2(lsock);
953 e++;
954 }
955 /* What should I trigger on - low/high,raise,fall? */
956 if(state->csc_mask & SS_READY) {
957 e->eventbit = SS_READY;
958 reg |= e->regbit = 0; //??
959 e++;
960 }
961 }
962
963 e->regbit = 0; /* terminate list */
964
965 /*
966 * Clear the status changed .
967 * Port A and Port B share the same port.
968 * Writing ones will clear the bits.
969 */
970
971 out_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pscr, reg);
972
973 /*
974 * Write the mask.
975 * Port A and Port B share the same port.
976 * Need for read-modify-write.
977 * Ones will enable the interrupt.
978 */
979
980 /*
981 reg |= ((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_per
982 & M8XX_PCMCIA_MASK(lsock);
983 */
984
985 reg |= in_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_per) &
986 (M8XX_PCMCIA_MASK(0) | M8XX_PCMCIA_MASK(1));
987
988 out_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_per, reg);
989
990 spin_unlock_irqrestore(&events_lock, flags);
991
992 /* copy the struct and modify the copy */
993
994 s->state = *state;
995
996 return 0;
997}
998
999static int m8xx_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io)
1000{
1001 int lsock = container_of(sock, struct socket_info, socket)->slot;
1002
1003 struct socket_info *s = &socket[lsock];
1004 struct pcmcia_win *w;
1005 unsigned int reg, winnr;
1006
1007#define M8XX_SIZE (io->stop - io->start + 1)
1008#define M8XX_BASE (PCMCIA_IO_WIN_BASE + io->start)
1009
1010 dprintk( "SetIOMap(%d, %d, %#2.2x, %d ns, "
1011 "%#4.4x-%#4.4x)\n", lsock, io->map, io->flags,
1012 io->speed, io->start, io->stop);
1013
1014 if ((io->map >= PCMCIA_IO_WIN_NO) || (io->start > 0xffff)
1015 || (io->stop > 0xffff) || (io->stop < io->start))
1016 return -EINVAL;
1017
1018 if((reg = m8xx_get_graycode(M8XX_SIZE)) == -1)
1019 return -EINVAL;
1020
1021 if(io->flags & MAP_ACTIVE) {
1022
1023 dprintk( "io->flags & MAP_ACTIVE\n");
1024
1025 winnr = (PCMCIA_MEM_WIN_NO * PCMCIA_SOCKETS_NO)
1026 + (lsock * PCMCIA_IO_WIN_NO) + io->map;
1027
1028 /* setup registers */
1029
1030 w = (void *) &((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pbr0;
1031 w += winnr;
1032
1033 out_be32(&w->or, 0); /* turn off window first */
1034 out_be32(&w->br, M8XX_BASE);
1035
1036 reg <<= 27;
1037 reg |= M8XX_PCMCIA_POR_IO |(lsock << 2);
1038
1039 reg |= m8xx_get_speed(io->speed, 1);
1040
1041 if(io->flags & MAP_WRPROT)
1042 reg |= M8XX_PCMCIA_POR_WRPROT;
1043
1044 /*if(io->flags & (MAP_16BIT | MAP_AUTOSZ))*/
1045 if(io->flags & MAP_16BIT)
1046 reg |= M8XX_PCMCIA_POR_16BIT;
1047
1048 if(io->flags & MAP_ACTIVE)
1049 reg |= M8XX_PCMCIA_POR_VALID;
1050
1051 out_be32(&w->or, reg);
1052
1053 dprintk("Socket %u: Mapped io window %u at %#8.8x, "
1054 "OR = %#8.8x.\n", lsock, io->map, w->br, w->or);
1055 } else {
1056 /* shutdown IO window */
1057 winnr = (PCMCIA_MEM_WIN_NO * PCMCIA_SOCKETS_NO)
1058 + (lsock * PCMCIA_IO_WIN_NO) + io->map;
1059
1060 /* setup registers */
1061
1062 w = (void *) &((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pbr0;
1063 w += winnr;
1064
1065 out_be32(&w->or, 0); /* turn off window */
1066 out_be32(&w->br, 0); /* turn off base address */
1067
1068 dprintk("Socket %u: Unmapped io window %u at %#8.8x, "
1069 "OR = %#8.8x.\n", lsock, io->map, w->br, w->or);
1070 }
1071
1072 /* copy the struct and modify the copy */
1073 s->io_win[io->map] = *io;
1074 s->io_win[io->map].flags &= (MAP_WRPROT
1075 | MAP_16BIT
1076 | MAP_ACTIVE);
1077 dprintk("SetIOMap exit\n");
1078
1079 return 0;
1080}
1081
1082static int m8xx_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *mem)
1083{
1084 int lsock = container_of(sock, struct socket_info, socket)->slot;
1085 struct socket_info *s = &socket[lsock];
1086 struct pcmcia_win *w;
1087 struct pccard_mem_map *old;
1088 unsigned int reg, winnr;
1089
1090 dprintk( "SetMemMap(%d, %d, %#2.2x, %d ns, "
1091 "%#5.5lx, %#5.5x)\n", lsock, mem->map, mem->flags,
1092 mem->speed, mem->static_start, mem->card_start);
1093
1094 if ((mem->map >= PCMCIA_MEM_WIN_NO)
1095// || ((mem->s) >= PCMCIA_MEM_WIN_SIZE)
1096 || (mem->card_start >= 0x04000000)
1097 || (mem->static_start & 0xfff) /* 4KByte resolution */
1098 || (mem->card_start & 0xfff))
1099 return -EINVAL;
1100
1101 if((reg = m8xx_get_graycode(PCMCIA_MEM_WIN_SIZE)) == -1) {
1102 printk( "Cannot set size to 0x%08x.\n", PCMCIA_MEM_WIN_SIZE);
1103 return -EINVAL;
1104 }
1105 reg <<= 27;
1106
1107 winnr = (lsock * PCMCIA_MEM_WIN_NO) + mem->map;
1108
1109 /* Setup the window in the pcmcia controller */
1110
1111 w = (void *) &((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pbr0;
1112 w += winnr;
1113
1114 reg |= lsock << 2;
1115
1116 reg |= m8xx_get_speed(mem->speed, 0);
1117
1118 if(mem->flags & MAP_ATTRIB)
1119 reg |= M8XX_PCMCIA_POR_ATTRMEM;
1120
1121 if(mem->flags & MAP_WRPROT)
1122 reg |= M8XX_PCMCIA_POR_WRPROT;
1123
1124 if(mem->flags & MAP_16BIT)
1125 reg |= M8XX_PCMCIA_POR_16BIT;
1126
1127 if(mem->flags & MAP_ACTIVE)
1128 reg |= M8XX_PCMCIA_POR_VALID;
1129
1130 out_be32(&w->or, reg);
1131
1132 dprintk("Socket %u: Mapped memory window %u at %#8.8x, "
1133 "OR = %#8.8x.\n", lsock, mem->map, w->br, w->or);
1134
1135 if(mem->flags & MAP_ACTIVE) {
1136 /* get the new base address */
1137 mem->static_start = PCMCIA_MEM_WIN_BASE +
1138 (PCMCIA_MEM_WIN_SIZE * winnr)
1139 + mem->card_start;
1140 }
1141
1142 dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, "
1143 "%#5.5lx, %#5.5x)\n", lsock, mem->map, mem->flags,
1144 mem->speed, mem->static_start, mem->card_start);
1145
1146 /* copy the struct and modify the copy */
1147
1148 old = &s->mem_win[mem->map];
1149
1150 *old = *mem;
1151 old->flags &= (MAP_ATTRIB
1152 | MAP_WRPROT
1153 | MAP_16BIT
1154 | MAP_ACTIVE);
1155
1156 return 0;
1157}
1158
1159static int m8xx_sock_init(struct pcmcia_socket *sock)
1160{
1161 int i;
1162 pccard_io_map io = { 0, 0, 0, 0, 1 };
1163 pccard_mem_map mem = { 0, 0, 0, 0, 0, 0 };
1164
1165 dprintk( "sock_init(%d)\n", s);
1166
1167 m8xx_set_socket(sock, &dead_socket);
1168 for (i = 0; i < PCMCIA_IO_WIN_NO; i++) {
1169 io.map = i;
1170 m8xx_set_io_map(sock, &io);
1171 }
1172 for (i = 0; i < PCMCIA_MEM_WIN_NO; i++) {
1173 mem.map = i;
1174 m8xx_set_mem_map(sock, &mem);
1175 }
1176
1177 return 0;
1178
1179}
1180
1181static int m8xx_suspend(struct pcmcia_socket *sock)
1182{
1183 return m8xx_set_socket(sock, &dead_socket);
1184}
1185
1186static struct pccard_operations m8xx_services = {
1187 .init = m8xx_sock_init,
1188 .suspend = m8xx_suspend,
1189 .get_status = m8xx_get_status,
1190 .get_socket = m8xx_get_socket,
1191 .set_socket = m8xx_set_socket,
1192 .set_io_map = m8xx_set_io_map,
1193 .set_mem_map = m8xx_set_mem_map,
1194};
1195
1196static int __init m8xx_init(void)
1197{
1198 struct pcmcia_win *w;
1199 unsigned int i,m;
1200
1201 pcmcia_info("%s\n", version);
1202
1203 if (driver_register(&m8xx_driver))
1204 return -1;
1205
1206 pcmcia_info(PCMCIA_BOARD_MSG " using " PCMCIA_SLOT_MSG
1207 " with IRQ %u.\n", pcmcia_schlvl);
1208
1209 /* Configure Status change interrupt */
1210
1211 if(request_irq(pcmcia_schlvl, m8xx_interrupt, 0,
1212 "m8xx_pcmcia", NULL)) {
1213 pcmcia_error("Cannot allocate IRQ %u for SCHLVL!\n",
1214 pcmcia_schlvl);
1215 return -1;
1216 }
1217
1218 w = (void *) &((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pbr0;
1219
1220 out_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pscr,
1221 M8XX_PCMCIA_MASK(0)| M8XX_PCMCIA_MASK(1));
1222
1223 out_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_per,
1224 in_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_per) &
1225 ~(M8XX_PCMCIA_MASK(0)| M8XX_PCMCIA_MASK(1)));
1226
1227/* connect interrupt and disable CxOE */
1228
1229 out_be32(M8XX_PGCRX(0), M8XX_PGCRX_CXOE | (mk_int_int_mask(pcmcia_schlvl) << 16));
1230 out_be32(M8XX_PGCRX(1), M8XX_PGCRX_CXOE | (mk_int_int_mask(pcmcia_schlvl) << 16));
1231
1232/* intialize the fixed memory windows */
1233
1234 for(i = 0; i < PCMCIA_SOCKETS_NO; i++){
1235 for(m = 0; m < PCMCIA_MEM_WIN_NO; m++) {
1236 out_be32(&w->br, PCMCIA_MEM_WIN_BASE +
1237 (PCMCIA_MEM_WIN_SIZE
1238 * (m + i * PCMCIA_MEM_WIN_NO)));
1239
1240 out_be32(&w->or, 0); /* set to not valid */
1241
1242 w++;
1243 }
1244 }
1245
1246/* turn off voltage */
1247 voltage_set(0, 0, 0);
1248 voltage_set(1, 0, 0);
1249
1250/* Enable external hardware */
1251 hardware_enable(0);
1252 hardware_enable(1);
1253
1254 platform_device_register(&m8xx_device);
1255
1256 for (i = 0 ; i < PCMCIA_SOCKETS_NO; i++) {
1257 socket[i].slot = i;
1258 socket[i].socket.owner = THIS_MODULE;
1259 socket[i].socket.features = SS_CAP_PCCARD | SS_CAP_MEM_ALIGN | SS_CAP_STATIC_MAP;
1260 socket[i].socket.irq_mask = 0x000;
1261 socket[i].socket.map_size = 0x1000;
1262 socket[i].socket.io_offset = 0;
1263 socket[i].socket.pci_irq = i ? 7 : 9;
1264 socket[i].socket.ops = &m8xx_services;
1265 socket[i].socket.resource_ops = &pccard_nonstatic_ops;
1266 socket[i].socket.cb_dev = NULL;
1267 socket[i].socket.dev.dev = &m8xx_device.dev;
1268 }
1269
1270 for (i = 0; i < PCMCIA_SOCKETS_NO; i++)
1271 pcmcia_register_socket(&socket[i].socket);
1272
1273 return 0;
1274}
1275
1276static void __exit m8xx_exit(void)
1277{
1278 int i;
1279
1280 for (i = 0; i < PCMCIA_SOCKETS_NO; i++)
1281 pcmcia_unregister_socket(&socket[i].socket);
1282
1283 m8xx_shutdown();
1284
1285 platform_device_unregister(&m8xx_device);
1286 driver_unregister(&m8xx_driver);
1287}
1288
1289module_init(m8xx_init);
1290module_exit(m8xx_exit);
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index ff25210b00ba..822b9fa706f3 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -1543,13 +1543,16 @@ static struct vio_device_id ibmvscsi_device_table[] __devinitdata = {
1543 {"vscsi", "IBM,v-scsi"}, 1543 {"vscsi", "IBM,v-scsi"},
1544 { "", "" } 1544 { "", "" }
1545}; 1545};
1546
1547MODULE_DEVICE_TABLE(vio, ibmvscsi_device_table); 1546MODULE_DEVICE_TABLE(vio, ibmvscsi_device_table);
1547
1548static struct vio_driver ibmvscsi_driver = { 1548static struct vio_driver ibmvscsi_driver = {
1549 .name = "ibmvscsi",
1550 .id_table = ibmvscsi_device_table, 1549 .id_table = ibmvscsi_device_table,
1551 .probe = ibmvscsi_probe, 1550 .probe = ibmvscsi_probe,
1552 .remove = ibmvscsi_remove 1551 .remove = ibmvscsi_remove,
1552 .driver = {
1553 .name = "ibmvscsi",
1554 .owner = THIS_MODULE,
1555 }
1553}; 1556};
1554 1557
1555int __init ibmvscsi_module_init(void) 1558int __init ibmvscsi_module_init(void)
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 9073be4221a8..e2667ddab3f1 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -918,7 +918,7 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
918 } 918 }
919#endif 919#endif
920#elif defined(__powerpc__) 920#elif defined(__powerpc__)
921 vma->vm_page_prot = phys_mem_access_prot(file, off, 921 vma->vm_page_prot = phys_mem_access_prot(file, off >> PAGE_SHIFT,
922 vma->vm_end - vma->vm_start, 922 vma->vm_end - vma->vm_start,
923 vma->vm_page_prot); 923 vma->vm_page_prot);
924#elif defined(__alpha__) 924#elif defined(__alpha__)