static int broadcast_tdmb_fc8080_check_chip_id(void)
{
	int rc = ERROR;

	rc = tdmb_fc8080_power_on();

	if(rc == TRUE && !bbm_com_probe(NULL)) //rc == TRUE : power on success,  OK : 0
		rc = OK;
	else
		rc = ERROR;

	tdmb_fc8080_power_off();

	return rc;
}
int tdmb_fc8080_power_on_retry(void)
{
	int res;
	int i;

	tdmb_fc8080_interrupt_lock();

	for(i = 0 ; i < 10; i++)
	{
		printk("[FC8080] tdmb_fc8080_power_on_retry :  %d\n", i);
#ifdef FEATURE_DMB_USE_XO
		if(fc8080_ctrl_info.clk != NULL) {
			clk_disable_unprepare(fc8080_ctrl_info.clk);
			printk("[FC8080] retry clk_disable %d\n", i);
		}
		else
			printk("[FC8080] ERR fc8080_ctrl_info.clkdis is NULL\n");
#endif
		gpio_set_value(fc8080_ctrl_info.dmb_en, 0);
		mdelay(150);


		gpio_set_value(fc8080_ctrl_info.dmb_en, 1);
		mdelay(5);
#ifdef FEATURE_DMB_USE_XO
		if(fc8080_ctrl_info.clk != NULL) {
			res = clk_prepare_enable(fc8080_ctrl_info.clk);
			if (res) {
				printk("[FC8080] retry clk_prepare_enable fail %d\n", i);
			}
		}
		else
			printk("[FC8080] ERR fc8080_ctrl_info.clken is NULL\n");
#endif
		mdelay(30);

		res = bbm_com_probe(NULL);

		if (!res)
			break;

	}

	tdmb_fc8080_interrupt_free();

	return res;
}
Esempio n. 3
0
unsigned char dmb_drv_init(void)
{
#ifdef FEATURE_INTERFACE_TEST_MODE
	int i;
	u8 data;
	u16 wdata;
	u32 ldata;
	u8 temp = 0x1e;
#endif

#ifdef CONFIG_TDMB_SPI
	if (bbm_com_hostif_select(NULL, BBM_SPI))
		return TDMB_FAIL;
#elif defined(CONFIG_TDMB_EBI)
	if (bbm_com_hostif_select(NULL, BBM_PPI))
		return TDMB_FAIL;
#endif

	/* check for factory  chip interface test */
	if (bbm_com_probe(NULL) != BBM_OK) {
		DPRINTK("%s : BBM_PROBE fail\n", __func__);
		return TDMB_FAIL;
	}

	bbm_com_fic_callback_register(0, tdmb_interrupt_fic_callback);
	bbm_com_msc_callback_register(0, tdmb_interrupt_msc_callback);

	bbm_com_init(NULL);
	bbm_com_tuner_select(NULL, FC8050_TUNER, BAND3_TYPE);

#ifdef FEATURE_INTERFACE_TEST_MODE
	for (i = 0; i < 1000; i++) {
		bbm_com_write(NULL, 0x05, i & 0xff);
		bbm_com_read(NULL, 0x05, &data);
		if ((i & 0xff) != data)
			DPRINTK("FC8000 byte test (0x%x,0x%x)\r\n"
			, i & 0xff, data);
	}
	for (i = 0; i < 1000; i++) {
		bbm_com_word_write(NULL, 0x0210, i & 0xffff);
		bbm_com_word_read(NULL, 0x0210, &wdata);
		if ((i & 0xffff) != wdata)
			DPRINTK("FC8000 word test (0x%x,0x%x)\r\n"
			, i & 0xffff, wdata);
	}
	for (i = 0; i < 1000; i++) {
		bbm_com_long_write(NULL, 0x0210, i & 0xffffffff);
		bbm_com_long_read(NULL, 0x0210, &ldata);
		if ((i & 0xffffffff) != ldata)
			DPRINTK("FC8000 long test (0x%x,0x%x)\r\n"
			, i & 0xffffffff, ldata);
	}
	for (i = 0; i < 1000; i++) {
		temp = i&0xff;
		bbm_com_tuner_write(NULL, 0x12, 0x01, &temp, 0x01);
		bbm_com_tuner_read(NULL, 0x12, 0x01, &data, 0x01);
		if ((i & 0xff) != data)
			DPRINTK("FC8000 tuner test (0x%x,0x%x)\r\n"
			, i & 0xff, data);
	}
	temp = 0x51;
	bbm_com_tuner_write(NULL, 0x12, 0x01, &temp, 0x01);
#endif

	saved_ber = 3000;
	dmb_initialize = 1;

	return TDMB_SUCCESS;
}