>From 0be7cdd6a374cdae2b940eed04fd619d94bb0add Mon Sep 17 00:00:00 2001 From: Gregory Alagnou <[email protected]> Date: Thu, 4 Nov 2010 11:51:15 +0100 Subject: [PATCH] SFI: Add SD type to SFI device parsing
SFI_DEV_TYPE_SD is added to SFI device type. On SFI table parsing, add SD device data processing: data are stored in sd_board_info structure and SD platform data function is call. Signed-off-by: Gregory Alagnou <[email protected]> --- arch/x86/kernel/mrst.c | 30 ++++++++++++++++++++++++++++++ include/linux/mmc/sdio.h | 18 ++++++++++++++++++ include/linux/sfi.h | 1 + 3 files changed, 49 insertions(+), 0 deletions(-) diff --git a/arch/x86/kernel/mrst.c b/arch/x86/kernel/mrst.c index eaebd6a..adcb12e 100644 --- a/arch/x86/kernel/mrst.c +++ b/arch/x86/kernel/mrst.c @@ -34,6 +34,7 @@ #include <linux/i2c/tc35894xbg.h> #include <linux/bh1770glc.h> #include <linux/leds-lp5523.h> +#include <linux/mmc/sdio.h> #include <linux/wl12xx.h> #include <linux/regulator/machine.h> #include <linux/regulator/fixed.h> @@ -1266,6 +1267,22 @@ static void sfi_handle_i2c_dev(int bus, struct i2c_board_info *i2c_info) i2c_register_board_info(bus, i2c_info, 1); } +static void sfi_handle_sd_dev(struct sd_board_info *sd_info) +{ + const struct devs_id *dev = device_ids; + void *pdata = NULL; + + while (dev->name[0]) { + if (dev->type == SFI_DEV_TYPE_SD && + !strncmp(dev->name, sd_info->name, 16)) { + pdata = dev->get_platform_data(sd_info); + break; + } + dev++; + } + sd_info->platform_data = pdata; + +} static int __init sfi_parse_devs(struct sfi_table_header *table) { @@ -1273,6 +1290,7 @@ static int __init sfi_parse_devs(struct sfi_table_header *table) struct sfi_device_table_entry *pentry; struct spi_board_info spi_info; struct i2c_board_info i2c_info; + struct sd_board_info sd_info; struct platform_device *pdev; int num, i, bus; int ioapic; @@ -1338,6 +1356,18 @@ static int __init sfi_parse_devs(struct sfi_table_header *table) i2c_info.addr); sfi_handle_i2c_dev(bus, &i2c_info); break; + case SFI_DEV_TYPE_SD: + memset(&sd_info, 0, sizeof(sd_info)); + strncpy(sd_info.name, pentry->name, 16); + sd_info.bus_num = pentry->host_num; + sd_info.board_ref_clock = pentry->max_freq; + pr_info("info[%2d]: SDIO bus = %d, name = %16.16s, " + "ref_clock = %d\n", i, + sd_info.bus_num, + sd_info.name, + sd_info.board_ref_clock); + sfi_handle_sd_dev(&sd_info); + break; case SFI_DEV_TYPE_UART: case SFI_DEV_TYPE_HSI: default: diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h index 245cdac..6fd081e 100644 --- a/include/linux/mmc/sdio.h +++ b/include/linux/mmc/sdio.h @@ -12,6 +12,24 @@ #ifndef MMC_SDIO_H #define MMC_SDIO_H +#define SD_NAME_SIZE 16 + +/** + * struct sd_board_info - template for device creation + * @name: Initializes sdio_device.name; identifies the driver. + * @bus_num: board-specific identifier for a given SDIO controller. + * @board_ref_clock: Initializes sd_device.board_ref_clock; + * @platform_data: Initializes sd_device.platform_data; the particular + * data stored there is driver-specific. + * + */ +struct sd_board_info { + char name[SD_NAME_SIZE]; + int bus_num; + u32 board_ref_clock; + void *platform_data; +}; + /* SDIO commands type argument response */ #define SD_IO_SEND_OP_COND 5 /* bcr [23:0] OCR R4 */ #define SD_IO_RW_DIRECT 52 /* ac [31:0] See below R5 */ diff --git a/include/linux/sfi.h b/include/linux/sfi.h index 0299b4c..eb7d598 100644 --- a/include/linux/sfi.h +++ b/include/linux/sfi.h @@ -154,6 +154,7 @@ struct sfi_device_table_entry { #define SFI_DEV_TYPE_UART 2 #define SFI_DEV_TYPE_HSI 3 #define SFI_DEV_TYPE_IPC 4 +#define SFI_DEV_TYPE_SD 5 u8 host_num; /* attached to host 0, 1...*/ u16 addr; -- 1.7.2.3 --------------------------------------------------------------------- Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris, 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE Capital: 4,572,000 Euros This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. --------------------------------------------------------------------- Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris, 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE Capital: 4,572,000 Euros This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
0001-SFI-Add-SD-type-to-SFI-device-parsing.patch
Description: 0001-SFI-Add-SD-type-to-SFI-device-parsing.patch
_______________________________________________ MeeGo-kernel mailing list [email protected] http://lists.meego.com/listinfo/meego-kernel
