162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright © 2010 ST Microelectronics
362306a36Sopenharmony_ci * Shiraz Hashim <shiraz.linux.kernel@gmail.com>
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * This file is licensed under the terms of the GNU General Public
662306a36Sopenharmony_ci * License version 2. This program is licensed "as is" without any
762306a36Sopenharmony_ci * warranty of any kind, whether express or implied.
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#ifndef __MTD_SPEAR_SMI_H
1162306a36Sopenharmony_ci#define __MTD_SPEAR_SMI_H
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#include <linux/types.h>
1462306a36Sopenharmony_ci#include <linux/mtd/mtd.h>
1562306a36Sopenharmony_ci#include <linux/mtd/partitions.h>
1662306a36Sopenharmony_ci#include <linux/platform_device.h>
1762306a36Sopenharmony_ci#include <linux/of.h>
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci/* max possible slots for serial-nor flash chip in the SMI controller */
2062306a36Sopenharmony_ci#define MAX_NUM_FLASH_CHIP	4
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci/* macro to define partitions for flash devices */
2362306a36Sopenharmony_ci#define DEFINE_PARTS(n, of, s)		\
2462306a36Sopenharmony_ci{					\
2562306a36Sopenharmony_ci	.name = n,			\
2662306a36Sopenharmony_ci	.offset = of,			\
2762306a36Sopenharmony_ci	.size = s,			\
2862306a36Sopenharmony_ci}
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci/**
3162306a36Sopenharmony_ci * struct spear_smi_flash_info - platform structure for passing flash
3262306a36Sopenharmony_ci * information
3362306a36Sopenharmony_ci *
3462306a36Sopenharmony_ci * name: name of the serial nor flash for identification
3562306a36Sopenharmony_ci * mem_base: the memory base on which the flash is mapped
3662306a36Sopenharmony_ci * size: size of the flash in bytes
3762306a36Sopenharmony_ci * partitions: parition details
3862306a36Sopenharmony_ci * nr_partitions: number of partitions
3962306a36Sopenharmony_ci * fast_mode: whether flash supports fast mode
4062306a36Sopenharmony_ci */
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_cistruct spear_smi_flash_info {
4362306a36Sopenharmony_ci	char *name;
4462306a36Sopenharmony_ci	unsigned long mem_base;
4562306a36Sopenharmony_ci	unsigned long size;
4662306a36Sopenharmony_ci	struct mtd_partition *partitions;
4762306a36Sopenharmony_ci	int nr_partitions;
4862306a36Sopenharmony_ci	u8 fast_mode;
4962306a36Sopenharmony_ci};
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci/**
5262306a36Sopenharmony_ci * struct spear_smi_plat_data - platform structure for configuring smi
5362306a36Sopenharmony_ci *
5462306a36Sopenharmony_ci * clk_rate: clk rate at which SMI must operate
5562306a36Sopenharmony_ci * num_flashes: number of flashes present on board
5662306a36Sopenharmony_ci * board_flash_info: specific details of each flash present on board
5762306a36Sopenharmony_ci */
5862306a36Sopenharmony_cistruct spear_smi_plat_data {
5962306a36Sopenharmony_ci	unsigned long clk_rate;
6062306a36Sopenharmony_ci	int num_flashes;
6162306a36Sopenharmony_ci	struct spear_smi_flash_info *board_flash_info;
6262306a36Sopenharmony_ci	struct device_node *np[MAX_NUM_FLASH_CHIP];
6362306a36Sopenharmony_ci};
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci#endif /* __MTD_SPEAR_SMI_H */
66