blob: 1ddf05dcdd40403da81af320c52252e40b9ed152 [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>
Mateusz Zalega16297cf2013-10-04 19:22:26 +020024#include <usb.h>
stefano babic5e5803e2007-08-30 23:01:49 +020025
26DECLARE_GLOBAL_DATA_PTR;
27
28#define RH_A_PSM (1 << 8) /* power switching mode */
29#define RH_A_NPS (1 << 9) /* no power switching */
30
31extern struct serial_device serial_ffuart_device;
32extern struct serial_device serial_btuart_device;
33extern struct serial_device serial_stuart_device;
34
Marek Vasut7c957c02010-10-04 00:21:51 +020035#if CONFIG_MK_POLARIS
Stefano Babic040f8f62009-07-01 20:40:41 +020036#define BOOT_CONSOLE "serial_stuart"
37#else
38#define BOOT_CONSOLE "serial_ffuart"
39#endif
stefano babic5e5803e2007-08-30 23:01:49 +020040/* ------------------------------------------------------------------------- */
41
42/*
43 * Miscelaneous platform dependent initialisations
44 */
45
Troy Kiskybba67912013-10-10 15:27:55 -070046int board_usb_init(int index, enum usb_init_type init)
stefano babic5e5803e2007-08-30 23:01:49 +020047{
Marek Vasut3ba8bf72010-09-09 09:50:39 +020048 writel((readl(UHCHR) | UHCHR_PCPL | UHCHR_PSPL) &
49 ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE),
50 UHCHR);
stefano babic5e5803e2007-08-30 23:01:49 +020051
Marek Vasut3ba8bf72010-09-09 09:50:39 +020052 writel(readl(UHCHR) | UHCHR_FSBIR, UHCHR);
stefano babic5e5803e2007-08-30 23:01:49 +020053
Marek Vasut3ba8bf72010-09-09 09:50:39 +020054 while (readl(UHCHR) & UHCHR_FSBIR)
55 ;
stefano babic5e5803e2007-08-30 23:01:49 +020056
Marek Vasut3ba8bf72010-09-09 09:50:39 +020057 writel(readl(UHCHR) & ~UHCHR_SSE, UHCHR);
58 writel((UHCHIE_UPRIE | UHCHIE_RWIE), UHCHIE);
stefano babic5e5803e2007-08-30 23:01:49 +020059
60 /* Clear any OTG Pin Hold */
Marek Vasut3ba8bf72010-09-09 09:50:39 +020061 if (readl(PSSR) & PSSR_OTGPH)
62 writel(readl(PSSR) | PSSR_OTGPH, PSSR);
stefano babic5e5803e2007-08-30 23:01:49 +020063
Marek Vasut3ba8bf72010-09-09 09:50:39 +020064 writel(readl(UHCRHDA) & ~(RH_A_NPS), UHCRHDA);
65 writel(readl(UHCRHDA) | RH_A_PSM, UHCRHDA);
stefano babic5e5803e2007-08-30 23:01:49 +020066
67 /* Set port power control mask bits, only 3 ports. */
Marek Vasut3ba8bf72010-09-09 09:50:39 +020068 writel(readl(UHCRHDB) | (0x7<<17), UHCRHDB);
Stefano Babic88bd9752009-07-01 04:33:56 +020069
70 return 0;
stefano babic5e5803e2007-08-30 23:01:49 +020071}
72
Troy Kiskybba67912013-10-10 15:27:55 -070073int board_usb_cleanup(int index, enum usb_init_type init)
stefano babic5e5803e2007-08-30 23:01:49 +020074{
Mateusz Zalega16297cf2013-10-04 19:22:26 +020075 return 0;
stefano babic5e5803e2007-08-30 23:01:49 +020076}
77
78void usb_board_stop(void)
79{
Marek Vasut3ba8bf72010-09-09 09:50:39 +020080 writel(readl(UHCHR) | UHCHR_FHR, UHCHR);
stefano babic5e5803e2007-08-30 23:01:49 +020081 udelay(11);
Marek Vasut3ba8bf72010-09-09 09:50:39 +020082 writel(readl(UHCHR) & ~UHCHR_FHR, UHCHR);
stefano babic5e5803e2007-08-30 23:01:49 +020083
Marek Vasut3ba8bf72010-09-09 09:50:39 +020084 writel(readl(UHCCOMS) | 1, UHCCOMS);
stefano babic5e5803e2007-08-30 23:01:49 +020085 udelay(10);
86
Marek Vasut3ba8bf72010-09-09 09:50:39 +020087 writel(readl(CKEN) & ~CKEN10_USBHOST, CKEN);
stefano babic5e5803e2007-08-30 23:01:49 +020088
stefano babic5e5803e2007-08-30 23:01:49 +020089 return;
90}
91
92int board_init (void)
93{
Marek Vasutcc72ac62010-10-20 21:28:14 +020094 /* We have RAM, disable cache */
95 dcache_disable();
96 icache_disable();
stefano babic5e5803e2007-08-30 23:01:49 +020097
98 /* arch number of ConXS Board */
99 gd->bd->bi_arch_number = 776;
100
101 /* adress of boot parameters */
102 gd->bd->bi_boot_params = 0xa000003c;
103
104 return 0;
105}
106
107int board_late_init(void)
108{
stefano babic5e5803e2007-08-30 23:01:49 +0200109 char *console=getenv("boot_console");
110
Stefano Babic040f8f62009-07-01 20:40:41 +0200111 if ((console == NULL) || (strcmp(console,"serial_btuart") &&
112 strcmp(console,"serial_stuart") &&
113 strcmp(console,"serial_ffuart"))) {
114 console = BOOT_CONSOLE;
stefano babic5e5803e2007-08-30 23:01:49 +0200115 }
Stefano Babic040f8f62009-07-01 20:40:41 +0200116 setenv("stdout",console);
117 setenv("stdin", console);
118 setenv("stderr",console);
stefano babic5e5803e2007-08-30 23:01:49 +0200119 return 0;
120}
121
Marek Vasutcc72ac62010-10-20 21:28:14 +0200122int dram_init(void)
123{
Marek Vasutf68d2a22011-11-26 11:18:57 +0100124 pxa2xx_dram_init();
Marek Vasutcc72ac62010-10-20 21:28:14 +0200125 gd->ram_size = PHYS_SDRAM_1_SIZE;
126 return 0;
127}
128
129void dram_init_banksize(void)
stefano babic5e5803e2007-08-30 23:01:49 +0200130{
131 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
132 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
stefano babic5e5803e2007-08-30 23:01:49 +0200133}
Remy Bohmer60f61e62009-05-02 21:49:18 +0200134
135#ifdef CONFIG_DRIVER_DM9000
136int board_eth_init(bd_t *bis)
137{
138 return dm9000_initialize(bis);
139}
140#endif
Marek Vasut831f8492012-09-30 10:09:49 +0000141
142#ifdef CONFIG_CMD_MMC
143int board_mmc_init(bd_t *bis)
144{
145 pxa_mmc_register(0);
146 return 0;
147}
148#endif