summaryrefslogtreecommitdiff
path: root/board/BuR/common/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/BuR/common/common.c')
-rw-r--r--board/BuR/common/common.c225
1 files changed, 0 insertions, 225 deletions
diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c
index 78bf7d6228..3c78020bf9 100644
--- a/board/BuR/common/common.c
+++ b/board/BuR/common/common.c
@@ -14,7 +14,6 @@
#include <env.h>
#include <fdtdec.h>
#include <i2c.h>
-#include <lcd.h>
#include <asm/global_data.h>
#include <linux/delay.h>
#include "bur_common.h"
@@ -22,230 +21,6 @@
DECLARE_GLOBAL_DATA_PTR;
/* --------------------------------------------------------------------------*/
-#if defined(CONFIG_LCD) && defined(CONFIG_AM335X_LCD) && \
- !defined(CONFIG_DM_VIDEO) && !defined(CONFIG_SPL_BUILD)
-#include <asm/arch/hardware.h>
-#include <asm/arch/cpu.h>
-#include <asm/gpio.h>
-#include <power/tps65217.h>
-#include "../../../drivers/video/ti/am335x-fb.h"
-
-void lcdbacklight(int on)
-{
- unsigned int driver = env_get_ulong("ds1_bright_drv", 16, 0UL);
- unsigned int bright = env_get_ulong("ds1_bright_def", 10, 50);
- unsigned int pwmfrq = env_get_ulong("ds1_pwmfreq", 10, ~0UL);
- unsigned int tmp;
- struct gptimer *timerhw;
-
- if (on)
- bright = bright != ~0UL ? bright : 50;
- else
- bright = 0;
-
- switch (driver) {
- case 2:
- timerhw = (struct gptimer *)DM_TIMER5_BASE;
- break;
- default:
- timerhw = (struct gptimer *)DM_TIMER6_BASE;
- }
-
- switch (driver) {
- case 0: /* PMIC LED-Driver */
- /* brightness level */
- tps65217_reg_write(TPS65217_PROT_LEVEL_NONE,
- TPS65217_WLEDCTRL2, bright, 0xFF);
- /* current sink */
- tps65217_reg_write(TPS65217_PROT_LEVEL_NONE,
- TPS65217_WLEDCTRL1,
- bright != 0 ? 0x0A : 0x02,
- 0xFF);
- break;
- case 1:
- case 2: /* PWM using timer */
- if (pwmfrq != ~0UL) {
- timerhw->tiocp_cfg = TCFG_RESET;
- udelay(10);
- while (timerhw->tiocp_cfg & TCFG_RESET)
- ;
- tmp = ~0UL-(V_OSCK/pwmfrq); /* bottom value */
- timerhw->tldr = tmp;
- timerhw->tcrr = tmp;
- tmp = tmp + ((V_OSCK/pwmfrq)/100) * bright;
- timerhw->tmar = tmp;
- timerhw->tclr = (TCLR_PT | (2 << TCLR_TRG_SHIFT) |
- TCLR_CE | TCLR_AR | TCLR_ST);
- } else {
- puts("invalid pwmfrq in env/dtb! skip PWM-setup.\n");
- }
- break;
- default:
- puts("no suitable backlightdriver in env/dtb!\n");
- break;
- }
-}
-
-int load_lcdtiming(struct am335x_lcdpanel *panel)
-{
- struct am335x_lcdpanel pnltmp;
-
- pnltmp.hactive = env_get_ulong("ds1_hactive", 10, ~0UL);
- pnltmp.vactive = env_get_ulong("ds1_vactive", 10, ~0UL);
- pnltmp.bpp = env_get_ulong("ds1_bpp", 10, ~0UL);
- pnltmp.hfp = env_get_ulong("ds1_hfp", 10, ~0UL);
- pnltmp.hbp = env_get_ulong("ds1_hbp", 10, ~0UL);
- pnltmp.hsw = env_get_ulong("ds1_hsw", 10, ~0UL);
- pnltmp.vfp = env_get_ulong("ds1_vfp", 10, ~0UL);
- pnltmp.vbp = env_get_ulong("ds1_vbp", 10, ~0UL);
- pnltmp.vsw = env_get_ulong("ds1_vsw", 10, ~0UL);
- pnltmp.pxl_clk = env_get_ulong("ds1_pxlclk", 10, ~0UL);
- pnltmp.pol = env_get_ulong("ds1_pol", 16, ~0UL);
- pnltmp.pup_delay = env_get_ulong("ds1_pupdelay", 10, ~0UL);
- pnltmp.pon_delay = env_get_ulong("ds1_tondelay", 10, ~0UL);
- panel_info.vl_rot = env_get_ulong("ds1_rotation", 10, 0);
-
- if (
- ~0UL == (pnltmp.hactive) ||
- ~0UL == (pnltmp.vactive) ||
- ~0UL == (pnltmp.bpp) ||
- ~0UL == (pnltmp.hfp) ||
- ~0UL == (pnltmp.hbp) ||
- ~0UL == (pnltmp.hsw) ||
- ~0UL == (pnltmp.vfp) ||
- ~0UL == (pnltmp.vbp) ||
- ~0UL == (pnltmp.vsw) ||
- ~0UL == (pnltmp.pxl_clk) ||
- ~0UL == (pnltmp.pol) ||
- ~0UL == (pnltmp.pup_delay) ||
- ~0UL == (pnltmp.pon_delay)
- ) {
- puts("lcd-settings in env/dtb incomplete!\n");
- printf("display-timings:\n"
- "================\n"
- "hactive: %d\n"
- "vactive: %d\n"
- "bpp : %d\n"
- "hfp : %d\n"
- "hbp : %d\n"
- "hsw : %d\n"
- "vfp : %d\n"
- "vbp : %d\n"
- "vsw : %d\n"
- "pxlclk : %d\n"
- "pol : 0x%08x\n"
- "pondly : %d\n",
- pnltmp.hactive, pnltmp.vactive, pnltmp.bpp,
- pnltmp.hfp, pnltmp.hbp, pnltmp.hsw,
- pnltmp.vfp, pnltmp.vbp, pnltmp.vsw,
- pnltmp.pxl_clk, pnltmp.pol, pnltmp.pon_delay);
-
- return -1;
- }
- debug("lcd-settings in env complete, taking over.\n");
- memcpy((void *)panel,
- (void *)&pnltmp,
- sizeof(struct am335x_lcdpanel));
-
- return 0;
-}
-
-static void br_summaryscreen_printenv(char *prefix,
- char *name, char *altname,
- char *suffix)
-{
- char *envval = env_get(name);
- if (0 != envval) {
- lcd_printf("%s %s %s", prefix, envval, suffix);
- } else if (0 != altname) {
- envval = env_get(altname);
- if (0 != envval)
- lcd_printf("%s %s %s", prefix, envval, suffix);
- } else {
- lcd_printf("\n");
- }
-}
-
-void br_summaryscreen(void)
-{
- br_summaryscreen_printenv(" - B&R -", "br_orderno", 0, "-\n");
- br_summaryscreen_printenv(" Serial/Rev :", "br_serial", 0, "\n");
- br_summaryscreen_printenv(" MAC1 :", "br_mac1", "ethaddr", "\n");
- br_summaryscreen_printenv(" MAC2 :", "br_mac2", 0, "\n");
- lcd_puts(" Bootloader : " PLAIN_VERSION "\n");
- lcd_puts("\n");
-}
-
-void lcdpower(int on)
-{
- u32 pin, swval, i;
- char buf[16] = { 0 };
-
- pin = env_get_ulong("ds1_pwr", 16, ~0UL);
-
- if (pin == ~0UL) {
- puts("no pwrpin in dtb/env, cannot powerup display!\n");
- return;
- }
-
- for (i = 0; i < 3; i++) {
- if (pin != 0) {
- snprintf(buf, sizeof(buf), "ds1_pwr#%d", i);
- if (gpio_request(pin & 0x7F, buf) != 0) {
- printf("%s: not able to request gpio %s",
- __func__, buf);
- continue;
- }
- swval = pin & 0x80 ? 0 : 1;
- if (on)
- gpio_direction_output(pin & 0x7F, swval);
- else
- gpio_direction_output(pin & 0x7F, !swval);
-
- debug("switched pin %d to %d\n", pin & 0x7F, swval);
- }
- pin >>= 8;
- }
-}
-
-vidinfo_t panel_info = {
- .vl_col = 1366, /*
- * give full resolution for allocating enough
- * memory
- */
- .vl_row = 768,
- .vl_bpix = 5,
- .priv = 0
-};
-
-void lcd_ctrl_init(void *lcdbase)
-{
- struct am335x_lcdpanel lcd_panel;
-
- memset(&lcd_panel, 0, sizeof(struct am335x_lcdpanel));
- if (load_lcdtiming(&lcd_panel) != 0)
- return;
-
- lcd_panel.panel_power_ctrl = &lcdpower;
-
- if (0 != am335xfb_init(&lcd_panel))
- printf("ERROR: failed to initialize video!");
- /*
- * modifiy panel info to 'real' resolution, to operate correct with
- * lcd-framework.
- */
- panel_info.vl_col = lcd_panel.hactive;
- panel_info.vl_row = lcd_panel.vactive;
-
- lcd_set_flush_dcache(1);
-}
-
-void lcd_enable(void)
-{
- br_summaryscreen();
- lcdbacklight(1);
-}
-#endif /* CONFIG_LCD */
int ft_board_setup(void *blob, struct bd_info *bd)
{