2 * Common board functions for siemens AM335X based boards
3 * (C) Copyright 2013 Siemens Schweiz AG
4 * (C) Heiko Schocher, DENX Software Engineering, hs@denx.de.
7 * U-Boot file:/board/ti/am335x/board.c
8 * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
10 * SPDX-License-Identifier: GPL-2.0+
16 #include <asm/arch/cpu.h>
17 #include <asm/arch/hardware.h>
18 #include <asm/arch/omap.h>
19 #include <asm/arch/ddr_defs.h>
20 #include <asm/arch/clock.h>
21 #include <asm/arch/gpio.h>
22 #include <asm/arch/mmc_host_def.h>
23 #include <asm/arch/sys_proto.h>
31 #include "../common/factoryset.h"
33 DECLARE_GLOBAL_DATA_PTR;
35 #ifdef CONFIG_SPL_BUILD
36 void set_uart_mux_conf(void)
38 enable_uart0_pin_mux();
41 void set_mux_conf_regs(void)
43 /* Initalize the board header */
44 enable_i2c0_pin_mux();
46 if (read_eeprom() < 0)
47 puts("Could not get board ID.\n");
49 enable_board_pin_mux();
54 spl_siemens_board_init();
59 #endif /* #ifdef CONFIG_SPL_BUILD */
61 #ifndef CONFIG_SPL_BUILD
63 * Basic board specific setup. Pinmux has been handled already.
67 #if defined(CONFIG_HW_WATCHDOG)
69 #endif /* defined(CONFIG_HW_WATCHDOG) */
71 if (read_eeprom() < 0)
72 puts("Could not get board ID.\n");
74 gd->bd->bi_arch_number = CONFIG_MACH_TYPE;
75 gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
77 #ifdef CONFIG_FACTORYSET
78 factoryset_read_eeprom(CONFIG_SYS_I2C_EEPROM_ADDR);
88 #endif /* #ifndef CONFIG_SPL_BUILD */
90 #define OSC (V_OSCK/1000000)
91 const struct dpll_params dpll_ddr = {
92 DDR_PLL_FREQ, OSC-1, 1, -1, -1, -1, -1};
94 const struct dpll_params *get_dpll_ddr_params(void)
99 #ifdef CONFIG_BOARD_LATE_INIT
100 int board_late_init(void)
102 omap_nand_switch_ecc(1, 8);
108 #ifndef CONFIG_SPL_BUILD
109 #if defined(BOARD_DFU_BUTTON_GPIO)
111 * This command returns the status of the user button on
113 * Returns - 1 if button is held down
114 * 0 if button is not held down
117 do_userbutton(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
122 gpio = BOARD_DFU_BUTTON_GPIO;
123 gpio_request(gpio, "DFU");
124 gpio_direction_input(gpio);
125 if (gpio_get_value(gpio))
132 /* LED0 - RED=1: GPIO2_0 2*32 = 64 */
133 gpio_request(BOARD_DFU_BUTTON_LED, "");
134 gpio_direction_output(BOARD_DFU_BUTTON_LED, 1);
135 gpio_set_value(BOARD_DFU_BUTTON_LED, 1);
142 dfubutton, CONFIG_SYS_MAXARGS, 1, do_userbutton,
143 "Return the status of the DFU button",
149 do_usertestwdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
151 printf("\n\n\n Go into infinite loop\n\n\n");
158 testwdt, CONFIG_SYS_MAXARGS, 1, do_usertestwdt,
159 "Sends U-Boot into infinite loop",
162 #endif /* !CONFIG_SPL_BUILD */