|
23 | 23 | struct i2c_client; |
24 | 24 | struct rtc_device; |
25 | 25 |
|
| 26 | +/** |
| 27 | + * struct omnia_mcu - driver private data structure |
| 28 | + * @client: I2C client |
| 29 | + * @type: MCU type (STM32, GD32, MKL, or unknown) |
| 30 | + * @features: bitmap of features supported by the MCU firmware |
| 31 | + * @board_serial_number: board serial number, if stored in MCU |
| 32 | + * @board_first_mac: board first MAC address, if stored in MCU |
| 33 | + * @board_revision: board revision, if stored in MCU |
| 34 | + * @gc: GPIO chip |
| 35 | + * @lock: mutex to protect internal GPIO chip state |
| 36 | + * @mask: bitmap of masked IRQs |
| 37 | + * @rising: bitmap of rising edge IRQs |
| 38 | + * @falling: bitmap of falling edge IRQs |
| 39 | + * @both: bitmap of both edges IRQs |
| 40 | + * @cached: bitmap of cached IRQ line values (when an IRQ line is configured for |
| 41 | + * both edges, we cache the corresponding GPIO values in the IRQ |
| 42 | + * handler) |
| 43 | + * @is_cached: bitmap of which IRQ line values are cached |
| 44 | + * @button_release_emul_work: front button release emulation work, used with old MCU firmware |
| 45 | + * versions which did not send button release events, only button press |
| 46 | + * events |
| 47 | + * @last_status: cached value of the status word, to be compared with new value to |
| 48 | + * determine which interrupt events occurred, used with old MCU |
| 49 | + * firmware versions which only informed that the status word changed, |
| 50 | + * but not which bits of the status word changed |
| 51 | + * @button_pressed_emul: the front button is still emulated to be pressed |
| 52 | + * @rtcdev: RTC device, does not actually count real-time, the device is only |
| 53 | + * used for the RTC alarm mechanism, so that the board can be |
| 54 | + * configured to wake up from poweroff state at a specific time |
| 55 | + * @rtc_alarm: RTC alarm that was set for the board to wake up on, in MCU time |
| 56 | + * (seconds since last MCU reset) |
| 57 | + * @front_button_poweron: the front button should power on the device after it is powered off |
| 58 | + * @wdt: watchdog driver structure |
| 59 | + * @trng: RNG driver structure |
| 60 | + * @trng_entropy_ready: RNG entropy ready completion |
| 61 | + */ |
26 | 62 | struct omnia_mcu { |
27 | 63 | struct i2c_client *client; |
28 | 64 | const char *type; |
29 | 65 | u32 features; |
30 | 66 |
|
31 | | - /* board information */ |
32 | 67 | u64 board_serial_number; |
33 | 68 | u8 board_first_mac[ETH_ALEN]; |
34 | 69 | u8 board_revision; |
35 | 70 |
|
36 | 71 | #ifdef CONFIG_TURRIS_OMNIA_MCU_GPIO |
37 | | - /* GPIO chip */ |
38 | 72 | struct gpio_chip gc; |
39 | 73 | struct mutex lock; |
40 | 74 | unsigned long mask, rising, falling, both, cached, is_cached; |
41 | | - /* Old MCU firmware handling needs the following */ |
42 | 75 | struct delayed_work button_release_emul_work; |
43 | 76 | unsigned long last_status; |
44 | 77 | bool button_pressed_emul; |
45 | 78 | #endif |
46 | 79 |
|
47 | 80 | #ifdef CONFIG_TURRIS_OMNIA_MCU_SYSOFF_WAKEUP |
48 | | - /* RTC device for configuring wake-up */ |
49 | 81 | struct rtc_device *rtcdev; |
50 | 82 | u32 rtc_alarm; |
51 | 83 | bool front_button_poweron; |
52 | 84 | #endif |
53 | 85 |
|
54 | 86 | #ifdef CONFIG_TURRIS_OMNIA_MCU_WATCHDOG |
55 | | - /* MCU watchdog */ |
56 | 87 | struct watchdog_device wdt; |
57 | 88 | #endif |
58 | 89 |
|
59 | 90 | #ifdef CONFIG_TURRIS_OMNIA_MCU_TRNG |
60 | | - /* true random number generator */ |
61 | 91 | struct hwrng trng; |
62 | 92 | struct completion trng_entropy_ready; |
63 | 93 | #endif |
|
0 commit comments