On 14/03/2025 17:09, Caleb Connolly wrote:
Load firmware for the peripheral if necessary.

Signed-off-by: Caleb Connolly <caleb.conno...@linaro.org>
---
  drivers/i2c/geni_i2c.c | 8 ++++++++
  1 file changed, 8 insertions(+)

diff --git a/drivers/i2c/geni_i2c.c b/drivers/i2c/geni_i2c.c
index 
4eb41ba852f7790ca646c8ba38f29fdb727fa804..fca0fab7201a2f86ff4a8c12d053297e660c4621
 100644
--- a/drivers/i2c/geni_i2c.c
+++ b/drivers/i2c/geni_i2c.c
@@ -21,8 +21,9 @@
  #include <clk.h>
  #include <reset.h>
  #include <time.h>
  #include <soc/qcom/geni-se.h>
+#include <soc/qcom/qup-fw-load.h>
#define SE_I2C_TX_TRANS_LEN 0x26c
  #define SE_I2C_RX_TRANS_LEN           0x270
  #define SE_I2C_SCL_COUNTERS           0x278
@@ -498,8 +499,15 @@ static int geni_i2c_probe(struct udevice *dev)
        proto = readl(geni->base + GENI_FW_REVISION_RO);
        proto &= FW_REV_PROTOCOL_MSK;
        proto >>= FW_REV_PROTOCOL_SHFT;
+ if (proto == 0xff) {

-------------------- GENI_SE_INVALID_PROTO

+               qcom_geni_load_firmware(geni->base, dev);
+               proto = readl(geni->base + GENI_FW_REVISION_RO);
+               proto &= FW_REV_PROTOCOL_MSK;
+               proto >>= FW_REV_PROTOCOL_SHFT;
+       }
+
        if (proto != GENI_SE_I2C) {
                dev_err(dev, "Invalid proto %d\n", proto);
                geni_i2c_disable_clocks(dev, geni);
                return -ENXIO;


Reviewed-by: Neil Armstrong <neil.armstr...@linaro.org>

Reply via email to