stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2007 |
| 3 | * Stefano Babic, DENX Gmbh, sbabic@denx.de |
| 4 | * |
| 5 | * (C) Copyright 2004 |
| 6 | * Robert Whaley, Applied Data Systems, Inc. rwhaley@applieddata.net |
| 7 | * |
| 8 | * (C) Copyright 2002 |
| 9 | * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net |
| 10 | * |
| 11 | * (C) Copyright 2002 |
| 12 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 13 | * Marius Groeger <mgroeger@sysgo.de> |
| 14 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 15 | * SPDX-License-Identifier: GPL-2.0+ |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 16 | */ |
| 17 | |
| 18 | #include <common.h> |
| 19 | #include <asm/arch/pxa-regs.h> |
Marek Vasut | 4438a45 | 2011-11-26 11:17:32 +0100 | [diff] [blame] | 20 | #include <asm/arch/pxa.h> |
Marek Vasut | 831f849 | 2012-09-30 10:09:49 +0000 | [diff] [blame] | 21 | #include <asm/arch/regs-mmc.h> |
Remy Bohmer | 60f61e6 | 2009-05-02 21:49:18 +0200 | [diff] [blame] | 22 | #include <netdev.h> |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 23 | #include <asm/io.h> |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 24 | |
| 25 | DECLARE_GLOBAL_DATA_PTR; |
| 26 | |
| 27 | #define RH_A_PSM (1 << 8) /* power switching mode */ |
| 28 | #define RH_A_NPS (1 << 9) /* no power switching */ |
| 29 | |
| 30 | extern struct serial_device serial_ffuart_device; |
| 31 | extern struct serial_device serial_btuart_device; |
| 32 | extern struct serial_device serial_stuart_device; |
| 33 | |
Marek Vasut | 7c957c0 | 2010-10-04 00:21:51 +0200 | [diff] [blame] | 34 | #if CONFIG_MK_POLARIS |
Stefano Babic | 040f8f6 | 2009-07-01 20:40:41 +0200 | [diff] [blame] | 35 | #define BOOT_CONSOLE "serial_stuart" |
| 36 | #else |
| 37 | #define BOOT_CONSOLE "serial_ffuart" |
| 38 | #endif |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 39 | /* ------------------------------------------------------------------------- */ |
| 40 | |
| 41 | /* |
| 42 | * Miscelaneous platform dependent initialisations |
| 43 | */ |
| 44 | |
Stefano Babic | 88bd975 | 2009-07-01 04:33:56 +0200 | [diff] [blame] | 45 | int usb_board_init(void) |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 46 | { |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 47 | writel((readl(UHCHR) | UHCHR_PCPL | UHCHR_PSPL) & |
| 48 | ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE), |
| 49 | UHCHR); |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 50 | |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 51 | writel(readl(UHCHR) | UHCHR_FSBIR, UHCHR); |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 52 | |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 53 | while (readl(UHCHR) & UHCHR_FSBIR) |
| 54 | ; |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 55 | |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 56 | writel(readl(UHCHR) & ~UHCHR_SSE, UHCHR); |
| 57 | writel((UHCHIE_UPRIE | UHCHIE_RWIE), UHCHIE); |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 58 | |
| 59 | /* Clear any OTG Pin Hold */ |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 60 | if (readl(PSSR) & PSSR_OTGPH) |
| 61 | writel(readl(PSSR) | PSSR_OTGPH, PSSR); |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 62 | |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 63 | writel(readl(UHCRHDA) & ~(RH_A_NPS), UHCRHDA); |
| 64 | writel(readl(UHCRHDA) | RH_A_PSM, UHCRHDA); |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 65 | |
| 66 | /* Set port power control mask bits, only 3 ports. */ |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 67 | writel(readl(UHCRHDB) | (0x7<<17), UHCRHDB); |
Stefano Babic | 88bd975 | 2009-07-01 04:33:56 +0200 | [diff] [blame] | 68 | |
| 69 | return 0; |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | void usb_board_init_fail(void) |
| 73 | { |
| 74 | return; |
| 75 | } |
| 76 | |
| 77 | void usb_board_stop(void) |
| 78 | { |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 79 | writel(readl(UHCHR) | UHCHR_FHR, UHCHR); |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 80 | udelay(11); |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 81 | writel(readl(UHCHR) & ~UHCHR_FHR, UHCHR); |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 82 | |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 83 | writel(readl(UHCCOMS) | 1, UHCCOMS); |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 84 | udelay(10); |
| 85 | |
Marek Vasut | 3ba8bf7 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 86 | writel(readl(CKEN) & ~CKEN10_USBHOST, CKEN); |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 87 | |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 88 | return; |
| 89 | } |
| 90 | |
| 91 | int board_init (void) |
| 92 | { |
Marek Vasut | cc72ac6 | 2010-10-20 21:28:14 +0200 | [diff] [blame] | 93 | /* We have RAM, disable cache */ |
| 94 | dcache_disable(); |
| 95 | icache_disable(); |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 96 | |
| 97 | /* arch number of ConXS Board */ |
| 98 | gd->bd->bi_arch_number = 776; |
| 99 | |
| 100 | /* adress of boot parameters */ |
| 101 | gd->bd->bi_boot_params = 0xa000003c; |
| 102 | |
| 103 | return 0; |
| 104 | } |
| 105 | |
| 106 | int board_late_init(void) |
| 107 | { |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 108 | char *console=getenv("boot_console"); |
| 109 | |
Stefano Babic | 040f8f6 | 2009-07-01 20:40:41 +0200 | [diff] [blame] | 110 | if ((console == NULL) || (strcmp(console,"serial_btuart") && |
| 111 | strcmp(console,"serial_stuart") && |
| 112 | strcmp(console,"serial_ffuart"))) { |
| 113 | console = BOOT_CONSOLE; |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 114 | } |
Stefano Babic | 040f8f6 | 2009-07-01 20:40:41 +0200 | [diff] [blame] | 115 | setenv("stdout",console); |
| 116 | setenv("stdin", console); |
| 117 | setenv("stderr",console); |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 118 | return 0; |
| 119 | } |
| 120 | |
Marek Vasut | cc72ac6 | 2010-10-20 21:28:14 +0200 | [diff] [blame] | 121 | int dram_init(void) |
| 122 | { |
Marek Vasut | f68d2a2 | 2011-11-26 11:18:57 +0100 | [diff] [blame] | 123 | pxa2xx_dram_init(); |
Marek Vasut | cc72ac6 | 2010-10-20 21:28:14 +0200 | [diff] [blame] | 124 | gd->ram_size = PHYS_SDRAM_1_SIZE; |
| 125 | return 0; |
| 126 | } |
| 127 | |
| 128 | void dram_init_banksize(void) |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 129 | { |
| 130 | gd->bd->bi_dram[0].start = PHYS_SDRAM_1; |
| 131 | gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; |
stefano babic | 5e5803e | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 132 | } |
Remy Bohmer | 60f61e6 | 2009-05-02 21:49:18 +0200 | [diff] [blame] | 133 | |
| 134 | #ifdef CONFIG_DRIVER_DM9000 |
| 135 | int board_eth_init(bd_t *bis) |
| 136 | { |
| 137 | return dm9000_initialize(bis); |
| 138 | } |
| 139 | #endif |
Marek Vasut | 831f849 | 2012-09-30 10:09:49 +0000 | [diff] [blame] | 140 | |
| 141 | #ifdef CONFIG_CMD_MMC |
| 142 | int board_mmc_init(bd_t *bis) |
| 143 | { |
| 144 | pxa_mmc_register(0); |
| 145 | return 0; |
| 146 | } |
| 147 | #endif |