Blame view

drivers/mtd/ftsmc020.c 786 Bytes
43a5f0df2   Po-Yu Chuang   arm: A320: Add su...
1
2
3
4
  /*
   * (C) Copyright 2009 Faraday Technology
   * Po-Yu Chuang <ratbert@faraday-tech.com>
   *
1a4596601   Wolfgang Denk   Add GPL-2.0+ SPDX...
5
   * SPDX-License-Identifier:	GPL-2.0+
43a5f0df2   Po-Yu Chuang   arm: A320: Add su...
6
7
8
9
10
   */
  
  #include <config.h>
  #include <common.h>
  #include <asm/io.h>
00d10eb04   Macpaul Lin   ftsmc020: move ft...
11
  #include <faraday/ftsmc020.h>
43a5f0df2   Po-Yu Chuang   arm: A320: Add su...
12
13
14
15
16
  
  struct ftsmc020_config {
  	unsigned int	config;
  	unsigned int	timing;
  };
43a5f0df2   Po-Yu Chuang   arm: A320: Add su...
17
18
  static void ftsmc020_setup_bank(unsigned int bank, struct ftsmc020_config *cfg)
  {
f194f6ba5   Macpaul Lin   ftsmc020: fix rel...
19
  	struct ftsmc020 *smc = (struct ftsmc020 *)CONFIG_FTSMC020_BASE;
43a5f0df2   Po-Yu Chuang   arm: A320: Add su...
20
21
22
23
24
25
26
27
28
29
30
31
  	if (bank > 3) {
  		printf("bank # %u invalid
  ", bank);
  		return;
  	}
  
  	writel(cfg->config, &smc->bank[bank].cr);
  	writel(cfg->timing, &smc->bank[bank].tpr);
  }
  
  void ftsmc020_init(void)
  {
f194f6ba5   Macpaul Lin   ftsmc020: fix rel...
32
  	struct ftsmc020_config config[] = CONFIG_SYS_FTSMC020_CONFIGS;
43a5f0df2   Po-Yu Chuang   arm: A320: Add su...
33
34
35
36
37
  	int i;
  
  	for (i = 0; i < ARRAY_SIZE(config); i++)
  		ftsmc020_setup_bank(i, &config[i]);
  }