5 * SPDX-License-Identifier: GPL-2.0+
13 #include <fdt_support.h>
14 #include <fsl_esdhc.h>
19 #include <video_osd.h>
21 #include "../common/ihs_mdio.h"
22 #include "../../../drivers/board/gazerbeam.h"
24 DECLARE_GLOBAL_DATA_PTR;
26 struct ihs_mdio_info ihs_mdio_info[] = {
27 { .fpga = NULL, .name = "ihs0", .base = 0x58 },
28 { .fpga = NULL, .name = "ihs1", .base = 0x58 },
31 static int get_tpm(struct udevice **devp)
35 rc = uclass_first_device_err(UCLASS_TPM, devp);
37 printf("Could not find TPM (ret=%d)\n", rc);
38 return CMD_RET_FAILURE;
44 int board_early_init_r(void)
46 struct udevice *board;
47 struct udevice *serdes;
51 if (board_get(&board))
52 puts("Could not find board information device.\n");
54 /* Initialize serdes */
55 uclass_get_device_by_phandle(UCLASS_MISC, board, "serdes", &serdes);
57 if (board_detect(board))
58 puts("Device information detection failed.\n");
60 board_get_int(board, BOARD_MULTICHANNEL, &mc);
61 board_get_int(board, BOARD_VARIANT, &con);
63 if (mc == 2 || mc == 1)
64 dev_disable_by_path("/immr@e0000000/i2c@3100/pca9698@22");
67 dev_disable_by_path("/immr@e0000000/i2c@3100/pca9698@20");
68 dev_enable_by_path("/localbus@e0005000/iocon_uart@2,0");
69 dev_enable_by_path("/fpga1bus");
72 if (mc == 2 || con == VAR_CON) {
73 dev_enable_by_path("/fpga0bus/fpga0_video1");
74 dev_enable_by_path("/fpga0bus/fpga0_iic_video1");
75 dev_enable_by_path("/fpga0bus/fpga0_axi_video1");
79 dev_enable_by_path("/fpga0bus/fpga0_video0");
80 dev_enable_by_path("/fpga0bus/fpga0_iic_video0");
81 dev_enable_by_path("/fpga0bus/fpga0_axi_video0");
89 struct udevice *board;
90 char *s = env_get("serial#");
94 if (board_get(&board))
95 puts("Could not find board information device.\n");
97 board_get_int(board, BOARD_MULTICHANNEL, &mc);
98 board_get_int(board, BOARD_VARIANT, &con);
100 puts("Board: Gazerbeam ");
101 printf("%s ", mc == 4 ? "MC4" : mc == 2 ? "MC2" : "SC");
102 printf("%s", con == VAR_CON ? "CON" : "CPU");
114 static void display_osd_info(struct udevice *osd,
115 struct video_osd_info *osd_info)
117 printf("OSD-%s: Digital-OSD version %01d.%02d, %d x %d characters\n",
118 osd->name, osd_info->major_version, osd_info->minor_version,
119 osd_info->width, osd_info->height);
122 int last_stage_init(void)
126 struct udevice *board;
128 struct video_osd_info osd_info;
132 if (board_get(&board))
133 puts("Could not find board information device.\n");
136 int res = board_get_int(board, BOARD_HWVERSION, &fpga_hw_rev);
139 printf("Could not determind FPGA HW revision (res = %d)\n", res);
142 env_set_ulong("fpga_hw_rev", fpga_hw_rev);
145 if (ret || tpm_init(tpm) || tpm_startup(tpm, TPM_ST_CLEAR) ||
146 tpm_continue_self_test(tpm)) {
147 printf("TPM init failed\n");
150 if (fpga_hw_rev >= 4) {
151 for (i = 0; i < 4; i++) {
152 struct udevice *rxaui;
155 snprintf(name, sizeof(name), "rxaui%d", i);
156 /* Disable RXAUI polarity inversion */
157 ret = uclass_get_device_by_phandle(UCLASS_MISC, board, name, &rxaui);
159 misc_set_enabled(rxaui, false);
163 for (uclass_first_device(UCLASS_VIDEO_OSD, &osd);
165 uclass_next_device(&osd)) {
166 video_osd_get_info(osd, &osd_info);
167 display_osd_info(osd, &osd_info);
173 #if defined(CONFIG_OF_BOARD_SETUP)
174 int ft_board_setup(void *blob, bd_t *bd)
176 ft_cpu_setup(blob, bd);
177 fsl_fdt_fixup_dr_usb(blob, bd);
178 fdt_fixup_esdhc(blob, bd);