diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2016-07-12 07:16:32 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-07-13 03:24:51 -0400 |
commit | 05f310e26fe9d97fec0ce1752edc16bf1ea55a2d (patch) | |
tree | 943e59407a9ad949c75261e9d3540cc932b2dcf4 | |
parent | 707a605b5a1732e548f4ff51ccf0199a14d95f0f (diff) |
x86/sfi: Enable enumeration of SD devices
SFI specification v0.8.2 defines type of devices which are connected to
SD bus. In particularly WiFi dongle is a such.
Add a callback to enumerate the devices connected to SD bus.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1468322192-62080-1-git-send-email-andriy.shevchenko@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/include/asm/intel-mid.h | 15 | ||||
-rw-r--r-- | arch/x86/platform/intel-mid/sfi.c | 29 | ||||
-rw-r--r-- | include/linux/sfi.h | 1 |
3 files changed, 45 insertions, 0 deletions
diff --git a/arch/x86/include/asm/intel-mid.h b/arch/x86/include/asm/intel-mid.h index 59013a2ac713..9d6b097aa73d 100644 --- a/arch/x86/include/asm/intel-mid.h +++ b/arch/x86/include/asm/intel-mid.h | |||
@@ -49,6 +49,21 @@ struct devs_id { | |||
49 | static const struct devs_id *const __intel_mid_sfi_##i##_dev __used \ | 49 | static const struct devs_id *const __intel_mid_sfi_##i##_dev __used \ |
50 | __attribute__((__section__(".x86_intel_mid_dev.init"))) = &i | 50 | __attribute__((__section__(".x86_intel_mid_dev.init"))) = &i |
51 | 51 | ||
52 | /** | ||
53 | * struct mid_sd_board_info - template for SD device creation | ||
54 | * @name: identifies the driver | ||
55 | * @bus_num: board-specific identifier for a given SD controller | ||
56 | * @max_clk: the maximum frequency device supports | ||
57 | * @platform_data: the particular data stored there is driver-specific | ||
58 | */ | ||
59 | struct mid_sd_board_info { | ||
60 | char name[SFI_NAME_LEN]; | ||
61 | int bus_num; | ||
62 | unsigned short addr; | ||
63 | u32 max_clk; | ||
64 | void *platform_data; | ||
65 | }; | ||
66 | |||
52 | /* | 67 | /* |
53 | * Medfield is the follow-up of Moorestown, it combines two chip solution into | 68 | * Medfield is the follow-up of Moorestown, it combines two chip solution into |
54 | * one. Other than that it also added always-on and constant tsc and lapic | 69 | * one. Other than that it also added always-on and constant tsc and lapic |
diff --git a/arch/x86/platform/intel-mid/sfi.c b/arch/x86/platform/intel-mid/sfi.c index 5ee360a951ce..1555672d436f 100644 --- a/arch/x86/platform/intel-mid/sfi.c +++ b/arch/x86/platform/intel-mid/sfi.c | |||
@@ -407,6 +407,32 @@ static void __init sfi_handle_i2c_dev(struct sfi_device_table_entry *pentry, | |||
407 | i2c_register_board_info(pentry->host_num, &i2c_info, 1); | 407 | i2c_register_board_info(pentry->host_num, &i2c_info, 1); |
408 | } | 408 | } |
409 | 409 | ||
410 | static void __init sfi_handle_sd_dev(struct sfi_device_table_entry *pentry, | ||
411 | struct devs_id *dev) | ||
412 | { | ||
413 | struct mid_sd_board_info sd_info; | ||
414 | void *pdata; | ||
415 | |||
416 | memset(&sd_info, 0, sizeof(sd_info)); | ||
417 | strncpy(sd_info.name, pentry->name, SFI_NAME_LEN); | ||
418 | sd_info.bus_num = pentry->host_num; | ||
419 | sd_info.max_clk = pentry->max_freq; | ||
420 | sd_info.addr = pentry->addr; | ||
421 | pr_debug("SD bus = %d, name = %16.16s, max_clk = %d, addr = 0x%x\n", | ||
422 | sd_info.bus_num, | ||
423 | sd_info.name, | ||
424 | sd_info.max_clk, | ||
425 | sd_info.addr); | ||
426 | pdata = intel_mid_sfi_get_pdata(dev, &sd_info); | ||
427 | if (IS_ERR(pdata)) | ||
428 | return; | ||
429 | |||
430 | /* Nothing we can do with this for now */ | ||
431 | sd_info.platform_data = pdata; | ||
432 | |||
433 | pr_debug("Successfully registered %16.16s", sd_info.name); | ||
434 | } | ||
435 | |||
410 | extern struct devs_id *const __x86_intel_mid_dev_start[], | 436 | extern struct devs_id *const __x86_intel_mid_dev_start[], |
411 | *const __x86_intel_mid_dev_end[]; | 437 | *const __x86_intel_mid_dev_end[]; |
412 | 438 | ||
@@ -490,6 +516,9 @@ static int __init sfi_parse_devs(struct sfi_table_header *table) | |||
490 | case SFI_DEV_TYPE_I2C: | 516 | case SFI_DEV_TYPE_I2C: |
491 | sfi_handle_i2c_dev(pentry, dev); | 517 | sfi_handle_i2c_dev(pentry, dev); |
492 | break; | 518 | break; |
519 | case SFI_DEV_TYPE_SD: | ||
520 | sfi_handle_sd_dev(pentry, dev); | ||
521 | break; | ||
493 | case SFI_DEV_TYPE_UART: | 522 | case SFI_DEV_TYPE_UART: |
494 | case SFI_DEV_TYPE_HSI: | 523 | case SFI_DEV_TYPE_HSI: |
495 | default: | 524 | default: |
diff --git a/include/linux/sfi.h b/include/linux/sfi.h index d9b436f09925..e0e1597ef9e6 100644 --- a/include/linux/sfi.h +++ b/include/linux/sfi.h | |||
@@ -156,6 +156,7 @@ struct sfi_device_table_entry { | |||
156 | #define SFI_DEV_TYPE_UART 2 | 156 | #define SFI_DEV_TYPE_UART 2 |
157 | #define SFI_DEV_TYPE_HSI 3 | 157 | #define SFI_DEV_TYPE_HSI 3 |
158 | #define SFI_DEV_TYPE_IPC 4 | 158 | #define SFI_DEV_TYPE_IPC 4 |
159 | #define SFI_DEV_TYPE_SD 5 | ||
159 | 160 | ||
160 | u8 host_num; /* attached to host 0, 1...*/ | 161 | u8 host_num; /* attached to host 0, 1...*/ |
161 | u16 addr; | 162 | u16 addr; |