David Feng | 3b5458c | 2013-12-14 11:47:37 +0800 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2013 |
| 3 | * David Feng <fenghua@phytium.com.cn> |
| 4 | * Sharma Bhupesh <bhupesh.sharma@freescale.com> |
| 5 | * |
| 6 | * SPDX-License-Identifier: GPL-2.0+ |
| 7 | */ |
| 8 | #include <common.h> |
| 9 | #include <malloc.h> |
| 10 | #include <errno.h> |
| 11 | #include <netdev.h> |
| 12 | #include <asm/io.h> |
| 13 | #include <linux/compiler.h> |
David Feng | ab33c2c | 2015-01-31 11:55:29 +0800 | [diff] [blame] | 14 | #include <dm/platdata.h> |
| 15 | #include <dm/platform_data/serial_pl01x.h> |
Liviu Dudau | 8d1fdc3 | 2015-10-19 11:08:32 +0100 | [diff] [blame] | 16 | #include "pcie.h" |
David Feng | 3b5458c | 2013-12-14 11:47:37 +0800 | [diff] [blame] | 17 | |
| 18 | DECLARE_GLOBAL_DATA_PTR; |
| 19 | |
David Feng | ab33c2c | 2015-01-31 11:55:29 +0800 | [diff] [blame] | 20 | static const struct pl01x_serial_platdata serial_platdata = { |
| 21 | .base = V2M_UART0, |
| 22 | .type = TYPE_PL011, |
Linus Walleij | 31e476e | 2015-04-14 10:01:35 +0200 | [diff] [blame] | 23 | .clock = CONFIG_PL011_CLOCK, |
David Feng | ab33c2c | 2015-01-31 11:55:29 +0800 | [diff] [blame] | 24 | }; |
| 25 | |
| 26 | U_BOOT_DEVICE(vexpress_serials) = { |
| 27 | .name = "serial_pl01x", |
| 28 | .platdata = &serial_platdata, |
| 29 | }; |
| 30 | |
Ryan Harkin | 8961d50 | 2015-11-18 10:39:06 +0000 | [diff] [blame] | 31 | /* This function gets replaced by platforms supporting PCIe. |
| 32 | * The replacement function, eg. on Juno, initialises the PCIe bus. |
| 33 | */ |
| 34 | __weak void vexpress64_pcie_init(void) |
| 35 | { |
| 36 | } |
| 37 | |
David Feng | 3b5458c | 2013-12-14 11:47:37 +0800 | [diff] [blame] | 38 | int board_init(void) |
| 39 | { |
Liviu Dudau | 8d1fdc3 | 2015-10-19 11:08:32 +0100 | [diff] [blame] | 40 | vexpress64_pcie_init(); |
David Feng | 3b5458c | 2013-12-14 11:47:37 +0800 | [diff] [blame] | 41 | return 0; |
| 42 | } |
| 43 | |
| 44 | int dram_init(void) |
| 45 | { |
David Feng | 3b5458c | 2013-12-14 11:47:37 +0800 | [diff] [blame] | 46 | gd->ram_size = PHYS_SDRAM_1_SIZE; |
| 47 | return 0; |
| 48 | } |
| 49 | |
Liviu Dudau | 086c977 | 2015-10-19 11:08:31 +0100 | [diff] [blame] | 50 | void dram_init_banksize(void) |
| 51 | { |
| 52 | gd->bd->bi_dram[0].start = PHYS_SDRAM_1; |
| 53 | gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; |
Ryan Harkin | 98d2fff | 2015-11-18 10:39:07 +0000 | [diff] [blame] | 54 | #ifdef PHYS_SDRAM_2 |
Liviu Dudau | 086c977 | 2015-10-19 11:08:31 +0100 | [diff] [blame] | 55 | gd->bd->bi_dram[1].start = PHYS_SDRAM_2; |
| 56 | gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE; |
Ryan Harkin | 98d2fff | 2015-11-18 10:39:07 +0000 | [diff] [blame] | 57 | #endif |
Liviu Dudau | 086c977 | 2015-10-19 11:08:31 +0100 | [diff] [blame] | 58 | } |
| 59 | |
David Feng | 3b5458c | 2013-12-14 11:47:37 +0800 | [diff] [blame] | 60 | /* |
| 61 | * Board specific reset that is system reset. |
| 62 | */ |
| 63 | void reset_cpu(ulong addr) |
| 64 | { |
Darwin Rambo | d32d411 | 2014-06-09 11:12:59 -0700 | [diff] [blame] | 65 | } |
| 66 | |
David Feng | 3b5458c | 2013-12-14 11:47:37 +0800 | [diff] [blame] | 67 | /* |
| 68 | * Board specific ethernet initialization routine. |
| 69 | */ |
| 70 | int board_eth_init(bd_t *bis) |
| 71 | { |
| 72 | int rc = 0; |
| 73 | #ifdef CONFIG_SMC91111 |
| 74 | rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); |
| 75 | #endif |
Linus Walleij | 48b4755 | 2015-02-17 11:35:25 +0100 | [diff] [blame] | 76 | #ifdef CONFIG_SMC911X |
| 77 | rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); |
| 78 | #endif |
David Feng | 3b5458c | 2013-12-14 11:47:37 +0800 | [diff] [blame] | 79 | return rc; |
| 80 | } |