Lines Matching +full:low +full:- +full:side

1 // SPDX-License-Identifier: GPL-2.0
38 /* VIA registers - spaced 0x200 bytes apart */
40 #define B 0 /* B-side data */
41 #define A RS /* A-side data */
42 #define DIRB (2*RS) /* B-side direction (1=output) */
43 #define DIRA (3*RS) /* A-side direction (1=output) */
44 #define T1CL (4*RS) /* Timer 1 ctr/latch (low 8 bits) */
46 #define T1LL (6*RS) /* Timer 1 latch (low 8 bits) */
48 #define T2CL (8*RS) /* Timer 2 ctr/latch (low 8 bits) */
55 #define ANH (15*RS) /* A-side data, no handshake */
62 * ----------------+------------------------------------------
63 * PB3 (input) | Transceiver session (active low)
68 * ----------------+------------------------------------------
69 * PB3 (input) | Transfer request (active low)
70 * PB4 (output) | Byte acknowledge (active low)
71 * PB5 (output) | Transfer in progress (active low)
212 if (macintosh_config->adb_type != MAC_ADB_CUDA && in find_via_cuda()
213 macintosh_config->adb_type != MAC_ADB_EGRET) in find_via_cuda()
218 mcu_is_egret = macintosh_config->adb_type == MAC_ADB_EGRET; in find_via_cuda()
243 vias = of_find_node_by_name(NULL, "via-cuda"); in find_via_cuda()
249 printk(KERN_ERR "via-cuda: Error getting \"reg\" property !\n"); in find_via_cuda()
254 printk(KERN_ERR "via-cuda: Can't map address !\n"); in find_via_cuda()
291 return -ENODEV; in via_cuda_start()
298 printk(KERN_ERR "via-cuda: can't map interrupts for %pOF\n", in via_cuda_start()
300 return -ENODEV; in via_cuda_start()
305 printk(KERN_ERR "via-cuda: can't request irq %d\n", cuda_irq); in via_cuda_start()
306 return -EAGAIN; in via_cuda_start()
323 return -ENODEV; in cuda_probe()
325 if (macintosh_config->adb_type != MAC_ADB_CUDA && in cuda_probe()
326 macintosh_config->adb_type != MAC_ADB_EGRET) in cuda_probe()
327 return -ENODEV; in cuda_probe()
330 return -ENODEV; in cuda_probe()
365 for (x = 1000; !(cond); --x) { \
368 return -ENXIO; \
386 (void)in_8(&via[SR]); /* clear any left-over data */ in cuda_init_via()
398 /* sync with the CUDA - assert TACK without TIP */ in cuda_init_via()
429 req->complete = 1; in cuda_send_request()
430 return -ENXIO; in cuda_send_request()
433 req->reply_expected = 1; in cuda_send_request()
440 while (!req->complete) in cuda_send_request()
454 return -ENXIO; in cuda_adb_autopoll()
462 /* Reset adb bus - how do we do this?? */
469 return -ENXIO; in cuda_reset_adb_bus()
487 req->complete = 1; in cuda_request()
488 return -ENXIO; in cuda_request()
491 req->nbytes = nbytes; in cuda_request()
492 req->done = done; in cuda_request()
495 req->data[i] = va_arg(list, int); in cuda_request()
497 req->reply_expected = 1; in cuda_request()
507 if (req->nbytes < 2 || req->data[0] > CUDA_PACKET) { in cuda_write()
508 req->complete = 1; in cuda_write()
509 return -EINVAL; in cuda_write()
511 req->next = NULL; in cuda_write()
512 req->sent = 0; in cuda_write()
513 req->complete = 0; in cuda_write()
514 req->reply_len = 0; in cuda_write()
518 last_req->next = req; in cuda_write()
543 out_8(&via[SR], current_req->data[data_index++]); in cuda_start()
558 #define ARRAY_FULL(a, p) ((p) - (a) == ARRAY_SIZE(a))
574 * just the shift register IRQ -- other VIA interrupt sources are disabled. in cuda_interrupt()
609 reply_ptr = current_req->reply; in cuda_interrupt()
624 out_8(&via[SR], current_req->data[data_index++]); in cuda_interrupt()
634 if (data_index >= req->nbytes) { in cuda_interrupt()
638 req->sent = 1; in cuda_interrupt()
639 if (req->reply_expected) { in cuda_interrupt()
642 current_req = req->next; in cuda_interrupt()
649 out_8(&via[SR], req->data[data_index++]); in cuda_interrupt()
657 full = reading_reply ? ARRAY_FULL(current_req->reply, reply_ptr) in cuda_interrupt()
684 req->reply_len = reply_ptr - req->reply; in cuda_interrupt()
685 if (req->data[0] == ADB_PACKET) { in cuda_interrupt()
687 if (req->reply_len <= 2 || (req->reply[1] & 2) != 0) { in cuda_interrupt()
689 req->reply_len = 0; in cuda_interrupt()
692 req->reply_len -= 2; in cuda_interrupt()
693 memmove(req->reply, req->reply + 2, req->reply_len); in cuda_interrupt()
696 current_req = req->next; in cuda_interrupt()
702 * re-entered from another CPU getting an interrupt in cuda_interrupt()
707 ibuf_len = reply_ptr - cuda_rbuf; in cuda_interrupt()
724 void (*done)(struct adb_request *) = req->done; in cuda_interrupt()
726 req->complete = 1; in cuda_interrupt()
728 * struct request will survive to setting req->complete to 1 in cuda_interrupt()
753 adb_input(buf+2, nb-2, buf[1] & 0x40); in cuda_input()
769 /* Offset between Unix time (1970-based) and Mac time (1904-based) */
785 return (time64_t)now - RTC_OFFSET; in cuda_get_time()
796 return -ENXIO; in cuda_set_rtc_time()