blob: 581603ac127769c5fe87d0b1e5d36eeaab3135f6 [file] [log] [blame]
Shiraz Hashimf18dbbb2012-01-12 14:38:57 +01001/*
2 * Copyright © 2010 ST Microelectronics
Viresh Kumar9cc23682014-04-18 15:07:16 -07003 * Shiraz Hashim <shiraz.linux.kernel@gmail.com>
Shiraz Hashimf18dbbb2012-01-12 14:38:57 +01004 *
5 * This file is licensed under the terms of the GNU General Public
6 * License version 2. This program is licensed "as is" without any
7 * warranty of any kind, whether express or implied.
8 */
9
10#ifndef __MTD_SPEAR_SMI_H
11#define __MTD_SPEAR_SMI_H
12
13#include <linux/types.h>
14#include <linux/mtd/mtd.h>
15#include <linux/mtd/partitions.h>
16#include <linux/platform_device.h>
Stefan Roese6551ab52012-03-16 11:42:11 +010017#include <linux/of.h>
18
19/* max possible slots for serial-nor flash chip in the SMI controller */
20#define MAX_NUM_FLASH_CHIP 4
Shiraz Hashimf18dbbb2012-01-12 14:38:57 +010021
22/* macro to define partitions for flash devices */
23#define DEFINE_PARTS(n, of, s) \
24{ \
25 .name = n, \
26 .offset = of, \
27 .size = s, \
28}
29
30/**
31 * struct spear_smi_flash_info - platform structure for passing flash
32 * information
33 *
34 * name: name of the serial nor flash for identification
35 * mem_base: the memory base on which the flash is mapped
36 * size: size of the flash in bytes
37 * partitions: parition details
38 * nr_partitions: number of partitions
39 * fast_mode: whether flash supports fast mode
40 */
41
42struct spear_smi_flash_info {
43 char *name;
44 unsigned long mem_base;
45 unsigned long size;
46 struct mtd_partition *partitions;
47 int nr_partitions;
48 u8 fast_mode;
49};
50
51/**
52 * struct spear_smi_plat_data - platform structure for configuring smi
53 *
54 * clk_rate: clk rate at which SMI must operate
55 * num_flashes: number of flashes present on board
56 * board_flash_info: specific details of each flash present on board
57 */
58struct spear_smi_plat_data {
59 unsigned long clk_rate;
60 int num_flashes;
61 struct spear_smi_flash_info *board_flash_info;
Stefan Roese6551ab52012-03-16 11:42:11 +010062 struct device_node *np[MAX_NUM_FLASH_CHIP];
Shiraz Hashimf18dbbb2012-01-12 14:38:57 +010063};
64
65#endif /* __MTD_SPEAR_SMI_H */