Linux-libre 4.14.68-gnu
[librecmc/linux-libre.git] / arch / cris / include / arch-v10 / arch / io_interface_mux.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* IO interface mux allocator for ETRAX100LX.
3  * Copyright 2004, Axis Communications AB
4  * $Id: io_interface_mux.h,v 1.1 2004/12/13 12:21:53 starvik Exp $
5  */
6
7
8 #ifndef _IO_INTERFACE_MUX_H
9 #define _IO_INTERFACE_MUX_H
10
11
12 /* C.f. ETRAX100LX Designer's Reference 20.9 */
13
14 /* The order in enum must match the order of interfaces[] in
15  * io_interface_mux.c */
16 enum cris_io_interface {
17         /* Begin Non-multiplexed interfaces */
18         if_eth = 0,
19         if_serial_0,
20         /* End Non-multiplexed interfaces */
21         if_serial_1,
22         if_serial_2,
23         if_serial_3,
24         if_sync_serial_1,
25         if_sync_serial_3,
26         if_shared_ram,
27         if_shared_ram_w,
28         if_par_0,
29         if_par_1,
30         if_par_w,
31         if_scsi8_0,
32         if_scsi8_1,
33         if_scsi_w,
34         if_ata,
35         if_csp,
36         if_i2c,
37         if_usb_1,
38         if_usb_2,
39         /* GPIO pins */
40         if_gpio_grp_a,
41         if_gpio_grp_b,
42         if_gpio_grp_c,
43         if_gpio_grp_d,
44         if_gpio_grp_e,
45         if_gpio_grp_f,
46         if_max_interfaces,
47         if_unclaimed
48 };
49
50 int cris_request_io_interface(enum cris_io_interface ioif, const char *device_id);
51
52 void cris_free_io_interface(enum cris_io_interface ioif);
53
54 /* port can be 'a', 'b' or 'g' */
55 int cris_io_interface_allocate_pins(const enum cris_io_interface ioif,
56                                     const char port,
57                                     const unsigned start_bit,
58                                     const unsigned stop_bit);
59
60 /* port can be 'a', 'b' or 'g' */
61 int cris_io_interface_free_pins(const enum cris_io_interface ioif,
62                                 const char port,
63                                 const unsigned start_bit,
64                                 const unsigned stop_bit);
65
66 int cris_io_interface_register_watcher(void (*notify)(const unsigned int gpio_in_available,
67                                                       const unsigned int gpio_out_available,
68                                                       const unsigned char pa_available,
69                                                       const unsigned char pb_available));
70
71 void cris_io_interface_delete_watcher(void (*notify)(const unsigned int gpio_in_available,
72                                                      const unsigned int gpio_out_available,
73                                                      const unsigned char pa_available,
74                                                      const unsigned char pb_available));
75
76 #endif /* _IO_INTERFACE_MUX_H */