2009-11-11 09:27:30 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2009 Faraday Technology
|
|
|
|
* Po-Yu Chuang <ratbert@faraday-tech.com>
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2009-11-11 09:27:30 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
#include <common.h>
|
|
|
|
#include <asm/io.h>
|
2011-04-15 21:37:11 +00:00
|
|
|
#include <faraday/ftsmc020.h>
|
2009-11-11 09:27:30 +00:00
|
|
|
|
|
|
|
struct ftsmc020_config {
|
|
|
|
unsigned int config;
|
|
|
|
unsigned int timing;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void ftsmc020_setup_bank(unsigned int bank, struct ftsmc020_config *cfg)
|
|
|
|
{
|
2011-05-01 22:17:29 +00:00
|
|
|
struct ftsmc020 *smc = (struct ftsmc020 *)CONFIG_FTSMC020_BASE;
|
|
|
|
|
2009-11-11 09:27:30 +00:00
|
|
|
if (bank > 3) {
|
|
|
|
printf("bank # %u invalid\n", bank);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
writel(cfg->config, &smc->bank[bank].cr);
|
|
|
|
writel(cfg->timing, &smc->bank[bank].tpr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ftsmc020_init(void)
|
|
|
|
{
|
2011-05-01 22:17:29 +00:00
|
|
|
struct ftsmc020_config config[] = CONFIG_SYS_FTSMC020_CONFIGS;
|
2009-11-11 09:27:30 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(config); i++)
|
|
|
|
ftsmc020_setup_bank(i, &config[i]);
|
|
|
|
}
|