#include <common.h>
#include <dm.h>
+#include <log.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
#include <linux/types.h>
#include <linux/io.h>
#include <linux/errno.h>
unsigned long speed_p = speed;
int ret = 0;
- if (speed > 400000) {
+ if (speed > I2C_SPEED_FAST_RATE) {
debug("%s, failed to set clock speed to %u\n", __func__,
speed);
return -EINVAL;
while (len-- && !is_arbitration_lost(regs)) {
writel(*(cur_data++), ®s->data);
- if (readl(®s->transfer_size) == CDNS_I2C_FIFO_DEPTH) {
+ if (len && readl(®s->transfer_size) == CDNS_I2C_FIFO_DEPTH) {
ret = cdns_i2c_wait(regs, CDNS_I2C_INTERRUPT_COMP |
CDNS_I2C_INTERRUPT_ARBLOST);
if (ret & CDNS_I2C_INTERRUPT_ARBLOST)
};
U_BOOT_DRIVER(cdns_i2c) = {
- .name = "i2c-cdns",
+ .name = "i2c_cdns",
.id = UCLASS_I2C,
.of_match = cdns_i2c_of_match,
.ofdata_to_platdata = cdns_i2c_ofdata_to_platdata,