2 * (c) 2010 Graf-Syteco, Matthias Weisser
5 * (C) Copyright 2007, mycable GmbH
6 * Carsten Schneider <cs@mycable.de>, Alexander Bigga <ab@mycable.de>
8 * SPDX-License-Identifier: GPL-2.0+
14 #include <asm/arch/mb86r0x.h>
16 DECLARE_GLOBAL_DATA_PTR;
19 * Miscellaneous platform dependent initialisations
23 struct mb86r0x_ccnt * ccnt = (struct mb86r0x_ccnt *)
26 /* We select mode 0 for group 2 and mode 1 for group 4 */
27 writel(0x00000010, &ccnt->cmux_md);
30 gd->bd->bi_boot_params = PHYS_SDRAM + PHYS_SDRAM_SIZE - 0x10000;
38 static void setup_display_power(uint32_t pwr_bit, char *pwm_opts,
39 unsigned long pwm_base)
41 struct mb86r0x_gpio *gpio = (struct mb86r0x_gpio *)
43 struct mb86r0x_pwm *pwm = (struct mb86r0x_pwm *) pwm_base;
46 writel(readl(&gpio->gpdr2) | pwr_bit, &gpio->gpdr2);
58 freq = simple_strtol(s + 2, NULL, 0);
62 init = simple_strtol(s + 2, NULL, 0);
65 writel(CONFIG_MB86R0x_IOCLK / 1000 / freq,
67 writel(1002, &pwm->tpr);
69 writel(init * 10 + 1, &pwm->dr);
76 int board_late_init(void)
78 struct mb86r0x_gpio *gpio = (struct mb86r0x_gpio *)
82 #ifdef CONFIG_VIDEO_MB86R0xGDC
83 /* Check if we have valid display settings and turn on power if so */
85 if (getenv("gs_dsp_0_param") || getenv("videomode"))
86 setup_display_power((1 << 3), "gs_dsp_0_pwm",
89 /* The corresponding GPIO is always an output */
90 writel(readl(&gpio->gpddr2) | (1 << 3), &gpio->gpddr2);
93 if (getenv("gs_dsp_1_param") || getenv("videomode1"))
94 setup_display_power((1 << 4), "gs_dsp_1_pwm",
97 /* The corresponding GPIO is always an output */
98 writel(readl(&gpio->gpddr2) | (1 << 4), &gpio->gpddr2);
99 #endif /* CONFIG_VIDEO_MB86R0xGDC */
102 writel(readl(&gpio->gpdr1) & ~(1 << 5), &gpio->gpdr1);
103 writel(readl(&gpio->gpddr1) | (1 << 5), &gpio->gpddr1);
105 /* We have special boot options if told by GPIOs */
106 in_word = readl(&gpio->gpdr1);
108 if ((in_word & 0xC0) == 0xC0) {
109 setenv("stdin", "serial");
110 setenv("stdout", "serial");
111 setenv("stderr", "serial");
112 setenv("preboot", "run gs_slow_boot");
113 } else if ((in_word & 0xC0) != 0) {
114 setenv("stdout", "vga");
115 setenv("preboot", "run gs_slow_boot");
117 setenv("stdin", "serial");
118 setenv("stdout", "serial");
119 setenv("stderr", "serial");
120 if (getenv("gs_devel")) {
121 setenv("preboot", "run gs_slow_boot");
123 setenv("preboot", "run gs_fast_boot");
130 int misc_init_r(void)
140 /* dram_init must store complete ramsize in gd->ram_size */
141 gd->ram_size = get_ram_size((void *)PHYS_SDRAM,
147 void dram_init_banksize(void)
149 gd->bd->bi_dram[0].start = PHYS_SDRAM;
150 gd->bd->bi_dram[0].size = gd->ram_size;
153 int board_eth_init(bd_t *bis)
156 #ifdef CONFIG_SMC911X
157 rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);