18449f287SMagnus Lilja /* 28449f287SMagnus Lilja * 38449f287SMagnus Lilja * (C) Copyright 2009 Magnus Lilja <lilja.magnus@gmail.com> 48449f287SMagnus Lilja * 58449f287SMagnus Lilja * (c) 2007 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de> 68449f287SMagnus Lilja * 78449f287SMagnus Lilja * See file CREDITS for list of people who contributed to this 88449f287SMagnus Lilja * project. 98449f287SMagnus Lilja * 108449f287SMagnus Lilja * This program is free software; you can redistribute it and/or 118449f287SMagnus Lilja * modify it under the terms of the GNU General Public License as 128449f287SMagnus Lilja * published by the Free Software Foundation; either version 2 of 138449f287SMagnus Lilja * the License, or (at your option) any later version. 148449f287SMagnus Lilja * 158449f287SMagnus Lilja * This program is distributed in the hope that it will be useful, 168449f287SMagnus Lilja * but WITHOUT ANY WARRANTY; without even the implied warranty of 178449f287SMagnus Lilja * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 188449f287SMagnus Lilja * GNU General Public License for more details. 198449f287SMagnus Lilja * 208449f287SMagnus Lilja * You should have received a copy of the GNU General Public License 218449f287SMagnus Lilja * along with this program; if not, write to the Free Software 228449f287SMagnus Lilja * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 238449f287SMagnus Lilja * MA 02111-1307 USA 248449f287SMagnus Lilja */ 258449f287SMagnus Lilja 268449f287SMagnus Lilja 278449f287SMagnus Lilja #include <common.h> 28736fead8SBen Warren #include <netdev.h> 2986271115SStefano Babic #include <asm/arch/clock.h> 3086271115SStefano Babic #include <asm/arch/imx-regs.h> 31*47c5455aSHelmut Raiger #include <asm/arch/sys_proto.h> 32b73850f7SFabio Estevam #include <watchdog.h> 338449f287SMagnus Lilja 348449f287SMagnus Lilja DECLARE_GLOBAL_DATA_PTR; 358449f287SMagnus Lilja 36b73850f7SFabio Estevam #ifdef CONFIG_HW_WATCHDOG 37b73850f7SFabio Estevam void hw_watchdog_reset(void) 38b73850f7SFabio Estevam { 39b73850f7SFabio Estevam mxc_hw_watchdog_reset(); 40b73850f7SFabio Estevam } 41b73850f7SFabio Estevam #endif 42b73850f7SFabio Estevam 438449f287SMagnus Lilja int dram_init(void) 448449f287SMagnus Lilja { 45ed3df72dSFabio Estevam /* dram_init must store complete ramsize in gd->ram_size */ 46a55d23ccSAlbert ARIBAUD gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE, 47ed3df72dSFabio Estevam PHYS_SDRAM_1_SIZE); 48ed3df72dSFabio Estevam return 0; 49ed3df72dSFabio Estevam } 50ed3df72dSFabio Estevam 519b6442f9SFabio Estevam int board_early_init_f(void) 528449f287SMagnus Lilja { 538449f287SMagnus Lilja /* CS5: CPLD incl. network controller */ 54*47c5455aSHelmut Raiger static const struct mxc_weimcs cs5 = { 55*47c5455aSHelmut Raiger /* sp wp bcd bcs psz pme sync dol cnc wsc ew wws edc */ 56*47c5455aSHelmut Raiger CSCR_U(0, 0, 0, 0, 0, 0, 0, 0, 3, 24, 0, 4, 3), 57*47c5455aSHelmut Raiger /* oea oen ebwa ebwn csa ebc dsz csn psr cre wrap csen */ 58*47c5455aSHelmut Raiger CSCR_L(2, 2, 2, 5, 2, 0, 5, 2, 0, 0, 0, 1), 59*47c5455aSHelmut Raiger /* ebra ebrn rwa rwn mum lah lbn lba dww dct wwu age cnc2 fce*/ 60*47c5455aSHelmut Raiger CSCR_A(2, 2, 2, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0) 61*47c5455aSHelmut Raiger }; 62*47c5455aSHelmut Raiger 63*47c5455aSHelmut Raiger mxc_setup_weimcs(5, &cs5); 648449f287SMagnus Lilja 658449f287SMagnus Lilja /* Setup UART1 and SPI2 pins */ 668449f287SMagnus Lilja mx31_uart1_hw_init(); 678449f287SMagnus Lilja mx31_spi2_hw_init(); 688449f287SMagnus Lilja 699b6442f9SFabio Estevam return 0; 709b6442f9SFabio Estevam } 719b6442f9SFabio Estevam 729b6442f9SFabio Estevam int board_init(void) 739b6442f9SFabio Estevam { 748449f287SMagnus Lilja /* adress of boot parameters */ 758449f287SMagnus Lilja gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; 768449f287SMagnus Lilja 778449f287SMagnus Lilja return 0; 788449f287SMagnus Lilja } 798449f287SMagnus Lilja 80b73850f7SFabio Estevam int board_late_init(void) 81b73850f7SFabio Estevam { 82b73850f7SFabio Estevam #ifdef CONFIG_HW_WATCHDOG 83b73850f7SFabio Estevam mxc_hw_watchdog_enable(); 84b73850f7SFabio Estevam #endif 85b73850f7SFabio Estevam return 0; 86b73850f7SFabio Estevam } 87b73850f7SFabio Estevam 888449f287SMagnus Lilja int checkboard(void) 898449f287SMagnus Lilja { 90e9e0790cSFabio Estevam printf("Board: MX31PDK\n"); 918449f287SMagnus Lilja return 0; 928449f287SMagnus Lilja } 93736fead8SBen Warren 94736fead8SBen Warren int board_eth_init(bd_t *bis) 95736fead8SBen Warren { 96736fead8SBen Warren int rc = 0; 97736fead8SBen Warren #ifdef CONFIG_SMC911X 98736fead8SBen Warren rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); 99736fead8SBen Warren #endif 100736fead8SBen Warren return rc; 101736fead8SBen Warren } 102