Wolfgang Denk | 70a2047 | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 1 | /* |
| 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 | * |
| 14 | * See file CREDITS for list of people who contributed to this |
| 15 | * project. |
| 16 | * |
| 17 | * This program is free software; you can redistribute it and/or |
| 18 | * modify it under the terms of the GNU General Public License as |
| 19 | * published by the Free Software Foundation; either version 2 of |
| 20 | * the License, or (at your option) any later version. |
| 21 | * |
| 22 | * This program is distributed in the hope that it will be useful, |
| 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 25 | * GNU General Public License for more details. |
| 26 | * |
| 27 | * You should have received a copy of the GNU General Public License |
| 28 | * along with this program; if not, write to the Free Software |
| 29 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 30 | * MA 02111-1307 USA |
| 31 | */ |
| 32 | |
| 33 | #include <common.h> |
Ben Warren | 7194ab8 | 2009-10-04 22:37:03 -0700 | [diff] [blame] | 34 | #include <netdev.h> |
Wolfgang Denk | 70a2047 | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 35 | #include <command.h> |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 36 | #include <asm/io.h> |
Marek Vasut | 4438a45 | 2011-11-26 11:17:32 +0100 | [diff] [blame] | 37 | #include <asm/arch/pxa.h> |
Marek Vasut | 831f849 | 2012-09-30 10:09:49 +0000 | [diff] [blame^] | 38 | #include <asm/arch/regs-mmc.h> |
Wolfgang Denk | 70a2047 | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 39 | |
Wolfgang Denk | d87080b | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 40 | DECLARE_GLOBAL_DATA_PTR; |
Wolfgang Denk | 70a2047 | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 41 | |
| 42 | /* |
| 43 | * Miscelaneous platform dependent initialisations |
| 44 | */ |
| 45 | |
| 46 | int board_init (void) |
| 47 | { |
Marek Vasut | 65bd6a9 | 2010-10-20 21:20:07 +0200 | [diff] [blame] | 48 | /* We have RAM, disable cache */ |
| 49 | dcache_disable(); |
| 50 | icache_disable(); |
Wolfgang Denk | 70a2047 | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 51 | |
| 52 | /* arch number of Lubbock-Board */ |
| 53 | gd->bd->bi_arch_number = MACH_TYPE_PXA_IDP; |
| 54 | |
| 55 | /* adress of boot parameters */ |
| 56 | gd->bd->bi_boot_params = 0xa0000100; |
| 57 | |
| 58 | /* turn on serial ports */ |
| 59 | *(volatile unsigned int *)(PXA_CS5_PHYS + 0x03C0002c) = 0x13; |
| 60 | |
| 61 | /* set PWM for LCD */ |
| 62 | /* a value that works is 60Hz, 77% duty cycle */ |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 63 | writel(readl(CKEN) | CKEN0_PWM0, CKEN); |
| 64 | writel(0x3f, PWM_CTRL0); |
| 65 | writel(0x3ff, PWM_PERVAL0); |
| 66 | writel(792, PWM_PWDUTY0); |
Wolfgang Denk | 70a2047 | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 67 | |
| 68 | /* clear reset to AC97 codec */ |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 69 | writel(readl(CKEN) | CKEN2_AC97, CKEN); |
| 70 | writel(GCR_COLD_RST, GCR); |
Wolfgang Denk | 70a2047 | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 71 | |
| 72 | /* enable LCD backlight */ |
| 73 | /* *(volatile unsigned int *)(PXA_CS5_PHYS + 0x03C00030) = 0x7; */ |
| 74 | |
| 75 | /* test display */ |
| 76 | /* lcd_puts("This is a test\nTest #2\n"); */ |
| 77 | |
| 78 | return 0; |
| 79 | } |
| 80 | |
Marek Vasut | 831f849 | 2012-09-30 10:09:49 +0000 | [diff] [blame^] | 81 | #ifdef CONFIG_CMD_MMC |
| 82 | int board_mmc_init(bd_t *bis) |
| 83 | { |
| 84 | pxa_mmc_register(0); |
| 85 | return 0; |
| 86 | } |
| 87 | #endif |
| 88 | |
Wolfgang Denk | 70a2047 | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 89 | int board_late_init(void) |
| 90 | { |
| 91 | setenv("stdout", "serial"); |
| 92 | setenv("stderr", "serial"); |
| 93 | return 0; |
| 94 | } |
| 95 | |
Marek Vasut | 65bd6a9 | 2010-10-20 21:20:07 +0200 | [diff] [blame] | 96 | int dram_init(void) |
Wolfgang Denk | 70a2047 | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 97 | { |
Marek Vasut | f68d2a2 | 2011-11-26 11:18:57 +0100 | [diff] [blame] | 98 | pxa2xx_dram_init(); |
Marek Vasut | 65bd6a9 | 2010-10-20 21:20:07 +0200 | [diff] [blame] | 99 | gd->ram_size = PHYS_SDRAM_1_SIZE; |
Wolfgang Denk | 70a2047 | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 100 | return 0; |
| 101 | } |
| 102 | |
Marek Vasut | 65bd6a9 | 2010-10-20 21:20:07 +0200 | [diff] [blame] | 103 | void dram_init_banksize(void) |
| 104 | { |
| 105 | gd->bd->bi_dram[0].start = PHYS_SDRAM_1; |
| 106 | gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; |
| 107 | } |
Wolfgang Denk | 70a2047 | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 108 | |
| 109 | #ifdef DEBUG_BLINKC_ENABLE |
| 110 | |
| 111 | void delay_c(void) |
| 112 | { |
| 113 | /* reset OSCR to 0 */ |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 114 | writel(0, OSCR); |
| 115 | while (readl(OSCR) > 0x10000) |
Wolfgang Denk | 70a2047 | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 116 | ; |
| 117 | |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 118 | while (readl(OSCR) < 0xd4000) |
Wolfgang Denk | 70a2047 | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 119 | ; |
| 120 | } |
| 121 | |
| 122 | void blink_c(void) |
| 123 | { |
| 124 | int led_bit = (1<<10); |
| 125 | |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 126 | writel(led_bit, GPDR0); |
| 127 | writel(led_bit, GPCR0); |
Wolfgang Denk | 70a2047 | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 128 | delay_c(); |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 129 | writel(led_bit, GPSR0); |
Wolfgang Denk | 70a2047 | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 130 | delay_c(); |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 131 | writel(led_bit, GPCR0); |
Wolfgang Denk | 70a2047 | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 132 | } |
| 133 | |
Wolfgang Denk | 54841ab | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 134 | int do_idpcmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
Wolfgang Denk | 70a2047 | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 135 | { |
| 136 | printf("IDPCMD started\n"); |
| 137 | return 0; |
| 138 | } |
| 139 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 140 | U_BOOT_CMD(idpcmd, CONFIG_SYS_MAXARGS, 0, do_idpcmd, |
Peter Tyser | 2fb2604 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 141 | "custom IDP command", |
Wolfgang Denk | a89c33d | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 142 | "no args at this time" |
Wolfgang Denk | 70a2047 | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 143 | ); |
| 144 | |
| 145 | #endif |
Ben Warren | 7194ab8 | 2009-10-04 22:37:03 -0700 | [diff] [blame] | 146 | |
| 147 | #ifdef CONFIG_CMD_NET |
| 148 | int board_eth_init(bd_t *bis) |
| 149 | { |
| 150 | int rc = 0; |
| 151 | #ifdef CONFIG_SMC91111 |
| 152 | rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); |
| 153 | #endif |
| 154 | return rc; |
| 155 | } |
| 156 | #endif |