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 VBUS_PWR_EN IMX_GPIO_NR(7, 8)
21 #define BOOSTER_OFF IMX_GPIO_NR(2, 23)
22 #define LCD_BACKLIGHT IMX_GPIO_NR(1, 1)
23 #define KEY1 IMX_GPIO_NR(2, 26)
25 DECLARE_GLOBAL_DATA_PTR;
31 size = get_ram_size((void *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE);
37 int dram_init_banksize(void)
39 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
40 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
45 #ifdef CONFIG_USB_EHCI_MX5
46 int board_ehci_hcd_init(int port)
48 gpio_request(VBUS_PWR_EN, "VBUS_PWR_EN");
49 gpio_direction_output(VBUS_PWR_EN, 1);
54 static int power_init(void)
59 ret = pmic_get("mc34708", &dev);
61 printf("%s: mc34708 not found !\n", __func__);
65 /* Set VDDGP to 1.110V for 800 MHz on SW1 */
66 pmic_clrsetbits(dev, REG_SW_0, SWx_VOLT_MASK_MC34708,
69 /* Set VCC as 1.30V on SW2 */
70 pmic_clrsetbits(dev, REG_SW_1, SWx_VOLT_MASK_MC34708,
73 /* Set global reset timer to 4s */
74 pmic_clrsetbits(dev, REG_POWER_CTL2, TIMER_MASK_MC34708,
80 static void setup_clocks(void)
83 u32 ref_clk = MXC_HCLK;
85 * CPU clock set to 800MHz and DDR to 400MHz
87 ret = mxc_set_clock(ref_clk, 800, MXC_ARM_CLK);
89 printf("CPU: Switch CPU clock to 800MHZ failed\n");
91 ret = mxc_set_clock(ref_clk, 400, MXC_PERIPH_CLK);
92 ret |= mxc_set_clock(ref_clk, 400, MXC_DDR_CLK);
94 printf("CPU: Switch DDR clock to 400MHz failed\n");
97 static void setup_ups(void)
99 gpio_request(BOOSTER_OFF, "BOOSTER_OFF");
100 gpio_direction_output(BOOSTER_OFF, 0);
103 int board_early_init_f(void)
109 * Do not overwrite the console
110 * Use always serial for U-Boot console
112 int overwrite_console(void)
119 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
124 void board_disable_display(void)
126 gpio_request(LCD_BACKLIGHT, "LCD_BACKLIGHT");
127 gpio_direction_output(LCD_BACKLIGHT, 0);
130 void board_misc_setup(void)
132 gpio_request(KEY1, "KEY1_GPIO");
133 gpio_direction_input(KEY1);
135 if (gpio_get_value(KEY1))
136 env_set("key1", "off");
138 env_set("key1", "on");
141 int board_late_init(void)
145 board_disable_display();
153 printf("Error %d reading EEPROM content!\n", ret);