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)
{
u8 *cur_data = data;
struct cdns_i2c_regs *regs = i2c_bus->regs;
- int curr_recv_count;
+ u32 curr_recv_count;
int updatetx, hold_quirk;
u32 ret;
- /* Check the hardware can handle the requested bytes */
- if ((recv_count < 0))
- return -EINVAL;
-
curr_recv_count = recv_count;
/* Check for the message size against the FIFO depth */