]> git.ipfire.org Git - people/ms/u-boot.git/blame - drivers/mtd/ftsmc020.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[people/ms/u-boot.git] / drivers / mtd / ftsmc020.c
CommitLineData
43a5f0df
PYC
1/*
2 * (C) Copyright 2009 Faraday Technology
3 * Po-Yu Chuang <ratbert@faraday-tech.com>
4 *
1a459660 5 * SPDX-License-Identifier: GPL-2.0+
43a5f0df
PYC
6 */
7
8#include <config.h>
9#include <common.h>
10#include <asm/io.h>
00d10eb0 11#include <faraday/ftsmc020.h>
43a5f0df
PYC
12
13struct ftsmc020_config {
14 unsigned int config;
15 unsigned int timing;
16};
17
43a5f0df
PYC
18static void ftsmc020_setup_bank(unsigned int bank, struct ftsmc020_config *cfg)
19{
f194f6ba
ML
20 struct ftsmc020 *smc = (struct ftsmc020 *)CONFIG_FTSMC020_BASE;
21
43a5f0df
PYC
22 if (bank > 3) {
23 printf("bank # %u invalid\n", bank);
24 return;
25 }
26
27 writel(cfg->config, &smc->bank[bank].cr);
28 writel(cfg->timing, &smc->bank[bank].tpr);
29}
30
31void ftsmc020_init(void)
32{
f194f6ba 33 struct ftsmc020_config config[] = CONFIG_SYS_FTSMC020_CONFIGS;
43a5f0df
PYC
34 int i;
35
36 for (i = 0; i < ARRAY_SIZE(config); i++)
37 ftsmc020_setup_bank(i, &config[i]);
38}