summaryrefslogtreecommitdiff
path: root/drivers/macintosh
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/Kconfig25
-rw-r--r--drivers/macintosh/Makefile1
-rw-r--r--drivers/macintosh/adb.c4
-rw-r--r--drivers/macintosh/ans-lcd.c2
-rw-r--r--drivers/macintosh/rack-meter.c28
-rw-r--r--drivers/macintosh/smu.c2
-rw-r--r--drivers/macintosh/via-cuda.c294
-rw-r--r--drivers/macintosh/via-maciisi.c677
-rw-r--r--drivers/macintosh/via-pmu.c2
-rw-r--r--drivers/macintosh/via-pmu68k.c2
-rw-r--r--drivers/macintosh/windfarm_core.c4
11 files changed, 237 insertions, 804 deletions
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index d28690f6e262..97a420c11eed 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -30,14 +30,6 @@ config ADB_MACII
Quadra 610, Quadra 650, Quadra 700, Quadra 800, Centris 610 and
Centris 650.
-config ADB_MACIISI
- bool "Include Mac IIsi ADB driver"
- depends on ADB && MAC && BROKEN
- help
- Say Y here if want your kernel to support Macintosh systems that use
- the Mac IIsi style ADB. This includes the IIsi, IIvi, IIvx, Classic
- II, LC, LC II, LC III, Performa 460, and the Performa 600.
-
config ADB_IOP
bool "Include IOP (IIfx/Quadra 9x0) ADB driver"
depends on ADB && MAC
@@ -60,17 +52,15 @@ config ADB_PMU68K
# we want to change this to something like CONFIG_SYSCTRL_CUDA/PMU
config ADB_CUDA
- bool "Support for CUDA based Macs and PowerMacs"
+ bool "Support for Cuda/Egret based Macs and PowerMacs"
depends on (ADB || PPC_PMAC) && !PPC_PMAC64
help
- This provides support for CUDA based Macintosh and Power Macintosh
- systems. This includes many m68k based Macs (Color Classic, Mac TV,
- Performa 475, Performa 520, Performa 550, Performa 575,
- Performa 588, Quadra 605, Quadra 630, Quadra/Centris 660AV, and
- Quadra 840AV), most OldWorld PowerMacs, the first generation iMacs,
- the Blue&White G3 and the "Yikes" G4 (PCI Graphics). All later
- models should use CONFIG_ADB_PMU instead. It is safe to say Y here
- even if your machine doesn't have a CUDA.
+ This provides support for Cuda/Egret based Macintosh and
+ Power Macintosh systems. This includes most m68k based Macs,
+ most Old World PowerMacs, the first generation iMacs, the
+ Blue & White G3 and the "Yikes" G4 (PCI Graphics). All later
+ models should use CONFIG_ADB_PMU instead. It is safe to say Y
+ here even if your machine doesn't have a Cuda or Egret device.
If unsure say Y.
@@ -102,7 +92,6 @@ config ADB_PMU_LED_DISK
bool "Use front LED as DISK LED by default"
depends on ADB_PMU_LED
depends on LEDS_CLASS
- depends on IDE_GD_ATA
select LEDS_TRIGGERS
select LEDS_TRIGGER_DISK
help
diff --git a/drivers/macintosh/Makefile b/drivers/macintosh/Makefile
index 383ba920085b..516eb65bcacc 100644
--- a/drivers/macintosh/Makefile
+++ b/drivers/macintosh/Makefile
@@ -20,7 +20,6 @@ obj-$(CONFIG_PMAC_SMU) += smu.o
obj-$(CONFIG_ADB) += adb.o
obj-$(CONFIG_ADB_MACII) += via-macii.o
-obj-$(CONFIG_ADB_MACIISI) += via-maciisi.o
obj-$(CONFIG_ADB_IOP) += adb-iop.o
obj-$(CONFIG_ADB_PMU68K) += via-pmu68k.o
obj-$(CONFIG_ADB_MACIO) += macio-adb.o
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 226179b975a0..152414e6378a 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -48,7 +48,6 @@
EXPORT_SYMBOL(adb_client_list);
extern struct adb_driver via_macii_driver;
-extern struct adb_driver via_maciisi_driver;
extern struct adb_driver via_cuda_driver;
extern struct adb_driver adb_iop_driver;
extern struct adb_driver via_pmu_driver;
@@ -59,9 +58,6 @@ static struct adb_driver *adb_driver_list[] = {
#ifdef CONFIG_ADB_MACII
&via_macii_driver,
#endif
-#ifdef CONFIG_ADB_MACIISI
- &via_maciisi_driver,
-#endif
#ifdef CONFIG_ADB_CUDA
&via_cuda_driver,
#endif
diff --git a/drivers/macintosh/ans-lcd.c b/drivers/macintosh/ans-lcd.c
index cd35079c8c98..281fa9e6fc1f 100644
--- a/drivers/macintosh/ans-lcd.c
+++ b/drivers/macintosh/ans-lcd.c
@@ -11,7 +11,7 @@
#include <linux/delay.h>
#include <linux/fs.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include <asm/sections.h>
#include <asm/prom.h>
#include <asm/io.h>
diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c
index 775527135b93..e199fd6c71ce 100644
--- a/drivers/macintosh/rack-meter.c
+++ b/drivers/macintosh/rack-meter.c
@@ -52,8 +52,8 @@ struct rackmeter_dma {
struct rackmeter_cpu {
struct delayed_work sniffer;
struct rackmeter *rm;
- cputime64_t prev_wall;
- cputime64_t prev_idle;
+ u64 prev_wall;
+ u64 prev_idle;
int zero;
} ____cacheline_aligned;
@@ -81,7 +81,7 @@ static int rackmeter_ignore_nice;
/* This is copied from cpufreq_ondemand, maybe we should put it in
* a common header somewhere
*/
-static inline cputime64_t get_cpu_idle_time(unsigned int cpu)
+static inline u64 get_cpu_idle_time(unsigned int cpu)
{
u64 retval;
@@ -217,23 +217,23 @@ static void rackmeter_do_timer(struct work_struct *work)
container_of(work, struct rackmeter_cpu, sniffer.work);
struct rackmeter *rm = rcpu->rm;
unsigned int cpu = smp_processor_id();
- cputime64_t cur_jiffies, total_idle_ticks;
- unsigned int total_ticks, idle_ticks;
+ u64 cur_nsecs, total_idle_nsecs;
+ u64 total_nsecs, idle_nsecs;
int i, offset, load, cumm, pause;
- cur_jiffies = jiffies64_to_cputime64(get_jiffies_64());
- total_ticks = (unsigned int) (cur_jiffies - rcpu->prev_wall);
- rcpu->prev_wall = cur_jiffies;
+ cur_nsecs = jiffies64_to_nsecs(get_jiffies_64());
+ total_nsecs = cur_nsecs - rcpu->prev_wall;
+ rcpu->prev_wall = cur_nsecs;
- total_idle_ticks = get_cpu_idle_time(cpu);
- idle_ticks = (unsigned int) (total_idle_ticks - rcpu->prev_idle);
- idle_ticks = min(idle_ticks, total_ticks);
- rcpu->prev_idle = total_idle_ticks;
+ total_idle_nsecs = get_cpu_idle_time(cpu);
+ idle_nsecs = total_idle_nsecs - rcpu->prev_idle;
+ idle_nsecs = min(idle_nsecs, total_nsecs);
+ rcpu->prev_idle = total_idle_nsecs;
/* We do a very dumb calculation to update the LEDs for now,
* we'll do better once we have actual PWM implemented
*/
- load = (9 * (total_ticks - idle_ticks)) / total_ticks;
+ load = div64_u64(9 * (total_nsecs - idle_nsecs), total_nsecs);
offset = cpu << 3;
cumm = 0;
@@ -278,7 +278,7 @@ static void rackmeter_init_cpu_sniffer(struct rackmeter *rm)
continue;
rcpu = &rm->cpu[cpu];
rcpu->prev_idle = get_cpu_idle_time(cpu);
- rcpu->prev_wall = jiffies64_to_cputime64(get_jiffies_64());
+ rcpu->prev_wall = jiffies64_to_nsecs(get_jiffies_64());
schedule_delayed_work_on(cpu, &rm->cpu[cpu].sniffer,
msecs_to_jiffies(CPU_SAMPLING_RATE));
}
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 08edb2c25b60..227869159ac0 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -47,7 +47,7 @@
#include <asm/pmac_feature.h>
#include <asm/smu.h>
#include <asm/sections.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#define VERSION "0.7"
#define AUTHOR "(c) 2005 Benjamin Herrenschmidt, IBM Corp."
diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c
index 2088e23a8002..c60415958dfe 100644
--- a/drivers/macintosh/via-cuda.c
+++ b/drivers/macintosh/via-cuda.c
@@ -1,10 +1,10 @@
/*
- * Device driver for the via-cuda on Apple Powermacs.
+ * Device driver for the Cuda and Egret system controllers found on PowerMacs
+ * and 68k Macs.
*
- * The VIA (versatile interface adapter) interfaces to the CUDA,
- * a 6805 microprocessor core which controls the ADB (Apple Desktop
- * Bus) which connects to the keyboard and mouse. The CUDA also
- * controls system power and the RTC (real time clock) chip.
+ * The Cuda or Egret is a 6805 microcontroller interfaced to the 6522 VIA.
+ * This MCU controls system power, Parameter RAM, Real Time Clock and the
+ * Apple Desktop Bus (ADB) that connects to the keyboard and mouse.
*
* Copyright (C) 1996 Paul Mackerras.
*/
@@ -50,10 +50,27 @@ static DEFINE_SPINLOCK(cuda_lock);
#define IER (14*RS) /* Interrupt enable register */
#define ANH (15*RS) /* A-side data, no handshake */
-/* Bits in B data register: all active low */
-#define TREQ 0x08 /* Transfer request (input) */
-#define TACK 0x10 /* Transfer acknowledge (output) */
-#define TIP 0x20 /* Transfer in progress (output) */
+/*
+ * When the Cuda design replaced the Egret, some signal names and
+ * logic sense changed. They all serve the same purposes, however.
+ *
+ * VIA pin | Egret pin
+ * ----------------+------------------------------------------
+ * PB3 (input) | Transceiver session (active low)
+ * PB4 (output) | VIA full (active high)
+ * PB5 (output) | System session (active high)
+ *
+ * VIA pin | Cuda pin
+ * ----------------+------------------------------------------
+ * PB3 (input) | Transfer request (active low)
+ * PB4 (output) | Byte acknowledge (active low)
+ * PB5 (output) | Transfer in progress (active low)
+ */
+
+/* Bits in Port B data register */
+#define TREQ 0x08 /* Transfer request */
+#define TACK 0x10 /* Transfer acknowledge */
+#define TIP 0x20 /* Transfer in progress */
/* Bits in ACR */
#define SR_CTRL 0x1c /* Shift register control bits */
@@ -65,6 +82,74 @@ static DEFINE_SPINLOCK(cuda_lock);
#define IER_CLR 0 /* clear bits in IER */
#define SR_INT 0x04 /* Shift register full/empty */
+/* Duration of byte acknowledgement pulse (us) */
+#define EGRET_TACK_ASSERTED_DELAY 300
+#define EGRET_TACK_NEGATED_DELAY 400
+
+/* Interval from interrupt to start of session (us) */
+#define EGRET_SESSION_DELAY 450
+
+#ifdef CONFIG_PPC
+#define mcu_is_egret false
+#else
+static bool mcu_is_egret;
+#endif
+
+static inline bool TREQ_asserted(u8 portb)
+{
+ return !(portb & TREQ);
+}
+
+static inline void assert_TIP(void)
+{
+ if (mcu_is_egret) {
+ udelay(EGRET_SESSION_DELAY);
+ out_8(&via[B], in_8(&via[B]) | TIP);
+ } else
+ out_8(&via[B], in_8(&via[B]) & ~TIP);
+}
+
+static inline void assert_TIP_and_TACK(void)
+{
+ if (mcu_is_egret) {
+ udelay(EGRET_SESSION_DELAY);
+ out_8(&via[B], in_8(&via[B]) | TIP | TACK);
+ } else
+ out_8(&via[B], in_8(&via[B]) & ~(TIP | TACK));
+}
+
+static inline void assert_TACK(void)
+{
+ if (mcu_is_egret) {
+ udelay(EGRET_TACK_NEGATED_DELAY);
+ out_8(&via[B], in_8(&via[B]) | TACK);
+ } else
+ out_8(&via[B], in_8(&via[B]) & ~TACK);
+}
+
+static inline void toggle_TACK(void)
+{
+ out_8(&via[B], in_8(&via[B]) ^ TACK);
+}
+
+static inline void negate_TACK(void)
+{
+ if (mcu_is_egret) {
+ udelay(EGRET_TACK_ASSERTED_DELAY);
+ out_8(&via[B], in_8(&via[B]) & ~TACK);
+ } else
+ out_8(&via[B], in_8(&via[B]) | TACK);
+}
+
+static inline void negate_TIP_and_TACK(void)
+{
+ if (mcu_is_egret) {
+ udelay(EGRET_TACK_ASSERTED_DELAY);
+ out_8(&via[B], in_8(&via[B]) & ~(TIP | TACK));
+ } else
+ out_8(&via[B], in_8(&via[B]) | TIP | TACK);
+}
+
static enum cuda_state {
idle,
sent_first_byte,
@@ -120,11 +205,13 @@ int __init find_via_cuda(void)
struct adb_request req;
int err;
- if (macintosh_config->adb_type != MAC_ADB_CUDA)
+ if (macintosh_config->adb_type != MAC_ADB_CUDA &&
+ macintosh_config->adb_type != MAC_ADB_EGRET)
return 0;
via = via1;
cuda_state = idle;
+ mcu_is_egret = macintosh_config->adb_type == MAC_ADB_EGRET;
err = cuda_init_via();
if (err) {
@@ -221,7 +308,7 @@ static int __init via_cuda_start(void)
return -EAGAIN;
}
- printk("Macintosh CUDA driver v0.5 for Unified ADB.\n");
+ pr_info("Macintosh Cuda and Egret driver.\n");
cuda_fully_inited = 1;
return 0;
@@ -237,7 +324,8 @@ cuda_probe(void)
if (sys_ctrler != SYS_CTRLER_CUDA)
return -ENODEV;
#else
- if (macintosh_config->adb_type != MAC_ADB_CUDA)
+ if (macintosh_config->adb_type != MAC_ADB_CUDA &&
+ macintosh_config->adb_type != MAC_ADB_EGRET)
return -ENODEV;
#endif
if (via == NULL)
@@ -246,12 +334,39 @@ cuda_probe(void)
}
#endif /* CONFIG_ADB */
+static int __init sync_egret(void)
+{
+ if (TREQ_asserted(in_8(&via[B]))) {
+ /* Complete the inbound transfer */
+ assert_TIP_and_TACK();
+ while (1) {
+ negate_TACK();
+ mdelay(1);
+ (void)in_8(&via[SR]);
+ assert_TACK();
+ if (!TREQ_asserted(in_8(&via[B])))
+ break;
+ }
+ negate_TIP_and_TACK();
+ } else if (in_8(&via[B]) & TIP) {
+ /* Terminate the outbound transfer */
+ negate_TACK();
+ assert_TACK();
+ mdelay(1);
+ negate_TIP_and_TACK();
+ }
+ /* Clear shift register interrupt */
+ if (in_8(&via[IFR]) & SR_INT)
+ (void)in_8(&via[SR]);
+ return 0;
+}
+
#define WAIT_FOR(cond, what) \
do { \
int x; \
for (x = 1000; !(cond); --x) { \
if (x == 0) { \
- printk("Timeout waiting for " what "\n"); \
+ pr_err("Timeout waiting for " what "\n"); \
return -ENXIO; \
} \
udelay(100); \
@@ -261,10 +376,6 @@ cuda_probe(void)
static int
__init cuda_init_via(void)
{
- out_8(&via[DIRB], (in_8(&via[DIRB]) | TACK | TIP) & ~TREQ); /* TACK & TIP out */
- out_8(&via[B], in_8(&via[B]) | TACK | TIP); /* negate them */
- out_8(&via[ACR] ,(in_8(&via[ACR]) & ~SR_CTRL) | SR_EXT); /* SR data in */
- (void)in_8(&via[SR]); /* clear any left-over data */
#ifdef CONFIG_PPC
out_8(&via[IER], 0x7f); /* disable interrupts from VIA */
(void)in_8(&via[IER]);
@@ -272,16 +383,25 @@ __init cuda_init_via(void)
out_8(&via[IER], SR_INT); /* disable SR interrupt from VIA */
#endif
+ out_8(&via[DIRB], (in_8(&via[DIRB]) | TACK | TIP) & ~TREQ); /* TACK & TIP out */
+ out_8(&via[ACR], (in_8(&via[ACR]) & ~SR_CTRL) | SR_EXT); /* SR data in */
+ (void)in_8(&via[SR]); /* clear any left-over data */
+
+ if (mcu_is_egret)
+ return sync_egret();
+
+ negate_TIP_and_TACK();
+
/* delay 4ms and then clear any pending interrupt */
mdelay(4);
(void)in_8(&via[SR]);
out_8(&via[IFR], SR_INT);
/* sync with the CUDA - assert TACK without TIP */
- out_8(&via[B], in_8(&via[B]) & ~TACK);
+ assert_TACK();
/* wait for the CUDA to assert TREQ in response */
- WAIT_FOR((in_8(&via[B]) & TREQ) == 0, "CUDA response to sync");
+ WAIT_FOR(TREQ_asserted(in_8(&via[B])), "CUDA response to sync");
/* wait for the interrupt and then clear it */
WAIT_FOR(in_8(&via[IFR]) & SR_INT, "CUDA response to sync (2)");
@@ -289,14 +409,13 @@ __init cuda_init_via(void)
out_8(&via[IFR], SR_INT);
/* finish the sync by negating TACK */
- out_8(&via[B], in_8(&via[B]) | TACK);
+ negate_TACK();
/* wait for the CUDA to negate TREQ and the corresponding interrupt */
- WAIT_FOR(in_8(&via[B]) & TREQ, "CUDA response to sync (3)");
+ WAIT_FOR(!TREQ_asserted(in_8(&via[B])), "CUDA response to sync (3)");
WAIT_FOR(in_8(&via[IFR]) & SR_INT, "CUDA response to sync (4)");
(void)in_8(&via[SR]);
out_8(&via[IFR], SR_INT);
- out_8(&via[B], in_8(&via[B]) | TIP); /* should be unnecessary */
return 0;
}
@@ -357,6 +476,7 @@ cuda_reset_adb_bus(void)
return 0;
}
#endif /* CONFIG_ADB */
+
/* Construct and send a cuda request */
int
cuda_request(struct adb_request *req, void (*done)(struct adb_request *),
@@ -413,47 +533,43 @@ cuda_write(struct adb_request *req)
static void
cuda_start(void)
{
- struct adb_request *req;
-
/* assert cuda_state == idle */
- /* get the packet to send */
- req = current_req;
- if (req == 0)
+ if (current_req == NULL)
return;
- if ((in_8(&via[B]) & TREQ) == 0)
+ data_index = 0;
+ if (TREQ_asserted(in_8(&via[B])))
return; /* a byte is coming in from the CUDA */
/* set the shift register to shift out and send a byte */
out_8(&via[ACR], in_8(&via[ACR]) | SR_OUT);
- out_8(&via[SR], req->data[0]);
- out_8(&via[B], in_8(&via[B]) & ~TIP);
+ out_8(&via[SR], current_req->data[data_index++]);
+ if (mcu_is_egret)
+ assert_TIP_and_TACK();
+ else
+ assert_TIP();
cuda_state = sent_first_byte;
}
void
cuda_poll(void)
{
- /* cuda_interrupt only takes a normal lock, we disable
- * interrupts here to avoid re-entering and thus deadlocking.
- */
- if (cuda_irq)
- disable_irq(cuda_irq);
- cuda_interrupt(0, NULL);
- if (cuda_irq)
- enable_irq(cuda_irq);
+ cuda_interrupt(0, NULL);
}
EXPORT_SYMBOL(cuda_poll);
+#define ARRAY_FULL(a, p) ((p) - (a) == ARRAY_SIZE(a))
+
static irqreturn_t
cuda_interrupt(int irq, void *arg)
{
- int status;
+ unsigned long flags;
+ u8 status;
struct adb_request *req = NULL;
unsigned char ibuf[16];
int ibuf_len = 0;
int complete = 0;
- spin_lock(&cuda_lock);
+ spin_lock_irqsave(&cuda_lock, flags);
/* On powermacs, this handler is registered for the VIA IRQ. But they use
* just the shift register IRQ -- other VIA interrupt sources are disabled.
@@ -466,52 +582,50 @@ cuda_interrupt(int irq, void *arg)
#endif
{
if ((in_8(&via[IFR]) & SR_INT) == 0) {
- spin_unlock(&cuda_lock);
+ spin_unlock_irqrestore(&cuda_lock, flags);
return IRQ_NONE;
} else {
out_8(&via[IFR], SR_INT);
}
}
-
- status = (~in_8(&via[B]) & (TIP|TREQ)) | (in_8(&via[ACR]) & SR_OUT);
- /* printk("cuda_interrupt: state=%d status=%x\n", cuda_state, status); */
+
+ status = in_8(&via[B]) & (TIP | TACK | TREQ);
+
switch (cuda_state) {
case idle:
- /* CUDA has sent us the first byte of data - unsolicited */
- if (status != TREQ)
- printk("cuda: state=idle, status=%x\n", status);
+ /* System controller has unsolicited data for us */
(void)in_8(&via[SR]);
- out_8(&via[B], in_8(&via[B]) & ~TIP);
+idle_state:
+ assert_TIP();
cuda_state = reading;
reply_ptr = cuda_rbuf;
reading_reply = 0;
break;
case awaiting_reply:
- /* CUDA has sent us the first byte of data of a reply */
- if (status != TREQ)
- printk("cuda: state=awaiting_reply, status=%x\n", status);
+ /* System controller has reply data for us */
(void)in_8(&via[SR]);
- out_8(&via[B], in_8(&via[B]) & ~TIP);
+ assert_TIP();
cuda_state = reading;
reply_ptr = current_req->reply;
reading_reply = 1;
break;
case sent_first_byte:
- if (status == TREQ + TIP + SR_OUT) {
+ if (TREQ_asserted(status)) {
/* collision */
out_8(&via[ACR], in_8(&via[ACR]) & ~SR_OUT);
(void)in_8(&via[SR]);
- out_8(&via[B], in_8(&via[B]) | TIP | TACK);
+ negate_TIP_and_TACK();
cuda_state = idle;
+ /* Egret does not raise an "aborted" interrupt */
+ if (mcu_is_egret)
+ goto idle_state;
} else {
- /* assert status == TIP + SR_OUT */
- if (status != TIP + SR_OUT)
- printk("cuda: state=sent_first_byte status=%x\n", status);
- out_8(&via[SR], current_req->data[1]);
- out_8(&via[B], in_8(&via[B]) ^ TACK);
- data_index = 2;
+ out_8(&via[SR], current_req->data[data_index++]);
+ toggle_TACK();
+ if (mcu_is_egret)
+ assert_TACK();
cuda_state = sending;
}
break;
@@ -521,7 +635,7 @@ cuda_interrupt(int irq, void *arg)
if (data_index >= req->nbytes) {
out_8(&via[ACR], in_8(&via[ACR]) & ~SR_OUT);
(void)in_8(&via[SR]);
- out_8(&via[B], in_8(&via[B]) | TACK | TIP);
+ negate_TIP_and_TACK();
req->sent = 1;
if (req->reply_expected) {
cuda_state = awaiting_reply;
@@ -534,26 +648,37 @@ cuda_interrupt(int irq, void *arg)
}
} else {
out_8(&via[SR], req->data[data_index++]);
- out_8(&via[B], in_8(&via[B]) ^ TACK);
+ toggle_TACK();
+ if (mcu_is_egret)
+ assert_TACK();
}
break;
case reading:
- *reply_ptr++ = in_8(&via[SR]);
- if (status == TIP) {
+ if (reading_reply ? ARRAY_FULL(current_req->reply, reply_ptr)
+ : ARRAY_FULL(cuda_rbuf, reply_ptr))
+ (void)in_8(&via[SR]);
+ else
+ *reply_ptr++ = in_8(&via[SR]);
+ if (!TREQ_asserted(status)) {
+ if (mcu_is_egret)
+ assert_TACK();
/* that's all folks */
- out_8(&via[B], in_8(&via[B]) | TACK | TIP);
+ negate_TIP_and_TACK();
cuda_state = read_done;
+ /* Egret does not raise a "read done" interrupt */
+ if (mcu_is_egret)
+ goto read_done_state;
} else {
- /* assert status == TIP | TREQ */
- if (status != TIP + TREQ)
- printk("cuda: state=reading status=%x\n", status);
- out_8(&via[B], in_8(&via[B]) ^ TACK);
+ toggle_TACK();
+ if (mcu_is_egret)
+ negate_TACK();
}
break;
case read_done:
(void)in_8(&via[SR]);
+read_done_state:
if (reading_reply) {
req = current_req;
req->reply_len = reply_ptr - req->reply;
@@ -570,6 +695,7 @@ cuda_interrupt(int irq, void *arg)
}
current_req = req->next;
complete = 1;
+ reading_reply = 0;
} else {
/* This is tricky. We must break the spinlock to call
* cuda_input. However, doing so means we might get
@@ -581,21 +707,19 @@ cuda_interrupt(int irq, void *arg)
ibuf_len = reply_ptr - cuda_rbuf;
memcpy(ibuf, cuda_rbuf, ibuf_len);
}
- if (status == TREQ) {
- out_8(&via[B], in_8(&via[B]) & ~TIP);
+ reply_ptr = cuda_rbuf;
+ cuda_state = idle;
+ cuda_start();
+ if (cuda_state == idle && TREQ_asserted(in_8(&via[B]))) {
+ assert_TIP();
cuda_state = reading;
- reply_ptr = cuda_rbuf;
- reading_reply = 0;
- } else {
- cuda_state = idle;
- cuda_start();
}
break;
default:
- printk("cuda_interrupt: unknown cuda_state %d?\n", cuda_state);
+ pr_err("cuda_interrupt: unknown cuda_state %d?\n", cuda_state);
}
- spin_unlock(&cuda_lock);
+ spin_unlock_irqrestore(&cuda_lock, flags);
if (complete && req) {
void (*done)(struct adb_request *) = req->done;
mb();
@@ -614,8 +738,6 @@ cuda_interrupt(int irq, void *arg)
static void
cuda_input(unsigned char *buf, int nb)
{
- int i;
-
switch (buf[0]) {
case ADB_PACKET:
#ifdef CONFIG_XMON
@@ -632,10 +754,14 @@ cuda_input(unsigned char *buf, int nb)
#endif /* CONFIG_ADB */
break;
+ case TIMER_PACKET:
+ /* Egret sends these periodically. Might be useful as a 'heartbeat'
+ * to trigger a recovery for the VIA shift register errata.
+ */
+ break;
+
default:
- printk("data from cuda (%d bytes):", nb);
- for (i = 0; i < nb; ++i)
- printk(" %.2x", buf[i]);
- printk("\n");
+ print_hex_dump(KERN_INFO, "cuda_input: ", DUMP_PREFIX_NONE, 32, 1,
+ buf, nb, false);
}
}
diff --git a/drivers/macintosh/via-maciisi.c b/drivers/macintosh/via-maciisi.c
deleted file mode 100644
index 34d02a91b29f..000000000000
--- a/drivers/macintosh/via-maciisi.c
+++ /dev/null
@@ -1,677 +0,0 @@
-/*
- * Device driver for the IIsi-style ADB on some Mac LC and II-class machines
- *
- * Based on via-cuda.c and via-macii.c, as well as the original
- * adb-bus.c, which in turn is somewhat influenced by (but uses no
- * code from) the NetBSD HWDIRECT ADB code. Original IIsi driver work
- * was done by Robert Thompson and integrated into the old style
- * driver by Michael Schmitz.
- *
- * Original sources (c) Alan Cox, Paul Mackerras, and others.
- *
- * Rewritten for Unified ADB by David Huggins-Daines <dhd@debian.org>
- *
- * 7/13/2000- extensive changes by Andrew McPherson <andrew@macduff.dhs.org>
- * Works about 30% of the time now.
- */
-
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <linux/kernel.h>
-#include <linux/adb.h>
-#include <linux/cuda.h>
-#include <linux/delay.h>
-#include <linux/interrupt.h>
-#include <asm/macintosh.h>
-#include <asm/macints.h>
-#include <asm/mac_via.h>
-
-static volatile unsigned char *via;
-
-/* VIA registers - spaced 0x200 bytes apart - only the ones we actually use */
-#define RS 0x200 /* skip between registers */
-#define B 0 /* B-side data */
-#define A RS /* A-side data */
-#define DIRB (2*RS) /* B-side direction (1=output) */
-#define DIRA (3*RS) /* A-side direction (1=output) */
-#define SR (10*RS) /* Shift register */
-#define ACR (11*RS) /* Auxiliary control register */
-#define IFR (13*RS) /* Interrupt flag register */
-#define IER (14*RS) /* Interrupt enable register */
-
-/* Bits in B data register: all active low */
-#define TREQ 0x08 /* Transfer request (input) */
-#define TACK 0x10 /* Transfer acknowledge (output) */
-#define TIP 0x20 /* Transfer in progress (output) */
-#define ST_MASK 0x30 /* mask for selecting ADB state bits */
-
-/* Bits in ACR */
-#define SR_CTRL 0x1c /* Shift register control bits */
-#define SR_EXT 0x0c /* Shift on external clock */
-#define SR_OUT 0x10 /* Shift out if 1 */
-
-/* Bits in IFR and IER */
-#define IER_SET 0x80 /* set bits in IER */
-#define IER_CLR 0 /* clear bits in IER */
-#define SR_INT 0x04 /* Shift register full/empty */
-#define SR_DATA 0x08 /* Shift register data */
-#define SR_CLOCK 0x10 /* Shift register clock */
-
-#define ADB_DELAY 150
-
-#undef DEBUG_MACIISI_ADB
-
-static struct adb_request* current_req;
-static struct adb_request* last_req;
-static unsigned char maciisi_rbuf[16];
-static unsigned char *reply_ptr;
-static int data_index;
-static int reading_reply;
-static int reply_len;
-static int tmp;
-static int need_sync;
-
-static enum maciisi_state {
- idle,
- sending,
- reading,
-} maciisi_state;
-
-static int maciisi_probe(void);
-static int maciisi_init(void);
-static int maciisi_send_request(struct adb_request* req, int sync);
-static void maciisi_sync(struct adb_request *req);
-static int maciisi_write(struct adb_request* req);
-static irqreturn_t maciisi_interrupt(int irq, void* arg);
-static void maciisi_input(unsigned char *buf, int nb);
-static int maciisi_init_via(void);
-static void maciisi_poll(void);
-static int maciisi_start(void);
-
-struct adb_driver via_maciisi_driver = {
- "Mac IIsi",
- maciisi_probe,
- maciisi_init,
- maciisi_send_request,
- NULL, /* maciisi_adb_autopoll, */
- maciisi_poll,
- NULL /* maciisi_reset_adb_bus */
-};
-
-static int
-maciisi_probe(void)
-{
- if (macintosh_config->adb_type != MAC_ADB_IISI)
- return -ENODEV;
-
- via = via1;
- return 0;
-}
-
-static int
-maciisi_init(void)
-{
- int err;
-
- if (via == NULL)
- return -ENODEV;
-
- if ((err = maciisi_init_via())) {
- printk(KERN_ERR "maciisi_init: maciisi_init_via() failed, code %d\n", err);
- via = NULL;
- return err;
- }
-
- if (request_irq(IRQ_MAC_ADB, maciisi_interrupt, 0, "ADB",
- maciisi_interrupt)) {
- printk(KERN_ERR "maciisi_init: can't get irq %d\n", IRQ_MAC_ADB);
- return -EAGAIN;
- }
-
- printk("adb: Mac IIsi driver v0.2 for Unified ADB.\n");
- return 0;
-}
-
-/* Flush data from the ADB controller */
-static void
-maciisi_stfu(void)
-{
- int status = via[B] & (TIP|TREQ);
-
- if (status & TREQ) {
-#ifdef DEBUG_MACIISI_ADB
- printk (KERN_DEBUG "maciisi_stfu called with TREQ high!\n");
-#endif
- return;
- }
-
- udelay(ADB_DELAY);
- via[ACR] &= ~SR_OUT;
- via[IER] = IER_CLR | SR_INT;
-
- udelay(ADB_DELAY);
-
- status = via[B] & (TIP|TREQ);
-
- if (!(status & TREQ))
- {
- via[B] |= TIP;
-
- while(1)
- {
- int poll_timeout = ADB_DELAY * 5;
- /* Poll for SR interrupt */
- while (!(via[IFR] & SR_INT) && poll_timeout-- > 0)
- status = via[B] & (TIP|TREQ);
-
- tmp = via[SR]; /* Clear shift register */
-#ifdef DEBUG_MACIISI_ADB
- printk(KERN_DEBUG "maciisi_stfu: status %x timeout %d data %x\n",
- status, poll_timeout, tmp);
-#endif
- if(via[B] & TREQ)
- break;
-
- /* ACK on-off */
- via[B] |= TACK;
- udelay(ADB_DELAY);
- via[B] &= ~TACK;
- }
-
- /* end frame */
- via[B] &= ~TIP;
- udelay(ADB_DELAY);
- }
-
- via[IER] = IER_SET | SR_INT;
-}
-
-/* All specifically VIA-related initialization goes here */
-static int
-maciisi_init_via(void)
-{
- int i;
-
- /* Set the lines up. We want TREQ as input TACK|TIP as output */
- via[DIRB] = (via[DIRB] | TACK | TIP) & ~TREQ;
- /* Shift register on input */
- via[ACR] = (via[ACR] & ~SR_CTRL) | SR_EXT;
-#ifdef DEBUG_MACIISI_ADB
- printk(KERN_DEBUG "maciisi_init_via: initial status %x\n", via[B] & (TIP|TREQ));
-#endif
- /* Wipe any pending data and int */
- tmp = via[SR];
- /* Enable keyboard interrupts */
- via[IER] = IER_SET | SR_INT;
- /* Set initial state: idle */
- via[B] &= ~(TACK|TIP);
- /* Clear interrupt bit */
- via[IFR] = SR_INT;
-
- for(i = 0; i < 60; i++) {
- udelay(ADB_DELAY);
- maciisi_stfu();
- udelay(ADB_DELAY);
- if(via[B] & TREQ)
- break;
- }
- if (i == 60)
- printk(KERN_ERR "maciisi_init_via: bus jam?\n");
-
- maciisi_state = idle;
- need_sync = 0;
-
- return 0;
-}
-
-/* Send a request, possibly waiting for a reply */
-static int
-maciisi_send_request(struct adb_request* req, int sync)
-{
- int i;
-
-#ifdef DEBUG_MACIISI_ADB
- static int dump_packet = 0;
-#endif
-
- if (via == NULL) {
- req->complete = 1;
- return -ENXIO;
- }
-
-#ifdef DEBUG_MACIISI_ADB
- if (dump_packet) {
- printk(KERN_DEBUG "maciisi_send_request:");
- for (i = 0; i < req->nbytes; i++) {
- printk(" %.2x", req->data[i]);
- }
- printk(" sync %d\n", sync);
- }
-#endif
-
- req->reply_expected = 1;
-
- i = maciisi_write(req);
- if (i)
- {
- /* Normally, if a packet requires syncing, that happens at the end of
- * maciisi_send_request. But if the transfer fails, it will be restarted
- * by maciisi_interrupt(). We use need_sync to tell maciisi_interrupt
- * when to sync a packet that it sends out.
- *
- * Suggestions on a better way to do this are welcome.
- */
- if(i == -EBUSY && sync)
- need_sync = 1;
- else
- need_sync = 0;
- return i;
- }
- if(sync)
- maciisi_sync(req);
-
- return 0;
-}
-
-/* Poll the ADB chip until the request completes */
-static void maciisi_sync(struct adb_request *req)
-{
- int count = 0;
-
-#ifdef DEBUG_MACIISI_ADB
- printk(KERN_DEBUG "maciisi_sync called\n");
-#endif
-
- /* If for some reason the ADB chip shuts up on us, we want to avoid an endless loop. */
- while (!req->complete && count++ < 50) {
- maciisi_poll();
- }
- /* This could be BAD... when the ADB controller doesn't respond
- * for this long, it's probably not coming back :-( */
- if (count > 50) /* Hopefully shouldn't happen */
- printk(KERN_ERR "maciisi_send_request: poll timed out!\n");
-}
-
-int
-maciisi_request(struct adb_request *req, void (*done)(struct adb_request *),
- int nbytes, ...)
-{
- va_list list;
- int i;
-
- req->nbytes = nbytes;
- req->done = done;
- req->reply_expected = 0;
- va_start(list, nbytes);
- for (i = 0; i < nbytes; i++)
- req->data[i++] = va_arg(list, int);
- va_end(list);
-
- return maciisi_send_request(req, 1);
-}
-
-/* Enqueue a request, and run the queue if possible */
-static int
-maciisi_write(struct adb_request* req)
-{
- unsigned long flags;
- int i;
-
- /* We will accept CUDA packets - the VIA sends them to us, so
- it figures that we should be able to send them to it */
- if (req->nbytes < 2 || req->data[0] > CUDA_PACKET) {
- printk(KERN_ERR "maciisi_write: packet too small or not an ADB or CUDA packet\n");
- req->complete = 1;
- return -EINVAL;
- }
- req->next = NULL;
- req->sent = 0;
- req->complete = 0;
- req->reply_len = 0;
-
- local_irq_save(flags);
-
- if (current_req) {
- last_req->next = req;
- last_req = req;
- } else {
- current_req = req;
- last_req = req;
- }
- if (maciisi_state == idle)
- {
- i = maciisi_start();
- if(i != 0)
- {
- local_irq_restore(flags);
- return i;
- }
- }
- else
- {
-#ifdef DEBUG_MACIISI_ADB
- printk(KERN_DEBUG "maciisi_write: would start, but state is %d\n", maciisi_state);
-#endif
- local_irq_restore(flags);
- return -EBUSY;
- }
-
- local_irq_restore(flags);
-
- return 0;
-}
-
-static int
-maciisi_start(void)
-{
- struct adb_request* req;
- int status;
-
-#ifdef DEBUG_MACIISI_ADB
- status = via[B] & (TIP | TREQ);
-
- printk(KERN_DEBUG "maciisi_start called, state=%d, status=%x, ifr=%x\n", maciisi_state, status, via[IFR]);
-#endif
-
- if (maciisi_state != idle) {
- /* shouldn't happen */
- printk(KERN_ERR "maciisi_start: maciisi_start called when driver busy!\n");
- return -EBUSY;
- }
-
- req = current_req;
- if (req == NULL)
- return -EINVAL;
-
- status = via[B] & (TIP|TREQ);
- if (!(status & TREQ)) {
-#ifdef DEBUG_MACIISI_ADB
- printk(KERN_DEBUG "maciisi_start: bus busy - aborting\n");
-#endif
- return -EBUSY;
- }
-
- /* Okay, send */
-#ifdef DEBUG_MACIISI_ADB
- printk(KERN_DEBUG "maciisi_start: sending\n");
-#endif
- /* Set state to active */
- via[B] |= TIP;
- /* ACK off */
- via[B] &= ~TACK;
- /* Delay */
- udelay(ADB_DELAY);
- /* Shift out and send */
- via[ACR] |= SR_OUT;
- via[SR] = req->data[0];
- data_index = 1;
- /* ACK on */
- via[B] |= TACK;
- maciisi_state = sending;
-
- return 0;
-}
-
-void
-maciisi_poll(void)
-{
- unsigned long flags;
-
- local_irq_save(flags);
- if (via[IFR] & SR_INT) {
- maciisi_interrupt(0, NULL);
- }
- else /* avoid calling this function too quickly in a loop */
- udelay(ADB_DELAY);
-
- local_irq_restore(flags);
-}
-
-/* Shift register interrupt - this is *supposed* to mean that the
- register is either full or empty. In practice, I have no idea what
- it means :( */
-static irqreturn_t
-maciisi_interrupt(int irq, void* arg)
-{
- int status;
- struct adb_request *req;
-#ifdef DEBUG_MACIISI_ADB
- static int dump_reply = 0;
-#endif
- int i;
- unsigned long flags;
-
- local_irq_save(flags);
-
- status = via[B] & (TIP|TREQ);
-#ifdef DEBUG_MACIISI_ADB
- printk(KERN_DEBUG "state %d status %x ifr %x\n", maciisi_state, status, via[IFR]);
-#endif
-
- if (!(via[IFR] & SR_INT)) {
- /* Shouldn't happen, we hope */
- printk(KERN_ERR "maciisi_interrupt: called without interrupt flag set\n");
- local_irq_restore(flags);
- return IRQ_NONE;
- }
-
- /* Clear the interrupt */
- /* via[IFR] = SR_INT; */
-
- switch_start:
- switch (maciisi_state) {
- case idle:
- if (status & TIP)
- printk(KERN_ERR "maciisi_interrupt: state is idle but TIP asserted!\n");
-
- if(!reading_reply)
- udelay(ADB_DELAY);
- /* Shift in */
- via[ACR] &= ~SR_OUT;
- /* Signal start of frame */
- via[B] |= TIP;
- /* Clear the interrupt (throw this value on the floor, it's useless) */
- tmp = via[SR];
- /* ACK adb chip, high-low */
- via[B] |= TACK;
- udelay(ADB_DELAY);
- via[B] &= ~TACK;
- reply_len = 0;
- maciisi_state = reading;
- if (reading_reply) {
- reply_ptr = current_req->reply;
- } else {
- reply_ptr = maciisi_rbuf;
- }
- break;
-
- case sending:
- /* via[SR]; */
- /* Set ACK off */
- via[B] &= ~TACK;
- req = current_req;
-
- if (!(status & TREQ)) {
- /* collision */
- printk(KERN_ERR "maciisi_interrupt: send collision\n");
- /* Set idle and input */
- via[ACR] &= ~SR_OUT;
- tmp = via[SR];
- via[B] &= ~TIP;
- /* Must re-send */
- reading_reply = 0;
- reply_len = 0;
- maciisi_state = idle;
- udelay(ADB_DELAY);
- /* process this now, because the IFR has been cleared */
- goto switch_start;
- }
-
- udelay(ADB_DELAY);
-
- if (data_index >= req->nbytes) {
- /* Sent the whole packet, put the bus back in idle state */
- /* Shift in, we are about to read a reply (hopefully) */
- via[ACR] &= ~SR_OUT;
- tmp = via[SR];
- /* End of frame */
- via[B] &= ~TIP;
- req->sent = 1;
- maciisi_state = idle;
- if (req->reply_expected) {
- /* Note: only set this once we've
- successfully sent the packet */
- reading_reply = 1;
- } else {
- current_req = req->next;
- if (req->done)
- (*req->done)(req);
- /* Do any queued requests now */
- i = maciisi_start();
- if(i == 0 && need_sync) {
- /* Packet needs to be synced */
- maciisi_sync(current_req);
- }
- if(i != -EBUSY)
- need_sync = 0;
- }
- } else {
- /* Sending more stuff */
- /* Shift out */
- via[ACR] |= SR_OUT;
- /* Write */
- via[SR] = req->data[data_index++];
- /* Signal 'byte ready' */
- via[B] |= TACK;
- }
- break;
-
- case reading:
- /* Shift in */
- /* via[ACR] &= ~SR_OUT; */ /* Not in 2.2 */
- if (reply_len++ > 16) {
- printk(KERN_ERR "maciisi_interrupt: reply too long, aborting read\n");
- via[B] |= TACK;
- udelay(ADB_DELAY);
- via[B] &= ~(TACK|TIP);
- maciisi_state = idle;
- i = maciisi_start();
- if(i == 0 && need_sync) {
- /* Packet needs to be synced */
- maciisi_sync(current_req);
- }
- if(i != -EBUSY)
- need_sync = 0;
- break;
- }
- /* Read data */
- *reply_ptr++ = via[SR];
- status = via[B] & (TIP|TREQ);
- /* ACK on/off */
- via[B] |= TACK;
- udelay(ADB_DELAY);
- via[B] &= ~TACK;
- if (!(status & TREQ))
- break; /* more stuff to deal with */
-
- /* end of frame */
- via[B] &= ~TIP;
- tmp = via[SR]; /* That's what happens in 2.2 */
- udelay(ADB_DELAY); /* Give controller time to recover */
-
- /* end of packet, deal with it */
- if (reading_reply) {
- req = current_req;
- req->reply_len = reply_ptr - req->reply;
- if (req->data[0] == ADB_PACKET) {
- /* Have to adjust the reply from ADB commands */
- if (req->reply_len <= 2 || (req->reply[1] & 2) != 0) {
- /* the 0x2 bit indicates no response */
- req->reply_len = 0;
- } else {
- /* leave just the command and result bytes in the reply */
- req->reply_len -= 2;
- memmove(req->reply, req->reply + 2, req->reply_len);
- }
- }
-#ifdef DEBUG_MACIISI_ADB
- if (dump_reply) {
- int i;
- printk(KERN_DEBUG "maciisi_interrupt: reply is ");
- for (i = 0; i < req->reply_len; ++i)
- printk(" %.2x", req->reply[i]);
- printk("\n");
- }
-#endif
- req->complete = 1;
- current_req = req->next;
- if (req->done)
- (*req->done)(req);
- /* Obviously, we got it */
- reading_reply = 0;
- } else {
- maciisi_input(maciisi_rbuf, reply_ptr - maciisi_rbuf);
- }
- maciisi_state = idle;
- status = via[B] & (TIP|TREQ);
- if (!(status & TREQ)) {
- /* Timeout?! More likely, another packet coming in already */
-#ifdef DEBUG_MACIISI_ADB
- printk(KERN_DEBUG "extra data after packet: status %x ifr %x\n",
- status, via[IFR]);
-#endif
-#if 0
- udelay(ADB_DELAY);
- via[B] |= TIP;
-
- maciisi_state = reading;
- reading_reply = 0;
- reply_ptr = maciisi_rbuf;
-#else
- /* Process the packet now */
- reading_reply = 0;
- goto switch_start;
-#endif
- /* We used to do this... but the controller might actually have data for us */
- /* maciisi_stfu(); */
- }
- else {
- /* Do any queued requests now if possible */
- i = maciisi_start();
- if(i == 0 && need_sync) {
- /* Packet needs to be synced */
- maciisi_sync(current_req);
- }
- if(i != -EBUSY)
- need_sync = 0;
- }
- break;
-
- default:
- printk("maciisi_interrupt: unknown maciisi_state %d?\n", maciisi_state);
- }
- local_irq_restore(flags);
- return IRQ_HANDLED;
-}
-
-static void
-maciisi_input(unsigned char *buf, int nb)
-{
-#ifdef DEBUG_MACIISI_ADB
- int i;
-#endif
-
- switch (buf[0]) {
- case ADB_PACKET:
- adb_input(buf+2, nb-2, buf[1] & 0x40);
- break;
- default:
-#ifdef DEBUG_MACIISI_ADB
- printk(KERN_DEBUG "data from IIsi ADB (%d bytes):", nb);
- for (i = 0; i < nb; ++i)
- printk(" %.2x", buf[i]);
- printk("\n");
-#endif
- break;
- }
-}
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 91081dcdc272..43b8db2b5445 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -57,7 +57,7 @@
#include <asm/pmac_feature.h>
#include <asm/pmac_pfunc.h>
#include <asm/pmac_low_i2c.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include <asm/mmu_context.h>
#include <asm/cputable.h>
#include <asm/time.h>
diff --git a/drivers/macintosh/via-pmu68k.c b/drivers/macintosh/via-pmu68k.c
index a00ee41f0573..a411c5cb77a1 100644
--- a/drivers/macintosh/via-pmu68k.c
+++ b/drivers/macintosh/via-pmu68k.c
@@ -38,7 +38,7 @@
#include <asm/pgtable.h>
#include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
/* Misc minor number allocated for /dev/pmu */
#define PMU_MINOR 154
diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c
index 465d770ab0bb..5e013d781a74 100644
--- a/drivers/macintosh/windfarm_core.c
+++ b/drivers/macintosh/windfarm_core.c
@@ -74,8 +74,8 @@ static inline void wf_notify(int event, void *param)
static int wf_critical_overtemp(void)
{
- static char * critical_overtemp_path = "/sbin/critical_overtemp";
- char *argv[] = { critical_overtemp_path, NULL };
+ static char const critical_overtemp_path[] = "/sbin/critical_overtemp";
+ char *argv[] = { (char *)critical_overtemp_path, NULL };
static char *envp[] = { "HOME=/",
"TERM=linux",
"PATH=/sbin:/usr/sbin:/bin:/usr/bin",