2 * Copyright (C) Freescale Semiconductor, Inc. 2006.
5 * Andre Schwarz, Matrix Vision GmbH, andre.schwarz@matrix-vision.de
7 * SPDX-License-Identifier: GPL-2.0+
13 #include <asm/mpc8349_pci.h>
17 #if defined(CONFIG_OF_LIBFDT)
21 #include "../common/mv_common.h"
26 volatile immap_t
*im
= (immap_t
*)CONFIG_SYS_IMMR
;
30 char *s
= getenv("ddr_size");
32 msize
= CONFIG_SYS_DDR_SIZE
;
34 u32 env_ddr_size
= simple_strtoul(s
, NULL
, 10);
35 if (env_ddr_size
== 512)
39 for (ddr_size
= msize
<< 20, ddr_size_log2
= 0;
41 ddr_size
= ddr_size
>> 1, ddr_size_log2
++) {
45 im
->sysconf
.ddrlaw
[0].bar
= CONFIG_SYS_DDR_SDRAM_BASE
& 0xfffff000;
46 im
->sysconf
.ddrlaw
[0].ar
= LAWAR_EN
| ((ddr_size_log2
- 1) &
49 im
->ddr
.csbnds
[0].csbnds
= CONFIG_SYS_DDR_CS0_BNDS
;
50 im
->ddr
.cs_config
[0] = CONFIG_SYS_DDR_CS0_CONFIG
;
51 im
->ddr
.timing_cfg_0
= CONFIG_SYS_DDR_TIMING_0
;
52 im
->ddr
.timing_cfg_1
= CONFIG_SYS_DDR_TIMING_1
;
53 im
->ddr
.timing_cfg_2
= CONFIG_SYS_DDR_TIMING_2
;
54 im
->ddr
.timing_cfg_3
= CONFIG_SYS_DDR_TIMING_3
;
55 im
->ddr
.sdram_cfg
= CONFIG_SYS_DDR_SDRAM_CFG
;
56 im
->ddr
.sdram_cfg2
= CONFIG_SYS_DDR_SDRAM_CFG2
;
57 im
->ddr
.sdram_mode
= CONFIG_SYS_DDR_MODE
;
58 im
->ddr
.sdram_mode2
= CONFIG_SYS_DDR_MODE2
;
59 im
->ddr
.sdram_interval
= CONFIG_SYS_DDR_INTERVAL
;
60 im
->ddr
.sdram_clk_cntl
= CONFIG_SYS_DDR_SDRAM_CLK_CNTL
;
65 im
->ddr
.sdram_cfg
|= SDRAM_CFG_MEM_EN
;
73 phys_size_t
initdram(int board_type
)
75 volatile immap_t
*im
= (immap_t
*) CONFIG_SYS_IMMR
;
78 if ((im
->sysconf
.immrbar
& IMMRBAR_BASE_ADDR
) != (u32
) im
)
81 im
->sysconf
.ddrlaw
[0].bar
= CONFIG_SYS_DDR_BASE
& LAWBAR_BAR
;
82 msize
= fixed_sdram();
84 /* return total bus RAM size(bytes) */
85 return msize
* 1024 * 1024;
90 char *s
= getenv("reset_env");
93 mv_reset_environment();
101 puts("Board: Matrix Vision mvBlueLYNX-M7\n");
106 #ifdef CONFIG_HARD_SPI
107 int spi_cs_is_valid(unsigned int bus
, unsigned int cs
)
109 return bus
== 0 && cs
== 0;
112 void spi_cs_activate(struct spi_slave
*slave
)
114 volatile gpio83xx_t
*iopd
= &((immap_t
*)CONFIG_SYS_IMMR
)->gpio
[0];
116 iopd
->dat
&= ~MVBLM7_MMC_CS
;
119 void spi_cs_deactivate(struct spi_slave
*slave
)
121 volatile gpio83xx_t
*iopd
= &((immap_t
*)CONFIG_SYS_IMMR
)->gpio
[0];
123 iopd
->dat
|= ~MVBLM7_MMC_CS
;
127 #if defined(CONFIG_OF_BOARD_SETUP)
128 void ft_board_setup(void *blob
, bd_t
*bd
)
130 ft_cpu_setup(blob
, bd
);
132 ft_pci_setup(blob
, bd
);