1 // SPDX-License-Identifier: GPL-2.0+
4 * Lukasz Majewski, DENX Software Engineering, lukma@denx.de
9 #include <asm/arch/imx-regs.h>
10 #include <asm/arch/sys_proto.h>
11 #include <asm/arch/crm_regs.h>
12 #include <asm/arch/clock.h>
13 #include <asm/arch/iomux-mx53.h>
14 #include <asm/arch/clock.h>
16 #include <power/pmic.h>
18 #include "kp_id_rev.h"
20 #define BOOSTER_OFF IMX_GPIO_NR(2, 23)
21 #define LCD_BACKLIGHT IMX_GPIO_NR(1, 1)
22 #define KEY1 IMX_GPIO_NR(2, 26)
24 DECLARE_GLOBAL_DATA_PTR;
30 size = get_ram_size((void *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE);
36 int dram_init_banksize(void)
38 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
39 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
44 static int power_init(void)
49 ret = pmic_get("mc34708", &dev);
51 printf("%s: mc34708 not found !\n", __func__);
55 /* Set VDDGP to 1.110V for 800 MHz on SW1 */
56 pmic_clrsetbits(dev, REG_SW_0, SWx_VOLT_MASK_MC34708,
59 /* Set VCC as 1.30V on SW2 */
60 pmic_clrsetbits(dev, REG_SW_1, SWx_VOLT_MASK_MC34708,
63 /* Set global reset timer to 4s */
64 pmic_clrsetbits(dev, REG_POWER_CTL2, TIMER_MASK_MC34708,
70 static void setup_clocks(void)
73 u32 ref_clk = MXC_HCLK;
75 * CPU clock set to 800MHz and DDR to 400MHz
77 ret = mxc_set_clock(ref_clk, 800, MXC_ARM_CLK);
79 printf("CPU: Switch CPU clock to 800MHZ failed\n");
81 ret = mxc_set_clock(ref_clk, 400, MXC_PERIPH_CLK);
82 ret |= mxc_set_clock(ref_clk, 400, MXC_DDR_CLK);
84 printf("CPU: Switch DDR clock to 400MHz failed\n");
87 static void setup_ups(void)
89 gpio_request(BOOSTER_OFF, "BOOSTER_OFF");
90 gpio_direction_output(BOOSTER_OFF, 0);
93 int board_early_init_f(void)
99 * Do not overwrite the console
100 * Use always serial for U-Boot console
102 int overwrite_console(void)
109 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
114 void board_disable_display(void)
116 gpio_request(LCD_BACKLIGHT, "LCD_BACKLIGHT");
117 gpio_direction_output(LCD_BACKLIGHT, 0);
120 void board_misc_setup(void)
122 gpio_request(KEY1, "KEY1_GPIO");
123 gpio_direction_input(KEY1);
125 if (gpio_get_value(KEY1))
126 env_set("key1", "off");
128 env_set("key1", "on");
131 int board_late_init(void)
135 board_disable_display();
143 printf("Error %d reading EEPROM content!\n", ret);