Chander Kashyap | e21185b | 2011-05-24 20:02:56 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 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> |
| 29 | #include <asm/arch/sromc.h> |
| 30 | |
| 31 | DECLARE_GLOBAL_DATA_PTR; |
| 32 | struct s5pc210_gpio_part1 *gpio1; |
| 33 | struct s5pc210_gpio_part2 *gpio2; |
| 34 | |
| 35 | static void smc9115_pre_init(void) |
| 36 | { |
| 37 | u32 smc_bw_conf, smc_bc_conf; |
| 38 | |
| 39 | /* gpio configuration GPK0CON */ |
Łukasz Majewski | ef5d9eb | 2011-07-15 00:16:22 +0000 | [diff] [blame^] | 40 | s5p_gpio_cfg_pin(&gpio2->y0, CONFIG_ENV_SROM_BANK, GPIO_FUNC(2)); |
Chander Kashyap | e21185b | 2011-05-24 20:02:56 +0000 | [diff] [blame] | 41 | |
| 42 | /* Ethernet needs bus width of 16 bits */ |
| 43 | smc_bw_conf = SROMC_DATA16_WIDTH(CONFIG_ENV_SROM_BANK); |
| 44 | smc_bc_conf = SROMC_BC_TACS(0x0F) | SROMC_BC_TCOS(0x0F) |
| 45 | | SROMC_BC_TACC(0x0F) | SROMC_BC_TCOH(0x0F) |
| 46 | | SROMC_BC_TAH(0x0F) | SROMC_BC_TACP(0x0F) |
| 47 | | SROMC_BC_PMC(0x0F); |
| 48 | |
| 49 | /* Select and configure the SROMC bank */ |
| 50 | s5p_config_sromc(CONFIG_ENV_SROM_BANK, smc_bw_conf, smc_bc_conf); |
| 51 | } |
| 52 | |
| 53 | int board_init(void) |
| 54 | { |
| 55 | gpio1 = (struct s5pc210_gpio_part1 *) S5PC210_GPIO_PART1_BASE; |
| 56 | gpio2 = (struct s5pc210_gpio_part2 *) S5PC210_GPIO_PART2_BASE; |
| 57 | |
| 58 | smc9115_pre_init(); |
| 59 | |
| 60 | gd->bd->bi_arch_number = MACH_TYPE_SMDKV310; |
| 61 | gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL); |
| 62 | return 0; |
| 63 | } |
| 64 | |
| 65 | int dram_init(void) |
| 66 | { |
| 67 | gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE) |
| 68 | + get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE) |
| 69 | + get_ram_size((long *)PHYS_SDRAM_3, PHYS_SDRAM_3_SIZE) |
| 70 | + get_ram_size((long *)PHYS_SDRAM_4, PHYS_SDRAM_4_SIZE); |
| 71 | |
| 72 | return 0; |
| 73 | } |
| 74 | |
| 75 | void dram_init_banksize(void) |
| 76 | { |
| 77 | gd->bd->bi_dram[0].start = PHYS_SDRAM_1; |
| 78 | gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; |
| 79 | gd->bd->bi_dram[1].start = PHYS_SDRAM_2; |
| 80 | gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE; |
| 81 | gd->bd->bi_dram[2].start = PHYS_SDRAM_3; |
| 82 | gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE; |
| 83 | gd->bd->bi_dram[3].start = PHYS_SDRAM_4; |
| 84 | gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE; |
| 85 | } |
| 86 | |
| 87 | int board_eth_init(bd_t *bis) |
| 88 | { |
| 89 | int rc = 0; |
| 90 | #ifdef CONFIG_SMC911X |
| 91 | rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); |
| 92 | #endif |
| 93 | return rc; |
| 94 | } |
| 95 | |
| 96 | #ifdef CONFIG_DISPLAY_BOARDINFO |
| 97 | int checkboard(void) |
| 98 | { |
| 99 | printf("\nBoard: SMDKV310\n"); |
| 100 | return 0; |
| 101 | } |
| 102 | #endif |
| 103 | |
| 104 | #ifdef CONFIG_GENERIC_MMC |
| 105 | int board_mmc_init(bd_t *bis) |
| 106 | { |
| 107 | int i, err; |
| 108 | |
| 109 | /* |
| 110 | * MMC2 SD card GPIO: |
| 111 | * |
| 112 | * GPK2[0] SD_2_CLK(2) |
| 113 | * GPK2[1] SD_2_CMD(2) |
| 114 | * GPK2[2] SD_2_CDn |
| 115 | * GPK2[3:6] SD_2_DATA[0:3](2) |
| 116 | */ |
| 117 | for (i = 0; i < 7; i++) { |
| 118 | /* GPK2[0:6] special function 2 */ |
Łukasz Majewski | ef5d9eb | 2011-07-15 00:16:22 +0000 | [diff] [blame^] | 119 | s5p_gpio_cfg_pin(&gpio2->k2, i, GPIO_FUNC(0x2)); |
Chander Kashyap | e21185b | 2011-05-24 20:02:56 +0000 | [diff] [blame] | 120 | |
| 121 | /* GPK2[0:6] drv 4x */ |
Łukasz Majewski | ef5d9eb | 2011-07-15 00:16:22 +0000 | [diff] [blame^] | 122 | s5p_gpio_set_drv(&gpio2->k2, i, GPIO_DRV_4X); |
Chander Kashyap | e21185b | 2011-05-24 20:02:56 +0000 | [diff] [blame] | 123 | |
| 124 | /* GPK2[0:1] pull disable */ |
| 125 | if (i == 0 || i == 1) { |
| 126 | gpio_set_pull(&gpio2->k2, i, GPIO_PULL_NONE); |
| 127 | continue; |
| 128 | } |
| 129 | |
| 130 | /* GPK2[2:6] pull up */ |
Łukasz Majewski | ef5d9eb | 2011-07-15 00:16:22 +0000 | [diff] [blame^] | 131 | s5p_gpio_set_pull(&gpio2->k2, i, GPIO_PULL_UP); |
Chander Kashyap | e21185b | 2011-05-24 20:02:56 +0000 | [diff] [blame] | 132 | } |
| 133 | err = s5p_mmc_init(2, 4); |
| 134 | return err; |
| 135 | } |
| 136 | #endif |