siic 88 drivers/i2c/busses/i2c-sirf.c static void i2c_sirfsoc_read_data(struct sirfsoc_i2c *siic) siic 93 drivers/i2c/busses/i2c-sirf.c for (i = 0; i < siic->read_cmd_len; i++) { siic 95 drivers/i2c/busses/i2c-sirf.c data = readl(siic->base + SIRFSOC_I2C_DATA_BUF + i); siic 96 drivers/i2c/busses/i2c-sirf.c siic->buf[siic->finished_len++] = siic 102 drivers/i2c/busses/i2c-sirf.c static void i2c_sirfsoc_queue_cmd(struct sirfsoc_i2c *siic) siic 107 drivers/i2c/busses/i2c-sirf.c if (siic->msg_read) { siic 108 drivers/i2c/busses/i2c-sirf.c while (((siic->finished_len + i) < siic->msg_len) siic 109 drivers/i2c/busses/i2c-sirf.c && (siic->cmd_ptr < SIRFSOC_I2C_CMD_BUF_MAX)) { siic 111 drivers/i2c/busses/i2c-sirf.c if (((siic->finished_len + i) == siic 112 drivers/i2c/busses/i2c-sirf.c (siic->msg_len - 1)) && siic->last) siic 115 drivers/i2c/busses/i2c-sirf.c siic->base + SIRFSOC_I2C_CMD(siic->cmd_ptr++)); siic 119 drivers/i2c/busses/i2c-sirf.c siic->read_cmd_len = i; siic 121 drivers/i2c/busses/i2c-sirf.c while ((siic->cmd_ptr < SIRFSOC_I2C_CMD_BUF_MAX - 1) siic 122 drivers/i2c/busses/i2c-sirf.c && (siic->finished_len < siic->msg_len)) { siic 124 drivers/i2c/busses/i2c-sirf.c if ((siic->finished_len == (siic->msg_len - 1)) siic 125 drivers/i2c/busses/i2c-sirf.c && siic->last) siic 128 drivers/i2c/busses/i2c-sirf.c siic->base + SIRFSOC_I2C_CMD(siic->cmd_ptr++)); siic 129 drivers/i2c/busses/i2c-sirf.c writel(siic->buf[siic->finished_len++], siic 130 drivers/i2c/busses/i2c-sirf.c siic->base + SIRFSOC_I2C_CMD(siic->cmd_ptr++)); siic 133 drivers/i2c/busses/i2c-sirf.c siic->cmd_ptr = 0; siic 136 drivers/i2c/busses/i2c-sirf.c writel(SIRFSOC_I2C_START_CMD, siic->base + SIRFSOC_I2C_CMD_START); siic 141 drivers/i2c/busses/i2c-sirf.c struct sirfsoc_i2c *siic = (struct sirfsoc_i2c *)dev_id; siic 142 drivers/i2c/busses/i2c-sirf.c u32 i2c_stat = readl(siic->base + SIRFSOC_I2C_STATUS); siic 146 drivers/i2c/busses/i2c-sirf.c siic->err_status = SIRFSOC_I2C_ERR_NOACK; siic 147 drivers/i2c/busses/i2c-sirf.c writel(SIRFSOC_I2C_STAT_ERR, siic->base + SIRFSOC_I2C_STATUS); siic 150 drivers/i2c/busses/i2c-sirf.c dev_dbg(&siic->adapter.dev, "ACK not received\n"); siic 152 drivers/i2c/busses/i2c-sirf.c dev_err(&siic->adapter.dev, "I2C error\n"); siic 159 drivers/i2c/busses/i2c-sirf.c writel(readl(siic->base + SIRFSOC_I2C_CTRL) | SIRFSOC_I2C_RESET, siic 160 drivers/i2c/busses/i2c-sirf.c siic->base + SIRFSOC_I2C_CTRL); siic 161 drivers/i2c/busses/i2c-sirf.c while (readl(siic->base + SIRFSOC_I2C_CTRL) & SIRFSOC_I2C_RESET) siic 164 drivers/i2c/busses/i2c-sirf.c complete(&siic->done); siic 167 drivers/i2c/busses/i2c-sirf.c if (siic->msg_read) siic 168 drivers/i2c/busses/i2c-sirf.c i2c_sirfsoc_read_data(siic); siic 169 drivers/i2c/busses/i2c-sirf.c if (siic->finished_len == siic->msg_len) siic 170 drivers/i2c/busses/i2c-sirf.c complete(&siic->done); siic 172 drivers/i2c/busses/i2c-sirf.c i2c_sirfsoc_queue_cmd(siic); siic 174 drivers/i2c/busses/i2c-sirf.c writel(SIRFSOC_I2C_STAT_CMD_DONE, siic->base + SIRFSOC_I2C_STATUS); siic 180 drivers/i2c/busses/i2c-sirf.c static void i2c_sirfsoc_set_address(struct sirfsoc_i2c *siic, siic 187 drivers/i2c/busses/i2c-sirf.c if (siic->last && (msg->len == 0)) siic 190 drivers/i2c/busses/i2c-sirf.c writel(regval, siic->base + SIRFSOC_I2C_CMD(siic->cmd_ptr++)); siic 198 drivers/i2c/busses/i2c-sirf.c writel(addr, siic->base + SIRFSOC_I2C_CMD(siic->cmd_ptr++)); siic 201 drivers/i2c/busses/i2c-sirf.c static int i2c_sirfsoc_xfer_msg(struct sirfsoc_i2c *siic, struct i2c_msg *msg) siic 203 drivers/i2c/busses/i2c-sirf.c u32 regval = readl(siic->base + SIRFSOC_I2C_CTRL); siic 207 drivers/i2c/busses/i2c-sirf.c i2c_sirfsoc_set_address(siic, msg); siic 210 drivers/i2c/busses/i2c-sirf.c siic->base + SIRFSOC_I2C_CTRL); siic 211 drivers/i2c/busses/i2c-sirf.c i2c_sirfsoc_queue_cmd(siic); siic 213 drivers/i2c/busses/i2c-sirf.c if (wait_for_completion_timeout(&siic->done, timeout) == 0) { siic 214 drivers/i2c/busses/i2c-sirf.c siic->err_status = SIRFSOC_I2C_ERR_TIMEOUT; siic 215 drivers/i2c/busses/i2c-sirf.c dev_err(&siic->adapter.dev, "Transfer timeout\n"); siic 219 drivers/i2c/busses/i2c-sirf.c siic->base + SIRFSOC_I2C_CTRL); siic 220 drivers/i2c/busses/i2c-sirf.c writel(0, siic->base + SIRFSOC_I2C_CMD_START); siic 223 drivers/i2c/busses/i2c-sirf.c if (siic->err_status == SIRFSOC_I2C_ERR_TIMEOUT) { siic 224 drivers/i2c/busses/i2c-sirf.c writel(readl(siic->base + SIRFSOC_I2C_CTRL) | SIRFSOC_I2C_RESET, siic 225 drivers/i2c/busses/i2c-sirf.c siic->base + SIRFSOC_I2C_CTRL); siic 226 drivers/i2c/busses/i2c-sirf.c while (readl(siic->base + SIRFSOC_I2C_CTRL) & SIRFSOC_I2C_RESET) siic 229 drivers/i2c/busses/i2c-sirf.c return siic->err_status ? -EAGAIN : 0; siic 240 drivers/i2c/busses/i2c-sirf.c struct sirfsoc_i2c *siic = adap->algo_data; siic 243 drivers/i2c/busses/i2c-sirf.c clk_enable(siic->clk); siic 246 drivers/i2c/busses/i2c-sirf.c siic->buf = msgs[i].buf; siic 247 drivers/i2c/busses/i2c-sirf.c siic->msg_len = msgs[i].len; siic 248 drivers/i2c/busses/i2c-sirf.c siic->msg_read = !!(msgs[i].flags & I2C_M_RD); siic 249 drivers/i2c/busses/i2c-sirf.c siic->err_status = 0; siic 250 drivers/i2c/busses/i2c-sirf.c siic->cmd_ptr = 0; siic 251 drivers/i2c/busses/i2c-sirf.c siic->finished_len = 0; siic 252 drivers/i2c/busses/i2c-sirf.c siic->last = (i == (num - 1)); siic 254 drivers/i2c/busses/i2c-sirf.c ret = i2c_sirfsoc_xfer_msg(siic, &msgs[i]); siic 256 drivers/i2c/busses/i2c-sirf.c clk_disable(siic->clk); siic 261 drivers/i2c/busses/i2c-sirf.c clk_disable(siic->clk); siic 273 drivers/i2c/busses/i2c-sirf.c struct sirfsoc_i2c *siic; siic 305 drivers/i2c/busses/i2c-sirf.c siic = devm_kzalloc(&pdev->dev, sizeof(*siic), GFP_KERNEL); siic 306 drivers/i2c/busses/i2c-sirf.c if (!siic) { siic 310 drivers/i2c/busses/i2c-sirf.c adap = &siic->adapter; siic 314 drivers/i2c/busses/i2c-sirf.c siic->base = devm_ioremap_resource(&pdev->dev, mem_res); siic 315 drivers/i2c/busses/i2c-sirf.c if (IS_ERR(siic->base)) { siic 316 drivers/i2c/busses/i2c-sirf.c err = PTR_ERR(siic->base); siic 326 drivers/i2c/busses/i2c-sirf.c dev_name(&pdev->dev), siic); siic 331 drivers/i2c/busses/i2c-sirf.c adap->algo_data = siic; siic 341 drivers/i2c/busses/i2c-sirf.c init_completion(&siic->done); siic 345 drivers/i2c/busses/i2c-sirf.c writel(SIRFSOC_I2C_RESET, siic->base + SIRFSOC_I2C_CTRL); siic 346 drivers/i2c/busses/i2c-sirf.c while (readl(siic->base + SIRFSOC_I2C_CTRL) & SIRFSOC_I2C_RESET) siic 349 drivers/i2c/busses/i2c-sirf.c siic->base + SIRFSOC_I2C_CTRL); siic 351 drivers/i2c/busses/i2c-sirf.c siic->clk = clk; siic 382 drivers/i2c/busses/i2c-sirf.c writel(regval, siic->base + SIRFSOC_I2C_CLK_CTRL); siic 384 drivers/i2c/busses/i2c-sirf.c writel(0xFF, siic->base + SIRFSOC_I2C_SDA_DELAY); siic 386 drivers/i2c/busses/i2c-sirf.c writel(regval, siic->base + SIRFSOC_I2C_SDA_DELAY); siic 411 drivers/i2c/busses/i2c-sirf.c struct sirfsoc_i2c *siic = adapter->algo_data; siic 413 drivers/i2c/busses/i2c-sirf.c writel(SIRFSOC_I2C_RESET, siic->base + SIRFSOC_I2C_CTRL); siic 415 drivers/i2c/busses/i2c-sirf.c clk_unprepare(siic->clk); siic 416 drivers/i2c/busses/i2c-sirf.c clk_put(siic->clk); siic 424 drivers/i2c/busses/i2c-sirf.c struct sirfsoc_i2c *siic = adapter->algo_data; siic 426 drivers/i2c/busses/i2c-sirf.c clk_enable(siic->clk); siic 427 drivers/i2c/busses/i2c-sirf.c siic->sda_delay = readl(siic->base + SIRFSOC_I2C_SDA_DELAY); siic 428 drivers/i2c/busses/i2c-sirf.c siic->clk_div = readl(siic->base + SIRFSOC_I2C_CLK_CTRL); siic 429 drivers/i2c/busses/i2c-sirf.c clk_disable(siic->clk); siic 436 drivers/i2c/busses/i2c-sirf.c struct sirfsoc_i2c *siic = adapter->algo_data; siic 438 drivers/i2c/busses/i2c-sirf.c clk_enable(siic->clk); siic 439 drivers/i2c/busses/i2c-sirf.c writel(SIRFSOC_I2C_RESET, siic->base + SIRFSOC_I2C_CTRL); siic 440 drivers/i2c/busses/i2c-sirf.c while (readl(siic->base + SIRFSOC_I2C_CTRL) & SIRFSOC_I2C_RESET) siic 443 drivers/i2c/busses/i2c-sirf.c siic->base + SIRFSOC_I2C_CTRL); siic 444 drivers/i2c/busses/i2c-sirf.c writel(siic->clk_div, siic->base + SIRFSOC_I2C_CLK_CTRL); siic 445 drivers/i2c/busses/i2c-sirf.c writel(siic->sda_delay, siic->base + SIRFSOC_I2C_SDA_DELAY); siic 446 drivers/i2c/busses/i2c-sirf.c clk_disable(siic->clk);