Merge branch 'master' of git://git.denx.de/u-boot-arm
[platform/kernel/u-boot.git] / board / pxa255_idp / pxa_idp.c
1 /*
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>
34 #include <netdev.h>
35 #include <command.h>
36 #include <asm/io.h>
37
38 DECLARE_GLOBAL_DATA_PTR;
39
40 /*
41  * Miscelaneous platform dependent initialisations
42  */
43
44 int board_init (void)
45 {
46         /* 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 */
60         writel(readl(CKEN) | CKEN0_PWM0, CKEN);
61         writel(0x3f, PWM_CTRL0);
62         writel(0x3ff, PWM_PERVAL0);
63         writel(792, PWM_PWDUTY0);
64
65         /* clear reset to AC97 codec */
66         writel(readl(CKEN) | CKEN2_AC97, CKEN);
67         writel(GCR_COLD_RST, GCR);
68
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
78 int board_late_init(void)
79 {
80         setenv("stdout", "serial");
81         setenv("stderr", "serial");
82         return 0;
83 }
84
85
86 int dram_init (void)
87 {
88         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
103 void delay_c(void)
104 {
105         /* reset OSCR to 0 */
106         writel(0, OSCR);
107         while (readl(OSCR) > 0x10000)
108                 ;
109
110         while (readl(OSCR) < 0xd4000)
111                 ;
112 }
113
114 void blink_c(void)
115 {
116         int led_bit = (1<<10);
117
118         writel(led_bit, GPDR0);
119         writel(led_bit, GPCR0);
120         delay_c();
121         writel(led_bit, GPSR0);
122         delay_c();
123         writel(led_bit, GPCR0);
124 }
125
126 int do_idpcmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
127 {
128         printf("IDPCMD started\n");
129         return 0;
130 }
131
132 U_BOOT_CMD(idpcmd, CONFIG_SYS_MAXARGS, 0, do_idpcmd,
133            "custom IDP command",
134            "no args at this time"
135 );
136
137 #endif
138
139 #ifdef CONFIG_CMD_NET
140 int 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