/* Get Peri Clock */ static int get_lcd_clock(void) { #ifdef DEBUG int lcd_ckc = 0; lcd_ckc = tca_ckc_getperi(PERI_LCD); dbg("[%s]lcd = %d\n", __func__, lcd_ckc); return lcd_ckc/10000; #else return tca_ckc_getperi(PERI_LCD); #endif }
static int get_usb_clock(void) { #ifdef DEBUG int usb = 0; usb = tca_ckc_getperi(PERI_USB11H); dbg("[%s]usb = %d\n", __func__, usb); return usb/10000; #else return tca_ckc_getperi(PERI_USB11H); #endif }
static int get_spi1_clock(void) { #ifdef DEBUG int spi1 = 0; spi1 = tca_ckc_getperi(PERI_SPIMS1); dbg("[%s]spi1 = %d\n", __func__, spi1); return spi1/10000; #else return tca_ckc_getperi(PERI_SPIMS1); #endif }
static int get_uart3_clock(void) { #ifdef DEBUG int uart3 = 0; uart3 = tca_ckc_getperi(PERI_UART3); dbg("[%s]uart3 = %d\n", __func__, uart3); return uart3/10000; #else return tca_ckc_getperi(PERI_UART3); #endif }
static int get_cam_clock(void) { #ifdef DEBUG int cam = 0; cam = tca_ckc_getperi(PERI_CAM); dbg("[%s]cam = %d\n", __func__, cam); return cam/10000; #else return tca_ckc_getperi(PERI_CAM); #endif }
static int get_gpsb3_clock(void) { #if 1 int gpsb3 = 0; gpsb3 = tca_ckc_getperi(PERI_GPSB3); dbg("[%s]gpsb3 = %d\n", __func__, gpsb3); return gpsb3/10000; #else return tca_ckc_getperi(PERI_GPSB3); #endif }
static int get_scaler_clock(void) { #ifdef DEBUG int scaler = 0; scaler = tca_ckc_getperi(PERI_SCALER); dbg("[%s]scaler = %d\n", __func__, scaler); return scaler/10000; #else return tca_ckc_getperi(PERI_SCALER); #endif }
static int get_adc_clock(void) { #if 1 int adc = 0; adc = tca_ckc_getperi(PERI_ADC); dbg("[%s]adc = %d\n", __func__, adc); return adc/10000; #else return tca_ckc_getperi(PERI_ADC); #endif }
static int get_i2c_clock(void) { #ifdef DEBUG int i2c = 0; i2c = tca_ckc_getperi(PERI_I2C); dbg("[%s]i2c = %d\n", __func__, i2c); return i2c/10000; #else return tca_ckc_getperi(PERI_I2C); #endif }
static int get_gpsb1_clock(void) { #ifdef DEBUG int gpsb1 = 0; gpsb1 = tca_ckc_getperi(PERI_GPSB1); dbg("[%s]gpsb1 = %d\n", __func__, gpsb1); return gpsb1/10000; #else return tca_ckc_getperi(PERI_GPSB1); #endif }
static int get_sdmmc_clock(void) { #ifdef DEBUG int sdmmc = 0; sdmmc = tca_ckc_getperi(PERI_SDMMC); dbg("[%s]sdmmc = %d\n", __func__, sdmmc); return sdmmc/10000; #else return tca_ckc_getperi(PERI_SDMMC); #endif }
static int set_gpsb3_clock(int peri_gpsb3) { int gpsb3 = 0; tca_ckc_setperi(PERI_GPSB3, KHz, peri_gpsb3, PCDIRECTPLL0); gpsb3 = tca_ckc_getperi(PERI_GPSB3); dbg("[%s]gpsb3 = %d\n", __func__, gpsb3/10); }
static int set_gpsb2_clock(int peri_gpsb2) { int gpsb2 = 0; tca_ckc_setperi(PERI_GPSB2, KHz, peri_gpsb2, PCDIRECTPLL0); gpsb2 = tca_ckc_getperi(PERI_GPSB2); dbg("[%s]gpsb2 = %d\n", __func__, gpsb2/10); }
static void set_adc_clock(int peri_adc) { int adc = 0; tca_ckc_setperi(PERI_ADC, MHz, peri_adc, PCDIRECTXIN); adc = tca_ckc_getperi(PERI_ADC); dbg("[%s]adc = %d\n", __func__, adc/10000); }
static void set_uart0_clock(int peri_uart0) { tca_ckc_setperi(PERI_UART0, MHz, peri_uart0, PCDIRECTPLL1); #ifdef DEBUG int uart0 = 0; uart0 = tca_ckc_getperi(PERI_UART0); dbg("[%s]uart0 = %d\n", __func__, uart0/1000); #endif }
static void set_uart2_clock(int peri_uart2) { tca_ckc_setperi(PERI_UART2, MHz, peri_uart2, PCDIRECTPLL1); #ifdef DEBUG int uart2 = 0; uart2 = tca_ckc_getperi(PERI_UART2); dbg("[%s]uart2 = %d\n", __func__, uart2/10000); #endif }
static void set_uart1_clock(int peri_uart1) { tca_ckc_setperi(PERI_UART1, MHz, peri_uart1, PCDIRECTPLL1); #ifdef DEBUG int uart1 = 0; uart1 = tca_ckc_getperi(PERI_UART1); dbg("[%s]uart1 = %d\n", __func__, uart1/10000); #endif }
static void set_uart3_clock(int peri_uart3) { tca_ckc_setperi(PERI_UART3, MHz, peri_uart3, PCDIRECTPLL1); #ifdef DEBUG int uart3 = 0; uart3 = tca_ckc_getperi(PERI_UART3); dbg("[%s]uart3 = %d\n", __func__, uart3/10000); #endif }
static void set_i2c_clock(int peri_i2c) { tca_ckc_setperi(PERI_I2C, MHz, peri_i2c, PCDIRECTXIN); #ifdef DEBUG int i2c = 0; i2c = tca_ckc_getperi(PERI_I2C); dbg("[%s]i2c = %d\n", __func__, i2c/10000); #endif }
static void set_usb_clock(int peri_usb) { tca_ckc_setperi(PERI_USB11H, MHz, peri_usb, PCCLKFROM48M); #ifdef DEBUG int usb = 0; usb = tca_ckc_getperi(PERI_USB11H); dbg("[%s]usb = %d\n", __func__, usb/10000); #endif }
static void set_lcd_clock(int peri_lcd) { tca_ckc_setperi(PERI_LCD, MHz, peri_lcd, PCDIRECTPLL2); #ifdef DEBUG int lcd = 0; printk("input lcd freq = %d\n", peri_lcd); lcd = tca_ckc_getperi(PERI_LCD); dbg("[%s]lcd = %d\n", __func__, lcd/10000); #endif }
static void set_gpsb1_clock(int peri_gpsb1) { tca_ckc_setperi(PERI_GPSB1, KHz, peri_gpsb1, PCDIRECTPLL0); #ifdef DEBUG int gpsb1 = 0; gpsb1 = tca_ckc_getperi(PERI_GPSB1); dbg("[%s]gpsb1 = %d\n", __func__, gpsb1/10); #endif }
static void set_gpsb0_clock(int peri_gpsb0) { tca_ckc_setperi(PERI_GPSB0, KHz, peri_gpsb0, PCDIRECTPLL0); #ifdef DEBUG int gpsb0 = 0; gpsb0 = tca_ckc_getperi(PERI_GPSB0); dbg("[%s]gpsb0 = %d\n", __func__, gpsb0/10); #endif }
static void set_scaler_clock(int peri_scaler) { tca_ckc_setperi(PERI_SCALER, MHz, peri_scaler, PCDIRECTPLL2); #ifdef DEBUG int scaler = 0; scaler = tca_ckc_getperi(PERI_SCALER); dbg("[%s]scaler = %d\n", __func__, scaler/10000); #endif }
static void set_spi0_clock(int peri_spi0) { tca_ckc_setperi(PERI_SPIMS0, KHz, peri_spi0, PCDIRECTPLL0); #ifdef DEBUG int spi0 = 0; spi0 = tca_ckc_getperi(PERI_SPIMS0); dbg("[%s]spi0 = %d\n", __func__, spi0/10); #endif }
static void set_spi1_clock(int peri_spi1) { tca_ckc_setperi(PERI_SPIMS1, KHz, peri_spi1, PCDIRECTPLL0); #ifdef DEBUG int spi1 = 0; spi1 = tca_ckc_getperi(PERI_SPIMS1); dbg("[%s]spi1 = %d\n", __func__, spi1/10); #endif }
static void set_sdmmc_clock(int peri_sdmmc) { tca_ckc_setperi(PERI_SDMMC, MHz, peri_sdmmc, PCDIRECTPLL1); #ifdef DEBUG int sdmmc = 0; sdmmc = tca_ckc_getperi(PERI_SDMMC); dbg("[%s]sdmmc = %d\n", __func__, sdmmc/10000); #endif }
static void set_cam_clock(int peri_cam) { tca_ckc_setperi(PERI_CAM, MHz, peri_cam, PCDIRECTPLL2); #ifdef DEBUG int cam = 0; cam = tca_ckc_getperi(PERI_CAM); dbg("[%s]cam = %d\n", __func__, cam/10000); #endif }
static struct lcd_panel * lcdc_io_init(unsigned char lcdc_num) { struct lcd_panel *panel; unsigned int lclk; #if 0 // reset VIOD BITSET(pDDICfg->SWRESET, Hw3); BITSET(pDDICfg->SWRESET, Hw2); BITCLR(pDDICfg->SWRESET, Hw3); BITCLR(pDDICfg->SWRESET, Hw2); #endif// panel = tccfb_get_panel(); panel->dev.power_on = GPIO_LCD_ON; panel->dev.display_on = GPIO_LCD_DISPLAY; panel->dev.bl_on = GPIO_LCD_BL; panel->dev.reset = GPIO_LCD_RESET; panel->dev.lcdc_num = lcdc_num; panel->init(panel); if(lcdc_num) { tca_ckc_setperi(PERI_LCD1,ENABLE, panel->clk_freq * panel->clk_div); lclk = tca_ckc_getperi(PERI_LCD1); } else { tca_ckc_setperi(PERI_LCD0,ENABLE, panel->clk_freq * panel->clk_div); lclk = tca_ckc_getperi(PERI_LCD0); } printf("telechips tcc88xx %s lcdc:%d clk:%d set clk:%d \n", __func__, lcdc_num, panel->clk_freq, lclk); panel->set_power(panel, 1); printf("%s end\n", __func__); return panel; }
static void lcdc_io_init_component(unsigned char lcdc_num, unsigned char type) { unsigned int lcd_reg = 0; unsigned int width, height; stCOMPONENT_SPEC spec; stLTIMING ComponentTiming; stLCDCTR LcdCtrlParam; PVIOC_DISP pDISPBase; PVIOC_WMIX pWIXBase; PDDICONFIG pDDICfg = (PDDICONFIG)HwDDI_CONFIG_BASE; PNTSCPAL pTVE = (PNTSCPAL)HwNTSCPAL_BASE; PGPIO pGPIO = (PGPIO)HwGPIO_BASE; struct fbcon_config *fb_con; printf("%s, lcdc_num=%d, type=%d\n", __func__, lcdc_num, type); if(type >= LCDC_COMPONENT_MAX) type = defalut_component_resolution; #if defined(COMPONENT_CHIP_THS8200) #if defined(TARGET_BOARD_STB) /* THS8200 Power Control - GPIO_F16 */ gpio_set(TCC_GPF(16), 1); #else #endif #endif #ifndef DEFAULT_DISPLAY_OUTPUT_DUAL BITSET(pTVE->DACPD, HwTVEDACPD_PD_EN); #endif component_get_spec(type, &spec); LCDC_IO_Set(lcdc_num, spec.component_bus_width); fb_con = &fb_cfg; if(lcdc_num) { pDISPBase = (VIOC_DISP *)HwVIOC_DISP1; pWIXBase =(VIOC_WMIX *)HwVIOC_WMIX1; tca_ckc_setperi(PERI_LCD1, ENABLE, spec.component_clock*spec.component_divider); //VIOC_OUTCFG_SetOutConfig(VIOC_OUTCFG_MRGB, VIOC_OUTCFG_DISP1); } else { pDISPBase = (VIOC_DISP *)HwVIOC_DISP0; pWIXBase =(VIOC_WMIX *)HwVIOC_WMIX0; tca_ckc_setperi(PERI_LCD0, ENABLE, spec.component_clock*spec.component_divider); //VIOC_OUTCFG_SetOutConfig(VIOC_OUTCFG_MRGB, VIOC_OUTCFG_DISP0); } printf("LCDC0 clk:%d, LCDC1 clk:%d, PLL:%d, divide:%d\n", tca_ckc_getperi(PERI_LCD0), tca_ckc_getperi(PERI_LCD1), tca_ckc_getpll(PCDIRECTPLL0), spec.component_divider); width = spec.component_width; height = spec.component_height; lcdc_set_logo(lcdc_num, width, height, fb_con); ComponentTiming.lpw = spec.component_LPW; ComponentTiming.lpc = spec.component_LPC + 1; ComponentTiming.lswc = spec.component_LSWC + 1; ComponentTiming.lewc = spec.component_LEWC + 1; ComponentTiming.vdb = spec.component_VDB; ComponentTiming.vdf = spec.component_VDF; ComponentTiming.fpw = spec.component_FPW1; ComponentTiming.flc = spec.component_FLC1; ComponentTiming.fswc = spec.component_FSWC1; ComponentTiming.fewc = spec.component_FEWC1; ComponentTiming.fpw2 = spec.component_FPW2; ComponentTiming.flc2 = spec.component_FLC2; ComponentTiming.fswc2 = spec.component_FSWC2; ComponentTiming.fewc2 = spec.component_FEWC2; VIOC_DISP_SetTimingParam(pDISPBase, &ComponentTiming); memset(&LcdCtrlParam, NULL, sizeof(LcdCtrlParam)); switch(type) { case LCDC_COMPONENT_480I_NTSC: case LCDC_COMPONENT_576I_PAL: break; case LCDC_COMPONENT_720P: LcdCtrlParam.r2ymd = 3; LcdCtrlParam.ckg = 1; LcdCtrlParam.id= 0; LcdCtrlParam.iv = 1; LcdCtrlParam.ih = 1; LcdCtrlParam.ip = 0; LcdCtrlParam.pxdw = 12; LcdCtrlParam.ni = 1; break; case LCDC_COMPONENT_1080I: LcdCtrlParam.r2ymd = 3; LcdCtrlParam.ckg = 1; LcdCtrlParam.id= 1; LcdCtrlParam.iv = 1; LcdCtrlParam.ih = 0; LcdCtrlParam.ip = 1; LcdCtrlParam.pxdw = 12; LcdCtrlParam.ni = 0; LcdCtrlParam.tv = 1; break; default: break; } VIOC_DISP_SetControlConfigure(pDISPBase, &LcdCtrlParam); VIOC_DISP_SetSize(pDISPBase, width, height); VIOC_DISP_SetBGColor(pDISPBase, 0, 0 , 0); VIOC_WMIX_SetOverlayPriority(pWIXBase, 0); VIOC_WMIX_SetBGColor(pWIXBase, 0x00, 0x00, 0x00, 0xff); VIOC_WMIX_SetSize(pWIXBase, width, height); VIOC_WMIX_SetUpdate(pWIXBase); #if defined(TARGET_BOARD_STB) /* VE_FIELD: GPIO_E27 */ gpio_config(TCC_GPE(27), GPIO_FN0|GPIO_OUTPUT|GPIO_HIGH); #endif /* Enable Component Chip */ #if defined(COMPONENT_CHIP_CS4954) if(type == LCDC_COMPONENT_480I_NTSC) cs4954_enable(COMPONENT_MODE_NTSC_M); // NTSC_M else cs4954_enable(COMPONENT_MODE_PAL_B); // PAL_B #elif defined(COMPONENT_CHIP_THS8200) if(type == LCDC_COMPONENT_720P) ths8200_enable(COMPONENT_MODE_720P); // 720P else ths8200_enable(COMPONENT_MODE_1080I); // 1080I #endif VIOC_DISP_TurnOn(pDISPBase); }