wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2002 |
| 3 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 4 | * Marius Groeger <mgroeger@sysgo.de> |
| 5 | * |
| 6 | * (C) Copyright 2002 |
Detlev Zundel | 792a09e | 2009-05-13 10:54:10 +0200 | [diff] [blame] | 7 | * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de> |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 8 | * |
| 9 | * See file CREDITS for list of people who contributed to this |
| 10 | * project. |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License as |
| 14 | * published by the Free Software Foundation; either version 2 of |
| 15 | * the License, or (at your option) any later version. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program; if not, write to the Free Software |
| 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 25 | * MA 02111-1307 USA |
| 26 | */ |
| 27 | |
| 28 | #include <common.h> |
Ben Warren | b1c0eaa | 2009-08-25 13:09:37 -0700 | [diff] [blame] | 29 | #include <netdev.h> |
kevin.morfitt@fearnside-systems.co.uk | ac67804 | 2009-11-17 18:30:34 +0900 | [diff] [blame] | 30 | #include <asm/arch/s3c24x0_cpu.h> |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 31 | |
Wolfgang Denk | d87080b | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 32 | DECLARE_GLOBAL_DATA_PTR; |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 33 | |
| 34 | #ifdef CONFIG_MODEM_SUPPORT |
| 35 | static int key_pressed(void); |
| 36 | int mdm_init (bd_t *); |
| 37 | extern void disable_putc(void); |
| 38 | extern void enable_putc(void); |
| 39 | extern int hwflow_onoff(int); |
| 40 | extern int do_mdm_init; /* defined in common/main.c */ |
| 41 | #endif /* CONFIG_MODEM_SUPPORT */ |
| 42 | |
| 43 | /* |
| 44 | * Miscellaneous platform dependent initialisations |
| 45 | */ |
| 46 | |
| 47 | int board_init (void) |
| 48 | { |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 49 | struct s3c24x0_clock_power * const clk_power = |
| 50 | s3c24x0_get_base_clock_power(); |
| 51 | struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 52 | |
| 53 | /* memory and cpu-speed are setup before relocation */ |
| 54 | /* change the clock to be 50 MHz 1:1:1 */ |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 55 | clk_power->mpllcon = 0x5c042; |
| 56 | clk_power->clkdivn = 0; |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 57 | /* set up the I/O ports */ |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 58 | gpio->pacon = 0x3ffff; |
| 59 | gpio->pbcon = 0xaaaaaaaa; |
| 60 | gpio->pbup = 0xffff; |
| 61 | gpio->pecon = 0x0; |
| 62 | gpio->peup = 0x0; |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 63 | #ifdef CONFIG_HWFLOW |
| 64 | /*CTS[0] RTS[0] INPUT INPUT TXD[0] INPUT RXD[0] */ |
| 65 | /* 10, 10, 00, 00, 10, 00, 10 */ |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 66 | gpio->pfcon = 0xa22; |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 67 | /* Disable pull-up on Rx, Tx, CTS and RTS pins */ |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 68 | gpio->pfup = 0x35; |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 69 | #else |
| 70 | /*INPUT INPUT INPUT INPUT TXD[0] INPUT RXD[0] */ |
| 71 | /* 00, 00, 00, 00, 10, 00, 10 */ |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 72 | gpio->pfcon = 0x22; |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 73 | /* Disable pull-up on Rx and Tx pins */ |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 74 | gpio->pfup = 0x5; |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 75 | #endif /* CONFIG_HWFLOW */ |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 76 | gpio->pgcon = 0x0; |
| 77 | gpio->pgup = 0x0; |
| 78 | gpio->opencr = 0x0; |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 79 | |
| 80 | /* arch number of SAMSUNG-Board to MACH_TYPE_SMDK2400 */ |
wdenk | 731215e | 2004-10-10 18:41:04 +0000 | [diff] [blame] | 81 | gd->bd->bi_arch_number = MACH_TYPE_SMDK2400; |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 82 | |
| 83 | /* adress of boot parameters */ |
| 84 | gd->bd->bi_boot_params = 0x0C000100; |
| 85 | |
| 86 | #ifdef CONFIG_MODEM_SUPPORT |
| 87 | if (key_pressed()) { |
| 88 | disable_putc(); /* modem doesn't understand banner etc */ |
| 89 | do_mdm_init = 1; |
| 90 | } |
| 91 | #endif /* CONFIG_MODEM_SUPPORT */ |
| 92 | |
| 93 | return 0; |
| 94 | } |
| 95 | |
| 96 | int dram_init (void) |
| 97 | { |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 98 | gd->bd->bi_dram[0].start = PHYS_SDRAM_1; |
| 99 | gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; |
| 100 | |
| 101 | return 0; |
| 102 | } |
| 103 | |
| 104 | #ifdef CONFIG_MODEM_SUPPORT |
| 105 | static int key_pressed(void) |
| 106 | { |
| 107 | int rc; |
| 108 | if (1) { /* check for button push here, now just return 1 */ |
| 109 | rc = 1; |
| 110 | } |
| 111 | |
| 112 | return rc; |
| 113 | } |
| 114 | #endif /* CONFIG_MODEM_SUPPORT */ |
Ben Warren | b1c0eaa | 2009-08-25 13:09:37 -0700 | [diff] [blame] | 115 | |
| 116 | #ifdef CONFIG_CMD_NET |
| 117 | int board_eth_init(bd_t *bis) |
| 118 | { |
| 119 | int rc = 0; |
| 120 | #ifdef CONFIG_CS8900 |
| 121 | rc = cs8900_initialize(0, CONFIG_CS8900_BASE); |
| 122 | #endif |
| 123 | return rc; |
| 124 | } |
| 125 | #endif |