blob: 8d777df84640ed2617c5e3af119c928c1f46983d [file] [log] [blame]
Marek Vasut1e847582010-03-07 23:35:48 +01001/*
Marek Vasut0c116e92010-07-22 16:51:52 +02002 * Voipac PXA270 Support
Marek Vasut1e847582010-03-07 23:35:48 +01003 *
Marek Vasut0c116e92010-07-22 16:51:52 +02004 * Copyright (C) 2010 Marek Vasut <marek.vasut@gmail.com>
Marek Vasut1e847582010-03-07 23:35:48 +01005 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Marek Vasut1e847582010-03-07 23:35:48 +01007 */
8
9#include <common.h>
10#include <asm/arch/hardware.h>
Marek Vasute7a195b2011-08-28 06:30:40 +020011#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 <serial.h>
15#include <asm/io.h>
Mateusz Zalegad862f892013-10-04 19:22:26 +020016#include <usb.h>
Marek Vasut1e847582010-03-07 23:35:48 +010017
18DECLARE_GLOBAL_DATA_PTR;
19
Marek Vasut1e847582010-03-07 23:35:48 +010020/*
21 * Miscelaneous platform dependent initialisations
22 */
Marek Vasut0c116e92010-07-22 16:51:52 +020023int board_init(void)
Marek Vasut1e847582010-03-07 23:35:48 +010024{
Marek Vasut41239912010-09-28 15:50:49 +020025 /* We have RAM, disable cache */
26 dcache_disable();
27 icache_disable();
28
Marek Vasut1e847582010-03-07 23:35:48 +010029 /* memory and cpu-speed are setup before relocation */
30 /* so we do _nothing_ here */
31
Marek Vasut0c116e92010-07-22 16:51:52 +020032 /* Arch number of vpac270 */
Marek Vasut1e847582010-03-07 23:35:48 +010033 gd->bd->bi_arch_number = MACH_TYPE_VPAC270;
34
35 /* adress of boot parameters */
36 gd->bd->bi_boot_params = 0xa0000100;
37
38 return 0;
39}
40
Marek Vasut0c116e92010-07-22 16:51:52 +020041int dram_init(void)
42{
Marek Vasutd7a35452011-10-31 14:17:21 +010043#ifndef CONFIG_ONENAND
Marek Vasut08341be2011-11-26 11:18:57 +010044 pxa2xx_dram_init();
Marek Vasutd7a35452011-10-31 14:17:21 +010045#endif
Marek Vasut62f66a52010-09-23 09:46:57 +020046 gd->ram_size = PHYS_SDRAM_1_SIZE;
Marek Vasut62f66a52010-09-23 09:46:57 +020047 return 0;
48}
49
50void dram_init_banksize(void)
51{
Marek Vasut0c116e92010-07-22 16:51:52 +020052 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
Marek Vasut1e847582010-03-07 23:35:48 +010053 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
Marek Vasut1e847582010-03-07 23:35:48 +010054
Marek Vasutb8dfbf82010-10-03 18:27:36 +020055#ifdef CONFIG_RAM_256M
Marek Vasut0c116e92010-07-22 16:51:52 +020056 gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
57 gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
58#endif
Marek Vasut1e847582010-03-07 23:35:48 +010059}
60
Marek Vasute7a195b2011-08-28 06:30:40 +020061#ifdef CONFIG_CMD_MMC
62int board_mmc_init(bd_t *bis)
63{
64 pxa_mmc_register(0);
65 return 0;
66}
67#endif
68
Marek Vasut0c116e92010-07-22 16:51:52 +020069#ifdef CONFIG_CMD_USB
Troy Kiskyde8ae7b2013-10-10 15:27:55 -070070int board_usb_init(int index, enum usb_init_type init)
Marek Vasut1e847582010-03-07 23:35:48 +010071{
Marek Vasut2db1e962010-09-09 09:50:39 +020072 writel((UHCHR | UHCHR_PCPL | UHCHR_PSPL) &
73 ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE),
74 UHCHR);
Marek Vasut1e847582010-03-07 23:35:48 +010075
Marek Vasut2db1e962010-09-09 09:50:39 +020076 writel(readl(UHCHR) | UHCHR_FSBIR, UHCHR);
Marek Vasut1e847582010-03-07 23:35:48 +010077
Marek Vasut2db1e962010-09-09 09:50:39 +020078 while (readl(UHCHR) & UHCHR_FSBIR)
79 ;
Marek Vasut1e847582010-03-07 23:35:48 +010080
Marek Vasut2db1e962010-09-09 09:50:39 +020081 writel(readl(UHCHR) & ~UHCHR_SSE, UHCHR);
82 writel((UHCHIE_UPRIE | UHCHIE_RWIE), UHCHIE);
Marek Vasut1e847582010-03-07 23:35:48 +010083
84 /* Clear any OTG Pin Hold */
Marek Vasut2db1e962010-09-09 09:50:39 +020085 if (readl(PSSR) & PSSR_OTGPH)
86 writel(readl(PSSR) | PSSR_OTGPH, PSSR);
Marek Vasut1e847582010-03-07 23:35:48 +010087
Marek Vasut2db1e962010-09-09 09:50:39 +020088 writel(readl(UHCRHDA) & ~(0x200), UHCRHDA);
89 writel(readl(UHCRHDA) | 0x100, UHCRHDA);
Marek Vasut1e847582010-03-07 23:35:48 +010090
91 /* Set port power control mask bits, only 3 ports. */
Marek Vasut2db1e962010-09-09 09:50:39 +020092 writel(readl(UHCRHDB) | (0x7<<17), UHCRHDB);
Marek Vasut1e847582010-03-07 23:35:48 +010093
94 /* enable port 2 */
Marek Vasut2db1e962010-09-09 09:50:39 +020095 writel(readl(UP2OCR) | UP2OCR_HXOE | UP2OCR_HXS |
96 UP2OCR_DMPDE | UP2OCR_DPPDE, UP2OCR);
Marek Vasut1e847582010-03-07 23:35:48 +010097
98 return 0;
99}
100
Troy Kiskyde8ae7b2013-10-10 15:27:55 -0700101int board_usb_cleanup(int index, enum usb_init_type init)
Marek Vasut1e847582010-03-07 23:35:48 +0100102{
Mateusz Zalegad862f892013-10-04 19:22:26 +0200103 return 0;
Marek Vasut1e847582010-03-07 23:35:48 +0100104}
105
106void usb_board_stop(void)
107{
Marek Vasut2db1e962010-09-09 09:50:39 +0200108 writel(readl(UHCHR) | UHCHR_FHR, UHCHR);
Marek Vasut1e847582010-03-07 23:35:48 +0100109 udelay(11);
Marek Vasut2db1e962010-09-09 09:50:39 +0200110 writel(readl(UHCHR) & ~UHCHR_FHR, UHCHR);
Marek Vasut1e847582010-03-07 23:35:48 +0100111
Marek Vasut2db1e962010-09-09 09:50:39 +0200112 writel(readl(UHCCOMS) | 1, UHCCOMS);
Marek Vasut1e847582010-03-07 23:35:48 +0100113 udelay(10);
114
Marek Vasut2db1e962010-09-09 09:50:39 +0200115 writel(readl(CKEN) & ~CKEN10_USBHOST, CKEN);
Marek Vasut1e847582010-03-07 23:35:48 +0100116
117 return;
118}
Marek Vasut0c116e92010-07-22 16:51:52 +0200119#endif
Marek Vasut1e847582010-03-07 23:35:48 +0100120
121#ifdef CONFIG_DRIVER_DM9000
122int board_eth_init(bd_t *bis)
123{
124 return dm9000_initialize(bis);
125}
126#endif