blob: 197ff3ef31d73f7c2b49f9c9b9c9bc8b582fdbf5 [file] [log] [blame]
Wolfgang Denk70a20472005-09-25 15:59:01 +02001/*
2 * (C) Copyright 2002
3 * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
4 *
5 * (C) Copyright 2002
6 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
7 * Marius Groeger <mgroeger@sysgo.de>
8 *
9 * (C) Copyright 2004
10 * BEC Systems <http://bec-systems.com>
11 * Cliff Brake <cliff.brake@gmail.com>
12 * Support for Accelent/Vibren PXA255 IDP
13 *
Wolfgang Denk1a459662013-07-08 09:37:19 +020014 * SPDX-License-Identifier: GPL-2.0+
Wolfgang Denk70a20472005-09-25 15:59:01 +020015 */
16
17#include <common.h>
Ben Warren7194ab82009-10-04 22:37:03 -070018#include <netdev.h>
Wolfgang Denk70a20472005-09-25 15:59:01 +020019#include <command.h>
Marek Vasut3ba8bf72010-09-09 09:50:39 +020020#include <asm/io.h>
Marek Vasut4438a452011-11-26 11:17:32 +010021#include <asm/arch/pxa.h>
Marek Vasut831f8492012-09-30 10:09:49 +000022#include <asm/arch/regs-mmc.h>
Wolfgang Denk70a20472005-09-25 15:59:01 +020023
Wolfgang Denkd87080b2006-03-31 18:32:53 +020024DECLARE_GLOBAL_DATA_PTR;
Wolfgang Denk70a20472005-09-25 15:59:01 +020025
26/*
27 * Miscelaneous platform dependent initialisations
28 */
29
30int board_init (void)
31{
Marek Vasut65bd6a92010-10-20 21:20:07 +020032 /* We have RAM, disable cache */
33 dcache_disable();
34 icache_disable();
Wolfgang Denk70a20472005-09-25 15:59:01 +020035
36 /* arch number of Lubbock-Board */
37 gd->bd->bi_arch_number = MACH_TYPE_PXA_IDP;
38
39 /* adress of boot parameters */
40 gd->bd->bi_boot_params = 0xa0000100;
41
42 /* turn on serial ports */
43 *(volatile unsigned int *)(PXA_CS5_PHYS + 0x03C0002c) = 0x13;
44
45 /* set PWM for LCD */
46 /* a value that works is 60Hz, 77% duty cycle */
Marek Vasut3ba8bf72010-09-09 09:50:39 +020047 writel(readl(CKEN) | CKEN0_PWM0, CKEN);
48 writel(0x3f, PWM_CTRL0);
49 writel(0x3ff, PWM_PERVAL0);
50 writel(792, PWM_PWDUTY0);
Wolfgang Denk70a20472005-09-25 15:59:01 +020051
52 /* clear reset to AC97 codec */
Marek Vasut3ba8bf72010-09-09 09:50:39 +020053 writel(readl(CKEN) | CKEN2_AC97, CKEN);
54 writel(GCR_COLD_RST, GCR);
Wolfgang Denk70a20472005-09-25 15:59:01 +020055
56 /* enable LCD backlight */
57 /* *(volatile unsigned int *)(PXA_CS5_PHYS + 0x03C00030) = 0x7; */
58
59 /* test display */
60 /* lcd_puts("This is a test\nTest #2\n"); */
61
62 return 0;
63}
64
Marek Vasut831f8492012-09-30 10:09:49 +000065#ifdef CONFIG_CMD_MMC
66int board_mmc_init(bd_t *bis)
67{
68 pxa_mmc_register(0);
69 return 0;
70}
71#endif
72
Wolfgang Denk70a20472005-09-25 15:59:01 +020073int board_late_init(void)
74{
75 setenv("stdout", "serial");
76 setenv("stderr", "serial");
77 return 0;
78}
79
Marek Vasut65bd6a92010-10-20 21:20:07 +020080int dram_init(void)
Wolfgang Denk70a20472005-09-25 15:59:01 +020081{
Marek Vasutf68d2a22011-11-26 11:18:57 +010082 pxa2xx_dram_init();
Marek Vasut65bd6a92010-10-20 21:20:07 +020083 gd->ram_size = PHYS_SDRAM_1_SIZE;
Wolfgang Denk70a20472005-09-25 15:59:01 +020084 return 0;
85}
86
Marek Vasut65bd6a92010-10-20 21:20:07 +020087void dram_init_banksize(void)
88{
89 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
90 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
91}
Wolfgang Denk70a20472005-09-25 15:59:01 +020092
93#ifdef DEBUG_BLINKC_ENABLE
94
95void delay_c(void)
96{
97 /* reset OSCR to 0 */
Marek Vasut3ba8bf72010-09-09 09:50:39 +020098 writel(0, OSCR);
99 while (readl(OSCR) > 0x10000)
Wolfgang Denk70a20472005-09-25 15:59:01 +0200100 ;
101
Marek Vasut3ba8bf72010-09-09 09:50:39 +0200102 while (readl(OSCR) < 0xd4000)
Wolfgang Denk70a20472005-09-25 15:59:01 +0200103 ;
104}
105
106void blink_c(void)
107{
108 int led_bit = (1<<10);
109
Marek Vasut3ba8bf72010-09-09 09:50:39 +0200110 writel(led_bit, GPDR0);
111 writel(led_bit, GPCR0);
Wolfgang Denk70a20472005-09-25 15:59:01 +0200112 delay_c();
Marek Vasut3ba8bf72010-09-09 09:50:39 +0200113 writel(led_bit, GPSR0);
Wolfgang Denk70a20472005-09-25 15:59:01 +0200114 delay_c();
Marek Vasut3ba8bf72010-09-09 09:50:39 +0200115 writel(led_bit, GPCR0);
Wolfgang Denk70a20472005-09-25 15:59:01 +0200116}
117
Wolfgang Denk54841ab2010-06-28 22:00:46 +0200118int do_idpcmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Wolfgang Denk70a20472005-09-25 15:59:01 +0200119{
120 printf("IDPCMD started\n");
121 return 0;
122}
123
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200124U_BOOT_CMD(idpcmd, CONFIG_SYS_MAXARGS, 0, do_idpcmd,
Peter Tyser2fb26042009-01-27 18:03:12 -0600125 "custom IDP command",
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200126 "no args at this time"
Wolfgang Denk70a20472005-09-25 15:59:01 +0200127);
128
129#endif
Ben Warren7194ab82009-10-04 22:37:03 -0700130
131#ifdef CONFIG_CMD_NET
132int board_eth_init(bd_t *bis)
133{
134 int rc = 0;
135#ifdef CONFIG_SMC91111
136 rc = smc91111_initialize(0, CONFIG_SMC91111_BASE);
137#endif
138 return rc;
139}
140#endif