Commit 7e8702a0 authored by Wenyou Yang's avatar Wenyou Yang Committed by Andreas Bießmann

arm: at91/spl: mpddrc: add struct atmel_mpddrc_config

Add struct atmel_mpddrc_config to accommodate the mpddrc register
configurations, not using the mpddrc register map structure,
struct atmel_mpddrc, in order to increase readability and reduce
run-time memory use.
Signed-off-by: 's avatarWenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: 's avatarAndreas Bießmann <andreas.devel@googlemail.com>
parent 258b21fc
......@@ -8,6 +8,16 @@
#ifndef __ATMEL_MPDDRC_H__
#define __ATMEL_MPDDRC_H__
struct atmel_mpddrc_config {
u32 mr;
u32 rtr;
u32 cr;
u32 tpr0;
u32 tpr1;
u32 tpr2;
u32 md;
};
/*
* Only define the needed register in mpddr
* If other register needed, will add them later
......@@ -26,7 +36,7 @@ struct atmel_mpddr {
int ddr2_init(const unsigned int base,
const unsigned int ram_address,
const struct atmel_mpddr *mpddr);
const struct atmel_mpddrc_config *mpddr_value);
/* Bit field in mode register */
#define ATMEL_MPDDRC_MR_MODE_NORMAL_CMD 0x0
......
......@@ -30,7 +30,7 @@ static int ddr2_decodtype_is_seq(u32 cr)
int ddr2_init(const unsigned int base,
const unsigned int ram_address,
const struct atmel_mpddr *mpddr_value)
const struct atmel_mpddrc_config *mpddr_value)
{
const struct atmel_mpddr *mpddr = (struct atmel_mpddr *)base;
......
......@@ -97,7 +97,7 @@ void at91_spl_board_init(void)
}
#include <asm/arch/atmel_mpddrc.h>
static void ddr2_conf(struct atmel_mpddr *ddr2)
static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
{
ddr2->md = (ATMEL_MPDDRC_MD_DBW_16_BITS | ATMEL_MPDDRC_MD_DDR2_SDRAM);
......@@ -131,7 +131,7 @@ static void ddr2_conf(struct atmel_mpddr *ddr2)
void mem_init(void)
{
struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
struct atmel_mpddr ddr2;
struct atmel_mpddrc_config ddr2;
ddr2_conf(&ddr2);
......
......@@ -274,7 +274,7 @@ void at91_spl_board_init(void)
}
#include <asm/arch/atmel_mpddrc.h>
static void ddr2_conf(struct atmel_mpddr *ddr2)
static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
{
ddr2->md = (ATMEL_MPDDRC_MD_DBW_16_BITS | ATMEL_MPDDRC_MD_DDR2_SDRAM);
......@@ -310,7 +310,7 @@ void mem_init(void)
{
struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
struct at91_matrix *matrix = (struct at91_matrix *)ATMEL_BASE_MATRIX;
struct atmel_mpddr ddr2;
struct atmel_mpddrc_config ddr2;
unsigned long csa;
ddr2_conf(&ddr2);
......
......@@ -310,7 +310,7 @@ void at91_spl_board_init(void)
}
#include <asm/arch/atmel_mpddrc.h>
static void ddr2_conf(struct atmel_mpddr *ddr2)
static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
{
ddr2->md = (ATMEL_MPDDRC_MD_DBW_16_BITS | ATMEL_MPDDRC_MD_DDR2_SDRAM);
......@@ -347,7 +347,7 @@ void mem_init(void)
{
struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
struct at91_matrix *matrix = (struct at91_matrix *)ATMEL_BASE_MATRIX;
struct atmel_mpddr ddr2;
struct atmel_mpddrc_config ddr2;
unsigned long csa;
ddr2_conf(&ddr2);
......
......@@ -143,7 +143,7 @@ void spl_board_init(void)
#endif
}
static void ddr2_conf(struct atmel_mpddr *ddr2)
static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
{
ddr2->md = (ATMEL_MPDDRC_MD_DBW_32_BITS | ATMEL_MPDDRC_MD_DDR2_SDRAM);
......@@ -185,7 +185,7 @@ static void ddr2_conf(struct atmel_mpddr *ddr2)
void mem_init(void)
{
struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
struct atmel_mpddr ddr2;
struct atmel_mpddrc_config ddr2;
ddr2_conf(&ddr2);
......
......@@ -402,7 +402,7 @@ void spl_board_init(void)
#endif
}
static void ddr2_conf(struct atmel_mpddr *ddr2)
static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
{
ddr2->md = (ATMEL_MPDDRC_MD_DBW_32_BITS | ATMEL_MPDDRC_MD_DDR2_SDRAM);
......@@ -444,7 +444,7 @@ static void ddr2_conf(struct atmel_mpddr *ddr2)
void mem_init(void)
{
struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
struct atmel_mpddr ddr2;
struct atmel_mpddrc_config ddr2;
ddr2_conf(&ddr2);
......
......@@ -346,7 +346,7 @@ void spl_board_init(void)
#endif
}
static void ddr2_conf(struct atmel_mpddr *ddr2)
static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
{
ddr2->md = (ATMEL_MPDDRC_MD_DBW_32_BITS | ATMEL_MPDDRC_MD_DDR2_SDRAM);
......@@ -384,7 +384,7 @@ static void ddr2_conf(struct atmel_mpddr *ddr2)
void mem_init(void)
{
struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
struct atmel_mpddr ddr2;
struct atmel_mpddrc_config ddr2;
ddr2_conf(&ddr2);
......
......@@ -342,7 +342,7 @@ void spl_board_init(void)
#endif
}
static void ddr2_conf(struct atmel_mpddr *ddr2)
static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
{
ddr2->md = (ATMEL_MPDDRC_MD_DBW_32_BITS | ATMEL_MPDDRC_MD_DDR2_SDRAM);
......@@ -380,7 +380,7 @@ static void ddr2_conf(struct atmel_mpddr *ddr2)
void mem_init(void)
{
struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
struct atmel_mpddr ddr2;
struct atmel_mpddrc_config ddr2;
ddr2_conf(&ddr2);
......
......@@ -47,7 +47,7 @@ void at91_spl_board_init(void)
}
#include <asm/arch/atmel_mpddrc.h>
static void ddr2_conf(struct atmel_mpddr *ddr2)
static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
{
ddr2->md = (ATMEL_MPDDRC_MD_DBW_16_BITS | ATMEL_MPDDRC_MD_DDR2_SDRAM);
......@@ -82,7 +82,7 @@ void mem_init(void)
{
struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
struct at91_matrix *mat = (struct at91_matrix *)ATMEL_BASE_MATRIX;
struct atmel_mpddr ddr2;
struct atmel_mpddrc_config ddr2;
unsigned long csa;
ddr2_conf(&ddr2);
......
......@@ -114,7 +114,7 @@ void spl_board_init(void)
}
#include <asm/arch/atmel_mpddrc.h>
static void ddr2_conf(struct atmel_mpddr *ddr2)
static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
{
ddr2->md = (ATMEL_MPDDRC_MD_DBW_16_BITS | ATMEL_MPDDRC_MD_DDR2_SDRAM);
......@@ -148,7 +148,7 @@ static void ddr2_conf(struct atmel_mpddr *ddr2)
void mem_init(void)
{
struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
struct atmel_mpddr ddr2;
struct atmel_mpddrc_config ddr2;
ddr2_conf(&ddr2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment