static int dump_ccci_reg()
{
	int fd, i;
	unsigned char *base;
	unsigned int k;

	fd = open(MEM_DEV_PATH, O_RDWR);
	if (fd < 0) {
		ALOGD("MEM_DEV_PATH open failed");
		return 1;
	}

	base = (unsigned char *) mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, CCIF_BASE);
	if (base == MAP_FAILED) {
		ALOGD("mmap failed");
		return 1;
	}

	ALOGD("CCIF_CON    (0x%p) = %X\n", CCIF_CON(base), *CCIF_CON(base));
	ALOGD("CCIF_BUSY   (0x%p) = %X\n", CCIF_BUSY(base), *CCIF_BUSY(base));
	ALOGD("CCIF_START  (0x%p) = %X\n", CCIF_START(base), *CCIF_START(base));
	ALOGD("CCIF_RCHNUM (0x%p) = %X\n", CCIF_RCHNUM(base), *CCIF_RCHNUM(base));

	munmap(base, CCIF_BASE);
	close(fd);

	return 0;
}
예제 #2
0
static int  __ccif_v1_write_phy_ch_data(ccif_t* ccif, unsigned int buf[], int retry_en)
{
    int             ret = 0;
    unsigned int    busy;
    unsigned long    flag;
    unsigned int    retry_count = 200;
    unsigned int    ch;
    ccif_msg_t        *tx_msg;
    int md_id = ccif->m_md_id;

    CCCI_FUNC_ENTRY(md_id);
    if(retry_en == 0)
        retry_count = 1;

    do{
        spin_lock_irqsave(&ccif->m_lock, flag);
        busy=ccci_read32(CCIF_BUSY(ccif->m_reg_base));

        ch = ccif->m_tx_idx;
        if (busy&(1<<ch)) {                
            ret = -CCCI_ERR_CCIF_NO_PHYSICAL_CHANNEL;
            if (busy != 0xff) {
                CCCI_DBG_MSG(md_id, "cci", "Wrong Busy value: 0x%X\n", busy);
            }
            spin_unlock_irqrestore(&ccif->m_lock,flag);
            
            udelay(1);
            retry_count--;
        } else {
            ccci_write32(CCIF_BUSY(ccif->m_reg_base), 1<<ch);
            ccif->m_tx_idx++;
            ccif->m_tx_idx &= (CCIF_STD_V1_MAX_CH_NUM-1);
            //spin_unlock_irqrestore(&ccif->m_lock,flag);
            
            //mb(); // Note here, make sure data has write to memory be really send
            tx_msg = (ccif_msg_t*)(CCIF_TXCHDATA(ccif->m_reg_base));
            ccci_write32(&(tx_msg[ch].data[0]), buf[0]);
            ccci_write32(&(tx_msg[ch].data[1]), buf[1]);
            ccci_write32(&(tx_msg[ch].channel), buf[2]);
            ccci_write32(&(tx_msg[ch].reserved), buf[3]);
            //mb();

            ccci_write32(CCIF_TCHNUM(ccif->m_reg_base), ch);
            
            spin_unlock_irqrestore(&ccif->m_lock,flag);

            ret = sizeof(ccif_msg_t);
            break;
        }
    }while(retry_count>0);

    if(lg_ch_tx_debug_enable[md_id] & (1<< buf[2])) 
        CCCI_MSG_INF(md_id, "cci", "[TX]: %08X, %08X, %02d, %08X (%02d)\n",
             buf[0], buf[1], buf[2], buf[3], ch);

    return ret;
}
예제 #3
0
static int __ccif_v1_dump_reg(ccif_t* ccif, unsigned int buf[], int len)
{
    int i,j;
    volatile unsigned int *curr_ccif_smem_addr = (volatile unsigned int *)CCIF_TXCHDATA(ccif->m_reg_base);

    CCCI_DBG_MSG(ccif->m_md_id, "cci", "[CCCI REG_INFO]\n");
    CCCI_DBG_MSG(ccif->m_md_id, "cci", "CON(%lx)=%08X, BUSY(%lx)=%08x, START(%lx)=%08x, MRCHNUM(%lx)=%08x\n", 
                    CCIF_CON(ccif->m_reg_base), ccci_read32(CCIF_CON(ccif->m_reg_base)),
                    CCIF_BUSY(ccif->m_reg_base), ccci_read32(CCIF_BUSY(ccif->m_reg_base)),
                    CCIF_START(ccif->m_reg_base), ccci_read32(CCIF_START(ccif->m_reg_base)),
                    MD_CCIF_RCHNUM(ccif->m_md_reg_base), ccci_read32(MD_CCIF_RCHNUM(ccif->m_md_reg_base)));
    CCCI_DBG_MSG(ccif->m_md_id, "cci", "MCON(%lx)=%08X, MBUSY(%lx)=%08x, MSTART(%lx)=%08x, RCHNUM(%lx)=%08x\n", 
                    MD_CCIF_CON(ccif->m_md_reg_base), ccci_read32(MD_CCIF_CON(ccif->m_md_reg_base)),
                    MD_CCIF_BUSY(ccif->m_md_reg_base), ccci_read32(MD_CCIF_BUSY(ccif->m_md_reg_base)),
                    MD_CCIF_START(ccif->m_md_reg_base), ccci_read32(MD_CCIF_START(ccif->m_md_reg_base)),
                    CCIF_RCHNUM(ccif->m_reg_base), ccci_read32(CCIF_RCHNUM(ccif->m_reg_base)));

    for(i=0; i<16; i++){
        CCCI_DBG_MSG(ccif->m_md_id, "cci", "%08X: %08X %08X %08X %08X\n", (unsigned int)curr_ccif_smem_addr, \
            curr_ccif_smem_addr[0], curr_ccif_smem_addr[1],
            curr_ccif_smem_addr[2], curr_ccif_smem_addr[3]);
        curr_ccif_smem_addr+=4;
    }

    if(buf == NULL || len < (4*16+8)){
        // Only dump by log
        return 0;
    }else{
        j=0;
        buf[j++] = ccci_read32(CCIF_CON(ccif->m_reg_base));
        buf[j++] = ccci_read32(CCIF_BUSY(ccif->m_reg_base));
        buf[j++] = ccci_read32(CCIF_START(ccif->m_reg_base));
        buf[j++] = ccci_read32(MD_CCIF_RCHNUM(ccif->m_reg_base));
        
        buf[j++] = ccci_read32(MD_CCIF_CON(ccif->m_reg_base));
        buf[j++] = ccci_read32(MD_CCIF_BUSY(ccif->m_reg_base));
        buf[j++] = ccci_read32(MD_CCIF_START(ccif->m_reg_base));
        buf[j++] = ccci_read32(CCIF_RCHNUM(ccif->m_reg_base));
        curr_ccif_smem_addr = (volatile unsigned int *)CCIF_TXCHDATA(ccif->m_reg_base);
        for(i=0; i<4*16; i++)
            buf[j++] = curr_ccif_smem_addr[i];
    }

    return j;
}
예제 #4
0
static void __ccif_v1_set_busy_state(ccif_t* ccif, unsigned int val)
{
    //*CCIF_BUSY(ccif->m_reg_base) = val;
    ccci_write32(CCIF_BUSY(ccif->m_reg_base), val);
}
예제 #5
0
static int  __ccif_v1_get_busy_state(ccif_t* ccif)
{
    return ccci_read32(CCIF_BUSY(ccif->m_reg_base));
}