Sascha Hauer | caebc95 | 2008-03-26 20:41:09 +0100 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * (c) 2007 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de> |
| 4 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Sascha Hauer | caebc95 | 2008-03-26 20:41:09 +0100 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | |
| 9 | #include <common.h> |
Ben Warren | 736fead | 2009-07-20 22:01:11 -0700 | [diff] [blame] | 10 | #include <netdev.h> |
Stefano Babic | 8627111 | 2011-03-14 15:43:56 +0100 | [diff] [blame] | 11 | #include <asm/arch/clock.h> |
| 12 | #include <asm/arch/imx-regs.h> |
Helmut Raiger | 47c5455 | 2011-09-29 05:45:03 +0000 | [diff] [blame] | 13 | #include <asm/arch/sys_proto.h> |
Sascha Hauer | caebc95 | 2008-03-26 20:41:09 +0100 | [diff] [blame] | 14 | |
| 15 | DECLARE_GLOBAL_DATA_PTR; |
| 16 | |
Fabio Estevam | 4e37731 | 2011-06-05 14:56:02 +0000 | [diff] [blame] | 17 | int dram_init(void) |
Sascha Hauer | caebc95 | 2008-03-26 20:41:09 +0100 | [diff] [blame] | 18 | { |
Fabio Estevam | 4e37731 | 2011-06-05 14:56:02 +0000 | [diff] [blame] | 19 | /* dram_init must store complete ramsize in gd->ram_size */ |
Albert ARIBAUD | a55d23c | 2011-07-03 05:55:33 +0000 | [diff] [blame] | 20 | gd->ram_size = get_ram_size((void *)PHYS_SDRAM_1, |
Fabio Estevam | 4e37731 | 2011-06-05 14:56:02 +0000 | [diff] [blame] | 21 | PHYS_SDRAM_1_SIZE); |
Sascha Hauer | caebc95 | 2008-03-26 20:41:09 +0100 | [diff] [blame] | 22 | return 0; |
| 23 | } |
| 24 | |
Fabio Estevam | 4e37731 | 2011-06-05 14:56:02 +0000 | [diff] [blame] | 25 | int board_early_init_f(void) |
Sascha Hauer | caebc95 | 2008-03-26 20:41:09 +0100 | [diff] [blame] | 26 | { |
Helmut Raiger | 47c5455 | 2011-09-29 05:45:03 +0000 | [diff] [blame] | 27 | /* CS0: Nor Flash */ |
| 28 | static const struct mxc_weimcs cs0 = { |
| 29 | /* sp wp bcd bcs psz pme sync dol cnc wsc ew wws edc */ |
| 30 | CSCR_U(0, 0, 0, 0, 0, 0, 0, 0, 3, 15, 0, 0, 3), |
| 31 | /* oea oen ebwa ebwn csa ebc dsz csn psr cre wrap csen */ |
| 32 | CSCR_L(10, 0, 3, 3, 0, 1, 5, 0, 0, 0, 0, 1), |
| 33 | /* ebra ebrn rwa rwn mum lah lbn lba dww dct wwu age cnc2 fce*/ |
| 34 | CSCR_A(0, 0, 2, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0) |
| 35 | }; |
Sascha Hauer | caebc95 | 2008-03-26 20:41:09 +0100 | [diff] [blame] | 36 | |
Helmut Raiger | 47c5455 | 2011-09-29 05:45:03 +0000 | [diff] [blame] | 37 | /* CS4: Network Controller */ |
| 38 | static const struct mxc_weimcs cs4 = { |
| 39 | /* sp wp bcd bcs psz pme sync dol cnc wsc ew wws edc */ |
| 40 | CSCR_U(0, 0, 0, 0, 0, 0, 0, 0, 3, 28, 1, 7, 6), |
| 41 | /* oea oen ebwa ebwn csa ebc dsz csn psr cre wrap csen */ |
| 42 | CSCR_L(4, 4, 4, 10, 4, 0, 5, 4, 0, 0, 0, 1), |
| 43 | /* ebra ebrn rwa rwn mum lah lbn lba dww dct wwu age cnc2 fce*/ |
| 44 | CSCR_A(4, 4, 4, 4, 0, 1, 4, 3, 0, 0, 0, 0, 1, 0) |
| 45 | }; |
| 46 | |
| 47 | mxc_setup_weimcs(0, &cs0); |
| 48 | mxc_setup_weimcs(4, &cs4); |
Sascha Hauer | caebc95 | 2008-03-26 20:41:09 +0100 | [diff] [blame] | 49 | |
| 50 | /* setup pins for UART1 */ |
| 51 | mx31_gpio_mux(MUX_RXD1__UART1_RXD_MUX); |
| 52 | mx31_gpio_mux(MUX_TXD1__UART1_TXD_MUX); |
| 53 | mx31_gpio_mux(MUX_RTS1__UART1_RTS_B); |
Magnus Lilja | b6b183c | 2008-08-03 21:43:37 +0200 | [diff] [blame] | 54 | mx31_gpio_mux(MUX_CTS1__UART1_CTS_B); |
Sascha Hauer | caebc95 | 2008-03-26 20:41:09 +0100 | [diff] [blame] | 55 | |
Magnus Lilja | f9204e1 | 2008-04-20 10:38:12 +0200 | [diff] [blame] | 56 | /* SPI2 */ |
Magnus Lilja | 5276a35 | 2008-08-03 21:44:10 +0200 | [diff] [blame] | 57 | mx31_gpio_mux(MUX_CSPI2_SS2__CSPI2_SS2_B); |
| 58 | mx31_gpio_mux(MUX_CSPI2_SCLK__CSPI2_CLK); |
| 59 | mx31_gpio_mux(MUX_CSPI2_SPI_RDY__CSPI2_DATAREADY_B); |
| 60 | mx31_gpio_mux(MUX_CSPI2_MOSI__CSPI2_MOSI); |
| 61 | mx31_gpio_mux(MUX_CSPI2_MISO__CSPI2_MISO); |
| 62 | mx31_gpio_mux(MUX_CSPI2_SS0__CSPI2_SS0_B); |
| 63 | mx31_gpio_mux(MUX_CSPI2_SS1__CSPI2_SS1_B); |
Magnus Lilja | f9204e1 | 2008-04-20 10:38:12 +0200 | [diff] [blame] | 64 | |
| 65 | /* start SPI2 clock */ |
| 66 | __REG(CCM_CGR2) = __REG(CCM_CGR2) | (3 << 4); |
| 67 | |
Fabio Estevam | 4e37731 | 2011-06-05 14:56:02 +0000 | [diff] [blame] | 68 | return 0; |
| 69 | } |
| 70 | |
| 71 | int board_init(void) |
| 72 | { |
Sascha Hauer | caebc95 | 2008-03-26 20:41:09 +0100 | [diff] [blame] | 73 | gd->bd->bi_boot_params = (0x80000100); /* adress of boot parameters */ |
| 74 | |
| 75 | return 0; |
| 76 | } |
| 77 | |
Fabio Estevam | 77f11a9 | 2011-10-13 05:34:59 +0000 | [diff] [blame] | 78 | int checkboard(void) |
Sascha Hauer | caebc95 | 2008-03-26 20:41:09 +0100 | [diff] [blame] | 79 | { |
| 80 | printf("Board: i.MX31 Litekit\n"); |
| 81 | return 0; |
| 82 | } |
Ben Warren | 736fead | 2009-07-20 22:01:11 -0700 | [diff] [blame] | 83 | |
| 84 | int board_eth_init(bd_t *bis) |
| 85 | { |
| 86 | int rc = 0; |
| 87 | #ifdef CONFIG_SMC911X |
| 88 | rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); |
| 89 | #endif |
| 90 | return rc; |
| 91 | } |