Nikita Shubin and Anup Patel
13a1158d24
lib: utils/i2c: Add minimal SiFive I2C driver
...
Minimum SiFive I2C driver to read/send bytes over I2C bus.
This allows querying information and perform operation of onboard PMIC,
as well as power-off and reset.
Tested-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com >
Reviewed-by: Alexandre Ghiti <alexandre.ghiti@canonical.com >
Tested-by: Alexandre Ghiti <alexandre.ghiti@canonical.com >
Signed-off-by: Nikita Shubin <n.shubin@yadro.com >
2021-11-12 10:29:08 +05:30
Nikita Shubin and Anup Patel
6ca6bcafb7
lib: utils/i2c: Add simple FDT based I2C framework
...
FDT based I2C framework on the top of I2C library.
The drivers are probed on demand by fdt_i2c_adapter_get
function.
Tested-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com >
Reviewed-by: Alexandre Ghiti <alexandre.ghiti@canonical.com >
Tested-by: Alexandre Ghiti <alexandre.ghiti@canonical.com >
Signed-off-by: Nikita Shubin <n.shubin@yadro.com >
2021-11-12 10:19:45 +05:30
Nikita Shubin and Anup Patel
2c964a2e15
lib: utils/i2c: Add generic I2C configuration library
...
Helper library to keep track of registered I2C adapters,
identified by dts offset, basic send/read functions and
adapter configuration (enable, set dividers, etc...).
Tested-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com >
Reviewed-by: Alexandre Ghiti <alexandre.ghiti@canonical.com >
Tested-by: Alexandre Ghiti <alexandre.ghiti@canonical.com >
Signed-off-by: Nikita Shubin <n.shubin@yadro.com >
2021-11-12 10:17:50 +05:30
Nikita Shubin and Anup Patel
1d462e0397
lib: utils/reset: separate driver init func
...
Move driver init code to separate function, so it can be reused
elsewhere.
Tested-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com >
Reviewed-by: Alexandre Ghiti <alexandre.ghiti@canonical.com >
Tested-by: Alexandre Ghiti <alexandre.ghiti@canonical.com >
Signed-off-by: Nikita Shubin <n.shubin@yadro.com >
2021-11-12 10:16:23 +05:30
Nikita Shubin and Anup Patel
94eba23376
lib: utils/reset: add priority to gpio reset
...
Make gpio_system_reset_check return priority instead of just true/false.
Make default 128 priority for reset/shutdown.
Tested-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com >
Reviewed-by: Alexandre Ghiti <alexandre.ghiti@canonical.com >
Tested-by: Alexandre Ghiti <alexandre.ghiti@canonical.com >
Signed-off-by: Nikita Shubin <n.shubin@yadro.com >
2021-11-12 10:15:54 +05:30
Nikita Shubin and Anup Patel
0979ffda12
lib: utils/gpio: use list for drivers
...
Convert static array to sbi_list.
This removes size limitation, makes add/remove more efficient and
saves space.
Signed-off-by: Nikita Shubin <n.shubin@yadro.com >
Reviewed-by: Anup Patel <anup.patel@wdc.com >
2021-11-03 15:57:56 +05:30
Nikita Shubin and Anup Patel
9283d503bd
lib: sbi: add priority for reset handler
...
Let's make system_reset_check returning priority instead of only
true/false. In that case 0 - means not supported, and anything above
means priority that makes existing reset handlers being used in first
place, unless it is decided to lower their priority.
The handler with the most priority wins.
Signed-off-by: Nikita Shubin <n.shubin@yadro.com >
Reviewed-by: Anup Patel <anup.patel@wdc.com >
2021-10-11 10:32:26 +05:30
Nikita Shubin and Anup Patel
516161c46f
lib: sbi: convert reset to list
...
To support different handlers for different types of resets, we are
adding a sbi_list of restart handlers.
Instead of sbi_system_reset_set_device we use
sbi_system_reset_add_device to reflect the actual meaning.
Signed-off-by: Nikita Shubin <n.shubin@yadro.com >
Reviewed-by: Anup Patel <anup.patel@wdc.com >
2021-10-11 09:59:29 +05:30