2 * Common board functions for siemens AM335X based boards
3 * (C) Copyright 2013 Siemens Schweiz AG
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();
47 /* enable early the console */
48 gd->baudrate = CONFIG_BAUDRATE;
51 if (read_eeprom() < 0)
52 puts("Could not get board ID.\n");
54 enable_board_pin_mux();
59 spl_siemens_board_init();
64 #endif /* #ifdef CONFIG_SPL_BUILD */
66 #ifndef CONFIG_SPL_BUILD
68 * Basic board specific setup. Pinmux has been handled already.
72 #if defined(CONFIG_HW_WATCHDOG)
74 #endif /* defined(CONFIG_HW_WATCHDOG) */
76 if (read_eeprom() < 0)
77 puts("Could not get board ID.\n");
79 gd->bd->bi_arch_number = CONFIG_MACH_TYPE;
80 gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
82 #ifdef CONFIG_FACTORYSET
83 factoryset_read_eeprom(CONFIG_SYS_I2C_EEPROM_ADDR);
93 #endif /* #ifndef CONFIG_SPL_BUILD */
95 #define OSC (V_OSCK/1000000)
96 const struct dpll_params dpll_ddr = {
97 DDR_PLL_FREQ, OSC-1, 1, -1, -1, -1, -1};
99 const struct dpll_params *get_dpll_ddr_params(void)
104 #ifndef CONFIG_SPL_BUILD
105 #if defined(BOARD_DFU_BUTTON_GPIO)
107 * This command returns the status of the user button on
109 * Returns - 1 if button is held down
110 * 0 if button is not held down
113 do_userbutton(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
118 gpio = BOARD_DFU_BUTTON_GPIO;
119 gpio_request(gpio, "DFU");
120 gpio_direction_input(gpio);
121 if (gpio_get_value(gpio))
132 dfubutton, CONFIG_SYS_MAXARGS, 1, do_userbutton,
133 "Return the status of the DFU button",
138 * This command sets led
139 * Input - name of led
141 * Returns - 1 if input does not match
145 do_setled(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
150 #if defined(BOARD_STATUS_LED)
151 if (!strcmp(argv[1], "stat"))
152 gpio = BOARD_STATUS_LED;
154 #if defined(BOARD_DFU_BUTTON_LED)
155 if (!strcmp(argv[1], "dfu"))
156 gpio = BOARD_DFU_BUTTON_LED;
158 /* If argument does not mach exit */
161 gpio_request(gpio, "");
162 gpio_direction_output(gpio, 1);
163 if (!strcmp(argv[2], "1"))
164 gpio_set_value(gpio, 1);
166 gpio_set_value(gpio, 0);
173 led, CONFIG_SYS_MAXARGS, 2, do_setled,
175 "dfu val - set dfu led\nled stat val - set status led"
179 do_usertestwdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
181 printf("\n\n\n Go into infinite loop\n\n\n");
188 testwdt, CONFIG_SYS_MAXARGS, 1, do_usertestwdt,
189 "Sends U-Boot into infinite loop",
192 #endif /* !CONFIG_SPL_BUILD */