Steve Sakoman | 1ad2158 | 2010-06-08 13:07:46 -0700 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Common functions for OMAP4 based boards |
| 4 | * |
| 5 | * (C) Copyright 2010 |
| 6 | * Texas Instruments, <www.ti.com> |
| 7 | * |
| 8 | * Author : |
| 9 | * Aneesh V <aneesh@ti.com> |
| 10 | * Steve Sakoman <steve@sakoman.com> |
| 11 | * |
| 12 | * See file CREDITS for list of people who contributed to this |
| 13 | * project. |
| 14 | * |
| 15 | * This program is free software; you can redistribute it and/or |
| 16 | * modify it under the terms of the GNU General Public License as |
| 17 | * published by the Free Software Foundation; either version 2 of |
| 18 | * the License, or (at your option) any later version. |
| 19 | * |
| 20 | * This program is distributed in the hope that it will be useful, |
| 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 | * GNU General Public License for more details. |
| 24 | * |
| 25 | * You should have received a copy of the GNU General Public License |
| 26 | * along with this program; if not, write to the Free Software |
| 27 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 28 | * MA 02111-1307 USA |
| 29 | */ |
| 30 | #include <common.h> |
| 31 | #include <asm/arch/cpu.h> |
| 32 | #include <asm/arch/sys_proto.h> |
| 33 | |
| 34 | /* |
| 35 | * Routine: s_init |
| 36 | * Description: Does early system init of muxing and clocks. |
| 37 | * - Called path is with SRAM stack. |
| 38 | */ |
| 39 | void s_init(void) |
| 40 | { |
| 41 | watchdog_init(); |
| 42 | } |
| 43 | |
| 44 | /* |
| 45 | * Routine: wait_for_command_complete |
| 46 | * Description: Wait for posting to finish on watchdog |
| 47 | */ |
| 48 | void wait_for_command_complete(struct watchdog *wd_base) |
| 49 | { |
| 50 | int pending = 1; |
| 51 | do { |
| 52 | pending = readl(&wd_base->wwps); |
| 53 | } while (pending); |
| 54 | } |
| 55 | |
| 56 | /* |
| 57 | * Routine: watchdog_init |
| 58 | * Description: Shut down watch dogs |
| 59 | */ |
| 60 | void watchdog_init(void) |
| 61 | { |
| 62 | struct watchdog *wd2_base = (struct watchdog *)WDT2_BASE; |
| 63 | |
| 64 | writel(WD_UNLOCK1, &wd2_base->wspr); |
| 65 | wait_for_command_complete(wd2_base); |
| 66 | writel(WD_UNLOCK2, &wd2_base->wspr); |
| 67 | } |
| 68 | |
| 69 | /* |
| 70 | * Routine: dram_init |
| 71 | * Description: sets uboots idea of sdram size |
| 72 | */ |
| 73 | int dram_init(void) |
| 74 | { |
| 75 | DECLARE_GLOBAL_DATA_PTR; |
| 76 | |
| 77 | gd->bd->bi_dram[0].start = 0x80000000; |
| 78 | gd->bd->bi_dram[0].size = 512 << 20; |
| 79 | return 0; |
| 80 | } |
| 81 | |
| 82 | /* |
| 83 | * Print board information |
| 84 | */ |
| 85 | int checkboard(void) |
| 86 | { |
| 87 | puts(sysinfo.board_string); |
| 88 | return 0; |
| 89 | } |
| 90 | |