qup 278 drivers/i2c/busses/i2c-qup.c void (*write_tx_fifo)(struct qup_i2c_dev *qup); qup 280 drivers/i2c/busses/i2c-qup.c void (*read_rx_fifo)(struct qup_i2c_dev *qup); qup 282 drivers/i2c/busses/i2c-qup.c void (*write_rx_tags)(struct qup_i2c_dev *qup); qup 287 drivers/i2c/busses/i2c-qup.c struct qup_i2c_dev *qup = dev; qup 288 drivers/i2c/busses/i2c-qup.c struct qup_i2c_block *blk = &qup->blk; qup 293 drivers/i2c/busses/i2c-qup.c bus_err = readl(qup->base + QUP_I2C_STATUS); qup 294 drivers/i2c/busses/i2c-qup.c qup_err = readl(qup->base + QUP_ERROR_FLAGS); qup 295 drivers/i2c/busses/i2c-qup.c opflags = readl(qup->base + QUP_OPERATIONAL); qup 297 drivers/i2c/busses/i2c-qup.c if (!qup->msg) { qup 299 drivers/i2c/busses/i2c-qup.c writel(QUP_RESET_STATE, qup->base + QUP_STATE); qup 308 drivers/i2c/busses/i2c-qup.c writel(qup_err, qup->base + QUP_ERROR_FLAGS); qup 312 drivers/i2c/busses/i2c-qup.c writel(bus_err, qup->base + QUP_I2C_STATUS); qup 319 drivers/i2c/busses/i2c-qup.c if (qup->use_dma && (qup->qup_err || qup->bus_err)) qup 330 drivers/i2c/busses/i2c-qup.c if (!qup->use_dma) qup 331 drivers/i2c/busses/i2c-qup.c writel(QUP_RESET_STATE, qup->base + QUP_STATE); qup 336 drivers/i2c/busses/i2c-qup.c writel(QUP_OUT_SVC_FLAG, qup->base + QUP_OPERATIONAL); qup 339 drivers/i2c/busses/i2c-qup.c blk->tx_fifo_free += qup->out_blk_sz; qup 340 drivers/i2c/busses/i2c-qup.c if (qup->msg->flags & I2C_M_RD) qup 341 drivers/i2c/busses/i2c-qup.c qup->write_rx_tags(qup); qup 343 drivers/i2c/busses/i2c-qup.c qup->write_tx_fifo(qup); qup 348 drivers/i2c/busses/i2c-qup.c writel(QUP_IN_SVC_FLAG, qup->base + QUP_OPERATIONAL); qup 351 drivers/i2c/busses/i2c-qup.c blk->fifo_available += qup->in_fifo_sz; qup 352 drivers/i2c/busses/i2c-qup.c qup->read_rx_fifo(qup); qup 354 drivers/i2c/busses/i2c-qup.c blk->fifo_available += qup->in_blk_sz; qup 355 drivers/i2c/busses/i2c-qup.c qup->read_rx_fifo(qup); qup 359 drivers/i2c/busses/i2c-qup.c if (qup->msg->flags & I2C_M_RD) { qup 375 drivers/i2c/busses/i2c-qup.c qup->qup_err = qup_err; qup 376 drivers/i2c/busses/i2c-qup.c qup->bus_err = bus_err; qup 377 drivers/i2c/busses/i2c-qup.c complete(&qup->xfer); qup 381 drivers/i2c/busses/i2c-qup.c static int qup_i2c_poll_state_mask(struct qup_i2c_dev *qup, qup 392 drivers/i2c/busses/i2c-qup.c state = readl(qup->base + QUP_STATE); qup 404 drivers/i2c/busses/i2c-qup.c static int qup_i2c_poll_state(struct qup_i2c_dev *qup, u32 req_state) qup 406 drivers/i2c/busses/i2c-qup.c return qup_i2c_poll_state_mask(qup, req_state, QUP_STATE_MASK); qup 409 drivers/i2c/busses/i2c-qup.c static void qup_i2c_flush(struct qup_i2c_dev *qup) qup 411 drivers/i2c/busses/i2c-qup.c u32 val = readl(qup->base + QUP_STATE); qup 414 drivers/i2c/busses/i2c-qup.c writel(val, qup->base + QUP_STATE); qup 417 drivers/i2c/busses/i2c-qup.c static int qup_i2c_poll_state_valid(struct qup_i2c_dev *qup) qup 419 drivers/i2c/busses/i2c-qup.c return qup_i2c_poll_state_mask(qup, 0, 0); qup 422 drivers/i2c/busses/i2c-qup.c static int qup_i2c_poll_state_i2c_master(struct qup_i2c_dev *qup) qup 424 drivers/i2c/busses/i2c-qup.c return qup_i2c_poll_state_mask(qup, QUP_I2C_MAST_GEN, QUP_I2C_MAST_GEN); qup 427 drivers/i2c/busses/i2c-qup.c static int qup_i2c_change_state(struct qup_i2c_dev *qup, u32 state) qup 429 drivers/i2c/busses/i2c-qup.c if (qup_i2c_poll_state_valid(qup) != 0) qup 432 drivers/i2c/busses/i2c-qup.c writel(state, qup->base + QUP_STATE); qup 434 drivers/i2c/busses/i2c-qup.c if (qup_i2c_poll_state(qup, state) != 0) qup 440 drivers/i2c/busses/i2c-qup.c static int qup_i2c_bus_active(struct qup_i2c_dev *qup, int len) qup 448 drivers/i2c/busses/i2c-qup.c status = readl(qup->base + QUP_I2C_STATUS); qup 461 drivers/i2c/busses/i2c-qup.c static void qup_i2c_write_tx_fifo_v1(struct qup_i2c_dev *qup) qup 463 drivers/i2c/busses/i2c-qup.c struct qup_i2c_block *blk = &qup->blk; qup 464 drivers/i2c/busses/i2c-qup.c struct i2c_msg *msg = qup->msg; qup 470 drivers/i2c/busses/i2c-qup.c if (qup->pos == 0) { qup 479 drivers/i2c/busses/i2c-qup.c while (blk->tx_fifo_free && qup->pos < msg->len) { qup 480 drivers/i2c/busses/i2c-qup.c if (qup->pos == msg->len - 1) qup 486 drivers/i2c/busses/i2c-qup.c val |= (qup_tag | msg->buf[qup->pos]) << QUP_MSW_SHIFT; qup 488 drivers/i2c/busses/i2c-qup.c val = qup_tag | msg->buf[qup->pos]; qup 491 drivers/i2c/busses/i2c-qup.c if (idx & 1 || qup->pos == msg->len - 1) qup 492 drivers/i2c/busses/i2c-qup.c writel(val, qup->base + QUP_OUT_FIFO_BASE); qup 494 drivers/i2c/busses/i2c-qup.c qup->pos++; qup 500 drivers/i2c/busses/i2c-qup.c static void qup_i2c_set_blk_data(struct qup_i2c_dev *qup, qup 503 drivers/i2c/busses/i2c-qup.c qup->blk.pos = 0; qup 504 drivers/i2c/busses/i2c-qup.c qup->blk.data_len = msg->len; qup 505 drivers/i2c/busses/i2c-qup.c qup->blk.count = DIV_ROUND_UP(msg->len, qup->blk_xfer_limit); qup 508 drivers/i2c/busses/i2c-qup.c static int qup_i2c_get_data_len(struct qup_i2c_dev *qup) qup 512 drivers/i2c/busses/i2c-qup.c if (qup->blk.data_len > qup->blk_xfer_limit) qup 513 drivers/i2c/busses/i2c-qup.c data_len = qup->blk_xfer_limit; qup 515 drivers/i2c/busses/i2c-qup.c data_len = qup->blk.data_len; qup 525 drivers/i2c/busses/i2c-qup.c static int qup_i2c_set_tags_smb(u16 addr, u8 *tags, struct qup_i2c_dev *qup, qup 530 drivers/i2c/busses/i2c-qup.c if (qup->is_smbus_read) { qup 532 drivers/i2c/busses/i2c-qup.c tags[len++] = qup_i2c_get_data_len(qup); qup 547 drivers/i2c/busses/i2c-qup.c static int qup_i2c_set_tags(u8 *tags, struct qup_i2c_dev *qup, qup 554 drivers/i2c/busses/i2c-qup.c int last = (qup->blk.pos == (qup->blk.count - 1)) && (qup->is_last); qup 558 drivers/i2c/busses/i2c-qup.c return qup_i2c_set_tags_smb(addr, tags, qup, msg); qup 560 drivers/i2c/busses/i2c-qup.c if (qup->blk.pos == 0) { qup 576 drivers/i2c/busses/i2c-qup.c tags[len++] = qup->blk.pos == (qup->blk.count - 1) ? qup 583 drivers/i2c/busses/i2c-qup.c data_len = qup_i2c_get_data_len(qup); qup 597 drivers/i2c/busses/i2c-qup.c struct qup_i2c_dev *qup = data; qup 599 drivers/i2c/busses/i2c-qup.c complete(&qup->xfer); qup 603 drivers/i2c/busses/i2c-qup.c unsigned int buflen, struct qup_i2c_dev *qup, qup 609 drivers/i2c/busses/i2c-qup.c ret = dma_map_sg(qup->dev, sg, 1, dir); qup 616 drivers/i2c/busses/i2c-qup.c static void qup_i2c_rel_dma(struct qup_i2c_dev *qup) qup 618 drivers/i2c/busses/i2c-qup.c if (qup->btx.dma) qup 619 drivers/i2c/busses/i2c-qup.c dma_release_channel(qup->btx.dma); qup 620 drivers/i2c/busses/i2c-qup.c if (qup->brx.dma) qup 621 drivers/i2c/busses/i2c-qup.c dma_release_channel(qup->brx.dma); qup 622 drivers/i2c/busses/i2c-qup.c qup->btx.dma = NULL; qup 623 drivers/i2c/busses/i2c-qup.c qup->brx.dma = NULL; qup 626 drivers/i2c/busses/i2c-qup.c static int qup_i2c_req_dma(struct qup_i2c_dev *qup) qup 630 drivers/i2c/busses/i2c-qup.c if (!qup->btx.dma) { qup 631 drivers/i2c/busses/i2c-qup.c qup->btx.dma = dma_request_slave_channel_reason(qup->dev, "tx"); qup 632 drivers/i2c/busses/i2c-qup.c if (IS_ERR(qup->btx.dma)) { qup 633 drivers/i2c/busses/i2c-qup.c err = PTR_ERR(qup->btx.dma); qup 634 drivers/i2c/busses/i2c-qup.c qup->btx.dma = NULL; qup 635 drivers/i2c/busses/i2c-qup.c dev_err(qup->dev, "\n tx channel not available"); qup 640 drivers/i2c/busses/i2c-qup.c if (!qup->brx.dma) { qup 641 drivers/i2c/busses/i2c-qup.c qup->brx.dma = dma_request_slave_channel_reason(qup->dev, "rx"); qup 642 drivers/i2c/busses/i2c-qup.c if (IS_ERR(qup->brx.dma)) { qup 643 drivers/i2c/busses/i2c-qup.c dev_err(qup->dev, "\n rx channel not available"); qup 644 drivers/i2c/busses/i2c-qup.c err = PTR_ERR(qup->brx.dma); qup 645 drivers/i2c/busses/i2c-qup.c qup->brx.dma = NULL; qup 646 drivers/i2c/busses/i2c-qup.c qup_i2c_rel_dma(qup); qup 653 drivers/i2c/busses/i2c-qup.c static int qup_i2c_bam_make_desc(struct qup_i2c_dev *qup, struct i2c_msg *msg) qup 660 drivers/i2c/busses/i2c-qup.c qup->blk_xfer_limit = QUP_READ_LIMIT; qup 661 drivers/i2c/busses/i2c-qup.c qup_i2c_set_blk_data(qup, msg); qup 663 drivers/i2c/busses/i2c-qup.c blocks = qup->blk.count; qup 667 drivers/i2c/busses/i2c-qup.c while (qup->blk.pos < blocks) { qup 669 drivers/i2c/busses/i2c-qup.c tags = &qup->start_tag.start[qup->tag_buf_pos + len]; qup 670 drivers/i2c/busses/i2c-qup.c len += qup_i2c_set_tags(tags, qup, msg); qup 671 drivers/i2c/busses/i2c-qup.c qup->blk.data_len -= tlen; qup 674 drivers/i2c/busses/i2c-qup.c ret = qup_sg_set_buf(&qup->brx.sg[qup->brx.sg_cnt++], qup 675 drivers/i2c/busses/i2c-qup.c &qup->brx.tag.start[0], qup 676 drivers/i2c/busses/i2c-qup.c 2, qup, DMA_FROM_DEVICE); qup 681 drivers/i2c/busses/i2c-qup.c ret = qup_sg_set_buf(&qup->brx.sg[qup->brx.sg_cnt++], qup 683 drivers/i2c/busses/i2c-qup.c tlen, qup, qup 689 drivers/i2c/busses/i2c-qup.c qup->blk.pos = i; qup 691 drivers/i2c/busses/i2c-qup.c ret = qup_sg_set_buf(&qup->btx.sg[qup->btx.sg_cnt++], qup 692 drivers/i2c/busses/i2c-qup.c &qup->start_tag.start[qup->tag_buf_pos], qup 693 drivers/i2c/busses/i2c-qup.c len, qup, DMA_TO_DEVICE); qup 697 drivers/i2c/busses/i2c-qup.c qup->tag_buf_pos += len; qup 699 drivers/i2c/busses/i2c-qup.c while (qup->blk.pos < blocks) { qup 701 drivers/i2c/busses/i2c-qup.c tags = &qup->start_tag.start[qup->tag_buf_pos + tx_len]; qup 702 drivers/i2c/busses/i2c-qup.c len = qup_i2c_set_tags(tags, qup, msg); qup 703 drivers/i2c/busses/i2c-qup.c qup->blk.data_len -= tlen; qup 705 drivers/i2c/busses/i2c-qup.c ret = qup_sg_set_buf(&qup->btx.sg[qup->btx.sg_cnt++], qup 707 drivers/i2c/busses/i2c-qup.c qup, DMA_TO_DEVICE); qup 712 drivers/i2c/busses/i2c-qup.c ret = qup_sg_set_buf(&qup->btx.sg[qup->btx.sg_cnt++], qup 714 drivers/i2c/busses/i2c-qup.c tlen, qup, DMA_TO_DEVICE); qup 718 drivers/i2c/busses/i2c-qup.c qup->blk.pos = i; qup 721 drivers/i2c/busses/i2c-qup.c qup->tag_buf_pos += tx_len; qup 727 drivers/i2c/busses/i2c-qup.c static int qup_i2c_bam_schedule_desc(struct qup_i2c_dev *qup) qup 733 drivers/i2c/busses/i2c-qup.c u32 tx_cnt = qup->btx.sg_cnt, rx_cnt = qup->brx.sg_cnt; qup 738 drivers/i2c/busses/i2c-qup.c qup->btx.tag.start[0] = QUP_BAM_INPUT_EOT; qup 742 drivers/i2c/busses/i2c-qup.c ret = qup_sg_set_buf(&qup->brx.sg[rx_cnt++], qup 743 drivers/i2c/busses/i2c-qup.c &qup->brx.tag.start[0], qup 744 drivers/i2c/busses/i2c-qup.c 1, qup, DMA_FROM_DEVICE); qup 749 drivers/i2c/busses/i2c-qup.c qup->btx.tag.start[len - 1] = QUP_BAM_FLUSH_STOP; qup 750 drivers/i2c/busses/i2c-qup.c ret = qup_sg_set_buf(&qup->btx.sg[tx_cnt++], &qup->btx.tag.start[0], qup 751 drivers/i2c/busses/i2c-qup.c len, qup, DMA_TO_DEVICE); qup 755 drivers/i2c/busses/i2c-qup.c txd = dmaengine_prep_slave_sg(qup->btx.dma, qup->btx.sg, tx_cnt, qup 759 drivers/i2c/busses/i2c-qup.c dev_err(qup->dev, "failed to get tx desc\n"); qup 766 drivers/i2c/busses/i2c-qup.c txd->callback_param = qup; qup 775 drivers/i2c/busses/i2c-qup.c dma_async_issue_pending(qup->btx.dma); qup 778 drivers/i2c/busses/i2c-qup.c rxd = dmaengine_prep_slave_sg(qup->brx.dma, qup->brx.sg, qup 782 drivers/i2c/busses/i2c-qup.c dev_err(qup->dev, "failed to get rx desc\n"); qup 786 drivers/i2c/busses/i2c-qup.c dmaengine_terminate_all(qup->btx.dma); qup 791 drivers/i2c/busses/i2c-qup.c rxd->callback_param = qup; qup 798 drivers/i2c/busses/i2c-qup.c dma_async_issue_pending(qup->brx.dma); qup 801 drivers/i2c/busses/i2c-qup.c if (!wait_for_completion_timeout(&qup->xfer, qup->xfer_timeout)) { qup 802 drivers/i2c/busses/i2c-qup.c dev_err(qup->dev, "normal trans timed out\n"); qup 806 drivers/i2c/busses/i2c-qup.c if (ret || qup->bus_err || qup->qup_err) { qup 807 drivers/i2c/busses/i2c-qup.c reinit_completion(&qup->xfer); qup 809 drivers/i2c/busses/i2c-qup.c if (qup_i2c_change_state(qup, QUP_RUN_STATE)) { qup 810 drivers/i2c/busses/i2c-qup.c dev_err(qup->dev, "change to run state timed out"); qup 814 drivers/i2c/busses/i2c-qup.c qup_i2c_flush(qup); qup 817 drivers/i2c/busses/i2c-qup.c if (!wait_for_completion_timeout(&qup->xfer, HZ)) qup 818 drivers/i2c/busses/i2c-qup.c dev_err(qup->dev, "flush timed out\n"); qup 820 drivers/i2c/busses/i2c-qup.c ret = (qup->bus_err & QUP_I2C_NACK_FLAG) ? -ENXIO : -EIO; qup 824 drivers/i2c/busses/i2c-qup.c dma_unmap_sg(qup->dev, qup->btx.sg, tx_cnt, DMA_TO_DEVICE); qup 827 drivers/i2c/busses/i2c-qup.c dma_unmap_sg(qup->dev, qup->brx.sg, rx_cnt, qup 833 drivers/i2c/busses/i2c-qup.c static void qup_i2c_bam_clear_tag_buffers(struct qup_i2c_dev *qup) qup 835 drivers/i2c/busses/i2c-qup.c qup->btx.sg_cnt = 0; qup 836 drivers/i2c/busses/i2c-qup.c qup->brx.sg_cnt = 0; qup 837 drivers/i2c/busses/i2c-qup.c qup->tag_buf_pos = 0; qup 843 drivers/i2c/busses/i2c-qup.c struct qup_i2c_dev *qup = i2c_get_adapdata(adap); qup 847 drivers/i2c/busses/i2c-qup.c enable_irq(qup->irq); qup 848 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_req_dma(qup); qup 853 drivers/i2c/busses/i2c-qup.c writel(0, qup->base + QUP_MX_INPUT_CNT); qup 854 drivers/i2c/busses/i2c-qup.c writel(0, qup->base + QUP_MX_OUTPUT_CNT); qup 857 drivers/i2c/busses/i2c-qup.c writel(QUP_REPACK_EN | QUP_BAM_MODE, qup->base + QUP_IO_MODE); qup 860 drivers/i2c/busses/i2c-qup.c writel((0x3 << 8), qup->base + QUP_OPERATIONAL_MASK); qup 863 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_change_state(qup, QUP_RUN_STATE); qup 867 drivers/i2c/busses/i2c-qup.c writel(qup->clk_ctl, qup->base + QUP_I2C_CLK_CTL); qup 868 drivers/i2c/busses/i2c-qup.c qup_i2c_bam_clear_tag_buffers(qup); qup 871 drivers/i2c/busses/i2c-qup.c qup->msg = msg + idx; qup 872 drivers/i2c/busses/i2c-qup.c qup->is_last = idx == (num - 1); qup 874 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_bam_make_desc(qup, qup->msg); qup 885 drivers/i2c/busses/i2c-qup.c if (qup->btx.sg_cnt > qup->max_xfer_sg_len || qup 886 drivers/i2c/busses/i2c-qup.c qup->brx.sg_cnt > qup->max_xfer_sg_len || qup 887 drivers/i2c/busses/i2c-qup.c qup->is_last) { qup 888 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_bam_schedule_desc(qup); qup 892 drivers/i2c/busses/i2c-qup.c qup_i2c_bam_clear_tag_buffers(qup); qup 897 drivers/i2c/busses/i2c-qup.c disable_irq(qup->irq); qup 899 drivers/i2c/busses/i2c-qup.c qup->msg = NULL; qup 903 drivers/i2c/busses/i2c-qup.c static int qup_i2c_wait_for_complete(struct qup_i2c_dev *qup, qup 909 drivers/i2c/busses/i2c-qup.c left = wait_for_completion_timeout(&qup->xfer, qup->xfer_timeout); qup 911 drivers/i2c/busses/i2c-qup.c writel(1, qup->base + QUP_SW_RESET); qup 915 drivers/i2c/busses/i2c-qup.c if (qup->bus_err || qup->qup_err) qup 916 drivers/i2c/busses/i2c-qup.c ret = (qup->bus_err & QUP_I2C_NACK_FLAG) ? -ENXIO : -EIO; qup 921 drivers/i2c/busses/i2c-qup.c static void qup_i2c_read_rx_fifo_v1(struct qup_i2c_dev *qup) qup 923 drivers/i2c/busses/i2c-qup.c struct qup_i2c_block *blk = &qup->blk; qup 924 drivers/i2c/busses/i2c-qup.c struct i2c_msg *msg = qup->msg; qup 928 drivers/i2c/busses/i2c-qup.c while (blk->fifo_available && qup->pos < msg->len) { qup 931 drivers/i2c/busses/i2c-qup.c val = readl(qup->base + QUP_IN_FIFO_BASE); qup 932 drivers/i2c/busses/i2c-qup.c msg->buf[qup->pos++] = val & 0xFF; qup 934 drivers/i2c/busses/i2c-qup.c msg->buf[qup->pos++] = val >> QUP_MSW_SHIFT; qup 940 drivers/i2c/busses/i2c-qup.c if (qup->pos == msg->len) qup 944 drivers/i2c/busses/i2c-qup.c static void qup_i2c_write_rx_tags_v1(struct qup_i2c_dev *qup) qup 946 drivers/i2c/busses/i2c-qup.c struct i2c_msg *msg = qup->msg; qup 955 drivers/i2c/busses/i2c-qup.c writel(val, qup->base + QUP_OUT_FIFO_BASE); qup 958 drivers/i2c/busses/i2c-qup.c static void qup_i2c_conf_v1(struct qup_i2c_dev *qup) qup 960 drivers/i2c/busses/i2c-qup.c struct qup_i2c_block *blk = &qup->blk; qup 965 drivers/i2c/busses/i2c-qup.c blk->total_tx_len > qup->out_fifo_sz ? true : false; qup 967 drivers/i2c/busses/i2c-qup.c blk->total_rx_len > qup->in_fifo_sz ? true : false; qup 971 drivers/i2c/busses/i2c-qup.c writel(0, qup->base + QUP_MX_WRITE_CNT); qup 972 drivers/i2c/busses/i2c-qup.c writel(blk->total_tx_len, qup->base + QUP_MX_OUTPUT_CNT); qup 974 drivers/i2c/busses/i2c-qup.c writel(0, qup->base + QUP_MX_OUTPUT_CNT); qup 975 drivers/i2c/busses/i2c-qup.c writel(blk->total_tx_len, qup->base + QUP_MX_WRITE_CNT); qup 981 drivers/i2c/busses/i2c-qup.c writel(0, qup->base + QUP_MX_READ_CNT); qup 982 drivers/i2c/busses/i2c-qup.c writel(blk->total_rx_len, qup->base + QUP_MX_INPUT_CNT); qup 984 drivers/i2c/busses/i2c-qup.c writel(0, qup->base + QUP_MX_INPUT_CNT); qup 985 drivers/i2c/busses/i2c-qup.c writel(blk->total_rx_len, qup->base + QUP_MX_READ_CNT); qup 991 drivers/i2c/busses/i2c-qup.c writel(qup_config, qup->base + QUP_CONFIG); qup 992 drivers/i2c/busses/i2c-qup.c writel(io_mode, qup->base + QUP_IO_MODE); qup 1002 drivers/i2c/busses/i2c-qup.c static int qup_i2c_conf_xfer_v1(struct qup_i2c_dev *qup, bool is_rx) qup 1004 drivers/i2c/busses/i2c-qup.c struct qup_i2c_block *blk = &qup->blk; qup 1008 drivers/i2c/busses/i2c-qup.c qup_i2c_conf_v1(qup); qup 1009 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_change_state(qup, QUP_RUN_STATE); qup 1013 drivers/i2c/busses/i2c-qup.c writel(qup->clk_ctl, qup->base + QUP_I2C_CLK_CTL); qup 1015 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_change_state(qup, QUP_PAUSE_STATE); qup 1019 drivers/i2c/busses/i2c-qup.c reinit_completion(&qup->xfer); qup 1020 drivers/i2c/busses/i2c-qup.c enable_irq(qup->irq); qup 1022 drivers/i2c/busses/i2c-qup.c blk->tx_fifo_free = qup->out_fifo_sz; qup 1025 drivers/i2c/busses/i2c-qup.c qup_i2c_write_rx_tags_v1(qup); qup 1027 drivers/i2c/busses/i2c-qup.c qup_i2c_write_tx_fifo_v1(qup); qup 1030 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_change_state(qup, QUP_RUN_STATE); qup 1034 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_wait_for_complete(qup, qup->msg); qup 1038 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_bus_active(qup, ONE_BYTE); qup 1041 drivers/i2c/busses/i2c-qup.c disable_irq(qup->irq); qup 1045 drivers/i2c/busses/i2c-qup.c static int qup_i2c_write_one(struct qup_i2c_dev *qup) qup 1047 drivers/i2c/busses/i2c-qup.c struct i2c_msg *msg = qup->msg; qup 1048 drivers/i2c/busses/i2c-qup.c struct qup_i2c_block *blk = &qup->blk; qup 1050 drivers/i2c/busses/i2c-qup.c qup->pos = 0; qup 1054 drivers/i2c/busses/i2c-qup.c return qup_i2c_conf_xfer_v1(qup, false); qup 1057 drivers/i2c/busses/i2c-qup.c static int qup_i2c_read_one(struct qup_i2c_dev *qup) qup 1059 drivers/i2c/busses/i2c-qup.c struct qup_i2c_block *blk = &qup->blk; qup 1061 drivers/i2c/busses/i2c-qup.c qup->pos = 0; qup 1063 drivers/i2c/busses/i2c-qup.c blk->total_rx_len = qup->msg->len; qup 1065 drivers/i2c/busses/i2c-qup.c return qup_i2c_conf_xfer_v1(qup, true); qup 1072 drivers/i2c/busses/i2c-qup.c struct qup_i2c_dev *qup = i2c_get_adapdata(adap); qup 1075 drivers/i2c/busses/i2c-qup.c ret = pm_runtime_get_sync(qup->dev); qup 1079 drivers/i2c/busses/i2c-qup.c qup->bus_err = 0; qup 1080 drivers/i2c/busses/i2c-qup.c qup->qup_err = 0; qup 1082 drivers/i2c/busses/i2c-qup.c writel(1, qup->base + QUP_SW_RESET); qup 1083 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_poll_state(qup, QUP_RESET_STATE); qup 1088 drivers/i2c/busses/i2c-qup.c writel(I2C_MINI_CORE | I2C_N_VAL, qup->base + QUP_CONFIG); qup 1091 drivers/i2c/busses/i2c-qup.c if (qup_i2c_poll_state_i2c_master(qup)) { qup 1101 drivers/i2c/busses/i2c-qup.c qup->msg = &msgs[idx]; qup 1103 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_read_one(qup); qup 1105 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_write_one(qup); qup 1110 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_change_state(qup, QUP_RESET_STATE); qup 1119 drivers/i2c/busses/i2c-qup.c pm_runtime_mark_last_busy(qup->dev); qup 1120 drivers/i2c/busses/i2c-qup.c pm_runtime_put_autosuspend(qup->dev); qup 1129 drivers/i2c/busses/i2c-qup.c static void qup_i2c_conf_count_v2(struct qup_i2c_dev *qup) qup 1131 drivers/i2c/busses/i2c-qup.c struct qup_i2c_block *blk = &qup->blk; qup 1135 drivers/i2c/busses/i2c-qup.c writel(qup->config_run | blk->total_tx_len, qup 1136 drivers/i2c/busses/i2c-qup.c qup->base + QUP_MX_OUTPUT_CNT); qup 1138 drivers/i2c/busses/i2c-qup.c writel(qup->config_run | blk->total_tx_len, qup 1139 drivers/i2c/busses/i2c-qup.c qup->base + QUP_MX_WRITE_CNT); qup 1143 drivers/i2c/busses/i2c-qup.c writel(qup->config_run | blk->total_rx_len, qup 1144 drivers/i2c/busses/i2c-qup.c qup->base + QUP_MX_INPUT_CNT); qup 1146 drivers/i2c/busses/i2c-qup.c writel(qup->config_run | blk->total_rx_len, qup 1147 drivers/i2c/busses/i2c-qup.c qup->base + QUP_MX_READ_CNT); qup 1152 drivers/i2c/busses/i2c-qup.c writel(qup_config, qup->base + QUP_CONFIG); qup 1160 drivers/i2c/busses/i2c-qup.c static void qup_i2c_conf_mode_v2(struct qup_i2c_dev *qup) qup 1162 drivers/i2c/busses/i2c-qup.c struct qup_i2c_block *blk = &qup->blk; qup 1167 drivers/i2c/busses/i2c-qup.c writel(0, qup->base + QUP_MX_WRITE_CNT); qup 1169 drivers/i2c/busses/i2c-qup.c writel(0, qup->base + QUP_MX_OUTPUT_CNT); qup 1174 drivers/i2c/busses/i2c-qup.c writel(0, qup->base + QUP_MX_READ_CNT); qup 1176 drivers/i2c/busses/i2c-qup.c writel(0, qup->base + QUP_MX_INPUT_CNT); qup 1179 drivers/i2c/busses/i2c-qup.c writel(io_mode, qup->base + QUP_IO_MODE); qup 1199 drivers/i2c/busses/i2c-qup.c static void qup_i2c_recv_data(struct qup_i2c_dev *qup) qup 1201 drivers/i2c/busses/i2c-qup.c struct qup_i2c_block *blk = &qup->blk; qup 1208 drivers/i2c/busses/i2c-qup.c blk->rx_fifo_data = readl(qup->base + QUP_IN_FIFO_BASE); qup 1223 drivers/i2c/busses/i2c-qup.c static void qup_i2c_recv_tags(struct qup_i2c_dev *qup) qup 1225 drivers/i2c/busses/i2c-qup.c struct qup_i2c_block *blk = &qup->blk; qup 1227 drivers/i2c/busses/i2c-qup.c blk->rx_fifo_data = readl(qup->base + QUP_IN_FIFO_BASE); qup 1241 drivers/i2c/busses/i2c-qup.c static void qup_i2c_read_rx_fifo_v2(struct qup_i2c_dev *qup) qup 1243 drivers/i2c/busses/i2c-qup.c struct qup_i2c_block *blk = &qup->blk; qup 1246 drivers/i2c/busses/i2c-qup.c qup_i2c_recv_tags(qup); qup 1250 drivers/i2c/busses/i2c-qup.c qup_i2c_recv_data(qup); qup 1261 drivers/i2c/busses/i2c-qup.c qup_i2c_write_blk_data(struct qup_i2c_dev *qup, u8 **data, unsigned int *len) qup 1263 drivers/i2c/busses/i2c-qup.c struct qup_i2c_block *blk = &qup->blk; qup 1271 drivers/i2c/busses/i2c-qup.c qup->base + QUP_OUT_FIFO_BASE); qup 1283 drivers/i2c/busses/i2c-qup.c static void qup_i2c_write_rx_tags_v2(struct qup_i2c_dev *qup) qup 1285 drivers/i2c/busses/i2c-qup.c struct qup_i2c_block *blk = &qup->blk; qup 1287 drivers/i2c/busses/i2c-qup.c qup_i2c_write_blk_data(qup, &blk->cur_tx_tags, &blk->tx_tag_len); qup 1289 drivers/i2c/busses/i2c-qup.c writel(blk->tx_fifo_data, qup->base + QUP_OUT_FIFO_BASE); qup 1314 drivers/i2c/busses/i2c-qup.c static void qup_i2c_write_tx_fifo_v2(struct qup_i2c_dev *qup) qup 1316 drivers/i2c/busses/i2c-qup.c struct qup_i2c_block *blk = &qup->blk; qup 1319 drivers/i2c/busses/i2c-qup.c qup_i2c_write_blk_data(qup, &blk->cur_tx_tags, qup 1327 drivers/i2c/busses/i2c-qup.c qup_i2c_write_blk_data(qup, &blk->cur_data, &blk->cur_blk_len); qup 1341 drivers/i2c/busses/i2c-qup.c writel(blk->tx_fifo_data, qup->base + QUP_OUT_FIFO_BASE); qup 1350 drivers/i2c/busses/i2c-qup.c qup_i2c_conf_xfer_v2(struct qup_i2c_dev *qup, bool is_rx, bool is_first, qup 1353 drivers/i2c/busses/i2c-qup.c struct qup_i2c_block *blk = &qup->blk; qup 1354 drivers/i2c/busses/i2c-qup.c struct i2c_msg *msg = qup->msg; qup 1363 drivers/i2c/busses/i2c-qup.c if (qup->is_smbus_read) { qup 1376 drivers/i2c/busses/i2c-qup.c qup->config_run = is_first ? 0 : QUP_I2C_MX_CONFIG_DURING_RUN; qup 1379 drivers/i2c/busses/i2c-qup.c qup_i2c_conf_count_v2(qup); qup 1383 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_change_state(qup, QUP_RUN_STATE); qup 1387 drivers/i2c/busses/i2c-qup.c writel(qup->clk_ctl, qup->base + QUP_I2C_CLK_CTL); qup 1389 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_change_state(qup, QUP_PAUSE_STATE); qup 1394 drivers/i2c/busses/i2c-qup.c reinit_completion(&qup->xfer); qup 1395 drivers/i2c/busses/i2c-qup.c enable_irq(qup->irq); qup 1401 drivers/i2c/busses/i2c-qup.c blk->tx_fifo_free = qup->out_fifo_sz; qup 1404 drivers/i2c/busses/i2c-qup.c qup_i2c_write_rx_tags_v2(qup); qup 1406 drivers/i2c/busses/i2c-qup.c qup_i2c_write_tx_fifo_v2(qup); qup 1409 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_change_state(qup, QUP_RUN_STATE); qup 1413 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_wait_for_complete(qup, msg); qup 1419 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_change_state(qup, QUP_PAUSE_STATE); qup 1425 drivers/i2c/busses/i2c-qup.c disable_irq(qup->irq); qup 1434 drivers/i2c/busses/i2c-qup.c static int qup_i2c_xfer_v2_msg(struct qup_i2c_dev *qup, int msg_id, bool is_rx) qup 1438 drivers/i2c/busses/i2c-qup.c struct i2c_msg *msg = qup->msg; qup 1439 drivers/i2c/busses/i2c-qup.c struct qup_i2c_block *blk = &qup->blk; qup 1442 drivers/i2c/busses/i2c-qup.c qup->blk_xfer_limit = is_rx ? RECV_MAX_DATA_LEN : QUP_READ_LIMIT; qup 1443 drivers/i2c/busses/i2c-qup.c qup_i2c_set_blk_data(qup, msg); qup 1446 drivers/i2c/busses/i2c-qup.c data_len = qup_i2c_get_data_len(qup); qup 1451 drivers/i2c/busses/i2c-qup.c qup_i2c_set_tags(blk->cur_tx_tags, qup, qup->msg); qup 1464 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_conf_xfer_v2(qup, is_rx, !msg_id && !i, qup 1465 drivers/i2c/busses/i2c-qup.c !qup->is_last || i < blk->count - 1); qup 1471 drivers/i2c/busses/i2c-qup.c !qup->is_smbus_read) { qup 1476 drivers/i2c/busses/i2c-qup.c qup->is_smbus_read = true; qup 1477 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_xfer_v2_msg(qup, msg_id, true); qup 1478 drivers/i2c/busses/i2c-qup.c qup->is_smbus_read = false; qup 1486 drivers/i2c/busses/i2c-qup.c blk->data_len -= qup->blk_xfer_limit; qup 1509 drivers/i2c/busses/i2c-qup.c qup_i2c_determine_mode_v2(struct qup_i2c_dev *qup, qup 1531 drivers/i2c/busses/i2c-qup.c if (!no_dma && qup->is_dma && qup 1532 drivers/i2c/busses/i2c-qup.c (total_len > qup->out_fifo_sz || total_len > qup->in_fifo_sz)) { qup 1533 drivers/i2c/busses/i2c-qup.c qup->use_dma = true; qup 1535 drivers/i2c/busses/i2c-qup.c qup->blk.is_tx_blk_mode = max_tx_len > qup->out_fifo_sz - qup 1537 drivers/i2c/busses/i2c-qup.c qup->blk.is_rx_blk_mode = max_rx_len > qup->in_fifo_sz - qup 1548 drivers/i2c/busses/i2c-qup.c struct qup_i2c_dev *qup = i2c_get_adapdata(adap); qup 1551 drivers/i2c/busses/i2c-qup.c qup->bus_err = 0; qup 1552 drivers/i2c/busses/i2c-qup.c qup->qup_err = 0; qup 1554 drivers/i2c/busses/i2c-qup.c ret = pm_runtime_get_sync(qup->dev); qup 1558 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_determine_mode_v2(qup, msgs, num); qup 1562 drivers/i2c/busses/i2c-qup.c writel(1, qup->base + QUP_SW_RESET); qup 1563 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_poll_state(qup, QUP_RESET_STATE); qup 1568 drivers/i2c/busses/i2c-qup.c writel(I2C_MINI_CORE | I2C_N_VAL_V2, qup->base + QUP_CONFIG); qup 1569 drivers/i2c/busses/i2c-qup.c writel(QUP_V2_TAGS_EN, qup->base + QUP_I2C_MASTER_GEN); qup 1571 drivers/i2c/busses/i2c-qup.c if (qup_i2c_poll_state_i2c_master(qup)) { qup 1576 drivers/i2c/busses/i2c-qup.c if (qup->use_dma) { qup 1577 drivers/i2c/busses/i2c-qup.c reinit_completion(&qup->xfer); qup 1579 drivers/i2c/busses/i2c-qup.c qup->use_dma = false; qup 1581 drivers/i2c/busses/i2c-qup.c qup_i2c_conf_mode_v2(qup); qup 1584 drivers/i2c/busses/i2c-qup.c qup->msg = &msgs[idx]; qup 1585 drivers/i2c/busses/i2c-qup.c qup->is_last = idx == (num - 1); qup 1587 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_xfer_v2_msg(qup, idx, qup 1592 drivers/i2c/busses/i2c-qup.c qup->msg = NULL; qup 1596 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_bus_active(qup, ONE_BYTE); qup 1599 drivers/i2c/busses/i2c-qup.c qup_i2c_change_state(qup, QUP_RESET_STATE); qup 1604 drivers/i2c/busses/i2c-qup.c pm_runtime_mark_last_busy(qup->dev); qup 1605 drivers/i2c/busses/i2c-qup.c pm_runtime_put_autosuspend(qup->dev); qup 1639 drivers/i2c/busses/i2c-qup.c static void qup_i2c_enable_clocks(struct qup_i2c_dev *qup) qup 1641 drivers/i2c/busses/i2c-qup.c clk_prepare_enable(qup->clk); qup 1642 drivers/i2c/busses/i2c-qup.c clk_prepare_enable(qup->pclk); qup 1645 drivers/i2c/busses/i2c-qup.c static void qup_i2c_disable_clocks(struct qup_i2c_dev *qup) qup 1649 drivers/i2c/busses/i2c-qup.c qup_i2c_change_state(qup, QUP_RESET_STATE); qup 1650 drivers/i2c/busses/i2c-qup.c clk_disable_unprepare(qup->clk); qup 1651 drivers/i2c/busses/i2c-qup.c config = readl(qup->base + QUP_CONFIG); qup 1653 drivers/i2c/busses/i2c-qup.c writel(config, qup->base + QUP_CONFIG); qup 1654 drivers/i2c/busses/i2c-qup.c clk_disable_unprepare(qup->pclk); qup 1666 drivers/i2c/busses/i2c-qup.c struct qup_i2c_dev *qup; qup 1676 drivers/i2c/busses/i2c-qup.c qup = devm_kzalloc(&pdev->dev, sizeof(*qup), GFP_KERNEL); qup 1677 drivers/i2c/busses/i2c-qup.c if (!qup) qup 1680 drivers/i2c/busses/i2c-qup.c qup->dev = &pdev->dev; qup 1681 drivers/i2c/busses/i2c-qup.c init_completion(&qup->xfer); qup 1682 drivers/i2c/busses/i2c-qup.c platform_set_drvdata(pdev, qup); qup 1685 drivers/i2c/busses/i2c-qup.c dev_notice(qup->dev, "Using override frequency of %u\n", scl_freq); qup 1688 drivers/i2c/busses/i2c-qup.c ret = device_property_read_u32(qup->dev, "clock-frequency", &clk_freq); qup 1690 drivers/i2c/busses/i2c-qup.c dev_notice(qup->dev, "using default clock-frequency %d", qup 1696 drivers/i2c/busses/i2c-qup.c qup->adap.algo = &qup_i2c_algo; qup 1697 drivers/i2c/busses/i2c-qup.c qup->adap.quirks = &qup_i2c_quirks; qup 1700 drivers/i2c/busses/i2c-qup.c qup->adap.algo = &qup_i2c_algo_v2; qup 1701 drivers/i2c/busses/i2c-qup.c qup->adap.quirks = &qup_i2c_quirks_v2; qup 1703 drivers/i2c/busses/i2c-qup.c if (acpi_match_device(qup_i2c_acpi_match, qup->dev)) qup 1706 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_req_dma(qup); qup 1713 drivers/i2c/busses/i2c-qup.c qup->max_xfer_sg_len = (MX_BLOCKS << 1); qup 1715 drivers/i2c/busses/i2c-qup.c qup->btx.sg = devm_kcalloc(&pdev->dev, qup 1716 drivers/i2c/busses/i2c-qup.c blocks, sizeof(*qup->btx.sg), qup 1718 drivers/i2c/busses/i2c-qup.c if (!qup->btx.sg) { qup 1722 drivers/i2c/busses/i2c-qup.c sg_init_table(qup->btx.sg, blocks); qup 1724 drivers/i2c/busses/i2c-qup.c qup->brx.sg = devm_kcalloc(&pdev->dev, qup 1725 drivers/i2c/busses/i2c-qup.c blocks, sizeof(*qup->brx.sg), qup 1727 drivers/i2c/busses/i2c-qup.c if (!qup->brx.sg) { qup 1731 drivers/i2c/busses/i2c-qup.c sg_init_table(qup->brx.sg, blocks); qup 1736 drivers/i2c/busses/i2c-qup.c qup->start_tag.start = devm_kzalloc(&pdev->dev, qup 1738 drivers/i2c/busses/i2c-qup.c if (!qup->start_tag.start) { qup 1743 drivers/i2c/busses/i2c-qup.c qup->brx.tag.start = devm_kzalloc(&pdev->dev, 2, GFP_KERNEL); qup 1744 drivers/i2c/busses/i2c-qup.c if (!qup->brx.tag.start) { qup 1749 drivers/i2c/busses/i2c-qup.c qup->btx.tag.start = devm_kzalloc(&pdev->dev, 2, GFP_KERNEL); qup 1750 drivers/i2c/busses/i2c-qup.c if (!qup->btx.tag.start) { qup 1754 drivers/i2c/busses/i2c-qup.c qup->is_dma = true; qup 1760 drivers/i2c/busses/i2c-qup.c dev_err(qup->dev, "clock frequency not supported %d\n", qup 1766 drivers/i2c/busses/i2c-qup.c qup->base = devm_ioremap_resource(qup->dev, res); qup 1767 drivers/i2c/busses/i2c-qup.c if (IS_ERR(qup->base)) qup 1768 drivers/i2c/busses/i2c-qup.c return PTR_ERR(qup->base); qup 1770 drivers/i2c/busses/i2c-qup.c qup->irq = platform_get_irq(pdev, 0); qup 1771 drivers/i2c/busses/i2c-qup.c if (qup->irq < 0) { qup 1772 drivers/i2c/busses/i2c-qup.c dev_err(qup->dev, "No IRQ defined\n"); qup 1773 drivers/i2c/busses/i2c-qup.c return qup->irq; qup 1776 drivers/i2c/busses/i2c-qup.c if (has_acpi_companion(qup->dev)) { qup 1777 drivers/i2c/busses/i2c-qup.c ret = device_property_read_u32(qup->dev, qup 1780 drivers/i2c/busses/i2c-qup.c dev_notice(qup->dev, "using default src-clock-hz %d", qup 1783 drivers/i2c/busses/i2c-qup.c ACPI_COMPANION_SET(&qup->adap.dev, ACPI_COMPANION(qup->dev)); qup 1785 drivers/i2c/busses/i2c-qup.c qup->clk = devm_clk_get(qup->dev, "core"); qup 1786 drivers/i2c/busses/i2c-qup.c if (IS_ERR(qup->clk)) { qup 1787 drivers/i2c/busses/i2c-qup.c dev_err(qup->dev, "Could not get core clock\n"); qup 1788 drivers/i2c/busses/i2c-qup.c return PTR_ERR(qup->clk); qup 1791 drivers/i2c/busses/i2c-qup.c qup->pclk = devm_clk_get(qup->dev, "iface"); qup 1792 drivers/i2c/busses/i2c-qup.c if (IS_ERR(qup->pclk)) { qup 1793 drivers/i2c/busses/i2c-qup.c dev_err(qup->dev, "Could not get iface clock\n"); qup 1794 drivers/i2c/busses/i2c-qup.c return PTR_ERR(qup->pclk); qup 1796 drivers/i2c/busses/i2c-qup.c qup_i2c_enable_clocks(qup); qup 1797 drivers/i2c/busses/i2c-qup.c src_clk_freq = clk_get_rate(qup->clk); qup 1804 drivers/i2c/busses/i2c-qup.c writel(1, qup->base + QUP_SW_RESET); qup 1805 drivers/i2c/busses/i2c-qup.c ret = qup_i2c_poll_state_valid(qup); qup 1809 drivers/i2c/busses/i2c-qup.c ret = devm_request_irq(qup->dev, qup->irq, qup_i2c_interrupt, qup 1810 drivers/i2c/busses/i2c-qup.c IRQF_TRIGGER_HIGH, "i2c_qup", qup); qup 1812 drivers/i2c/busses/i2c-qup.c dev_err(qup->dev, "Request %d IRQ failed\n", qup->irq); qup 1815 drivers/i2c/busses/i2c-qup.c disable_irq(qup->irq); qup 1817 drivers/i2c/busses/i2c-qup.c hw_ver = readl(qup->base + QUP_HW_VERSION); qup 1818 drivers/i2c/busses/i2c-qup.c dev_dbg(qup->dev, "Revision %x\n", hw_ver); qup 1820 drivers/i2c/busses/i2c-qup.c io_mode = readl(qup->base + QUP_IO_MODE); qup 1831 drivers/i2c/busses/i2c-qup.c qup->out_blk_sz = blk_sizes[size]; qup 1838 drivers/i2c/busses/i2c-qup.c qup->in_blk_sz = blk_sizes[size]; qup 1846 drivers/i2c/busses/i2c-qup.c qup->in_blk_sz /= 2; qup 1847 drivers/i2c/busses/i2c-qup.c qup->out_blk_sz /= 2; qup 1848 drivers/i2c/busses/i2c-qup.c qup->write_tx_fifo = qup_i2c_write_tx_fifo_v1; qup 1849 drivers/i2c/busses/i2c-qup.c qup->read_rx_fifo = qup_i2c_read_rx_fifo_v1; qup 1850 drivers/i2c/busses/i2c-qup.c qup->write_rx_tags = qup_i2c_write_rx_tags_v1; qup 1852 drivers/i2c/busses/i2c-qup.c qup->write_tx_fifo = qup_i2c_write_tx_fifo_v2; qup 1853 drivers/i2c/busses/i2c-qup.c qup->read_rx_fifo = qup_i2c_read_rx_fifo_v2; qup 1854 drivers/i2c/busses/i2c-qup.c qup->write_rx_tags = qup_i2c_write_rx_tags_v2; qup 1858 drivers/i2c/busses/i2c-qup.c qup->out_fifo_sz = qup->out_blk_sz * (2 << size); qup 1861 drivers/i2c/busses/i2c-qup.c qup->in_fifo_sz = qup->in_blk_sz * (2 << size); qup 1866 drivers/i2c/busses/i2c-qup.c qup->clk_ctl = (hs_div << 8) | (fs_div & 0xff); qup 1870 drivers/i2c/busses/i2c-qup.c qup->clk_ctl = ((fs_div / 2) << 16) | (hs_div << 8) | (fs_div & 0xff); qup 1878 drivers/i2c/busses/i2c-qup.c qup->one_byte_t = one_bit_t * 9; qup 1879 drivers/i2c/busses/i2c-qup.c qup->xfer_timeout = TOUT_MIN * HZ + qup 1880 drivers/i2c/busses/i2c-qup.c usecs_to_jiffies(MX_DMA_TX_RX_LEN * qup->one_byte_t); qup 1882 drivers/i2c/busses/i2c-qup.c dev_dbg(qup->dev, "IN:block:%d, fifo:%d, OUT:block:%d, fifo:%d\n", qup 1883 drivers/i2c/busses/i2c-qup.c qup->in_blk_sz, qup->in_fifo_sz, qup 1884 drivers/i2c/busses/i2c-qup.c qup->out_blk_sz, qup->out_fifo_sz); qup 1886 drivers/i2c/busses/i2c-qup.c i2c_set_adapdata(&qup->adap, qup); qup 1887 drivers/i2c/busses/i2c-qup.c qup->adap.dev.parent = qup->dev; qup 1888 drivers/i2c/busses/i2c-qup.c qup->adap.dev.of_node = pdev->dev.of_node; qup 1889 drivers/i2c/busses/i2c-qup.c qup->is_last = true; qup 1891 drivers/i2c/busses/i2c-qup.c strlcpy(qup->adap.name, "QUP I2C adapter", sizeof(qup->adap.name)); qup 1893 drivers/i2c/busses/i2c-qup.c pm_runtime_set_autosuspend_delay(qup->dev, MSEC_PER_SEC); qup 1894 drivers/i2c/busses/i2c-qup.c pm_runtime_use_autosuspend(qup->dev); qup 1895 drivers/i2c/busses/i2c-qup.c pm_runtime_set_active(qup->dev); qup 1896 drivers/i2c/busses/i2c-qup.c pm_runtime_enable(qup->dev); qup 1898 drivers/i2c/busses/i2c-qup.c ret = i2c_add_adapter(&qup->adap); qup 1905 drivers/i2c/busses/i2c-qup.c pm_runtime_disable(qup->dev); qup 1906 drivers/i2c/busses/i2c-qup.c pm_runtime_set_suspended(qup->dev); qup 1908 drivers/i2c/busses/i2c-qup.c qup_i2c_disable_clocks(qup); qup 1910 drivers/i2c/busses/i2c-qup.c if (qup->btx.dma) qup 1911 drivers/i2c/busses/i2c-qup.c dma_release_channel(qup->btx.dma); qup 1912 drivers/i2c/busses/i2c-qup.c if (qup->brx.dma) qup 1913 drivers/i2c/busses/i2c-qup.c dma_release_channel(qup->brx.dma); qup 1919 drivers/i2c/busses/i2c-qup.c struct qup_i2c_dev *qup = platform_get_drvdata(pdev); qup 1921 drivers/i2c/busses/i2c-qup.c if (qup->is_dma) { qup 1922 drivers/i2c/busses/i2c-qup.c dma_release_channel(qup->btx.dma); qup 1923 drivers/i2c/busses/i2c-qup.c dma_release_channel(qup->brx.dma); qup 1926 drivers/i2c/busses/i2c-qup.c disable_irq(qup->irq); qup 1927 drivers/i2c/busses/i2c-qup.c qup_i2c_disable_clocks(qup); qup 1928 drivers/i2c/busses/i2c-qup.c i2c_del_adapter(&qup->adap); qup 1929 drivers/i2c/busses/i2c-qup.c pm_runtime_disable(qup->dev); qup 1930 drivers/i2c/busses/i2c-qup.c pm_runtime_set_suspended(qup->dev); qup 1937 drivers/i2c/busses/i2c-qup.c struct qup_i2c_dev *qup = dev_get_drvdata(device); qup 1940 drivers/i2c/busses/i2c-qup.c qup_i2c_disable_clocks(qup); qup 1946 drivers/i2c/busses/i2c-qup.c struct qup_i2c_dev *qup = dev_get_drvdata(device); qup 1949 drivers/i2c/busses/i2c-qup.c qup_i2c_enable_clocks(qup); qup 343 drivers/spi/spi-qup.c struct spi_qup *qup = data; qup 345 drivers/spi/spi-qup.c complete(&qup->done); qup 393 drivers/spi/spi-qup.c struct spi_qup *qup = spi_master_get_devdata(master); qup 409 drivers/spi/spi-qup.c desc->callback_param = qup; qup 450 drivers/spi/spi-qup.c struct spi_qup *qup = spi_master_get_devdata(master); qup 466 drivers/spi/spi-qup.c qup->n_words = spi_qup_sgl_get_nents_len(rx_sgl, qup 467 drivers/spi/spi-qup.c SPI_MAX_XFER, &rx_nents) / qup->w_size; qup 469 drivers/spi/spi-qup.c qup->n_words = spi_qup_sgl_get_nents_len(tx_sgl, qup 470 drivers/spi/spi-qup.c SPI_MAX_XFER, &tx_nents) / qup->w_size; qup 471 drivers/spi/spi-qup.c if (!qup->n_words) qup 479 drivers/spi/spi-qup.c ret = spi_qup_set_state(qup, QUP_STATE_RUN); qup 481 drivers/spi/spi-qup.c dev_warn(qup->dev, "cannot set RUN state\n"); qup 501 drivers/spi/spi-qup.c if (!wait_for_completion_timeout(&qup->done, timeout)) qup 518 drivers/spi/spi-qup.c struct spi_qup *qup = spi_master_get_devdata(master); qup 521 drivers/spi/spi-qup.c n_words = qup->n_words; qup 523 drivers/spi/spi-qup.c qup->rx_buf = xfer->rx_buf; qup 524 drivers/spi/spi-qup.c qup->tx_buf = xfer->tx_buf; qup 528 drivers/spi/spi-qup.c qup->n_words = SPI_MAX_XFER; qup 530 drivers/spi/spi-qup.c qup->n_words = n_words % SPI_MAX_XFER; qup 532 drivers/spi/spi-qup.c if (qup->tx_buf && offset) qup 533 drivers/spi/spi-qup.c qup->tx_buf = xfer->tx_buf + offset * SPI_MAX_XFER; qup 535 drivers/spi/spi-qup.c if (qup->rx_buf && offset) qup 536 drivers/spi/spi-qup.c qup->rx_buf = xfer->rx_buf + offset * SPI_MAX_XFER; qup 542 drivers/spi/spi-qup.c if (qup->n_words <= (qup->in_fifo_sz / sizeof(u32))) qup 543 drivers/spi/spi-qup.c qup->mode = QUP_IO_M_MODE_FIFO; qup 549 drivers/spi/spi-qup.c ret = spi_qup_set_state(qup, QUP_STATE_RUN); qup 551 drivers/spi/spi-qup.c dev_warn(qup->dev, "cannot set RUN state\n"); qup 555 drivers/spi/spi-qup.c ret = spi_qup_set_state(qup, QUP_STATE_PAUSE); qup 557 drivers/spi/spi-qup.c dev_warn(qup->dev, "cannot set PAUSE state\n"); qup 561 drivers/spi/spi-qup.c if (qup->mode == QUP_IO_M_MODE_FIFO) qup 562 drivers/spi/spi-qup.c spi_qup_write(qup); qup 564 drivers/spi/spi-qup.c ret = spi_qup_set_state(qup, QUP_STATE_RUN); qup 566 drivers/spi/spi-qup.c dev_warn(qup->dev, "cannot set RUN state\n"); qup 570 drivers/spi/spi-qup.c if (!wait_for_completion_timeout(&qup->done, timeout)) qup 891 drivers/spi/spi-qup.c struct spi_qup *qup = spi_master_get_devdata(master); qup 899 drivers/spi/spi-qup.c if (qup->qup_v1 && (xfer->len % qup->in_blk_sz)) qup 907 drivers/spi/spi-qup.c if (qup->qup_v1 && (xfer->len % qup->out_blk_sz)) qup 912 drivers/spi/spi-qup.c if (n_words <= (qup->in_fifo_sz / sizeof(u32)))