2 * (c) 2010 Graf-Syteco, Matthias Weisser
5 * (C) Copyright 2007, mycable GmbH
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_arch_number = MACH_TYPE_JADECPU;
44 gd->bd->bi_boot_params = PHYS_SDRAM + PHYS_SDRAM_SIZE - 0x10000;
52 static void setup_display_power(uint32_t pwr_bit, char *pwm_opts,
53 unsigned long pwm_base)
55 struct mb86r0x_gpio *gpio = (struct mb86r0x_gpio *)
57 struct mb86r0x_pwm *pwm = (struct mb86r0x_pwm *) pwm_base;
60 writel(readl(&gpio->gpdr2) | pwr_bit, &gpio->gpdr2);
72 freq = simple_strtol(s + 2, NULL, 0);
76 init = simple_strtol(s + 2, NULL, 0);
79 writel(CONFIG_MB86R0x_IOCLK / 1000 / freq,
81 writel(1002, &pwm->tpr);
83 writel(init * 10 + 1, &pwm->dr);
90 int board_late_init(void)
92 struct mb86r0x_gpio *gpio = (struct mb86r0x_gpio *)
96 #ifdef CONFIG_VIDEO_MB86R0xGDC
97 /* Check if we have valid display settings and turn on power if so */
99 if (getenv("gs_dsp_0_param") || getenv("videomode"))
100 setup_display_power((1 << 3), "gs_dsp_0_pwm",
103 /* The corresponding GPIO is always an output */
104 writel(readl(&gpio->gpddr2) | (1 << 3), &gpio->gpddr2);
107 if (getenv("gs_dsp_1_param") || getenv("videomode1"))
108 setup_display_power((1 << 4), "gs_dsp_1_pwm",
111 /* The corresponding GPIO is always an output */
112 writel(readl(&gpio->gpddr2) | (1 << 4), &gpio->gpddr2);
113 #endif /* CONFIG_VIDEO_MB86R0xGDC */
116 writel(readl(&gpio->gpdr1) & ~(1 << 5), &gpio->gpdr1);
117 writel(readl(&gpio->gpddr1) | (1 << 5), &gpio->gpddr1);
119 /* We have special boot options if told by GPIOs */
120 in_word = readl(&gpio->gpdr1);
122 if ((in_word & 0xC0) == 0xC0) {
123 setenv("stdin", "serial");
124 setenv("stdout", "serial");
125 setenv("stderr", "serial");
126 setenv("preboot", "run gs_slow_boot");
127 } else if ((in_word & 0xC0) != 0) {
128 setenv("stdout", "vga");
129 setenv("preboot", "run gs_slow_boot");
131 setenv("stdin", "serial");
132 setenv("stdout", "serial");
133 setenv("stderr", "serial");
134 if (getenv("gs_devel")) {
135 setenv("preboot", "run gs_slow_boot");
137 setenv("preboot", "run gs_fast_boot");
144 int misc_init_r(void)
154 /* dram_init must store complete ramsize in gd->ram_size */
155 gd->ram_size = get_ram_size((void *)PHYS_SDRAM,
161 void dram_init_banksize(void)
163 gd->bd->bi_dram[0].start = PHYS_SDRAM;
164 gd->bd->bi_dram[0].size = gd->ram_size;
167 int board_eth_init(bd_t *bis)
170 #ifdef CONFIG_SMC911X
171 rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);