aboutsummaryrefslogtreecommitdiff
path: root/board/lge/sniper/sniper.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/lge/sniper/sniper.c')
-rw-r--r--board/lge/sniper/sniper.c160
1 files changed, 160 insertions, 0 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