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 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 14 | * SPDX-License-Identifier: GPL-2.0+ |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <common.h> |
Ben Warren | 0fd6aae | 2009-10-04 22:37:03 -0700 | [diff] [blame] | 18 | #include <netdev.h> |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 19 | #include <command.h> |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 20 | #include <asm/io.h> |
Marek Vasut | 71d058b | 2011-11-26 11:17:32 +0100 | [diff] [blame] | 21 | #include <asm/arch/pxa.h> |
Marek Vasut | d2f3bbd | 2012-09-30 10:09:49 +0000 | [diff] [blame] | 22 | #include <asm/arch/regs-mmc.h> |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 23 | |
Wolfgang Denk | 6405a15 | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 24 | DECLARE_GLOBAL_DATA_PTR; |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 25 | |
| 26 | /* |
| 27 | * Miscelaneous platform dependent initialisations |
| 28 | */ |
| 29 | |
| 30 | int board_init (void) |
| 31 | { |
Marek Vasut | edd9d1d0 | 2010-10-20 21:20:07 +0200 | [diff] [blame] | 32 | /* We have RAM, disable cache */ |
| 33 | dcache_disable(); |
| 34 | icache_disable(); |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 35 | |
| 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 Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 47 | writel(readl(CKEN) | CKEN0_PWM0, CKEN); |
| 48 | writel(0x3f, PWM_CTRL0); |
| 49 | writel(0x3ff, PWM_PERVAL0); |
| 50 | writel(792, PWM_PWDUTY0); |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 51 | |
| 52 | /* clear reset to AC97 codec */ |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 53 | writel(readl(CKEN) | CKEN2_AC97, CKEN); |
| 54 | writel(GCR_COLD_RST, GCR); |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 55 | |
| 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 Vasut | d2f3bbd | 2012-09-30 10:09:49 +0000 | [diff] [blame] | 65 | #ifdef CONFIG_CMD_MMC |
| 66 | int board_mmc_init(bd_t *bis) |
| 67 | { |
| 68 | pxa_mmc_register(0); |
| 69 | return 0; |
| 70 | } |
| 71 | #endif |
| 72 | |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 73 | int board_late_init(void) |
| 74 | { |
| 75 | setenv("stdout", "serial"); |
| 76 | setenv("stderr", "serial"); |
| 77 | return 0; |
| 78 | } |
| 79 | |
Marek Vasut | edd9d1d0 | 2010-10-20 21:20:07 +0200 | [diff] [blame] | 80 | int dram_init(void) |
| 81 | { |
Marek Vasut | 08341be | 2011-11-26 11:18:57 +0100 | [diff] [blame] | 82 | pxa2xx_dram_init(); |
Marek Vasut | edd9d1d0 | 2010-10-20 21:20:07 +0200 | [diff] [blame] | 83 | gd->ram_size = PHYS_SDRAM_1_SIZE; |
| 84 | return 0; |
| 85 | } |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 86 | |
Marek Vasut | edd9d1d0 | 2010-10-20 21:20:07 +0200 | [diff] [blame] | 87 | void dram_init_banksize(void) |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 88 | { |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 89 | gd->bd->bi_dram[0].start = PHYS_SDRAM_1; |
| 90 | gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 91 | } |
| 92 | |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 93 | #ifdef DEBUG_BLINKC_ENABLE |
| 94 | |
| 95 | void delay_c(void) |
| 96 | { |
| 97 | /* reset OSCR to 0 */ |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 98 | writel(0, OSCR); |
| 99 | while (readl(OSCR) > 0x10000) |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 100 | ; |
| 101 | |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 102 | while (readl(OSCR) < 0xd4000) |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 103 | ; |
| 104 | } |
| 105 | |
| 106 | void blink_c(void) |
| 107 | { |
| 108 | int led_bit = (1<<10); |
| 109 | |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 110 | writel(led_bit, GPDR0); |
| 111 | writel(led_bit, GPCR0); |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 112 | delay_c(); |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 113 | writel(led_bit, GPSR0); |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 114 | delay_c(); |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 115 | writel(led_bit, GPCR0); |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 116 | } |
| 117 | |
Wolfgang Denk | 6262d021 | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 118 | 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] | 119 | { |
| 120 | printf("IDPCMD started\n"); |
| 121 | return 0; |
| 122 | } |
| 123 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 124 | U_BOOT_CMD(idpcmd, CONFIG_SYS_MAXARGS, 0, do_idpcmd, |
Peter Tyser | dfb72b8 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 125 | "custom IDP command", |
Wolfgang Denk | c54781c | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 126 | "no args at this time" |
Wolfgang Denk | e1ebacb | 2005-09-25 15:59:01 +0200 | [diff] [blame] | 127 | ); |
| 128 | |
| 129 | #endif |
Ben Warren | 0fd6aae | 2009-10-04 22:37:03 -0700 | [diff] [blame] | 130 | |
| 131 | #ifdef CONFIG_CMD_NET |
| 132 | int 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 |