blob: 4ab8bd494f6eb8dbf65de8b7311ce0aa20183b4a [file] [log] [blame]
Wolfgang Denk70a20472005-09-25 15:59:01 +02001/*
2 * (C) Copyright 2002
3 * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
4 *
5 * (C) Copyright 2002
6 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
7 * Marius Groeger <mgroeger@sysgo.de>
8 *
9 * (C) Copyright 2004
10 * BEC Systems <http://bec-systems.com>
11 * Cliff Brake <cliff.brake@gmail.com>
12 * Support for Accelent/Vibren PXA255 IDP
13 *
14 * See file CREDITS for list of people who contributed to this
15 * project.
16 *
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License as
19 * published by the Free Software Foundation; either version 2 of
20 * the License, or (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
30 * MA 02111-1307 USA
31 */
32
33#include <common.h>
Ben Warren7194ab82009-10-04 22:37:03 -070034#include <netdev.h>
Wolfgang Denk70a20472005-09-25 15:59:01 +020035#include <command.h>
Marek Vasut3ba8bf72010-09-09 09:50:39 +020036#include <asm/io.h>
Wolfgang Denk70a20472005-09-25 15:59:01 +020037
Wolfgang Denkd87080b2006-03-31 18:32:53 +020038DECLARE_GLOBAL_DATA_PTR;
Wolfgang Denk70a20472005-09-25 15:59:01 +020039
40/*
41 * Miscelaneous platform dependent initialisations
42 */
43
44int board_init (void)
45{
Wolfgang Denk70a20472005-09-25 15:59:01 +020046 /* memory and cpu-speed are setup before relocation */
47 /* so we do _nothing_ here */
48
49 /* arch number of Lubbock-Board */
50 gd->bd->bi_arch_number = MACH_TYPE_PXA_IDP;
51
52 /* adress of boot parameters */
53 gd->bd->bi_boot_params = 0xa0000100;
54
55 /* turn on serial ports */
56 *(volatile unsigned int *)(PXA_CS5_PHYS + 0x03C0002c) = 0x13;
57
58 /* set PWM for LCD */
59 /* a value that works is 60Hz, 77% duty cycle */
Marek Vasut3ba8bf72010-09-09 09:50:39 +020060 writel(readl(CKEN) | CKEN0_PWM0, CKEN);
61 writel(0x3f, PWM_CTRL0);
62 writel(0x3ff, PWM_PERVAL0);
63 writel(792, PWM_PWDUTY0);
Wolfgang Denk70a20472005-09-25 15:59:01 +020064
65 /* clear reset to AC97 codec */
Marek Vasut3ba8bf72010-09-09 09:50:39 +020066 writel(readl(CKEN) | CKEN2_AC97, CKEN);
67 writel(GCR_COLD_RST, GCR);
Wolfgang Denk70a20472005-09-25 15:59:01 +020068
69 /* enable LCD backlight */
70 /* *(volatile unsigned int *)(PXA_CS5_PHYS + 0x03C00030) = 0x7; */
71
72 /* test display */
73 /* lcd_puts("This is a test\nTest #2\n"); */
74
75 return 0;
76}
77
78int board_late_init(void)
79{
80 setenv("stdout", "serial");
81 setenv("stderr", "serial");
82 return 0;
83}
84
85
86int dram_init (void)
87{
Wolfgang Denk70a20472005-09-25 15:59:01 +020088 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
89 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
90 gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
91 gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
92 gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
93 gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
94 gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
95 gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
96
97 return 0;
98}
99
100
101#ifdef DEBUG_BLINKC_ENABLE
102
103void delay_c(void)
104{
105 /* reset OSCR to 0 */
Marek Vasut3ba8bf72010-09-09 09:50:39 +0200106 writel(0, OSCR);
107 while (readl(OSCR) > 0x10000)
Wolfgang Denk70a20472005-09-25 15:59:01 +0200108 ;
109
Marek Vasut3ba8bf72010-09-09 09:50:39 +0200110 while (readl(OSCR) < 0xd4000)
Wolfgang Denk70a20472005-09-25 15:59:01 +0200111 ;
112}
113
114void blink_c(void)
115{
116 int led_bit = (1<<10);
117
Marek Vasut3ba8bf72010-09-09 09:50:39 +0200118 writel(led_bit, GPDR0);
119 writel(led_bit, GPCR0);
Wolfgang Denk70a20472005-09-25 15:59:01 +0200120 delay_c();
Marek Vasut3ba8bf72010-09-09 09:50:39 +0200121 writel(led_bit, GPSR0);
Wolfgang Denk70a20472005-09-25 15:59:01 +0200122 delay_c();
Marek Vasut3ba8bf72010-09-09 09:50:39 +0200123 writel(led_bit, GPCR0);
Wolfgang Denk70a20472005-09-25 15:59:01 +0200124}
125
Wolfgang Denk54841ab2010-06-28 22:00:46 +0200126int do_idpcmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Wolfgang Denk70a20472005-09-25 15:59:01 +0200127{
128 printf("IDPCMD started\n");
129 return 0;
130}
131
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200132U_BOOT_CMD(idpcmd, CONFIG_SYS_MAXARGS, 0, do_idpcmd,
Peter Tyser2fb26042009-01-27 18:03:12 -0600133 "custom IDP command",
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200134 "no args at this time"
Wolfgang Denk70a20472005-09-25 15:59:01 +0200135);
136
137#endif
Ben Warren7194ab82009-10-04 22:37:03 -0700138
139#ifdef CONFIG_CMD_NET
140int board_eth_init(bd_t *bis)
141{
142 int rc = 0;
143#ifdef CONFIG_SMC91111
144 rc = smc91111_initialize(0, CONFIG_SMC91111_BASE);
145#endif
146 return rc;
147}
148#endif