blob: c3dee8459e68a2ab166dc3f0426f2f4ead7253b9 [file] [log] [blame]
stefano babic6708a602007-08-30 23:01:49 +02001/*
2 * (C) Copyright 2007
3 * Stefano Babic, DENX Gmbh, sbabic@denx.de
4 *
5 * (C) Copyright 2004
6 * Robert Whaley, Applied Data Systems, Inc. rwhaley@applieddata.net
7 *
8 * (C) Copyright 2002
9 * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
10 *
11 * (C) Copyright 2002
12 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
13 * Marius Groeger <mgroeger@sysgo.de>
14 *
15 * See file CREDITS for list of people who contributed to this
16 * project.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA
32 */
33
34#include <common.h>
35#include <asm/arch/pxa-regs.h>
Marek Vasut71d058b2011-11-26 11:17:32 +010036#include <asm/arch/pxa.h>
Marek Vasutd2f3bbd2012-09-30 10:09:49 +000037#include <asm/arch/regs-mmc.h>
Remy Bohmer7eefd922009-05-02 21:49:18 +020038#include <netdev.h>
Marek Vasut2db1e962010-09-09 09:50:39 +020039#include <asm/io.h>
stefano babic6708a602007-08-30 23:01:49 +020040
41DECLARE_GLOBAL_DATA_PTR;
42
43#define RH_A_PSM (1 << 8) /* power switching mode */
44#define RH_A_NPS (1 << 9) /* no power switching */
45
46extern struct serial_device serial_ffuart_device;
47extern struct serial_device serial_btuart_device;
48extern struct serial_device serial_stuart_device;
49
Marek Vasut4ccaaef2010-10-04 00:21:51 +020050#if CONFIG_MK_POLARIS
Stefano Babice33f8042009-07-01 20:40:41 +020051#define BOOT_CONSOLE "serial_stuart"
52#else
53#define BOOT_CONSOLE "serial_ffuart"
54#endif
stefano babic6708a602007-08-30 23:01:49 +020055/* ------------------------------------------------------------------------- */
56
57/*
58 * Miscelaneous platform dependent initialisations
59 */
60
Stefano Babic57eb46b2009-07-01 04:33:56 +020061int usb_board_init(void)
stefano babic6708a602007-08-30 23:01:49 +020062{
Marek Vasut2db1e962010-09-09 09:50:39 +020063 writel((readl(UHCHR) | UHCHR_PCPL | UHCHR_PSPL) &
64 ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE),
65 UHCHR);
stefano babic6708a602007-08-30 23:01:49 +020066
Marek Vasut2db1e962010-09-09 09:50:39 +020067 writel(readl(UHCHR) | UHCHR_FSBIR, UHCHR);
stefano babic6708a602007-08-30 23:01:49 +020068
Marek Vasut2db1e962010-09-09 09:50:39 +020069 while (readl(UHCHR) & UHCHR_FSBIR)
70 ;
stefano babic6708a602007-08-30 23:01:49 +020071
Marek Vasut2db1e962010-09-09 09:50:39 +020072 writel(readl(UHCHR) & ~UHCHR_SSE, UHCHR);
73 writel((UHCHIE_UPRIE | UHCHIE_RWIE), UHCHIE);
stefano babic6708a602007-08-30 23:01:49 +020074
75 /* Clear any OTG Pin Hold */
Marek Vasut2db1e962010-09-09 09:50:39 +020076 if (readl(PSSR) & PSSR_OTGPH)
77 writel(readl(PSSR) | PSSR_OTGPH, PSSR);
stefano babic6708a602007-08-30 23:01:49 +020078
Marek Vasut2db1e962010-09-09 09:50:39 +020079 writel(readl(UHCRHDA) & ~(RH_A_NPS), UHCRHDA);
80 writel(readl(UHCRHDA) | RH_A_PSM, UHCRHDA);
stefano babic6708a602007-08-30 23:01:49 +020081
82 /* Set port power control mask bits, only 3 ports. */
Marek Vasut2db1e962010-09-09 09:50:39 +020083 writel(readl(UHCRHDB) | (0x7<<17), UHCRHDB);
Stefano Babic57eb46b2009-07-01 04:33:56 +020084
85 return 0;
stefano babic6708a602007-08-30 23:01:49 +020086}
87
88void usb_board_init_fail(void)
89{
90 return;
91}
92
93void usb_board_stop(void)
94{
Marek Vasut2db1e962010-09-09 09:50:39 +020095 writel(readl(UHCHR) | UHCHR_FHR, UHCHR);
stefano babic6708a602007-08-30 23:01:49 +020096 udelay(11);
Marek Vasut2db1e962010-09-09 09:50:39 +020097 writel(readl(UHCHR) & ~UHCHR_FHR, UHCHR);
stefano babic6708a602007-08-30 23:01:49 +020098
Marek Vasut2db1e962010-09-09 09:50:39 +020099 writel(readl(UHCCOMS) | 1, UHCCOMS);
stefano babic6708a602007-08-30 23:01:49 +0200100 udelay(10);
101
Marek Vasut2db1e962010-09-09 09:50:39 +0200102 writel(readl(CKEN) & ~CKEN10_USBHOST, CKEN);
stefano babic6708a602007-08-30 23:01:49 +0200103
stefano babic6708a602007-08-30 23:01:49 +0200104 return;
105}
106
107int board_init (void)
108{
Marek Vasuta11b85d2010-10-20 21:28:14 +0200109 /* We have RAM, disable cache */
110 dcache_disable();
111 icache_disable();
stefano babic6708a602007-08-30 23:01:49 +0200112
113 /* arch number of ConXS Board */
114 gd->bd->bi_arch_number = 776;
115
116 /* adress of boot parameters */
117 gd->bd->bi_boot_params = 0xa000003c;
118
119 return 0;
120}
121
122int board_late_init(void)
123{
stefano babic6708a602007-08-30 23:01:49 +0200124 char *console=getenv("boot_console");
125
Stefano Babice33f8042009-07-01 20:40:41 +0200126 if ((console == NULL) || (strcmp(console,"serial_btuart") &&
127 strcmp(console,"serial_stuart") &&
128 strcmp(console,"serial_ffuart"))) {
129 console = BOOT_CONSOLE;
stefano babic6708a602007-08-30 23:01:49 +0200130 }
Stefano Babice33f8042009-07-01 20:40:41 +0200131 setenv("stdout",console);
132 setenv("stdin", console);
133 setenv("stderr",console);
stefano babic6708a602007-08-30 23:01:49 +0200134 return 0;
135}
136
Marek Vasuta11b85d2010-10-20 21:28:14 +0200137int dram_init(void)
138{
Marek Vasut08341be2011-11-26 11:18:57 +0100139 pxa2xx_dram_init();
Marek Vasuta11b85d2010-10-20 21:28:14 +0200140 gd->ram_size = PHYS_SDRAM_1_SIZE;
141 return 0;
142}
143
144void dram_init_banksize(void)
stefano babic6708a602007-08-30 23:01:49 +0200145{
146 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
147 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
stefano babic6708a602007-08-30 23:01:49 +0200148}
Remy Bohmer7eefd922009-05-02 21:49:18 +0200149
150#ifdef CONFIG_DRIVER_DM9000
151int board_eth_init(bd_t *bis)
152{
153 return dm9000_initialize(bis);
154}
155#endif
Marek Vasutd2f3bbd2012-09-30 10:09:49 +0000156
157#ifdef CONFIG_CMD_MMC
158int board_mmc_init(bd_t *bis)
159{
160 pxa_mmc_register(0);
161 return 0;
162}
163#endif