Lines Matching refs:master
112 u16 master; member
134 struct cci_master master[NUM_MASTERS]; member
148 complete(&cci->master[0].irq_complete); in cci_isr()
149 if (cci->master[1].master) in cci_isr()
150 complete(&cci->master[1].irq_complete); in cci_isr()
157 cci->master[0].status = 0; in cci_isr()
158 complete(&cci->master[0].irq_complete); in cci_isr()
165 cci->master[1].status = 0; in cci_isr()
166 complete(&cci->master[1].irq_complete); in cci_isr()
186 cci->master[0].status = -ENXIO; in cci_isr()
188 cci->master[0].status = -EIO; in cci_isr()
197 cci->master[1].status = -ENXIO; in cci_isr()
199 cci->master[1].status = -EIO; in cci_isr()
210 struct cci_master *master; in cci_halt() local
219 master = &cci->master[master_num]; in cci_halt()
221 reinit_completion(&master->irq_complete); in cci_halt()
224 if (!wait_for_completion_timeout(&master->irq_complete, CCI_TIMEOUT)) { in cci_halt()
238 reinit_completion(&cci->master[0].irq_complete); in cci_reset()
241 if (!wait_for_completion_timeout(&cci->master[0].irq_complete, in cci_reset()
268 int mode = cci->master[i].mode; in cci_init()
271 if (!cci->master[i].cci) in cci_init()
295 static int cci_run_queue(struct cci *cci, u8 master, u8 queue) in cci_run_queue() argument
299 val = readl(cci->base + CCI_I2C_Mm_Qn_CUR_WORD_CNT(master, queue)); in cci_run_queue()
300 writel(val, cci->base + CCI_I2C_Mm_Qn_EXEC_WORD_CNT(master, queue)); in cci_run_queue()
302 reinit_completion(&cci->master[master].irq_complete); in cci_run_queue()
303 val = BIT(master * 2 + queue); in cci_run_queue()
306 if (!wait_for_completion_timeout(&cci->master[master].irq_complete, in cci_run_queue()
309 master, queue); in cci_run_queue()
315 return cci->master[master].status; in cci_run_queue()
318 static int cci_validate_queue(struct cci *cci, u8 master, u8 queue) in cci_validate_queue() argument
322 val = readl(cci->base + CCI_I2C_Mm_Qn_CUR_WORD_CNT(master, queue)); in cci_validate_queue()
330 writel(val, cci->base + CCI_I2C_Mm_Qn_LOAD_DATA(master, queue)); in cci_validate_queue()
332 return cci_run_queue(cci, master, queue); in cci_validate_queue()
335 static int cci_i2c_read(struct cci *cci, u16 master, in cci_i2c_read() argument
347 ret = cci_validate_queue(cci, master, queue); in cci_i2c_read()
352 writel(val, cci->base + CCI_I2C_Mm_Qn_LOAD_DATA(master, queue)); in cci_i2c_read()
355 writel(val, cci->base + CCI_I2C_Mm_Qn_LOAD_DATA(master, queue)); in cci_i2c_read()
357 ret = cci_run_queue(cci, master, queue); in cci_i2c_read()
361 words_read = readl(cci->base + CCI_I2C_Mm_READ_BUF_LEVEL(master)); in cci_i2c_read()
370 val = readl(cci->base + CCI_I2C_Mm_READ_DATA(master)); in cci_i2c_read()
388 static int cci_i2c_write(struct cci *cci, u16 master, in cci_i2c_write() argument
400 ret = cci_validate_queue(cci, master, queue); in cci_i2c_write()
405 writel(val, cci->base + CCI_I2C_Mm_Qn_LOAD_DATA(master, queue)); in cci_i2c_write()
417 writel(val, cci->base + CCI_I2C_Mm_Qn_LOAD_DATA(master, queue)); in cci_i2c_write()
421 writel(val, cci->base + CCI_I2C_Mm_Qn_LOAD_DATA(master, queue)); in cci_i2c_write()
423 return cci_run_queue(cci, master, queue); in cci_i2c_write()
438 ret = cci_i2c_read(cci, cci_master->master, in cci_xfer()
442 ret = cci_i2c_write(cci, cci_master->master, in cci_xfer()
544 struct cci_master *master; in cci_probe() local
559 master = &cci->master[idx]; in cci_probe()
560 master->adap.quirks = &cci->data->quirks; in cci_probe()
561 master->adap.algo = &cci_algo; in cci_probe()
562 master->adap.dev.parent = dev; in cci_probe()
563 master->adap.dev.of_node = of_node_get(child); in cci_probe()
564 master->master = idx; in cci_probe()
565 master->cci = cci; in cci_probe()
567 i2c_set_adapdata(&master->adap, master); in cci_probe()
568 snprintf(master->adap.name, sizeof(master->adap.name), "Qualcomm-CCI"); in cci_probe()
570 master->mode = I2C_MODE_STANDARD; in cci_probe()
574 master->mode = I2C_MODE_FAST; in cci_probe()
576 master->mode = I2C_MODE_FAST_PLUS; in cci_probe()
579 init_completion(&master->irq_complete); in cci_probe()
647 if (!cci->master[i].cci) in cci_probe()
650 ret = i2c_add_adapter(&cci->master[i].adap); in cci_probe()
652 of_node_put(cci->master[i].adap.dev.of_node); in cci_probe()
664 if (cci->master[i].cci) { in cci_probe()
665 i2c_del_adapter(&cci->master[i].adap); in cci_probe()
666 of_node_put(cci->master[i].adap.dev.of_node); in cci_probe()
683 if (cci->master[i].cci) { in cci_remove()
684 i2c_del_adapter(&cci->master[i].adap); in cci_remove()
685 of_node_put(cci->master[i].adap.dev.of_node); in cci_remove()