Enric Balletbo i Serra | 1a832dc | 2010-10-14 16:57:39 -0400 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2010 |
| 3 | * ISEE 2007 SL, <www.iseebcn.com> |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA |
| 22 | */ |
| 23 | #include <common.h> |
| 24 | #include <twl4030.h> |
| 25 | #include <asm/io.h> |
| 26 | #include <asm/arch/mem.h> |
Enric Balletbo i Serra | ac657c4 | 2010-11-04 15:34:37 -0400 | [diff] [blame] | 27 | #include <asm/arch/mmc_host_def.h> |
Enric Balletbo i Serra | 1a832dc | 2010-10-14 16:57:39 -0400 | [diff] [blame] | 28 | #include <asm/arch/mux.h> |
| 29 | #include <asm/arch/sys_proto.h> |
| 30 | #include <asm/mach-types.h> |
| 31 | #include "igep0030.h" |
| 32 | |
John Rigby | 2956532 | 2010-12-20 18:27:51 -0700 | [diff] [blame] | 33 | DECLARE_GLOBAL_DATA_PTR; |
| 34 | |
Enric Balletbo i Serra | 1a832dc | 2010-10-14 16:57:39 -0400 | [diff] [blame] | 35 | /* |
| 36 | * Routine: board_init |
| 37 | * Description: Early hardware init. |
| 38 | */ |
| 39 | int board_init(void) |
| 40 | { |
Enric Balletbo i Serra | 1a832dc | 2010-10-14 16:57:39 -0400 | [diff] [blame] | 41 | gpmc_init(); /* in SRAM or SDRAM, finish GPMC */ |
Enric Balletbo i Serra | 1a832dc | 2010-10-14 16:57:39 -0400 | [diff] [blame] | 42 | /* boot param addr */ |
| 43 | gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100); |
| 44 | |
| 45 | return 0; |
| 46 | } |
| 47 | |
Javier Martinez Canillas | d271a61 | 2012-07-28 01:19:34 +0000 | [diff] [blame] | 48 | #ifdef CONFIG_SPL_BUILD |
| 49 | /* |
| 50 | * Routine: omap_rev_string |
| 51 | * Description: For SPL builds output board rev |
| 52 | */ |
| 53 | void omap_rev_string(void) |
| 54 | { |
| 55 | } |
| 56 | |
| 57 | /* |
| 58 | * Routine: get_board_mem_timings |
| 59 | * Description: If we use SPL then there is no x-loader nor config header |
| 60 | * so we have to setup the DDR timings ourself on both banks. |
| 61 | */ |
| 62 | void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl, |
| 63 | u32 *mr) |
| 64 | { |
| 65 | *mr = MICRON_V_MR_165; |
| 66 | #ifdef CONFIG_BOOT_NAND |
Enric Balletbò i Serra | 4833b09 | 2012-08-05 00:55:56 +0000 | [diff] [blame] | 67 | *mcfg = MICRON_V_MCFG_200(256 << 20); |
Javier Martinez Canillas | d271a61 | 2012-07-28 01:19:34 +0000 | [diff] [blame] | 68 | *ctrla = MICRON_V_ACTIMA_200; |
| 69 | *ctrlb = MICRON_V_ACTIMB_200; |
| 70 | *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz; |
| 71 | #else |
| 72 | if (get_cpu_family() == CPU_OMAP34XX) { |
Enric Balletbò i Serra | 4833b09 | 2012-08-05 00:55:56 +0000 | [diff] [blame] | 73 | *mcfg = NUMONYX_V_MCFG_165(256 << 20); |
Javier Martinez Canillas | d271a61 | 2012-07-28 01:19:34 +0000 | [diff] [blame] | 74 | *ctrla = NUMONYX_V_ACTIMA_165; |
| 75 | *ctrlb = NUMONYX_V_ACTIMB_165; |
| 76 | *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz; |
| 77 | |
| 78 | } else { |
Enric Balletbò i Serra | 4833b09 | 2012-08-05 00:55:56 +0000 | [diff] [blame] | 79 | *mcfg = NUMONYX_V_MCFG_200(256 << 20); |
Javier Martinez Canillas | d271a61 | 2012-07-28 01:19:34 +0000 | [diff] [blame] | 80 | *ctrla = NUMONYX_V_ACTIMA_200; |
| 81 | *ctrlb = NUMONYX_V_ACTIMB_200; |
| 82 | *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz; |
| 83 | } |
| 84 | #endif |
| 85 | } |
| 86 | #endif |
| 87 | |
| 88 | #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD) |
Enric Balletbo i Serra | ac657c4 | 2010-11-04 15:34:37 -0400 | [diff] [blame] | 89 | int board_mmc_init(bd_t *bis) |
| 90 | { |
Jonathan Solnit | bbbc1ae | 2012-02-24 11:30:18 +0000 | [diff] [blame] | 91 | omap_mmc_init(0, 0, 0); |
Enric Balletbo i Serra | ac657c4 | 2010-11-04 15:34:37 -0400 | [diff] [blame] | 92 | return 0; |
| 93 | } |
| 94 | #endif |
| 95 | |
Enric Balletbo i Serra | 1a832dc | 2010-10-14 16:57:39 -0400 | [diff] [blame] | 96 | /* |
| 97 | * Routine: misc_init_r |
| 98 | * Description: Configure board specific parts |
| 99 | */ |
| 100 | int misc_init_r(void) |
| 101 | { |
| 102 | twl4030_power_init(); |
| 103 | |
| 104 | dieid_num_r(); |
| 105 | |
| 106 | return 0; |
| 107 | } |
| 108 | |
| 109 | /* |
| 110 | * Routine: set_muxconf_regs |
| 111 | * Description: Setting up the configuration Mux registers specific to the |
| 112 | * hardware. Many pins need to be moved from protect to primary |
| 113 | * mode. |
| 114 | */ |
| 115 | void set_muxconf_regs(void) |
| 116 | { |
| 117 | MUX_DEFAULT(); |
| 118 | } |