Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright © 2010 ST Microelectronics
0003  * Shiraz Hashim <shiraz.linux.kernel@gmail.com>
0004  *
0005  * This file is licensed under the terms of the GNU General Public
0006  * License version 2. This program is licensed "as is" without any
0007  * warranty of any kind, whether express or implied.
0008  */
0009 
0010 #ifndef __MTD_SPEAR_SMI_H
0011 #define __MTD_SPEAR_SMI_H
0012 
0013 #include <linux/types.h>
0014 #include <linux/mtd/mtd.h>
0015 #include <linux/mtd/partitions.h>
0016 #include <linux/platform_device.h>
0017 #include <linux/of.h>
0018 
0019 /* max possible slots for serial-nor flash chip in the SMI controller */
0020 #define MAX_NUM_FLASH_CHIP  4
0021 
0022 /* macro to define partitions for flash devices */
0023 #define DEFINE_PARTS(n, of, s)      \
0024 {                   \
0025     .name = n,          \
0026     .offset = of,           \
0027     .size = s,          \
0028 }
0029 
0030 /**
0031  * struct spear_smi_flash_info - platform structure for passing flash
0032  * information
0033  *
0034  * name: name of the serial nor flash for identification
0035  * mem_base: the memory base on which the flash is mapped
0036  * size: size of the flash in bytes
0037  * partitions: parition details
0038  * nr_partitions: number of partitions
0039  * fast_mode: whether flash supports fast mode
0040  */
0041 
0042 struct spear_smi_flash_info {
0043     char *name;
0044     unsigned long mem_base;
0045     unsigned long size;
0046     struct mtd_partition *partitions;
0047     int nr_partitions;
0048     u8 fast_mode;
0049 };
0050 
0051 /**
0052  * struct spear_smi_plat_data - platform structure for configuring smi
0053  *
0054  * clk_rate: clk rate at which SMI must operate
0055  * num_flashes: number of flashes present on board
0056  * board_flash_info: specific details of each flash present on board
0057  */
0058 struct spear_smi_plat_data {
0059     unsigned long clk_rate;
0060     int num_flashes;
0061     struct spear_smi_flash_info *board_flash_info;
0062     struct device_node *np[MAX_NUM_FLASH_CHIP];
0063 };
0064 
0065 #endif /* __MTD_SPEAR_SMI_H */