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 |
| 7 | * Gary Jennejohn, DENX Software Engineering, <gj@denx.de> |
| 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> |
| 29 | #include <s3c2400.h> |
| 30 | |
Wolfgang Denk | 6405a15 | 2006-03-31 18:32:53 +0200 | [diff] [blame^] | 31 | DECLARE_GLOBAL_DATA_PTR; |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 32 | |
| 33 | #ifdef CONFIG_MODEM_SUPPORT |
| 34 | static int key_pressed(void); |
| 35 | int mdm_init (bd_t *); |
| 36 | extern void disable_putc(void); |
| 37 | extern void enable_putc(void); |
| 38 | extern int hwflow_onoff(int); |
| 39 | extern int do_mdm_init; /* defined in common/main.c */ |
| 40 | #endif /* CONFIG_MODEM_SUPPORT */ |
| 41 | |
| 42 | /* |
| 43 | * Miscellaneous platform dependent initialisations |
| 44 | */ |
| 45 | |
| 46 | int board_init (void) |
| 47 | { |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 48 | S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER(); |
| 49 | S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO(); |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 50 | |
| 51 | /* memory and cpu-speed are setup before relocation */ |
| 52 | /* change the clock to be 50 MHz 1:1:1 */ |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 53 | clk_power->MPLLCON = 0x5c042; |
| 54 | clk_power->CLKDIVN = 0; |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 55 | /* set up the I/O ports */ |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 56 | gpio->PACON = 0x3ffff; |
| 57 | gpio->PBCON = 0xaaaaaaaa; |
| 58 | gpio->PBUP = 0xffff; |
| 59 | gpio->PECON = 0x0; |
| 60 | gpio->PEUP = 0x0; |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 61 | #ifdef CONFIG_HWFLOW |
| 62 | /*CTS[0] RTS[0] INPUT INPUT TXD[0] INPUT RXD[0] */ |
| 63 | /* 10, 10, 00, 00, 10, 00, 10 */ |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 64 | gpio->PFCON=0xa22; |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 65 | /* Disable pull-up on Rx, Tx, CTS and RTS pins */ |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 66 | gpio->PFUP=0x35; |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 67 | #else |
| 68 | /*INPUT INPUT INPUT INPUT TXD[0] INPUT RXD[0] */ |
| 69 | /* 00, 00, 00, 00, 10, 00, 10 */ |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 70 | gpio->PFCON = 0x22; |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 71 | /* Disable pull-up on Rx and Tx pins */ |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 72 | gpio->PFUP = 0x5; |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 73 | #endif /* CONFIG_HWFLOW */ |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 74 | gpio->PGCON = 0x0; |
| 75 | gpio->PGUP = 0x0; |
| 76 | gpio->OPENCR = 0x0; |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 77 | |
| 78 | /* arch number of SAMSUNG-Board to MACH_TYPE_SMDK2400 */ |
wdenk | 767fbd4 | 2004-10-10 18:41:04 +0000 | [diff] [blame] | 79 | gd->bd->bi_arch_number = MACH_TYPE_SMDK2400; |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 80 | |
| 81 | /* adress of boot parameters */ |
| 82 | gd->bd->bi_boot_params = 0x0C000100; |
| 83 | |
| 84 | #ifdef CONFIG_MODEM_SUPPORT |
| 85 | if (key_pressed()) { |
| 86 | disable_putc(); /* modem doesn't understand banner etc */ |
| 87 | do_mdm_init = 1; |
| 88 | } |
| 89 | #endif /* CONFIG_MODEM_SUPPORT */ |
| 90 | |
| 91 | return 0; |
| 92 | } |
| 93 | |
| 94 | int dram_init (void) |
| 95 | { |
wdenk | d8a555f | 2002-09-14 19:10:04 +0000 | [diff] [blame] | 96 | gd->bd->bi_dram[0].start = PHYS_SDRAM_1; |
| 97 | gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; |
| 98 | |
| 99 | return 0; |
| 100 | } |
| 101 | |
| 102 | #ifdef CONFIG_MODEM_SUPPORT |
| 103 | static int key_pressed(void) |
| 104 | { |
| 105 | int rc; |
| 106 | if (1) { /* check for button push here, now just return 1 */ |
| 107 | rc = 1; |
| 108 | } |
| 109 | |
| 110 | return rc; |
| 111 | } |
| 112 | #endif /* CONFIG_MODEM_SUPPORT */ |