diff options
author | Paul Kocialkowski | 2015-01-14 19:47:06 +0100 |
---|---|---|
committer | Paul Kocialkowski | 2015-07-15 15:06:15 +0200 |
commit | a70e3e716741f7a7d4ca4cf0d0689f9251aa20fb (patch) | |
tree | 757aaa3e011c2afd4da0d4c7e14eb76f9eaf0918 | |
parent | 66f1cd3fbc186ecd8332c297f709254c335571c9 (diff) |
WIP: Video-related stuff
-rw-r--r-- | board/lge/sniper/sniper.c | 160 | ||||
-rw-r--r-- | board/lge/sniper/sniper.h | 17 | ||||
-rw-r--r-- | drivers/video/cfb_console.c | 7 | ||||
-rw-r--r-- | drivers/video/omap3_dss.c | 8 | ||||
-rw-r--r-- | include/configs/sniper.h | 65 |
5 files changed, 239 insertions, 18 deletions
diff --git a/board/lge/sniper/sniper.c b/board/lge/sniper/sniper.c index d26c695df78..bc5df0abda0 100644 --- a/board/lge/sniper/sniper.c +++ b/board/lge/sniper/sniper.c @@ -27,6 +27,7 @@ #include <asm/arch/mem.h> #include <asm/arch/gpio.h> #include <asm/arch/sys_proto.h> +#include <asm/arch/dss.h> #include <asm/mach-types.h> #include <asm/omap_musb.h> #include <linux/usb/ch9.h> @@ -101,6 +102,146 @@ static struct musb_hdrc_platform_data musb_plat = { }; #endif +#define LDO_AB_LEVEL_REG 0x24 +#define LDO_CD_LEVEL_REG 0x25 +#define LDO_ABCD_EN_REG 0x26 +static int aat2862_write_reg(unsigned char addr, unsigned char data) +{ + return i2c_write(0x60, (uint)addr, 1, &data, 1); +} +#if 0 +/* + +#define PANEL_TIMING_H(bp, fp, sw) (DSS_HBP(bp) | DSS_HFP(fp) | DSS_HSW(sw)) +#define PANEL_TIMING_V(bp, fp, sw) (DSS_VBP(bp) | DSS_VFP(fp) | DSS_VSW(sw)) +#define PANEL_LCD_SIZE(xres, yres) ((yres - 1) << 16 | (xres - 1)) +*/ + + .pixel_clock = LCD_PIXEL_CLOCK, + .hfp = 1, //right_margin - 1 + .hsw = 1, //hsync_len - 1 + .hbp = 1, //left_margin - 1 + .vfp = 0, //lower_margin + .vsw = 1, //vsync_len - 1 + .vbp = 0, //upper_margin + +/* + +static int hub_acbi = 0; +static int hub_acb = 0; + +static u32 hub_config = (OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |OMAP_DSS_LCD_IHS); + +#define DSS_IVS (1 << 12) +#define DSS_IHS (1 << 13) +#define DSS_IPC (1 << 14) +#define DSS_IEO (1 << 15) +#define DSS_ONOFF (1 << 17) + + l |= FLD_VAL(ihs, 13, 13); + l |= FLD_VAL(ivs, 12, 12); + + l |= FLD_VAL(acbi, 11, 8); + l |= FLD_VAL(acb, 7, 0); + + + + _dispc_set_pol_freq((config & OMAP_DSS_LCD_ONOFF) != 0, + (config & OMAP_DSS_LCD_RF) != 0, + (config & OMAP_DSS_LCD_IEO) != 0, + (config & OMAP_DSS_LCD_IPC) != 0, + (config & OMAP_DSS_LCD_IHS) != 0, + (config & OMAP_DSS_LCD_IVS) != 0, + acbi, acb); + + dispc_write_reg(DISPC_DIVISOR, + FLD_VAL(lck_div, 23, 16) | FLD_VAL(pck_div, 7, 0) + +dpi_set_dsi_clk -> dispc_set_lcd_divisor +(hub_dsi) dsi_pll_init −> dispc_set_clock_div -> dispc_set_lcd_divisor + + +r = dispc_calc_clock_div(1, 48 * 1000 * 1000, &cinfo); +*/ +#endif +static struct panel_config lcd_cfg = { + .timing_h = PANEL_TIMING_H(1, 1, 1), + .timing_v = PANEL_TIMING_V(0, 0, 1), + .pol_freq = DSS_IVS | DSS_IHS, /* Pol Freq */ +// .divisor = 0x0001000E, + .divisor = 0x10003, +// .divisor = 0x00010033, /* 9 Mhz Pixel Clock */ /* FIXME NOT FROM ANYWHERE */ + .lcd_size = PANEL_LCD_SIZE(480, 800), + .panel_type = ACTIVE_DISPLAY, /* TFT */ + .data_lines = LCD_INTERFACE_24_BIT, /* 24 Bit RGB */ + .load_mode = 0x02, /* Frame Mode */ + .panel_color = 0x00FF8000, // orange, why not? + .gfx_format = GFXFORMAT_RGB24_UNPACKED, +}; + +#if defined(CONFIG_VIDEO) && !defined(CONFIG_SPL_BUILD) +int board_video_init(void) +{ + printf("Trying to contact AAT2870\n"); + + gpio_request(SNIPER_GPIO_LCD_CP_EN, "aat2870_en"); + gpio_direction_output(SNIPER_GPIO_LCD_CP_EN, 0); + gpio_set_value(SNIPER_GPIO_LCD_CP_EN, 1); + + gpio_request(SNIPER_GPIO_LCD_CS, "lcd_cs"); + gpio_direction_output(SNIPER_GPIO_LCD_CS, 0); + gpio_set_value(SNIPER_GPIO_LCD_CS, 1); + + gpio_request(SNIPER_GPIO_LCD_RESET_N, "lcd_reset_n"); + gpio_direction_output(SNIPER_GPIO_LCD_RESET_N, 0); + + printf("LCD reset\n"); + + gpio_set_value(SNIPER_GPIO_LCD_RESET_N, 0); + i2c_set_bus_num(1); + aat2862_write_reg(LDO_AB_LEVEL_REG,0x4A); /* LDOA 1.8V_LCD_IOVCC (1010), LDOB 3.0V_LCD_VCC_VCI (1100) */ + aat2862_write_reg(LDO_CD_LEVEL_REG,0x4C); /* LDOC 1.8V_TOUCH_VDD (0100), LDOD 3.0V_TOUCH_VCPIN (1100) */ + aat2862_write_reg(LDO_ABCD_EN_REG,0x3); /* LDO A & B ON */ + i2c_set_bus_num(0); + mdelay(50); + gpio_set_value(SNIPER_GPIO_LCD_RESET_N, 1); + mdelay(10); + +/* + u8 data = 0; + hub_panel_dcs_read_1(0x0a, &data); + -> dsi_vc_dcs_read(TCH, dcs_cmd, buf, 1); // TCH = 0 + if (data == 0x94) + { + return 1; + } +*/ + // Send commands here + +//SNIPER_GPIO_LCD_RESET_N + + + lcd_cfg.frame_buffer = (void *)0x880000000; + +// CONFIG_VIDEO_OMAP3 + omap3_dss_panel_config(&lcd_cfg); + omap3_dss_enable(); + printf("DSS enable over\n"); + + printf("AAT2862 backlight enable\n"); + + i2c_set_bus_num(1); + aat2862_write_reg(0x0,0xff); /* LCD channel enable */ + aat2862_write_reg(0x03,0xF4); /* LED main group, LED enabled, 22.26 */ + aat2862_write_reg(0x04,0x74); /* LED main group, LED enabled, 22.26 */ + aat2862_write_reg(0x05,0x74); /* LED main group, LED enabled, 30 */ + aat2862_write_reg(0x06,0x74); /* LED main group, LED enabled, 30 */ + i2c_set_bus_num(0); + + return 0; +} +#endif + /* * Routine: misc_init_r * Description: Configure board specific parts @@ -111,6 +252,18 @@ int misc_init_r(void) musb_register(&musb_plat, &musb_board_data, (void *)MUSB_BASE); #endif +/* + for dss, look at LCD_RESET_N: + + omap_set_gpio_direction(HUB_PANEL_LCD_RESET_N, 0); + mdelay(2); + omap_set_gpio_dataout(HUB_PANEL_LCD_RESET_N, 0); + aat2862_ldo_enabled(1); + mdelay(50); + omap_set_gpio_dataout(HUB_PANEL_LCD_RESET_N, 1); + mdelay(10); +*/ + return 0; } @@ -190,3 +343,10 @@ void board_mmc_power_init(void) mdelay(100); /* ramp-up delay from Linux code */ } #endif + +#if defined(CONFIG_USB_ETHER) && defined(CONFIG_MUSB_GADGET) +int board_eth_init(bd_t *bis) +{ + return usb_eth_initialize(bis); +} +#endif diff --git a/board/lge/sniper/sniper.h b/board/lge/sniper/sniper.h index a80ab64d83b..d160cd40d29 100644 --- a/board/lge/sniper/sniper.h +++ b/board/lge/sniper/sniper.h @@ -7,8 +7,11 @@ #ifndef _SNIPER_H_ #define _SNIPER_H_ -#define SNIPER_GPIO_CAM_SUBPM_EN 37 #define SNIPER_GPIO_MICROSD_DET_N 10 +#define SNIPER_GPIO_LCD_RESET_N 34 +#define SNIPER_GPIO_CAM_SUBPM_EN 37 +#define SNIPER_GPIO_LCD_CS 54 +#define SNIPER_GPIO_LCD_CP_EN 62 /* * IEN - Input Enable @@ -109,12 +112,12 @@ MUX_VAL(CP(DSS_HSYNC), (IEN | PTD | EN | M7)) /* SAFE_MODE */ \ MUX_VAL(CP(DSS_VSYNC), (IEN | PTD | EN | M7)) /* SAFE_MODE */ \ MUX_VAL(CP(DSS_ACBIAS), (IEN | PTD | EN | M7)) /* SAFE_MODE */ \ - MUX_VAL(CP(DSS_DATA0), (IDIS | PTD | DIS | M1)) /* DSS_DATA0 */ \ - MUX_VAL(CP(DSS_DATA1), (IDIS | PTD | DIS | M1)) /* DSS_DATA1 */ \ - MUX_VAL(CP(DSS_DATA2), (IDIS | PTD | DIS | M1)) /* DSS_DATA2 */ \ - MUX_VAL(CP(DSS_DATA3), (IDIS | PTD | DIS | M1)) /* DSS_DATA3 */ \ - MUX_VAL(CP(DSS_DATA4), (IDIS | PTD | DIS | M1)) /* DSS_DATA4 */ \ - MUX_VAL(CP(DSS_DATA5), (IDIS | PTD | DIS | M1)) /* DSS_DATA5 */ \ + MUX_VAL(CP(DSS_DATA0), (IDIS | PTD | DIS | M1)) /* DSI_DX0 */ \ + MUX_VAL(CP(DSS_DATA1), (IDIS | PTD | DIS | M1)) /* DSI_DY0 */ \ + MUX_VAL(CP(DSS_DATA2), (IDIS | PTD | DIS | M1)) /* DSI_DX1 */ \ + MUX_VAL(CP(DSS_DATA3), (IDIS | PTD | DIS | M1)) /* DSI_DY1 */ \ + MUX_VAL(CP(DSS_DATA4), (IDIS | PTD | DIS | M1)) /* DSI_DX2 */ \ + MUX_VAL(CP(DSS_DATA5), (IDIS | PTD | DIS | M1)) /* DSI_DY2 */ \ MUX_VAL(CP(DSS_DATA6), (IEN | PTD | EN | M7)) /* SAFE_MODE */ \ MUX_VAL(CP(DSS_DATA7), (IEN | PTD | EN | M7)) /* SAFE_MODE */ \ MUX_VAL(CP(DSS_DATA8), (IEN | PTD | EN | M7)) /* SAFE_MODE */ \ diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 7f2ddc10c62..53baa2f64d5 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -2222,7 +2222,7 @@ static int video_init(void) #ifdef CONFIG_VIDEO_LOGO /* Plot the logo and get start point of console */ - debug("Video: Drawing the logo ...\n"); + printf("Video: Drawing the logo ...\n"); video_console_address = video_logo(); #else video_console_address = video_fb_address; @@ -2260,7 +2260,7 @@ int drv_video_init(void) /* Init video chip - returns with framebuffer cleared */ skip_dev_init = (video_init() == -1); - +printf("skip_dev_init=%d\n", skip_dev_init); if (board_cfb_skip()) return 0; @@ -2298,9 +2298,10 @@ int drv_video_init(void) } #endif + printf("Registering console stdio device\n"); if (stdio_register(&console_dev) != 0) return 0; - + printf("Registered console stdio device\n"); /* Return success */ return 1; } diff --git a/drivers/video/omap3_dss.c b/drivers/video/omap3_dss.c index 6efba122e78..f86ce0fd666 100644 --- a/drivers/video/omap3_dss.c +++ b/drivers/video/omap3_dss.c @@ -132,7 +132,7 @@ void omap3_dss_enable(void) { struct dispc_regs *dispc = (struct dispc_regs *) OMAP3_DISPC_BASE; u32 l; - +printf("%s: All good and enable\n", __func__); l = readl(&dispc->control); l |= LCD_ENABLE | GO_LCD | DIG_ENABLE | GO_DIG | GP_OUT0 | GP_OUT1; writel(l, &dispc->control); @@ -152,16 +152,18 @@ void *video_hw_init(void) static GraphicDevice dssfb; GraphicDevice *pGD = &dssfb; struct dispc_regs *dispc = (struct dispc_regs *) OMAP3_DISPC_BASE; - +printf("%s()\n", __func__); if (board_video_init() || !readl(&dispc->gfx_ba0)) return NULL; - +printf("register reads: 0x%x\n", readl(&dispc->size_lcd)); pGD->winSizeX = (readl(&dispc->size_lcd) & 0x7FF) + 1; pGD->winSizeY = ((readl(&dispc->size_lcd) >> 16) & 0x7FF) + 1; pGD->gdfBytesPP = 4; pGD->gdfIndex = GDF_32BIT_X888RGB; pGD->frameAdrs = readl(&dispc->gfx_ba0); +printf("%s: %dx%d framebuffer at 0x%x\n", __func__, pGD->winSizeX, pGD->winSizeY, pGD->frameAdrs); + return pGD; } #endif diff --git a/include/configs/sniper.h b/include/configs/sniper.h index d561c7e01f5..ef8b455d50e 100644 --- a/include/configs/sniper.h +++ b/include/configs/sniper.h @@ -157,7 +157,6 @@ * USB */ - #define CONFIG_MUSB_GADGET #define CONFIG_USB_MUSB_OMAP2PLUS #define CONFIG_MUSB_PIO_ONLY @@ -173,10 +172,32 @@ #define CONFIG_G_DNL_PRODUCT_NUM 0xd022 #define CONFIG_G_DNL_MANUFACTURER "TI" #define CONFIG_CMD_FASTBOOT -#define CONFIG_ANDROID_BOOT_IMAGE #define CONFIG_USB_FASTBOOT_BUF_ADDR CONFIG_SYS_LOAD_ADDR #define CONFIG_USB_FASTBOOT_BUF_SIZE 0x07000000 + +/* LEGACY USB */ + +/* +#define CONFIG_MUSB_UDC 1 +#define CONFIG_USB_OMAP3 1 +#define CONFIG_TWL4030_USB 1 +#define CONFIG_USB_DEVICE 1 +#define CONFIG_USB_TTY 1 +*/ + +#define CONFIG_ANDROID_BOOT_IMAGE + +/* + * Video + */ + +#define CONFIG_VIDEO +#define CONFIG_CFB_CONSOLE +#define CONFIG_VGA_AS_SINGLE_DEVICE +#define CONFIG_VIDEO_OMAP3 +#define CONFIG_VIDEO_LOGO + /* * Commands */ @@ -212,15 +233,48 @@ #define CONFIG_BOOTDELAY 1 -#define CONFIG_EXTRA_ENV_SETTINGS \ +/* "stdout=vga\0" \ + "stderr=vga\0" \ + "console=vga\0" \ "usbtty=cdc_acm\0" \ "setcon=setenv stdin ${con};" \ "setenv stdout ${con};" \ "setenv stderr ${con}\0" \ "usbcon=setenv con usbtty; run setcon\0" \ - "bootargs=console=ttyO2,115200n8 earlyprintk mem=512M init=/init videoout=omap24xxvout omap_vout.video1_numbuffers=6 omap_vout.vid1_static_vrfb_alloc=y vram=16M omapfb.vram=0:5M lpj=2334720 fuelgauge=g androidboot.hardware=blackg muic_state=0 thermal_fakemode=0 CRC=0x6f889a29" /*root=/dev/ram0 rw initrd=0x81000000,16M ramdisk_size=16384"*/ +*/ + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "setcon=setenv stdin ${con};" \ + "setenv stdout ${con};" \ + "setenv stderr ${con}\0" \ + "usbtty=cdc_acm\0" \ + "usbcon=setenv con usbtty; run setcon\0" \ + "bootargs=console=ttyO2,115200n8 earlyprintk mem=512M init=/init videoout=omap24xxvout omap_vout.video1_numbuffers=6 omap_vout.vid1_static_vrfb_alloc=y vram=16M omapfb.vram=0:5M lpj=2334720 fuelgauge=g androidboot.hardware=blackg muic_state=0 thermal_fakemode=0 CRC=0x6f889a29" #define CONFIG_BOOTCOMMAND \ + "fatload mmc 0 0x81000000 recovery.img;" \ + "bootm 0x81000000;" +/* + "i2c dev 0; i2c probe 0x4a;i2c mw 0x4a 0xaa 0xd5;i2c mw 0x4a 0xab 0x08;i2c mw 0x4a 0xac 0x0b;i2c mw 0x4a 0xad 0x00;i2c mw 0x4a 0xae 0x88; i2c mw 0x4a 0xaf 0x00; i2c mw 0x4a 0xb0 0x00; sleep 1; i2c md 0x4a 0x00 0xff;" \ + +d5 08 0b 00 88 00 D....l.......... + 00b0: 00 + + "fatload mmc 0 0x81000000 recovery.img;" \ + "bootm 0x81000000;" +*/ +/* + "i2c dev 1;" \ + "i2c probe 0x60;" \ + "i2c probe 60;" \ + "mmc help; help mmc; help;" \ + "print bootargs;" \ + "fatload mmc 0 0x81000000 recovery.img;" \ + "bootm 0x81000000" +*/ + +/* "fastboot;"*/ +/* "i2c dev 0;" \ "i2c probe;" \ "i2c dev 1;" \ @@ -228,7 +282,7 @@ "fatload mmc 0 0x81000000 boot.img;" \ "print bootargs;" \ "bootm 0x81000000" - +*/ #define CONFIG_AUTO_COMPLETE 1 #define MTDPARTS_DEFAULT @@ -262,6 +316,7 @@ #define CONFIG_SYS_LOAD_ADDR (OMAP34XX_SDRC_CS0) /* default load */ /* address */ + /* 0x81000000 probably suites better, the kernel base address is 0x80000000 and we want to move it */ /* * OMAP3 has 12 GP timers, they can be driven by the system clock |