Compare commits
53 Commits
v2015.10-r
...
v2015.10
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ec0003b19 | |||
| 75918afa64 | |||
| 6a48109d0e | |||
| ecdc3df611 | |||
| 743d75925a | |||
| 71d5511628 | |||
| 7229c3c70b | |||
| 73f7550715 | |||
| 84ca65aa4b | |||
| 81fd858cbe | |||
| 2fdc9b741b | |||
| 2d0cee1ca2 | |||
| 2727f3bfba | |||
| f4c9258213 | |||
| d718ff70ee | |||
| 04d6f1420f | |||
| 7003e4cf76 | |||
| ef1e5710b3 | |||
| 461f592649 | |||
| 79ad5cef15 | |||
| d1a2f32fca | |||
| 8626cb8021 | |||
| b9f06b360d | |||
| ac6a53219a | |||
| 3790a8c662 | |||
| 8d8e13e129 | |||
| 4b8cdd484c | |||
| a7e2c6f6bb | |||
| 53fd4b8c22 | |||
| 1275456d31 | |||
| aaf87f03ad | |||
| b1964c72bd | |||
| ad3d6e88a1 | |||
| cb4c833b74 | |||
| c57a9a6350 | |||
| 55aa0bed98 | |||
| cf04ad3219 | |||
| d45fd018c8 | |||
| e24bb2b732 | |||
| 13a3972585 | |||
| 297faccca2 | |||
| 2308ea7c6f | |||
| 995a54cc12 | |||
| 6a9fbb6e20 | |||
| 1a9d1731f9 | |||
| 8e34a74d69 | |||
| 4ed50807e2 | |||
| f861f51c46 | |||
| f532727d16 | |||
| 61903b759a | |||
| 835c30e368 | |||
| 208bd51396 | |||
| ed64190f67 |
2
Makefile
2
Makefile
@ -1,7 +1,7 @@
|
||||
VERSION = 2015
|
||||
PATCHLEVEL = 10
|
||||
SUBLEVEL =
|
||||
EXTRAVERSION = -rc5
|
||||
EXTRAVERSION =
|
||||
NAME =
|
||||
|
||||
# *DOCUMENTATION*
|
||||
|
||||
@ -13,6 +13,8 @@
|
||||
#include <tsec.h>
|
||||
#include <netdev.h>
|
||||
#include <fsl_esdhc.h>
|
||||
#include <config.h>
|
||||
#include <fsl_wdog.h>
|
||||
|
||||
#include "fsl_epu.h"
|
||||
|
||||
@ -354,3 +356,16 @@ void smp_kick_all_cpus(void)
|
||||
asm volatile("sev");
|
||||
}
|
||||
#endif
|
||||
|
||||
void reset_cpu(ulong addr)
|
||||
{
|
||||
struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
|
||||
|
||||
clrbits_be16(&wdog->wcr, WCR_SRS);
|
||||
|
||||
while (1) {
|
||||
/*
|
||||
* Let the watchdog trigger
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ ENDPROC(__asm_flush_dcache_all)
|
||||
|
||||
ENTRY(__asm_invalidate_dcache_all)
|
||||
mov x16, lr
|
||||
mov x0, #0xffff
|
||||
mov x0, #0x1
|
||||
bl __asm_dcache_all
|
||||
mov lr, x16
|
||||
ret
|
||||
|
||||
@ -59,15 +59,15 @@ static void mmu_setup(void)
|
||||
el = current_el();
|
||||
if (el == 1) {
|
||||
set_ttbr_tcr_mair(el, gd->arch.tlb_addr,
|
||||
TCR_FLAGS | TCR_EL1_IPS_BITS,
|
||||
TCR_EL1_RSVD | TCR_FLAGS | TCR_EL1_IPS_BITS,
|
||||
MEMORY_ATTRIBUTES);
|
||||
} else if (el == 2) {
|
||||
set_ttbr_tcr_mair(el, gd->arch.tlb_addr,
|
||||
TCR_FLAGS | TCR_EL2_IPS_BITS,
|
||||
TCR_EL2_RSVD | TCR_FLAGS | TCR_EL2_IPS_BITS,
|
||||
MEMORY_ATTRIBUTES);
|
||||
} else {
|
||||
set_ttbr_tcr_mair(el, gd->arch.tlb_addr,
|
||||
TCR_FLAGS | TCR_EL3_IPS_BITS,
|
||||
TCR_EL3_RSVD | TCR_FLAGS | TCR_EL3_IPS_BITS,
|
||||
MEMORY_ATTRIBUTES);
|
||||
}
|
||||
/* enable the mmu */
|
||||
|
||||
@ -69,6 +69,9 @@
|
||||
};
|
||||
|
||||
&mmc0 {
|
||||
status = "okay";
|
||||
u-boot,dm-pre-reloc;
|
||||
|
||||
cd-gpios = <&portb 18 0>;
|
||||
vmmc-supply = <®ulator_3_3v>;
|
||||
vqmmc-supply = <®ulator_3_3v>;
|
||||
|
||||
@ -18,6 +18,8 @@
|
||||
#define IOMUXC_GPR1_REF_SSP_EN (1 << 16)
|
||||
#define IOMUXC_GPR1_TEST_POWERDOWN (1 << 18)
|
||||
|
||||
#define IOMUXC_GPR1_PCIE_SW_RST (1 << 29)
|
||||
|
||||
/*
|
||||
* IOMUXC_GPR5 bit fields
|
||||
*/
|
||||
|
||||
@ -103,13 +103,17 @@
|
||||
#define TCR_EL2_IPS_BITS (3 << 16) /* 42 bits physical address */
|
||||
#define TCR_EL3_IPS_BITS (3 << 16) /* 42 bits physical address */
|
||||
|
||||
/* PTWs cacheable, inner/outer WBWA and non-shareable */
|
||||
/* PTWs cacheable, inner/outer WBWA and inner shareable */
|
||||
#define TCR_FLAGS (TCR_TG0_64K | \
|
||||
TCR_SHARED_NON | \
|
||||
TCR_SHARED_INNER | \
|
||||
TCR_ORGN_WBWA | \
|
||||
TCR_IRGN_WBWA | \
|
||||
TCR_T0SZ(VA_BITS))
|
||||
|
||||
#define TCR_EL1_RSVD (1 << 31)
|
||||
#define TCR_EL2_RSVD (1 << 31 | 1 << 23)
|
||||
#define TCR_EL3_RSVD (1 << 31 | 1 << 23)
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
void set_pgtable_section(u64 *page_table, u64 index,
|
||||
|
||||
@ -17,6 +17,8 @@
|
||||
#define L2X0_CTRL_EN 1
|
||||
|
||||
#define L310_SHARED_ATT_OVERRIDE_ENABLE (1 << 22)
|
||||
#define L310_AUX_CTRL_DATA_PREFETCH_MASK (1 << 28)
|
||||
#define L310_AUX_CTRL_INST_PREFETCH_MASK (1 << 29)
|
||||
|
||||
struct pl310_regs {
|
||||
u32 pl310_cache_id;
|
||||
|
||||
@ -194,7 +194,7 @@ void save_boot_params_ret(void);
|
||||
static inline unsigned int get_cr(void)
|
||||
{
|
||||
unsigned int val;
|
||||
asm("mrc p15, 0, %0, c1, c0, 0 @ get CR" : "=r" (val) : : "cc");
|
||||
asm volatile("mrc p15, 0, %0, c1, c0, 0 @ get CR" : "=r" (val) : : "cc");
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,8 @@
|
||||
* the GD ('global data') structure, both located in some readily
|
||||
* available RAM (SRAM, locked cache...). In this context, VARIABLE
|
||||
* global data, initialized or not (BSS), are UNAVAILABLE; only
|
||||
* CONSTANT initialized data are available.
|
||||
* CONSTANT initialized data are available. GD should be zeroed
|
||||
* before board_init_f() is called.
|
||||
*
|
||||
* 2. Call board_init_f(). This function prepares the hardware for
|
||||
* execution from system RAM (DRAM, DDR...) As system RAM may not
|
||||
@ -34,24 +35,29 @@
|
||||
* data include the relocation destination, the future stack, and
|
||||
* the future GD location.
|
||||
*
|
||||
* (the following applies only to non-SPL builds)
|
||||
*
|
||||
* 3. Set up intermediate environment where the stack and GD are the
|
||||
* ones allocated by board_init_f() in system RAM, but BSS and
|
||||
* initialized non-const data are still not available.
|
||||
*
|
||||
* 4. Call relocate_code(). This function relocates U-Boot from its
|
||||
* current location into the relocation destination computed by
|
||||
* board_init_f().
|
||||
* 4a.For U-Boot proper (not SPL), call relocate_code(). This function
|
||||
* relocates U-Boot from its current location into the relocation
|
||||
* destination computed by board_init_f().
|
||||
*
|
||||
* 4b.For SPL, board_init_f() just returns (to crt0). There is no
|
||||
* code relocation in SPL.
|
||||
*
|
||||
* 5. Set up final environment for calling board_init_r(). This
|
||||
* environment has BSS (initialized to 0), initialized non-const
|
||||
* data (initialized to their intended value), and stack in system
|
||||
* RAM. GD has retained values set by board_init_f(). Some CPUs
|
||||
* have some work left to do at this point regarding memory, so
|
||||
* call c_runtime_cpu_setup.
|
||||
* RAM (for SPL moving the stack and GD into RAM is optional - see
|
||||
* CONFIG_SPL_STACK_R). GD has retained values set by board_init_f().
|
||||
*
|
||||
* 6. Branch to board_init_r().
|
||||
* 6. For U-Boot proper (not SPL), some CPUs have some work left to do
|
||||
* at this point regarding memory, so call c_runtime_cpu_setup.
|
||||
*
|
||||
* 7. Branch to board_init_r().
|
||||
*
|
||||
* For more information see 'Board Initialisation Flow in README.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
@ -27,7 +27,8 @@
|
||||
* the GD ('global data') structure, both located in some readily
|
||||
* available RAM (SRAM, locked cache...). In this context, VARIABLE
|
||||
* global data, initialized or not (BSS), are UNAVAILABLE; only
|
||||
* CONSTANT initialized data are available.
|
||||
* CONSTANT initialized data are available. GD should be zeroed
|
||||
* before board_init_f() is called.
|
||||
*
|
||||
* 2. Call board_init_f(). This function prepares the hardware for
|
||||
* execution from system RAM (DRAM, DDR...) As system RAM may not
|
||||
@ -36,24 +37,31 @@
|
||||
* data include the relocation destination, the future stack, and
|
||||
* the future GD location.
|
||||
*
|
||||
* (the following applies only to non-SPL builds)
|
||||
*
|
||||
* 3. Set up intermediate environment where the stack and GD are the
|
||||
* ones allocated by board_init_f() in system RAM, but BSS and
|
||||
* initialized non-const data are still not available.
|
||||
*
|
||||
* 4. Call relocate_code(). This function relocates U-Boot from its
|
||||
* current location into the relocation destination computed by
|
||||
* board_init_f().
|
||||
* 4a.For U-Boot proper (not SPL), call relocate_code(). This function
|
||||
* relocates U-Boot from its current location into the relocation
|
||||
* destination computed by board_init_f().
|
||||
*
|
||||
* 4b.For SPL, board_init_f() just returns (to crt0). There is no
|
||||
* code relocation in SPL.
|
||||
*
|
||||
* 5. Set up final environment for calling board_init_r(). This
|
||||
* environment has BSS (initialized to 0), initialized non-const
|
||||
* data (initialized to their intended value), and stack in system
|
||||
* RAM. GD has retained values set by board_init_f(). Some CPUs
|
||||
* have some work left to do at this point regarding memory, so
|
||||
* call c_runtime_cpu_setup.
|
||||
* RAM (for SPL moving the stack and GD into RAM is optional - see
|
||||
* CONFIG_SPL_STACK_R). GD has retained values set by board_init_f().
|
||||
*
|
||||
* 6. Branch to board_init_r().
|
||||
* TODO: For SPL, implement stack relocation on AArch64.
|
||||
*
|
||||
* 6. For U-Boot proper (not SPL), some CPUs have some work left to do
|
||||
* at this point regarding memory, so call c_runtime_cpu_setup.
|
||||
*
|
||||
* 7. Branch to board_init_r().
|
||||
*
|
||||
* For more information see 'Board Initialisation Flow in README.
|
||||
*/
|
||||
|
||||
ENTRY(_main)
|
||||
@ -106,6 +114,8 @@ relocation_return:
|
||||
*/
|
||||
bl c_runtime_cpu_setup /* still call old routine */
|
||||
|
||||
/* TODO: For SPL, call spl_relocate_stack_gd() to alloc stack relocation */
|
||||
|
||||
/*
|
||||
* Clear BSS section
|
||||
*/
|
||||
|
||||
@ -46,11 +46,19 @@ ENTRY(gic_init_secure)
|
||||
ldr w9, [x0, GICD_TYPER]
|
||||
and w10, w9, #0x1f /* ITLinesNumber */
|
||||
cbz w10, 1f /* No SPIs */
|
||||
add x11, x0, (GICD_IGROUPRn + 4)
|
||||
add x11, x0, GICD_IGROUPRn
|
||||
mov w9, #~0 /* Config SPIs as Grp1 */
|
||||
str w9, [x11], #0x4
|
||||
0: str w9, [x11], #0x4
|
||||
sub w10, w10, #0x1
|
||||
cbnz w10, 0b
|
||||
|
||||
ldr x1, =GICC_BASE /* GICC_CTLR */
|
||||
mov w0, #3 /* EnableGrp0 | EnableGrp1 */
|
||||
str w0, [x1]
|
||||
|
||||
mov w0, #1 << 7 /* allow NS access to GICC_PMR */
|
||||
str w0, [x1, #4] /* GICC_PMR */
|
||||
#endif
|
||||
1:
|
||||
ret
|
||||
|
||||
@ -150,6 +150,7 @@ struct bcm2835_mbox_tag_hdr {
|
||||
#define BCM2835_BOARD_REV_A_PLUS 0x12
|
||||
#define BCM2835_BOARD_REV_B_PLUS_13 0x13
|
||||
#define BCM2835_BOARD_REV_CM_14 0x14
|
||||
#define BCM2835_BOARD_REV_A_PLUS_15 0x15
|
||||
#endif
|
||||
|
||||
struct bcm2835_mbox_tag_get_board_rev {
|
||||
|
||||
@ -33,6 +33,11 @@ const struct keystone_pll_regs keystone_pll_regs[] = {
|
||||
[DDR3B_PLL] = {KS2_DDR3BPLLCTL0, KS2_DDR3BPLLCTL1},
|
||||
};
|
||||
|
||||
inline void pll_pa_clk_sel(void)
|
||||
{
|
||||
setbits_le32(keystone_pll_regs[PASS_PLL].reg1, CFG_PLLCTL1_PAPLL_MASK);
|
||||
}
|
||||
|
||||
static void wait_for_completion(const struct pll_init_data *data)
|
||||
{
|
||||
int i;
|
||||
@ -180,9 +185,8 @@ void configure_secondary_pll(const struct pll_init_data *data)
|
||||
sdelay(21000);
|
||||
|
||||
/* Select the Output of PASS PLL as input to PASS */
|
||||
if (data->pll == PASS_PLL)
|
||||
setbits_le32(keystone_pll_regs[data->pll].reg1,
|
||||
CFG_PLLCTL1_PAPLL_MASK);
|
||||
if (data->pll == PASS_PLL && cpu_is_k2hk())
|
||||
pll_pa_clk_sel();
|
||||
|
||||
/* Select the Output of ARM PLL as input to ARM */
|
||||
if (data->pll == TETRIS_PLL)
|
||||
|
||||
@ -118,6 +118,7 @@ unsigned long clk_round_rate(unsigned int clk, unsigned long hz);
|
||||
int clk_set_rate(unsigned int clk, unsigned long hz);
|
||||
int get_max_dev_speed(void);
|
||||
int get_max_arm_speed(void);
|
||||
void pll_pa_clk_sel(void);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -52,6 +52,18 @@ void enable_caches(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void v7_outer_cache_enable(void)
|
||||
{
|
||||
/* disable the L2 cache */
|
||||
writel(0, &pl310->pl310_ctrl);
|
||||
|
||||
/* enable BRESP, instruction and data prefetch, full line of zeroes */
|
||||
setbits_le32(&pl310->pl310_aux_ctrl,
|
||||
L310_AUX_CTRL_DATA_PREFETCH_MASK |
|
||||
L310_AUX_CTRL_INST_PREFETCH_MASK |
|
||||
L310_SHARED_ATT_OVERRIDE_ENABLE);
|
||||
}
|
||||
|
||||
/*
|
||||
* DesignWare Ethernet initialization
|
||||
*/
|
||||
|
||||
@ -15,7 +15,8 @@ LDFLAGS_FINAL += --bss-plt
|
||||
PLATFORM_RELFLAGS += -fpic -mrelocatable -ffunction-sections \
|
||||
-fdata-sections -mcall-linux
|
||||
|
||||
PLATFORM_CPPFLAGS += -D__powerpc__ -ffixed-r2 -m32
|
||||
PF_CPPFLAGS_POWERPC := $(call cc-option,-fno-ira-hoist-pressure,)
|
||||
PLATFORM_CPPFLAGS += -D__powerpc__ -ffixed-r2 -m32 $(PF_CPPFLAGS_POWERPC)
|
||||
PLATFORM_LDFLAGS += -m32 -melf32ppclinux
|
||||
|
||||
#
|
||||
|
||||
@ -1,986 +0,0 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2011
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <watchdog.h>
|
||||
#include <command.h>
|
||||
#include <malloc.h>
|
||||
#include <stdio_dev.h>
|
||||
#ifdef CONFIG_8xx
|
||||
#include <mpc8xx.h>
|
||||
#endif
|
||||
#ifdef CONFIG_5xx
|
||||
#include <mpc5xx.h>
|
||||
#endif
|
||||
#ifdef CONFIG_MPC5xxx
|
||||
#include <mpc5xxx.h>
|
||||
#endif
|
||||
#if defined(CONFIG_CMD_IDE)
|
||||
#include <ide.h>
|
||||
#endif
|
||||
#if defined(CONFIG_CMD_SCSI)
|
||||
#include <scsi.h>
|
||||
#endif
|
||||
#if defined(CONFIG_CMD_KGDB)
|
||||
#include <kgdb.h>
|
||||
#endif
|
||||
#ifdef CONFIG_STATUS_LED
|
||||
#include <status_led.h>
|
||||
#endif
|
||||
#include <net.h>
|
||||
#ifdef CONFIG_GENERIC_MMC
|
||||
#include <mmc.h>
|
||||
#endif
|
||||
#include <serial.h>
|
||||
#ifdef CONFIG_SYS_ALLOC_DPRAM
|
||||
#if !defined(CONFIG_CPM2)
|
||||
#include <commproc.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <version.h>
|
||||
#if defined(CONFIG_BAB7xx)
|
||||
#include <w83c553f.h>
|
||||
#endif
|
||||
#include <dtt.h>
|
||||
#if defined(CONFIG_POST)
|
||||
#include <post.h>
|
||||
#endif
|
||||
#if defined(CONFIG_LOGBUFFER)
|
||||
#include <logbuff.h>
|
||||
#endif
|
||||
#if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
|
||||
#include <asm/cache.h>
|
||||
#endif
|
||||
#ifdef CONFIG_PS2KBD
|
||||
#include <keyboard.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADDR_MAP
|
||||
#include <asm/mmu.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MP
|
||||
#include <asm/mp.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BITBANGMII
|
||||
#include <miiphy.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SYS_UPDATE_FLASH_SIZE
|
||||
extern int update_flash_size(int flash_size);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CMD_DOC)
|
||||
void doc_init(void);
|
||||
#endif
|
||||
#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)
|
||||
#include <i2c.h>
|
||||
#endif
|
||||
#include <spi.h>
|
||||
#include <nand.h>
|
||||
|
||||
static char *failed = "*** failed ***\n";
|
||||
|
||||
#if defined(CONFIG_OXC) || defined(CONFIG_RMU)
|
||||
extern flash_info_t flash_info[];
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_START_IDE)
|
||||
extern int board_start_ide(void);
|
||||
#endif
|
||||
#include <environment.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#if !defined(CONFIG_SYS_MEM_TOP_HIDE)
|
||||
#define CONFIG_SYS_MEM_TOP_HIDE 0
|
||||
#endif
|
||||
|
||||
extern ulong __init_end;
|
||||
extern ulong __bss_end;
|
||||
ulong monitor_flash_len;
|
||||
|
||||
#if defined(CONFIG_CMD_BEDBUG)
|
||||
#include <bedbug/type.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Utilities
|
||||
*/
|
||||
|
||||
/*
|
||||
* All attempts to come up with a "common" initialization sequence
|
||||
* that works for all boards and architectures failed: some of the
|
||||
* requirements are just _too_ different. To get rid of the resulting
|
||||
* mess of board dependend #ifdef'ed code we now make the whole
|
||||
* initialization sequence configurable to the user.
|
||||
*
|
||||
* The requirements for any new initalization function is simple: it
|
||||
* receives a pointer to the "global data" structure as it's only
|
||||
* argument, and returns an integer return code, where 0 means
|
||||
* "continue" and != 0 means "fatal error, hang the system".
|
||||
*/
|
||||
typedef int (init_fnc_t)(void);
|
||||
|
||||
/*
|
||||
* Init Utilities
|
||||
*
|
||||
* Some of this code should be moved into the core functions,
|
||||
* but let's get it working (again) first...
|
||||
*/
|
||||
|
||||
static int init_baudrate(void)
|
||||
{
|
||||
gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
static void __board_add_ram_info(int use_default)
|
||||
{
|
||||
/* please define platform specific board_add_ram_info() */
|
||||
}
|
||||
|
||||
void board_add_ram_info(int)
|
||||
__attribute__ ((weak, alias("__board_add_ram_info")));
|
||||
|
||||
static int __board_flash_wp_on(void)
|
||||
{
|
||||
/*
|
||||
* Most flashes can't be detected when write protection is enabled,
|
||||
* so provide a way to let U-Boot gracefully ignore write protected
|
||||
* devices.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_flash_wp_on(void)
|
||||
__attribute__ ((weak, alias("__board_flash_wp_on")));
|
||||
|
||||
static void __cpu_secondary_init_r(void)
|
||||
{
|
||||
}
|
||||
|
||||
void cpu_secondary_init_r(void)
|
||||
__attribute__ ((weak, alias("__cpu_secondary_init_r")));
|
||||
|
||||
static int init_func_ram(void)
|
||||
{
|
||||
#ifdef CONFIG_BOARD_TYPES
|
||||
int board_type = gd->board_type;
|
||||
#else
|
||||
int board_type = 0; /* use dummy arg */
|
||||
#endif
|
||||
puts("DRAM: ");
|
||||
|
||||
gd->ram_size = initdram(board_type);
|
||||
|
||||
if (gd->ram_size > 0) {
|
||||
print_size(gd->ram_size, "");
|
||||
board_add_ram_info(0);
|
||||
putc('\n');
|
||||
return 0;
|
||||
}
|
||||
puts(failed);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)
|
||||
static int init_func_i2c(void)
|
||||
{
|
||||
puts("I2C: ");
|
||||
#ifdef CONFIG_SYS_I2C
|
||||
i2c_init_all();
|
||||
#else
|
||||
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
|
||||
#endif
|
||||
puts("ready\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_HARD_SPI)
|
||||
static int init_func_spi(void)
|
||||
{
|
||||
puts("SPI: ");
|
||||
spi_init();
|
||||
puts("ready\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
#if defined(CONFIG_WATCHDOG)
|
||||
int init_func_watchdog_init(void)
|
||||
{
|
||||
#if defined(CONFIG_MPC85xx)
|
||||
init_85xx_watchdog();
|
||||
#endif
|
||||
puts(" Watchdog enabled\n");
|
||||
WATCHDOG_RESET();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int init_func_watchdog_reset(void)
|
||||
{
|
||||
WATCHDOG_RESET();
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_WATCHDOG */
|
||||
|
||||
/*
|
||||
* Initialization sequence
|
||||
*/
|
||||
|
||||
static init_fnc_t *init_sequence[] = {
|
||||
#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
|
||||
probecpu,
|
||||
#endif
|
||||
#if defined(CONFIG_BOARD_EARLY_INIT_F)
|
||||
board_early_init_f,
|
||||
#endif
|
||||
#if !defined(CONFIG_8xx_CPUCLK_DEFAULT)
|
||||
get_clocks, /* get CPU and bus clocks (etc.) */
|
||||
#if defined(CONFIG_TQM8xxL) && !defined(CONFIG_TQM866M) \
|
||||
&& !defined(CONFIG_TQM885D)
|
||||
adjust_sdram_tbs_8xx,
|
||||
#endif
|
||||
init_timebase,
|
||||
#endif
|
||||
#ifdef CONFIG_SYS_ALLOC_DPRAM
|
||||
#if !defined(CONFIG_CPM2)
|
||||
dpram_init,
|
||||
#endif
|
||||
#endif
|
||||
#if defined(CONFIG_BOARD_POSTCLK_INIT)
|
||||
board_postclk_init,
|
||||
#endif
|
||||
env_init,
|
||||
#if defined(CONFIG_8xx_CPUCLK_DEFAULT)
|
||||
/* get CPU and bus clocks according to the environment variable */
|
||||
get_clocks_866,
|
||||
/* adjust sdram refresh rate according to the new clock */
|
||||
sdram_adjust_866,
|
||||
init_timebase,
|
||||
#endif
|
||||
init_baudrate,
|
||||
serial_init,
|
||||
console_init_f,
|
||||
display_options,
|
||||
#if defined(CONFIG_MPC8260)
|
||||
prt_8260_rsr,
|
||||
prt_8260_clks,
|
||||
#endif /* CONFIG_MPC8260 */
|
||||
#if defined(CONFIG_MPC83xx)
|
||||
prt_83xx_rsr,
|
||||
#endif
|
||||
checkcpu,
|
||||
#if defined(CONFIG_MPC5xxx)
|
||||
prt_mpc5xxx_clks,
|
||||
#endif /* CONFIG_MPC5xxx */
|
||||
checkboard,
|
||||
INIT_FUNC_WATCHDOG_INIT
|
||||
#if defined(CONFIG_MISC_INIT_F)
|
||||
misc_init_f,
|
||||
#endif
|
||||
INIT_FUNC_WATCHDOG_RESET
|
||||
#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)
|
||||
init_func_i2c,
|
||||
#endif
|
||||
#if defined(CONFIG_HARD_SPI)
|
||||
init_func_spi,
|
||||
#endif
|
||||
#ifdef CONFIG_POST
|
||||
post_init_f,
|
||||
#endif
|
||||
INIT_FUNC_WATCHDOG_RESET
|
||||
init_func_ram,
|
||||
#if defined(CONFIG_SYS_DRAM_TEST)
|
||||
testdram,
|
||||
#endif /* CONFIG_SYS_DRAM_TEST */
|
||||
INIT_FUNC_WATCHDOG_RESET
|
||||
NULL, /* Terminate this list */
|
||||
};
|
||||
|
||||
static int __fixup_cpu(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fixup_cpu(void) __attribute__((weak, alias("__fixup_cpu")));
|
||||
|
||||
/*
|
||||
* This is the first part of the initialization sequence that is
|
||||
* implemented in C, but still running from ROM.
|
||||
*
|
||||
* The main purpose is to provide a (serial) console interface as
|
||||
* soon as possible (so we can see any error messages), and to
|
||||
* initialize the RAM so that we can relocate the monitor code to
|
||||
* RAM.
|
||||
*
|
||||
* Be aware of the restrictions: global data is read-only, BSS is not
|
||||
* initialized, and stack space is limited to a few kB.
|
||||
*/
|
||||
|
||||
void board_init_f(ulong bootflag)
|
||||
{
|
||||
bd_t *bd;
|
||||
ulong len, addr, addr_sp;
|
||||
ulong *s;
|
||||
gd_t *id;
|
||||
init_fnc_t **init_fnc_ptr;
|
||||
|
||||
#ifdef CONFIG_PRAM
|
||||
ulong reg;
|
||||
#endif
|
||||
|
||||
/* Pointer is writable since we allocated a register for it */
|
||||
gd = (gd_t *) (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
|
||||
/* compiler optimization barrier needed for GCC >= 3.4 */
|
||||
__asm__ __volatile__("":::"memory");
|
||||
|
||||
#if !defined(CONFIG_CPM2) && !defined(CONFIG_MPC512X) && \
|
||||
!defined(CONFIG_MPC83xx) && !defined(CONFIG_MPC85xx) && \
|
||||
!defined(CONFIG_MPC86xx)
|
||||
/* Clear initial global data */
|
||||
memset((void *) gd, 0, sizeof(gd_t));
|
||||
#endif
|
||||
|
||||
gd->flags = bootflag;
|
||||
|
||||
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr)
|
||||
if ((*init_fnc_ptr) () != 0)
|
||||
hang();
|
||||
|
||||
#ifdef CONFIG_POST
|
||||
post_bootmode_init();
|
||||
post_run(NULL, POST_ROM | post_bootmode_get(NULL));
|
||||
#endif
|
||||
|
||||
WATCHDOG_RESET();
|
||||
|
||||
/*
|
||||
* Now that we have DRAM mapped and working, we can
|
||||
* relocate the code and continue running from DRAM.
|
||||
*
|
||||
* Reserve memory at end of RAM for (top down in that order):
|
||||
* - area that won't get touched by U-Boot and Linux (optional)
|
||||
* - kernel log buffer
|
||||
* - protected RAM
|
||||
* - LCD framebuffer
|
||||
* - monitor code
|
||||
* - board info struct
|
||||
*/
|
||||
len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE;
|
||||
|
||||
/*
|
||||
* Subtract specified amount of memory to hide so that it won't
|
||||
* get "touched" at all by U-Boot. By fixing up gd->ram_size
|
||||
* the Linux kernel should now get passed the now "corrected"
|
||||
* memory size and won't touch it either. This should work
|
||||
* for arch/ppc and arch/powerpc. Only Linux board ports in
|
||||
* arch/powerpc with bootwrapper support, that recalculate the
|
||||
* memory size from the SDRAM controller setup will have to
|
||||
* get fixed.
|
||||
*/
|
||||
gd->ram_size -= CONFIG_SYS_MEM_TOP_HIDE;
|
||||
|
||||
addr = CONFIG_SYS_SDRAM_BASE + get_effective_memsize();
|
||||
|
||||
#if defined(CONFIG_MP) && (defined(CONFIG_MPC86xx) || defined(CONFIG_E500))
|
||||
/*
|
||||
* We need to make sure the location we intend to put secondary core
|
||||
* boot code is reserved and not used by any part of u-boot
|
||||
*/
|
||||
if (addr > determine_mp_bootpg(NULL)) {
|
||||
addr = determine_mp_bootpg(NULL);
|
||||
debug("Reserving MP boot page to %08lx\n", addr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LOGBUFFER
|
||||
#ifndef CONFIG_ALT_LB_ADDR
|
||||
/* reserve kernel log buffer */
|
||||
addr -= (LOGBUFF_RESERVE);
|
||||
debug("Reserving %dk for kernel logbuffer at %08lx\n", LOGBUFF_LEN,
|
||||
addr);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PRAM
|
||||
/*
|
||||
* reserve protected RAM
|
||||
*/
|
||||
reg = getenv_ulong("pram", 10, CONFIG_PRAM);
|
||||
addr -= (reg << 10); /* size is in kB */
|
||||
debug("Reserving %ldk for protected RAM at %08lx\n", reg, addr);
|
||||
#endif /* CONFIG_PRAM */
|
||||
|
||||
/* round down to next 4 kB limit */
|
||||
addr &= ~(4096 - 1);
|
||||
debug("Top of RAM usable for U-Boot at: %08lx\n", addr);
|
||||
|
||||
#ifdef CONFIG_LCD
|
||||
#ifdef CONFIG_FB_ADDR
|
||||
gd->fb_base = CONFIG_FB_ADDR;
|
||||
#else
|
||||
/* reserve memory for LCD display (always full pages) */
|
||||
addr = lcd_setmem(addr);
|
||||
gd->fb_base = addr;
|
||||
#endif /* CONFIG_FB_ADDR */
|
||||
#endif /* CONFIG_LCD */
|
||||
|
||||
#if defined(CONFIG_VIDEO) && defined(CONFIG_8xx)
|
||||
/* reserve memory for video display (always full pages) */
|
||||
addr = video_setmem(addr);
|
||||
gd->fb_base = addr;
|
||||
#endif /* CONFIG_VIDEO */
|
||||
|
||||
/*
|
||||
* reserve memory for U-Boot code, data & bss
|
||||
* round down to next 4 kB limit
|
||||
*/
|
||||
addr -= len;
|
||||
addr &= ~(4096 - 1);
|
||||
#ifdef CONFIG_E500
|
||||
/* round down to next 64 kB limit so that IVPR stays aligned */
|
||||
addr &= ~(65536 - 1);
|
||||
#endif
|
||||
|
||||
debug("Reserving %ldk for U-Boot at: %08lx\n", len >> 10, addr);
|
||||
|
||||
/*
|
||||
* reserve memory for malloc() arena
|
||||
*/
|
||||
addr_sp = addr - TOTAL_MALLOC_LEN;
|
||||
debug("Reserving %dk for malloc() at: %08lx\n",
|
||||
TOTAL_MALLOC_LEN >> 10, addr_sp);
|
||||
|
||||
/*
|
||||
* (permanently) allocate a Board Info struct
|
||||
* and a permanent copy of the "global" data
|
||||
*/
|
||||
addr_sp -= sizeof(bd_t);
|
||||
bd = (bd_t *) addr_sp;
|
||||
memset(bd, 0, sizeof(bd_t));
|
||||
gd->bd = bd;
|
||||
debug("Reserving %zu Bytes for Board Info at: %08lx\n",
|
||||
sizeof(bd_t), addr_sp);
|
||||
addr_sp -= sizeof(gd_t);
|
||||
id = (gd_t *) addr_sp;
|
||||
debug("Reserving %zu Bytes for Global Data at: %08lx\n",
|
||||
sizeof(gd_t), addr_sp);
|
||||
|
||||
/*
|
||||
* Finally, we set up a new (bigger) stack.
|
||||
*
|
||||
* Leave some safety gap for SP, force alignment on 16 byte boundary
|
||||
* Clear initial stack frame
|
||||
*/
|
||||
addr_sp -= 16;
|
||||
addr_sp &= ~0xF;
|
||||
s = (ulong *) addr_sp;
|
||||
*s = 0; /* Terminate back chain */
|
||||
*++s = 0; /* NULL return address */
|
||||
debug("Stack Pointer at: %08lx\n", addr_sp);
|
||||
|
||||
/*
|
||||
* Save local variables to board info struct
|
||||
*/
|
||||
|
||||
bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; /* start of memory */
|
||||
bd->bi_memsize = gd->ram_size; /* size in bytes */
|
||||
|
||||
#ifdef CONFIG_SYS_SRAM_BASE
|
||||
bd->bi_sramstart = CONFIG_SYS_SRAM_BASE; /* start of SRAM */
|
||||
bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE; /* size of SRAM */
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_8xx) || defined(CONFIG_MPC8260) || defined(CONFIG_5xx) || \
|
||||
defined(CONFIG_E500) || defined(CONFIG_MPC86xx)
|
||||
bd->bi_immr_base = CONFIG_SYS_IMMR; /* base of IMMR register */
|
||||
#endif
|
||||
#if defined(CONFIG_MPC5xxx)
|
||||
bd->bi_mbar_base = CONFIG_SYS_MBAR; /* base of internal registers */
|
||||
#endif
|
||||
#if defined(CONFIG_MPC83xx)
|
||||
bd->bi_immrbar = CONFIG_SYS_IMMR;
|
||||
#endif
|
||||
|
||||
WATCHDOG_RESET();
|
||||
bd->bi_intfreq = gd->cpu_clk; /* Internal Freq, in Hz */
|
||||
bd->bi_busfreq = gd->bus_clk; /* Bus Freq, in Hz */
|
||||
#if defined(CONFIG_CPM2)
|
||||
bd->bi_cpmfreq = gd->arch.cpm_clk;
|
||||
bd->bi_brgfreq = gd->arch.brg_clk;
|
||||
bd->bi_sccfreq = gd->arch.scc_clk;
|
||||
bd->bi_vco = gd->arch.vco_out;
|
||||
#endif /* CONFIG_CPM2 */
|
||||
#if defined(CONFIG_MPC512X)
|
||||
bd->bi_ipsfreq = gd->arch.ips_clk;
|
||||
#endif /* CONFIG_MPC512X */
|
||||
#if defined(CONFIG_MPC5xxx)
|
||||
bd->bi_ipbfreq = gd->arch.ipb_clk;
|
||||
bd->bi_pcifreq = gd->pci_clk;
|
||||
#endif /* CONFIG_MPC5xxx */
|
||||
|
||||
#ifdef CONFIG_SYS_EXTBDINFO
|
||||
strncpy((char *) bd->bi_s_version, "1.2", sizeof(bd->bi_s_version));
|
||||
strncpy((char *) bd->bi_r_version, U_BOOT_VERSION,
|
||||
sizeof(bd->bi_r_version));
|
||||
|
||||
bd->bi_procfreq = gd->cpu_clk; /* Processor Speed, In Hz */
|
||||
bd->bi_plb_busfreq = gd->bus_clk;
|
||||
#if defined(CONFIG_405GP) || defined(CONFIG_405EP) || \
|
||||
defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
|
||||
defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
|
||||
bd->bi_pci_busfreq = get_PCI_freq();
|
||||
bd->bi_opbfreq = get_OPB_freq();
|
||||
#elif defined(CONFIG_XILINX_405)
|
||||
bd->bi_pci_busfreq = get_PCI_freq();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
debug("New Stack Pointer is: %08lx\n", addr_sp);
|
||||
|
||||
WATCHDOG_RESET();
|
||||
|
||||
gd->relocaddr = addr; /* Store relocation addr, useful for debug */
|
||||
|
||||
memcpy(id, (void *) gd, sizeof(gd_t));
|
||||
|
||||
relocate_code(addr_sp, id, addr);
|
||||
|
||||
/* NOTREACHED - relocate_code() does not return */
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the next part if the initialization sequence: we are now
|
||||
* running from RAM and have a "normal" C environment, i. e. global
|
||||
* data can be written, BSS has been cleared, the stack size in not
|
||||
* that critical any more, etc.
|
||||
*/
|
||||
void board_init_r(gd_t *id, ulong dest_addr)
|
||||
{
|
||||
bd_t *bd;
|
||||
ulong malloc_start;
|
||||
|
||||
#ifndef CONFIG_SYS_NO_FLASH
|
||||
ulong flash_size;
|
||||
#endif
|
||||
|
||||
gd = id; /* initialize RAM version of global data */
|
||||
bd = gd->bd;
|
||||
|
||||
gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
|
||||
|
||||
/* The Malloc area is immediately below the monitor copy in DRAM */
|
||||
malloc_start = dest_addr - TOTAL_MALLOC_LEN;
|
||||
|
||||
#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
|
||||
/*
|
||||
* The gd->arch.cpu pointer is set to an address in flash before
|
||||
* relocation. We need to update it to point to the same CPU entry
|
||||
* in RAM.
|
||||
*/
|
||||
gd->arch.cpu += dest_addr - CONFIG_SYS_MONITOR_BASE;
|
||||
|
||||
/*
|
||||
* If we didn't know the cpu mask & # cores, we can save them of
|
||||
* now rather than 'computing' them constantly
|
||||
*/
|
||||
fixup_cpu();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SYS_EXTRA_ENV_RELOC
|
||||
/*
|
||||
* Some systems need to relocate the env_addr pointer early because the
|
||||
* location it points to will get invalidated before env_relocate is
|
||||
* called. One example is on systems that might use a L2 or L3 cache
|
||||
* in SRAM mode and initialize that cache from SRAM mode back to being
|
||||
* a cache in cpu_init_r.
|
||||
*/
|
||||
gd->env_addr += dest_addr - CONFIG_SYS_MONITOR_BASE;
|
||||
#endif
|
||||
|
||||
serial_initialize();
|
||||
|
||||
debug("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
|
||||
|
||||
WATCHDOG_RESET();
|
||||
|
||||
/*
|
||||
* Setup trap handlers
|
||||
*/
|
||||
trap_init(dest_addr);
|
||||
|
||||
#ifdef CONFIG_ADDR_MAP
|
||||
init_addr_map();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BOARD_EARLY_INIT_R)
|
||||
board_early_init_r();
|
||||
#endif
|
||||
|
||||
monitor_flash_len = (ulong)&__init_end - dest_addr;
|
||||
|
||||
WATCHDOG_RESET();
|
||||
|
||||
#ifdef CONFIG_LOGBUFFER
|
||||
logbuff_init_ptrs();
|
||||
#endif
|
||||
#ifdef CONFIG_POST
|
||||
post_output_backlog();
|
||||
#endif
|
||||
|
||||
WATCHDOG_RESET();
|
||||
|
||||
#if defined(CONFIG_SYS_DELAYED_ICACHE)
|
||||
icache_enable(); /* it's time to enable the instruction cache */
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
|
||||
unlock_ram_in_cache(); /* it's time to unlock D-cache in e500 */
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PCI) && defined(CONFIG_SYS_EARLY_PCI_INIT)
|
||||
/*
|
||||
* Do early PCI configuration _before_ the flash gets initialised,
|
||||
* because PCU ressources are crucial for flash access on some boards.
|
||||
*/
|
||||
pci_init();
|
||||
#endif
|
||||
#if defined(CONFIG_WINBOND_83C553)
|
||||
/*
|
||||
* Initialise the ISA bridge
|
||||
*/
|
||||
initialise_w83c553f();
|
||||
#endif
|
||||
|
||||
asm("sync ; isync");
|
||||
|
||||
mem_malloc_init(malloc_start, TOTAL_MALLOC_LEN);
|
||||
|
||||
#if !defined(CONFIG_SYS_NO_FLASH)
|
||||
puts("Flash: ");
|
||||
|
||||
if (board_flash_wp_on()) {
|
||||
printf("Uninitialized - Write Protect On\n");
|
||||
/* Since WP is on, we can't find real size. Set to 0 */
|
||||
flash_size = 0;
|
||||
} else if ((flash_size = flash_init()) > 0) {
|
||||
#ifdef CONFIG_SYS_FLASH_CHECKSUM
|
||||
print_size(flash_size, "");
|
||||
/*
|
||||
* Compute and print flash CRC if flashchecksum is set to 'y'
|
||||
*
|
||||
* NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
|
||||
*/
|
||||
if (getenv_yesno("flashchecksum") == 1) {
|
||||
printf(" CRC: %08X",
|
||||
crc32(0,
|
||||
(const unsigned char *)
|
||||
CONFIG_SYS_FLASH_BASE, flash_size)
|
||||
);
|
||||
}
|
||||
putc('\n');
|
||||
#else /* !CONFIG_SYS_FLASH_CHECKSUM */
|
||||
print_size(flash_size, "\n");
|
||||
#endif /* CONFIG_SYS_FLASH_CHECKSUM */
|
||||
} else {
|
||||
puts(failed);
|
||||
hang();
|
||||
}
|
||||
|
||||
/* update start of FLASH memory */
|
||||
bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
|
||||
/* size of FLASH memory (final value) */
|
||||
bd->bi_flashsize = flash_size;
|
||||
|
||||
#if defined(CONFIG_SYS_UPDATE_FLASH_SIZE)
|
||||
/* Make a update of the Memctrl. */
|
||||
update_flash_size(flash_size);
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(CONFIG_OXC) || defined(CONFIG_RMU)
|
||||
/* flash mapped at end of memory map */
|
||||
bd->bi_flashoffset = CONFIG_SYS_TEXT_BASE + flash_size;
|
||||
#elif CONFIG_SYS_MONITOR_BASE == CONFIG_SYS_FLASH_BASE
|
||||
bd->bi_flashoffset = monitor_flash_len; /* reserved area for monitor */
|
||||
#endif
|
||||
#endif /* !CONFIG_SYS_NO_FLASH */
|
||||
|
||||
WATCHDOG_RESET();
|
||||
|
||||
/* initialize higher level parts of CPU like time base and timers */
|
||||
cpu_init_r();
|
||||
|
||||
WATCHDOG_RESET();
|
||||
|
||||
#ifdef CONFIG_SPI
|
||||
#if !defined(CONFIG_ENV_IS_IN_EEPROM)
|
||||
spi_init_f();
|
||||
#endif
|
||||
spi_init_r();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CMD_NAND)
|
||||
WATCHDOG_RESET();
|
||||
puts("NAND: ");
|
||||
nand_init(); /* go init the NAND */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_GENERIC_MMC
|
||||
/*
|
||||
* MMC initialization is called before relocating env.
|
||||
* Thus It is required that operations like pin multiplexer
|
||||
* be put in board_init.
|
||||
*/
|
||||
WATCHDOG_RESET();
|
||||
puts("MMC: ");
|
||||
mmc_initialize(bd);
|
||||
#endif
|
||||
|
||||
/* relocate environment function pointers etc. */
|
||||
env_relocate();
|
||||
|
||||
/*
|
||||
* after non-volatile devices & environment is setup and cpu code have
|
||||
* another round to deal with any initialization that might require
|
||||
* full access to the environment or loading of some image (firmware)
|
||||
* from a non-volatile device
|
||||
*/
|
||||
cpu_secondary_init_r();
|
||||
|
||||
/*
|
||||
* Fill in missing fields of bd_info.
|
||||
* We do this here, where we have "normal" access to the
|
||||
* environment; we used to do this still running from ROM,
|
||||
* where had to use getenv_f(), which can be pretty slow when
|
||||
* the environment is in EEPROM.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_SYS_EXTBDINFO)
|
||||
#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
|
||||
#if defined(CONFIG_I2CFAST)
|
||||
/*
|
||||
* set bi_iic_fast for linux taking environment variable
|
||||
* "i2cfast" into account
|
||||
*/
|
||||
{
|
||||
if (getenv_yesno("i2cfast") == 1) {
|
||||
bd->bi_iic_fast[0] = 1;
|
||||
bd->bi_iic_fast[1] = 1;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_I2CFAST */
|
||||
#endif /* CONFIG_405GP, CONFIG_405EP */
|
||||
#endif /* CONFIG_SYS_EXTBDINFO */
|
||||
|
||||
#if defined(CONFIG_ID_EEPROM) || defined(CONFIG_SYS_I2C_MAC_OFFSET)
|
||||
mac_read_from_eeprom();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CMD_NET
|
||||
/* kept around for legacy kernels only ... ignore the next section */
|
||||
eth_getenv_enetaddr("ethaddr", bd->bi_enetaddr);
|
||||
#ifdef CONFIG_HAS_ETH1
|
||||
eth_getenv_enetaddr("eth1addr", bd->bi_enet1addr);
|
||||
#endif
|
||||
#ifdef CONFIG_HAS_ETH2
|
||||
eth_getenv_enetaddr("eth2addr", bd->bi_enet2addr);
|
||||
#endif
|
||||
#ifdef CONFIG_HAS_ETH3
|
||||
eth_getenv_enetaddr("eth3addr", bd->bi_enet3addr);
|
||||
#endif
|
||||
#ifdef CONFIG_HAS_ETH4
|
||||
eth_getenv_enetaddr("eth4addr", bd->bi_enet4addr);
|
||||
#endif
|
||||
#ifdef CONFIG_HAS_ETH5
|
||||
eth_getenv_enetaddr("eth5addr", bd->bi_enet5addr);
|
||||
#endif
|
||||
#endif /* CONFIG_CMD_NET */
|
||||
|
||||
WATCHDOG_RESET();
|
||||
|
||||
#if defined(CONFIG_PCI) && !defined(CONFIG_SYS_EARLY_PCI_INIT)
|
||||
/*
|
||||
* Do pci configuration
|
||||
*/
|
||||
pci_init();
|
||||
#endif
|
||||
|
||||
/** leave this here (after malloc(), environment and PCI are working) **/
|
||||
/* Initialize stdio devices */
|
||||
stdio_init();
|
||||
|
||||
/* Initialize the jump table for applications */
|
||||
jumptable_init();
|
||||
|
||||
#if defined(CONFIG_API)
|
||||
/* Initialize API */
|
||||
api_init();
|
||||
#endif
|
||||
|
||||
/* Initialize the console (after the relocation and devices init) */
|
||||
console_init_r();
|
||||
|
||||
#if defined(CONFIG_MISC_INIT_R)
|
||||
/* miscellaneous platform dependent initialisations */
|
||||
misc_init_r();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CMD_KGDB)
|
||||
WATCHDOG_RESET();
|
||||
puts("KGDB: ");
|
||||
kgdb_init();
|
||||
#endif
|
||||
|
||||
debug("U-Boot relocated to %08lx\n", dest_addr);
|
||||
|
||||
/*
|
||||
* Enable Interrupts
|
||||
*/
|
||||
interrupt_init();
|
||||
|
||||
#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
|
||||
status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING);
|
||||
#endif
|
||||
|
||||
udelay(20);
|
||||
|
||||
/* Initialize from environment */
|
||||
load_addr = getenv_ulong("loadaddr", 16, load_addr);
|
||||
|
||||
WATCHDOG_RESET();
|
||||
|
||||
#if defined(CONFIG_CMD_SCSI)
|
||||
WATCHDOG_RESET();
|
||||
puts("SCSI: ");
|
||||
scsi_init();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CMD_DOC)
|
||||
WATCHDOG_RESET();
|
||||
puts("DOC: ");
|
||||
doc_init();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BITBANGMII
|
||||
bb_miiphy_init();
|
||||
#endif
|
||||
#if defined(CONFIG_CMD_NET)
|
||||
WATCHDOG_RESET();
|
||||
puts("Net: ");
|
||||
eth_initialize();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CMD_NET) && defined(CONFIG_RESET_PHY_R)
|
||||
WATCHDOG_RESET();
|
||||
debug("Reset Ethernet PHY\n");
|
||||
reset_phy();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_POST
|
||||
post_run(NULL, POST_RAM | post_bootmode_get(0));
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CMD_PCMCIA) \
|
||||
&& !defined(CONFIG_CMD_IDE)
|
||||
WATCHDOG_RESET();
|
||||
puts("PCMCIA:");
|
||||
pcmcia_init();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CMD_IDE)
|
||||
WATCHDOG_RESET();
|
||||
#ifdef CONFIG_IDE_8xx_PCCARD
|
||||
puts("PCMCIA:");
|
||||
#else
|
||||
puts("IDE: ");
|
||||
#endif
|
||||
#if defined(CONFIG_START_IDE)
|
||||
if (board_start_ide())
|
||||
ide_init();
|
||||
#else
|
||||
ide_init();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LAST_STAGE_INIT
|
||||
WATCHDOG_RESET();
|
||||
/*
|
||||
* Some parts can be only initialized if all others (like
|
||||
* Interrupts) are up and running (i.e. the PC-style ISA
|
||||
* keyboard).
|
||||
*/
|
||||
last_stage_init();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CMD_BEDBUG)
|
||||
WATCHDOG_RESET();
|
||||
bedbug_init();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
|
||||
/*
|
||||
* Export available size of memory for Linux,
|
||||
* taking into account the protected RAM at top of memory
|
||||
*/
|
||||
{
|
||||
ulong pram = 0;
|
||||
char memsz[32];
|
||||
|
||||
#ifdef CONFIG_PRAM
|
||||
pram = getenv_ulong("pram", 10, CONFIG_PRAM);
|
||||
#endif
|
||||
#ifdef CONFIG_LOGBUFFER
|
||||
#ifndef CONFIG_ALT_LB_ADDR
|
||||
/* Also take the logbuffer into account (pram is in kB) */
|
||||
pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024;
|
||||
#endif
|
||||
#endif
|
||||
sprintf(memsz, "%ldk", (ulong) (bd->bi_memsize / 1024) - pram);
|
||||
setenv("mem", memsz);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PS2KBD
|
||||
puts("PS/2: ");
|
||||
kbd_init();
|
||||
#endif
|
||||
|
||||
/* Initialization complete - start the monitor */
|
||||
|
||||
/* main_loop() can return to retry autoboot, if so just run it again. */
|
||||
for (;;) {
|
||||
WATCHDOG_RESET();
|
||||
main_loop();
|
||||
}
|
||||
|
||||
/* NOTREACHED - no way out of command loop except booting */
|
||||
}
|
||||
|
||||
#if 0 /* We could use plain global data, but the resulting code is bigger */
|
||||
/*
|
||||
* Pointer to initial global data area
|
||||
*
|
||||
* Here we initialize it.
|
||||
*/
|
||||
#undef XTRN_DECLARE_GLOBAL_DATA_PTR
|
||||
#define XTRN_DECLARE_GLOBAL_DATA_PTR /* empty = allocate here */
|
||||
DECLARE_GLOBAL_DATA_PTR =
|
||||
(gd_t *) (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
|
||||
#endif /* 0 */
|
||||
|
||||
/************************************************************************/
|
||||
@ -1,11 +1,7 @@
|
||||
NET2BIG_V2 BOARD
|
||||
#M: -
|
||||
M: Simon Guinot <simon.guinot@sequanux.org>
|
||||
S: Maintained
|
||||
F: board/LaCie/net2big_v2/
|
||||
F: include/configs/lacie_kw.h
|
||||
F: configs/d2net_v2_defconfig
|
||||
|
||||
NET2BIG_V2 BOARD
|
||||
M: Simon Guinot <simon.guinot@sequanux.org>
|
||||
S: Maintained
|
||||
F: configs/net2big_v2_defconfig
|
||||
|
||||
@ -5,4 +5,4 @@
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
obj-y := vexpress64.o
|
||||
obj-y := vexpress64.o pcie.o
|
||||
|
||||
197
board/armltd/vexpress64/pcie.c
Normal file
197
board/armltd/vexpress64/pcie.c
Normal file
@ -0,0 +1,197 @@
|
||||
/*
|
||||
* Copyright (C) ARM Ltd 2015
|
||||
*
|
||||
* Author: Liviu Dudau <Liviu.Dudau@arm.com>
|
||||
*
|
||||
* SPDX-Licence-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/io.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <pci_ids.h>
|
||||
#include "pcie.h"
|
||||
|
||||
/* XpressRICH3 support */
|
||||
#define XR3_CONFIG_BASE 0x7ff30000
|
||||
#define XR3_RESET_BASE 0x7ff20000
|
||||
|
||||
#define XR3_PCI_ECAM_START 0x40000000
|
||||
#define XR3_PCI_ECAM_SIZE 28 /* as power of 2 = 0x10000000 */
|
||||
#define XR3_PCI_IOSPACE_START 0x5f800000
|
||||
#define XR3_PCI_IOSPACE_SIZE 23 /* as power of 2 = 0x800000 */
|
||||
#define XR3_PCI_MEMSPACE_START 0x50000000
|
||||
#define XR3_PCI_MEMSPACE_SIZE 27 /* as power of 2 = 0x8000000 */
|
||||
#define XR3_PCI_MEMSPACE64_START 0x4000000000
|
||||
#define XR3_PCI_MEMSPACE64_SIZE 33 /* as power of 2 = 0x200000000 */
|
||||
|
||||
#define JUNO_V2M_MSI_START 0x2c1c0000
|
||||
#define JUNO_V2M_MSI_SIZE 12 /* as power of 2 = 4096 */
|
||||
|
||||
#define XR3PCI_BASIC_STATUS 0x18
|
||||
#define XR3PCI_BS_GEN_MASK (0xf << 8)
|
||||
#define XR3PCI_BS_LINK_MASK 0xff
|
||||
|
||||
#define XR3PCI_VIRTCHAN_CREDITS 0x90
|
||||
#define XR3PCI_BRIDGE_PCI_IDS 0x9c
|
||||
#define XR3PCI_PEX_SPC2 0xd8
|
||||
|
||||
#define XR3PCI_ATR_PCIE_WIN0 0x600
|
||||
#define XR3PCI_ATR_PCIE_WIN1 0x700
|
||||
#define XR3PCI_ATR_AXI4_SLV0 0x800
|
||||
|
||||
#define XR3PCI_ATR_TABLE_SIZE 0x20
|
||||
#define XR3PCI_ATR_SRC_ADDR_LOW 0x0
|
||||
#define XR3PCI_ATR_SRC_ADDR_HIGH 0x4
|
||||
#define XR3PCI_ATR_TRSL_ADDR_LOW 0x8
|
||||
#define XR3PCI_ATR_TRSL_ADDR_HIGH 0xc
|
||||
#define XR3PCI_ATR_TRSL_PARAM 0x10
|
||||
|
||||
/* IDs used in the XR3PCI_ATR_TRSL_PARAM */
|
||||
#define XR3PCI_ATR_TRSLID_AXIDEVICE (0x420004)
|
||||
#define XR3PCI_ATR_TRSLID_AXIMEMORY (0x4e0004) /* Write-through, read/write allocate */
|
||||
#define XR3PCI_ATR_TRSLID_PCIE_CONF (0x000001)
|
||||
#define XR3PCI_ATR_TRSLID_PCIE_IO (0x020000)
|
||||
#define XR3PCI_ATR_TRSLID_PCIE_MEMORY (0x000000)
|
||||
|
||||
#define XR3PCI_ECAM_OFFSET(b, d, o) (((b) << 20) | \
|
||||
(PCI_SLOT(d) << 15) | \
|
||||
(PCI_FUNC(d) << 12) | o)
|
||||
|
||||
#define JUNO_RESET_CTRL 0x1004
|
||||
#define JUNO_RESET_CTRL_PHY BIT(0)
|
||||
#define JUNO_RESET_CTRL_RC BIT(1)
|
||||
|
||||
#define JUNO_RESET_STATUS 0x1008
|
||||
#define JUNO_RESET_STATUS_PLL BIT(0)
|
||||
#define JUNO_RESET_STATUS_PHY BIT(1)
|
||||
#define JUNO_RESET_STATUS_RC BIT(2)
|
||||
#define JUNO_RESET_STATUS_MASK (JUNO_RESET_STATUS_PLL | \
|
||||
JUNO_RESET_STATUS_PHY | \
|
||||
JUNO_RESET_STATUS_RC)
|
||||
|
||||
void xr3pci_set_atr_entry(unsigned long base, unsigned long src_addr,
|
||||
unsigned long trsl_addr, int window_size,
|
||||
int trsl_param)
|
||||
{
|
||||
/* X3PCI_ATR_SRC_ADDR_LOW:
|
||||
- bit 0: enable entry,
|
||||
- bits 1-6: ATR window size: total size in bytes: 2^(ATR_WSIZE + 1)
|
||||
- bits 7-11: reserved
|
||||
- bits 12-31: start of source address
|
||||
*/
|
||||
writel((u32)(src_addr & 0xfffff000) | (window_size - 1) << 1 | 1,
|
||||
base + XR3PCI_ATR_SRC_ADDR_LOW);
|
||||
writel((u32)(src_addr >> 32), base + XR3PCI_ATR_SRC_ADDR_HIGH);
|
||||
writel((u32)(trsl_addr & 0xfffff000), base + XR3PCI_ATR_TRSL_ADDR_LOW);
|
||||
writel((u32)(trsl_addr >> 32), base + XR3PCI_ATR_TRSL_ADDR_HIGH);
|
||||
writel(trsl_param, base + XR3PCI_ATR_TRSL_PARAM);
|
||||
|
||||
printf("ATR entry: 0x%010lx %s 0x%010lx [0x%010llx] (param: 0x%06x)\n",
|
||||
src_addr, (trsl_param & 0x400000) ? "<-" : "->", trsl_addr,
|
||||
((u64)1) << window_size, trsl_param);
|
||||
}
|
||||
|
||||
void xr3pci_setup_atr(void)
|
||||
{
|
||||
/* setup PCIe to CPU address translation tables */
|
||||
unsigned long base = XR3_CONFIG_BASE + XR3PCI_ATR_PCIE_WIN0;
|
||||
|
||||
/* forward all writes from PCIe to GIC V2M (used for MSI) */
|
||||
xr3pci_set_atr_entry(base, JUNO_V2M_MSI_START, JUNO_V2M_MSI_START,
|
||||
JUNO_V2M_MSI_SIZE, XR3PCI_ATR_TRSLID_AXIDEVICE);
|
||||
|
||||
base += XR3PCI_ATR_TABLE_SIZE;
|
||||
|
||||
/* PCIe devices can write anywhere in memory */
|
||||
xr3pci_set_atr_entry(base, PHYS_SDRAM_1, PHYS_SDRAM_1,
|
||||
31 /* grant access to all RAM under 4GB */,
|
||||
XR3PCI_ATR_TRSLID_AXIMEMORY);
|
||||
base += XR3PCI_ATR_TABLE_SIZE;
|
||||
xr3pci_set_atr_entry(base, PHYS_SDRAM_2, PHYS_SDRAM_2,
|
||||
XR3_PCI_MEMSPACE64_SIZE,
|
||||
XR3PCI_ATR_TRSLID_AXIMEMORY);
|
||||
|
||||
|
||||
/* setup CPU to PCIe address translation table */
|
||||
base = XR3_CONFIG_BASE + XR3PCI_ATR_AXI4_SLV0;
|
||||
|
||||
/* setup ECAM space to bus configuration interface */
|
||||
xr3pci_set_atr_entry(base, XR3_PCI_ECAM_START, 0, XR3_PCI_ECAM_SIZE,
|
||||
XR3PCI_ATR_TRSLID_PCIE_CONF);
|
||||
|
||||
base += XR3PCI_ATR_TABLE_SIZE;
|
||||
|
||||
/* setup IO space translation */
|
||||
xr3pci_set_atr_entry(base, XR3_PCI_IOSPACE_START, XR3_PCI_IOSPACE_START,
|
||||
XR3_PCI_IOSPACE_SIZE, XR3PCI_ATR_TRSLID_PCIE_IO);
|
||||
|
||||
base += XR3PCI_ATR_TABLE_SIZE;
|
||||
|
||||
/* setup 32bit MEM space translation */
|
||||
xr3pci_set_atr_entry(base, XR3_PCI_MEMSPACE_START, XR3_PCI_MEMSPACE_START,
|
||||
XR3_PCI_MEMSPACE_SIZE, XR3PCI_ATR_TRSLID_PCIE_MEMORY);
|
||||
|
||||
base += XR3PCI_ATR_TABLE_SIZE;
|
||||
|
||||
/* setup 64bit MEM space translation */
|
||||
xr3pci_set_atr_entry(base, XR3_PCI_MEMSPACE64_START, XR3_PCI_MEMSPACE64_START,
|
||||
XR3_PCI_MEMSPACE64_SIZE, XR3PCI_ATR_TRSLID_PCIE_MEMORY);
|
||||
}
|
||||
|
||||
void xr3pci_init(void)
|
||||
{
|
||||
u32 val;
|
||||
int timeout = 200;
|
||||
|
||||
/* Initialise the XpressRICH3 PCIe host bridge */
|
||||
|
||||
/* add credits */
|
||||
writel(0x00f0b818, XR3_CONFIG_BASE + XR3PCI_VIRTCHAN_CREDITS);
|
||||
writel(0x1, XR3_CONFIG_BASE + XR3PCI_VIRTCHAN_CREDITS + 4);
|
||||
/* allow ECRC */
|
||||
writel(0x6006, XR3_CONFIG_BASE + XR3PCI_PEX_SPC2);
|
||||
/* setup the correct class code for the host bridge */
|
||||
writel(PCI_CLASS_BRIDGE_PCI << 16, XR3_CONFIG_BASE + XR3PCI_BRIDGE_PCI_IDS);
|
||||
|
||||
/* reset phy and root complex */
|
||||
writel(JUNO_RESET_CTRL_PHY | JUNO_RESET_CTRL_RC,
|
||||
XR3_RESET_BASE + JUNO_RESET_CTRL);
|
||||
|
||||
do {
|
||||
mdelay(1);
|
||||
val = readl(XR3_RESET_BASE + JUNO_RESET_STATUS);
|
||||
} while (--timeout &&
|
||||
(val & JUNO_RESET_STATUS_MASK) != JUNO_RESET_STATUS_MASK);
|
||||
|
||||
if (!timeout) {
|
||||
printf("PCI XR3 Root complex reset timed out\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Wait for the link to train */
|
||||
mdelay(20);
|
||||
timeout = 20;
|
||||
|
||||
do {
|
||||
mdelay(1);
|
||||
val = readl(XR3_CONFIG_BASE + XR3PCI_BASIC_STATUS);
|
||||
} while (--timeout && !(val & XR3PCI_BS_LINK_MASK));
|
||||
|
||||
if (!(val & XR3PCI_BS_LINK_MASK)) {
|
||||
printf("Failed to negotiate a link!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("PCIe XR3 Host Bridge enabled: x%d link (Gen %d)\n",
|
||||
val & XR3PCI_BS_LINK_MASK, (val & XR3PCI_BS_GEN_MASK) >> 8);
|
||||
|
||||
xr3pci_setup_atr();
|
||||
}
|
||||
|
||||
void vexpress64_pcie_init(void)
|
||||
{
|
||||
#ifdef CONFIG_TARGET_VEXPRESS64_JUNO
|
||||
xr3pci_init();
|
||||
#endif
|
||||
}
|
||||
6
board/armltd/vexpress64/pcie.h
Normal file
6
board/armltd/vexpress64/pcie.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef __VEXPRESS64_PCIE_H__
|
||||
#define __VEXPRESS64_PCIE_H__
|
||||
|
||||
void vexpress64_pcie_init(void);
|
||||
|
||||
#endif /* __VEXPRESS64_PCIE_H__ */
|
||||
@ -13,6 +13,7 @@
|
||||
#include <linux/compiler.h>
|
||||
#include <dm/platdata.h>
|
||||
#include <dm/platform_data/serial_pl01x.h>
|
||||
#include "pcie.h"
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
@ -29,6 +30,7 @@ U_BOOT_DEVICE(vexpress_serials) = {
|
||||
|
||||
int board_init(void)
|
||||
{
|
||||
vexpress64_pcie_init();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -38,6 +40,14 @@ int dram_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dram_init_banksize(void)
|
||||
{
|
||||
gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
|
||||
gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
|
||||
gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
|
||||
gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Board specific reset that is system reset.
|
||||
*/
|
||||
|
||||
@ -108,7 +108,7 @@ int dram_init(void)
|
||||
.trcd_int = 6,
|
||||
.tras_lockout = 0,
|
||||
.tdal = 12,
|
||||
.bstlen = 0,
|
||||
.bstlen = 3,
|
||||
.tdll = 512,
|
||||
.trp_ab = 6,
|
||||
.tref = 3120,
|
||||
|
||||
@ -176,6 +176,11 @@ static const struct {
|
||||
"bcm2835-rpi-cm.dtb",
|
||||
false,
|
||||
},
|
||||
[BCM2835_BOARD_REV_A_PLUS_15] = {
|
||||
"Model A+",
|
||||
"bcm2835-rpi-a-plus.dtb",
|
||||
false,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ Wind River SBC8641D reference board
|
||||
|
||||
Created 06/14/2007 Joe Hamman
|
||||
Copyright 2007, Embedded Specialties, Inc.
|
||||
Copyright 2007 Wind River Systemes, Inc.
|
||||
Copyright 2007 Wind River Systems, Inc.
|
||||
-----------------------------
|
||||
|
||||
1. Building U-Boot
|
||||
@ -26,3 +26,24 @@ and settings may change with board revisions.
|
||||
--------------------
|
||||
PCI:
|
||||
The PCI command may hang if no boards are present in either slot.
|
||||
|
||||
4. Reflashing U-Boot
|
||||
--------------------
|
||||
The board has two independent flash devices which can be used for dual
|
||||
booting, or for u-boot backup and recovery. A two pin jumper on the
|
||||
three pin JP10 determines which device is attached to /CS0 line.
|
||||
|
||||
Assuming one device has a functional u-boot, and the other device has
|
||||
a recently installed non-functional image, to perform a recovery from
|
||||
that non-functional image goes essentially as follows:
|
||||
|
||||
a) power down the board and jumper JP10 to select the functional image.
|
||||
b) power on the board and let it get to u-boot prompt.
|
||||
c) while on, using static precautions, move JP10 back to the failed image.
|
||||
d) use "md fff00000" to confirm you are looking at the failed image
|
||||
e) turn off write protect with "prot off all"
|
||||
f) get new image, i.e. "tftp 200000 /somepath/u-boot.bin"
|
||||
g) erase failed image: "erase FFF00000 FFF5FFFF"
|
||||
h) copy in new image: "cp.b 200000 FFF00000 60000"
|
||||
i) ensure new image is written: "md fff00000"
|
||||
k) power cycle the board and confirm new image works.
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <fdt_support.h>
|
||||
#include <asm/arch/ddr3.h>
|
||||
#include <asm/arch/psc_defs.h>
|
||||
#include <asm/arch/clock.h>
|
||||
#include <asm/ti-common/ti-aemif.h>
|
||||
#include <asm/ti-common/keystone_net.h>
|
||||
|
||||
@ -81,6 +82,9 @@ int board_eth_init(bd_t *bis)
|
||||
if (psc_enable_module(KS2_LPSC_CRYPTO))
|
||||
return -1;
|
||||
|
||||
if (cpu_is_k2e() || cpu_is_k2l())
|
||||
pll_pa_clk_sel();
|
||||
|
||||
port_num = get_num_eth_ports();
|
||||
|
||||
for (j = 0; j < port_num; j++) {
|
||||
|
||||
@ -119,7 +119,7 @@ int dram_init(void)
|
||||
.trcd_int = 6,
|
||||
.tras_lockout = 0,
|
||||
.tdal = 12,
|
||||
.bstlen = 0,
|
||||
.bstlen = 3,
|
||||
.tdll = 512,
|
||||
.trp_ab = 6,
|
||||
.tref = 3120,
|
||||
|
||||
@ -1030,8 +1030,10 @@ int fit_image_verify(const void *fit, int image_noffset)
|
||||
strlen(FIT_SIG_NODENAME))) {
|
||||
ret = fit_image_check_sig(fit, noffset, data,
|
||||
size, -1, &err_msg);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
puts("- ");
|
||||
goto error;
|
||||
}
|
||||
else
|
||||
puts("+ ");
|
||||
}
|
||||
|
||||
8
configs/d2net_v2_defconfig
Normal file
8
configs/d2net_v2_defconfig
Normal file
@ -0,0 +1,8 @@
|
||||
CONFIG_ARM=y
|
||||
CONFIG_KIRKWOOD=y
|
||||
CONFIG_TARGET_NET2BIG_V2=y
|
||||
CONFIG_SYS_EXTRA_OPTIONS="D2NET_V2"
|
||||
# CONFIG_CMD_IMLS is not set
|
||||
# CONFIG_CMD_FLASH is not set
|
||||
# CONFIG_CMD_SETEXPR is not set
|
||||
CONFIG_SPI_FLASH=y
|
||||
8
configs/inetspace_v2_defconfig
Normal file
8
configs/inetspace_v2_defconfig
Normal file
@ -0,0 +1,8 @@
|
||||
CONFIG_ARM=y
|
||||
CONFIG_KIRKWOOD=y
|
||||
CONFIG_TARGET_NETSPACE_V2=y
|
||||
CONFIG_SYS_EXTRA_OPTIONS="INETSPACE_V2"
|
||||
# CONFIG_CMD_IMLS is not set
|
||||
# CONFIG_CMD_FLASH is not set
|
||||
# CONFIG_CMD_SETEXPR is not set
|
||||
CONFIG_SPI_FLASH=y
|
||||
@ -12,15 +12,86 @@ The list should be sorted in reverse chronological order.
|
||||
|
||||
Board Arch CPU Commit Removed Last known maintainer/contact
|
||||
=================================================================================================
|
||||
stxgp3 powerpc mpc85xx - - Dan Malek <dan@embeddedalley.com>
|
||||
stxssa powerpc mpc85xx - - Dan Malek <dan@embeddedalley.com>
|
||||
cmi_mpc5xx powerpc mpc5xx - -
|
||||
zeus powerpc ppc4xx - - Stefan Roese <sr@denx.de>
|
||||
sbc405 powerpc ppc4xx - -
|
||||
pcs440ep powerpc ppc4xx - - Stefan Roese <sr@denx.de>
|
||||
p3p440 powerpc ppc4xx - - Stefan Roese <sr@denx.de>
|
||||
csb272/csb472 powerpc ppc4xx - - Tolunay Orkun <torkun@nextio.com>
|
||||
alpr powerpc ppc4xx - - Stefan Roese <sr@denx.de>
|
||||
lcd4_lwmon5 powerpc ppc4xx b6b5e394 2015-10-02 Stefan Roese <sr@denx.de>
|
||||
da830evm arm arm926ejs d7e8b2b9 2015-09-12 Nick Thompson <nick.thompson@gefanuc.com>
|
||||
wireless_space arm arm926ejs b352182a 2015-09-12 Albert ARIBAUD <albert.u.boot@aribaud.net>
|
||||
stxgp3 powerpc mpc85xx 2ec69b88 2015-09-02 Dan Malek <dan@embeddedalley.com>
|
||||
stxssa powerpc mpc85xx 2ec69b88 2015-09-02 Dan Malek <dan@embeddedalley.com>
|
||||
cmi_mpc5xx powerpc mpc5xx 972f5320 2015-09-02
|
||||
zeus powerpc ppc4xx eb5d1dc7 2015-09-02 Stefan Roese <sr@denx.de>
|
||||
sbc405 powerpc ppc4xx 0e030593 2015-09-02
|
||||
pcs440ep powerpc ppc4xx 242836a8 2015-09-02 Stefan Roese <sr@denx.de>
|
||||
p3p440 powerpc ppc4xx c6999e5f 2015-09-02 Stefan Roese <sr@denx.de>
|
||||
csb272/csb472 powerpc ppc4xx 54a3f260 2015-09-02 Tolunay Orkun <torkun@nextio.com>
|
||||
alpr powerpc ppc4xx 0d2fc811 2015-09-02 Stefan Roese <sr@denx.de>
|
||||
balloon3 arm pxa 679d4456 2015-08-30 Marek Vasut <marex@denx.de>
|
||||
cpu9260_128M arm arm926ejs af7f884b 2015-08-30 Eric Benard <eric@eukrea.com>
|
||||
cpu9260 arm arm926ejs af7f884b 2015-08-30 Eric Benard <eric@eukrea.com>
|
||||
cpu9260_nand_128M arm arm926ejs af7f884b 2015-08-30 Eric Benard <eric@eukrea.com>
|
||||
cpu9260_nand arm arm926ejs af7f884b 2015-08-30 Eric Benard <eric@eukrea.com>
|
||||
cpu9G20_128M arm arm926ejs af7f884b 2015-08-30 Eric Benard <eric@eukrea.com>
|
||||
cpu9G20 arm arm926ejs af7f884b 2015-08-30 Eric Benard <eric@eukrea.com>
|
||||
cpuat91 arm arm920t af7f884b 2015-08-30 Eric Benard <eric@eukrea.com>
|
||||
cpuat91_ram arm arm920t af7f884b 2015-08-30 Eric Benard <eric@eukrea.com>
|
||||
davinci_dm355evm arm arm926ejs 6761946f 2015-08-30
|
||||
davinci_dm355leopard arm arm926ejs 6761946f 2015-08-30
|
||||
davinci_dm365evm arm arm926ejs 6761946f 2015-08-30
|
||||
davinci_dm6467evm arm arm926ejs 6761946f 2015-08-30
|
||||
davinci_dm6467Tevm arm arm926ejs 6761946f 2015-08-30
|
||||
davinci_dvevm arm arm926ejs 6761946f 2015-08-30
|
||||
davinci_schmoogie arm arm926ejs 6761946f 2015-08-30
|
||||
davinci_sffsdr arm arm926ejs 6761946f 2015-08-30
|
||||
davinci_sonata arm arm926ejs 6761946f 2015-08-30
|
||||
dig297 arm armv7 5ff33d04 2015-08-30 Luca Ceresoli <luca.ceresoli@comelit.it>
|
||||
ea20 arm arm926ejs 6761946f 2015-08-30
|
||||
eb_cpux9k2 arm arm920t 5522f12b 2015-08-30 Jens Scharsig <esw@bus-elektronik.de>
|
||||
eb_cpux9k2_ram arm arm920t 5522f12b 2015-08-30 Jens Scharsig <esw@bus-elektronik.de>
|
||||
enbw_cmc arm arm926ejs a6f7f787 2015-08-30 Heiko Schocher <hs@denx.de>
|
||||
ima3-mx53 arm armv7 3eb8f58d 2015-08-30
|
||||
imx27lite arm arm926ejs bc0840bc 2015-08-30 Wolfgang Denk <wd@denx.de>
|
||||
imx31_litekit arm arm1136 36d14178 2015-08-30
|
||||
jornada arm sa1100 df0b116d 2015-08-30 Kristoffer Ericson <kristoffer.ericson@gmail.com>
|
||||
lp8x4x arm pxa 9f840b8d 2015-08-30 Sergey Yanovich <ynvich@gmail.com>
|
||||
magnesium arm arm926ejs bc0840bc 2015-08-30 Heiko Schocher <hs@denx.de>
|
||||
mv88f6281gtw_ge arm arm926ejs 7cd768cf 2015-08-30 Prafulla Wadaskar <prafulla@marvell.com>
|
||||
mx51_efikamx arm armv7 b6073fd2 2015-08-30
|
||||
mx51_efikasb arm armv7 b6073fd2 2015-08-30
|
||||
nhk8815 arm arm926ejs 0abdd9d0 2015-08-30 Nomadik Linux Team <STN_WMM_nomadik_linux@list.st.com>
|
||||
nhk8815_onenand arm arm926ejs 0abdd9d0 2015-08-30 Nomadik Linux Team <STN_WMM_nomadik_linux@list.st.com>
|
||||
omap3_mvblx arm armv7 8dc372f9 2015-08-30 Michael Jones <michael.jones@matrix-vision.de>
|
||||
omap3_sdp3430 arm armv7 93b25c08 2015-08-30 Nishanth Menon <nm@ti.com>
|
||||
openrd_base arm arm926ejs 7a2c1b13 2015-08-30 Prafulla Wadaskar <prafulla@marvell.com>
|
||||
openrd_client arm arm926ejs 7a2c1b13 2015-08-30 Prafulla Wadaskar <prafulla@marvell.com>
|
||||
openrd_ultimate arm arm926ejs 7a2c1b13 2015-08-30 Prafulla Wadaskar <prafulla@marvell.com>
|
||||
otc570 arm arm926ejs 819216dd 2015-08-30 Daniel Gorsulowski <daniel.gorsulowski@esd.eu>
|
||||
otc570_dataflash arm arm926ejs 819216dd 2015-08-30 Daniel Gorsulowski <daniel.gorsulowski@esd.eu>
|
||||
palmld arm pxa 35782e9c 2015-08-30 Marek Vasut <marex@denx.de>
|
||||
palmtc arm pxa 8896325d 2015-08-30 Marek Vasut <marex@denx.de>
|
||||
palmtreo680 arm pxa ad4f54ea 2015-08-30 Mike Dunn <mikedunn@newsguy.com>
|
||||
polaris arm pxa f6eac00a 2015-08-30 Stefano Babic <sbabic@denx.de>
|
||||
portuxg20 arm arm926ejs 79d19734 2015-08-30 Markus Hubig <mhubig@imko.de>
|
||||
pxa255_idp arm pxa 49d8899b 2015-08-30 Marek Vasut <marex@denx.de>
|
||||
qong arm arm1136 daf77086 2015-08-30 Wolfgang Denk <wd@denx.de>
|
||||
rd6281a arm arm926ejs 47b87d2e 2015-08-30 Prafulla Wadaskar <prafulla@marvell.com>
|
||||
scb9328 arm arm920t 7650beb7 2015-08-30 Torsten Koschorrek <koschorrek@synertronixx.de>
|
||||
snowball arm armv7 7495e41b 2015-08-30 Mathieu Poirier <mathieu.poirier@linaro.org>
|
||||
stamp9g20 arm arm926ejs 79d19734 2015-08-30 Markus Hubig <mhubig@imko.de>
|
||||
tk71 arm arm926ejs f73db66d 2015-08-30
|
||||
trizepsiv arm pxa f6eac00a 2015-08-30 Stefano Babic <sbabic@denx.de>
|
||||
tt01 arm arm1136 0c81f37d 2015-08-30 Helmut Raiger <helmut.raiger@hale.at>
|
||||
tx25 arm arm926ejs b9599dd8 2015-08-30 John Rigby <jcrigby@gmail.com>
|
||||
u8500_href arm armv7 7495e41b 2015-08-30
|
||||
versatileab arm arm926ejs b928e658 2015-08-30
|
||||
versatilepb arm arm926ejs b928e658 2015-08-30
|
||||
versatileqemu arm arm926ejs b928e658 2015-08-30
|
||||
vision2 arm armv7 bee2b99d 2015-08-30 Stefano Babic <sbabic@denx.de>
|
||||
vl_ma2sc arm arm926ejs 6e830dfc 2015-08-30 Jens Scharsig <esw@bus-elektronik.de>
|
||||
vl_ma2sc_ram arm arm926ejs 6e830dfc 2015-08-30 Jens Scharsig <esw@bus-elektronik.de>
|
||||
vpac270_nor_128 arm pxa 452ef830 2015-08-30 Marek Vasut <marex@denx.de>
|
||||
vpac270_nor_256 arm pxa 452ef830 2015-08-30 Marek Vasut <marex@denx.de>
|
||||
vpac270_ond_256 arm pxa 452ef830 2015-08-30 Marek Vasut <marex@denx.de>
|
||||
xaeniax arm pxa 1c87dd76 2015-08-30
|
||||
zipitz2 arm pxa 49d8899b 2015-08-30 Cliff Brake <cliff.brake@gmail.com>
|
||||
cam_enc_4xx arm arm926ejs 8d775763 2015-08-20 Heiko Schocher <hs@denx.de>
|
||||
atstk1003 avr32 - e5354b8a 2015-06-10 Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
|
||||
atstk1004 avr32 - e5354b8a 2015-06-10 Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
|
||||
|
||||
@ -129,10 +129,10 @@ as follows:
|
||||
|
||||
BKSZ Description RAM slot Peripherals
|
||||
--------------------------------------------------------------------
|
||||
0b00 15MB RAM / 1MB Peri 00000000-0effffff 0f000000-0fffffff
|
||||
0b01 31MB RAM / 1MB Peri 00000000-1effffff 1f000000-1fffffff
|
||||
0b10 64MB RAM / 1MB Peri 00000000-3effffff 3f000000-3fffffff
|
||||
0b11 127MB RAM / 1MB Peri 00000000-7effffff 7f000000-7fffffff
|
||||
0b00 15MB RAM / 1MB Peri 00000000-00efffff 00f00000-00ffffff
|
||||
0b01 31MB RAM / 1MB Peri 00000000-01efffff 01f00000-01ffffff
|
||||
0b10 64MB RAM / 1MB Peri 00000000-03efffff 03f00000-03ffffff
|
||||
0b11 127MB RAM / 1MB Peri 00000000-07efffff 07f00000-07ffffff
|
||||
|
||||
Set BSKZ[1:0] to 0b01 for U-Boot.
|
||||
This mode is the most handy because EA[24] is always supported by the save pin
|
||||
|
||||
@ -23,16 +23,25 @@ static int dfu_read_medium_sf(struct dfu_entity *dfu, u64 offset, void *buf,
|
||||
return spi_flash_read(dfu->data.sf.dev, offset, *len, buf);
|
||||
}
|
||||
|
||||
static u64 find_sector(struct dfu_entity *dfu, u64 start, u64 offset)
|
||||
{
|
||||
return (lldiv((start + offset), dfu->data.sf.dev->sector_size)) *
|
||||
dfu->data.sf.dev->sector_size;
|
||||
}
|
||||
|
||||
static int dfu_write_medium_sf(struct dfu_entity *dfu,
|
||||
u64 offset, void *buf, long *len)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = spi_flash_erase(dfu->data.sf.dev, offset, *len);
|
||||
ret = spi_flash_erase(dfu->data.sf.dev,
|
||||
find_sector(dfu, dfu->data.sf.start, offset),
|
||||
dfu->data.sf.dev->sector_size);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = spi_flash_write(dfu->data.sf.dev, offset, *len, buf);
|
||||
ret = spi_flash_write(dfu->data.sf.dev, dfu->data.sf.start + offset,
|
||||
*len, buf);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
||||
@ -84,9 +84,9 @@ static int s5p_sdhci_core_init(struct sdhci_host *host)
|
||||
|
||||
int s5p_sdhci_init(u32 regbase, int index, int bus_width)
|
||||
{
|
||||
struct sdhci_host *host = malloc(sizeof(struct sdhci_host));
|
||||
struct sdhci_host *host = calloc(1, sizeof(struct sdhci_host));
|
||||
if (!host) {
|
||||
printf("sdhci__host malloc fail!\n");
|
||||
printf("sdhci__host allocation fail!\n");
|
||||
return 1;
|
||||
}
|
||||
host->ioaddr = (void *)regbase;
|
||||
@ -101,29 +101,31 @@ struct sdhci_host sdhci_host[SDHCI_MAX_HOSTS];
|
||||
|
||||
static int do_sdhci_init(struct sdhci_host *host)
|
||||
{
|
||||
int dev_id, flag;
|
||||
int err = 0;
|
||||
int dev_id, flag, ret;
|
||||
|
||||
flag = host->bus_width == 8 ? PINMUX_FLAG_8BIT_MODE : PINMUX_FLAG_NONE;
|
||||
dev_id = host->index + PERIPH_ID_SDMMC0;
|
||||
|
||||
if (dm_gpio_is_valid(&host->pwr_gpio)) {
|
||||
dm_gpio_set_value(&host->pwr_gpio, 1);
|
||||
err = exynos_pinmux_config(dev_id, flag);
|
||||
if (err) {
|
||||
ret = exynos_pinmux_config(dev_id, flag);
|
||||
if (ret) {
|
||||
debug("MMC not configured\n");
|
||||
return err;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (dm_gpio_is_valid(&host->cd_gpio)) {
|
||||
if (dm_gpio_get_value(&host->cd_gpio))
|
||||
ret = dm_gpio_get_value(&host->cd_gpio);
|
||||
if (ret) {
|
||||
debug("no SD card detected (%d)\n", ret);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
err = exynos_pinmux_config(dev_id, flag);
|
||||
if (err) {
|
||||
ret = exynos_pinmux_config(dev_id, flag);
|
||||
if (ret) {
|
||||
printf("external SD not configured\n");
|
||||
return err;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,7 +172,8 @@ static int sdhci_get_config(const void *blob, int node, struct sdhci_host *host)
|
||||
static int process_nodes(const void *blob, int node_list[], int count)
|
||||
{
|
||||
struct sdhci_host *host;
|
||||
int i, node;
|
||||
int i, node, ret;
|
||||
int failed = 0;
|
||||
|
||||
debug("%s: count = %d\n", __func__, count);
|
||||
|
||||
@ -182,13 +185,22 @@ static int process_nodes(const void *blob, int node_list[], int count)
|
||||
|
||||
host = &sdhci_host[i];
|
||||
|
||||
if (sdhci_get_config(blob, node, host)) {
|
||||
printf("%s: failed to decode dev %d\n", __func__, i);
|
||||
return -1;
|
||||
ret = sdhci_get_config(blob, node, host);
|
||||
if (ret) {
|
||||
printf("%s: failed to decode dev %d (%d)\n", __func__, i, ret);
|
||||
failed++;
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = do_sdhci_init(host);
|
||||
if (ret) {
|
||||
printf("%s: failed to initialize dev %d (%d)\n", __func__, i, ret);
|
||||
failed++;
|
||||
}
|
||||
do_sdhci_init(host);
|
||||
}
|
||||
return 0;
|
||||
|
||||
/* we only consider it an error when all nodes fail */
|
||||
return (failed == count ? -1 : 0);
|
||||
}
|
||||
|
||||
int exynos_mmc_init(const void *blob)
|
||||
@ -200,8 +212,6 @@ int exynos_mmc_init(const void *blob)
|
||||
COMPAT_SAMSUNG_EXYNOS_MMC, node_list,
|
||||
SDHCI_MAX_HOSTS);
|
||||
|
||||
process_nodes(blob, node_list, count);
|
||||
|
||||
return 0;
|
||||
return process_nodes(blob, node_list, count);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2009-2014 Freescale Semiconductor, Inc. and others
|
||||
* Copyright 2009-2015 Freescale Semiconductor, Inc. and others
|
||||
*
|
||||
* Description: MPC5125, VF610, MCF54418 and Kinetis K70 Nand driver.
|
||||
* Ported to U-Boot by Stefan Agner
|
||||
@ -19,9 +19,10 @@
|
||||
*
|
||||
* Limitations:
|
||||
* - Untested on MPC5125 and M54418.
|
||||
* - DMA not used.
|
||||
* - DMA and pipelining not used.
|
||||
* - 2K pages or less.
|
||||
* - Only 2K page w. 64+OOB and hardware ECC.
|
||||
* - HW ECC: Only 2K page with 64+ OOB.
|
||||
* - HW ECC: Only 24 and 32-bit error correction implemented.
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
@ -53,6 +54,7 @@
|
||||
|
||||
#define PAGE_2K 0x0800
|
||||
#define OOB_64 0x0040
|
||||
#define OOB_MAX 0x0100
|
||||
|
||||
/*
|
||||
* NFC_CMD2[CODE] values. See section:
|
||||
@ -127,32 +129,33 @@
|
||||
|
||||
#define NFC_TIMEOUT (1000)
|
||||
|
||||
/* ECC status placed at end of buffers. */
|
||||
#define ECC_SRAM_ADDR ((PAGE_2K+256-8) >> 3)
|
||||
#define ECC_STATUS_MASK 0x80
|
||||
#define ECC_ERR_COUNT 0x3F
|
||||
|
||||
/*
|
||||
* ECC status is stored at NFC_CFG[ECCADD] +4 for little-endian
|
||||
* and +7 for big-endian SOC.
|
||||
* ECC status - seems to consume 8 bytes (double word). The documented
|
||||
* status byte is located in the lowest byte of the second word (which is
|
||||
* the 4th or 7th byte depending on endianness).
|
||||
* Calculate an offset to store the ECC status at the end of the buffer.
|
||||
*/
|
||||
#ifdef CONFIG_VF610
|
||||
#define ECC_OFFSET 4
|
||||
#else
|
||||
#define ECC_OFFSET 7
|
||||
#endif
|
||||
#define ECC_SRAM_ADDR (PAGE_2K + OOB_MAX - 8)
|
||||
|
||||
#define ECC_STATUS 0x4
|
||||
#define ECC_STATUS_MASK 0x80
|
||||
#define ECC_STATUS_ERR_COUNT 0x3F
|
||||
|
||||
enum vf610_nfc_alt_buf {
|
||||
ALT_BUF_DATA = 0,
|
||||
ALT_BUF_ID = 1,
|
||||
ALT_BUF_STAT = 2,
|
||||
ALT_BUF_ONFI = 3,
|
||||
};
|
||||
|
||||
struct vf610_nfc {
|
||||
struct mtd_info *mtd;
|
||||
struct nand_chip chip;
|
||||
void __iomem *regs;
|
||||
uint column;
|
||||
struct mtd_info *mtd;
|
||||
struct nand_chip chip;
|
||||
void __iomem *regs;
|
||||
uint buf_offset;
|
||||
int write_sz;
|
||||
/* Status and ID are in alternate locations. */
|
||||
int alt_buf;
|
||||
#define ALT_BUF_ID 1
|
||||
#define ALT_BUF_STAT 2
|
||||
#define ALT_BUF_ONFI 3
|
||||
struct clk *clk;
|
||||
enum vf610_nfc_alt_buf alt_buf;
|
||||
};
|
||||
|
||||
#define mtd_to_nfc(_mtd) \
|
||||
@ -170,8 +173,8 @@ static struct nand_ecclayout vf610_nfc_ecc = {
|
||||
48, 49, 50, 51, 52, 53, 54, 55,
|
||||
56, 57, 58, 59, 60, 61, 62, 63},
|
||||
.oobfree = {
|
||||
{.offset = 8,
|
||||
.length = 11} }
|
||||
{.offset = 2,
|
||||
.length = 17} }
|
||||
};
|
||||
#elif defined(CONFIG_SYS_NAND_VF610_NFC_60_ECC_BYTES)
|
||||
#define ECC_HW_MODE ECC_60_BYTE
|
||||
@ -226,8 +229,12 @@ static inline void vf610_nfc_set_field(struct mtd_info *mtd, u32 reg,
|
||||
static inline void vf610_nfc_memcpy(void *dst, const void *src, size_t n)
|
||||
{
|
||||
/*
|
||||
* Use this accessor for the interal SRAM buffers. On ARM we can
|
||||
* treat the SRAM buffer as if its memory, hence use memcpy
|
||||
* Use this accessor for the internal SRAM buffers. On the ARM
|
||||
* Freescale Vybrid SoC it's known that the driver can treat
|
||||
* the SRAM buffer as if it's memory. Other platform might need
|
||||
* to treat the buffers differently.
|
||||
*
|
||||
* For the time being, use memcpy
|
||||
*/
|
||||
memcpy(dst, src, n);
|
||||
}
|
||||
@ -242,7 +249,7 @@ static inline void vf610_nfc_clear_status(void __iomem *regbase)
|
||||
}
|
||||
|
||||
/* Wait for complete operation */
|
||||
static inline void vf610_nfc_done(struct mtd_info *mtd)
|
||||
static void vf610_nfc_done(struct mtd_info *mtd)
|
||||
{
|
||||
struct vf610_nfc *nfc = mtd_to_nfc(mtd);
|
||||
uint start;
|
||||
@ -260,7 +267,7 @@ static inline void vf610_nfc_done(struct mtd_info *mtd)
|
||||
|
||||
while (!(vf610_nfc_read(mtd, NFC_IRQ_STATUS) & IDLE_IRQ_BIT)) {
|
||||
if (get_timer(start) > NFC_TIMEOUT) {
|
||||
printf("Timeout while waiting for !BUSY.\n");
|
||||
printf("Timeout while waiting for IDLE.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -273,11 +280,13 @@ static u8 vf610_nfc_get_id(struct mtd_info *mtd, int col)
|
||||
|
||||
if (col < 4) {
|
||||
flash_id = vf610_nfc_read(mtd, NFC_FLASH_STATUS1);
|
||||
return (flash_id >> (3-col)*8) & 0xff;
|
||||
flash_id >>= (3 - col) * 8;
|
||||
} else {
|
||||
flash_id = vf610_nfc_read(mtd, NFC_FLASH_STATUS2);
|
||||
return flash_id >> 24;
|
||||
flash_id >>= 24;
|
||||
}
|
||||
|
||||
return flash_id & 0xff;
|
||||
}
|
||||
|
||||
static u8 vf610_nfc_get_status(struct mtd_info *mtd)
|
||||
@ -345,26 +354,28 @@ static void vf610_nfc_command(struct mtd_info *mtd, unsigned command,
|
||||
int column, int page)
|
||||
{
|
||||
struct vf610_nfc *nfc = mtd_to_nfc(mtd);
|
||||
int page_sz = nfc->chip.options & NAND_BUSWIDTH_16 ? 1 : 0;
|
||||
int trfr_sz = nfc->chip.options & NAND_BUSWIDTH_16 ? 1 : 0;
|
||||
|
||||
nfc->column = max(column, 0);
|
||||
nfc->alt_buf = 0;
|
||||
nfc->buf_offset = max(column, 0);
|
||||
nfc->alt_buf = ALT_BUF_DATA;
|
||||
|
||||
switch (command) {
|
||||
case NAND_CMD_SEQIN:
|
||||
/* Use valid column/page from preread... */
|
||||
vf610_nfc_addr_cycle(mtd, column, page);
|
||||
nfc->buf_offset = 0;
|
||||
|
||||
/*
|
||||
* SEQIN => data => PAGEPROG sequence is done by the controller
|
||||
* hence we do not need to issue the command here...
|
||||
*/
|
||||
return;
|
||||
case NAND_CMD_PAGEPROG:
|
||||
page_sz += mtd->writesize + mtd->oobsize;
|
||||
vf610_nfc_transfer_size(nfc->regs, page_sz);
|
||||
trfr_sz += nfc->write_sz;
|
||||
vf610_nfc_ecc_mode(mtd, ECC_HW_MODE);
|
||||
vf610_nfc_transfer_size(nfc->regs, trfr_sz);
|
||||
vf610_nfc_send_commands(nfc->regs, NAND_CMD_SEQIN,
|
||||
command, PROGRAM_PAGE_CMD_CODE);
|
||||
vf610_nfc_ecc_mode(mtd, ECC_HW_MODE);
|
||||
break;
|
||||
|
||||
case NAND_CMD_RESET:
|
||||
@ -373,9 +384,9 @@ static void vf610_nfc_command(struct mtd_info *mtd, unsigned command,
|
||||
break;
|
||||
|
||||
case NAND_CMD_READOOB:
|
||||
page_sz += mtd->oobsize;
|
||||
trfr_sz += mtd->oobsize;
|
||||
column = mtd->writesize;
|
||||
vf610_nfc_transfer_size(nfc->regs, page_sz);
|
||||
vf610_nfc_transfer_size(nfc->regs, trfr_sz);
|
||||
vf610_nfc_send_commands(nfc->regs, NAND_CMD_READ0,
|
||||
NAND_CMD_READSTART, READ_PAGE_CMD_CODE);
|
||||
vf610_nfc_addr_cycle(mtd, column, page);
|
||||
@ -383,18 +394,18 @@ static void vf610_nfc_command(struct mtd_info *mtd, unsigned command,
|
||||
break;
|
||||
|
||||
case NAND_CMD_READ0:
|
||||
page_sz += mtd->writesize + mtd->oobsize;
|
||||
column = 0;
|
||||
vf610_nfc_transfer_size(nfc->regs, page_sz);
|
||||
trfr_sz += mtd->writesize + mtd->oobsize;
|
||||
vf610_nfc_transfer_size(nfc->regs, trfr_sz);
|
||||
vf610_nfc_ecc_mode(mtd, ECC_HW_MODE);
|
||||
vf610_nfc_send_commands(nfc->regs, NAND_CMD_READ0,
|
||||
NAND_CMD_READSTART, READ_PAGE_CMD_CODE);
|
||||
vf610_nfc_addr_cycle(mtd, column, page);
|
||||
vf610_nfc_ecc_mode(mtd, ECC_HW_MODE);
|
||||
break;
|
||||
|
||||
case NAND_CMD_PARAM:
|
||||
nfc->alt_buf = ALT_BUF_ONFI;
|
||||
vf610_nfc_transfer_size(nfc->regs, 768);
|
||||
trfr_sz = 3 * sizeof(struct nand_onfi_params);
|
||||
vf610_nfc_transfer_size(nfc->regs, trfr_sz);
|
||||
vf610_nfc_send_command(nfc->regs, NAND_CMD_PARAM,
|
||||
READ_ONFI_PARAM_CMD_CODE);
|
||||
vf610_nfc_set_field(mtd, NFC_ROW_ADDR, ROW_ADDR_MASK,
|
||||
@ -411,7 +422,7 @@ static void vf610_nfc_command(struct mtd_info *mtd, unsigned command,
|
||||
|
||||
case NAND_CMD_READID:
|
||||
nfc->alt_buf = ALT_BUF_ID;
|
||||
nfc->column = 0;
|
||||
nfc->buf_offset = 0;
|
||||
vf610_nfc_transfer_size(nfc->regs, 0);
|
||||
vf610_nfc_send_command(nfc->regs, command, READ_ID_CMD_CODE);
|
||||
vf610_nfc_set_field(mtd, NFC_ROW_ADDR, ROW_ADDR_MASK,
|
||||
@ -421,21 +432,22 @@ static void vf610_nfc_command(struct mtd_info *mtd, unsigned command,
|
||||
case NAND_CMD_STATUS:
|
||||
nfc->alt_buf = ALT_BUF_STAT;
|
||||
vf610_nfc_transfer_size(nfc->regs, 0);
|
||||
vf610_nfc_send_command(nfc->regs, command,
|
||||
STATUS_READ_CMD_CODE);
|
||||
vf610_nfc_send_command(nfc->regs, command, STATUS_READ_CMD_CODE);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
vf610_nfc_done(mtd);
|
||||
|
||||
nfc->write_sz = 0;
|
||||
}
|
||||
|
||||
/* Read data from NFC buffers */
|
||||
static void vf610_nfc_read_buf(struct mtd_info *mtd, u_char *buf, int len)
|
||||
{
|
||||
struct vf610_nfc *nfc = mtd_to_nfc(mtd);
|
||||
uint c = nfc->column;
|
||||
uint c = nfc->buf_offset;
|
||||
|
||||
/* Alternate buffers are only supported through read_byte */
|
||||
if (nfc->alt_buf)
|
||||
@ -443,28 +455,30 @@ static void vf610_nfc_read_buf(struct mtd_info *mtd, u_char *buf, int len)
|
||||
|
||||
vf610_nfc_memcpy(buf, nfc->regs + NFC_MAIN_AREA(0) + c, len);
|
||||
|
||||
nfc->column += len;
|
||||
nfc->buf_offset += len;
|
||||
}
|
||||
|
||||
/* Write data to NFC buffers */
|
||||
static void vf610_nfc_write_buf(struct mtd_info *mtd, const u_char *buf,
|
||||
static void vf610_nfc_write_buf(struct mtd_info *mtd, const uint8_t *buf,
|
||||
int len)
|
||||
{
|
||||
struct vf610_nfc *nfc = mtd_to_nfc(mtd);
|
||||
uint c = nfc->column;
|
||||
uint c = nfc->buf_offset;
|
||||
uint l;
|
||||
|
||||
l = min((uint)len, mtd->writesize + mtd->oobsize - c);
|
||||
nfc->column += l;
|
||||
l = min_t(uint, len, mtd->writesize + mtd->oobsize - c);
|
||||
vf610_nfc_memcpy(nfc->regs + NFC_MAIN_AREA(0) + c, buf, l);
|
||||
|
||||
nfc->write_sz += l;
|
||||
nfc->buf_offset += l;
|
||||
}
|
||||
|
||||
/* Read byte from NFC buffers */
|
||||
static u8 vf610_nfc_read_byte(struct mtd_info *mtd)
|
||||
static uint8_t vf610_nfc_read_byte(struct mtd_info *mtd)
|
||||
{
|
||||
struct vf610_nfc *nfc = mtd_to_nfc(mtd);
|
||||
u8 tmp;
|
||||
uint c = nfc->column;
|
||||
uint c = nfc->buf_offset;
|
||||
|
||||
switch (nfc->alt_buf) {
|
||||
case ALT_BUF_ID:
|
||||
@ -473,18 +487,17 @@ static u8 vf610_nfc_read_byte(struct mtd_info *mtd)
|
||||
case ALT_BUF_STAT:
|
||||
tmp = vf610_nfc_get_status(mtd);
|
||||
break;
|
||||
case ALT_BUF_ONFI:
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
case ALT_BUF_ONFI:
|
||||
/* Reverse byte since the controller uses big endianness */
|
||||
c = nfc->column ^ 0x3;
|
||||
tmp = *((u8 *)(nfc->regs + NFC_MAIN_AREA(0) + c));
|
||||
break;
|
||||
c = nfc->buf_offset ^ 0x3;
|
||||
/* fall-through */
|
||||
#endif
|
||||
default:
|
||||
tmp = *((u8 *)(nfc->regs + NFC_MAIN_AREA(0) + c));
|
||||
break;
|
||||
}
|
||||
nfc->column++;
|
||||
nfc->buf_offset++;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@ -492,6 +505,7 @@ static u8 vf610_nfc_read_byte(struct mtd_info *mtd)
|
||||
static u16 vf610_nfc_read_word(struct mtd_info *mtd)
|
||||
{
|
||||
u16 tmp;
|
||||
|
||||
vf610_nfc_read_buf(mtd, (u_char *)&tmp, sizeof(tmp));
|
||||
return tmp;
|
||||
}
|
||||
@ -511,12 +525,11 @@ static void vf610_nfc_select_chip(struct mtd_info *mtd, int chip)
|
||||
#ifdef CONFIG_VF610
|
||||
u32 tmp = vf610_nfc_read(mtd, NFC_ROW_ADDR);
|
||||
tmp &= ~(ROW_ADDR_CHIP_SEL_RB_MASK | ROW_ADDR_CHIP_SEL_MASK);
|
||||
tmp |= 1 << ROW_ADDR_CHIP_SEL_RB_SHIFT;
|
||||
|
||||
if (chip == 0)
|
||||
tmp |= 1 << ROW_ADDR_CHIP_SEL_SHIFT;
|
||||
else if (chip == 1)
|
||||
tmp |= 2 << ROW_ADDR_CHIP_SEL_SHIFT;
|
||||
if (chip >= 0) {
|
||||
tmp |= 1 << ROW_ADDR_CHIP_SEL_RB_SHIFT;
|
||||
tmp |= (1 << chip) << ROW_ADDR_CHIP_SEL_SHIFT;
|
||||
}
|
||||
|
||||
vf610_nfc_write(mtd, NFC_ROW_ADDR, tmp);
|
||||
#endif
|
||||
@ -537,52 +550,61 @@ static inline int count_written_bits(uint8_t *buff, int size, int max_bits)
|
||||
return written_bits;
|
||||
}
|
||||
|
||||
static inline int vf610_nfc_correct_data(struct mtd_info *mtd, u_char *dat)
|
||||
static inline int vf610_nfc_correct_data(struct mtd_info *mtd, uint8_t *dat,
|
||||
uint8_t *oob, int page)
|
||||
{
|
||||
struct vf610_nfc *nfc = mtd_to_nfc(mtd);
|
||||
u32 ecc_status_off = NFC_MAIN_AREA(0) + ECC_SRAM_ADDR + ECC_STATUS;
|
||||
u8 ecc_status;
|
||||
u8 ecc_count;
|
||||
int flip;
|
||||
int flips;
|
||||
int flips_threshold = nfc->chip.ecc.strength / 2;
|
||||
|
||||
ecc_status = vf610_nfc_read(mtd, ecc_status_off) & 0xff;
|
||||
ecc_count = ecc_status & ECC_STATUS_ERR_COUNT;
|
||||
|
||||
ecc_status = __raw_readb(nfc->regs + ECC_SRAM_ADDR * 8 + ECC_OFFSET);
|
||||
ecc_count = ecc_status & ECC_ERR_COUNT;
|
||||
if (!(ecc_status & ECC_STATUS_MASK))
|
||||
return ecc_count;
|
||||
|
||||
/* If 'ecc_count' zero or less then buffer is all 0xff or erased. */
|
||||
flip = count_written_bits(dat, nfc->chip.ecc.size, ecc_count);
|
||||
/* Read OOB without ECC unit enabled */
|
||||
vf610_nfc_command(mtd, NAND_CMD_READOOB, 0, page);
|
||||
vf610_nfc_read_buf(mtd, oob, mtd->oobsize);
|
||||
|
||||
/* ECC failed. */
|
||||
if (flip > ecc_count && flip > (nfc->chip.ecc.strength / 2))
|
||||
return -1;
|
||||
/*
|
||||
* On an erased page, bit count (including OOB) should be zero or
|
||||
* at least less then half of the ECC strength.
|
||||
*/
|
||||
flips = count_written_bits(dat, nfc->chip.ecc.size, flips_threshold);
|
||||
flips += count_written_bits(oob, mtd->oobsize, flips_threshold);
|
||||
|
||||
if (unlikely(flips > flips_threshold))
|
||||
return -EINVAL;
|
||||
|
||||
/* Erased page. */
|
||||
memset(dat, 0xff, nfc->chip.ecc.size);
|
||||
return 0;
|
||||
memset(oob, 0xff, mtd->oobsize);
|
||||
return flips;
|
||||
}
|
||||
|
||||
|
||||
static int vf610_nfc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
uint8_t *buf, int oob_required, int page)
|
||||
{
|
||||
int eccsize = chip->ecc.size;
|
||||
int stat;
|
||||
uint8_t *p = buf;
|
||||
|
||||
|
||||
vf610_nfc_read_buf(mtd, p, eccsize);
|
||||
|
||||
vf610_nfc_read_buf(mtd, buf, eccsize);
|
||||
if (oob_required)
|
||||
vf610_nfc_read_buf(mtd, chip->oob_poi, mtd->oobsize);
|
||||
|
||||
stat = vf610_nfc_correct_data(mtd, p);
|
||||
stat = vf610_nfc_correct_data(mtd, buf, chip->oob_poi, page);
|
||||
|
||||
if (stat < 0)
|
||||
if (stat < 0) {
|
||||
mtd->ecc_stats.failed++;
|
||||
else
|
||||
return 0;
|
||||
} else {
|
||||
mtd->ecc_stats.corrected += stat;
|
||||
|
||||
return 0;
|
||||
return stat;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -591,10 +613,15 @@ static int vf610_nfc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
static int vf610_nfc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
const uint8_t *buf, int oob_required)
|
||||
{
|
||||
struct vf610_nfc *nfc = mtd_to_nfc(mtd);
|
||||
|
||||
vf610_nfc_write_buf(mtd, buf, mtd->writesize);
|
||||
if (oob_required)
|
||||
vf610_nfc_write_buf(mtd, chip->oob_poi, mtd->oobsize);
|
||||
|
||||
/* Always write whole page including OOB due to HW ECC */
|
||||
nfc->write_sz = mtd->writesize + mtd->oobsize;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -635,12 +662,6 @@ static int vf610_nfc_nand_init(int devnum, void __iomem *addr)
|
||||
if (cfg.width == 16)
|
||||
chip->options |= NAND_BUSWIDTH_16;
|
||||
|
||||
/* Use 8-bit mode during initialization */
|
||||
vf610_nfc_clear(mtd, NFC_FLASH_CONFIG, CONFIG_16BIT);
|
||||
|
||||
/* Disable subpage writes as we do not provide ecc->hwctl */
|
||||
chip->options |= NAND_NO_SUBPAGE_WRITE;
|
||||
|
||||
chip->dev_ready = vf610_nfc_dev_ready;
|
||||
chip->cmdfunc = vf610_nfc_command;
|
||||
chip->read_byte = vf610_nfc_read_byte;
|
||||
@ -649,30 +670,22 @@ static int vf610_nfc_nand_init(int devnum, void __iomem *addr)
|
||||
chip->write_buf = vf610_nfc_write_buf;
|
||||
chip->select_chip = vf610_nfc_select_chip;
|
||||
|
||||
/* Bad block options. */
|
||||
if (cfg.flash_bbt)
|
||||
chip->bbt_options = NAND_BBT_USE_FLASH | NAND_BBT_NO_OOB |
|
||||
NAND_BBT_CREATE;
|
||||
chip->options |= NAND_NO_SUBPAGE_WRITE;
|
||||
|
||||
chip->ecc.size = PAGE_2K;
|
||||
|
||||
/* Set configuration register. */
|
||||
vf610_nfc_clear(mtd, NFC_FLASH_CONFIG, CONFIG_16BIT);
|
||||
vf610_nfc_clear(mtd, NFC_FLASH_CONFIG, CONFIG_ADDR_AUTO_INCR_BIT);
|
||||
vf610_nfc_clear(mtd, NFC_FLASH_CONFIG, CONFIG_BUFNO_AUTO_INCR_BIT);
|
||||
vf610_nfc_clear(mtd, NFC_FLASH_CONFIG, CONFIG_BOOT_MODE_BIT);
|
||||
vf610_nfc_clear(mtd, NFC_FLASH_CONFIG, CONFIG_DMA_REQ_BIT);
|
||||
vf610_nfc_set(mtd, NFC_FLASH_CONFIG, CONFIG_FAST_FLASH_BIT);
|
||||
|
||||
/* Enable Idle IRQ */
|
||||
vf610_nfc_set(mtd, NFC_IRQ_STATUS, IDLE_EN_BIT);
|
||||
|
||||
/* PAGE_CNT = 1 */
|
||||
/* Disable virtual pages, only one elementary transfer unit */
|
||||
vf610_nfc_set_field(mtd, NFC_FLASH_CONFIG, CONFIG_PAGE_CNT_MASK,
|
||||
CONFIG_PAGE_CNT_SHIFT, 1);
|
||||
|
||||
/* Set ECC_STATUS offset */
|
||||
vf610_nfc_set_field(mtd, NFC_FLASH_CONFIG,
|
||||
CONFIG_ECC_SRAM_ADDR_MASK,
|
||||
CONFIG_ECC_SRAM_ADDR_SHIFT, ECC_SRAM_ADDR);
|
||||
|
||||
/* first scan to find the device and get the page size */
|
||||
if (nand_scan_ident(mtd, CONFIG_SYS_MAX_NAND_DEVICE, NULL)) {
|
||||
err = -ENXIO;
|
||||
@ -682,11 +695,14 @@ static int vf610_nfc_nand_init(int devnum, void __iomem *addr)
|
||||
if (cfg.width == 16)
|
||||
vf610_nfc_set(mtd, NFC_FLASH_CONFIG, CONFIG_16BIT);
|
||||
|
||||
chip->ecc.mode = NAND_ECC_SOFT; /* default */
|
||||
/* Bad block options. */
|
||||
if (cfg.flash_bbt)
|
||||
chip->bbt_options = NAND_BBT_USE_FLASH | NAND_BBT_NO_OOB |
|
||||
NAND_BBT_CREATE;
|
||||
|
||||
/* Single buffer only, max 256 OOB minus ECC status */
|
||||
if (mtd->writesize + mtd->oobsize > PAGE_2K + 256 - 8) {
|
||||
dev_err(nfc->dev, "Unsupported flash size\n");
|
||||
if (mtd->writesize + mtd->oobsize > PAGE_2K + OOB_MAX - 8) {
|
||||
dev_err(nfc->dev, "Unsupported flash page size\n");
|
||||
err = -ENXIO;
|
||||
goto error;
|
||||
}
|
||||
@ -698,6 +714,13 @@ static int vf610_nfc_nand_init(int devnum, void __iomem *addr)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (chip->ecc.size != mtd->writesize) {
|
||||
dev_err(nfc->dev, "ecc size: %d\n", chip->ecc.size);
|
||||
dev_err(nfc->dev, "Step size needs to be page size\n");
|
||||
err = -ENXIO;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Current HW ECC layouts only use 64 bytes of OOB */
|
||||
if (mtd->oobsize > 64)
|
||||
mtd->oobsize = 64;
|
||||
@ -718,7 +741,13 @@ static int vf610_nfc_nand_init(int devnum, void __iomem *addr)
|
||||
chip->ecc.bytes = 60;
|
||||
#endif
|
||||
|
||||
/* Enable ECC_STATUS */
|
||||
/* Set ECC_STATUS offset */
|
||||
vf610_nfc_set_field(mtd, NFC_FLASH_CONFIG,
|
||||
CONFIG_ECC_SRAM_ADDR_MASK,
|
||||
CONFIG_ECC_SRAM_ADDR_SHIFT,
|
||||
ECC_SRAM_ADDR >> 3);
|
||||
|
||||
/* Enable ECC status in SRAM */
|
||||
vf610_nfc_set(mtd, NFC_FLASH_CONFIG, CONFIG_ECC_SRAM_REQ_BIT);
|
||||
}
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
#include <asm/io.h>
|
||||
#include <linux/sizes.h>
|
||||
#include <errno.h>
|
||||
#include <asm/arch/sys_proto.h>
|
||||
|
||||
#define PCI_ACCESS_READ 0
|
||||
#define PCI_ACCESS_WRITE 1
|
||||
@ -430,6 +431,10 @@ static int imx_pcie_write_config(struct pci_controller *hose, pci_dev_t d,
|
||||
static int imx6_pcie_assert_core_reset(void)
|
||||
{
|
||||
struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
|
||||
|
||||
if (is_mx6dqp())
|
||||
setbits_le32(&iomuxc_regs->gpr[1], IOMUXC_GPR1_PCIE_SW_RST);
|
||||
|
||||
#if defined(CONFIG_MX6SX)
|
||||
struct gpc *gpc_regs = (struct gpc *)GPC_BASE_ADDR;
|
||||
|
||||
@ -536,6 +541,9 @@ static int imx6_pcie_deassert_core_reset(void)
|
||||
|
||||
enable_pcie_clock();
|
||||
|
||||
if (is_mx6dqp())
|
||||
clrbits_le32(&iomuxc_regs->gpr[1], IOMUXC_GPR1_PCIE_SW_RST);
|
||||
|
||||
/*
|
||||
* Wait for the clock to settle a bit, when the clock are sourced
|
||||
* from the CPU, we need about 30 ms to settle.
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
obj-$(CONFIG_AT91SAM9_WATCHDOG) += at91sam9_wdt.o
|
||||
obj-$(CONFIG_FTWDT010_WATCHDOG) += ftwdt010_wdt.o
|
||||
ifneq (,$(filter $(SOC), mx31 mx35 mx5 mx6 mx7 vf610 ls102xa))
|
||||
ifneq (,$(filter $(SOC), mx31 mx35 mx5 mx6 mx7 vf610))
|
||||
obj-y += imx_watchdog.o
|
||||
endif
|
||||
obj-$(CONFIG_S5P) += s5p_wdt.o
|
||||
|
||||
@ -8,19 +8,7 @@
|
||||
#include <asm/io.h>
|
||||
#include <watchdog.h>
|
||||
#include <asm/arch/imx-regs.h>
|
||||
|
||||
struct watchdog_regs {
|
||||
u16 wcr; /* Control */
|
||||
u16 wsr; /* Service */
|
||||
u16 wrsr; /* Reset Status */
|
||||
};
|
||||
|
||||
#define WCR_WDZST 0x01
|
||||
#define WCR_WDBG 0x02
|
||||
#define WCR_WDE 0x04 /* WDOG enable */
|
||||
#define WCR_WDT 0x08
|
||||
#define WCR_SRS 0x10
|
||||
#define SET_WCR_WT(x) (x << 8)
|
||||
#include <fsl_wdog.h>
|
||||
|
||||
#ifdef CONFIG_IMX_WATCHDOG
|
||||
void hw_watchdog_reset(void)
|
||||
|
||||
@ -57,8 +57,8 @@
|
||||
* it has to be rounded to sector size
|
||||
*/
|
||||
#define CONFIG_ENV_SIZE 0x20000 /* 128k */
|
||||
#define CONFIG_ENV_ADDR 0x60000
|
||||
#define CONFIG_ENV_OFFSET 0x60000 /* env starts here */
|
||||
#define CONFIG_ENV_ADDR 0x80000
|
||||
#define CONFIG_ENV_OFFSET 0x80000 /* env starts here */
|
||||
|
||||
/*
|
||||
* Default environment variables
|
||||
|
||||
@ -108,11 +108,13 @@
|
||||
* 2. ROOT: -
|
||||
*/
|
||||
#define CONFIG_EXTRA_ENV_SETTINGS \
|
||||
"loadkernel=fatload mmc ${mmcbootdev}:${mmcbootpart} ${kerneladdr} " \
|
||||
"loadbootscript=load mmc ${mmcbootdev}:${mmcbootpart} ${scriptaddr} " \
|
||||
"boot.scr\0" \
|
||||
"loadkernel=load mmc ${mmcbootdev}:${mmcbootpart} ${kerneladdr} " \
|
||||
"${kernelname}\0" \
|
||||
"loadinitrd=fatload mmc ${mmcbootdev}:${mmcbootpart} ${initrdaddr} " \
|
||||
"loadinitrd=load mmc ${mmcbootdev}:${mmcbootpart} ${initrdaddr} " \
|
||||
"${initrdname}\0" \
|
||||
"loaddtb=fatload mmc ${mmcbootdev}:${mmcbootpart} ${fdtaddr} " \
|
||||
"loaddtb=load mmc ${mmcbootdev}:${mmcbootpart} ${fdtaddr} " \
|
||||
"${fdtfile}\0" \
|
||||
"check_ramdisk=" \
|
||||
"if run loadinitrd; then " \
|
||||
@ -129,6 +131,9 @@
|
||||
"kernel_args=" \
|
||||
"setenv bootargs root=/dev/mmcblk${mmcrootdev}p${mmcrootpart}" \
|
||||
" rootwait ${console} ${opts}\0" \
|
||||
"boot_script=" \
|
||||
"run loadbootscript;" \
|
||||
"source ${scriptaddr}\0" \
|
||||
"boot_fit=" \
|
||||
"setenv kerneladdr 0x42000000;" \
|
||||
"setenv kernelname Image.itb;" \
|
||||
@ -152,7 +157,9 @@
|
||||
"run kernel_args;" \
|
||||
"bootz ${kerneladdr} ${initrd_addr} ${fdt_addr};\0" \
|
||||
"autoboot=" \
|
||||
"if test -e mmc 0 Image.itb; then; " \
|
||||
"if test -e mmc 0 boot.scr; then; " \
|
||||
"run boot_script; " \
|
||||
"elif test -e mmc 0 Image.itb; then; " \
|
||||
"run boot_fit;" \
|
||||
"elif test -e mmc 0 zImage; then; " \
|
||||
"run boot_zimg;" \
|
||||
@ -171,6 +178,7 @@
|
||||
"consoleoff=set console console=ram; save; reset\0" \
|
||||
"initrdname=uInitrd\0" \
|
||||
"initrdaddr=42000000\0" \
|
||||
"scriptaddr=0x42000000\0" \
|
||||
"fdtaddr=40800000\0"
|
||||
|
||||
/* I2C */
|
||||
|
||||
@ -160,12 +160,20 @@
|
||||
#define CONFIG_SYS_NAND_PAGE_SIZE 2048
|
||||
#define CONFIG_SYS_NAND_OOBSIZE 64
|
||||
#define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024)
|
||||
#define CONFIG_SYS_NAND_BAD_BLOCK_POS 0
|
||||
#define CONFIG_SYS_NAND_ECCPOS {2, 3, 4, 5, 6, 7, 8, 9,\
|
||||
10, 11, 12, 13}
|
||||
#define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS
|
||||
#define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \
|
||||
10, 11, 12, 13, 14, 15, 16, 17, \
|
||||
18, 19, 20, 21, 22, 23, 24, 25, \
|
||||
26, 27, 28, 29, 30, 31, 32, 33, \
|
||||
34, 35, 36, 37, 38, 39, 40, 41, \
|
||||
42, 43, 44, 45, 46, 47, 48, 49, \
|
||||
50, 51, 52, 53, 54, 55, 56, 57, }
|
||||
#define CONFIG_SYS_NAND_ECCSIZE 512
|
||||
#define CONFIG_SYS_NAND_ECCBYTES 3
|
||||
#define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_HAM1_CODE_HW
|
||||
#define CONFIG_SYS_NAND_ECCBYTES 14
|
||||
#define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
|
||||
#define CONFIG_NAND_OMAP_GPMC
|
||||
#define CONFIG_BCH
|
||||
|
||||
#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000
|
||||
/* NAND: SPL falcon mode configs */
|
||||
#ifdef CONFIG_SPL_OS_BOOT
|
||||
|
||||
@ -20,6 +20,8 @@
|
||||
#ifndef __CONFIG_H
|
||||
#define __CONFIG_H
|
||||
|
||||
#define CONFIG_SYS_GENERIC_BOARD
|
||||
|
||||
/* High Level Configuration Options */
|
||||
#define CONFIG_MPC8641 1 /* MPC8641 specific */
|
||||
#define CONFIG_SBC8641D 1 /* SBC8641D board specific */
|
||||
@ -241,8 +243,8 @@
|
||||
#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
|
||||
#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET
|
||||
|
||||
#define CONFIG_SYS_MONITOR_LEN (256 * 1024) /* Reserve 256 kB for Mon */
|
||||
#define CONFIG_SYS_MALLOC_LEN (128 * 1024) /* Reserved for malloc */
|
||||
#define CONFIG_SYS_MONITOR_LEN (384 * 1024) /* Reserve 384 kB for Mon */
|
||||
#define CONFIG_SYS_MALLOC_LEN (1024 * 1024) /* Reserved for malloc */
|
||||
|
||||
/* Serial Port */
|
||||
#define CONFIG_CONS_INDEX 1
|
||||
@ -472,8 +474,8 @@
|
||||
* Environment
|
||||
*/
|
||||
#define CONFIG_ENV_IS_IN_FLASH 1
|
||||
#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + 0x40000)
|
||||
#define CONFIG_ENV_SECT_SIZE 0x40000 /* 256K(one sector) for env */
|
||||
#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
|
||||
#define CONFIG_ENV_SECT_SIZE 0x20000 /* 128k(one sector) for env */
|
||||
#define CONFIG_ENV_SIZE 0x2000
|
||||
|
||||
#define CONFIG_LOADS_ECHO 1 /* echo on for serial download */
|
||||
@ -494,6 +496,7 @@
|
||||
*/
|
||||
#define CONFIG_SYS_LONGHELP /* undef to save memory */
|
||||
#define CONFIG_SYS_LOAD_ADDR 0x2000000 /* default load address */
|
||||
#define CONFIG_CMDLINE_EDITING 1 /* add command line history */
|
||||
|
||||
#if defined(CONFIG_CMD_KGDB)
|
||||
#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
|
||||
|
||||
@ -168,11 +168,13 @@
|
||||
#define CONFIG_SYS_LOAD_ADDR (V2M_BASE + 0x10000000)
|
||||
|
||||
/* Physical Memory Map */
|
||||
#define CONFIG_NR_DRAM_BANKS 1
|
||||
#define CONFIG_NR_DRAM_BANKS 2
|
||||
#define PHYS_SDRAM_1 (V2M_BASE) /* SDRAM Bank #1 */
|
||||
#define PHYS_SDRAM_2 (0x880000000)
|
||||
/* Top 16MB reserved for secure world use */
|
||||
#define DRAM_SEC_SIZE 0x01000000
|
||||
#define PHYS_SDRAM_1_SIZE 0x80000000 - DRAM_SEC_SIZE
|
||||
#define PHYS_SDRAM_2_SIZE 0x180000000
|
||||
#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
|
||||
|
||||
/* Enable memtest */
|
||||
|
||||
@ -116,20 +116,37 @@
|
||||
|
||||
#define CONFIG_BOOTDELAY 3
|
||||
|
||||
#define CONFIG_LOADADDR 0x82000000
|
||||
#define CONFIG_SYS_LOAD_ADDR 0x82000000
|
||||
|
||||
/* We boot from the gfxRAM area of the OCRAM. */
|
||||
#define CONFIG_SYS_TEXT_BASE 0x3f408000
|
||||
#define CONFIG_BOARD_SIZE_LIMIT 524288
|
||||
|
||||
/*
|
||||
* We do have 128MB of memory on the Vybrid Tower board. Leave the last
|
||||
* 16MB alone to avoid conflicts with Cortex-M4 firmwares running from
|
||||
* DDR3. Hence, limit the memory range for image processing to 112MB
|
||||
* using bootm_size. All of the following must be within this range.
|
||||
* We have the default load at 32MB into DDR (for the kernel), FDT at
|
||||
* 64MB and the ramdisk 512KB above that (allowing for hopefully never
|
||||
* seen large trees). This allows a reasonable split between ramdisk
|
||||
* and kernel size, where the ram disk can be a bit larger.
|
||||
*/
|
||||
#define MEM_LAYOUT_ENV_SETTINGS \
|
||||
"bootm_size=0x07000000\0" \
|
||||
"loadaddr=0x82000000\0" \
|
||||
"kernel_addr_r=0x82000000\0" \
|
||||
"fdt_addr=0x84000000\0" \
|
||||
"fdt_addr_r=0x84000000\0" \
|
||||
"rdaddr=0x84080000\0" \
|
||||
"ramdisk_addr_r=0x84080000\0"
|
||||
|
||||
#define CONFIG_EXTRA_ENV_SETTINGS \
|
||||
MEM_LAYOUT_ENV_SETTINGS \
|
||||
"script=boot.scr\0" \
|
||||
"image=zImage\0" \
|
||||
"console=ttyLP1\0" \
|
||||
"fdt_high=0xffffffff\0" \
|
||||
"initrd_high=0xffffffff\0" \
|
||||
"fdt_file=vf610-twr.dtb\0" \
|
||||
"fdt_addr=0x81000000\0" \
|
||||
"boot_fdt=try\0" \
|
||||
"ip_dyn=yes\0" \
|
||||
"mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
|
||||
@ -224,8 +241,6 @@
|
||||
#define CONFIG_SYS_MEMTEST_START 0x80010000
|
||||
#define CONFIG_SYS_MEMTEST_END 0x87C00000
|
||||
|
||||
#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
|
||||
|
||||
/*
|
||||
* Stack sizes
|
||||
* The stack sizes are set up in start.S using the settings below
|
||||
|
||||
18
include/fsl_wdog.h
Normal file
18
include/fsl_wdog.h
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* (C) Copyright 2015 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
struct watchdog_regs {
|
||||
u16 wcr; /* Control */
|
||||
u16 wsr; /* Service */
|
||||
u16 wrsr; /* Reset Status */
|
||||
};
|
||||
|
||||
#define WCR_WDZST 0x01
|
||||
#define WCR_WDBG 0x02
|
||||
#define WCR_WDE 0x04
|
||||
#define WCR_WDT 0x08
|
||||
#define WCR_SRS 0x10
|
||||
#define SET_WCR_WT(x) (x << 8)
|
||||
@ -160,54 +160,80 @@ static void set_dcd_val_v1(struct imx_header *imxhdr, char *name, int lineno,
|
||||
}
|
||||
}
|
||||
|
||||
static struct dcd_v2_cmd *gd_last_cmd;
|
||||
|
||||
static void set_dcd_param_v2(struct imx_header *imxhdr, uint32_t dcd_len,
|
||||
int32_t cmd)
|
||||
{
|
||||
dcd_v2_t *dcd_v2 = &imxhdr->header.hdr_v2.dcd_table;
|
||||
struct dcd_v2_cmd *d = gd_last_cmd;
|
||||
struct dcd_v2_cmd *d2;
|
||||
int len;
|
||||
|
||||
if (!d)
|
||||
d = &dcd_v2->dcd_cmd;
|
||||
d2 = d;
|
||||
len = be16_to_cpu(d->write_dcd_command.length);
|
||||
if (len > 4)
|
||||
d2 = (struct dcd_v2_cmd *)(((char *)d) + len);
|
||||
|
||||
switch (cmd) {
|
||||
case CMD_WRITE_DATA:
|
||||
dcd_v2->write_dcd_command.tag = DCD_WRITE_DATA_COMMAND_TAG;
|
||||
dcd_v2->write_dcd_command.length = cpu_to_be16(
|
||||
dcd_len * sizeof(dcd_addr_data_t) + 4);
|
||||
dcd_v2->write_dcd_command.param = DCD_WRITE_DATA_PARAM;
|
||||
if ((d->write_dcd_command.tag == DCD_WRITE_DATA_COMMAND_TAG) &&
|
||||
(d->write_dcd_command.param == DCD_WRITE_DATA_PARAM))
|
||||
break;
|
||||
d = d2;
|
||||
d->write_dcd_command.tag = DCD_WRITE_DATA_COMMAND_TAG;
|
||||
d->write_dcd_command.length = cpu_to_be16(4);
|
||||
d->write_dcd_command.param = DCD_WRITE_DATA_PARAM;
|
||||
break;
|
||||
case CMD_WRITE_CLR_BIT:
|
||||
dcd_v2->write_dcd_command.tag = DCD_WRITE_DATA_COMMAND_TAG;
|
||||
dcd_v2->write_dcd_command.length = cpu_to_be16(
|
||||
dcd_len * sizeof(dcd_addr_data_t) + 4);
|
||||
dcd_v2->write_dcd_command.param = DCD_WRITE_CLR_BIT_PARAM;
|
||||
if ((d->write_dcd_command.tag == DCD_WRITE_DATA_COMMAND_TAG) &&
|
||||
(d->write_dcd_command.param == DCD_WRITE_CLR_BIT_PARAM))
|
||||
break;
|
||||
d = d2;
|
||||
d->write_dcd_command.tag = DCD_WRITE_DATA_COMMAND_TAG;
|
||||
d->write_dcd_command.length = cpu_to_be16(4);
|
||||
d->write_dcd_command.param = DCD_WRITE_CLR_BIT_PARAM;
|
||||
break;
|
||||
/*
|
||||
* Check data command only supports one entry,
|
||||
* so use 0xC = size(address + value + command).
|
||||
*/
|
||||
case CMD_CHECK_BITS_SET:
|
||||
dcd_v2->write_dcd_command.tag = DCD_CHECK_DATA_COMMAND_TAG;
|
||||
dcd_v2->write_dcd_command.length = cpu_to_be16(0xC);
|
||||
dcd_v2->write_dcd_command.param = DCD_CHECK_BITS_SET_PARAM;
|
||||
d = d2;
|
||||
d->write_dcd_command.tag = DCD_CHECK_DATA_COMMAND_TAG;
|
||||
d->write_dcd_command.length = cpu_to_be16(4);
|
||||
d->write_dcd_command.param = DCD_CHECK_BITS_SET_PARAM;
|
||||
break;
|
||||
case CMD_CHECK_BITS_CLR:
|
||||
dcd_v2->write_dcd_command.tag = DCD_CHECK_DATA_COMMAND_TAG;
|
||||
dcd_v2->write_dcd_command.length = cpu_to_be16(0xC);
|
||||
dcd_v2->write_dcd_command.param = DCD_CHECK_BITS_SET_PARAM;
|
||||
d = d2;
|
||||
d->write_dcd_command.tag = DCD_CHECK_DATA_COMMAND_TAG;
|
||||
d->write_dcd_command.length = cpu_to_be16(4);
|
||||
d->write_dcd_command.param = DCD_CHECK_BITS_SET_PARAM;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
gd_last_cmd = d;
|
||||
}
|
||||
|
||||
static void set_dcd_val_v2(struct imx_header *imxhdr, char *name, int lineno,
|
||||
int fld, uint32_t value, uint32_t off)
|
||||
{
|
||||
dcd_v2_t *dcd_v2 = &imxhdr->header.hdr_v2.dcd_table;
|
||||
struct dcd_v2_cmd *d = gd_last_cmd;
|
||||
int len;
|
||||
|
||||
len = be16_to_cpu(d->write_dcd_command.length);
|
||||
off = (len - 4) >> 3;
|
||||
|
||||
switch (fld) {
|
||||
case CFG_REG_ADDRESS:
|
||||
dcd_v2->addr_data[off].addr = cpu_to_be32(value);
|
||||
d->addr_data[off].addr = cpu_to_be32(value);
|
||||
break;
|
||||
case CFG_REG_VALUE:
|
||||
dcd_v2->addr_data[off].value = cpu_to_be32(value);
|
||||
d->addr_data[off].value = cpu_to_be32(value);
|
||||
off++;
|
||||
d->write_dcd_command.length = cpu_to_be16((off << 3) + 4);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -236,12 +262,20 @@ static void set_dcd_rst_v2(struct imx_header *imxhdr, uint32_t dcd_len,
|
||||
char *name, int lineno)
|
||||
{
|
||||
dcd_v2_t *dcd_v2 = &imxhdr->header.hdr_v2.dcd_table;
|
||||
struct dcd_v2_cmd *d = gd_last_cmd;
|
||||
int len;
|
||||
|
||||
if (!d)
|
||||
d = &dcd_v2->dcd_cmd;
|
||||
len = be16_to_cpu(d->write_dcd_command.length);
|
||||
if (len > 4)
|
||||
d = (struct dcd_v2_cmd *)(((char *)d) + len);
|
||||
|
||||
len = (char *)d - (char *)&dcd_v2->header;
|
||||
|
||||
dcd_v2->header.tag = DCD_HEADER_TAG;
|
||||
dcd_v2->header.length = cpu_to_be16(
|
||||
dcd_len * sizeof(dcd_addr_data_t) + 8);
|
||||
dcd_v2->header.length = cpu_to_be16(len);
|
||||
dcd_v2->header.version = DCD_VERSION;
|
||||
set_dcd_param_v2(imxhdr, dcd_len, CMD_WRITE_DATA);
|
||||
}
|
||||
|
||||
static void set_imx_hdr_v1(struct imx_header *imxhdr, uint32_t dcd_len,
|
||||
@ -314,6 +348,7 @@ static void set_hdr_func(void)
|
||||
max_dcd_entries = MAX_HW_CFG_SIZE_V1;
|
||||
break;
|
||||
case IMXIMAGE_V2:
|
||||
gd_last_cmd = NULL;
|
||||
set_dcd_val = set_dcd_val_v2;
|
||||
set_dcd_param = set_dcd_param_v2;
|
||||
set_dcd_rst = set_dcd_rst_v2;
|
||||
@ -361,8 +396,8 @@ static void print_hdr_v2(struct imx_header *imx_hdr)
|
||||
dcd_v2_t *dcd_v2 = &hdr_v2->dcd_table;
|
||||
uint32_t size, version;
|
||||
|
||||
size = be16_to_cpu(dcd_v2->header.length) - 8;
|
||||
if (size > (MAX_HW_CFG_SIZE_V2 * sizeof(dcd_addr_data_t))) {
|
||||
size = be16_to_cpu(dcd_v2->header.length);
|
||||
if (size > (MAX_HW_CFG_SIZE_V2 * sizeof(dcd_addr_data_t)) + 8) {
|
||||
fprintf(stderr,
|
||||
"Error: Image corrupt DCD size %d exceed maximum %d\n",
|
||||
(uint32_t)(size / sizeof(dcd_addr_data_t)),
|
||||
|
||||
@ -133,10 +133,14 @@ typedef struct {
|
||||
uint8_t param;
|
||||
} __attribute__((packed)) write_dcd_command_t;
|
||||
|
||||
typedef struct {
|
||||
ivt_header_t header;
|
||||
struct dcd_v2_cmd {
|
||||
write_dcd_command_t write_dcd_command;
|
||||
dcd_addr_data_t addr_data[MAX_HW_CFG_SIZE_V2];
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
ivt_header_t header;
|
||||
struct dcd_v2_cmd dcd_cmd;
|
||||
uint32_t padding[1]; /* end up on an 8-byte boundary */
|
||||
} dcd_v2_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user