blob: c0c318f32877e17e2a7c2a5eddc7ff008915ff75 [file] [log] [blame]
stefano babic5e5803e2007-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 *
Wolfgang Denk1a459662013-07-08 09:37:19 +020015 * SPDX-License-Identifier: GPL-2.0+
stefano babic5e5803e2007-08-30 23:01:49 +020016 */
17
18#include <common.h>
19#include <asm/arch/pxa-regs.h>
Marek Vasut4438a452011-11-26 11:17:32 +010020#include <asm/arch/pxa.h>
Marek Vasut831f8492012-09-30 10:09:49 +000021#include <asm/arch/regs-mmc.h>
Remy Bohmer60f61e62009-05-02 21:49:18 +020022#include <netdev.h>
Marek Vasut3ba8bf72010-09-09 09:50:39 +020023#include <asm/io.h>
stefano babic5e5803e2007-08-30 23:01:49 +020024
25DECLARE_GLOBAL_DATA_PTR;
26
27#define RH_A_PSM (1 << 8) /* power switching mode */
28#define RH_A_NPS (1 << 9) /* no power switching */
29
30extern struct serial_device serial_ffuart_device;
31extern struct serial_device serial_btuart_device;
32extern struct serial_device serial_stuart_device;
33
Marek Vasut7c957c02010-10-04 00:21:51 +020034#if CONFIG_MK_POLARIS
Stefano Babic040f8f62009-07-01 20:40:41 +020035#define BOOT_CONSOLE "serial_stuart"
36#else
37#define BOOT_CONSOLE "serial_ffuart"
38#endif
stefano babic5e5803e2007-08-30 23:01:49 +020039/* ------------------------------------------------------------------------- */
40
41/*
42 * Miscelaneous platform dependent initialisations
43 */
44
Stefano Babic88bd9752009-07-01 04:33:56 +020045int usb_board_init(void)
stefano babic5e5803e2007-08-30 23:01:49 +020046{
Marek Vasut3ba8bf72010-09-09 09:50:39 +020047 writel((readl(UHCHR) | UHCHR_PCPL | UHCHR_PSPL) &
48 ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE),
49 UHCHR);
stefano babic5e5803e2007-08-30 23:01:49 +020050
Marek Vasut3ba8bf72010-09-09 09:50:39 +020051 writel(readl(UHCHR) | UHCHR_FSBIR, UHCHR);
stefano babic5e5803e2007-08-30 23:01:49 +020052
Marek Vasut3ba8bf72010-09-09 09:50:39 +020053 while (readl(UHCHR) & UHCHR_FSBIR)
54 ;
stefano babic5e5803e2007-08-30 23:01:49 +020055
Marek Vasut3ba8bf72010-09-09 09:50:39 +020056 writel(readl(UHCHR) & ~UHCHR_SSE, UHCHR);
57 writel((UHCHIE_UPRIE | UHCHIE_RWIE), UHCHIE);
stefano babic5e5803e2007-08-30 23:01:49 +020058
59 /* Clear any OTG Pin Hold */
Marek Vasut3ba8bf72010-09-09 09:50:39 +020060 if (readl(PSSR) & PSSR_OTGPH)
61 writel(readl(PSSR) | PSSR_OTGPH, PSSR);
stefano babic5e5803e2007-08-30 23:01:49 +020062
Marek Vasut3ba8bf72010-09-09 09:50:39 +020063 writel(readl(UHCRHDA) & ~(RH_A_NPS), UHCRHDA);
64 writel(readl(UHCRHDA) | RH_A_PSM, UHCRHDA);
stefano babic5e5803e2007-08-30 23:01:49 +020065
66 /* Set port power control mask bits, only 3 ports. */
Marek Vasut3ba8bf72010-09-09 09:50:39 +020067 writel(readl(UHCRHDB) | (0x7<<17), UHCRHDB);
Stefano Babic88bd9752009-07-01 04:33:56 +020068
69 return 0;
stefano babic5e5803e2007-08-30 23:01:49 +020070}
71
72void usb_board_init_fail(void)
73{
74 return;
75}
76
77void usb_board_stop(void)
78{
Marek Vasut3ba8bf72010-09-09 09:50:39 +020079 writel(readl(UHCHR) | UHCHR_FHR, UHCHR);
stefano babic5e5803e2007-08-30 23:01:49 +020080 udelay(11);
Marek Vasut3ba8bf72010-09-09 09:50:39 +020081 writel(readl(UHCHR) & ~UHCHR_FHR, UHCHR);
stefano babic5e5803e2007-08-30 23:01:49 +020082
Marek Vasut3ba8bf72010-09-09 09:50:39 +020083 writel(readl(UHCCOMS) | 1, UHCCOMS);
stefano babic5e5803e2007-08-30 23:01:49 +020084 udelay(10);
85
Marek Vasut3ba8bf72010-09-09 09:50:39 +020086 writel(readl(CKEN) & ~CKEN10_USBHOST, CKEN);
stefano babic5e5803e2007-08-30 23:01:49 +020087
stefano babic5e5803e2007-08-30 23:01:49 +020088 return;
89}
90
91int board_init (void)
92{
Marek Vasutcc72ac62010-10-20 21:28:14 +020093 /* We have RAM, disable cache */
94 dcache_disable();
95 icache_disable();
stefano babic5e5803e2007-08-30 23:01:49 +020096
97 /* arch number of ConXS Board */
98 gd->bd->bi_arch_number = 776;
99
100 /* adress of boot parameters */
101 gd->bd->bi_boot_params = 0xa000003c;
102
103 return 0;
104}
105
106int board_late_init(void)
107{
stefano babic5e5803e2007-08-30 23:01:49 +0200108 char *console=getenv("boot_console");
109
Stefano Babic040f8f62009-07-01 20:40:41 +0200110 if ((console == NULL) || (strcmp(console,"serial_btuart") &&
111 strcmp(console,"serial_stuart") &&
112 strcmp(console,"serial_ffuart"))) {
113 console = BOOT_CONSOLE;
stefano babic5e5803e2007-08-30 23:01:49 +0200114 }
Stefano Babic040f8f62009-07-01 20:40:41 +0200115 setenv("stdout",console);
116 setenv("stdin", console);
117 setenv("stderr",console);
stefano babic5e5803e2007-08-30 23:01:49 +0200118 return 0;
119}
120
Marek Vasutcc72ac62010-10-20 21:28:14 +0200121int dram_init(void)
122{
Marek Vasutf68d2a22011-11-26 11:18:57 +0100123 pxa2xx_dram_init();
Marek Vasutcc72ac62010-10-20 21:28:14 +0200124 gd->ram_size = PHYS_SDRAM_1_SIZE;
125 return 0;
126}
127
128void dram_init_banksize(void)
stefano babic5e5803e2007-08-30 23:01:49 +0200129{
130 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
131 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
stefano babic5e5803e2007-08-30 23:01:49 +0200132}
Remy Bohmer60f61e62009-05-02 21:49:18 +0200133
134#ifdef CONFIG_DRIVER_DM9000
135int board_eth_init(bd_t *bis)
136{
137 return dm9000_initialize(bis);
138}
139#endif
Marek Vasut831f8492012-09-30 10:09:49 +0000140
141#ifdef CONFIG_CMD_MMC
142int board_mmc_init(bd_t *bis)
143{
144 pxa_mmc_register(0);
145 return 0;
146}
147#endif