blob: 8d95e4d174614ece461a23b6fdd353c96224a965 [file] [log] [blame]
Marek Vasut163551a2010-05-11 04:31:44 +02001/*
2 * Toradex Colibri PXA270 Support
3 *
4 * Copyright (C) 2010 Marek Vasut <marek.vasut@gmail.com>
5 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Marek Vasut163551a2010-05-11 04:31:44 +02007 */
8
9#include <common.h>
10#include <asm/arch/hardware.h>
Marek Vasute326a232011-11-26 07:15:36 +010011#include <asm/arch/regs-mmc.h>
Marek Vasut71d058b2011-11-26 11:17:32 +010012#include <asm/arch/pxa.h>
Marek Vasutce2f0902010-08-08 15:55:51 +020013#include <netdev.h>
Marek Vasut2db1e962010-09-09 09:50:39 +020014#include <asm/io.h>
Marek Vasute326a232011-11-26 07:15:36 +010015#include <serial.h>
Mateusz Zalegad862f892013-10-04 19:22:26 +020016#include <usb.h>
Marek Vasut163551a2010-05-11 04:31:44 +020017
18DECLARE_GLOBAL_DATA_PTR;
19
Marek Vasute326a232011-11-26 07:15:36 +010020int board_init(void)
Marek Vasut163551a2010-05-11 04:31:44 +020021{
Marek Vasut20212992010-10-20 20:15:11 +020022 /* We have RAM, disable cache */
23 dcache_disable();
24 icache_disable();
Marek Vasut163551a2010-05-11 04:31:44 +020025
26 /* arch number of vpac270 */
27 gd->bd->bi_arch_number = MACH_TYPE_COLIBRI;
28
29 /* adress of boot parameters */
30 gd->bd->bi_boot_params = 0xa0000100;
31
32 return 0;
33}
34
Marek Vasut20212992010-10-20 20:15:11 +020035int dram_init(void)
Marek Vasut163551a2010-05-11 04:31:44 +020036{
Marek Vasut08341be2011-11-26 11:18:57 +010037 pxa2xx_dram_init();
Marek Vasut20212992010-10-20 20:15:11 +020038 gd->ram_size = PHYS_SDRAM_1_SIZE;
39 return 0;
40}
Marek Vasut163551a2010-05-11 04:31:44 +020041
Marek Vasut163551a2010-05-11 04:31:44 +020042#ifdef CONFIG_CMD_USB
Troy Kiskyde8ae7b2013-10-10 15:27:55 -070043int board_usb_init(int index, enum usb_init_type init)
Marek Vasut163551a2010-05-11 04:31:44 +020044{
Marek Vasut2db1e962010-09-09 09:50:39 +020045 writel((readl(UHCHR) | UHCHR_PCPL | UHCHR_PSPL) &
46 ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE),
47 UHCHR);
Marek Vasut163551a2010-05-11 04:31:44 +020048
Marek Vasut2db1e962010-09-09 09:50:39 +020049 writel(readl(UHCHR) | UHCHR_FSBIR, UHCHR);
Marek Vasut163551a2010-05-11 04:31:44 +020050
Marek Vasute326a232011-11-26 07:15:36 +010051 while (UHCHR & UHCHR_FSBIR)
52 ;
Marek Vasut163551a2010-05-11 04:31:44 +020053
Marek Vasut2db1e962010-09-09 09:50:39 +020054 writel(readl(UHCHR) & ~UHCHR_SSE, UHCHR);
55 writel((UHCHIE_UPRIE | UHCHIE_RWIE), UHCHIE);
Marek Vasut163551a2010-05-11 04:31:44 +020056
57 /* Clear any OTG Pin Hold */
Marek Vasut2db1e962010-09-09 09:50:39 +020058 if (readl(PSSR) & PSSR_OTGPH)
59 writel(readl(PSSR) | PSSR_OTGPH, PSSR);
Marek Vasut163551a2010-05-11 04:31:44 +020060
Marek Vasut2db1e962010-09-09 09:50:39 +020061 writel(readl(UHCRHDA) & ~(0x200), UHCRHDA);
62 writel(readl(UHCRHDA) | 0x100, UHCRHDA);
Marek Vasut163551a2010-05-11 04:31:44 +020063
64 /* Set port power control mask bits, only 3 ports. */
Marek Vasut2db1e962010-09-09 09:50:39 +020065 writel(readl(UHCRHDB) | (0x7<<17), UHCRHDB);
Marek Vasut163551a2010-05-11 04:31:44 +020066
67 /* enable port 2 */
Marek Vasut2db1e962010-09-09 09:50:39 +020068 writel(readl(UP2OCR) | UP2OCR_HXOE | UP2OCR_HXS |
69 UP2OCR_DMPDE | UP2OCR_DPPDE, UP2OCR);
Marek Vasut163551a2010-05-11 04:31:44 +020070
71 return 0;
72}
73
Troy Kiskyde8ae7b2013-10-10 15:27:55 -070074int board_usb_cleanup(int index, enum usb_init_type init)
Marek Vasut163551a2010-05-11 04:31:44 +020075{
Mateusz Zalegad862f892013-10-04 19:22:26 +020076 return 0;
Marek Vasut163551a2010-05-11 04:31:44 +020077}
78
79void usb_board_stop(void)
80{
Marek Vasut2db1e962010-09-09 09:50:39 +020081 writel(readl(UHCHR) | UHCHR_FHR, UHCHR);
Marek Vasut163551a2010-05-11 04:31:44 +020082 udelay(11);
Marek Vasut2db1e962010-09-09 09:50:39 +020083 writel(readl(UHCHR) & ~UHCHR_FHR, UHCHR);
Marek Vasut163551a2010-05-11 04:31:44 +020084
Marek Vasut2db1e962010-09-09 09:50:39 +020085 writel(readl(UHCCOMS) | 1, UHCCOMS);
Marek Vasut163551a2010-05-11 04:31:44 +020086 udelay(10);
87
Marek Vasut2db1e962010-09-09 09:50:39 +020088 writel(readl(CKEN) & ~CKEN10_USBHOST, CKEN);
Marek Vasut163551a2010-05-11 04:31:44 +020089
90 return;
91}
92#endif
93
94#ifdef CONFIG_DRIVER_DM9000
95int board_eth_init(bd_t *bis)
96{
97 return dm9000_initialize(bis);
98}
99#endif
Marek Vasute326a232011-11-26 07:15:36 +0100100
101#ifdef CONFIG_CMD_MMC
102int board_mmc_init(bd_t *bis)
103{
104 pxa_mmc_register(0);
105 return 0;
106}
107#endif