blob: a136dc4c37ab611bbcbd82a7379f90251b0b3a96 [file] [log] [blame]
Sergey Yanovich4976dfe2013-05-21 01:26:00 +04001/*
2 * ICP DAS LP-8x4x Support
3 *
4 * Copyright (C) 2010 Marek Vasut <marek.vasut@gmail.com>
5 * adapted from Voipac PXA270 Support by
6 * Copyright (C) 2013 Sergey Yanovich <ynvich@gmail.com>
7 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02008 * SPDX-License-Identifier: GPL-2.0+
Sergey Yanovich4976dfe2013-05-21 01:26:00 +04009 */
10
11#include <common.h>
12#include <asm/arch/hardware.h>
13#include <asm/arch/regs-mmc.h>
14#include <asm/arch/pxa.h>
15#include <netdev.h>
16#include <serial.h>
17#include <asm/io.h>
Mateusz Zalegad862f892013-10-04 19:22:26 +020018#include <usb.h>
Sergey Yanovich4976dfe2013-05-21 01:26:00 +040019
20DECLARE_GLOBAL_DATA_PTR;
21
22/*
23 * Miscelaneous platform dependent initialisations
24 */
25int board_init(void)
26{
27 /* We have RAM, disable cache */
28 dcache_disable();
29 icache_disable();
30
31 /* memory and cpu-speed are setup before relocation */
32 /* so we do _nothing_ here */
33
34 /* adress of boot parameters */
35 gd->bd->bi_boot_params = 0xa0000100;
36
37 return 0;
38}
39
40int dram_init(void)
41{
42 pxa2xx_dram_init();
43 gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE);
44 return 0;
45}
46
47void dram_init_banksize(void)
48{
49 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
50 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
51}
52
53#ifdef CONFIG_CMD_MMC
54int board_mmc_init(bd_t *bis)
55{
56 pxa_mmc_register(0);
57 return 0;
58}
59#endif
60
61#ifdef CONFIG_CMD_USB
Troy Kiskyde8ae7b2013-10-10 15:27:55 -070062int board_usb_init(int index, enum usb_init_type init)
Sergey Yanovich4976dfe2013-05-21 01:26:00 +040063{
Sergei Ianovichd05bff12013-12-18 20:19:20 +040064 if (index !=0 || init != USB_INIT_HOST)
65 return -1;
66
67 writel(readl(CKEN) | CKEN10_USBHOST, CKEN);
68
69 writel(readl(UHCHR) | UHCHR_FHR, UHCHR);
70 udelay(11);
71 writel(readl(UHCHR) & ~UHCHR_FHR, UHCHR);
Sergey Yanovich4976dfe2013-05-21 01:26:00 +040072
73 writel(readl(UHCHR) | UHCHR_FSBIR, UHCHR);
74
75 while (readl(UHCHR) & UHCHR_FSBIR)
76 continue; /* required by checkpath.pl */
77
Sergei Ianovichd05bff12013-12-18 20:19:20 +040078 writel(readl(UHCHR) & ~UHCHR_SSEP0, UHCHR);
79 writel(readl(UHCRHDA) & ~(0x1000), UHCRHDA);
80 writel(readl(UHCRHDA) | 0x800, UHCRHDA);
81
Sergey Yanovich4976dfe2013-05-21 01:26:00 +040082 writel(readl(UHCHR) & ~UHCHR_SSE, UHCHR);
83 writel((UHCHIE_UPRIE | UHCHIE_RWIE), UHCHIE);
84
85 /* Clear any OTG Pin Hold */
86 if (readl(PSSR) & PSSR_OTGPH)
87 writel(readl(PSSR) | PSSR_OTGPH, PSSR);
88
89 writel(readl(UHCRHDA) & ~(0x200), UHCRHDA);
90 writel(readl(UHCRHDA) | 0x100, UHCRHDA);
91
92 /* Set port power control mask bits, only 3 ports. */
93 writel(readl(UHCRHDB) | (0x7<<17), UHCRHDB);
94
Sergey Yanovich4976dfe2013-05-21 01:26:00 +040095 return 0;
96}
97
Sergei Ianovichd05bff12013-12-18 20:19:20 +040098int usb_board_stop(void)
Sergey Yanovich4976dfe2013-05-21 01:26:00 +040099{
100 writel(readl(UHCHR) | UHCHR_FHR, UHCHR);
101 udelay(11);
102 writel(readl(UHCHR) & ~UHCHR_FHR, UHCHR);
103
104 writel(readl(UHCCOMS) | 1, UHCCOMS);
105 udelay(10);
106
Sergei Ianovichd05bff12013-12-18 20:19:20 +0400107 writel(readl(UHCHR) | UHCHR_SSEP0 | UHCHR_SSE, UHCHR);
108
Sergey Yanovich4976dfe2013-05-21 01:26:00 +0400109 writel(readl(CKEN) & ~CKEN10_USBHOST, CKEN);
110
Sergei Ianovichd05bff12013-12-18 20:19:20 +0400111 return 0;
112}
113
114int board_usb_cleanup(int index, enum usb_init_type init)
115{
116 if (index !=0 || init != USB_INIT_HOST)
117 return -1;
118
119 return usb_board_stop();
Sergey Yanovich4976dfe2013-05-21 01:26:00 +0400120}
121#endif
122
123#ifdef CONFIG_DRIVER_DM9000
Sergey Yanovich4976dfe2013-05-21 01:26:00 +0400124int board_eth_init(bd_t *bis)
125{
Sergey Yanovich4976dfe2013-05-21 01:26:00 +0400126 return dm9000_initialize(bis);
127}
128#endif