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" |
Alexander Graf | 5889e39 | 2016-03-04 01:09:51 +0100 | [diff] [blame^] | 17 | #include <asm/armv8/mmu.h> |
David Feng | 3b5458c | 2013-12-14 11:47:37 +0800 | [diff] [blame] | 18 | |
| 19 | DECLARE_GLOBAL_DATA_PTR; |
| 20 | |
David Feng | ab33c2c | 2015-01-31 11:55:29 +0800 | [diff] [blame] | 21 | static const struct pl01x_serial_platdata serial_platdata = { |
| 22 | .base = V2M_UART0, |
| 23 | .type = TYPE_PL011, |
Linus Walleij | 31e476e | 2015-04-14 10:01:35 +0200 | [diff] [blame] | 24 | .clock = CONFIG_PL011_CLOCK, |
David Feng | ab33c2c | 2015-01-31 11:55:29 +0800 | [diff] [blame] | 25 | }; |
| 26 | |
| 27 | U_BOOT_DEVICE(vexpress_serials) = { |
| 28 | .name = "serial_pl01x", |
| 29 | .platdata = &serial_platdata, |
| 30 | }; |
| 31 | |
Alexander Graf | 5889e39 | 2016-03-04 01:09:51 +0100 | [diff] [blame^] | 32 | static struct mm_region vexpress64_mem_map[] = { |
| 33 | { |
| 34 | .base = 0x0UL, |
| 35 | .size = 0x80000000UL, |
| 36 | .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | |
| 37 | PTE_BLOCK_NON_SHARE | |
| 38 | PTE_BLOCK_PXN | PTE_BLOCK_UXN |
| 39 | }, { |
| 40 | .base = 0x80000000UL, |
| 41 | .size = 0xff80000000UL, |
| 42 | .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | |
| 43 | PTE_BLOCK_INNER_SHARE |
| 44 | }, { |
| 45 | /* List terminator */ |
| 46 | 0, |
| 47 | } |
| 48 | }; |
| 49 | |
| 50 | struct mm_region *mem_map = vexpress64_mem_map; |
| 51 | |
Ryan Harkin | 8961d50 | 2015-11-18 10:39:06 +0000 | [diff] [blame] | 52 | /* This function gets replaced by platforms supporting PCIe. |
| 53 | * The replacement function, eg. on Juno, initialises the PCIe bus. |
| 54 | */ |
| 55 | __weak void vexpress64_pcie_init(void) |
| 56 | { |
| 57 | } |
| 58 | |
David Feng | 3b5458c | 2013-12-14 11:47:37 +0800 | [diff] [blame] | 59 | int board_init(void) |
| 60 | { |
Liviu Dudau | 8d1fdc3 | 2015-10-19 11:08:32 +0100 | [diff] [blame] | 61 | vexpress64_pcie_init(); |
David Feng | 3b5458c | 2013-12-14 11:47:37 +0800 | [diff] [blame] | 62 | return 0; |
| 63 | } |
| 64 | |
| 65 | int dram_init(void) |
| 66 | { |
David Feng | 3b5458c | 2013-12-14 11:47:37 +0800 | [diff] [blame] | 67 | gd->ram_size = PHYS_SDRAM_1_SIZE; |
| 68 | return 0; |
| 69 | } |
| 70 | |
Liviu Dudau | 086c977 | 2015-10-19 11:08:31 +0100 | [diff] [blame] | 71 | void dram_init_banksize(void) |
| 72 | { |
| 73 | gd->bd->bi_dram[0].start = PHYS_SDRAM_1; |
| 74 | gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; |
Ryan Harkin | 98d2fff | 2015-11-18 10:39:07 +0000 | [diff] [blame] | 75 | #ifdef PHYS_SDRAM_2 |
Liviu Dudau | 086c977 | 2015-10-19 11:08:31 +0100 | [diff] [blame] | 76 | gd->bd->bi_dram[1].start = PHYS_SDRAM_2; |
| 77 | gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE; |
Ryan Harkin | 98d2fff | 2015-11-18 10:39:07 +0000 | [diff] [blame] | 78 | #endif |
Liviu Dudau | 086c977 | 2015-10-19 11:08:31 +0100 | [diff] [blame] | 79 | } |
| 80 | |
David Feng | 3b5458c | 2013-12-14 11:47:37 +0800 | [diff] [blame] | 81 | /* |
| 82 | * Board specific reset that is system reset. |
| 83 | */ |
| 84 | void reset_cpu(ulong addr) |
| 85 | { |
Darwin Rambo | d32d411 | 2014-06-09 11:12:59 -0700 | [diff] [blame] | 86 | } |
| 87 | |
David Feng | 3b5458c | 2013-12-14 11:47:37 +0800 | [diff] [blame] | 88 | /* |
| 89 | * Board specific ethernet initialization routine. |
| 90 | */ |
| 91 | int board_eth_init(bd_t *bis) |
| 92 | { |
| 93 | int rc = 0; |
| 94 | #ifdef CONFIG_SMC91111 |
| 95 | rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); |
| 96 | #endif |
Linus Walleij | 48b4755 | 2015-02-17 11:35:25 +0100 | [diff] [blame] | 97 | #ifdef CONFIG_SMC911X |
| 98 | rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); |
| 99 | #endif |
David Feng | 3b5458c | 2013-12-14 11:47:37 +0800 | [diff] [blame] | 100 | return rc; |
| 101 | } |