From: tip-bot for Kuppuswamy Sathyanarayanan <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
david.a.cohen@linux.intel.com,
sathyanarayanan.kuppuswamy@linux.intel.com, tglx@linutronix.de,
hpa@linux.intel.com
Subject: [tip:x86/intel-mid] intel_mid: Added custom handler for ipc devices
Date: Thu, 17 Oct 2013 11:19:33 -0700 [thread overview]
Message-ID: <tip-b8af4ddc1bab3dae75cef7a33a0170c5ab435fe2@git.kernel.org> (raw)
In-Reply-To: <1381896701-23476-9-git-send-email-david.a.cohen@linux.intel.com>
Commit-ID: b8af4ddc1bab3dae75cef7a33a0170c5ab435fe2
Gitweb: http://git.kernel.org/tip/b8af4ddc1bab3dae75cef7a33a0170c5ab435fe2
Author: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
AuthorDate: Tue, 15 Oct 2013 21:11:37 -0700
Committer: H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Wed, 16 Oct 2013 17:16:45 -0700
intel_mid: Added custom handler for ipc devices
Added a custom handler for medfield based ipc devices and
moved devs_id structure defintion to header file.
Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Link: http://lkml.kernel.org/r/1381896701-23476-9-git-send-email-david.a.cohen@linux.intel.com
Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
arch/x86/include/asm/intel-mid.h | 15 ++++++
arch/x86/platform/intel-mid/intel-mid.c | 82 ++++++++++++++++++++-------------
2 files changed, 66 insertions(+), 31 deletions(-)
diff --git a/arch/x86/include/asm/intel-mid.h b/arch/x86/include/asm/intel-mid.h
index beb7a5f..ad236ae 100644
--- a/arch/x86/include/asm/intel-mid.h
+++ b/arch/x86/include/asm/intel-mid.h
@@ -19,6 +19,21 @@ extern int sfi_mrtc_num;
extern struct sfi_rtc_table_entry sfi_mrtc_array[];
/*
+ * Here defines the array of devices platform data that IAFW would export
+ * through SFI "DEVS" table, we use name and type to match the device and
+ * its platform data.
+ */
+struct devs_id {
+ char name[SFI_NAME_LEN + 1];
+ u8 type;
+ u8 delay;
+ void *(*get_platform_data)(void *info);
+ /* Custom handler for devices */
+ void (*device_handler)(struct sfi_device_table_entry *pentry,
+ struct devs_id *dev);
+};
+
+/*
* Medfield is the follow-up of Moorestown, it combines two chip solution into
* one. Other than that it also added always-on and constant tsc and lapic
* timers. Medfield is the platform name, and the chip name is called Penwell
diff --git a/arch/x86/platform/intel-mid/intel-mid.c b/arch/x86/platform/intel-mid/intel-mid.c
index 7bfd784..40a3ff8 100644
--- a/arch/x86/platform/intel-mid/intel-mid.c
+++ b/arch/x86/platform/intel-mid/intel-mid.c
@@ -78,6 +78,8 @@ int sfi_mtimer_num;
struct sfi_rtc_table_entry sfi_mrtc_array[SFI_MRTC_MAX];
EXPORT_SYMBOL_GPL(sfi_mrtc_array);
int sfi_mrtc_num;
+static void __init ipc_device_handler(struct sfi_device_table_entry *pentry,
+ struct devs_id *dev);
static void intel_mid_power_off(void)
{
@@ -386,21 +388,6 @@ static int get_gpio_by_name(const char *name)
return -1;
}
-/*
- * Here defines the array of devices platform data that IAFW would export
- * through SFI "DEVS" table, we use name and type to match the device and
- * its platform data.
- */
-struct devs_id {
- char name[SFI_NAME_LEN + 1];
- u8 type;
- u8 delay;
- void *(*get_platform_data)(void *info);
- /* Custom handler for devices */
- void (*device_handler)(struct sfi_device_table_entry *pentry,
- struct devs_id *dev);
-};
-
/* the offset for the mapping of global gpio pin to irq */
#define INTEL_MID_IRQ_OFFSET 0x100
@@ -695,24 +682,24 @@ static void *tc35876x_platform_data(void *data)
static const struct devs_id __initconst device_ids[] = {
{"bma023", SFI_DEV_TYPE_I2C, 1, &no_platform_data, NULL},
{"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data, NULL},
- {"pmic_gpio", SFI_DEV_TYPE_IPC, 1, &pmic_gpio_platform_data, NULL},
+ {"pmic_gpio", SFI_DEV_TYPE_IPC, 1, &pmic_gpio_platform_data, &ipc_device_handler},
{"spi_max3111", SFI_DEV_TYPE_SPI, 0, &max3111_platform_data, NULL},
{"i2c_max7315", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data, NULL},
{"i2c_max7315_2", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data, NULL},
{"tca6416", SFI_DEV_TYPE_I2C, 1, &tca6416_platform_data, NULL},
{"emc1403", SFI_DEV_TYPE_I2C, 1, &emc1403_platform_data, NULL},
{"i2c_accel", SFI_DEV_TYPE_I2C, 0, &lis331dl_platform_data, NULL},
- {"pmic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data, NULL},
+ {"pmic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data, &ipc_device_handler},
{"mpu3050", SFI_DEV_TYPE_I2C, 1, &mpu3050_platform_data, NULL},
{"i2c_disp_brig", SFI_DEV_TYPE_I2C, 0, &tc35876x_platform_data, NULL},
/* MSIC subdevices */
- {"msic_battery", SFI_DEV_TYPE_IPC, 1, &msic_battery_platform_data, NULL},
- {"msic_gpio", SFI_DEV_TYPE_IPC, 1, &msic_gpio_platform_data, NULL},
- {"msic_audio", SFI_DEV_TYPE_IPC, 1, &msic_audio_platform_data, NULL},
- {"msic_power_btn", SFI_DEV_TYPE_IPC, 1, &msic_power_btn_platform_data, NULL},
- {"msic_ocd", SFI_DEV_TYPE_IPC, 1, &msic_ocd_platform_data, NULL},
- {"msic_thermal", SFI_DEV_TYPE_IPC, 1, &msic_thermal_platform_data, NULL},
+ {"msic_battery", SFI_DEV_TYPE_IPC, 1, &msic_battery_platform_data, &ipc_device_handler},
+ {"msic_gpio", SFI_DEV_TYPE_IPC, 1, &msic_gpio_platform_data, &ipc_device_handler},
+ {"msic_audio", SFI_DEV_TYPE_IPC, 1, &msic_audio_platform_data, &ipc_device_handler},
+ {"msic_power_btn", SFI_DEV_TYPE_IPC, 1, &msic_power_btn_platform_data, &ipc_device_handler},
+ {"msic_ocd", SFI_DEV_TYPE_IPC, 1, &msic_ocd_platform_data, &ipc_device_handler},
+ {"msic_thermal", SFI_DEV_TYPE_IPC, 1, &msic_thermal_platform_data, &ipc_device_handler},
{ 0 }
};
@@ -843,13 +830,6 @@ static void __init sfi_handle_ipc_dev(struct sfi_device_table_entry *pentry,
pentry->name, pentry->irq);
pdata = dev->get_platform_data(pentry);
- /*
- * On Medfield the platform device creation is handled by the MSIC
- * MFD driver so we don't need to do it here.
- */
- if (intel_mid_has_msic())
- return;
-
pdev = platform_device_alloc(pentry->name, 0);
if (pdev == NULL) {
pr_err("out of memory for SFI platform device '%s'.\n",
@@ -859,7 +839,7 @@ static void __init sfi_handle_ipc_dev(struct sfi_device_table_entry *pentry,
install_irq_resource(pdev, pentry->irq);
pdev->dev.platform_data = pdata;
- intel_scu_device_register(pdev);
+ platform_device_add(pdev);
}
static void __init sfi_handle_spi_dev(struct sfi_device_table_entry *pentry,
@@ -914,6 +894,46 @@ static void __init sfi_handle_i2c_dev(struct sfi_device_table_entry *pentry,
i2c_register_board_info(pentry->host_num, &i2c_info, 1);
}
+static void __init ipc_device_handler(struct sfi_device_table_entry *pentry,
+ struct devs_id *dev)
+{
+ struct platform_device *pdev;
+ void *pdata = NULL;
+ static struct resource res __initdata = {
+ .name = "IRQ",
+ .flags = IORESOURCE_IRQ,
+ };
+
+ pr_debug("IPC bus, name = %16.16s, irq = 0x%2x\n",
+ pentry->name, pentry->irq);
+
+ /*
+ * We need to call platform init of IPC devices to fill misc_pdata
+ * structure. It will be used in msic_init for initialization.
+ */
+ if (dev != NULL)
+ pdata = dev->get_platform_data(pentry);
+
+ /*
+ * On Medfield the platform device creation is handled by the MSIC
+ * MFD driver so we don't need to do it here.
+ */
+ if (intel_mid_has_msic())
+ return;
+
+ pdev = platform_device_alloc(pentry->name, 0);
+ if (pdev == NULL) {
+ pr_err("out of memory for SFI platform device '%s'.\n",
+ pentry->name);
+ return;
+ }
+ res.start = pentry->irq;
+ platform_device_add_resources(pdev, &res, 1);
+
+ pdev->dev.platform_data = pdata;
+ intel_scu_device_register(pdev);
+}
+
static struct devs_id __init *get_device_id(u8 type, char *name)
{
struct devs_id *dev = device_ids;
next prev parent reply other threads:[~2013-10-17 18:19 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-16 4:11 [PATCH v5 00/12] rework arch/x86/platform/[mrst => intel-mid] David Cohen
2013-10-16 4:11 ` [PATCH v5 01/12] mrst: Fixed printk/pr_* related issues David Cohen
2013-10-17 18:18 ` [tip:x86/intel-mid] " tip-bot for Kuppuswamy Sathyanarayanan
2013-10-16 4:11 ` [PATCH v5 02/12] mrst: Fixed indentation issues David Cohen
2013-10-17 18:18 ` [tip:x86/intel-mid] " tip-bot for Kuppuswamy Sathyanarayanan
2013-10-16 4:11 ` [PATCH v5 03/12] mrst: Fixed checkpatch warnings David Cohen
2013-10-17 18:18 ` [tip:x86/intel-mid] " tip-bot for Kuppuswamy Sathyanarayanan
2013-10-16 4:11 ` [PATCH v5 04/12] intel_mid: Renamed *mrst* to *intel_mid* David Cohen
2013-10-17 18:18 ` [tip:x86/intel-mid] " tip-bot for Kuppuswamy Sathyanarayanan
2013-10-16 4:11 ` [PATCH v5 05/12] " David Cohen
2013-10-17 18:19 ` [tip:x86/intel-mid] " tip-bot for Kuppuswamy Sathyanarayanan
2013-10-16 4:11 ` [PATCH v5 06/12] intel_mid: Refactored sfi_parse_devs() function David Cohen
2013-10-17 18:19 ` [tip:x86/intel-mid] " tip-bot for Kuppuswamy Sathyanarayanan
2013-10-16 4:11 ` [PATCH v5 07/12] intel_mid: Added custom device_handler support David Cohen
2013-10-17 18:19 ` [tip:x86/intel-mid] " tip-bot for Kuppuswamy Sathyanarayanan
2013-10-16 4:11 ` [PATCH v5 08/12] intel_mid: Added custom handler for ipc devices David Cohen
2013-10-17 18:19 ` tip-bot for Kuppuswamy Sathyanarayanan [this message]
2013-10-16 4:11 ` [PATCH v5 09/12] intel_mid: Moved SFI related code to sfi.c David Cohen
2013-10-17 18:19 ` [tip:x86/intel-mid] " tip-bot for Kuppuswamy Sathyanarayanan
2013-10-16 4:11 ` [PATCH v5 10/12] intel-mid: sfi: allow struct devs_id.get_platform_data to be NULL David Cohen
2013-10-17 18:19 ` [tip:x86/intel-mid] " tip-bot for David Cohen
2013-10-16 4:11 ` [PATCH v5 11/12] x86: intel-mid: add section for sfi device table David Cohen
2013-10-17 18:20 ` [tip:x86/intel-mid] " tip-bot for David Cohen
2013-10-16 4:11 ` [PATCH v5 12/12] intel_mid: Moved board related code to a new file David Cohen
2013-10-16 23:13 ` [PATCH v6 " David Cohen
2013-10-16 23:45 ` [PATCH v7 12/12] intel_mid: move board related code to their own platform_<device>.* files David Cohen
2013-10-17 2:36 ` [PATCH v8 12/12] intel_mid: move board related codes " David Cohen
2013-10-17 18:20 ` [tip:x86/intel-mid] intel_mid: move platform device definitions " tip-bot for David Cohen
-- strict thread matches above, loose matches on Subject: below --
2013-10-17 22:35 [PATCH v10 08/12] intel_mid: Added custom handler for ipc devices David Cohen
2013-10-18 0:34 ` [tip:x86/intel-mid] " tip-bot for Kuppuswamy Sathyanarayanan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-b8af4ddc1bab3dae75cef7a33a0170c5ab435fe2@git.kernel.org \
--to=tipbot@zytor.com \
--cc=david.a.cohen@linux.intel.com \
--cc=hpa@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=sathyanarayanan.kuppuswamy@linux.intel.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox