Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 Samsung Electronics |
| 3 | * |
| 4 | * See file CREDITS for list of people who contributed to this |
| 5 | * project. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License as |
| 9 | * published by the Free Software Foundation; either version 2 of |
| 10 | * the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 20 | * MA 02111-1307 USA |
| 21 | */ |
| 22 | |
| 23 | #include <common.h> |
| 24 | #include <asm/io.h> |
| 25 | #include <netdev.h> |
| 26 | #include <asm/arch/cpu.h> |
| 27 | #include <asm/arch/gpio.h> |
| 28 | #include <asm/arch/mmc.h> |
Rajeshwari Shinde | 5d2a8e2 | 2012-06-06 19:54:30 +0000 | [diff] [blame^] | 29 | #include <asm/arch/pinmux.h> |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 30 | #include <asm/arch/sromc.h> |
| 31 | |
| 32 | DECLARE_GLOBAL_DATA_PTR; |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 33 | |
Chander Kashyap | 5ff8061e | 2012-02-09 01:26:19 +0000 | [diff] [blame] | 34 | #ifdef CONFIG_SMC911X |
Rajeshwari Shinde | 5d2a8e2 | 2012-06-06 19:54:30 +0000 | [diff] [blame^] | 35 | static int smc9115_pre_init(void) |
Chander Kashyap | 5ff8061e | 2012-02-09 01:26:19 +0000 | [diff] [blame] | 36 | { |
| 37 | u32 smc_bw_conf, smc_bc_conf; |
Rajeshwari Shinde | 5d2a8e2 | 2012-06-06 19:54:30 +0000 | [diff] [blame^] | 38 | int err; |
Chander Kashyap | 5ff8061e | 2012-02-09 01:26:19 +0000 | [diff] [blame] | 39 | |
| 40 | /* Ethernet needs data bus width of 16 bits */ |
| 41 | smc_bw_conf = SROMC_DATA16_WIDTH(CONFIG_ENV_SROM_BANK) |
| 42 | | SROMC_BYTE_ENABLE(CONFIG_ENV_SROM_BANK); |
| 43 | |
| 44 | smc_bc_conf = SROMC_BC_TACS(0x01) | SROMC_BC_TCOS(0x01) |
| 45 | | SROMC_BC_TACC(0x06) | SROMC_BC_TCOH(0x01) |
| 46 | | SROMC_BC_TAH(0x0C) | SROMC_BC_TACP(0x09) |
| 47 | | SROMC_BC_PMC(0x01); |
| 48 | |
| 49 | /* Select and configure the SROMC bank */ |
Rajeshwari Shinde | 5d2a8e2 | 2012-06-06 19:54:30 +0000 | [diff] [blame^] | 50 | err = exynos_pinmux_config(PERIPH_ID_SROMC, |
| 51 | CONFIG_ENV_SROM_BANK | PINMUX_FLAG_16BIT); |
| 52 | if (err) { |
| 53 | debug("SROMC not configured\n"); |
| 54 | return err; |
| 55 | } |
| 56 | |
Chander Kashyap | 5ff8061e | 2012-02-09 01:26:19 +0000 | [diff] [blame] | 57 | s5p_config_sromc(CONFIG_ENV_SROM_BANK, smc_bw_conf, smc_bc_conf); |
Rajeshwari Shinde | 5d2a8e2 | 2012-06-06 19:54:30 +0000 | [diff] [blame^] | 58 | return 0; |
Chander Kashyap | 5ff8061e | 2012-02-09 01:26:19 +0000 | [diff] [blame] | 59 | } |
| 60 | #endif |
| 61 | |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 62 | int board_init(void) |
| 63 | { |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 64 | gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL); |
| 65 | return 0; |
| 66 | } |
| 67 | |
| 68 | int dram_init(void) |
| 69 | { |
| 70 | gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE) |
| 71 | + get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE) |
| 72 | + get_ram_size((long *)PHYS_SDRAM_3, PHYS_SDRAM_3_SIZE) |
| 73 | + get_ram_size((long *)PHYS_SDRAM_4, PHYS_SDRAM_4_SIZE) |
| 74 | + get_ram_size((long *)PHYS_SDRAM_5, PHYS_SDRAM_7_SIZE) |
| 75 | + get_ram_size((long *)PHYS_SDRAM_6, PHYS_SDRAM_7_SIZE) |
| 76 | + get_ram_size((long *)PHYS_SDRAM_7, PHYS_SDRAM_7_SIZE) |
| 77 | + get_ram_size((long *)PHYS_SDRAM_8, PHYS_SDRAM_8_SIZE); |
| 78 | return 0; |
| 79 | } |
| 80 | |
| 81 | void dram_init_banksize(void) |
| 82 | { |
| 83 | gd->bd->bi_dram[0].start = PHYS_SDRAM_1; |
| 84 | gd->bd->bi_dram[0].size = get_ram_size((long *)PHYS_SDRAM_1, |
| 85 | PHYS_SDRAM_1_SIZE); |
| 86 | gd->bd->bi_dram[1].start = PHYS_SDRAM_2; |
| 87 | gd->bd->bi_dram[1].size = get_ram_size((long *)PHYS_SDRAM_2, |
| 88 | PHYS_SDRAM_2_SIZE); |
| 89 | gd->bd->bi_dram[2].start = PHYS_SDRAM_3; |
| 90 | gd->bd->bi_dram[2].size = get_ram_size((long *)PHYS_SDRAM_3, |
| 91 | PHYS_SDRAM_3_SIZE); |
| 92 | gd->bd->bi_dram[3].start = PHYS_SDRAM_4; |
| 93 | gd->bd->bi_dram[3].size = get_ram_size((long *)PHYS_SDRAM_4, |
| 94 | PHYS_SDRAM_4_SIZE); |
| 95 | gd->bd->bi_dram[4].start = PHYS_SDRAM_5; |
| 96 | gd->bd->bi_dram[4].size = get_ram_size((long *)PHYS_SDRAM_5, |
| 97 | PHYS_SDRAM_5_SIZE); |
| 98 | gd->bd->bi_dram[5].start = PHYS_SDRAM_6; |
| 99 | gd->bd->bi_dram[5].size = get_ram_size((long *)PHYS_SDRAM_6, |
| 100 | PHYS_SDRAM_6_SIZE); |
| 101 | gd->bd->bi_dram[6].start = PHYS_SDRAM_7; |
| 102 | gd->bd->bi_dram[6].size = get_ram_size((long *)PHYS_SDRAM_7, |
| 103 | PHYS_SDRAM_7_SIZE); |
| 104 | gd->bd->bi_dram[7].start = PHYS_SDRAM_8; |
| 105 | gd->bd->bi_dram[7].size = get_ram_size((long *)PHYS_SDRAM_8, |
| 106 | PHYS_SDRAM_8_SIZE); |
| 107 | } |
| 108 | |
Chander Kashyap | 5ff8061e | 2012-02-09 01:26:19 +0000 | [diff] [blame] | 109 | int board_eth_init(bd_t *bis) |
| 110 | { |
| 111 | #ifdef CONFIG_SMC911X |
Rajeshwari Shinde | 5d2a8e2 | 2012-06-06 19:54:30 +0000 | [diff] [blame^] | 112 | if (smc9115_pre_init()) |
| 113 | return -1; |
Chander Kashyap | 5ff8061e | 2012-02-09 01:26:19 +0000 | [diff] [blame] | 114 | return smc911x_initialize(0, CONFIG_SMC911X_BASE); |
| 115 | #endif |
| 116 | return 0; |
| 117 | } |
| 118 | |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 119 | #ifdef CONFIG_DISPLAY_BOARDINFO |
| 120 | int checkboard(void) |
| 121 | { |
| 122 | printf("\nBoard: SMDK5250\n"); |
| 123 | |
| 124 | return 0; |
| 125 | } |
| 126 | #endif |
| 127 | |
| 128 | #ifdef CONFIG_GENERIC_MMC |
| 129 | int board_mmc_init(bd_t *bis) |
| 130 | { |
Rajeshwari Shinde | 5d2a8e2 | 2012-06-06 19:54:30 +0000 | [diff] [blame^] | 131 | int err; |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 132 | |
Rajeshwari Shinde | 5d2a8e2 | 2012-06-06 19:54:30 +0000 | [diff] [blame^] | 133 | err = exynos_pinmux_config(PERIPH_ID_SDMMC2, PINMUX_FLAG_NONE); |
| 134 | if (err) { |
| 135 | debug("SDMMC2 not configured\n"); |
| 136 | return err; |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | err = s5p_mmc_init(2, 4); |
| 140 | return err; |
| 141 | } |
| 142 | #endif |
| 143 | |
Rajeshwari Shinde | 5d2a8e2 | 2012-06-06 19:54:30 +0000 | [diff] [blame^] | 144 | static int board_uart_init(void) |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 145 | { |
Rajeshwari Shinde | 5d2a8e2 | 2012-06-06 19:54:30 +0000 | [diff] [blame^] | 146 | int err; |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 147 | |
Rajeshwari Shinde | 5d2a8e2 | 2012-06-06 19:54:30 +0000 | [diff] [blame^] | 148 | err = exynos_pinmux_config(PERIPH_ID_UART0, PINMUX_FLAG_NONE); |
| 149 | if (err) { |
| 150 | debug("UART0 not configured\n"); |
| 151 | return err; |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 152 | } |
Doug Anderson | f421952 | 2012-02-13 07:38:05 +0000 | [diff] [blame] | 153 | |
Rajeshwari Shinde | 5d2a8e2 | 2012-06-06 19:54:30 +0000 | [diff] [blame^] | 154 | err = exynos_pinmux_config(PERIPH_ID_UART1, PINMUX_FLAG_NONE); |
| 155 | if (err) { |
| 156 | debug("UART1 not configured\n"); |
| 157 | return err; |
Doug Anderson | f421952 | 2012-02-13 07:38:05 +0000 | [diff] [blame] | 158 | } |
| 159 | |
Rajeshwari Shinde | 5d2a8e2 | 2012-06-06 19:54:30 +0000 | [diff] [blame^] | 160 | err = exynos_pinmux_config(PERIPH_ID_UART2, PINMUX_FLAG_NONE); |
| 161 | if (err) { |
| 162 | debug("UART2 not configured\n"); |
| 163 | return err; |
Doug Anderson | f421952 | 2012-02-13 07:38:05 +0000 | [diff] [blame] | 164 | } |
| 165 | |
Rajeshwari Shinde | 5d2a8e2 | 2012-06-06 19:54:30 +0000 | [diff] [blame^] | 166 | err = exynos_pinmux_config(PERIPH_ID_UART3, PINMUX_FLAG_NONE); |
| 167 | if (err) { |
| 168 | debug("UART3 not configured\n"); |
| 169 | return err; |
Doug Anderson | f421952 | 2012-02-13 07:38:05 +0000 | [diff] [blame] | 170 | } |
| 171 | |
Rajeshwari Shinde | 5d2a8e2 | 2012-06-06 19:54:30 +0000 | [diff] [blame^] | 172 | return 0; |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | #ifdef CONFIG_BOARD_EARLY_INIT_F |
| 176 | int board_early_init_f(void) |
| 177 | { |
Rajeshwari Shinde | 5d2a8e2 | 2012-06-06 19:54:30 +0000 | [diff] [blame^] | 178 | return board_uart_init(); |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 179 | } |
| 180 | #endif |