aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-10-26 17:36:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-10-26 17:36:21 -0400
commit685f7e4f161425b137056abe35ba8ef7b669d83d (patch)
tree550dd1f5dc9e852cfeec26bf5e3ce9dd060c8a33 /drivers
parentc7a2c49ea6c9eebbe44ff2c08b663b2905ee2c13 (diff)
parent58cfbac25b1fd2b76f94566aed28a3662b0ff8c6 (diff)
Merge tag 'powerpc-4.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc updates from Michael Ellerman: "Notable changes: - A large series to rewrite our SLB miss handling, replacing a lot of fairly complicated asm with much fewer lines of C. - Following on from that, we now maintain a cache of SLB entries for each process and preload them on context switch. Leading to a 27% speedup for our context switch benchmark on Power9. - Improvements to our handling of SLB multi-hit errors. We now print more debug information when they occur, and try to continue running by flushing the SLB and reloading, rather than treating them as fatal. - Enable THP migration on 64-bit Book3S machines (eg. Power7/8/9). - Add support for physical memory up to 2PB in the linear mapping on 64-bit Book3S. We only support up to 512TB as regular system memory, otherwise the percpu allocator runs out of vmalloc space. - Add stack protector support for 32 and 64-bit, with a per-task canary. - Add support for PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP. - Support recognising "big cores" on Power9, where two SMT4 cores are presented to us as a single SMT8 core. - A large series to cleanup some of our ioremap handling and PTE flags. - Add a driver for the PAPR SCM (storage class memory) interface, allowing guests to operate on SCM devices (acked by Dan). - Changes to our ftrace code to handle very large kernels, where we need to use a trampoline to get to ftrace_caller(). And many other smaller enhancements and cleanups. Thanks to: Alan Modra, Alistair Popple, Aneesh Kumar K.V, Anton Blanchard, Aravinda Prasad, Bartlomiej Zolnierkiewicz, Benjamin Herrenschmidt, Breno Leitao, Cédric Le Goater, Christophe Leroy, Christophe Lombard, Dan Carpenter, Daniel Axtens, Finn Thain, Gautham R. Shenoy, Gustavo Romero, Haren Myneni, Hari Bathini, Jia Hongtao, Joel Stanley, John Allen, Laurent Dufour, Madhavan Srinivasan, Mahesh Salgaonkar, Mark Hairgrove, Masahiro Yamada, Michael Bringmann, Michael Neuling, Michal Suchanek, Murilo Opsfelder Araujo, Nathan Fontenot, Naveen N. Rao, Nicholas Piggin, Nick Desaulniers, Oliver O'Halloran, Paul Mackerras, Petr Vorel, Rashmica Gupta, Reza Arbab, Rob Herring, Sam Bobroff, Samuel Mendoza-Jonas, Scott Wood, Stan Johnson, Stephen Rothwell, Stewart Smith, Suraj Jitindar Singh, Tyrel Datwyler, Vaibhav Jain, Vasant Hegde, YueHaibing, zhong jiang" * tag 'powerpc-4.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (221 commits) Revert "selftests/powerpc: Fix out-of-tree build errors" powerpc/msi: Fix compile error on mpc83xx powerpc: Fix stack protector crashes on CPU hotplug powerpc/traps: restore recoverability of machine_check interrupts powerpc/64/module: REL32 relocation range check powerpc/64s/radix: Fix radix__flush_tlb_collapsed_pmd double flushing pmd selftests/powerpc: Add a test of wild bctr powerpc/mm: Fix page table dump to work on Radix powerpc/mm/radix: Display if mappings are exec or not powerpc/mm/radix: Simplify split mapping logic powerpc/mm/radix: Remove the retry in the split mapping logic powerpc/mm/radix: Fix small page at boundary when splitting powerpc/mm/radix: Fix overuse of small pages in splitting logic powerpc/mm/radix: Fix off-by-one in split mapping logic powerpc/ftrace: Handle large kernel configs powerpc/mm: Fix WARN_ON with THP NUMA migration selftests/powerpc: Fix out-of-tree build errors powerpc/time: no steal_time when CONFIG_PPC_SPLPAR is not selected powerpc/time: Only set CONFIG_ARCH_HAS_SCALED_CPUTIME on PPC64 powerpc/time: isolate scaled cputime accounting in dedicated functions. ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/z2ram.c3
-rw-r--r--drivers/macintosh/adb-iop.c50
-rw-r--r--drivers/macintosh/adb.c8
-rw-r--r--drivers/macintosh/adbhid.c53
-rw-r--r--drivers/macintosh/macio_asic.c8
-rw-r--r--drivers/macintosh/macio_sysfs.c8
-rw-r--r--drivers/macintosh/via-cuda.c35
-rw-r--r--drivers/macintosh/via-macii.c352
-rw-r--r--drivers/macintosh/via-pmu.c33
-rw-r--r--drivers/macintosh/windfarm_smu_controls.c4
-rw-r--r--drivers/macintosh/windfarm_smu_sat.c25
-rw-r--r--drivers/misc/ocxl/config.c4
-rw-r--r--drivers/pci/hotplug/pnv_php.c2
-rw-r--r--drivers/pcmcia/electra_cf.c2
-rw-r--r--drivers/soc/fsl/qbman/qman_ccsr.c2
-rw-r--r--drivers/video/fbdev/chipsfb.c3
-rw-r--r--drivers/video/fbdev/controlfb.c5
-rw-r--r--drivers/video/fbdev/platinumfb.c5
-rw-r--r--drivers/video/fbdev/valkyriefb.c12
19 files changed, 327 insertions, 287 deletions
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c
index 1106c076fa4b..600430685e28 100644
--- a/drivers/block/z2ram.c
+++ b/drivers/block/z2ram.c
@@ -191,8 +191,7 @@ static int z2_open(struct block_device *bdev, fmode_t mode)
191 vfree(vmalloc (size)); 191 vfree(vmalloc (size));
192 } 192 }
193 193
194 vaddr = (unsigned long) __ioremap (paddr, size, 194 vaddr = (unsigned long)ioremap_wt(paddr, size);
195 _PAGE_WRITETHRU);
196 195
197#else 196#else
198 vaddr = (unsigned long)z_remap_nocache_nonser(paddr, size); 197 vaddr = (unsigned long)z_remap_nocache_nonser(paddr, size);
diff --git a/drivers/macintosh/adb-iop.c b/drivers/macintosh/adb-iop.c
index ca623e6446e4..fca31640e3ef 100644
--- a/drivers/macintosh/adb-iop.c
+++ b/drivers/macintosh/adb-iop.c
@@ -20,13 +20,13 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/proc_fs.h> 21#include <linux/proc_fs.h>
22 22
23#include <asm/macintosh.h> 23#include <asm/macintosh.h>
24#include <asm/macints.h> 24#include <asm/macints.h>
25#include <asm/mac_iop.h> 25#include <asm/mac_iop.h>
26#include <asm/mac_oss.h> 26#include <asm/mac_oss.h>
27#include <asm/adb_iop.h> 27#include <asm/adb_iop.h>
28 28
29#include <linux/adb.h> 29#include <linux/adb.h>
30 30
31/*#define DEBUG_ADB_IOP*/ 31/*#define DEBUG_ADB_IOP*/
32 32
@@ -38,9 +38,9 @@ static unsigned char *reply_ptr;
38#endif 38#endif
39 39
40static enum adb_iop_state { 40static enum adb_iop_state {
41 idle, 41 idle,
42 sending, 42 sending,
43 awaiting_reply 43 awaiting_reply
44} adb_iop_state; 44} adb_iop_state;
45 45
46static void adb_iop_start(void); 46static void adb_iop_start(void);
@@ -66,7 +66,8 @@ static void adb_iop_end_req(struct adb_request *req, int state)
66{ 66{
67 req->complete = 1; 67 req->complete = 1;
68 current_req = req->next; 68 current_req = req->next;
69 if (req->done) (*req->done)(req); 69 if (req->done)
70 (*req->done)(req);
70 adb_iop_state = state; 71 adb_iop_state = state;
71} 72}
72 73
@@ -100,7 +101,7 @@ static void adb_iop_complete(struct iop_msg *msg)
100 101
101static void adb_iop_listen(struct iop_msg *msg) 102static void adb_iop_listen(struct iop_msg *msg)
102{ 103{
103 struct adb_iopmsg *amsg = (struct adb_iopmsg *) msg->message; 104 struct adb_iopmsg *amsg = (struct adb_iopmsg *)msg->message;
104 struct adb_request *req; 105 struct adb_request *req;
105 unsigned long flags; 106 unsigned long flags;
106#ifdef DEBUG_ADB_IOP 107#ifdef DEBUG_ADB_IOP
@@ -113,9 +114,9 @@ static void adb_iop_listen(struct iop_msg *msg)
113 114
114#ifdef DEBUG_ADB_IOP 115#ifdef DEBUG_ADB_IOP
115 printk("adb_iop_listen %p: rcvd packet, %d bytes: %02X %02X", req, 116 printk("adb_iop_listen %p: rcvd packet, %d bytes: %02X %02X", req,
116 (uint) amsg->count + 2, (uint) amsg->flags, (uint) amsg->cmd); 117 (uint)amsg->count + 2, (uint)amsg->flags, (uint)amsg->cmd);
117 for (i = 0; i < amsg->count; i++) 118 for (i = 0; i < amsg->count; i++)
118 printk(" %02X", (uint) amsg->data[i]); 119 printk(" %02X", (uint)amsg->data[i]);
119 printk("\n"); 120 printk("\n");
120#endif 121#endif
121 122
@@ -168,14 +169,15 @@ static void adb_iop_start(void)
168 169
169 /* get the packet to send */ 170 /* get the packet to send */
170 req = current_req; 171 req = current_req;
171 if (!req) return; 172 if (!req)
173 return;
172 174
173 local_irq_save(flags); 175 local_irq_save(flags);
174 176
175#ifdef DEBUG_ADB_IOP 177#ifdef DEBUG_ADB_IOP
176 printk("adb_iop_start %p: sending packet, %d bytes:", req, req->nbytes); 178 printk("adb_iop_start %p: sending packet, %d bytes:", req, req->nbytes);
177 for (i = 0 ; i < req->nbytes ; i++) 179 for (i = 0; i < req->nbytes; i++)
178 printk(" %02X", (uint) req->data[i]); 180 printk(" %02X", (uint)req->data[i]);
179 printk("\n"); 181 printk("\n");
180#endif 182#endif
181 183
@@ -196,19 +198,20 @@ static void adb_iop_start(void)
196 /* Now send it. The IOP manager will call adb_iop_complete */ 198 /* Now send it. The IOP manager will call adb_iop_complete */
197 /* when the packet has been sent. */ 199 /* when the packet has been sent. */
198 200
199 iop_send_message(ADB_IOP, ADB_CHAN, req, 201 iop_send_message(ADB_IOP, ADB_CHAN, req, sizeof(amsg), (__u8 *)&amsg,
200 sizeof(amsg), (__u8 *) &amsg, adb_iop_complete); 202 adb_iop_complete);
201} 203}
202 204
203int adb_iop_probe(void) 205int adb_iop_probe(void)
204{ 206{
205 if (!iop_ism_present) return -ENODEV; 207 if (!iop_ism_present)
208 return -ENODEV;
206 return 0; 209 return 0;
207} 210}
208 211
209int adb_iop_init(void) 212int adb_iop_init(void)
210{ 213{
211 printk("adb: IOP ISM driver v0.4 for Unified ADB.\n"); 214 pr_info("adb: IOP ISM driver v0.4 for Unified ADB\n");
212 iop_listen(ADB_IOP, ADB_CHAN, adb_iop_listen, "ADB"); 215 iop_listen(ADB_IOP, ADB_CHAN, adb_iop_listen, "ADB");
213 return 0; 216 return 0;
214} 217}
@@ -218,10 +221,12 @@ int adb_iop_send_request(struct adb_request *req, int sync)
218 int err; 221 int err;
219 222
220 err = adb_iop_write(req); 223 err = adb_iop_write(req);
221 if (err) return err; 224 if (err)
225 return err;
222 226
223 if (sync) { 227 if (sync) {
224 while (!req->complete) adb_iop_poll(); 228 while (!req->complete)
229 adb_iop_poll();
225 } 230 }
226 return 0; 231 return 0;
227} 232}
@@ -251,7 +256,9 @@ static int adb_iop_write(struct adb_request *req)
251 } 256 }
252 257
253 local_irq_restore(flags); 258 local_irq_restore(flags);
254 if (adb_iop_state == idle) adb_iop_start(); 259
260 if (adb_iop_state == idle)
261 adb_iop_start();
255 return 0; 262 return 0;
256} 263}
257 264
@@ -263,7 +270,8 @@ int adb_iop_autopoll(int devs)
263 270
264void adb_iop_poll(void) 271void adb_iop_poll(void)
265{ 272{
266 if (adb_iop_state == idle) adb_iop_start(); 273 if (adb_iop_state == idle)
274 adb_iop_start();
267 iop_ism_irq_poll(ADB_IOP); 275 iop_ism_irq_poll(ADB_IOP);
268} 276}
269 277
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 76e98f0f7a3e..e49d1f287a17 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -203,15 +203,15 @@ static int adb_scan_bus(void)
203 } 203 }
204 204
205 /* Now fill in the handler_id field of the adb_handler entries. */ 205 /* Now fill in the handler_id field of the adb_handler entries. */
206 pr_debug("adb devices:\n");
207 for (i = 1; i < 16; i++) { 206 for (i = 1; i < 16; i++) {
208 if (adb_handler[i].original_address == 0) 207 if (adb_handler[i].original_address == 0)
209 continue; 208 continue;
210 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1, 209 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
211 (i << 4) | 0xf); 210 (i << 4) | 0xf);
212 adb_handler[i].handler_id = req.reply[2]; 211 adb_handler[i].handler_id = req.reply[2];
213 pr_debug(" [%d]: %d %x\n", i, adb_handler[i].original_address, 212 printk(KERN_DEBUG "adb device [%d]: %d 0x%X\n", i,
214 adb_handler[i].handler_id); 213 adb_handler[i].original_address,
214 adb_handler[i].handler_id);
215 devmask |= 1 << i; 215 devmask |= 1 << i;
216 } 216 }
217 return devmask; 217 return devmask;
@@ -579,6 +579,8 @@ adb_try_handler_change(int address, int new_id)
579 mutex_lock(&adb_handler_mutex); 579 mutex_lock(&adb_handler_mutex);
580 ret = try_handler_change(address, new_id); 580 ret = try_handler_change(address, new_id);
581 mutex_unlock(&adb_handler_mutex); 581 mutex_unlock(&adb_handler_mutex);
582 if (ret)
583 pr_debug("adb handler change: [%d] 0x%X\n", address, new_id);
582 return ret; 584 return ret;
583} 585}
584EXPORT_SYMBOL(adb_try_handler_change); 586EXPORT_SYMBOL(adb_try_handler_change);
diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c
index a261892c03b3..75482eeab2c4 100644
--- a/drivers/macintosh/adbhid.c
+++ b/drivers/macintosh/adbhid.c
@@ -757,6 +757,7 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
757 struct input_dev *input_dev; 757 struct input_dev *input_dev;
758 int err; 758 int err;
759 int i; 759 int i;
760 char *keyboard_type;
760 761
761 if (adbhid[id]) { 762 if (adbhid[id]) {
762 pr_err("Trying to reregister ADB HID on ID %d\n", id); 763 pr_err("Trying to reregister ADB HID on ID %d\n", id);
@@ -798,24 +799,23 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
798 799
799 memcpy(hid->keycode, adb_to_linux_keycodes, sizeof(adb_to_linux_keycodes)); 800 memcpy(hid->keycode, adb_to_linux_keycodes, sizeof(adb_to_linux_keycodes));
800 801
801 pr_info("Detected ADB keyboard, type ");
802 switch (original_handler_id) { 802 switch (original_handler_id) {
803 default: 803 default:
804 pr_cont("<unknown>.\n"); 804 keyboard_type = "<unknown>";
805 input_dev->id.version = ADB_KEYBOARD_UNKNOWN; 805 input_dev->id.version = ADB_KEYBOARD_UNKNOWN;
806 break; 806 break;
807 807
808 case 0x01: case 0x02: case 0x03: case 0x06: case 0x08: 808 case 0x01: case 0x02: case 0x03: case 0x06: case 0x08:
809 case 0x0C: case 0x10: case 0x18: case 0x1B: case 0x1C: 809 case 0x0C: case 0x10: case 0x18: case 0x1B: case 0x1C:
810 case 0xC0: case 0xC3: case 0xC6: 810 case 0xC0: case 0xC3: case 0xC6:
811 pr_cont("ANSI.\n"); 811 keyboard_type = "ANSI";
812 input_dev->id.version = ADB_KEYBOARD_ANSI; 812 input_dev->id.version = ADB_KEYBOARD_ANSI;
813 break; 813 break;
814 814
815 case 0x04: case 0x05: case 0x07: case 0x09: case 0x0D: 815 case 0x04: case 0x05: case 0x07: case 0x09: case 0x0D:
816 case 0x11: case 0x14: case 0x19: case 0x1D: case 0xC1: 816 case 0x11: case 0x14: case 0x19: case 0x1D: case 0xC1:
817 case 0xC4: case 0xC7: 817 case 0xC4: case 0xC7:
818 pr_cont("ISO, swapping keys.\n"); 818 keyboard_type = "ISO, swapping keys";
819 input_dev->id.version = ADB_KEYBOARD_ISO; 819 input_dev->id.version = ADB_KEYBOARD_ISO;
820 i = hid->keycode[10]; 820 i = hid->keycode[10];
821 hid->keycode[10] = hid->keycode[50]; 821 hid->keycode[10] = hid->keycode[50];
@@ -824,10 +824,11 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
824 824
825 case 0x12: case 0x15: case 0x16: case 0x17: case 0x1A: 825 case 0x12: case 0x15: case 0x16: case 0x17: case 0x1A:
826 case 0x1E: case 0xC2: case 0xC5: case 0xC8: case 0xC9: 826 case 0x1E: case 0xC2: case 0xC5: case 0xC8: case 0xC9:
827 pr_cont("JIS.\n"); 827 keyboard_type = "JIS";
828 input_dev->id.version = ADB_KEYBOARD_JIS; 828 input_dev->id.version = ADB_KEYBOARD_JIS;
829 break; 829 break;
830 } 830 }
831 pr_info("Detected ADB keyboard, type %s.\n", keyboard_type);
831 832
832 for (i = 0; i < 128; i++) 833 for (i = 0; i < 128; i++)
833 if (hid->keycode[i]) 834 if (hid->keycode[i])
@@ -972,16 +973,13 @@ adbhid_probe(void)
972 ->get it to send separate codes for left and right shift, 973 ->get it to send separate codes for left and right shift,
973 control, option keys */ 974 control, option keys */
974#if 0 /* handler 5 doesn't send separate codes for R modifiers */ 975#if 0 /* handler 5 doesn't send separate codes for R modifiers */
975 if (adb_try_handler_change(id, 5)) 976 if (!adb_try_handler_change(id, 5))
976 printk("ADB keyboard at %d, handler set to 5\n", id);
977 else
978#endif 977#endif
979 if (adb_try_handler_change(id, 3)) 978 adb_try_handler_change(id, 3);
980 printk("ADB keyboard at %d, handler set to 3\n", id);
981 else
982 printk("ADB keyboard at %d, handler 1\n", id);
983 979
984 adb_get_infos(id, &default_id, &cur_handler_id); 980 adb_get_infos(id, &default_id, &cur_handler_id);
981 printk(KERN_DEBUG "ADB keyboard at %d has handler 0x%X\n",
982 id, cur_handler_id);
985 reg |= adbhid_input_reregister(id, default_id, org_handler_id, 983 reg |= adbhid_input_reregister(id, default_id, org_handler_id,
986 cur_handler_id, 0); 984 cur_handler_id, 0);
987 } 985 }
@@ -999,48 +997,44 @@ adbhid_probe(void)
999 for (i = 0; i < mouse_ids.nids; i++) { 997 for (i = 0; i < mouse_ids.nids; i++) {
1000 int id = mouse_ids.id[i]; 998 int id = mouse_ids.id[i];
1001 int mouse_kind; 999 int mouse_kind;
1000 char *desc = "standard";
1002 1001
1003 adb_get_infos(id, &default_id, &org_handler_id); 1002 adb_get_infos(id, &default_id, &org_handler_id);
1004 1003
1005 if (adb_try_handler_change(id, 4)) { 1004 if (adb_try_handler_change(id, 4)) {
1006 printk("ADB mouse at %d, handler set to 4", id);
1007 mouse_kind = ADBMOUSE_EXTENDED; 1005 mouse_kind = ADBMOUSE_EXTENDED;
1008 } 1006 }
1009 else if (adb_try_handler_change(id, 0x2F)) { 1007 else if (adb_try_handler_change(id, 0x2F)) {
1010 printk("ADB mouse at %d, handler set to 0x2F", id);
1011 mouse_kind = ADBMOUSE_MICROSPEED; 1008 mouse_kind = ADBMOUSE_MICROSPEED;
1012 } 1009 }
1013 else if (adb_try_handler_change(id, 0x42)) { 1010 else if (adb_try_handler_change(id, 0x42)) {
1014 printk("ADB mouse at %d, handler set to 0x42", id);
1015 mouse_kind = ADBMOUSE_TRACKBALLPRO; 1011 mouse_kind = ADBMOUSE_TRACKBALLPRO;
1016 } 1012 }
1017 else if (adb_try_handler_change(id, 0x66)) { 1013 else if (adb_try_handler_change(id, 0x66)) {
1018 printk("ADB mouse at %d, handler set to 0x66", id);
1019 mouse_kind = ADBMOUSE_MICROSPEED; 1014 mouse_kind = ADBMOUSE_MICROSPEED;
1020 } 1015 }
1021 else if (adb_try_handler_change(id, 0x5F)) { 1016 else if (adb_try_handler_change(id, 0x5F)) {
1022 printk("ADB mouse at %d, handler set to 0x5F", id);
1023 mouse_kind = ADBMOUSE_MICROSPEED; 1017 mouse_kind = ADBMOUSE_MICROSPEED;
1024 } 1018 }
1025 else if (adb_try_handler_change(id, 3)) { 1019 else if (adb_try_handler_change(id, 3)) {
1026 printk("ADB mouse at %d, handler set to 3", id);
1027 mouse_kind = ADBMOUSE_MS_A3; 1020 mouse_kind = ADBMOUSE_MS_A3;
1028 } 1021 }
1029 else if (adb_try_handler_change(id, 2)) { 1022 else if (adb_try_handler_change(id, 2)) {
1030 printk("ADB mouse at %d, handler set to 2", id);
1031 mouse_kind = ADBMOUSE_STANDARD_200; 1023 mouse_kind = ADBMOUSE_STANDARD_200;
1032 } 1024 }
1033 else { 1025 else {
1034 printk("ADB mouse at %d, handler 1", id);
1035 mouse_kind = ADBMOUSE_STANDARD_100; 1026 mouse_kind = ADBMOUSE_STANDARD_100;
1036 } 1027 }
1037 1028
1038 if ((mouse_kind == ADBMOUSE_TRACKBALLPRO) 1029 if ((mouse_kind == ADBMOUSE_TRACKBALLPRO)
1039 || (mouse_kind == ADBMOUSE_MICROSPEED)) { 1030 || (mouse_kind == ADBMOUSE_MICROSPEED)) {
1031 desc = "Microspeed/MacPoint or compatible";
1040 init_microspeed(id); 1032 init_microspeed(id);
1041 } else if (mouse_kind == ADBMOUSE_MS_A3) { 1033 } else if (mouse_kind == ADBMOUSE_MS_A3) {
1034 desc = "Mouse Systems A3 Mouse or compatible";
1042 init_ms_a3(id); 1035 init_ms_a3(id);
1043 } else if (mouse_kind == ADBMOUSE_EXTENDED) { 1036 } else if (mouse_kind == ADBMOUSE_EXTENDED) {
1037 desc = "extended";
1044 /* 1038 /*
1045 * Register 1 is usually used for device 1039 * Register 1 is usually used for device
1046 * identification. Here, we try to identify 1040 * identification. Here, we try to identify
@@ -1054,32 +1048,36 @@ adbhid_probe(void)
1054 (req.reply[1] == 0x9a) && ((req.reply[2] == 0x21) 1048 (req.reply[1] == 0x9a) && ((req.reply[2] == 0x21)
1055 || (req.reply[2] == 0x20))) { 1049 || (req.reply[2] == 0x20))) {
1056 mouse_kind = ADBMOUSE_TRACKBALL; 1050 mouse_kind = ADBMOUSE_TRACKBALL;
1051 desc = "trackman/mouseman";
1057 init_trackball(id); 1052 init_trackball(id);
1058 } 1053 }
1059 else if ((req.reply_len >= 4) && 1054 else if ((req.reply_len >= 4) &&
1060 (req.reply[1] == 0x74) && (req.reply[2] == 0x70) && 1055 (req.reply[1] == 0x74) && (req.reply[2] == 0x70) &&
1061 (req.reply[3] == 0x61) && (req.reply[4] == 0x64)) { 1056 (req.reply[3] == 0x61) && (req.reply[4] == 0x64)) {
1062 mouse_kind = ADBMOUSE_TRACKPAD; 1057 mouse_kind = ADBMOUSE_TRACKPAD;
1058 desc = "trackpad";
1063 init_trackpad(id); 1059 init_trackpad(id);
1064 } 1060 }
1065 else if ((req.reply_len >= 4) && 1061 else if ((req.reply_len >= 4) &&
1066 (req.reply[1] == 0x4b) && (req.reply[2] == 0x4d) && 1062 (req.reply[1] == 0x4b) && (req.reply[2] == 0x4d) &&
1067 (req.reply[3] == 0x4c) && (req.reply[4] == 0x31)) { 1063 (req.reply[3] == 0x4c) && (req.reply[4] == 0x31)) {
1068 mouse_kind = ADBMOUSE_TURBOMOUSE5; 1064 mouse_kind = ADBMOUSE_TURBOMOUSE5;
1065 desc = "TurboMouse 5";
1069 init_turbomouse(id); 1066 init_turbomouse(id);
1070 } 1067 }
1071 else if ((req.reply_len == 9) && 1068 else if ((req.reply_len == 9) &&
1072 (req.reply[1] == 0x4b) && (req.reply[2] == 0x4f) && 1069 (req.reply[1] == 0x4b) && (req.reply[2] == 0x4f) &&
1073 (req.reply[3] == 0x49) && (req.reply[4] == 0x54)) { 1070 (req.reply[3] == 0x49) && (req.reply[4] == 0x54)) {
1074 if (adb_try_handler_change(id, 0x42)) { 1071 if (adb_try_handler_change(id, 0x42)) {
1075 pr_cont("\nADB MacAlly 2-button mouse at %d, handler set to 0x42", id);
1076 mouse_kind = ADBMOUSE_MACALLY2; 1072 mouse_kind = ADBMOUSE_MACALLY2;
1073 desc = "MacAlly 2-button";
1077 } 1074 }
1078 } 1075 }
1079 } 1076 }
1080 pr_cont("\n");
1081 1077
1082 adb_get_infos(id, &default_id, &cur_handler_id); 1078 adb_get_infos(id, &default_id, &cur_handler_id);
1079 printk(KERN_DEBUG "ADB mouse (%s) at %d has handler 0x%X\n",
1080 desc, id, cur_handler_id);
1083 reg |= adbhid_input_reregister(id, default_id, org_handler_id, 1081 reg |= adbhid_input_reregister(id, default_id, org_handler_id,
1084 cur_handler_id, mouse_kind); 1082 cur_handler_id, mouse_kind);
1085 } 1083 }
@@ -1092,12 +1090,10 @@ init_trackpad(int id)
1092 struct adb_request req; 1090 struct adb_request req;
1093 unsigned char r1_buffer[8]; 1091 unsigned char r1_buffer[8];
1094 1092
1095 pr_cont(" (trackpad)");
1096
1097 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1, 1093 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
1098 ADB_READREG(id,1)); 1094 ADB_READREG(id,1));
1099 if (req.reply_len < 8) 1095 if (req.reply_len < 8)
1100 pr_cont("bad length for reg. 1\n"); 1096 pr_err("%s: bad length for reg. 1\n", __func__);
1101 else 1097 else
1102 { 1098 {
1103 memcpy(r1_buffer, &req.reply[1], 8); 1099 memcpy(r1_buffer, &req.reply[1], 8);
@@ -1145,8 +1141,6 @@ init_trackball(int id)
1145{ 1141{
1146 struct adb_request req; 1142 struct adb_request req;
1147 1143
1148 pr_cont(" (trackman/mouseman)");
1149
1150 adb_request(&req, NULL, ADBREQ_SYNC, 3, 1144 adb_request(&req, NULL, ADBREQ_SYNC, 3,
1151 ADB_WRITEREG(id,1), 00,0x81); 1145 ADB_WRITEREG(id,1), 00,0x81);
1152 1146
@@ -1177,8 +1171,6 @@ init_turbomouse(int id)
1177{ 1171{
1178 struct adb_request req; 1172 struct adb_request req;
1179 1173
1180 pr_cont(" (TurboMouse 5)");
1181
1182 adb_request(&req, NULL, ADBREQ_SYNC, 1, ADB_FLUSH(id)); 1174 adb_request(&req, NULL, ADBREQ_SYNC, 1, ADB_FLUSH(id));
1183 1175
1184 adb_request(&req, NULL, ADBREQ_SYNC, 1, ADB_FLUSH(3)); 1176 adb_request(&req, NULL, ADBREQ_SYNC, 1, ADB_FLUSH(3));
@@ -1213,8 +1205,6 @@ init_microspeed(int id)
1213{ 1205{
1214 struct adb_request req; 1206 struct adb_request req;
1215 1207
1216 pr_cont(" (Microspeed/MacPoint or compatible)");
1217
1218 adb_request(&req, NULL, ADBREQ_SYNC, 1, ADB_FLUSH(id)); 1208 adb_request(&req, NULL, ADBREQ_SYNC, 1, ADB_FLUSH(id));
1219 1209
1220 /* This will initialize mice using the Microspeed, MacPoint and 1210 /* This will initialize mice using the Microspeed, MacPoint and
@@ -1253,7 +1243,6 @@ init_ms_a3(int id)
1253{ 1243{
1254 struct adb_request req; 1244 struct adb_request req;
1255 1245
1256 pr_cont(" (Mouse Systems A3 Mouse, or compatible)");
1257 adb_request(&req, NULL, ADBREQ_SYNC, 3, 1246 adb_request(&req, NULL, ADBREQ_SYNC, 3,
1258 ADB_WRITEREG(id, 0x2), 1247 ADB_WRITEREG(id, 0x2),
1259 0x00, 1248 0x00,
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index 07074820a167..17d3bc917562 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -360,9 +360,10 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
360 struct macio_dev *in_bay, 360 struct macio_dev *in_bay,
361 struct resource *parent_res) 361 struct resource *parent_res)
362{ 362{
363 char name[MAX_NODE_NAME_SIZE + 1];
363 struct macio_dev *dev; 364 struct macio_dev *dev;
364 const u32 *reg; 365 const u32 *reg;
365 366
366 if (np == NULL) 367 if (np == NULL)
367 return NULL; 368 return NULL;
368 369
@@ -402,6 +403,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
402#endif 403#endif
403 404
404 /* MacIO itself has a different reg, we use it's PCI base */ 405 /* MacIO itself has a different reg, we use it's PCI base */
406 snprintf(name, sizeof(name), "%pOFn", np);
405 if (np == chip->of_node) { 407 if (np == chip->of_node) {
406 dev_set_name(&dev->ofdev.dev, "%1d.%08x:%.*s", 408 dev_set_name(&dev->ofdev.dev, "%1d.%08x:%.*s",
407 chip->lbus.index, 409 chip->lbus.index,
@@ -410,12 +412,12 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
410#else 412#else
411 0, /* NuBus may want to do something better here */ 413 0, /* NuBus may want to do something better here */
412#endif 414#endif
413 MAX_NODE_NAME_SIZE, np->name); 415 MAX_NODE_NAME_SIZE, name);
414 } else { 416 } else {
415 reg = of_get_property(np, "reg", NULL); 417 reg = of_get_property(np, "reg", NULL);
416 dev_set_name(&dev->ofdev.dev, "%1d.%08x:%.*s", 418 dev_set_name(&dev->ofdev.dev, "%1d.%08x:%.*s",
417 chip->lbus.index, 419 chip->lbus.index,
418 reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name); 420 reg ? *reg : 0, MAX_NODE_NAME_SIZE, name);
419 } 421 }
420 422
421 /* Setup interrupts & resources */ 423 /* Setup interrupts & resources */
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c
index ca4fcffe454b..d2451e58acb9 100644
--- a/drivers/macintosh/macio_sysfs.c
+++ b/drivers/macintosh/macio_sysfs.c
@@ -58,7 +58,13 @@ static ssize_t devspec_show(struct device *dev,
58static DEVICE_ATTR_RO(modalias); 58static DEVICE_ATTR_RO(modalias);
59static DEVICE_ATTR_RO(devspec); 59static DEVICE_ATTR_RO(devspec);
60 60
61macio_config_of_attr (name, "%s\n"); 61static ssize_t name_show(struct device *dev,
62 struct device_attribute *attr, char *buf)
63{
64 return sprintf(buf, "%pOFn\n", dev->of_node);
65}
66static DEVICE_ATTR_RO(name);
67
62macio_config_of_attr (type, "%s\n"); 68macio_config_of_attr (type, "%s\n");
63 69
64static struct attribute *macio_dev_attrs[] = { 70static struct attribute *macio_dev_attrs[] = {
diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c
index 98dd702eb867..bbec6ac0a966 100644
--- a/drivers/macintosh/via-cuda.c
+++ b/drivers/macintosh/via-cuda.c
@@ -766,3 +766,38 @@ cuda_input(unsigned char *buf, int nb)
766 buf, nb, false); 766 buf, nb, false);
767 } 767 }
768} 768}
769
770/* Offset between Unix time (1970-based) and Mac time (1904-based) */
771#define RTC_OFFSET 2082844800
772
773time64_t cuda_get_time(void)
774{
775 struct adb_request req;
776 u32 now;
777
778 if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_GET_TIME) < 0)
779 return 0;
780 while (!req.complete)
781 cuda_poll();
782 if (req.reply_len != 7)
783 pr_err("%s: got %d byte reply\n", __func__, req.reply_len);
784 now = (req.reply[3] << 24) + (req.reply[4] << 16) +
785 (req.reply[5] << 8) + req.reply[6];
786 return (time64_t)now - RTC_OFFSET;
787}
788
789int cuda_set_rtc_time(struct rtc_time *tm)
790{
791 u32 now;
792 struct adb_request req;
793
794 now = lower_32_bits(rtc_tm_to_time64(tm) + RTC_OFFSET);
795 if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME,
796 now >> 24, now >> 16, now >> 8, now) < 0)
797 return -ENXIO;
798 while (!req.complete)
799 cuda_poll();
800 if ((req.reply_len != 3) && (req.reply_len != 7))
801 pr_err("%s: got %d byte reply\n", __func__, req.reply_len);
802 return 0;
803}
diff --git a/drivers/macintosh/via-macii.c b/drivers/macintosh/via-macii.c
index cf6f7d52d6be..ac824d7b2dcf 100644
--- a/drivers/macintosh/via-macii.c
+++ b/drivers/macintosh/via-macii.c
@@ -12,7 +12,7 @@
12 * 12 *
13 * 1999-08-02 (jmt) - Initial rewrite for Unified ADB. 13 * 1999-08-02 (jmt) - Initial rewrite for Unified ADB.
14 * 2000-03-29 Tony Mantler <tonym@mac.linux-m68k.org> 14 * 2000-03-29 Tony Mantler <tonym@mac.linux-m68k.org>
15 * - Big overhaul, should actually work now. 15 * - Big overhaul, should actually work now.
16 * 2006-12-31 Finn Thain - Another overhaul. 16 * 2006-12-31 Finn Thain - Another overhaul.
17 * 17 *
18 * Suggested reading: 18 * Suggested reading:
@@ -23,7 +23,7 @@
23 * Apple's "ADB Analyzer" bus sniffer is invaluable: 23 * Apple's "ADB Analyzer" bus sniffer is invaluable:
24 * ftp://ftp.apple.com/developer/Tool_Chest/Devices_-_Hardware/Apple_Desktop_Bus/ 24 * ftp://ftp.apple.com/developer/Tool_Chest/Devices_-_Hardware/Apple_Desktop_Bus/
25 */ 25 */
26 26
27#include <stdarg.h> 27#include <stdarg.h>
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/errno.h> 29#include <linux/errno.h>
@@ -77,7 +77,7 @@ static volatile unsigned char *via;
77#define ST_ODD 0x20 /* ADB state: odd data byte */ 77#define ST_ODD 0x20 /* ADB state: odd data byte */
78#define ST_IDLE 0x30 /* ADB state: idle, nothing to send */ 78#define ST_IDLE 0x30 /* ADB state: idle, nothing to send */
79 79
80static int macii_init_via(void); 80static int macii_init_via(void);
81static void macii_start(void); 81static void macii_start(void);
82static irqreturn_t macii_interrupt(int irq, void *arg); 82static irqreturn_t macii_interrupt(int irq, void *arg);
83static void macii_queue_poll(void); 83static void macii_queue_poll(void);
@@ -120,31 +120,15 @@ static int srq_asserted; /* have to poll for the device that asserted it */
120static int command_byte; /* the most recent command byte transmitted */ 120static int command_byte; /* the most recent command byte transmitted */
121static int autopoll_devs; /* bits set are device addresses to be polled */ 121static int autopoll_devs; /* bits set are device addresses to be polled */
122 122
123/* Sanity check for request queue. Doesn't check for cycles. */
124static int request_is_queued(struct adb_request *req) {
125 struct adb_request *cur;
126 unsigned long flags;
127 local_irq_save(flags);
128 cur = current_req;
129 while (cur) {
130 if (cur == req) {
131 local_irq_restore(flags);
132 return 1;
133 }
134 cur = cur->next;
135 }
136 local_irq_restore(flags);
137 return 0;
138}
139
140/* Check for MacII style ADB */ 123/* Check for MacII style ADB */
141static int macii_probe(void) 124static int macii_probe(void)
142{ 125{
143 if (macintosh_config->adb_type != MAC_ADB_II) return -ENODEV; 126 if (macintosh_config->adb_type != MAC_ADB_II)
127 return -ENODEV;
144 128
145 via = via1; 129 via = via1;
146 130
147 printk("adb: Mac II ADB Driver v1.0 for Unified ADB\n"); 131 pr_info("adb: Mac II ADB Driver v1.0 for Unified ADB\n");
148 return 0; 132 return 0;
149} 133}
150 134
@@ -153,15 +137,17 @@ int macii_init(void)
153{ 137{
154 unsigned long flags; 138 unsigned long flags;
155 int err; 139 int err;
156 140
157 local_irq_save(flags); 141 local_irq_save(flags);
158 142
159 err = macii_init_via(); 143 err = macii_init_via();
160 if (err) goto out; 144 if (err)
145 goto out;
161 146
162 err = request_irq(IRQ_MAC_ADB, macii_interrupt, 0, "ADB", 147 err = request_irq(IRQ_MAC_ADB, macii_interrupt, 0, "ADB",
163 macii_interrupt); 148 macii_interrupt);
164 if (err) goto out; 149 if (err)
150 goto out;
165 151
166 macii_state = idle; 152 macii_state = idle;
167out: 153out:
@@ -169,7 +155,7 @@ out:
169 return err; 155 return err;
170} 156}
171 157
172/* initialize the hardware */ 158/* initialize the hardware */
173static int macii_init_via(void) 159static int macii_init_via(void)
174{ 160{
175 unsigned char x; 161 unsigned char x;
@@ -179,7 +165,7 @@ static int macii_init_via(void)
179 165
180 /* Set up state: idle */ 166 /* Set up state: idle */
181 via[B] |= ST_IDLE; 167 via[B] |= ST_IDLE;
182 last_status = via[B] & (ST_MASK|CTLR_IRQ); 168 last_status = via[B] & (ST_MASK | CTLR_IRQ);
183 169
184 /* Shift register on input */ 170 /* Shift register on input */
185 via[ACR] = (via[ACR] & ~SR_CTRL) | SR_EXT; 171 via[ACR] = (via[ACR] & ~SR_CTRL) | SR_EXT;
@@ -205,7 +191,8 @@ static void macii_queue_poll(void)
205 int next_device; 191 int next_device;
206 static struct adb_request req; 192 static struct adb_request req;
207 193
208 if (!autopoll_devs) return; 194 if (!autopoll_devs)
195 return;
209 196
210 device_mask = (1 << (((command_byte & 0xF0) >> 4) + 1)) - 1; 197 device_mask = (1 << (((command_byte & 0xF0) >> 4) + 1)) - 1;
211 if (autopoll_devs & ~device_mask) 198 if (autopoll_devs & ~device_mask)
@@ -213,10 +200,7 @@ static void macii_queue_poll(void)
213 else 200 else
214 next_device = ffs(autopoll_devs) - 1; 201 next_device = ffs(autopoll_devs) - 1;
215 202
216 BUG_ON(request_is_queued(&req)); 203 adb_request(&req, NULL, ADBREQ_NOSEND, 1, ADB_READREG(next_device, 0));
217
218 adb_request(&req, NULL, ADBREQ_NOSEND, 1,
219 ADB_READREG(next_device, 0));
220 204
221 req.sent = 0; 205 req.sent = 0;
222 req.complete = 0; 206 req.complete = 0;
@@ -235,45 +219,47 @@ static void macii_queue_poll(void)
235static int macii_send_request(struct adb_request *req, int sync) 219static int macii_send_request(struct adb_request *req, int sync)
236{ 220{
237 int err; 221 int err;
238 unsigned long flags;
239 222
240 BUG_ON(request_is_queued(req));
241
242 local_irq_save(flags);
243 err = macii_write(req); 223 err = macii_write(req);
244 local_irq_restore(flags); 224 if (err)
225 return err;
245 226
246 if (!err && sync) { 227 if (sync)
247 while (!req->complete) { 228 while (!req->complete)
248 macii_poll(); 229 macii_poll();
249 }
250 BUG_ON(request_is_queued(req));
251 }
252 230
253 return err; 231 return 0;
254} 232}
255 233
256/* Send an ADB request (append to request queue) */ 234/* Send an ADB request (append to request queue) */
257static int macii_write(struct adb_request *req) 235static int macii_write(struct adb_request *req)
258{ 236{
237 unsigned long flags;
238
259 if (req->nbytes < 2 || req->data[0] != ADB_PACKET || req->nbytes > 15) { 239 if (req->nbytes < 2 || req->data[0] != ADB_PACKET || req->nbytes > 15) {
260 req->complete = 1; 240 req->complete = 1;
261 return -EINVAL; 241 return -EINVAL;
262 } 242 }
263 243
264 req->next = NULL; 244 req->next = NULL;
265 req->sent = 0; 245 req->sent = 0;
266 req->complete = 0; 246 req->complete = 0;
267 req->reply_len = 0; 247 req->reply_len = 0;
268 248
249 local_irq_save(flags);
250
269 if (current_req != NULL) { 251 if (current_req != NULL) {
270 last_req->next = req; 252 last_req->next = req;
271 last_req = req; 253 last_req = req;
272 } else { 254 } else {
273 current_req = req; 255 current_req = req;
274 last_req = req; 256 last_req = req;
275 if (macii_state == idle) macii_start(); 257 if (macii_state == idle)
258 macii_start();
276 } 259 }
260
261 local_irq_restore(flags);
262
277 return 0; 263 return 0;
278} 264}
279 265
@@ -287,7 +273,8 @@ static int macii_autopoll(int devs)
287 /* bit 1 == device 1, and so on. */ 273 /* bit 1 == device 1, and so on. */
288 autopoll_devs = devs & 0xFFFE; 274 autopoll_devs = devs & 0xFFFE;
289 275
290 if (!autopoll_devs) return 0; 276 if (!autopoll_devs)
277 return 0;
291 278
292 local_irq_save(flags); 279 local_irq_save(flags);
293 280
@@ -304,7 +291,8 @@ static int macii_autopoll(int devs)
304 return err; 291 return err;
305} 292}
306 293
307static inline int need_autopoll(void) { 294static inline int need_autopoll(void)
295{
308 /* Was the last command Talk Reg 0 296 /* Was the last command Talk Reg 0
309 * and is the target on the autopoll list? 297 * and is the target on the autopoll list?
310 */ 298 */
@@ -317,21 +305,17 @@ static inline int need_autopoll(void) {
317/* Prod the chip without interrupts */ 305/* Prod the chip without interrupts */
318static void macii_poll(void) 306static void macii_poll(void)
319{ 307{
320 disable_irq(IRQ_MAC_ADB);
321 macii_interrupt(0, NULL); 308 macii_interrupt(0, NULL);
322 enable_irq(IRQ_MAC_ADB);
323} 309}
324 310
325/* Reset the bus */ 311/* Reset the bus */
326static int macii_reset_bus(void) 312static int macii_reset_bus(void)
327{ 313{
328 static struct adb_request req; 314 static struct adb_request req;
329
330 if (request_is_queued(&req))
331 return 0;
332 315
333 /* Command = 0, Address = ignored */ 316 /* Command = 0, Address = ignored */
334 adb_request(&req, NULL, 0, 1, ADB_BUSRESET); 317 adb_request(&req, NULL, ADBREQ_NOSEND, 1, ADB_BUSRESET);
318 macii_send_request(&req, 1);
335 319
336 /* Don't want any more requests during the Global Reset low time. */ 320 /* Don't want any more requests during the Global Reset low time. */
337 udelay(3000); 321 udelay(3000);
@@ -346,10 +330,6 @@ static void macii_start(void)
346 330
347 req = current_req; 331 req = current_req;
348 332
349 BUG_ON(req == NULL);
350
351 BUG_ON(macii_state != idle);
352
353 /* Now send it. Be careful though, that first byte of the request 333 /* Now send it. Be careful though, that first byte of the request
354 * is actually ADB_PACKET; the real data begins at index 1! 334 * is actually ADB_PACKET; the real data begins at index 1!
355 * And req->nbytes is the number of bytes of real data plus one. 335 * And req->nbytes is the number of bytes of real data plus one.
@@ -375,7 +355,7 @@ static void macii_start(void)
375 * to be activity on the ADB bus. The chip will poll to achieve this. 355 * to be activity on the ADB bus. The chip will poll to achieve this.
376 * 356 *
377 * The basic ADB state machine was left unchanged from the original MacII code 357 * The basic ADB state machine was left unchanged from the original MacII code
378 * by Alan Cox, which was based on the CUDA driver for PowerMac. 358 * by Alan Cox, which was based on the CUDA driver for PowerMac.
379 * The syntax of the ADB status lines is totally different on MacII, 359 * The syntax of the ADB status lines is totally different on MacII,
380 * though. MacII uses the states Command -> Even -> Odd -> Even ->...-> Idle 360 * though. MacII uses the states Command -> Even -> Odd -> Even ->...-> Idle
381 * for sending and Idle -> Even -> Odd -> Even ->...-> Idle for receiving. 361 * for sending and Idle -> Even -> Odd -> Even ->...-> Idle for receiving.
@@ -387,164 +367,166 @@ static void macii_start(void)
387static irqreturn_t macii_interrupt(int irq, void *arg) 367static irqreturn_t macii_interrupt(int irq, void *arg)
388{ 368{
389 int x; 369 int x;
390 static int entered;
391 struct adb_request *req; 370 struct adb_request *req;
371 unsigned long flags;
372
373 local_irq_save(flags);
392 374
393 if (!arg) { 375 if (!arg) {
394 /* Clear the SR IRQ flag when polling. */ 376 /* Clear the SR IRQ flag when polling. */
395 if (via[IFR] & SR_INT) 377 if (via[IFR] & SR_INT)
396 via[IFR] = SR_INT; 378 via[IFR] = SR_INT;
397 else 379 else {
380 local_irq_restore(flags);
398 return IRQ_NONE; 381 return IRQ_NONE;
382 }
399 } 383 }
400 384
401 BUG_ON(entered++);
402
403 last_status = status; 385 last_status = status;
404 status = via[B] & (ST_MASK|CTLR_IRQ); 386 status = via[B] & (ST_MASK | CTLR_IRQ);
405 387
406 switch (macii_state) { 388 switch (macii_state) {
407 case idle: 389 case idle:
408 if (reading_reply) { 390 if (reading_reply) {
409 reply_ptr = current_req->reply; 391 reply_ptr = current_req->reply;
410 } else { 392 } else {
411 BUG_ON(current_req != NULL); 393 WARN_ON(current_req);
412 reply_ptr = reply_buf; 394 reply_ptr = reply_buf;
413 } 395 }
414 396
415 x = via[SR]; 397 x = via[SR];
416 398
417 if ((status & CTLR_IRQ) && (x == 0xFF)) { 399 if ((status & CTLR_IRQ) && (x == 0xFF)) {
418 /* Bus timeout without SRQ sequence: 400 /* Bus timeout without SRQ sequence:
419 * data is "FF" while CTLR_IRQ is "H" 401 * data is "FF" while CTLR_IRQ is "H"
420 */ 402 */
421 reply_len = 0; 403 reply_len = 0;
422 srq_asserted = 0; 404 srq_asserted = 0;
423 macii_state = read_done; 405 macii_state = read_done;
424 } else { 406 } else {
425 macii_state = reading; 407 macii_state = reading;
426 *reply_ptr = x; 408 *reply_ptr = x;
427 reply_len = 1; 409 reply_len = 1;
428 } 410 }
429 411
430 /* set ADB state = even for first data byte */ 412 /* set ADB state = even for first data byte */
431 via[B] = (via[B] & ~ST_MASK) | ST_EVEN; 413 via[B] = (via[B] & ~ST_MASK) | ST_EVEN;
432 break; 414 break;
433 415
434 case sending: 416 case sending:
435 req = current_req; 417 req = current_req;
436 if (data_index >= req->nbytes) { 418 if (data_index >= req->nbytes) {
437 req->sent = 1; 419 req->sent = 1;
438 macii_state = idle; 420 macii_state = idle;
439
440 if (req->reply_expected) {
441 reading_reply = 1;
442 } else {
443 req->complete = 1;
444 current_req = req->next;
445 if (req->done) (*req->done)(req);
446
447 if (current_req)
448 macii_start();
449 else
450 if (need_autopoll())
451 macii_autopoll(autopoll_devs);
452 }
453 421
454 if (macii_state == idle) { 422 if (req->reply_expected) {
455 /* reset to shift in */ 423 reading_reply = 1;
456 via[ACR] &= ~SR_OUT;
457 x = via[SR];
458 /* set ADB state idle - might get SRQ */
459 via[B] = (via[B] & ~ST_MASK) | ST_IDLE;
460 }
461 } else { 424 } else {
462 via[SR] = req->data[data_index++]; 425 req->complete = 1;
463 426 current_req = req->next;
464 if ( (via[B] & ST_MASK) == ST_CMD ) { 427 if (req->done)
465 /* just sent the command byte, set to EVEN */ 428 (*req->done)(req);
466 via[B] = (via[B] & ~ST_MASK) | ST_EVEN;
467 } else {
468 /* invert state bits, toggle ODD/EVEN */
469 via[B] ^= ST_MASK;
470 }
471 }
472 break;
473
474 case reading:
475 x = via[SR];
476 BUG_ON((status & ST_MASK) == ST_CMD ||
477 (status & ST_MASK) == ST_IDLE);
478
479 /* Bus timeout with SRQ sequence:
480 * data is "XX FF" while CTLR_IRQ is "L L"
481 * End of packet without SRQ sequence:
482 * data is "XX...YY 00" while CTLR_IRQ is "L...H L"
483 * End of packet SRQ sequence:
484 * data is "XX...YY 00" while CTLR_IRQ is "L...L L"
485 * (where XX is the first response byte and
486 * YY is the last byte of valid response data.)
487 */
488 429
489 srq_asserted = 0; 430 if (current_req)
490 if (!(status & CTLR_IRQ)) { 431 macii_start();
491 if (x == 0xFF) { 432 else if (need_autopoll())
492 if (!(last_status & CTLR_IRQ)) { 433 macii_autopoll(autopoll_devs);
493 macii_state = read_done;
494 reply_len = 0;
495 srq_asserted = 1;
496 }
497 } else if (x == 0x00) {
498 macii_state = read_done;
499 if (!(last_status & CTLR_IRQ))
500 srq_asserted = 1;
501 }
502 } 434 }
503 435
504 if (macii_state == reading) { 436 if (macii_state == idle) {
505 BUG_ON(reply_len > 15); 437 /* reset to shift in */
506 reply_ptr++; 438 via[ACR] &= ~SR_OUT;
507 *reply_ptr = x; 439 x = via[SR];
508 reply_len++; 440 /* set ADB state idle - might get SRQ */
441 via[B] = (via[B] & ~ST_MASK) | ST_IDLE;
509 } 442 }
443 } else {
444 via[SR] = req->data[data_index++];
510 445
511 /* invert state bits, toggle ODD/EVEN */ 446 if ((via[B] & ST_MASK) == ST_CMD) {
512 via[B] ^= ST_MASK; 447 /* just sent the command byte, set to EVEN */
513 break; 448 via[B] = (via[B] & ~ST_MASK) | ST_EVEN;
449 } else {
450 /* invert state bits, toggle ODD/EVEN */
451 via[B] ^= ST_MASK;
452 }
453 }
454 break;
514 455
515 case read_done: 456 case reading:
516 x = via[SR]; 457 x = via[SR];
458 WARN_ON((status & ST_MASK) == ST_CMD ||
459 (status & ST_MASK) == ST_IDLE);
460
461 /* Bus timeout with SRQ sequence:
462 * data is "XX FF" while CTLR_IRQ is "L L"
463 * End of packet without SRQ sequence:
464 * data is "XX...YY 00" while CTLR_IRQ is "L...H L"
465 * End of packet SRQ sequence:
466 * data is "XX...YY 00" while CTLR_IRQ is "L...L L"
467 * (where XX is the first response byte and
468 * YY is the last byte of valid response data.)
469 */
517 470
518 if (reading_reply) { 471 srq_asserted = 0;
519 reading_reply = 0; 472 if (!(status & CTLR_IRQ)) {
520 req = current_req; 473 if (x == 0xFF) {
521 req->reply_len = reply_len; 474 if (!(last_status & CTLR_IRQ)) {
522 req->complete = 1; 475 macii_state = read_done;
523 current_req = req->next; 476 reply_len = 0;
524 if (req->done) (*req->done)(req); 477 srq_asserted = 1;
525 } else if (reply_len && autopoll_devs) 478 }
526 adb_input(reply_buf, reply_len, 0); 479 } else if (x == 0x00) {
480 macii_state = read_done;
481 if (!(last_status & CTLR_IRQ))
482 srq_asserted = 1;
483 }
484 }
527 485
528 macii_state = idle; 486 if (macii_state == reading &&
487 reply_len < ARRAY_SIZE(reply_buf)) {
488 reply_ptr++;
489 *reply_ptr = x;
490 reply_len++;
491 }
529 492
530 /* SRQ seen before, initiate poll now */ 493 /* invert state bits, toggle ODD/EVEN */
531 if (srq_asserted) 494 via[B] ^= ST_MASK;
532 macii_queue_poll(); 495 break;
533 496
534 if (current_req) 497 case read_done:
535 macii_start(); 498 x = via[SR];
536 else
537 if (need_autopoll())
538 macii_autopoll(autopoll_devs);
539 499
540 if (macii_state == idle) 500 if (reading_reply) {
541 via[B] = (via[B] & ~ST_MASK) | ST_IDLE; 501 reading_reply = 0;
542 break; 502 req = current_req;
503 req->reply_len = reply_len;
504 req->complete = 1;
505 current_req = req->next;
506 if (req->done)
507 (*req->done)(req);
508 } else if (reply_len && autopoll_devs)
509 adb_input(reply_buf, reply_len, 0);
510
511 macii_state = idle;
512
513 /* SRQ seen before, initiate poll now */
514 if (srq_asserted)
515 macii_queue_poll();
516
517 if (current_req)
518 macii_start();
519 else if (need_autopoll())
520 macii_autopoll(autopoll_devs);
521
522 if (macii_state == idle)
523 via[B] = (via[B] & ~ST_MASK) | ST_IDLE;
524 break;
543 525
544 default: 526 default:
545 break; 527 break;
546 } 528 }
547 529
548 entered--; 530 local_irq_restore(flags);
549 return IRQ_HANDLED; 531 return IRQ_HANDLED;
550} 532}
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index d72c450aebe5..60f57e2abf21 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -1737,6 +1737,39 @@ pmu_enable_irled(int on)
1737 pmu_wait_complete(&req); 1737 pmu_wait_complete(&req);
1738} 1738}
1739 1739
1740/* Offset between Unix time (1970-based) and Mac time (1904-based) */
1741#define RTC_OFFSET 2082844800
1742
1743time64_t pmu_get_time(void)
1744{
1745 struct adb_request req;
1746 u32 now;
1747
1748 if (pmu_request(&req, NULL, 1, PMU_READ_RTC) < 0)
1749 return 0;
1750 pmu_wait_complete(&req);
1751 if (req.reply_len != 4)
1752 pr_err("%s: got %d byte reply\n", __func__, req.reply_len);
1753 now = (req.reply[0] << 24) + (req.reply[1] << 16) +
1754 (req.reply[2] << 8) + req.reply[3];
1755 return (time64_t)now - RTC_OFFSET;
1756}
1757
1758int pmu_set_rtc_time(struct rtc_time *tm)
1759{
1760 u32 now;
1761 struct adb_request req;
1762
1763 now = lower_32_bits(rtc_tm_to_time64(tm) + RTC_OFFSET);
1764 if (pmu_request(&req, NULL, 5, PMU_SET_RTC,
1765 now >> 24, now >> 16, now >> 8, now) < 0)
1766 return -ENXIO;
1767 pmu_wait_complete(&req);
1768 if (req.reply_len != 0)
1769 pr_err("%s: got %d byte reply\n", __func__, req.reply_len);
1770 return 0;
1771}
1772
1740void 1773void
1741pmu_restart(void) 1774pmu_restart(void)
1742{ 1775{
diff --git a/drivers/macintosh/windfarm_smu_controls.c b/drivers/macintosh/windfarm_smu_controls.c
index d174c7437337..86d65462a61c 100644
--- a/drivers/macintosh/windfarm_smu_controls.c
+++ b/drivers/macintosh/windfarm_smu_controls.c
@@ -277,7 +277,7 @@ static int __init smu_controls_init(void)
277 fct = smu_fan_create(fan, 0); 277 fct = smu_fan_create(fan, 0);
278 if (fct == NULL) { 278 if (fct == NULL) {
279 printk(KERN_WARNING "windfarm: Failed to create SMU " 279 printk(KERN_WARNING "windfarm: Failed to create SMU "
280 "RPM fan %s\n", fan->name); 280 "RPM fan %pOFn\n", fan);
281 continue; 281 continue;
282 } 282 }
283 list_add(&fct->link, &smu_fans); 283 list_add(&fct->link, &smu_fans);
@@ -296,7 +296,7 @@ static int __init smu_controls_init(void)
296 fct = smu_fan_create(fan, 1); 296 fct = smu_fan_create(fan, 1);
297 if (fct == NULL) { 297 if (fct == NULL) {
298 printk(KERN_WARNING "windfarm: Failed to create SMU " 298 printk(KERN_WARNING "windfarm: Failed to create SMU "
299 "PWM fan %s\n", fan->name); 299 "PWM fan %pOFn\n", fan);
300 continue; 300 continue;
301 } 301 }
302 list_add(&fct->link, &smu_fans); 302 list_add(&fct->link, &smu_fans);
diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfarm_smu_sat.c
index da7f4fc1a51d..a0f61eb853c5 100644
--- a/drivers/macintosh/windfarm_smu_sat.c
+++ b/drivers/macintosh/windfarm_smu_sat.c
@@ -22,14 +22,6 @@
22 22
23#define VERSION "1.0" 23#define VERSION "1.0"
24 24
25#define DEBUG
26
27#ifdef DEBUG
28#define DBG(args...) printk(args)
29#else
30#define DBG(args...) do { } while(0)
31#endif
32
33/* If the cache is older than 800ms we'll refetch it */ 25/* If the cache is older than 800ms we'll refetch it */
34#define MAX_AGE msecs_to_jiffies(800) 26#define MAX_AGE msecs_to_jiffies(800)
35 27
@@ -106,13 +98,10 @@ struct smu_sdbp_header *smu_sat_get_sdb_partition(unsigned int sat_id, int id,
106 buf[i+2] = data[3]; 98 buf[i+2] = data[3];
107 buf[i+3] = data[2]; 99 buf[i+3] = data[2];
108 } 100 }
109#ifdef DEBUG
110 DBG(KERN_DEBUG "sat %d partition %x:", sat_id, id);
111 for (i = 0; i < len; ++i)
112 DBG(" %x", buf[i]);
113 DBG("\n");
114#endif
115 101
102 printk(KERN_DEBUG "sat %d partition %x:", sat_id, id);
103 print_hex_dump(KERN_DEBUG, " ", DUMP_PREFIX_OFFSET,
104 16, 1, buf, len, false);
116 if (size) 105 if (size)
117 *size = len; 106 *size = len;
118 return (struct smu_sdbp_header *) buf; 107 return (struct smu_sdbp_header *) buf;
@@ -132,13 +121,13 @@ static int wf_sat_read_cache(struct wf_sat *sat)
132 if (err < 0) 121 if (err < 0)
133 return err; 122 return err;
134 sat->last_read = jiffies; 123 sat->last_read = jiffies;
124
135#ifdef LOTSA_DEBUG 125#ifdef LOTSA_DEBUG
136 { 126 {
137 int i; 127 int i;
138 DBG(KERN_DEBUG "wf_sat_get: data is"); 128 printk(KERN_DEBUG "wf_sat_get: data is");
139 for (i = 0; i < 16; ++i) 129 print_hex_dump(KERN_DEBUG, " ", DUMP_PREFIX_OFFSET,
140 DBG(" %.2x", sat->cache[i]); 130 16, 1, sat->cache, 16, false);
141 DBG("\n");
142 } 131 }
143#endif 132#endif
144 return 0; 133 return 0;
diff --git a/drivers/misc/ocxl/config.c b/drivers/misc/ocxl/config.c
index 2e30de9c694a..57a6bb1fd3c9 100644
--- a/drivers/misc/ocxl/config.c
+++ b/drivers/misc/ocxl/config.c
@@ -280,7 +280,9 @@ int ocxl_config_check_afu_index(struct pci_dev *dev,
280 u32 val; 280 u32 val;
281 int rc, templ_major, templ_minor, len; 281 int rc, templ_major, templ_minor, len;
282 282
283 pci_write_config_word(dev, fn->dvsec_afu_info_pos, afu_idx); 283 pci_write_config_byte(dev,
284 fn->dvsec_afu_info_pos + OCXL_DVSEC_AFU_INFO_AFU_IDX,
285 afu_idx);
284 rc = read_afu_info(dev, fn, OCXL_DVSEC_TEMPL_VERSION, &val); 286 rc = read_afu_info(dev, fn, OCXL_DVSEC_TEMPL_VERSION, &val);
285 if (rc) 287 if (rc)
286 return rc; 288 return rc;
diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
index ee54f5bacad1..6758fd7c382e 100644
--- a/drivers/pci/hotplug/pnv_php.c
+++ b/drivers/pci/hotplug/pnv_php.c
@@ -746,7 +746,7 @@ static irqreturn_t pnv_php_interrupt(int irq, void *data)
746 pe = edev ? edev->pe : NULL; 746 pe = edev ? edev->pe : NULL;
747 if (pe) { 747 if (pe) {
748 eeh_serialize_lock(&flags); 748 eeh_serialize_lock(&flags);
749 eeh_pe_state_mark(pe, EEH_PE_ISOLATED); 749 eeh_pe_mark_isolated(pe);
750 eeh_serialize_unlock(flags); 750 eeh_serialize_unlock(flags);
751 eeh_pe_set_option(pe, EEH_OPT_FREEZE_PE); 751 eeh_pe_set_option(pe, EEH_OPT_FREEZE_PE);
752 } 752 }
diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c
index 9671ded549f0..b31abe35ed2c 100644
--- a/drivers/pcmcia/electra_cf.c
+++ b/drivers/pcmcia/electra_cf.c
@@ -230,7 +230,7 @@ static int electra_cf_probe(struct platform_device *ofdev)
230 230
231 if (!cf->mem_base || !cf->io_virt || !cf->gpio_base || 231 if (!cf->mem_base || !cf->io_virt || !cf->gpio_base ||
232 (__ioremap_at(io.start, cf->io_virt, cf->io_size, 232 (__ioremap_at(io.start, cf->io_virt, cf->io_size,
233 pgprot_val(pgprot_noncached(__pgprot(0)))) == NULL)) { 233 pgprot_noncached(PAGE_KERNEL)) == NULL)) {
234 dev_err(device, "can't ioremap ranges\n"); 234 dev_err(device, "can't ioremap ranges\n");
235 status = -ENOMEM; 235 status = -ENOMEM;
236 goto fail1; 236 goto fail1;
diff --git a/drivers/soc/fsl/qbman/qman_ccsr.c b/drivers/soc/fsl/qbman/qman_ccsr.c
index 6fd5fef5f39b..109b38de3176 100644
--- a/drivers/soc/fsl/qbman/qman_ccsr.c
+++ b/drivers/soc/fsl/qbman/qman_ccsr.c
@@ -419,7 +419,7 @@ static size_t fqd_sz, pfdr_sz;
419static int zero_priv_mem(phys_addr_t addr, size_t sz) 419static int zero_priv_mem(phys_addr_t addr, size_t sz)
420{ 420{
421 /* map as cacheable, non-guarded */ 421 /* map as cacheable, non-guarded */
422 void __iomem *tmpp = ioremap_prot(addr, sz, 0); 422 void __iomem *tmpp = ioremap_cache(addr, sz);
423 423
424 if (!tmpp) 424 if (!tmpp)
425 return -ENOMEM; 425 return -ENOMEM;
diff --git a/drivers/video/fbdev/chipsfb.c b/drivers/video/fbdev/chipsfb.c
index f103665cad43..40182ed85648 100644
--- a/drivers/video/fbdev/chipsfb.c
+++ b/drivers/video/fbdev/chipsfb.c
@@ -27,7 +27,6 @@
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/pci.h> 28#include <linux/pci.h>
29#include <linux/console.h> 29#include <linux/console.h>
30#include <asm/io.h>
31 30
32#ifdef CONFIG_PMAC_BACKLIGHT 31#ifdef CONFIG_PMAC_BACKLIGHT
33#include <asm/backlight.h> 32#include <asm/backlight.h>
@@ -401,7 +400,7 @@ static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
401#endif /* CONFIG_PMAC_BACKLIGHT */ 400#endif /* CONFIG_PMAC_BACKLIGHT */
402 401
403#ifdef CONFIG_PPC 402#ifdef CONFIG_PPC
404 p->screen_base = __ioremap(addr, 0x200000, _PAGE_NO_CACHE); 403 p->screen_base = ioremap_wc(addr, 0x200000);
405#else 404#else
406 p->screen_base = ioremap(addr, 0x200000); 405 p->screen_base = ioremap(addr, 0x200000);
407#endif 406#endif
diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c
index 8d14b29aafea..9cb0ef7ac29e 100644
--- a/drivers/video/fbdev/controlfb.c
+++ b/drivers/video/fbdev/controlfb.c
@@ -48,9 +48,7 @@
48#include <linux/nvram.h> 48#include <linux/nvram.h>
49#include <linux/adb.h> 49#include <linux/adb.h>
50#include <linux/cuda.h> 50#include <linux/cuda.h>
51#include <asm/io.h>
52#include <asm/prom.h> 51#include <asm/prom.h>
53#include <asm/pgtable.h>
54#include <asm/btext.h> 52#include <asm/btext.h>
55 53
56#include "macmodes.h" 54#include "macmodes.h"
@@ -715,8 +713,7 @@ static int __init control_of_init(struct device_node *dp)
715 goto error_out; 713 goto error_out;
716 } 714 }
717 /* map at most 8MB for the frame buffer */ 715 /* map at most 8MB for the frame buffer */
718 p->frame_buffer = __ioremap(p->frame_buffer_phys, 0x800000, 716 p->frame_buffer = ioremap_wt(p->frame_buffer_phys, 0x800000);
719 _PAGE_WRITETHRU);
720 717
721 if (!p->control_regs_phys || 718 if (!p->control_regs_phys ||
722 !request_mem_region(p->control_regs_phys, p->control_regs_size, 719 !request_mem_region(p->control_regs_phys, p->control_regs_size,
diff --git a/drivers/video/fbdev/platinumfb.c b/drivers/video/fbdev/platinumfb.c
index 377d3399a3ad..bf6b7fb83cf4 100644
--- a/drivers/video/fbdev/platinumfb.c
+++ b/drivers/video/fbdev/platinumfb.c
@@ -32,9 +32,7 @@
32#include <linux/nvram.h> 32#include <linux/nvram.h>
33#include <linux/of_device.h> 33#include <linux/of_device.h>
34#include <linux/of_platform.h> 34#include <linux/of_platform.h>
35#include <asm/io.h>
36#include <asm/prom.h> 35#include <asm/prom.h>
37#include <asm/pgtable.h>
38 36
39#include "macmodes.h" 37#include "macmodes.h"
40#include "platinumfb.h" 38#include "platinumfb.h"
@@ -577,8 +575,7 @@ static int platinumfb_probe(struct platform_device* odev)
577 575
578 /* frame buffer - map only 4MB */ 576 /* frame buffer - map only 4MB */
579 pinfo->frame_buffer_phys = pinfo->rsrc_fb.start; 577 pinfo->frame_buffer_phys = pinfo->rsrc_fb.start;
580 pinfo->frame_buffer = __ioremap(pinfo->rsrc_fb.start, 0x400000, 578 pinfo->frame_buffer = ioremap_wt(pinfo->rsrc_fb.start, 0x400000);
581 _PAGE_WRITETHRU);
582 pinfo->base_frame_buffer = pinfo->frame_buffer; 579 pinfo->base_frame_buffer = pinfo->frame_buffer;
583 580
584 /* registers */ 581 /* registers */
diff --git a/drivers/video/fbdev/valkyriefb.c b/drivers/video/fbdev/valkyriefb.c
index 275fb98236d3..d51c3a8009cb 100644
--- a/drivers/video/fbdev/valkyriefb.c
+++ b/drivers/video/fbdev/valkyriefb.c
@@ -54,13 +54,11 @@
54#include <linux/nvram.h> 54#include <linux/nvram.h>
55#include <linux/adb.h> 55#include <linux/adb.h>
56#include <linux/cuda.h> 56#include <linux/cuda.h>
57#include <asm/io.h>
58#ifdef CONFIG_MAC 57#ifdef CONFIG_MAC
59#include <asm/macintosh.h> 58#include <asm/macintosh.h>
60#else 59#else
61#include <asm/prom.h> 60#include <asm/prom.h>
62#endif 61#endif
63#include <asm/pgtable.h>
64 62
65#include "macmodes.h" 63#include "macmodes.h"
66#include "valkyriefb.h" 64#include "valkyriefb.h"
@@ -318,7 +316,7 @@ static void __init valkyrie_choose_mode(struct fb_info_valkyrie *p)
318int __init valkyriefb_init(void) 316int __init valkyriefb_init(void)
319{ 317{
320 struct fb_info_valkyrie *p; 318 struct fb_info_valkyrie *p;
321 unsigned long frame_buffer_phys, cmap_regs_phys, flags; 319 unsigned long frame_buffer_phys, cmap_regs_phys;
322 int err; 320 int err;
323 char *option = NULL; 321 char *option = NULL;
324 322
@@ -337,7 +335,6 @@ int __init valkyriefb_init(void)
337 /* Hardcoded addresses... welcome to 68k Macintosh country :-) */ 335 /* Hardcoded addresses... welcome to 68k Macintosh country :-) */
338 frame_buffer_phys = 0xf9000000; 336 frame_buffer_phys = 0xf9000000;
339 cmap_regs_phys = 0x50f24000; 337 cmap_regs_phys = 0x50f24000;
340 flags = IOMAP_NOCACHE_SER; /* IOMAP_WRITETHROUGH?? */
341#else /* ppc (!CONFIG_MAC) */ 338#else /* ppc (!CONFIG_MAC) */
342 { 339 {
343 struct device_node *dp; 340 struct device_node *dp;
@@ -354,7 +351,6 @@ int __init valkyriefb_init(void)
354 351
355 frame_buffer_phys = r.start; 352 frame_buffer_phys = r.start;
356 cmap_regs_phys = r.start + 0x304000; 353 cmap_regs_phys = r.start + 0x304000;
357 flags = _PAGE_WRITETHRU;
358 } 354 }
359#endif /* ppc (!CONFIG_MAC) */ 355#endif /* ppc (!CONFIG_MAC) */
360 356
@@ -369,7 +365,11 @@ int __init valkyriefb_init(void)
369 } 365 }
370 p->total_vram = 0x100000; 366 p->total_vram = 0x100000;
371 p->frame_buffer_phys = frame_buffer_phys; 367 p->frame_buffer_phys = frame_buffer_phys;
372 p->frame_buffer = __ioremap(frame_buffer_phys, p->total_vram, flags); 368#ifdef CONFIG_MAC
369 p->frame_buffer = ioremap_nocache(frame_buffer_phys, p->total_vram);
370#else
371 p->frame_buffer = ioremap_wt(frame_buffer_phys, p->total_vram);
372#endif
373 p->cmap_regs_phys = cmap_regs_phys; 373 p->cmap_regs_phys = cmap_regs_phys;
374 p->cmap_regs = ioremap(p->cmap_regs_phys, 0x1000); 374 p->cmap_regs = ioremap(p->cmap_regs_phys, 0x1000);
375 p->valkyrie_regs_phys = cmap_regs_phys+0x6000; 375 p->valkyrie_regs_phys = cmap_regs_phys+0x6000;