blob: 2e3e03a152716846659f43545fdf7d145de87283 [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 Vasut71d058b2011-11-26 11:17:32 +010011#include <asm/arch/pxa.h>
Marcel Ziswiler15fc2722016-11-14 21:40:28 +010012#include <asm/arch/regs-mmc.h>
13#include <asm/arch/regs-uart.h>
Marek Vasut2db1e962010-09-09 09:50:39 +020014#include <asm/io.h>
Marcel Ziswiler15fc2722016-11-14 21:40:28 +010015#include <dm/platdata.h>
16#include <dm/platform_data/serial_pxa.h>
17#include <netdev.h>
Marek Vasute326a232011-11-26 07:15:36 +010018#include <serial.h>
Mateusz Zalegad862f892013-10-04 19:22:26 +020019#include <usb.h>
Marek Vasut163551a2010-05-11 04:31:44 +020020
21DECLARE_GLOBAL_DATA_PTR;
22
Marek Vasute326a232011-11-26 07:15:36 +010023int board_init(void)
Marek Vasut163551a2010-05-11 04:31:44 +020024{
Marek Vasut20212992010-10-20 20:15:11 +020025 /* We have RAM, disable cache */
26 dcache_disable();
27 icache_disable();
Marek Vasut163551a2010-05-11 04:31:44 +020028
Marcel Ziswilerb7063652015-03-01 00:53:08 +010029 /* arch number of Toradex Colibri PXA270 */
Marek Vasut163551a2010-05-11 04:31:44 +020030 gd->bd->bi_arch_number = MACH_TYPE_COLIBRI;
31
32 /* adress of boot parameters */
33 gd->bd->bi_boot_params = 0xa0000100;
34
35 return 0;
36}
37
Marek Vasut20212992010-10-20 20:15:11 +020038int dram_init(void)
Marek Vasut163551a2010-05-11 04:31:44 +020039{
Marek Vasut08341be2011-11-26 11:18:57 +010040 pxa2xx_dram_init();
Marek Vasut20212992010-10-20 20:15:11 +020041 gd->ram_size = PHYS_SDRAM_1_SIZE;
42 return 0;
43}
Marek Vasut163551a2010-05-11 04:31:44 +020044
Marek Vasut163551a2010-05-11 04:31:44 +020045#ifdef CONFIG_CMD_USB
Troy Kiskyde8ae7b2013-10-10 15:27:55 -070046int board_usb_init(int index, enum usb_init_type init)
Marek Vasut163551a2010-05-11 04:31:44 +020047{
Marek Vasut2db1e962010-09-09 09:50:39 +020048 writel((readl(UHCHR) | UHCHR_PCPL | UHCHR_PSPL) &
49 ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE),
50 UHCHR);
Marek Vasut163551a2010-05-11 04:31:44 +020051
Marek Vasut2db1e962010-09-09 09:50:39 +020052 writel(readl(UHCHR) | UHCHR_FSBIR, UHCHR);
Marek Vasut163551a2010-05-11 04:31:44 +020053
Marek Vasute326a232011-11-26 07:15:36 +010054 while (UHCHR & UHCHR_FSBIR)
55 ;
Marek Vasut163551a2010-05-11 04:31:44 +020056
Marek Vasut2db1e962010-09-09 09:50:39 +020057 writel(readl(UHCHR) & ~UHCHR_SSE, UHCHR);
58 writel((UHCHIE_UPRIE | UHCHIE_RWIE), UHCHIE);
Marek Vasut163551a2010-05-11 04:31:44 +020059
60 /* Clear any OTG Pin Hold */
Marek Vasut2db1e962010-09-09 09:50:39 +020061 if (readl(PSSR) & PSSR_OTGPH)
62 writel(readl(PSSR) | PSSR_OTGPH, PSSR);
Marek Vasut163551a2010-05-11 04:31:44 +020063
Marek Vasut2db1e962010-09-09 09:50:39 +020064 writel(readl(UHCRHDA) & ~(0x200), UHCRHDA);
65 writel(readl(UHCRHDA) | 0x100, UHCRHDA);
Marek Vasut163551a2010-05-11 04:31:44 +020066
67 /* Set port power control mask bits, only 3 ports. */
Marek Vasut2db1e962010-09-09 09:50:39 +020068 writel(readl(UHCRHDB) | (0x7<<17), UHCRHDB);
Marek Vasut163551a2010-05-11 04:31:44 +020069
70 /* enable port 2 */
Marek Vasut2db1e962010-09-09 09:50:39 +020071 writel(readl(UP2OCR) | UP2OCR_HXOE | UP2OCR_HXS |
72 UP2OCR_DMPDE | UP2OCR_DPPDE, UP2OCR);
Marek Vasut163551a2010-05-11 04:31:44 +020073
74 return 0;
75}
76
Troy Kiskyde8ae7b2013-10-10 15:27:55 -070077int board_usb_cleanup(int index, enum usb_init_type init)
Marek Vasut163551a2010-05-11 04:31:44 +020078{
Mateusz Zalegad862f892013-10-04 19:22:26 +020079 return 0;
Marek Vasut163551a2010-05-11 04:31:44 +020080}
81
82void usb_board_stop(void)
83{
Marek Vasut2db1e962010-09-09 09:50:39 +020084 writel(readl(UHCHR) | UHCHR_FHR, UHCHR);
Marek Vasut163551a2010-05-11 04:31:44 +020085 udelay(11);
Marek Vasut2db1e962010-09-09 09:50:39 +020086 writel(readl(UHCHR) & ~UHCHR_FHR, UHCHR);
Marek Vasut163551a2010-05-11 04:31:44 +020087
Marek Vasut2db1e962010-09-09 09:50:39 +020088 writel(readl(UHCCOMS) | 1, UHCCOMS);
Marek Vasut163551a2010-05-11 04:31:44 +020089 udelay(10);
90
Marek Vasut2db1e962010-09-09 09:50:39 +020091 writel(readl(CKEN) & ~CKEN10_USBHOST, CKEN);
Marek Vasut163551a2010-05-11 04:31:44 +020092
93 return;
94}
95#endif
96
97#ifdef CONFIG_DRIVER_DM9000
98int board_eth_init(bd_t *bis)
99{
100 return dm9000_initialize(bis);
101}
102#endif
Marek Vasute326a232011-11-26 07:15:36 +0100103
104#ifdef CONFIG_CMD_MMC
105int board_mmc_init(bd_t *bis)
106{
107 pxa_mmc_register(0);
108 return 0;
109}
110#endif
Marcel Ziswiler15fc2722016-11-14 21:40:28 +0100111
112static const struct pxa_serial_platdata serial_platdata = {
113 .base = (struct pxa_uart_regs *)FFUART_BASE,
114 .port = FFUART_INDEX,
115 .baudrate = CONFIG_BAUDRATE,
116};
117
118U_BOOT_DEVICE(pxa_serials) = {
119 .name = "serial_pxa",
120 .platdata = &serial_platdata,
121};