u-boot-brain/arch/mips/mach-mtmips/include/mach/ddr.h
Weijie Gao 02cd449f0b mips: mtmips: rewrite lowlevel codes of mt7628
This patch rewrites the mtmips architecture with the following changes:

1. Move MT7628 soc parts into a subfolder.
2. Lock parts of D-Cache as temporary stack.
3. Reimplement DDR initialization in C language.
4. Reimplement DDR calibration in a clear logic.
5. Add full support for auto size detection for DDR1 and DDR2.
6. Use accurate CPU clock depending on the input xtal frequency for timer
   and delay functions.

Note:

print_cpuinfo() has incompatible parts with MT7620 so it's moved into
mt7628 subfolder.

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2020-04-27 20:29:33 +02:00

53 lines
817 B
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2020 MediaTek Inc.
*
* Author: Weijie Gao <weijie.gao@mediatek.com>
*/
#ifndef _MTMIPS_DDR_H_
#define _MTMIPS_DDR_H_
#include <linux/io.h>
#include <linux/types.h>
enum mc_dram_size {
DRAM_8MB,
DRAM_16MB,
DRAM_32MB,
DRAM_64MB,
DRAM_128MB,
DRAM_256MB,
__DRAM_SZ_MAX
};
struct mc_ddr_cfg {
u32 cfg0;
u32 cfg1;
u32 cfg2;
u32 cfg3;
u32 cfg4;
};
typedef void (*mc_reset_t)(int assert);
struct mc_ddr_init_param {
void __iomem *memc;
u32 dq_dly;
u32 dqs_dly;
const struct mc_ddr_cfg *cfgs;
mc_reset_t mc_reset;
u32 memsize;
u32 bus_width;
};
void ddr1_init(struct mc_ddr_init_param *param);
void ddr2_init(struct mc_ddr_init_param *param);
void ddr_calibrate(void __iomem *memc, u32 memsize, u32 bw);
#endif /* _MTMIPS_DDR_H_ */