.. | .. |
---|
36 | 36 | |
---|
37 | 37 | static void (*rom_reset)(void); |
---|
38 | 38 | |
---|
| 39 | +#if IS_ENABLED(CONFIG_NVRAM) |
---|
39 | 40 | #ifdef CONFIG_ADB_CUDA |
---|
40 | | -static time64_t cuda_read_time(void) |
---|
41 | | -{ |
---|
42 | | - struct adb_request req; |
---|
43 | | - time64_t time; |
---|
44 | | - |
---|
45 | | - if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_GET_TIME) < 0) |
---|
46 | | - return 0; |
---|
47 | | - while (!req.complete) |
---|
48 | | - cuda_poll(); |
---|
49 | | - |
---|
50 | | - time = (u32)((req.reply[3] << 24) | (req.reply[4] << 16) | |
---|
51 | | - (req.reply[5] << 8) | req.reply[6]); |
---|
52 | | - |
---|
53 | | - return time - RTC_OFFSET; |
---|
54 | | -} |
---|
55 | | - |
---|
56 | | -static void cuda_write_time(time64_t time) |
---|
57 | | -{ |
---|
58 | | - struct adb_request req; |
---|
59 | | - u32 data = lower_32_bits(time + RTC_OFFSET); |
---|
60 | | - |
---|
61 | | - if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME, |
---|
62 | | - (data >> 24) & 0xFF, (data >> 16) & 0xFF, |
---|
63 | | - (data >> 8) & 0xFF, data & 0xFF) < 0) |
---|
64 | | - return; |
---|
65 | | - while (!req.complete) |
---|
66 | | - cuda_poll(); |
---|
67 | | -} |
---|
68 | | - |
---|
69 | | -static __u8 cuda_read_pram(int offset) |
---|
| 41 | +static unsigned char cuda_pram_read_byte(int offset) |
---|
70 | 42 | { |
---|
71 | 43 | struct adb_request req; |
---|
72 | 44 | |
---|
.. | .. |
---|
78 | 50 | return req.reply[3]; |
---|
79 | 51 | } |
---|
80 | 52 | |
---|
81 | | -static void cuda_write_pram(int offset, __u8 data) |
---|
| 53 | +static void cuda_pram_write_byte(unsigned char data, int offset) |
---|
82 | 54 | { |
---|
83 | 55 | struct adb_request req; |
---|
84 | 56 | |
---|
.. | .. |
---|
91 | 63 | #endif /* CONFIG_ADB_CUDA */ |
---|
92 | 64 | |
---|
93 | 65 | #ifdef CONFIG_ADB_PMU |
---|
94 | | -static time64_t pmu_read_time(void) |
---|
| 66 | +static unsigned char pmu_pram_read_byte(int offset) |
---|
95 | 67 | { |
---|
96 | 68 | struct adb_request req; |
---|
97 | | - time64_t time; |
---|
98 | 69 | |
---|
99 | | - if (pmu_request(&req, NULL, 1, PMU_READ_RTC) < 0) |
---|
| 70 | + if (pmu_request(&req, NULL, 3, PMU_READ_XPRAM, |
---|
| 71 | + offset & 0xFF, 1) < 0) |
---|
100 | 72 | return 0; |
---|
101 | 73 | pmu_wait_complete(&req); |
---|
102 | 74 | |
---|
103 | | - time = (u32)((req.reply[0] << 24) | (req.reply[1] << 16) | |
---|
104 | | - (req.reply[2] << 8) | req.reply[3]); |
---|
105 | | - |
---|
106 | | - return time - RTC_OFFSET; |
---|
| 75 | + return req.reply[0]; |
---|
107 | 76 | } |
---|
108 | 77 | |
---|
109 | | -static void pmu_write_time(time64_t time) |
---|
| 78 | +static void pmu_pram_write_byte(unsigned char data, int offset) |
---|
110 | 79 | { |
---|
111 | 80 | struct adb_request req; |
---|
112 | | - u32 data = lower_32_bits(time + RTC_OFFSET); |
---|
113 | 81 | |
---|
114 | | - if (pmu_request(&req, NULL, 5, PMU_SET_RTC, |
---|
115 | | - (data >> 24) & 0xFF, (data >> 16) & 0xFF, |
---|
116 | | - (data >> 8) & 0xFF, data & 0xFF) < 0) |
---|
| 82 | + if (pmu_request(&req, NULL, 4, PMU_WRITE_XPRAM, |
---|
| 83 | + offset & 0xFF, 1, data) < 0) |
---|
117 | 84 | return; |
---|
118 | 85 | pmu_wait_complete(&req); |
---|
119 | | -} |
---|
120 | | - |
---|
121 | | -static __u8 pmu_read_pram(int offset) |
---|
122 | | -{ |
---|
123 | | - struct adb_request req; |
---|
124 | | - |
---|
125 | | - if (pmu_request(&req, NULL, 3, PMU_READ_NVRAM, |
---|
126 | | - (offset >> 8) & 0xFF, offset & 0xFF) < 0) |
---|
127 | | - return 0; |
---|
128 | | - while (!req.complete) |
---|
129 | | - pmu_poll(); |
---|
130 | | - return req.reply[3]; |
---|
131 | | -} |
---|
132 | | - |
---|
133 | | -static void pmu_write_pram(int offset, __u8 data) |
---|
134 | | -{ |
---|
135 | | - struct adb_request req; |
---|
136 | | - |
---|
137 | | - if (pmu_request(&req, NULL, 4, PMU_WRITE_NVRAM, |
---|
138 | | - (offset >> 8) & 0xFF, offset & 0xFF, data) < 0) |
---|
139 | | - return; |
---|
140 | | - while (!req.complete) |
---|
141 | | - pmu_poll(); |
---|
142 | 86 | } |
---|
143 | 87 | #endif /* CONFIG_ADB_PMU */ |
---|
| 88 | +#endif /* CONFIG_NVRAM */ |
---|
144 | 89 | |
---|
145 | 90 | /* |
---|
146 | 91 | * VIA PRAM/RTC access routines |
---|
.. | .. |
---|
149 | 94 | * the RTC should be enabled. |
---|
150 | 95 | */ |
---|
151 | 96 | |
---|
152 | | -static __u8 via_pram_readbyte(void) |
---|
| 97 | +static __u8 via_rtc_recv(void) |
---|
153 | 98 | { |
---|
154 | 99 | int i, reg; |
---|
155 | 100 | __u8 data; |
---|
.. | .. |
---|
176 | 121 | return data; |
---|
177 | 122 | } |
---|
178 | 123 | |
---|
179 | | -static void via_pram_writebyte(__u8 data) |
---|
| 124 | +static void via_rtc_send(__u8 data) |
---|
180 | 125 | { |
---|
181 | 126 | int i, reg, bit; |
---|
182 | 127 | |
---|
.. | .. |
---|
193 | 138 | } |
---|
194 | 139 | |
---|
195 | 140 | /* |
---|
| 141 | + * These values can be found in Inside Macintosh vol. III ch. 2 |
---|
| 142 | + * which has a description of the RTC chip in the original Mac. |
---|
| 143 | + */ |
---|
| 144 | + |
---|
| 145 | +#define RTC_FLG_READ BIT(7) |
---|
| 146 | +#define RTC_FLG_WRITE_PROTECT BIT(7) |
---|
| 147 | +#define RTC_CMD_READ(r) (RTC_FLG_READ | (r << 2)) |
---|
| 148 | +#define RTC_CMD_WRITE(r) (r << 2) |
---|
| 149 | +#define RTC_REG_SECONDS_0 0 |
---|
| 150 | +#define RTC_REG_SECONDS_1 1 |
---|
| 151 | +#define RTC_REG_SECONDS_2 2 |
---|
| 152 | +#define RTC_REG_SECONDS_3 3 |
---|
| 153 | +#define RTC_REG_WRITE_PROTECT 13 |
---|
| 154 | + |
---|
| 155 | +/* |
---|
| 156 | + * Inside Mac has no information about two-byte RTC commands but |
---|
| 157 | + * the MAME/MESS source code has the essentials. |
---|
| 158 | + */ |
---|
| 159 | + |
---|
| 160 | +#define RTC_REG_XPRAM 14 |
---|
| 161 | +#define RTC_CMD_XPRAM_READ (RTC_CMD_READ(RTC_REG_XPRAM) << 8) |
---|
| 162 | +#define RTC_CMD_XPRAM_WRITE (RTC_CMD_WRITE(RTC_REG_XPRAM) << 8) |
---|
| 163 | +#define RTC_CMD_XPRAM_ARG(a) (((a & 0xE0) << 3) | ((a & 0x1F) << 2)) |
---|
| 164 | + |
---|
| 165 | +/* |
---|
196 | 166 | * Execute a VIA PRAM/RTC command. For read commands |
---|
197 | 167 | * data should point to a one-byte buffer for the |
---|
198 | 168 | * resulting data. For write commands it should point |
---|
.. | .. |
---|
201 | 171 | * This function disables all interrupts while running. |
---|
202 | 172 | */ |
---|
203 | 173 | |
---|
204 | | -static void via_pram_command(int command, __u8 *data) |
---|
| 174 | +static void via_rtc_command(int command, __u8 *data) |
---|
205 | 175 | { |
---|
206 | 176 | unsigned long flags; |
---|
207 | 177 | int is_read; |
---|
208 | 178 | |
---|
209 | 179 | local_irq_save(flags); |
---|
210 | 180 | |
---|
| 181 | + /* The least significant bits must be 0b01 according to Inside Mac */ |
---|
| 182 | + |
---|
| 183 | + command = (command & ~3) | 1; |
---|
| 184 | + |
---|
211 | 185 | /* Enable the RTC and make sure the strobe line is high */ |
---|
212 | 186 | |
---|
213 | 187 | via1[vBufB] = (via1[vBufB] | VIA1B_vRTCClk) & ~VIA1B_vRTCEnb; |
---|
214 | 188 | |
---|
215 | 189 | if (command & 0xFF00) { /* extended (two-byte) command */ |
---|
216 | | - via_pram_writebyte((command & 0xFF00) >> 8); |
---|
217 | | - via_pram_writebyte(command & 0xFF); |
---|
218 | | - is_read = command & 0x8000; |
---|
| 190 | + via_rtc_send((command & 0xFF00) >> 8); |
---|
| 191 | + via_rtc_send(command & 0xFF); |
---|
| 192 | + is_read = command & (RTC_FLG_READ << 8); |
---|
219 | 193 | } else { /* one-byte command */ |
---|
220 | | - via_pram_writebyte(command); |
---|
221 | | - is_read = command & 0x80; |
---|
| 194 | + via_rtc_send(command); |
---|
| 195 | + is_read = command & RTC_FLG_READ; |
---|
222 | 196 | } |
---|
223 | 197 | if (is_read) { |
---|
224 | | - *data = via_pram_readbyte(); |
---|
| 198 | + *data = via_rtc_recv(); |
---|
225 | 199 | } else { |
---|
226 | | - via_pram_writebyte(*data); |
---|
| 200 | + via_rtc_send(*data); |
---|
227 | 201 | } |
---|
228 | 202 | |
---|
229 | 203 | /* All done, disable the RTC */ |
---|
.. | .. |
---|
233 | 207 | local_irq_restore(flags); |
---|
234 | 208 | } |
---|
235 | 209 | |
---|
236 | | -static __u8 via_read_pram(int offset) |
---|
| 210 | +#if IS_ENABLED(CONFIG_NVRAM) |
---|
| 211 | +static unsigned char via_pram_read_byte(int offset) |
---|
237 | 212 | { |
---|
238 | | - return 0; |
---|
| 213 | + unsigned char temp; |
---|
| 214 | + |
---|
| 215 | + via_rtc_command(RTC_CMD_XPRAM_READ | RTC_CMD_XPRAM_ARG(offset), &temp); |
---|
| 216 | + |
---|
| 217 | + return temp; |
---|
239 | 218 | } |
---|
240 | 219 | |
---|
241 | | -static void via_write_pram(int offset, __u8 data) |
---|
| 220 | +static void via_pram_write_byte(unsigned char data, int offset) |
---|
242 | 221 | { |
---|
| 222 | + unsigned char temp; |
---|
| 223 | + |
---|
| 224 | + temp = 0x55; |
---|
| 225 | + via_rtc_command(RTC_CMD_WRITE(RTC_REG_WRITE_PROTECT), &temp); |
---|
| 226 | + |
---|
| 227 | + temp = data; |
---|
| 228 | + via_rtc_command(RTC_CMD_XPRAM_WRITE | RTC_CMD_XPRAM_ARG(offset), &temp); |
---|
| 229 | + |
---|
| 230 | + temp = 0x55 | RTC_FLG_WRITE_PROTECT; |
---|
| 231 | + via_rtc_command(RTC_CMD_WRITE(RTC_REG_WRITE_PROTECT), &temp); |
---|
243 | 232 | } |
---|
| 233 | +#endif /* CONFIG_NVRAM */ |
---|
244 | 234 | |
---|
245 | 235 | /* |
---|
246 | 236 | * Return the current time in seconds since January 1, 1904. |
---|
.. | .. |
---|
257 | 247 | } result, last_result; |
---|
258 | 248 | int count = 1; |
---|
259 | 249 | |
---|
260 | | - via_pram_command(0x81, &last_result.cdata[3]); |
---|
261 | | - via_pram_command(0x85, &last_result.cdata[2]); |
---|
262 | | - via_pram_command(0x89, &last_result.cdata[1]); |
---|
263 | | - via_pram_command(0x8D, &last_result.cdata[0]); |
---|
| 250 | + via_rtc_command(RTC_CMD_READ(RTC_REG_SECONDS_0), &last_result.cdata[3]); |
---|
| 251 | + via_rtc_command(RTC_CMD_READ(RTC_REG_SECONDS_1), &last_result.cdata[2]); |
---|
| 252 | + via_rtc_command(RTC_CMD_READ(RTC_REG_SECONDS_2), &last_result.cdata[1]); |
---|
| 253 | + via_rtc_command(RTC_CMD_READ(RTC_REG_SECONDS_3), &last_result.cdata[0]); |
---|
264 | 254 | |
---|
265 | 255 | /* |
---|
266 | 256 | * The NetBSD guys say to loop until you get the same reading |
---|
.. | .. |
---|
268 | 258 | */ |
---|
269 | 259 | |
---|
270 | 260 | while (1) { |
---|
271 | | - via_pram_command(0x81, &result.cdata[3]); |
---|
272 | | - via_pram_command(0x85, &result.cdata[2]); |
---|
273 | | - via_pram_command(0x89, &result.cdata[1]); |
---|
274 | | - via_pram_command(0x8D, &result.cdata[0]); |
---|
| 261 | + via_rtc_command(RTC_CMD_READ(RTC_REG_SECONDS_0), |
---|
| 262 | + &result.cdata[3]); |
---|
| 263 | + via_rtc_command(RTC_CMD_READ(RTC_REG_SECONDS_1), |
---|
| 264 | + &result.cdata[2]); |
---|
| 265 | + via_rtc_command(RTC_CMD_READ(RTC_REG_SECONDS_2), |
---|
| 266 | + &result.cdata[1]); |
---|
| 267 | + via_rtc_command(RTC_CMD_READ(RTC_REG_SECONDS_3), |
---|
| 268 | + &result.cdata[0]); |
---|
275 | 269 | |
---|
276 | 270 | if (result.idata == last_result.idata) |
---|
277 | 271 | return (time64_t)result.idata - RTC_OFFSET; |
---|
.. | .. |
---|
295 | 289 | * is basically any machine with Mac II-style ADB. |
---|
296 | 290 | */ |
---|
297 | 291 | |
---|
298 | | -static void via_write_time(time64_t time) |
---|
| 292 | +static void via_set_rtc_time(struct rtc_time *tm) |
---|
299 | 293 | { |
---|
300 | 294 | union { |
---|
301 | 295 | __u8 cdata[4]; |
---|
302 | 296 | __u32 idata; |
---|
303 | 297 | } data; |
---|
304 | 298 | __u8 temp; |
---|
| 299 | + time64_t time; |
---|
| 300 | + |
---|
| 301 | + time = mktime64(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, |
---|
| 302 | + tm->tm_hour, tm->tm_min, tm->tm_sec); |
---|
305 | 303 | |
---|
306 | 304 | /* Clear the write protect bit */ |
---|
307 | 305 | |
---|
308 | 306 | temp = 0x55; |
---|
309 | | - via_pram_command(0x35, &temp); |
---|
| 307 | + via_rtc_command(RTC_CMD_WRITE(RTC_REG_WRITE_PROTECT), &temp); |
---|
310 | 308 | |
---|
311 | 309 | data.idata = lower_32_bits(time + RTC_OFFSET); |
---|
312 | | - via_pram_command(0x01, &data.cdata[3]); |
---|
313 | | - via_pram_command(0x05, &data.cdata[2]); |
---|
314 | | - via_pram_command(0x09, &data.cdata[1]); |
---|
315 | | - via_pram_command(0x0D, &data.cdata[0]); |
---|
| 310 | + via_rtc_command(RTC_CMD_WRITE(RTC_REG_SECONDS_0), &data.cdata[3]); |
---|
| 311 | + via_rtc_command(RTC_CMD_WRITE(RTC_REG_SECONDS_1), &data.cdata[2]); |
---|
| 312 | + via_rtc_command(RTC_CMD_WRITE(RTC_REG_SECONDS_2), &data.cdata[1]); |
---|
| 313 | + via_rtc_command(RTC_CMD_WRITE(RTC_REG_SECONDS_3), &data.cdata[0]); |
---|
316 | 314 | |
---|
317 | 315 | /* Set the write protect bit */ |
---|
318 | 316 | |
---|
319 | | - temp = 0xD5; |
---|
320 | | - via_pram_command(0x35, &temp); |
---|
| 317 | + temp = 0x55 | RTC_FLG_WRITE_PROTECT; |
---|
| 318 | + via_rtc_command(RTC_CMD_WRITE(RTC_REG_WRITE_PROTECT), &temp); |
---|
321 | 319 | } |
---|
322 | 320 | |
---|
323 | 321 | static void via_shutdown(void) |
---|
.. | .. |
---|
378 | 376 | *------------------------------------------------------------------- |
---|
379 | 377 | */ |
---|
380 | 378 | |
---|
381 | | -void mac_pram_read(int offset, __u8 *buffer, int len) |
---|
| 379 | +#if IS_ENABLED(CONFIG_NVRAM) |
---|
| 380 | +unsigned char mac_pram_read_byte(int addr) |
---|
382 | 381 | { |
---|
383 | | - __u8 (*func)(int); |
---|
384 | | - int i; |
---|
385 | | - |
---|
386 | 382 | switch (macintosh_config->adb_type) { |
---|
387 | 383 | case MAC_ADB_IOP: |
---|
388 | 384 | case MAC_ADB_II: |
---|
389 | 385 | case MAC_ADB_PB1: |
---|
390 | | - func = via_read_pram; |
---|
391 | | - break; |
---|
| 386 | + return via_pram_read_byte(addr); |
---|
392 | 387 | #ifdef CONFIG_ADB_CUDA |
---|
393 | 388 | case MAC_ADB_EGRET: |
---|
394 | 389 | case MAC_ADB_CUDA: |
---|
395 | | - func = cuda_read_pram; |
---|
396 | | - break; |
---|
| 390 | + return cuda_pram_read_byte(addr); |
---|
397 | 391 | #endif |
---|
398 | 392 | #ifdef CONFIG_ADB_PMU |
---|
399 | 393 | case MAC_ADB_PB2: |
---|
400 | | - func = pmu_read_pram; |
---|
401 | | - break; |
---|
| 394 | + return pmu_pram_read_byte(addr); |
---|
402 | 395 | #endif |
---|
403 | 396 | default: |
---|
404 | | - return; |
---|
405 | | - } |
---|
406 | | - for (i = 0 ; i < len ; i++) { |
---|
407 | | - buffer[i] = (*func)(offset++); |
---|
| 397 | + return 0xFF; |
---|
408 | 398 | } |
---|
409 | 399 | } |
---|
410 | 400 | |
---|
411 | | -void mac_pram_write(int offset, __u8 *buffer, int len) |
---|
| 401 | +void mac_pram_write_byte(unsigned char val, int addr) |
---|
412 | 402 | { |
---|
413 | | - void (*func)(int, __u8); |
---|
414 | | - int i; |
---|
415 | | - |
---|
416 | 403 | switch (macintosh_config->adb_type) { |
---|
417 | 404 | case MAC_ADB_IOP: |
---|
418 | 405 | case MAC_ADB_II: |
---|
419 | 406 | case MAC_ADB_PB1: |
---|
420 | | - func = via_write_pram; |
---|
| 407 | + via_pram_write_byte(val, addr); |
---|
421 | 408 | break; |
---|
422 | 409 | #ifdef CONFIG_ADB_CUDA |
---|
423 | 410 | case MAC_ADB_EGRET: |
---|
424 | 411 | case MAC_ADB_CUDA: |
---|
425 | | - func = cuda_write_pram; |
---|
| 412 | + cuda_pram_write_byte(val, addr); |
---|
426 | 413 | break; |
---|
427 | 414 | #endif |
---|
428 | 415 | #ifdef CONFIG_ADB_PMU |
---|
429 | 416 | case MAC_ADB_PB2: |
---|
430 | | - func = pmu_write_pram; |
---|
| 417 | + pmu_pram_write_byte(val, addr); |
---|
431 | 418 | break; |
---|
432 | 419 | #endif |
---|
433 | 420 | default: |
---|
434 | | - return; |
---|
435 | | - } |
---|
436 | | - for (i = 0 ; i < len ; i++) { |
---|
437 | | - (*func)(offset++, buffer[i]); |
---|
| 421 | + break; |
---|
438 | 422 | } |
---|
439 | 423 | } |
---|
| 424 | + |
---|
| 425 | +ssize_t mac_pram_get_size(void) |
---|
| 426 | +{ |
---|
| 427 | + return 256; |
---|
| 428 | +} |
---|
| 429 | +#endif /* CONFIG_NVRAM */ |
---|
440 | 430 | |
---|
441 | 431 | void mac_poweroff(void) |
---|
442 | 432 | { |
---|
.. | .. |
---|
462 | 452 | |
---|
463 | 453 | void mac_reset(void) |
---|
464 | 454 | { |
---|
465 | | - if (macintosh_config->adb_type == MAC_ADB_II) { |
---|
466 | | - unsigned long flags; |
---|
467 | | - |
---|
| 455 | + if (macintosh_config->adb_type == MAC_ADB_II && |
---|
| 456 | + macintosh_config->ident != MAC_MODEL_SE30) { |
---|
468 | 457 | /* need ROMBASE in booter */ |
---|
469 | 458 | /* indeed, plus need to MAP THE ROM !! */ |
---|
470 | 459 | |
---|
.. | .. |
---|
474 | 463 | /* works on some */ |
---|
475 | 464 | rom_reset = (void *) (mac_bi_data.rombase + 0xa); |
---|
476 | 465 | |
---|
477 | | - if (macintosh_config->ident == MAC_MODEL_SE30) { |
---|
478 | | - /* |
---|
479 | | - * MSch: Machines known to crash on ROM reset ... |
---|
480 | | - */ |
---|
481 | | - } else { |
---|
482 | | - local_irq_save(flags); |
---|
483 | | - |
---|
484 | | - rom_reset(); |
---|
485 | | - |
---|
486 | | - local_irq_restore(flags); |
---|
487 | | - } |
---|
| 466 | + local_irq_disable(); |
---|
| 467 | + rom_reset(); |
---|
488 | 468 | #ifdef CONFIG_ADB_CUDA |
---|
489 | 469 | } else if (macintosh_config->adb_type == MAC_ADB_EGRET || |
---|
490 | 470 | macintosh_config->adb_type == MAC_ADB_CUDA) { |
---|
.. | .. |
---|
641 | 621 | #ifdef CONFIG_ADB_CUDA |
---|
642 | 622 | case MAC_ADB_EGRET: |
---|
643 | 623 | case MAC_ADB_CUDA: |
---|
644 | | - now = cuda_read_time(); |
---|
| 624 | + now = cuda_get_time(); |
---|
645 | 625 | break; |
---|
646 | 626 | #endif |
---|
647 | 627 | #ifdef CONFIG_ADB_PMU |
---|
648 | 628 | case MAC_ADB_PB2: |
---|
649 | | - now = pmu_read_time(); |
---|
| 629 | + now = pmu_get_time(); |
---|
650 | 630 | break; |
---|
651 | 631 | #endif |
---|
652 | 632 | default: |
---|
.. | .. |
---|
657 | 637 | unmktime(now, 0, |
---|
658 | 638 | &t->tm_year, &t->tm_mon, &t->tm_mday, |
---|
659 | 639 | &t->tm_hour, &t->tm_min, &t->tm_sec); |
---|
660 | | - pr_debug("%s: read %04d-%02d-%-2d %02d:%02d:%02d\n", |
---|
661 | | - __func__, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, |
---|
662 | | - t->tm_hour, t->tm_min, t->tm_sec); |
---|
| 640 | + pr_debug("%s: read %ptR\n", __func__, t); |
---|
663 | 641 | } else { /* write */ |
---|
664 | | - pr_debug("%s: tried to write %04d-%02d-%-2d %02d:%02d:%02d\n", |
---|
665 | | - __func__, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, |
---|
666 | | - t->tm_hour, t->tm_min, t->tm_sec); |
---|
667 | | - |
---|
668 | | - now = mktime64(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, |
---|
669 | | - t->tm_hour, t->tm_min, t->tm_sec); |
---|
| 642 | + pr_debug("%s: tried to write %ptR\n", __func__, t); |
---|
670 | 643 | |
---|
671 | 644 | switch (macintosh_config->adb_type) { |
---|
672 | 645 | case MAC_ADB_IOP: |
---|
673 | 646 | case MAC_ADB_II: |
---|
674 | 647 | case MAC_ADB_PB1: |
---|
675 | | - via_write_time(now); |
---|
| 648 | + via_set_rtc_time(t); |
---|
676 | 649 | break; |
---|
677 | 650 | #ifdef CONFIG_ADB_CUDA |
---|
678 | 651 | case MAC_ADB_EGRET: |
---|
679 | 652 | case MAC_ADB_CUDA: |
---|
680 | | - cuda_write_time(now); |
---|
| 653 | + cuda_set_rtc_time(t); |
---|
681 | 654 | break; |
---|
682 | 655 | #endif |
---|
683 | 656 | #ifdef CONFIG_ADB_PMU |
---|
684 | 657 | case MAC_ADB_PB2: |
---|
685 | | - pmu_write_time(now); |
---|
| 658 | + pmu_set_rtc_time(t); |
---|
686 | 659 | break; |
---|
687 | 660 | #endif |
---|
688 | 661 | default: |
---|