hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/drivers/i2c/busses/i2c-thunderx-pcidrv.c
....@@ -118,6 +118,8 @@
118118 static int thunder_i2c_smbus_setup_of(struct octeon_i2c *i2c,
119119 struct device_node *node)
120120 {
121
+ struct i2c_client *ara;
122
+
121123 if (!node)
122124 return -EINVAL;
123125
....@@ -125,9 +127,12 @@
125127 if (!i2c->alert_data.irq)
126128 return -EINVAL;
127129
128
- i2c->ara = i2c_setup_smbus_alert(&i2c->adap, &i2c->alert_data);
129
- if (!i2c->ara)
130
- return -ENODEV;
130
+ ara = i2c_new_smbus_alert_device(&i2c->adap, &i2c->alert_data);
131
+ if (IS_ERR(ara))
132
+ return PTR_ERR(ara);
133
+
134
+ i2c->ara = ara;
135
+
131136 return 0;
132137 }
133138
....@@ -178,7 +183,7 @@
178183 thunder_i2c_clock_enable(dev, i2c);
179184 ret = device_property_read_u32(dev, "clock-frequency", &i2c->twsi_freq);
180185 if (ret)
181
- i2c->twsi_freq = 100000;
186
+ i2c->twsi_freq = I2C_MAX_STANDARD_MODE_FREQ;
182187
183188 init_waitqueue_head(&i2c->queue);
184189
....@@ -208,6 +213,7 @@
208213 i2c->adap.bus_recovery_info = &octeon_i2c_recovery_info;
209214 i2c->adap.dev.parent = dev;
210215 i2c->adap.dev.of_node = pdev->dev.of_node;
216
+ i2c->adap.dev.fwnode = dev->fwnode;
211217 snprintf(i2c->adap.name, sizeof(i2c->adap.name),
212218 "Cavium ThunderX i2c adapter at %s", dev_name(dev));
213219 i2c_set_adapdata(&i2c->adap, i2c);