aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/adb.c1
-rw-r--r--drivers/macintosh/mediabay.c48
-rw-r--r--drivers/macintosh/smu.c4
-rw-r--r--drivers/macintosh/via-macii.c2
4 files changed, 26 insertions, 29 deletions
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 7ce0ea64465c..28958101061f 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -36,6 +36,7 @@
36#include <linux/completion.h> 36#include <linux/completion.h>
37#include <linux/device.h> 37#include <linux/device.h>
38#include <linux/kthread.h> 38#include <linux/kthread.h>
39#include <linux/platform_device.h>
39 40
40#include <asm/uaccess.h> 41#include <asm/uaccess.h>
41#include <asm/semaphore.h> 42#include <asm/semaphore.h>
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
index 18dde2a27209..936788272a5f 100644
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -78,12 +78,14 @@ struct media_bay_info {
78 int cached_gpio; 78 int cached_gpio;
79 int sleeping; 79 int sleeping;
80 struct semaphore lock; 80 struct semaphore lock;
81#ifdef CONFIG_BLK_DEV_IDE 81#ifdef CONFIG_BLK_DEV_IDE_PMAC
82 void __iomem *cd_base; 82 void __iomem *cd_base;
83 int cd_index;
84 int cd_irq; 83 int cd_irq;
85 int cd_retry; 84 int cd_retry;
86#endif 85#endif
86#if defined(CONFIG_BLK_DEV_IDE_PMAC) || defined(CONFIG_MAC_FLOPPY)
87 int cd_index;
88#endif
87}; 89};
88 90
89#define MAX_BAYS 2 91#define MAX_BAYS 2
@@ -91,7 +93,7 @@ struct media_bay_info {
91static struct media_bay_info media_bays[MAX_BAYS]; 93static struct media_bay_info media_bays[MAX_BAYS];
92int media_bay_count = 0; 94int media_bay_count = 0;
93 95
94#ifdef CONFIG_BLK_DEV_IDE 96#ifdef CONFIG_BLK_DEV_IDE_PMAC
95/* check the busy bit in the media-bay ide interface 97/* check the busy bit in the media-bay ide interface
96 (assumes the media-bay contains an ide device) */ 98 (assumes the media-bay contains an ide device) */
97#define MB_IDE_READY(i) ((readb(media_bays[i].cd_base + 0x70) & 0x80) == 0) 99#define MB_IDE_READY(i) ((readb(media_bays[i].cd_base + 0x70) & 0x80) == 0)
@@ -401,7 +403,7 @@ static void poll_media_bay(struct media_bay_info* bay)
401 set_mb_power(bay, id != MB_NO); 403 set_mb_power(bay, id != MB_NO);
402 bay->content_id = id; 404 bay->content_id = id;
403 if (id == MB_NO) { 405 if (id == MB_NO) {
404#ifdef CONFIG_BLK_DEV_IDE 406#ifdef CONFIG_BLK_DEV_IDE_PMAC
405 bay->cd_retry = 0; 407 bay->cd_retry = 0;
406#endif 408#endif
407 printk(KERN_INFO "media bay %d is empty\n", bay->index); 409 printk(KERN_INFO "media bay %d is empty\n", bay->index);
@@ -414,9 +416,9 @@ static void poll_media_bay(struct media_bay_info* bay)
414 } 416 }
415} 417}
416 418
419#ifdef CONFIG_MAC_FLOPPY
417int check_media_bay(struct device_node *which_bay, int what) 420int check_media_bay(struct device_node *which_bay, int what)
418{ 421{
419#ifdef CONFIG_BLK_DEV_IDE
420 int i; 422 int i;
421 423
422 for (i=0; i<media_bay_count; i++) 424 for (i=0; i<media_bay_count; i++)
@@ -426,14 +428,14 @@ int check_media_bay(struct device_node *which_bay, int what)
426 media_bays[i].cd_index = -1; 428 media_bays[i].cd_index = -1;
427 return -EINVAL; 429 return -EINVAL;
428 } 430 }
429#endif /* CONFIG_BLK_DEV_IDE */
430 return -ENODEV; 431 return -ENODEV;
431} 432}
432EXPORT_SYMBOL(check_media_bay); 433EXPORT_SYMBOL(check_media_bay);
434#endif /* CONFIG_MAC_FLOPPY */
433 435
436#ifdef CONFIG_BLK_DEV_IDE_PMAC
434int check_media_bay_by_base(unsigned long base, int what) 437int check_media_bay_by_base(unsigned long base, int what)
435{ 438{
436#ifdef CONFIG_BLK_DEV_IDE
437 int i; 439 int i;
438 440
439 for (i=0; i<media_bay_count; i++) 441 for (i=0; i<media_bay_count; i++)
@@ -443,15 +445,13 @@ int check_media_bay_by_base(unsigned long base, int what)
443 media_bays[i].cd_index = -1; 445 media_bays[i].cd_index = -1;
444 return -EINVAL; 446 return -EINVAL;
445 } 447 }
446#endif 448
447
448 return -ENODEV; 449 return -ENODEV;
449} 450}
450 451
451int 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,
452 int irq, int index) 453 int irq, int index)
453{ 454{
454#ifdef CONFIG_BLK_DEV_IDE
455 int i; 455 int i;
456 456
457 for (i=0; i<media_bay_count; i++) { 457 for (i=0; i<media_bay_count; i++) {
@@ -483,10 +483,10 @@ int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base,
483 return -ENODEV; 483 return -ENODEV;
484 } 484 }
485 } 485 }
486#endif /* CONFIG_BLK_DEV_IDE */ 486
487
488 return -ENODEV; 487 return -ENODEV;
489} 488}
489#endif /* CONFIG_BLK_DEV_IDE_PMAC */
490 490
491static void media_bay_step(int i) 491static void media_bay_step(int i)
492{ 492{
@@ -521,14 +521,13 @@ static void media_bay_step(int i)
521 bay->state = mb_resetting; 521 bay->state = mb_resetting;
522 MBDBG("mediabay%d: waiting reset (kind:%d)\n", i, bay->content_id); 522 MBDBG("mediabay%d: waiting reset (kind:%d)\n", i, bay->content_id);
523 break; 523 break;
524
525 case mb_resetting: 524 case mb_resetting:
526 if (bay->content_id != MB_CD) { 525 if (bay->content_id != MB_CD) {
527 MBDBG("mediabay%d: bay is up (kind:%d)\n", i, bay->content_id); 526 MBDBG("mediabay%d: bay is up (kind:%d)\n", i, bay->content_id);
528 bay->state = mb_up; 527 bay->state = mb_up;
529 break; 528 break;
530 } 529 }
531#ifdef CONFIG_BLK_DEV_IDE 530#ifdef CONFIG_BLK_DEV_IDE_PMAC
532 MBDBG("mediabay%d: waiting IDE reset (kind:%d)\n", i, bay->content_id); 531 MBDBG("mediabay%d: waiting IDE reset (kind:%d)\n", i, bay->content_id);
533 bay->ops->un_reset_ide(bay); 532 bay->ops->un_reset_ide(bay);
534 bay->timer = msecs_to_jiffies(MB_IDE_WAIT); 533 bay->timer = msecs_to_jiffies(MB_IDE_WAIT);
@@ -536,16 +535,14 @@ static void media_bay_step(int i)
536#else 535#else
537 printk(KERN_DEBUG "media-bay %d is ide (not compiled in kernel)\n", i); 536 printk(KERN_DEBUG "media-bay %d is ide (not compiled in kernel)\n", i);
538 set_mb_power(bay, 0); 537 set_mb_power(bay, 0);
539#endif /* CONFIG_BLK_DEV_IDE */ 538#endif /* CONFIG_BLK_DEV_IDE_PMAC */
540 break; 539 break;
541 540#ifdef CONFIG_BLK_DEV_IDE_PMAC
542#ifdef CONFIG_BLK_DEV_IDE
543 case mb_ide_resetting: 541 case mb_ide_resetting:
544 bay->timer = msecs_to_jiffies(MB_IDE_TIMEOUT); 542 bay->timer = msecs_to_jiffies(MB_IDE_TIMEOUT);
545 bay->state = mb_ide_waiting; 543 bay->state = mb_ide_waiting;
546 MBDBG("mediabay%d: waiting IDE ready (kind:%d)\n", i, bay->content_id); 544 MBDBG("mediabay%d: waiting IDE ready (kind:%d)\n", i, bay->content_id);
547 break; 545 break;
548
549 case mb_ide_waiting: 546 case mb_ide_waiting:
550 if (bay->cd_base == NULL) { 547 if (bay->cd_base == NULL) {
551 bay->timer = 0; 548 bay->timer = 0;
@@ -587,15 +584,14 @@ static void media_bay_step(int i)
587 bay->timer = 0; 584 bay->timer = 0;
588 } 585 }
589 break; 586 break;
590#endif /* CONFIG_BLK_DEV_IDE */ 587#endif /* CONFIG_BLK_DEV_IDE_PMAC */
591
592 case mb_powering_down: 588 case mb_powering_down:
593 bay->state = mb_empty; 589 bay->state = mb_empty;
594#ifdef CONFIG_BLK_DEV_IDE 590#ifdef CONFIG_BLK_DEV_IDE_PMAC
595 if (bay->cd_index >= 0) { 591 if (bay->cd_index >= 0) {
596 printk(KERN_DEBUG "Unregistering mb %d ide, index:%d\n", i, 592 printk(KERN_DEBUG "Unregistering mb %d ide, index:%d\n", i,
597 bay->cd_index); 593 bay->cd_index);
598 ide_unregister(bay->cd_index); 594 ide_unregister(bay->cd_index, 1, 1);
599 bay->cd_index = -1; 595 bay->cd_index = -1;
600 } 596 }
601 if (bay->cd_retry) { 597 if (bay->cd_retry) {
@@ -607,7 +603,7 @@ static void media_bay_step(int i)
607 bay->content_id = MB_NO; 603 bay->content_id = MB_NO;
608 } 604 }
609 } 605 }
610#endif /* CONFIG_BLK_DEV_IDE */ 606#endif /* CONFIG_BLK_DEV_IDE_PMAC */
611 MBDBG("mediabay%d: end of power down\n", i); 607 MBDBG("mediabay%d: end of power down\n", i);
612 break; 608 break;
613 } 609 }
@@ -739,7 +735,7 @@ static int media_bay_resume(struct macio_dev *mdev)
739 bay->last_value = bay->content_id; 735 bay->last_value = bay->content_id;
740 bay->value_count = msecs_to_jiffies(MB_STABLE_DELAY); 736 bay->value_count = msecs_to_jiffies(MB_STABLE_DELAY);
741 bay->timer = msecs_to_jiffies(MB_POWER_DELAY); 737 bay->timer = msecs_to_jiffies(MB_POWER_DELAY);
742#ifdef CONFIG_BLK_DEV_IDE 738#ifdef CONFIG_BLK_DEV_IDE_PMAC
743 bay->cd_retry = 0; 739 bay->cd_retry = 0;
744#endif 740#endif
745 do { 741 do {
@@ -829,7 +825,7 @@ static int __init media_bay_init(void)
829 for (i=0; i<MAX_BAYS; i++) { 825 for (i=0; i<MAX_BAYS; i++) {
830 memset((char *)&media_bays[i], 0, sizeof(struct media_bay_info)); 826 memset((char *)&media_bays[i], 0, sizeof(struct media_bay_info));
831 media_bays[i].content_id = -1; 827 media_bays[i].content_id = -1;
832#ifdef CONFIG_BLK_DEV_IDE 828#ifdef CONFIG_BLK_DEV_IDE_PMAC
833 media_bays[i].cd_index = -1; 829 media_bays[i].cd_index = -1;
834#endif 830#endif
835 } 831 }
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index d409f6759482..8ba49385c3ff 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -12,7 +12,7 @@
12 * - maybe add timeout to commands ? 12 * - maybe add timeout to commands ?
13 * - blocking version of time functions 13 * - blocking version of time functions
14 * - polling version of i2c commands (including timer that works with 14 * - polling version of i2c commands (including timer that works with
15 * interrutps off) 15 * interrupts off)
16 * - maybe avoid some data copies with i2c by directly using the smu cmd 16 * - maybe avoid some data copies with i2c by directly using the smu cmd
17 * buffer and a lower level internal interface 17 * buffer and a lower level internal interface
18 * - understand SMU -> CPU events and implement reception of them via 18 * - understand SMU -> CPU events and implement reception of them via
@@ -179,7 +179,7 @@ static irqreturn_t smu_db_intr(int irq, void *arg)
179 /* CPU might have brought back the cache line, so we need 179 /* CPU might have brought back the cache line, so we need
180 * to flush again before peeking at the SMU response. We 180 * to flush again before peeking at the SMU response. We
181 * flush the entire buffer for now as we haven't read the 181 * flush the entire buffer for now as we haven't read the
182 * reply lenght (it's only 2 cache lines anyway) 182 * reply length (it's only 2 cache lines anyway)
183 */ 183 */
184 faddr = (unsigned long)smu->cmd_buf; 184 faddr = (unsigned long)smu->cmd_buf;
185 flush_inval_dcache_range(faddr, faddr + 256); 185 flush_inval_dcache_range(faddr, faddr + 256);
diff --git a/drivers/macintosh/via-macii.c b/drivers/macintosh/via-macii.c
index 01b8eca7ccd5..6e6dd17ab572 100644
--- a/drivers/macintosh/via-macii.c
+++ b/drivers/macintosh/via-macii.c
@@ -111,7 +111,7 @@ static enum macii_state {
111static struct adb_request *current_req; /* first request struct in the queue */ 111static struct adb_request *current_req; /* first request struct in the queue */
112static struct adb_request *last_req; /* last request struct in the queue */ 112static struct adb_request *last_req; /* last request struct in the queue */
113static unsigned char reply_buf[16]; /* storage for autopolled replies */ 113static unsigned char reply_buf[16]; /* storage for autopolled replies */
114static unsigned char *reply_ptr; /* next byte in req->data or reply_buf */ 114static unsigned char *reply_ptr; /* next byte in reply_buf or req->reply */
115static int reading_reply; /* store reply in reply_buf else req->reply */ 115static int reading_reply; /* store reply in reply_buf else req->reply */
116static int data_index; /* index of the next byte to send from req->data */ 116static int data_index; /* index of the next byte to send from req->data */
117static int reply_len; /* number of bytes received in reply_buf or req->reply */ 117static int reply_len; /* number of bytes received in reply_buf or req->reply */