Wolfgang Denk | e1ebacb | 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 | 0fd6aae | 2009-10-04 22:37:03 -0700 | [diff] [blame] | 34 | #include <netdev.h> |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 35 | #include <command.h> |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 36 | #include <asm/io.h> |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 37 | |
Wolfgang Denk | 6405a15 | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 38 | DECLARE_GLOBAL_DATA_PTR; |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 39 | |
| 40 | /* |
| 41 | * Miscelaneous platform dependent initialisations |
| 42 | */ |
| 43 | |
| 44 | int board_init (void) |
| 45 | { |
Marek Vasut | edd9d1d0 | 2010-10-20 21:20:07 +0200 | [diff] [blame] | 46 | /* We have RAM, disable cache */ |
| 47 | dcache_disable(); |
| 48 | icache_disable(); |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 49 | |
| 50 | /* arch number of Lubbock-Board */ |
| 51 | gd->bd->bi_arch_number = MACH_TYPE_PXA_IDP; |
| 52 | |
| 53 | /* adress of boot parameters */ |
| 54 | gd->bd->bi_boot_params = 0xa0000100; |
| 55 | |
| 56 | /* turn on serial ports */ |
| 57 | *(volatile unsigned int *)(PXA_CS5_PHYS + 0x03C0002c) = 0x13; |
| 58 | |
| 59 | /* set PWM for LCD */ |
| 60 | /* a value that works is 60Hz, 77% duty cycle */ |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 61 | writel(readl(CKEN) | CKEN0_PWM0, CKEN); |
| 62 | writel(0x3f, PWM_CTRL0); |
| 63 | writel(0x3ff, PWM_PERVAL0); |
| 64 | writel(792, PWM_PWDUTY0); |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 65 | |
| 66 | /* clear reset to AC97 codec */ |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 67 | writel(readl(CKEN) | CKEN2_AC97, CKEN); |
| 68 | writel(GCR_COLD_RST, GCR); |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 69 | |
| 70 | /* enable LCD backlight */ |
| 71 | /* *(volatile unsigned int *)(PXA_CS5_PHYS + 0x03C00030) = 0x7; */ |
| 72 | |
| 73 | /* test display */ |
| 74 | /* lcd_puts("This is a test\nTest #2\n"); */ |
| 75 | |
| 76 | return 0; |
| 77 | } |
| 78 | |
| 79 | int board_late_init(void) |
| 80 | { |
| 81 | setenv("stdout", "serial"); |
| 82 | setenv("stderr", "serial"); |
| 83 | return 0; |
| 84 | } |
| 85 | |
Marek Vasut | edd9d1d0 | 2010-10-20 21:20:07 +0200 | [diff] [blame] | 86 | extern void pxa_dram_init(void); |
| 87 | int dram_init(void) |
| 88 | { |
| 89 | pxa_dram_init(); |
| 90 | gd->ram_size = PHYS_SDRAM_1_SIZE; |
| 91 | return 0; |
| 92 | } |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 93 | |
Marek Vasut | edd9d1d0 | 2010-10-20 21:20:07 +0200 | [diff] [blame] | 94 | void dram_init_banksize(void) |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 95 | { |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 96 | gd->bd->bi_dram[0].start = PHYS_SDRAM_1; |
| 97 | gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 98 | } |
| 99 | |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 100 | #ifdef DEBUG_BLINKC_ENABLE |
| 101 | |
| 102 | void delay_c(void) |
| 103 | { |
| 104 | /* reset OSCR to 0 */ |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 105 | writel(0, OSCR); |
| 106 | while (readl(OSCR) > 0x10000) |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 107 | ; |
| 108 | |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 109 | while (readl(OSCR) < 0xd4000) |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 110 | ; |
| 111 | } |
| 112 | |
| 113 | void blink_c(void) |
| 114 | { |
| 115 | int led_bit = (1<<10); |
| 116 | |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 117 | writel(led_bit, GPDR0); |
| 118 | writel(led_bit, GPCR0); |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 119 | delay_c(); |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 120 | writel(led_bit, GPSR0); |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 121 | delay_c(); |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 122 | writel(led_bit, GPCR0); |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 123 | } |
| 124 | |
Wolfgang Denk | 6262d021 | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 125 | int do_idpcmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 126 | { |
| 127 | printf("IDPCMD started\n"); |
| 128 | return 0; |
| 129 | } |
| 130 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 131 | U_BOOT_CMD(idpcmd, CONFIG_SYS_MAXARGS, 0, do_idpcmd, |
Peter Tyser | dfb72b8 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 132 | "custom IDP command", |
Wolfgang Denk | c54781c | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 133 | "no args at this time" |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 134 | ); |
| 135 | |
| 136 | #endif |
Ben Warren | 0fd6aae | 2009-10-04 22:37:03 -0700 | [diff] [blame] | 137 | |
| 138 | #ifdef CONFIG_CMD_NET |
| 139 | int board_eth_init(bd_t *bis) |
| 140 | { |
| 141 | int rc = 0; |
| 142 | #ifdef CONFIG_SMC91111 |
| 143 | rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); |
| 144 | #endif |
| 145 | return rc; |
| 146 | } |
| 147 | #endif |