summaryrefslogtreecommitdiff
path: root/lib/utils/i2c
AgeCommit message (Collapse)Author
2026-05-11lib: utils/i2c: add minimal SpacemiT I2C driverAurelien Jarno
Add a simple SpacemiT I2C driver for basic byte transfers over the I2C bus, prioritizing simplicity over performance. The driver operates in PIO mode and does not use interrupts, FIFO, or DMA. The controller is reset at the start of each transaction to ensure a known initial state, regardless of prior configuration by the kernel. This also avoids the need for additional error recovery code. This will be used for communication with onboard PMIC to reset and power-off the board. Signed-off-by: Aurelien Jarno <[email protected]> Tested-by: Anand Moon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Anup Patel <[email protected]>
2024-11-28lib: utils/i2c: Use fdt_driver for initializationSamuel Holland
The i2c driver subsystem does not need any extra data, so it can use `struct fdt_driver` directly. It always initializes the driver for a specific DT node. Signed-off-by: Samuel Holland <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2024-11-28treewide: Make carray arrays const and NULL-terminatedSamuel Holland
This allows the compiler to generate significantly better code, because it does not have to maintain either the loop counter or loop limit. Plus there are half as many symbols to relocate. This also simplifies passing carray arrays to helper functions. Signed-off-by: Samuel Holland <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2024-08-24lib: utils/i2c: Constify FDT pointers in parsing functionsSamuel Holland
Indicate that none of these functions modify the devicetree by constifying the parameter type. Signed-off-by: Samuel Holland <[email protected]> Reviewed-by: Andrew Jones <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2024-07-04Makefile: change to using .carray.c for carray filesBen Dooks
We would like to clean any files generated by the carray scripts by just searching for the filename as the current make system turns f.carray into f.o. Change to make the make system turn f.carray into f.carray.o note, command to go through .mk files changing the .o in the .mk files is: find . -type f -name "*.carray" | xargs -t -I fname /bin/bash -x -c ' fn=`basename -s .carray fname`; echo "$fn"; sed -i `dirname fname `/objects.mk -e s/"$fn".o/"$fn".carray.o/g' Link: https://patchwork.ozlabs.org/project/opensbi/patch/[email protected]/ Reported-by: Ivan Orlov <[email protected]> Suggested-by: Andrew Jones <[email protected]> Signed-off-by: Ben Dooks <[email protected]> Reviewed-by: Andrew Jones <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2023-07-31include: sbi_utils: Remove driver pointer from struct i2c_adapterAnup Patel
The "driver" pointer in struct i2c_adapter is not used anywhere so let us remove it. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Xiang W <[email protected]>
2023-06-05lib: utils/i2c: Use heap in DesignWare and SiFive I2C driversAnup Patel
Let's use heap allocation in DesignWare and SiFive I2C drivers instead of using a fixed size global array. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Andrew Jones <[email protected]>
2023-03-09lib: utils/i2c: Add minimal StarFive jh7110 I2C driverMinda Chen
Starfive JH7110 I2C IP is synopsys designware. Minimum StarFIve 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. Signed-off-by: Minda Chen <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2022-08-08lib: utils/fdt: Use kconfig for enabling/disablingAnup Patel
We update FDT support makefile to use kconfig for enabling/disabling. To avoid compilation errors, we also enable FDT for each platform. Signed-off-by: Anup Patel <[email protected]> Tested-by: Andrew Jones <[email protected]> Acked-by: Atish Patra <[email protected]> Tested-by: Atish Patra <[email protected]>
2022-08-08lib: utils/i2c: Use kconfig for enabling/disabling driversAnup Patel
We update i2c drivers makefile to use kconfig for enabling/disabling drivers. To avoid compile errors, we also enable appropriate i2c drivers for each platform. Signed-off-by: Anup Patel <[email protected]> Tested-by: Andrew Jones <[email protected]> Acked-by: Atish Patra <[email protected]> Tested-by: Atish Patra <[email protected]>
2022-05-13lib: utils/i2c: Generate FDT i2c adapter driver list at compile-timeAnup Patel
Instead of having FDT i2c adapter driver list hard-coded in the C source, we generate it using carray.sh at compile-time. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2022-01-21lib: fix pointer of type 'void *' used in arithmeticJukka Laitinen
Using "void *" in arithmetic causes errors with strict compiler settings: "error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]" Avoid these by calculating on "char *" where 1-byte data size is assumed. Signed-off-by: Jukka Laitinen <[email protected]> Reviewed-by: Dong Du <[email protected]> Reviewed-by: Xiang W <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2021-11-12lib: utils/i2c: Add minimal SiFive I2C driverNikita Shubin
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 <[email protected]> Reviewed-by: Alexandre Ghiti <[email protected]> Tested-by: Alexandre Ghiti <[email protected]> Signed-off-by: Nikita Shubin <[email protected]>
2021-11-12lib: utils/i2c: Add simple FDT based I2C frameworkNikita Shubin
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 <[email protected]> Reviewed-by: Alexandre Ghiti <[email protected]> Tested-by: Alexandre Ghiti <[email protected]> Signed-off-by: Nikita Shubin <[email protected]>
2021-11-12lib: utils/i2c: Add generic I2C configuration libraryNikita Shubin
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 <[email protected]> Reviewed-by: Alexandre Ghiti <[email protected]> Tested-by: Alexandre Ghiti <[email protected]> Signed-off-by: Nikita Shubin <[email protected]>