• Abhishek Sahu's avatar
    i2c: qup: reorganization of driver code to remove polling for qup v1 · fbfab1ab
    Abhishek Sahu authored
    Following are the major issues in current driver code
    
    1. The current driver simply assumes the transfer completion
       whenever its gets any non-error interrupts and then simply do the
       polling of available/free bytes in FIFO.
    2. The block mode is not working properly since no handling in
       being done for OUT_BLOCK_WRITE_REQ and IN_BLOCK_READ_REQ.
    
    Because of above, i2c v1 transfers of size greater than 32 are failing
    with following error message
    
    	i2c_qup 78b6000.i2c: timeout for fifo out full
    
    To make block mode working properly and move to use the interrupts
    instead of polling, major code reorganization is required. Following
    are the major changes done in this patch
    
    1. Remove the polling of TX FIFO free space and RX FIFO available
       bytes and move to interrupts completely. QUP has QUP_MX_OUTPUT_DONE,
       QUP_MX_INPUT_DONE, OUT_BLOCK_WRITE_REQ and IN_BLOCK_READ_REQ
       interrupts to handle FIFO’s properly so check all these interrupts.
    2. During write, For FIFO mode, TX FIFO can be directly written
       without checking for FIFO space. For block mode, the QUP will generate
       OUT_BLOCK_WRITE_REQ interrupt whenever it has block size of available
       space.
    3. During read, both TX and RX FIFO will be used. TX will be used
       for writing tags and RX will be used for receiving the data. In QUP,
       TX and RX can operate in separate mode so configure modes accordingly.
    4. For read FIFO mode, wait for QUP_MX_INPUT_DONE interrupt which
       will be generated after all the bytes have been copied in RX FIFO. For
       read Block mode, QUP will generate IN_BLOCK_READ_REQ interrupts
       whenever it has block size of available data.
    Signed-off-by: default avatarAbhishek Sahu <absahu@codeaurora.org>
    Reviewed-by: default avatarSricharan R <sricharan@codeaurora.org>
    Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
    fbfab1ab
i2c-qup.c 42.3 KB