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 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 #include <asm/arch/mb86r0x.h>
29 DECLARE_GLOBAL_DATA_PTR;
32 * Miscellaneous platform dependent initialisations
36 struct mb86r0x_ccnt * ccnt = (struct mb86r0x_ccnt *)
39 /* We select mode 0 for group 2 and mode 1 for group 4 */
40 writel(0x00000010, &ccnt->cmux_md);
43 gd->bd->bi_boot_params = PHYS_SDRAM + PHYS_SDRAM_SIZE - 0x10000;
51 static void setup_display_power(uint32_t pwr_bit, char *pwm_opts,
52 unsigned long pwm_base)
54 struct mb86r0x_gpio *gpio = (struct mb86r0x_gpio *)
56 struct mb86r0x_pwm *pwm = (struct mb86r0x_pwm *) pwm_base;
59 writel(readl(&gpio->gpdr2) | pwr_bit, &gpio->gpdr2);
71 freq = simple_strtol(s + 2, NULL, 0);
75 init = simple_strtol(s + 2, NULL, 0);
78 writel(CONFIG_MB86R0x_IOCLK / 1000 / freq,
80 writel(1002, &pwm->tpr);
82 writel(init * 10 + 1, &pwm->dr);
89 int board_late_init(void)
91 struct mb86r0x_gpio *gpio = (struct mb86r0x_gpio *)
95 #ifdef CONFIG_VIDEO_MB86R0xGDC
96 /* Check if we have valid display settings and turn on power if so */
98 if (getenv("gs_dsp_0_param") || getenv("videomode"))
99 setup_display_power((1 << 3), "gs_dsp_0_pwm",
102 /* The corresponding GPIO is always an output */
103 writel(readl(&gpio->gpddr2) | (1 << 3), &gpio->gpddr2);
106 if (getenv("gs_dsp_1_param") || getenv("videomode1"))
107 setup_display_power((1 << 4), "gs_dsp_1_pwm",
110 /* The corresponding GPIO is always an output */
111 writel(readl(&gpio->gpddr2) | (1 << 4), &gpio->gpddr2);
112 #endif /* CONFIG_VIDEO_MB86R0xGDC */
115 writel(readl(&gpio->gpdr1) & ~(1 << 5), &gpio->gpdr1);
116 writel(readl(&gpio->gpddr1) | (1 << 5), &gpio->gpddr1);
118 /* We have special boot options if told by GPIOs */
119 in_word = readl(&gpio->gpdr1);
121 if ((in_word & 0xC0) == 0xC0) {
122 setenv("stdin", "serial");
123 setenv("stdout", "serial");
124 setenv("stderr", "serial");
125 setenv("preboot", "run gs_slow_boot");
126 } else if ((in_word & 0xC0) != 0) {
127 setenv("stdout", "vga");
128 setenv("preboot", "run gs_slow_boot");
130 setenv("stdin", "serial");
131 setenv("stdout", "serial");
132 setenv("stderr", "serial");
133 if (getenv("gs_devel")) {
134 setenv("preboot", "run gs_slow_boot");
136 setenv("preboot", "run gs_fast_boot");
143 int misc_init_r(void)
153 /* dram_init must store complete ramsize in gd->ram_size */
154 gd->ram_size = get_ram_size((void *)PHYS_SDRAM,
160 void dram_init_banksize(void)
162 gd->bd->bi_dram[0].start = PHYS_SDRAM;
163 gd->bd->bi_dram[0].size = gd->ram_size;
166 int board_eth_init(bd_t *bis)
169 #ifdef CONFIG_SMC911X
170 rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);