Make a10 watchdog driver more generic and add support to A31 watchdog.
Those are actually the only two watchdog on Allwinner SoC.
It is needed to add support to A31/A83/H3 (for which supports in on it s way).
Details
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 2553 Build 2570: arc lint + arc unit
Event Timeline
sys/arm/allwinner/aw_wdog.c | ||
---|---|---|
54–60 | This is the original indentation but I can fix that if you want. |
sys/arm/allwinner/aw_wdog.h | ||
---|---|---|
28–29 | This should be changed to __AW_WDOG_H__ |
sys/arm/allwinner/aw_wdog.c | ||
---|---|---|
55 | Bits 1:0 of A31_WDOG_CONFIG controls the target for the reset signal. 0x1 is "to whole system" and 0x2 is "only interrupt". Maybe A31_WDOG_CONFIG_RST_EN could have a name to better reflect this? |
Use ofw_bus_search_compatible.
Rename A31_WDOG_CONFIG_RST_EN to A31_WDOG_CONFIG_RST_EN_SYSTEM.
Rename ifdef in aw_wdog.h
Fix indentation to reflect style(9).
Remove a10 var in softc as it is not needed anymore
sys/arm/allwinner/aw_wdog.c | ||
---|---|---|
54–60 | I normally use #define<tab>FOO for the register and #define<tab> FOO_BAR for the contents of the register. | |
94–99 | At least wdog_mode_en should be a 32-bit value as it stores the contents of the register. It could be argued the register offsets should be bus_size_t. Given there are only a limited number of copies of this struct the size shouldn't matter too much. | |
130 | Extra return. | |
131 | Missing device_set_desc(dev, "Allwinner A10 Watchdog"); (or similar). | |
155 | You could put a unique value in the compat_data map, then have something like: switch (ofw_bus_search_compatible(dev, compat_data)->ocd_data) { case A10: ... break; case A31: ... break; default: ... return (ENXIO); } | |
169 | If you move the mtx_init call below this you can remove this line. |
Fix style(9) on defines.
Add A10_WATCHDOG, A31_WATCHDOG defines and use them in the compat_data.
Set device desc based on the compat data which matched.