diff options
author | Paul Kocialkowski | 2015-02-07 23:52:48 +0100 |
---|---|---|
committer | Paul Kocialkowski | 2015-07-15 15:07:27 +0200 |
commit | 8ef8f165772e43ef774153286d93df431c992986 (patch) | |
tree | c1149263fcdc144c93ba7bf3b1816f86657fbb5d | |
parent | f149924c70610ac8e4a599ba1b929948b762b56d (diff) |
WIP: better muxing, i2c speed, BD2812 support
-rw-r--r-- | board/lge/sniper/sniper.c | 131 | ||||
-rw-r--r-- | board/lge/sniper/sniper.h | 13 | ||||
-rw-r--r-- | include/configs/sniper.h | 7 |
3 files changed, 125 insertions, 26 deletions
diff --git a/board/lge/sniper/sniper.c b/board/lge/sniper/sniper.c index b165b436481..0f66525875e 100644 --- a/board/lge/sniper/sniper.c +++ b/board/lge/sniper/sniper.c @@ -280,29 +280,84 @@ void hub_load_rle565_image(unsigned char* src, unsigned int* dest, int len) extern unsigned int lg_boot_logo[]; #define CONFIG_FB_ADDRESS 0x9FA00000 -/* - * Routine: misc_init_r - * Description: Configure board specific parts - */ -int misc_init_r(void) +struct led_ctrl_data { + unsigned char reg; + unsigned char val; +}; +#define I2C_NO_REG 0xFF +#define BD2802_REG_CLKSETUP 0x00 +#define BD2802_REG_CONTROL 0x01 +#define BD2802_REG1_HOURSETUP 0x02 +#define BD2802_R1_CURRENT1SETUP 0x03 +#define BD2802_R1_CURRENT2SETUP 0x04 +#define BD2802_R1_WAVEPATTERN 0x05 +#define BD2802_G1_CURRENT1SETUP 0x06 +#define BD2802_G1_CURRENT2SETUP 0x07 +#define BD2802_G1_WAVEPATTERN 0x08 +#define BD2802_B1_CURRENT1SETUP 0x09 +#define BD2802_B1_CURRENT2SETUP 0x0A +#define BD2802_B1_WAVEPATTERN 0x0B +#define BD2802_REG2_HOURSETUP 0x0C +#define BD2802_R2_CURRENT1SETUP 0x0D +#define BD2802_R2_CURRENT2SETUP 0x0E +#define BD2802_R2_WAVEPATTERN 0x0F +#define BD2802_G2_CURRENT1SETUP 0x10 +#define BD2802_G2_CURRENT2SETUP 0x11 +#define BD2802_G2_WAVEPATTERN 0x12 +#define BD2802_B2_CURRENT1SETUP 0x13 +#define BD2802_B2_CURRENT2SETUP 0x14 +#define BD2802_B2_WAVEPATTERN 0x15 +#define BD2812_DCDCDRIVER 0x40 +#define BD2812_PIN_FUNC_SETUP 0x41 +static struct led_ctrl_data pwron_on_seq_bd2812[]= { - setenv("serial#", "p970-replicant"); - g_dnl_set_serialnumber("p970-replicant"); -#ifdef CONFIG_USB_MUSB_OMAP2PLUS - musb_register(&musb_plat, &musb_board_data, (void *)MUSB_BASE); -#endif + {BD2802_REG_CLKSETUP,0x00}, + {BD2802_REG_CONTROL,0x11}, + {BD2802_REG1_HOURSETUP,0xF3}, + {BD2802_REG2_HOURSETUP,0xF3}, + {BD2802_R1_CURRENT1SETUP,0x32}, + {BD2802_R1_CURRENT2SETUP,0x32}, + {BD2802_G1_CURRENT1SETUP,0x32}, + {BD2802_G1_CURRENT2SETUP,0x32}, + {BD2802_B1_CURRENT1SETUP,0x00}, + {BD2802_B1_CURRENT2SETUP,0x00}, + {BD2802_R2_CURRENT1SETUP,0x32}, + {BD2802_R2_CURRENT2SETUP,0x32}, + {BD2802_G2_CURRENT1SETUP,0x32}, + {BD2802_G2_CURRENT2SETUP,0x32}, + {BD2802_B2_CURRENT1SETUP,0x00}, + {BD2802_B2_CURRENT2SETUP,0x00}, + {BD2812_DCDCDRIVER,0x00}, + {BD2812_PIN_FUNC_SETUP,0x0F}, + {I2C_NO_REG, 0x00} /* End of array */ +}; -/* - for dss, look at LCD_RESET_N: +int bd2812_setup(void) +{ + int i; - 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); -*/ + gpio_request(SNIPER_GPIO_KEY_LED_RESET, "key_led_reset"); + gpio_direction_output(SNIPER_GPIO_KEY_LED_RESET, 0); + + gpio_set_value(SNIPER_GPIO_KEY_LED_RESET, 1); + udelay(150); + gpio_set_value(SNIPER_GPIO_KEY_LED_RESET, 0); + udelay(150); + gpio_set_value(SNIPER_GPIO_KEY_LED_RESET, 1); + udelay(150); + + i2c_set_bus_num(1); + + for (i = 0; pwron_on_seq_bd2812[i].reg != I2C_NO_REG; i++) { + i2c_write(0x1A, pwron_on_seq_bd2812[i].reg, 1, &pwron_on_seq_bd2812[i].val, 1); + udelay(10); //to be fixed + } + + i2c_set_bus_num(0); +} + +void video_init(void) +{ printf("VIDEO INIT BEGIN\n"); @@ -360,9 +415,45 @@ int misc_init_r(void) printf("VIDEO INIT END\n"); + +} + +/* + * Routine: misc_init_r + * Description: Configure board specific parts + */ +int misc_init_r(void) +{ + setenv("serial#", "p970-replicant"); + g_dnl_set_serialnumber("p970-replicant"); +#ifdef CONFIG_USB_MUSB_OMAP2PLUS + 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); +*/ + + video_init(); + + bd2812_setup(); + return 0; } +u32 get_board_rev(void) +{ + return 10; +} + /* * Routine: set_muxconf_regs * Description: Setting up the configuration Mux registers specific to the diff --git a/board/lge/sniper/sniper.h b/board/lge/sniper/sniper.h index d160cd40d29..9f9cd06ec96 100644 --- a/board/lge/sniper/sniper.h +++ b/board/lge/sniper/sniper.h @@ -12,6 +12,7 @@ #define SNIPER_GPIO_CAM_SUBPM_EN 37 #define SNIPER_GPIO_LCD_CS 54 #define SNIPER_GPIO_LCD_CP_EN 62 +#define SNIPER_GPIO_KEY_LED_RESET 128 /* * IEN - Input Enable @@ -175,9 +176,9 @@ MUX_VAL(CP(MMC1_DAT2), (IEN | PTU | DIS | M0)) /* MMC1_DAT2 */ \ MUX_VAL(CP(MMC1_DAT3), (IEN | PTU | DIS | M0)) /* MMC1_DAT3 */ \ MUX_VAL(CP(MMC1_DAT4), (IEN | PTD | DIS | M7)) /* SAFE_MODE */ \ - MUX_VAL(CP(MMC1_DAT5), (IDIS | PTD | DIS | M4)) /* GPIO_126: OMAP_SEND */ \ - MUX_VAL(CP(MMC1_DAT6), (IDIS | PTD | DIS | M4)) /* GPIO_128: KEY_LED_RESET */ \ - MUX_VAL(CP(MMC1_DAT7), (IEN | PTD | DIS | M4)) /* GPIO_129: MODEM_AP_WAKE */ \ + MUX_VAL(CP(MMC1_DAT5), (IEN | PTD | DIS | M7)) /* SAFE_MODE */ \ + MUX_VAL(CP(MMC1_DAT6), (IEN | PTD | DIS | M7)) /* SAFE_MODE */ \ + MUX_VAL(CP(MMC1_DAT7), (IEN | PTD | DIS | M7)) /* SAFE_MODE */ \ /* MMC2 */ \ MUX_VAL(CP(MMC2_CLK), (IEN | PTD | DIS | M0)) /* MMC2_CLK */ \ MUX_VAL(CP(MMC2_CMD), (IEN | PTD | DIS | M0)) /* MMC2_CMD */ \ @@ -368,6 +369,10 @@ MUX_VAL(CP(D2D_MBUSFLAG), (IEN | PTD | DIS | M0)) /* D2D_MBUSFLAG */ \ MUX_VAL(CP(D2D_SBUSFLAG), (IEN | PTD | DIS | M0)) /* D2D_SBUSFLAG */ \ MUX_VAL(CP(SDRC_CKE0), (IDIS | PTU | DIS | M0)) /* SDRC_CKE0 */ \ - MUX_VAL(CP(SDRC_CKE1), (IDIS | PTU | DIS | M0)) /* SDRC_CKE1 */ + MUX_VAL(CP(SDRC_CKE1), (IDIS | PTU | DIS | M0)) /* SDRC_CKE1 */ \ + MUX_VAL(CP(GPIO127), (IEN | PTD | DIS | M7)) /* SAFE_MODE */ \ + MUX_VAL(CP(GPIO126), (IDIS | PTD | DIS | M4)) /* GPIO_126: OMAP_SEND */ \ + MUX_VAL(CP(GPIO128), (IDIS | PTD | DIS | M4)) /* GPIO_128: KEY_LED_RESET */ \ + MUX_VAL(CP(GPIO129), (IEN | PTD | DIS | M4)) /* GPIO_129: MODEM_AP_WAKE */ #endif diff --git a/include/configs/sniper.h b/include/configs/sniper.h index 7ca51d7c64d..200249487a7 100644 --- a/include/configs/sniper.h +++ b/include/configs/sniper.h @@ -162,13 +162,14 @@ #define CONFIG_OMAP_GPIO #define CONFIG_OMAP3_GPIO_2 +#define CONFIG_OMAP3_GPIO_5 /* * I2C */ #define CONFIG_SYS_I2C -#define CONFIG_SYS_OMAP24_I2C_SPEED 100000 +#define CONFIG_SYS_OMAP24_I2C_SPEED 400000 #define CONFIG_SYS_OMAP24_I2C_SLAVE 1 #define CONFIG_SYS_I2C_OMAP34XX #define CONFIG_I2C_MULTI_BUS @@ -258,7 +259,9 @@ */ #define CONFIG_BOOTCOMMAND \ - "i2c dev 1; i2c md 0x44 0x00 0x10; i2c mw 0x44 0x03 0x00; i2c md 0x44 0x00 0x10; i2c dev 0; fastboot;" + "i2c dev 1; i2c md 0x44 0x00 0x10; i2c mw 0x44 0x03 0x00; i2c md 0x44 0x00 0x10; i2c dev 0;" \ + "load mmc 0 0x82000000 recovery.img;" \ + "bootm 0x82000000;" /* "i2c dev 1; i2c md 0x44 0x00 0x10; i2c mw 0x44 0x03 0x00; i2c md 0x44 0x00 0x10; i2c dev 0; fastboot;" \ |