mrst refactoring patches
Subsystems (12)
cover mrst refactoring patches
As Intel rolling out more SoC's after Moorestown, we need to re-structure the code in a way that is backward compatible and easy to expand.This patch set implements a flexible way to support multiple boards and devices.
Patch 1 - 5 fixes some indentation issue, compiler warnings and renames. Patch 6 - 13 refactors mrst code.
Andy Shevchenko (2):
sfi: fix compiler warnings
gpiolib: append SFI helpers for GPIO API
Sathyanarayanan Kuppuswamy (11):
mrst: Fixed printk/pr_* related issues
mrst: Fixed indentation issues
mrst: Fixed checkpatch warnings
intel_mid: Renamed *mrst* to *intel_mid*
intel_mid: Renamed *mrst* to *intel_mid*
intel_mid: Refactored sfi_parse_devs() function
intel_mid: Added custom device_handler support
intel_mid: Added custom handler for ipc devices
intel_mid: Moved board related code to a new file
intel_mid: Moved SFI related code to intel_mid_sfi.c
x86: mrst: move to generic SFI GPIO API
Documentation/kernel-parameters.txt | 6 +-
arch/x86/include/asm/{mrst.h => intel-mid.h} | 62 +-
.../include/asm/{mrst-vrtc.h => intel_mid_vrtc.h} | 4 +-
arch/x86/include/asm/setup.h | 4 +-
arch/x86/include/uapi/asm/bootparam.h | 2 +-
arch/x86/kernel/apb_timer.c | 10 +-
arch/x86/kernel/early_printk.c | 2 +-
arch/x86/kernel/head32.c | 4 +-
arch/x86/kernel/rtc.c | 4 +-
arch/x86/pci/Makefile | 2 +-
arch/x86/pci/{mrst.c => intel_mid_pci.c} | 22 +-
arch/x86/platform/Makefile | 2 +-
arch/x86/platform/intel-mid/Makefile | 9 +
arch/x86/platform/intel-mid/board.c | 109 ++
arch/x86/platform/intel-mid/device_libs/Makefile | 21 +
.../intel-mid/device_libs/platform_emc1403.c | 33 +
.../intel-mid/device_libs/platform_emc1403.h | 16 +
.../intel-mid/device_libs/platform_gpio_keys.c | 82 ++
.../intel-mid/device_libs/platform_gpio_keys.h | 16 +
.../platform/intel-mid/device_libs/platform_ipc.c | 59 ++
.../platform/intel-mid/device_libs/platform_ipc.h | 17 +
.../intel-mid/device_libs/platform_lis331.c | 32 +
.../intel-mid/device_libs/platform_lis331.h | 16 +
.../intel-mid/device_libs/platform_max3111.c | 28 +
.../intel-mid/device_libs/platform_max3111.h | 16 +
.../intel-mid/device_libs/platform_max7315.c | 62 ++
.../intel-mid/device_libs/platform_max7315.h | 19 +
.../intel-mid/device_libs/platform_mpu3050.c | 28 +
.../intel-mid/device_libs/platform_mpu3050.h | 16 +
.../platform/intel-mid/device_libs/platform_msic.c | 87 ++
.../platform/intel-mid/device_libs/platform_msic.h | 19 +
.../intel-mid/device_libs/platform_msic_audio.c | 36 +
.../intel-mid/device_libs/platform_msic_audio.h | 16 +
.../intel-mid/device_libs/platform_msic_battery.c | 26 +
.../intel-mid/device_libs/platform_msic_battery.h | 17 +
.../intel-mid/device_libs/platform_msic_gpio.c | 37 +
.../intel-mid/device_libs/platform_msic_gpio.h | 16 +
.../intel-mid/device_libs/platform_msic_ocd.c | 39 +
.../intel-mid/device_libs/platform_msic_ocd.h | 16 +
.../device_libs/platform_msic_power_btn.c | 25 +
.../device_libs/platform_msic_power_btn.h | 17 +
.../intel-mid/device_libs/platform_msic_thermal.c | 26 +
.../intel-mid/device_libs/platform_msic_thermal.h | 17 +
.../intel-mid/device_libs/platform_pmic_gpio.c | 36 +
.../intel-mid/device_libs/platform_pmic_gpio.h | 16 +
.../intel-mid/device_libs/platform_tc35876x.c | 29 +
.../intel-mid/device_libs/platform_tc35876x.h | 16 +
.../intel-mid/device_libs/platform_tca6416.c | 45 +
.../intel-mid/device_libs/platform_tca6416.h | 20 +
.../early_printk_intel_mid.c} | 11 +-
arch/x86/platform/intel-mid/intel-mid.c | 213 ++++
arch/x86/platform/intel-mid/intel_mid_sfi.c | 434 ++++++++
.../{mrst/vrtc.c => intel-mid/intel_mid_vrtc.c} | 21 +-
arch/x86/platform/intel-mid/intel_mid_weak_decls.h | 15 +
arch/x86/platform/mrst/Makefile | 3 -
arch/x86/platform/mrst/mrst.c | 1052 --------------------
drivers/gpio/Kconfig | 4 +
drivers/gpio/Makefile | 1 +
drivers/gpio/gpiolib-sfi.c | 76 ++
drivers/gpu/drm/gma500/mdfld_dsi_output.h | 2 +-
drivers/gpu/drm/gma500/oaktrail_device.c | 2 +-
drivers/gpu/drm/gma500/oaktrail_lvds.c | 2 +-
drivers/platform/x86/intel_scu_ipc.c | 4 +-
drivers/rtc/rtc-mrst.c | 4 +-
drivers/sfi/sfi_core.c | 11 +-
drivers/watchdog/intel_scu_watchdog.c | 4 +-
include/linux/sfi_gpio.h | 27 +
67 files changed, 2015 insertions(+), 1130 deletions(-)
rename arch/x86/include/asm/{mrst.h => intel-mid.h} (50%)
rename arch/x86/include/asm/{mrst-vrtc.h => intel_mid_vrtc.h} (81%)
rename arch/x86/pci/{mrst.c => intel_mid_pci.c} (95%)
create mode 100644 arch/x86/platform/intel-mid/Makefile
create mode 100644 arch/x86/platform/intel-mid/board.c
create mode 100644 arch/x86/platform/intel-mid/device_libs/Makefile
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_emc1403.c
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_emc1403.h
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.h
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_ipc.c
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_ipc.h
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_lis331.c
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_lis331.h
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_max3111.c
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_max3111.h
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_max7315.c
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_max7315.h
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_mpu3050.c
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_mpu3050.h
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic.c
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic.h
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_audio.c
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_audio.h
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_battery.c
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_battery.h
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.c
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.h
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.c
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.h
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.c
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.h
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.c
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.h
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.c
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.h
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_tc35876x.c
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_tc35876x.h
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_tca6416.c
create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_tca6416.h
rename arch/x86/platform/{mrst/early_printk_mrst.c => intel-mid/early_printk_intel_mid.c} (97%)
create mode 100644 arch/x86/platform/intel-mid/intel-mid.c
create mode 100644 arch/x86/platform/intel-mid/intel_mid_sfi.c
rename arch/x86/platform/{mrst/vrtc.c => intel-mid/intel_mid_vrtc.c} (90%)
create mode 100644 arch/x86/platform/intel-mid/intel_mid_weak_decls.h
delete mode 100644 arch/x86/platform/mrst/Makefile
delete mode 100644 arch/x86/platform/mrst/mrst.c
create mode 100644 drivers/gpio/gpiolib-sfi.c
create mode 100644 include/linux/sfi_gpio.hSignature · 1 line
1.7.9.5
PATCH 1/13 mrst: Fixed printk/pr_* related issues
Fixed printk and pr_* related issues in mrst related files.
--- arch/x86/pci/mrst.c | 2 +- arch/x86/platform/mrst/early_printk_mrst.c | 2 +- arch/x86/platform/mrst/mrst.c | 2 +- arch/x86/platform/mrst/vrtc.c | 5 ++--- 4 files changed, 5 insertions(+), 6 deletions(-)
arch/x86/pci/mrst.c +1 -1
@@ -235,7 +235,7 @@ struct pci_ops pci_mrst_ops = {*/ int __init pci_mrst_init (void ) { -printk (KERN_INFO "Intel MID platform detected, using MID PCI ops\n" ); +pr_info ("Intel MID platform detected, using MID PCI ops\n" );pci_mmcfg_late_init (); pcibios_enable_irq = mrst_pci_irq_enable; pci_root_ops = pci_mrst_ops;
arch/x86/platform/mrst/early_printk_mrst.c +1 -1
@@ -213,7 +213,7 @@ static void early_mrst_spi_putc(char c) }if (!timeout) -pr_warning ("MRST earlycon: timed out\n" ); +pr_warn ("MRST earlycon: timed out\n" );else max3110_write_data (c); }
arch/x86/platform/mrst/mrst.c +1 -1
@@ -328,7 +328,7 @@ static inline int __init setup_x86_mrst_timer(char *arg)else if (strcmp ("lapic_and_apbt" , arg) ==0 ) mrst_timer_options =MRST_TIMER_LAPIC_APBT ;else { -pr_warning ("X86 MRST timer option %s not recognised" +pr_warn ("X86 MRST timer option %s not recognised" " use x86_mrst_timer=apbt_only or lapic_and_apbt\n" , arg);return -EINVAL ;
arch/x86/platform/mrst/vrtc.c +2 -3
@@ -79,7 +79,7 @@ unsigned long vrtc_get_time(void)/* vRTC YEAR reg contains the offset to 1972 */ year +=1972 ; -printk (KERN_INFO "vRTC: sec: %d min: %d hour: %d day: %d " +pr_info ("vRTC: sec: %d min: %d hour: %d day: %d " "mon: %d year: %d\n" , sec, min, hour, mday, mon, year);return mktime (year, mon, mday, hour, min, sec);
@@ -108,8 +108,7 @@ int vrtc_set_mmss(unsigned long nowtime)vrtc_cmos_write (tm.tm_sec,RTC_SECONDS );spin_unlock_irqrestore (&rtc_lock, flags); }else { -printk (KERN_ERR -"%s: Invalid vRTC value: write of %lx to vRTC failed\n" , +pr_err ("%s: Invalid vRTC value: write of %lx to vRTC failed\n" , __FUNCTION__, nowtime); retval = -EINVAL ; }
Signature · 1 line
1.7.9.5
PATCH 2/13 mrst: Fixed indentation issues
In reply to Sathyanarayanan KuppuswamyFixed indentation issues reported by checkpatch script in mrst related files.
--- arch/x86/pci/mrst.c | 4 ++-- arch/x86/platform/mrst/early_printk_mrst.c | 3 ++- arch/x86/platform/mrst/mrst.c | 24 +++++++++++++----------- 3 files changed, 17 insertions(+), 14 deletions(-)
arch/x86/pci/mrst.c +2 -2
@@ -251,8 +251,8 @@ static void pci_d3delay_fixup(struct pci_dev *dev) {/* PCI fixups are effectively decided compile time. If we have a dual SoC/non-SoC kernel we don't want to mangle d3 on non SoC devices */ -if (!pci_soc_mode) -return ; +if (!pci_soc_mode) +return ;/* true pci devices in lincroft should allow type 1 access, the rest * are langwell fake pci devices. */
arch/x86/platform/mrst/early_printk_mrst.c +2 -1
@@ -219,7 +219,8 @@ static void early_mrst_spi_putc(char c) }/* Early SPI only uses polling mode */ -static void early_mrst_spi_write (struct console *con,const char *str,unsigned n) +static void early_mrst_spi_write (struct console *con,const char *str, +unsigned n) {int i;
arch/x86/platform/mrst/mrst.c +13 -11
@@ -131,7 +131,7 @@ struct sfi_timer_table_entry *sfi_get_mtmr(int hint)int i;if (hint < sfi_mtimer_num) {if (!sfi_mtimer_usage[hint]) { -pr_debug ("hint taken for timer %d irq %d\n" ,\ +pr_debug ("hint taken for timer %d irq %d\n" , hint, sfi_mtimer_array[hint].irq); sfi_mtimer_usage[hint] =1 ;return &sfi_mtimer_array[hint];
@@ -679,14 +679,14 @@ static void *msic_thermal_platform_data(void *info)/* tc35876x DSI-LVDS bridge chip and panel platform data */ static void *tc35876x_platform_data (void *data) { -static struct tc35876x_platform_data pdata; +static struct tc35876x_platform_data pdata; -/* gpio pins set to -1 will not be used by the driver */ - pdata.gpio_bridge_reset =get_gpio_by_name ("LCMB_RXEN" ); - pdata.gpio_panel_bl_en =get_gpio_by_name ("6S6P_BL_EN" ); - pdata.gpio_panel_vadd =get_gpio_by_name ("EN_VREG_LCD_V3P3" ); +/* gpio pins set to -1 will not be used by the driver */ + pdata.gpio_bridge_reset =get_gpio_by_name ("LCMB_RXEN" ); + pdata.gpio_panel_bl_en =get_gpio_by_name ("6S6P_BL_EN" ); + pdata.gpio_panel_vadd =get_gpio_by_name ("EN_VREG_LCD_V3P3" ); -return &pdata; +return &pdata; }static const struct devs_id __initconst device_ids[] = {
@@ -729,7 +729,7 @@ static int i2c_next_dev;static void __init intel_scu_device_register (struct platform_device *pdev) { -if (ipc_next_dev ==MAX_IPCDEVS ) +if (ipc_next_dev ==MAX_IPCDEVS )pr_err ("too many SCU IPC devices" );else ipc_devs[ipc_next_dev++] = pdev;
@@ -872,7 +872,8 @@ static void __init sfi_handle_spi_dev(struct spi_board_info *spi_info)while (dev->name[0 ]) {if (dev->type ==SFI_DEV_TYPE_SPI && - !strncmp (dev->name, spi_info->modalias,SFI_NAME_LEN )) { + !strncmp (dev->name, spi_info->modalias, +SFI_NAME_LEN )) { pdata = dev->get_platform_data (spi_info);break ; }
@@ -904,7 +905,7 @@ static void __init sfi_handle_i2c_dev(int bus, struct i2c_board_info *i2c_info)intel_scu_i2c_device_register (bus, i2c_info); else i2c_register_board_info(bus, i2c_info, 1); - } +} static int __init sfi_parse_devs(struct sfi_table_header *table)
@@ -1034,7 +1035,8 @@ static int __init pb_keys_init(void) num =sizeof (gpio_button) /sizeof (struct gpio_keys_button );for (i =0 ; i < num; i++) { gb[i].gpio =get_gpio_by_name (gb[i].desc); -pr_debug ("info[%2d]: name = %s, gpio = %d\n" , i, gb[i].desc, gb[i].gpio); +pr_debug ("info[%2d]: name = %s, gpio = %d\n" , i, gb[i].desc, + gb[i].gpio);if (gb[i].gpio ==-1 )continue ;
Signature · 1 line
1.7.9.5
PATCH 3/13 mrst: Fixed checkpatch warnings
In reply to Sathyanarayanan KuppuswamyFixed checkpatch warnings in mrst related files.
--- arch/x86/pci/mrst.c | 2 +- arch/x86/platform/mrst/mrst.c | 2 +- arch/x86/platform/mrst/vrtc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/pci/mrst.c +1 -1
@@ -43,7 +43,7 @@#define PCI_FIXED_BAR_4_SIZE 0x14#define PCI_FIXED_BAR_5_SIZE 0x1c -static int pci_soc_mode =0 ; +static int pci_soc_mode;/** * fixed_bar_cap - return the offset of the fixed BAR cap if found
arch/x86/platform/mrst/mrst.c +1 -1
@@ -977,7 +977,7 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)case SFI_DEV_TYPE_UART :case SFI_DEV_TYPE_HSI :default : - ; +break ; } }return 0 ;
arch/x86/platform/mrst/vrtc.c +1 -1
@@ -109,7 +109,7 @@ int vrtc_set_mmss(unsigned long nowtime)spin_unlock_irqrestore (&rtc_lock, flags); }else {pr_err ("%s: Invalid vRTC value: write of %lx to vRTC failed\n" , - __FUNCTION__, nowtime); + __func__, nowtime); retval = -EINVAL ; }return retval;
Signature · 1 line
1.7.9.5
PATCH 4/13 intel_mid: Renamed *mrst* to *intel_mid*
In reply to Sathyanarayanan KuppuswamyFollowing files contains code that is common to all intel mid soc's. So renamed them as below.
mrst/mrst.c -> intel-mid/intel-mid.cmrst/vrtc.c -> intel-mid/intel_mid_vrtc.cmrst/early_printk_mrst.c -> intel-mid/intel_mid_vrtc.cpci/mrst.c -> pci/intel_mid_pci.c
Also, renamed the corresponding header files and made changes to the driver files that included these header files.
To ensure that there are no functional changes, I have compared the objdump of renamed files before and after rename and found that the only difference is file name change.
---
arch/x86/include/asm/{mrst.h => intel-mid.h} | 8 ++++----
.../include/asm/{mrst-vrtc.h => intel_mid_vrtc.h} | 4 ++--
arch/x86/kernel/apb_timer.c | 2 +-
arch/x86/kernel/early_printk.c | 2 +-
arch/x86/kernel/rtc.c | 2 +-
arch/x86/pci/Makefile | 2 +-
arch/x86/pci/{mrst.c => intel_mid_pci.c} | 2 +-
arch/x86/platform/Makefile | 2 +-
arch/x86/platform/intel-mid/Makefile | 3 +++
.../early_printk_intel_mid.c} | 4 ++--
.../{mrst/mrst.c => intel-mid/intel-mid.c} | 11 ++++++-----
.../{mrst/vrtc.c => intel-mid/intel_mid_vrtc.c} | 6 +++---
arch/x86/platform/mrst/Makefile | 3 ---
drivers/gpu/drm/gma500/mdfld_dsi_output.h | 2 +-
drivers/gpu/drm/gma500/oaktrail_device.c | 2 +-
drivers/gpu/drm/gma500/oaktrail_lvds.c | 2 +-
drivers/platform/x86/intel_scu_ipc.c | 2 +-
drivers/rtc/rtc-mrst.c | 4 ++--
drivers/watchdog/intel_scu_watchdog.c | 2 +-
19 files changed, 33 insertions(+), 32 deletions(-)
rename arch/x86/include/asm/{mrst.h => intel-mid.h} (93%)
rename arch/x86/include/asm/{mrst-vrtc.h => intel_mid_vrtc.h} (81%)
rename arch/x86/pci/{mrst.c => intel_mid_pci.c} (99%)
create mode 100644 arch/x86/platform/intel-mid/Makefile
rename arch/x86/platform/{mrst/early_printk_mrst.c => intel-mid/early_printk_intel_mid.c} (98%)
rename arch/x86/platform/{mrst/mrst.c => intel-mid/intel-mid.c} (99%)
rename arch/x86/platform/{mrst/vrtc.c => intel-mid/intel_mid_vrtc.c} (96%)
delete mode 100644 arch/x86/platform/mrst/Makefilearch/x86/include/asm/intel-mid.h renamed from arch/x86/include/asm/mrst.h +4 -4
@@ -1,5 +1,5 @@/* -* mrst.h: Intel Moorestown platform specific setup code +* intel-mid.h: Intel MID specific setup code * * (C) Copyright 2009 Intel Corporation *
@@ -8,8 +8,8 @@* as published by the Free Software Foundation; version 2 * of the License. */ -#ifndef _ASM_X86_MRST_H -#define _ASM_X86_MRST_H +#ifndef _ASM_X86_INTEL_MID_H +#define _ASM_X86_INTEL_MID_H#include <linux/sfi.h>
@@ -78,4 +78,4 @@ extern void intel_scu_devices_destroy(void);extern void mrst_rtc_init (void ); -#endif /* _ASM_X86_MRST_H */ +#endif /* _ASM_X86_INTEL_MID_H */
arch/x86/include/asm/intel_mid_vrtc.h renamed from arch/x86/include/asm/mrst-vrtc.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef _MRST_VRTC_H -#define _MRST_VRTC_H +#ifndef _INTEL_MID_VRTC_H +#define _INTEL_MID_VRTC_Hextern unsigned char vrtc_cmos_read (unsigned char reg);extern void vrtc_cmos_write (unsigned char val,unsigned char reg);
arch/x86/kernel/apb_timer.c +1 -1
@@ -40,7 +40,7 @@#include <asm/fixmap.h> #include <asm/apb_timer.h> -#include <asm/mrst.h> +#include <asm/intel-mid.h> #include <asm/time.h> #define APBT_CLOCKEVENT_RATING 110
arch/x86/kernel/early_printk.c +1 -1
@@ -14,7 +14,7 @@#include <xen/hvc-console.h> #include <asm/pci-direct.h> #include <asm/fixmap.h> -#include <asm/mrst.h> +#include <asm/intel-mid.h> #include <asm/pgtable.h> #include <linux/usb/ehci_def.h>
arch/x86/kernel/rtc.c +1 -1
@@ -12,7 +12,7 @@#include <asm/vsyscall.h> #include <asm/x86_init.h> #include <asm/time.h> -#include <asm/mrst.h> +#include <asm/intel-mid.h> #include <asm/rtc.h> #ifdef CONFIG_X86_32
arch/x86/pci/Makefile +1 -1
@@ -18,7 +18,7 @@ obj-$(CONFIG_X86_VISWS) += visws.o obj-$(CONFIG_X86_NUMAQ) += numaq_32.o obj-$(CONFIG_X86_NUMACHIP) += numachip.o -obj-$(CONFIG_X86_INTEL_MID) += mrst.o +obj-$(CONFIG_X86_INTEL_MID) += intel_mid_pci.o obj-y += common.o early.o obj-y += bus_numa.o
arch/x86/pci/intel_mid_pci.c renamed from arch/x86/pci/mrst.c +1 -1
@@ -1,5 +1,5 @@/* -* Moorestown PCI support +* Intel MID PCI support * Copyright (c) 2008 Intel Corporation * Jesse Barnes <[email protected]> *
arch/x86/platform/Makefile +1 -1
@@ -4,7 +4,7 @@ obj-y += efi/ obj-y += geode/ obj-y += goldfish/ obj-y += iris/ -obj-y += mrst/ +obj-y += intel-mid/ obj-y += olpc/ obj-y += scx200/ obj-y += sfi/
arch/x86/platform/intel-mid/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +obj-$(CONFIG_X86_INTEL_MID) += intel-mid.o +obj-$(CONFIG_X86_INTEL_MID) += intel_mid_vrtc.o +obj-$(CONFIG_EARLY_PRINTK_INTEL_MID) += early_printk_intel_mid.o
arch/x86/platform/intel-mid/early_printk_intel_mid.c renamed from arch/x86/platform/mrst/early_printk_mrst.c +2 -2
@@ -1,5 +1,5 @@/* -* early_printk_mrst.c - early consoles for Intel MID platforms +* early_printk_intel_mid.c - early consoles for Intel MID platforms * * Copyright (c) 2008-2010, Intel Corporation *
@@ -27,7 +27,7 @@#include <asm/fixmap.h> #include <asm/pgtable.h> -#include <asm/mrst.h> +#include <asm/intel-mid.h> #define MRST_SPI_TIMEOUT 0x200000#define MRST_REGBASE_SPI0 0xff128000
arch/x86/platform/intel-mid/intel-mid.c renamed from arch/x86/platform/mrst/mrst.c +6 -5
@@ -1,8 +1,9 @@/* -* mrst.c: Intel Moorestown platform specific setup code +* intel-mid.c: Intel MID platform setup code * -* (C) Copyright 2008 Intel Corporation +* (C) Copyright 2008, 2012 Intel Corporation * Author: Jacob Pan ([email protected]) +* Author: Sathyanarayanan Kuppuswamy <[email protected]> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License
@@ -36,8 +37,8 @@#include <asm/hw_irq.h> #include <asm/apic.h> #include <asm/io_apic.h> -#include <asm/mrst.h> -#include <asm/mrst-vrtc.h> +#include <asm/intel-mid.h> +#include <asm/intel_mid_vrtc.h> #include <asm/io.h> #include <asm/i8259.h> #include <asm/intel_scu_ipc.h>
@@ -219,7 +220,7 @@ static unsigned long __init mrst_calibrate_tsc(void) lapic_timer_frequency = fsb *1000 /HZ ;/* mark tsc clocksource as reliable */ set_cpu_cap (&boot_cpu_data,X86_FEATURE_TSC_RELIABLE ); - +if (fast_calibrate)return fast_calibrate;
arch/x86/platform/intel-mid/intel_mid_vrtc.c renamed from arch/x86/platform/mrst/vrtc.c +3 -3
@@ -1,5 +1,5 @@/* -* vrtc.c: Driver for virtual RTC device on Intel MID platform +* intel_mid_vrtc.c: Driver for virtual RTC device on Intel MID platform * * (C) Copyright 2009 Intel Corporation *
@@ -23,8 +23,8 @@#include <linux/sfi.h> #include <linux/platform_device.h> -#include <asm/mrst.h> -#include <asm/mrst-vrtc.h> +#include <asm/intel-mid.h> +#include <asm/intel_mid_vrtc.h> #include <asm/time.h> #include <asm/fixmap.h>
arch/x86/platform/mrst/Makefile deleted +0 -3
@@ -1,3 +0,0 @@ -obj-$(CONFIG_X86_INTEL_MID) += mrst.o -obj-$(CONFIG_X86_INTEL_MID) += vrtc.o -obj-$(CONFIG_EARLY_PRINTK_INTEL_MID) += early_printk_mrst.o
drivers/gpu/drm/gma500/mdfld_dsi_output.h +1 -1
@@ -39,7 +39,7 @@#include "psb_intel_reg.h" #include "mdfld_output.h" -#include <asm/mrst.h> +#include <asm/intel-mid.h> #define FLD_MASK (start, end) (((1 << ((start) - (end) + 1)) - 1) << (end))#define FLD_VAL (val, start, end) (((val) << (end)) & FLD_MASK(start, end))
drivers/gpu/drm/gma500/oaktrail_device.c +1 -1
@@ -26,7 +26,7 @@#include "psb_drv.h" #include "psb_reg.h" #include "psb_intel_reg.h" -#include <asm/mrst.h> +#include <asm/intel-mid.h> #include <asm/intel_scu_ipc.h> #include "mid_bios.h" #include "intel_bios.h"
drivers/gpu/drm/gma500/oaktrail_lvds.c +1 -1
@@ -22,7 +22,7 @@#include <linux/i2c.h> #include <drm/drmP.h> -#include <asm/mrst.h> +#include <asm/intel-mid.h> #include "intel_bios.h" #include "psb_drv.h"
drivers/platform/x86/intel_scu_ipc.c +1 -1
@@ -25,7 +25,7 @@#include <linux/interrupt.h> #include <linux/sfi.h> #include <linux/module.h> -#include <asm/mrst.h> +#include <asm/intel-mid.h> #include <asm/intel_scu_ipc.h> /* IPC defines the following message types */
drivers/rtc/rtc-mrst.c +2 -2
@@ -38,8 +38,8 @@#include <asm-generic/rtc.h> #include <asm/intel_scu_ipc.h> -#include <asm/mrst.h> -#include <asm/mrst-vrtc.h> +#include <asm/intel-mid.h> +#include <asm/intel_mid_vrtc.h> struct mrst_rtc {struct rtc_device *rtc;
drivers/watchdog/intel_scu_watchdog.c +1 -1
@@ -48,7 +48,7 @@#include <linux/atomic.h> #include <asm/intel_scu_ipc.h> #include <asm/apb_timer.h> -#include <asm/mrst.h> +#include <asm/intel-mid.h> #include "intel_scu_watchdog.h"
Signature · 1 line
1.7.9.5
PATCH 5/13 intel_mid: Renamed *mrst* to *intel_mid*
In reply to Sathyanarayanan Kuppuswamymrst is used as common name to represent all intel_mid type soc's. But moorsetwon is just one of the intel_mid soc. So renamed them to use intel_mid.
This patch mainly renames the variables and related functions that uses *mrst* prefix with *intel_mid*.
To ensure that there are no functional changes, I have compared the objdump of related files before and after rename and found the only difference is symbol and name changes.
--- Documentation/kernel-parameters.txt | 6 +- arch/x86/include/asm/intel-mid.h | 26 ++--- arch/x86/include/asm/setup.h | 4 +- arch/x86/include/uapi/asm/bootparam.h | 2 +- arch/x86/kernel/apb_timer.c | 8 +- arch/x86/kernel/head32.c | 4 +- arch/x86/kernel/rtc.c | 2 +- arch/x86/pci/intel_mid_pci.c | 12 +-- .../platform/intel-mid/early_printk_intel_mid.c | 2 +- arch/x86/platform/intel-mid/intel-mid.c | 109 ++++++++++---------- arch/x86/platform/intel-mid/intel_mid_vrtc.c | 8 +- drivers/platform/x86/intel_scu_ipc.c | 2 +- drivers/watchdog/intel_scu_watchdog.c | 2 +- 13 files changed, 93 insertions(+), 94 deletions(-)
Documentation/kernel-parameters.txt +3 -3
@@ -3345,11 +3345,11 @@ bytes respectively. Such letter suffixes can also be entirely omitted. default x2apic cluster mode on platforms supporting x2apic. - x86_mrst_timer= [X86-32,APBT] - Choose timer option for x86 Moorestown MID platform. + x86_intel_mid_timer= [X86-32,APBT] + Choose timer option for x86 Intel MID platform. Two valid options are apbt timer only and lapic timer plus one apbt timer for broadcast timer. - x86_mrst_timer=apbt_only | lapic_and_apbt + x86_intel_mid_timer=apbt_only | lapic_and_apbt xd= [HW,XT] Original XT pre-IDE (RLL encoded) disks. xd_geo= See header of drivers/block/xd.c.
arch/x86/include/asm/intel-mid.h +13 -13
@@ -13,7 +13,7 @@#include <linux/sfi.h> -extern int pci_mrst_init (void ); +extern int intel_mid_pci_init (void );extern int __init sfi_parse_mrtc (struct sfi_table_header *table);extern int sfi_mrtc_num;extern struct sfi_rtc_table_entry sfi_mrtc_array[];
@@ -25,33 +25,33 @@ extern struct sfi_rtc_table_entry sfi_mrtc_array[];* we treat Medfield/Penwell as a variant of Moorestown. Penwell can be * identified via MSRs. */ -enum mrst_cpu_type { +enum intel_mid_cpu_type {/* 1 was Moorestown */ -MRST_CPU_CHIP_PENWELL =2 , +INTEL_MID_CPU_CHIP_PENWELL =2 , }; -extern enum mrst_cpu_type __mrst_cpu_chip; +extern enum intel_mid_cpu_type __intel_mid_cpu_chip;#ifdef CONFIG_X86_INTEL_MID -static inline enum mrst_cpu_type mrst_identify_cpu (void ) +static inline enum intel_mid_cpu_type intel_mid_identify_cpu (void ) { -return __mrst_cpu_chip; +return __intel_mid_cpu_chip; }#else /* !CONFIG_X86_INTEL_MID */ -#define mrst_identify_cpu () (0) +#define intel_mid_identify_cpu () (0)#endif /* !CONFIG_X86_INTEL_MID */ -enum mrst_timer_options { -MRST_TIMER_DEFAULT , -MRST_TIMER_APBT_ONLY , -MRST_TIMER_LAPIC_APBT , +enum intel_mid_timer_options { +INTEL_MID_TIMER_DEFAULT , +INTEL_MID_TIMER_APBT_ONLY , +INTEL_MID_TIMER_LAPIC_APBT , }; -extern enum mrst_timer_options mrst_timer_options; +extern enum intel_mid_timer_options intel_mid_timer_options;/* * Penwell uses spread spectrum clock, so the freq number is not exactly
@@ -76,6 +76,6 @@ extern void intel_scu_devices_destroy(void);#define MRST_VRTC_MAP_SZ (1024)/*#define MRST_VRTC_PGOFFSET (0xc00) */ -extern void mrst_rtc_init (void ); +extern void intel_mid_rtc_init (void );#endif /* _ASM_X86_INTEL_MID_H */
arch/x86/include/asm/setup.h +2 -2
@@ -49,9 +49,9 @@ extern void i386_reserve_resources(void);extern void setup_default_timer_irq (void );#ifdef CONFIG_X86_INTEL_MID -extern void x86_mrst_early_setup (void ); +extern void x86_intel_mid_early_setup (void );#else -static inline void x86_mrst_early_setup (void ) { } +static inline void x86_intel_mid_early_setup (void ) { }#endif #ifdef CONFIG_X86_INTEL_CE
arch/x86/include/uapi/asm/bootparam.h +1 -1
@@ -159,7 +159,7 @@ enum {X86_SUBARCH_PC =0 ,X86_SUBARCH_LGUEST ,X86_SUBARCH_XEN , -X86_SUBARCH_MRST , +X86_SUBARCH_INTEL_MID ,X86_SUBARCH_CE4100 , X86_NR_SUBARCHS, };
arch/x86/kernel/apb_timer.c +4 -4
@@ -157,13 +157,13 @@ static int __init apbt_clockevent_register(void) adev->num =smp_processor_id (); adev->timer =dw_apb_clockevent_init (smp_processor_id (),"apbt0" , - mrst_timer_options ==MRST_TIMER_LAPIC_APBT ? + intel_mid_timer_options ==INTEL_MID_TIMER_LAPIC_APBT ?APBT_CLOCKEVENT_RATING -100 :APBT_CLOCKEVENT_RATING ,adev_virt_addr (adev),0 , apbt_freq);/* Firmware does EOI handling for us. */ adev->timer->eoi =NULL ; -if (mrst_timer_options ==MRST_TIMER_LAPIC_APBT ) { +if (intel_mid_timer_options ==INTEL_MID_TIMER_LAPIC_APBT ) { global_clock_event = &adev->timer->ced;printk (KERN_DEBUG "%s clockevent registered as global\n" , global_clock_event->name);
@@ -253,7 +253,7 @@ static int apbt_cpuhp_notify(struct notifier_block *n,static __init int apbt_late_init (void ) { -if (mrst_timer_options ==MRST_TIMER_LAPIC_APBT || +if (intel_mid_timer_options ==INTEL_MID_TIMER_LAPIC_APBT || !apb_timer_block_enabled)return 0 ;/* This notifier should be called after workqueue is ready */
@@ -340,7 +340,7 @@ void __init apbt_time_init(void) }#ifdef CONFIG_SMP /* kernel cmdline disable apb timer, so we will use lapic timers */ -if (mrst_timer_options ==MRST_TIMER_LAPIC_APBT ) { +if (intel_mid_timer_options ==INTEL_MID_TIMER_LAPIC_APBT ) {printk (KERN_INFO "apbt: disabled per cpu timer\n" );return ; }
arch/x86/kernel/head32.c +2 -2
@@ -35,8 +35,8 @@ void __init i386_start_kernel(void)/* Call the subarch specific early setup function */ switch (boot_params.hdr.hardware_subarch) { -case X86_SUBARCH_MRST : -x86_mrst_early_setup (); +case X86_SUBARCH_INTEL_MID : +x86_intel_mid_early_setup ();break ;case X86_SUBARCH_CE4100 :x86_ce4100_early_setup ();
arch/x86/kernel/rtc.c +1 -1
@@ -192,7 +192,7 @@ static __init int add_rtc_cmos(void)return 0 ;/* Intel MID platforms don't have ioport rtc */ -if (mrst_identify_cpu ()) +if (intel_mid_identify_cpu ())return -ENODEV ;platform_device_register (&rtc_device);
arch/x86/pci/intel_mid_pci.c +6 -6
@@ -203,7 +203,7 @@ static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, where, size, value); } -static int mrst_pci_irq_enable (struct pci_dev *dev) +static int intel_mid_pci_irq_enable (struct pci_dev *dev) {u8 pin;struct io_apic_irq_attr irq_attr;
@@ -222,23 +222,23 @@ static int mrst_pci_irq_enable(struct pci_dev *dev)return 0 ; } -struct pci_ops pci_mrst_ops = { +struct pci_ops intel_mid_pci_ops = { .read = pci_read, .write = pci_write, };/** -* pci_mrst_init - installs pci_mrst_ops +* intel_mid_pci_init - installs intel_mid_pci_ops * * Moorestown has an interesting PCI implementation (see above). * Called when the early platform detection installs it. */ -int __init pci_mrst_init (void ) +int __init intel_mid_pci_init (void ) {pr_info ("Intel MID platform detected, using MID PCI ops\n" );pci_mmcfg_late_init (); - pcibios_enable_irq = mrst_pci_irq_enable; - pci_root_ops = pci_mrst_ops; + pcibios_enable_irq = intel_mid_pci_irq_enable; + pci_root_ops = intel_mid_pci_ops; pci_soc_mode =1 ;/* Continue with standard init */ return 1 ;
arch/x86/platform/intel-mid/early_printk_intel_mid.c +1 -1
@@ -152,7 +152,7 @@ void mrst_early_console_init(void) spi0_cdiv = ((*pclk_spi0) &0xe00 ) >>9 ; freq =100000000 / (spi0_cdiv +1 ); -if (mrst_identify_cpu () ==MRST_CPU_CHIP_PENWELL ) +if (intel_mid_identify_cpu () ==INTEL_MID_CPU_CHIP_PENWELL ) mrst_spi_paddr =MRST_REGBASE_SPI1 ; pspi = (void *)set_fixmap_offset_nocache(FIX_EARLYCON_MEM_BASE,
arch/x86/platform/intel-mid/intel-mid.c +54 -55
311 lines not on this page · raw message
arch/x86/platform/intel-mid/intel_mid_vrtc.c +4 -4
@@ -115,7 +115,7 @@ int vrtc_set_mmss(unsigned long nowtime)return retval; } -void __init mrst_rtc_init (void ) +void __init intel_mid_rtc_init (void ) {unsigned long vrtc_paddr;
@@ -153,10 +153,10 @@ static struct platform_device vrtc_device = { };/* Register the RTC device if appropriate */ -static int __init mrst_device_create (void ) +static int __init intel_mid_device_create (void ) {/* No Moorestown, no device */ -if (!mrst_identify_cpu ()) +if (!intel_mid_identify_cpu ())return -ENODEV ;/* No timer, no device */ if (!sfi_mrtc_num)
@@ -173,4 +173,4 @@ static int __init mrst_device_create(void)return platform_device_register (&vrtc_device); } -module_init (mrst_device_create); +module_init (intel_mid_device_create);
drivers/platform/x86/intel_scu_ipc.c +1 -1
@@ -579,7 +579,7 @@ static struct pci_driver ipc_driver = {static int __init intel_scu_ipc_init (void ) { - platform =mrst_identify_cpu (); + platform =intel_mid_identify_cpu ();if (platform ==0 )return -ENODEV ;return pci_register_driver (&ipc_driver);
drivers/watchdog/intel_scu_watchdog.c +1 -1
@@ -445,7 +445,7 @@ static int __init intel_scu_watchdog_init(void)* * If it isn't an intel MID device then it doesn't have this watchdog */ -if (!mrst_identify_cpu ()) +if (!intel_mid_identify_cpu ())return -ENODEV ;/* Check boot parameters to verify that their initial values */
Signature · 1 line
1.7.9.5
PATCH 6/13 intel_mid: Refactored sfi_parse_devs() function
In reply to Sathyanarayanan KuppuswamySFI device_id[] table parsing code is duplicated in every SFI device handler. This patch removes this code duplication, by adding a seperate function get_device_id() to parse through the device table. Also this patch moves the SPI, I2C, IPC info code from sfi_parse_devs() to respective device handlers.
--- arch/x86/platform/intel-mid/intel-mid.c | 141 ++++++++++++++++--------------- 1 file changed, 71 insertions(+), 70 deletions(-)
arch/x86/platform/intel-mid/intel-mid.c +71 -70
@@ -831,20 +831,15 @@ static void __init install_irq_resource(struct platform_device *pdev, int irq)platform_device_add_resources (pdev, &res,1 ); } -static void __init sfi_handle_ipc_dev (struct sfi_device_table_entry *entry) +static void __init sfi_handle_ipc_dev (struct sfi_device_table_entry *pentry, +struct devs_id *dev) { -const struct devs_id *dev = device_ids;struct platform_device *pdev;void *pdata =NULL ; -while (dev->name[0 ]) { -if (dev->type ==SFI_DEV_TYPE_IPC && - !strncmp (dev->name, entry->name,SFI_NAME_LEN )) { - pdata = dev->get_platform_data (entry); -break ; - } - dev++; - } +pr_debug ("IPC bus, name = %16.16s, irq = 0x%2x\n" , + pentry->name, pentry->irq); + pdata = dev->get_platform_data (pentry);/* * On Medfield the platform device creation is handled by the MSIC
@@ -853,68 +848,94 @@ static void __init sfi_handle_ipc_dev(struct sfi_device_table_entry *entry)if (intel_mid_has_msic ())return ; - pdev =platform_device_alloc (entry->name,0 ); + pdev =platform_device_alloc (pentry->name,0 );if (pdev ==NULL ) {pr_err ("out of memory for SFI platform device '%s'.\n" , - entry->name); + pentry->name);return ; } -install_irq_resource (pdev, entry->irq); +install_irq_resource (pdev, pentry->irq); pdev->dev.platform_data = pdata;intel_scu_device_register (pdev); } -static void __init sfi_handle_spi_dev (struct spi_board_info *spi_info) +static void __init sfi_handle_spi_dev (struct sfi_device_table_entry *pentry, +struct devs_id *dev) { -const struct devs_id *dev = device_ids; +struct spi_board_info spi_info;void *pdata =NULL ; -while (dev->name[0 ]) { -if (dev->type ==SFI_DEV_TYPE_SPI && - !strncmp (dev->name, spi_info->modalias, -SFI_NAME_LEN )) { - pdata = dev->get_platform_data (spi_info); -break ; - } - dev++; - } - spi_info->platform_data = pdata; +memset (&spi_info,0 ,sizeof (spi_info)); +strncpy (spi_info.modalias, pentry->name,SFI_NAME_LEN ); + spi_info.irq = ((pentry->irq == (u8 )0xff ) ?0 : pentry->irq); + spi_info.bus_num = pentry->host_num; + spi_info.chip_select = pentry->addr; + spi_info.max_speed_hz = pentry->max_freq; +pr_debug ("SPI bus=%d, name=%16.16s, irq=0x%2x, max_freq=%d, cs=%d\n" , + spi_info.bus_num, + spi_info.modalias, + spi_info.irq, + spi_info.max_speed_hz, + spi_info.chip_select); + + pdata = dev->get_platform_data (&spi_info); + + spi_info.platform_data = pdata;if (dev->delay) -intel_scu_spi_device_register (spi_info); +intel_scu_spi_device_register (&spi_info);else -spi_register_board_info (spi_info,1 ); +spi_register_board_info (&spi_info,1 ); } -static void __init sfi_handle_i2c_dev (int bus,struct i2c_board_info *i2c_info) +static void __init sfi_handle_i2c_dev (struct sfi_device_table_entry *pentry, +struct devs_id *dev) { -const struct devs_id *dev = device_ids; +struct i2c_board_info i2c_info;void *pdata =NULL ; +memset (&i2c_info,0 ,sizeof (i2c_info)); +strncpy (i2c_info.type, pentry->name,SFI_NAME_LEN ); + i2c_info.irq = ((pentry->irq == (u8 )0xff ) ?0 : pentry->irq); + i2c_info.addr = pentry->addr; +pr_debug ("I2C bus = %d, name = %16.16s, irq = 0x%2x, addr = 0x%x\n" , + pentry->host_num, + i2c_info.type, + i2c_info.irq, + i2c_info.addr); + pdata = dev->get_platform_data (&i2c_info); + i2c_info.platform_data = pdata; + +if (dev->delay) +intel_scu_i2c_device_register (pentry->host_num, &i2c_info); +else +i2c_register_board_info (pentry->host_num, &i2c_info,1 ); +} + +static struct devs_id __init *get_device_id (u8 type,char *name) +{ +struct devs_id *dev = device_ids; + +if (device_ids ==NULL ) +return NULL ; +while (dev->name[0 ]) { -if (dev->type ==SFI_DEV_TYPE_I2C && - !strncmp (dev->name, i2c_info->type,SFI_NAME_LEN )) { - pdata = dev->get_platform_data (i2c_info); -break ; +if (dev->type == type && + !strncmp (dev->name, name,SFI_NAME_LEN )) { +return dev; } dev++; } - i2c_info->platform_data = pdata; -if (dev->delay) -intel_scu_i2c_device_register (bus, i2c_info); -else -i2c_register_board_info (bus, i2c_info,1 ); +return NULL ; } -static int __init sfi_parse_devs (struct sfi_table_header *table) {struct sfi_table_simple *sb;struct sfi_device_table_entry *pentry; -struct spi_board_info spi_info; -struct i2c_board_info i2c_info; -int num, i, bus; +struct devs_id *dev =NULL ; +int num, i;int ioapic;struct io_apic_irq_attr irq_attr;
@@ -939,40 +960,20 @@ static int __init sfi_parse_devs(struct sfi_table_header *table) }else irq =0 ;/* No irq */ + dev =get_device_id (pentry->type, pentry->name); + +if ((dev ==NULL ) || (dev->get_platform_data ==NULL )) +continue ; +switch (pentry->type) {case SFI_DEV_TYPE_IPC : -pr_debug ("info[%2d]: IPC bus, name = %16.16s, " -"irq = 0x%2x\n" , i, pentry->name, pentry->irq); -sfi_handle_ipc_dev (pentry); +sfi_handle_ipc_dev (pentry, dev);break ;case SFI_DEV_TYPE_SPI : -memset (&spi_info,0 ,sizeof (spi_info)); -strncpy (spi_info.modalias, pentry->name,SFI_NAME_LEN ); - spi_info.irq = irq; - spi_info.bus_num = pentry->host_num; - spi_info.chip_select = pentry->addr; - spi_info.max_speed_hz = pentry->max_freq; -pr_debug ("info[%2d]: SPI bus = %d, name = %16.16s, " -"irq = 0x%2x, max_freq = %d, cs = %d\n" , i, - spi_info.bus_num, - spi_info.modalias, - spi_info.irq, - spi_info.max_speed_hz, - spi_info.chip_select); -sfi_handle_spi_dev (&spi_info); +sfi_handle_spi_dev (pentry, dev);break ;case SFI_DEV_TYPE_I2C : -memset (&i2c_info,0 ,sizeof (i2c_info)); - bus = pentry->host_num; -strncpy (i2c_info.type, pentry->name,SFI_NAME_LEN ); - i2c_info.irq = irq; - i2c_info.addr = pentry->addr; -pr_debug ("info[%2d]: I2C bus = %d, name = %16.16s, " -"irq = 0x%2x, addr = 0x%x\n" , i, bus, - i2c_info.type, - i2c_info.irq, - i2c_info.addr); -sfi_handle_i2c_dev (bus, &i2c_info); +sfi_handle_i2c_dev (pentry, dev);break ;case SFI_DEV_TYPE_UART :case SFI_DEV_TYPE_HSI :
Signature · 1 line
1.7.9.5
PATCH 7/13 intel_mid: Added custom device_handler support
In reply to Sathyanarayanan KuppuswamyThis patch provides a means to add custom handler for SFI devices. If you set device_handler as NULL in device_id table standard SFI device handler will be used. If its not NULL custom handler will be called.
--- arch/x86/platform/intel-mid/intel-mid.c | 75 +++++++++++++++++-------------- 1 file changed, 42 insertions(+), 33 deletions(-)
arch/x86/platform/intel-mid/intel-mid.c +42 -33
@@ -396,6 +396,9 @@ struct devs_id {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 */
@@ -690,27 +693,29 @@ static void *tc35876x_platform_data(void *data) }static const struct devs_id __initconst device_ids[] = { - {"bma023" ,SFI_DEV_TYPE_I2C ,1 , &no_platform_data}, - {"pmic_gpio" ,SFI_DEV_TYPE_SPI ,1 , &pmic_gpio_platform_data}, - {"pmic_gpio" ,SFI_DEV_TYPE_IPC ,1 , &pmic_gpio_platform_data}, - {"spi_max3111" ,SFI_DEV_TYPE_SPI ,0 , &max3111_platform_data}, - {"i2c_max7315" ,SFI_DEV_TYPE_I2C ,1 , &max7315_platform_data}, - {"i2c_max7315_2" ,SFI_DEV_TYPE_I2C ,1 , &max7315_platform_data}, - {"tca6416" ,SFI_DEV_TYPE_I2C ,1 , &tca6416_platform_data}, - {"emc1403" ,SFI_DEV_TYPE_I2C ,1 , &emc1403_platform_data}, - {"i2c_accel" ,SFI_DEV_TYPE_I2C ,0 , &lis331dl_platform_data}, - {"pmic_audio" ,SFI_DEV_TYPE_IPC ,1 , &no_platform_data}, - {"mpu3050" ,SFI_DEV_TYPE_I2C ,1 , &mpu3050_platform_data}, - {"i2c_disp_brig" ,SFI_DEV_TYPE_I2C ,0 , &tc35876x_platform_data}, + {"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 }, + {"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 }, + {"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}, - {"msic_gpio" ,SFI_DEV_TYPE_IPC ,1 , &msic_gpio_platform_data}, - {"msic_audio" ,SFI_DEV_TYPE_IPC ,1 , &msic_audio_platform_data}, - {"msic_power_btn" ,SFI_DEV_TYPE_IPC ,1 , &msic_power_btn_platform_data}, - {"msic_ocd" ,SFI_DEV_TYPE_IPC ,1 , &msic_ocd_platform_data}, - {"msic_thermal" ,SFI_DEV_TYPE_IPC ,1 , &msic_thermal_platform_data}, - + {"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 }, {}, };
@@ -965,20 +970,24 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)if ((dev ==NULL ) || (dev->get_platform_data ==NULL ))continue ; -switch (pentry->type) { -case SFI_DEV_TYPE_IPC : -sfi_handle_ipc_dev (pentry, dev); -break ; -case SFI_DEV_TYPE_SPI : -sfi_handle_spi_dev (pentry, dev); -break ; -case SFI_DEV_TYPE_I2C : -sfi_handle_i2c_dev (pentry, dev); -break ; -case SFI_DEV_TYPE_UART : -case SFI_DEV_TYPE_HSI : -default : -break ; +if (dev->device_handler) { + dev->device_handler (pentry, dev); + }else { +switch (pentry->type) { +case SFI_DEV_TYPE_IPC : +sfi_handle_ipc_dev (pentry, dev); +break ; +case SFI_DEV_TYPE_SPI : +sfi_handle_spi_dev (pentry, dev); +break ; +case SFI_DEV_TYPE_I2C : +sfi_handle_i2c_dev (pentry, dev); +break ; +case SFI_DEV_TYPE_UART : +case SFI_DEV_TYPE_HSI : +default : +break ; + } } }return 0 ;
Signature · 1 line
1.7.9.5
PATCH 8/13 intel_mid: Added custom handler for ipc devices
In reply to Sathyanarayanan KuppuswamyAdded a custom handler for medfield based ipc devices and moved devs_id structure defintion to header file.
--- arch/x86/include/asm/intel-mid.h | 15 ++++++ arch/x86/platform/intel-mid/intel-mid.c | 87 ++++++++++++++++++++----------- 2 files changed, 71 insertions(+), 31 deletions(-)
arch/x86/include/asm/intel-mid.h +15 -0
@@ -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
arch/x86/platform/intel-mid/intel-mid.c +56 -31
136 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 9/13 intel_mid: Moved board related code to a new file
In reply to Sathyanarayanan KuppuswamyAs Intel rolling out more SoC's after Moorestown, we need to re-structure the code in a way that is backward compatible and easy to expand.This patch implements a flexible way to support multiple boards and devices.
This patch does not add any new functional support. It just refactors the existing code to increase the modularity and decrease the code duplication for supporting multiple soc's and boards.
Currently intel-mid.c has both board and soc related code in one file. This patch moves the board related code to new files in the following order.
1. Moved the device specific code to arch/x86/platform/intel-mid/device-libs/ platform_<device>.*. A new device file is added for every supported device. This code will get conditionally compiled by using corresponding device driver CONFIG option.
2. Moved the device_ids structure definition to board.c. All board specific code are added to this file . This will provide better scalability for our code when supporting multiple boards.
--- arch/x86/include/asm/intel-mid.h | 12 + arch/x86/platform/intel-mid/Makefile | 5 + arch/x86/platform/intel-mid/board.c | 109 +++++ arch/x86/platform/intel-mid/device_libs/Makefile | 21 + .../intel-mid/device_libs/platform_emc1403.c | 33 ++ .../intel-mid/device_libs/platform_emc1403.h | 16 + .../intel-mid/device_libs/platform_gpio_keys.c | 82 ++++ .../intel-mid/device_libs/platform_gpio_keys.h | 16 + .../platform/intel-mid/device_libs/platform_ipc.c | 59 +++ .../platform/intel-mid/device_libs/platform_ipc.h | 17 + .../intel-mid/device_libs/platform_lis331.c | 32 ++ .../intel-mid/device_libs/platform_lis331.h | 16 + .../intel-mid/device_libs/platform_max3111.c | 28 ++ .../intel-mid/device_libs/platform_max3111.h | 16 + .../intel-mid/device_libs/platform_max7315.c | 62 +++ .../intel-mid/device_libs/platform_max7315.h | 19 + .../intel-mid/device_libs/platform_mpu3050.c | 28 ++ .../intel-mid/device_libs/platform_mpu3050.h | 16 + .../platform/intel-mid/device_libs/platform_msic.c | 87 ++++ .../platform/intel-mid/device_libs/platform_msic.h | 19 + .../intel-mid/device_libs/platform_msic_audio.c | 36 ++ .../intel-mid/device_libs/platform_msic_audio.h | 16 + .../intel-mid/device_libs/platform_msic_battery.c | 26 ++ .../intel-mid/device_libs/platform_msic_battery.h | 17 + .../intel-mid/device_libs/platform_msic_gpio.c | 37 ++ .../intel-mid/device_libs/platform_msic_gpio.h | 16 + .../intel-mid/device_libs/platform_msic_ocd.c | 39 ++ .../intel-mid/device_libs/platform_msic_ocd.h | 16 + .../device_libs/platform_msic_power_btn.c | 25 ++ .../device_libs/platform_msic_power_btn.h | 17 + .../intel-mid/device_libs/platform_msic_thermal.c | 26 ++ .../intel-mid/device_libs/platform_msic_thermal.h | 17 + .../intel-mid/device_libs/platform_pmic_gpio.c | 36 ++ .../intel-mid/device_libs/platform_pmic_gpio.h | 16 + .../intel-mid/device_libs/platform_tc35876x.c | 29 ++ .../intel-mid/device_libs/platform_tc35876x.h | 16 + .../intel-mid/device_libs/platform_tca6416.c | 45 ++ .../intel-mid/device_libs/platform_tca6416.h | 20 + arch/x86/platform/intel-mid/intel-mid.c | 432 +------------------- arch/x86/platform/intel-mid/intel_mid_weak_decls.h | 15 + 40 files changed, 1161 insertions(+), 429 deletions(-) create mode 100644 arch/x86/platform/intel-mid/board.c create mode 100644 arch/x86/platform/intel-mid/device_libs/Makefile create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_emc1403.c create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_emc1403.h create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.h create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_ipc.c create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_ipc.h create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_lis331.c create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_lis331.h create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_max3111.c create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_max3111.h create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_max7315.c create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_max7315.h create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_mpu3050.c create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_mpu3050.h create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic.c create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic.h create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_audio.c create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_audio.h create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_battery.c create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_battery.h create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.c create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.h create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.c create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.h create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.c create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.h create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.c create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.h create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.c create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.h create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_tc35876x.c create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_tc35876x.h create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_tca6416.c create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_tca6416.h create mode 100644 arch/x86/platform/intel-mid/intel_mid_weak_decls.h
arch/x86/include/asm/intel-mid.h +12 -0
@@ -12,8 +12,11 @@#define _ASM_X86_INTEL_MID_H#include <linux/sfi.h> +#include <linux/platform_device.h> extern int intel_mid_pci_init (void ); +extern int get_gpio_by_name (const char *name); +extern void intel_scu_device_register (struct platform_device *pdev);extern int __init sfi_parse_mrtc (struct sfi_table_header *table);extern int sfi_mrtc_num;extern struct sfi_rtc_table_entry sfi_mrtc_array[];
@@ -54,9 +57,15 @@ static inline enum intel_mid_cpu_type intel_mid_identify_cpu(void) return __intel_mid_cpu_chip; } +static inline bool intel_mid_has_msic (void ) +{ +return (intel_mid_identify_cpu () ==INTEL_MID_CPU_CHIP_PENWELL ); +} +#else /* !CONFIG_X86_INTEL_MID */ #define intel_mid_identify_cpu () (0) +#define intel_mid_has_msic () (0)#endif /* !CONFIG_X86_INTEL_MID */
@@ -93,4 +102,7 @@ extern void intel_scu_devices_destroy(void);extern void intel_mid_rtc_init (void ); +/* the offset for the mapping of global gpio pin to irq */ +#define INTEL_MID_IRQ_OFFSET 0x100 +#endif /* _ASM_X86_INTEL_MID_H */
arch/x86/platform/intel-mid/Makefile +5 -0
@@ -1,3 +1,8 @@ obj-$(CONFIG_X86_INTEL_MID) += intel-mid.o obj-$(CONFIG_X86_INTEL_MID) += intel_mid_vrtc.o obj-$(CONFIG_EARLY_PRINTK_INTEL_MID) += early_printk_intel_mid.o + +# BOARD files +obj-$(CONFIG_X86_INTEL_MID) += board.o +# platform configuration for board devices +obj-y += device_libs/
arch/x86/platform/intel-mid/board.c new file +109 -0
109 lines not on this page · raw message
arch/x86/platform/intel-mid/device_libs/Makefile new file +21 -0
@@ -0,0 +1,21 @@ +# IPC Devices +obj-y += platform_ipc.o +obj-$(subst m,y,$(CONFIG_MFD_INTEL_MSIC)) += platform_msic.o +obj-$(subst m,y,$(CONFIG_SND_MFLD_MACHINE)) += platform_msic_audio.o +obj-$(subst m,y,$(CONFIG_GPIO_MSIC)) += platform_msic_gpio.o +obj-$(subst m,y,$(CONFIG_MFD_INTEL_MSIC)) += platform_msic_ocd.o +obj-$(subst m,y,$(CONFIG_BATTERY_INTEL_MDF)) += platform_msic_battery.o +obj-$(subst m,y,$(CONFIG_INTEL_MID_POWER_BUTTON)) += platform_msic_power_btn.o +obj-$(subst m,y,$(CONFIG_GPIO_INTEL_PMIC)) += platform_pmic_gpio.o +obj-$(subst m,y,$(CONFIG_INTEL_MFLD_THERMAL)) += platform_msic_thermal.o +# I2C Devices +obj-$(subst m,y,$(CONFIG_SENSORS_EMC1403)) += platform_emc1403.o +obj-$(subst m,y,$(CONFIG_SENSORS_LIS3LV02D)) += platform_lis331.o +obj-$(subst m,y,$(CONFIG_GPIO_PCA953X)) += platform_max7315.o +obj-$(subst m,y,$(CONFIG_SENSORS_MPU3050)) += platform_mpu3050.o +obj-$(subst m,y,$(CONFIG_GPIO_PCA953X)) += platform_tca6416.o +obj-$(subst m,y,$(CONFIG_DRM_MEDFIELD)) += platform_tc35876x.o +# SPI Devices +obj-$(subst m,y,$(CONFIG_SERIAL_MRST_MAX3110)) += platform_max3111.o +# MISC Devices +obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
arch/x86/platform/intel-mid/device_libs/platform_emc1403.c new file +33 -0
@@ -0,0 +1,33 @@ +/* +* platform_emc1403.c: emc1403 platform data initilization file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ + +#include <linux/init.h> +#include <linux/gpio.h> +#include <linux/i2c.h> +#include <asm/intel-mid.h> +#include "platform_emc1403.h" + +void __init *emc1403_platform_data (void *info) +{ +static short intr2nd_pdata; +struct i2c_board_info *i2c_info = info; +int intr =get_gpio_by_name ("thermal_int" ); +int intr2nd =get_gpio_by_name ("thermal_alert" ); + +if (intr ==-1 || intr2nd ==-1 ) +return NULL ; + + i2c_info->irq = intr +INTEL_MID_IRQ_OFFSET ; + intr2nd_pdata = intr2nd +INTEL_MID_IRQ_OFFSET ; + +return &intr2nd_pdata; +}
arch/x86/platform/intel-mid/device_libs/platform_emc1403.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* platform_emc1403.h: emc1403 platform data header file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ +#ifndef _PLATFORM_EMC1403_H_ +#define _PLATFORM_EMC1403_H_ + +extern void __init *emc1403_platform_data (void *info) __attribute__((weak)); +#endif
arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c new file +82 -0
82 lines not on this page · raw message
arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* platform_gpio_keys.h: gpio_keys platform data header file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ +#ifndef _PLATFORM_GPIO_KEYS_H_ +#define _PLATFORM_GPIO_KEYS_H_ + +#define DEVICE_NAME "gpio-keys" +#endif
arch/x86/platform/intel-mid/device_libs/platform_ipc.c new file +59 -0
59 lines not on this page · raw message
arch/x86/platform/intel-mid/device_libs/platform_ipc.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* platform_ipc.h: IPC platform library header file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ +#ifndef _PLATFORM_IPC_H_ +#define _PLATFORM_IPC_H_ + +extern void __init ipc_device_handler (struct sfi_device_table_entry *pentry, +struct devs_id *dev) __attribute__((weak)); +#endif
arch/x86/platform/intel-mid/device_libs/platform_lis331.c new file +32 -0
@@ -0,0 +1,32 @@ +/* +* platform_lis331.c: lis331 platform data initilization file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ + +#include <linux/i2c.h> +#include <linux/gpio.h> +#include <asm/intel-mid.h> +#include "platform_lis331.h" + +void __init *lis331dl_platform_data (void *info) +{ +static short intr2nd_pdata; +struct i2c_board_info *i2c_info = info; +int intr =get_gpio_by_name ("accel_int" ); +int intr2nd =get_gpio_by_name ("accel_2" ); + +if (intr ==-1 || intr2nd ==-1 ) +return NULL ; + + i2c_info->irq = intr +INTEL_MID_IRQ_OFFSET ; + intr2nd_pdata = intr2nd +INTEL_MID_IRQ_OFFSET ; + +return &intr2nd_pdata; +}
arch/x86/platform/intel-mid/device_libs/platform_lis331.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* platform_lis331.h: lis331 platform data header file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ +#ifndef _PLATFORM_LIS331_H_ +#define _PLATFORM_LIS331_H_ + +extern void __init *lis331dl_platform_data (void *info) __attribute__((weak)); +#endif
arch/x86/platform/intel-mid/device_libs/platform_max3111.c new file +28 -0
@@ -0,0 +1,28 @@ +/* +* platform_max3111.c: max3111 platform data initilization file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ + +#include <linux/gpio.h> +#include <linux/spi/spi.h> +#include <asm/intel-mid.h> +#include "platform_max3111.h" + +void __init *max3111_platform_data (void *info) +{ +struct spi_board_info *spi_info = info; +int intr =get_gpio_by_name ("max3111_int" ); + + spi_info->mode =SPI_MODE_0 ; +if (intr ==-1 ) +return NULL ; + spi_info->irq = intr +INTEL_MID_IRQ_OFFSET ; +return NULL ; +}
arch/x86/platform/intel-mid/device_libs/platform_max3111.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* platform_max3111.h: max3111 platform data header file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ +#ifndef _PLATFORM_MAX3111_H_ +#define _PLATFORM_MAX3111_H_ + +extern void *max3111_platform_data (void *info) __attribute__((weak)); +#endif
arch/x86/platform/intel-mid/device_libs/platform_max7315.c new file +62 -0
62 lines not on this page · raw message
arch/x86/platform/intel-mid/device_libs/platform_max7315.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* platform_max7315.h: max7315 platform data header file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ +#ifndef _PLATFORM_MAX7315_H_ +#define _PLATFORM_MAX7315_H_ + +/* we have multiple max7315 on the board ... */ +#define MAX7315_NUM 2 + +extern void __init *max7315_platform_data (void *info) __attribute__((weak)); +#endif
arch/x86/platform/intel-mid/device_libs/platform_mpu3050.c new file +28 -0
@@ -0,0 +1,28 @@ +/* +* platform_mpu3050.c: mpu3050 platform data initilization file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ + +#include <linux/gpio.h> +#include <linux/i2c.h> +#include <asm/intel-mid.h> +#include "platform_mpu3050.h" + +void *mpu3050_platform_data (void *info) +{ +struct i2c_board_info *i2c_info = info; +int intr =get_gpio_by_name ("mpu3050_int" ); + +if (intr ==-1 ) +return NULL ; + + i2c_info->irq = intr +INTEL_MID_IRQ_OFFSET ; +return NULL ; +}
arch/x86/platform/intel-mid/device_libs/platform_mpu3050.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* platform_mpu3050.h: mpu3050 platform data header file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ +#ifndef _PLATFORM_MPU3050_H_ +#define _PLATFORM_MPU3050_H_ + +extern void *mpu3050_platform_data (void *info) __attribute__((weak)); +#endif
arch/x86/platform/intel-mid/device_libs/platform_msic.c new file +87 -0
87 lines not on this page · raw message
arch/x86/platform/intel-mid/device_libs/platform_msic.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* platform_msic.h: MSIC platform data header file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ +#ifndef _PLATFORM_MSIC_H_ +#define _PLATFORM_MSIC_H_ + +extern struct intel_msic_platform_data msic_pdata; + +extern void *msic_generic_platform_data (void *info, +enum intel_msic_block block) __attribute__((weak)); +#endif
arch/x86/platform/intel-mid/device_libs/platform_msic_audio.c new file +36 -0
@@ -0,0 +1,36 @@ +/* +* platform_msic_audio.c: MSIC audio platform data initilization file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ + +#include <linux/kernel.h> +#include <linux/interrupt.h> +#include <linux/scatterlist.h> +#include <linux/init.h> +#include <linux/sfi.h> +#include <linux/platform_device.h> +#include <linux/mfd/intel_msic.h> +#include <asm/intel-mid.h> +#include "platform_msic.h" +#include "platform_msic_audio.h" + +void *msic_audio_platform_data (void *info) +{ +struct platform_device *pdev; + + pdev =platform_device_register_simple ("sst-platform" ,-1 ,NULL ,0 ); + +if (IS_ERR (pdev)) { +pr_err ("failed to create audio platform device\n" ); +return NULL ; + } + +return msic_generic_platform_data (info,INTEL_MSIC_BLOCK_AUDIO ); +}
arch/x86/platform/intel-mid/device_libs/platform_msic_audio.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* platform_msic_audio.h: MSIC audio platform data header file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ +#ifndef _PLATFORM_MSIC_AUDIO_H_ +#define _PLATFORM_MSIC_AUDIO_H_ + +extern void __init *msic_audio_platform_data (void *info) __attribute__((weak)); +#endif
arch/x86/platform/intel-mid/device_libs/platform_msic_battery.c new file +26 -0
@@ -0,0 +1,26 @@ +/* +* platform_msic_battery.c: MSIC battery platform data initilization file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ + +#include <linux/kernel.h> +#include <linux/interrupt.h> +#include <linux/scatterlist.h> +#include <linux/init.h> +#include <linux/sfi.h> +#include <linux/mfd/intel_msic.h> +#include <asm/intel-mid.h> +#include "platform_msic.h" +#include "platform_msic_battery.h" + +void __init *msic_battery_platform_data (void *info) +{ +return msic_generic_platform_data (info,INTEL_MSIC_BLOCK_BATTERY ); +}
arch/x86/platform/intel-mid/device_libs/platform_msic_battery.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* platform_msic_battery.h: MSIC battery platform data header file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ +#ifndef _PLATFORM_MSIC_BATTERY_H_ +#define _PLATFORM_MSIC_BATTERY_H_ + +extern void __init *msic_battery_platform_data (void *info) + __attribute__((weak)); +#endif
arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.c new file +37 -0
@@ -0,0 +1,37 @@ +/* +* platform_msic_gpio.c: MSIC GPIO platform data initilization file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ + +#include <linux/kernel.h> +#include <linux/interrupt.h> +#include <linux/scatterlist.h> +#include <linux/sfi.h> +#include <linux/init.h> +#include <linux/gpio.h> +#include <linux/mfd/intel_msic.h> +#include <asm/intel-mid.h> +#include "platform_msic.h" +#include "platform_msic_gpio.h" + +void __init *msic_gpio_platform_data (void *info) +{ +static struct intel_msic_gpio_pdata msic_gpio_pdata; + +int gpio =get_gpio_by_name ("msic_gpio_base" ); + +if (gpio <0 ) +return NULL ; + + msic_gpio_pdata.gpio_base = gpio; + msic_pdata.gpio = &msic_gpio_pdata; + +return msic_generic_platform_data (info,INTEL_MSIC_BLOCK_GPIO ); +}
arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* platform_msic_gpio.h: MSIC GPIO platform data header file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ +#ifndef _PLATFORM_MSIC_GPIO_H_ +#define _PLATFORM_MSIC_GPIO_H_ + +extern void __init *msic_gpio_platform_data (void *info) __attribute__((weak)); +#endif
arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.c new file +39 -0
@@ -0,0 +1,39 @@ +/* +* platform_msic_ocd.c: MSIC OCD platform data initilization file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ + +#include <linux/kernel.h> +#include <linux/interrupt.h> +#include <linux/scatterlist.h> +#include <linux/sfi.h> +#include <linux/init.h> +#include <linux/gpio.h> +#include <linux/mfd/intel_msic.h> +#include <asm/intel-mid.h> +#include "platform_msic.h" +#include "platform_msic_ocd.h" + +void __init *msic_ocd_platform_data (void *info) +{ +static struct intel_msic_ocd_pdata msic_ocd_pdata; +int gpio; + + gpio =get_gpio_by_name ("ocd_gpio" ); + +if (gpio <0 ) +return NULL ; + + msic_ocd_pdata.gpio = gpio; + msic_pdata.ocd = &msic_ocd_pdata; + +return msic_generic_platform_data (info,INTEL_MSIC_BLOCK_OCD ); +} +
arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* platform_msic_ocd.h: MSIC OCD platform data header file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ +#ifndef _PLATFORM_MSIC_OCD_H_ +#define _PLATFORM_MSIC_OCD_H_ + +extern void __init *msic_ocd_platform_data (void *info) __attribute__((weak)); +#endif
arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.c new file +25 -0
@@ -0,0 +1,25 @@ +/* +* platform_msic_power_btn.c: MSIC power btn platform data initilization file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ +#include <linux/kernel.h> +#include <linux/interrupt.h> +#include <linux/scatterlist.h> +#include <linux/sfi.h> +#include <linux/init.h> +#include <linux/mfd/intel_msic.h> +#include <asm/intel-mid.h> +#include "platform_msic.h" +#include "platform_msic_power_btn.h" + +void __init *msic_power_btn_platform_data (void *info) +{ +return msic_generic_platform_data (info,INTEL_MSIC_BLOCK_POWER_BTN ); +}
arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* platform_msic_power_btn.h: MSIC power btn platform data header file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ +#ifndef _PLATFORM_MSIC_POWER_BTN_H_ +#define _PLATFORM_MSIC_POWER_BTN_H_ + +extern void __init *msic_power_btn_platform_data (void *info) + __attribute__((weak)); +#endif
arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.c new file +26 -0
@@ -0,0 +1,26 @@ +/* +* platform_msic_thermal.c: msic_thermal platform data initilization file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ + +#include <linux/input.h> +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/gpio.h> +#include <linux/platform_device.h> +#include <linux/mfd/intel_msic.h> +#include <asm/intel-mid.h> +#include "platform_msic.h" +#include "platform_msic_thermal.h" + +void __init *msic_thermal_platform_data (void *info) +{ +return msic_generic_platform_data (info,INTEL_MSIC_BLOCK_THERMAL ); +}
arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* platform_msic_thermal.h: msic_thermal platform data header file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ +#ifndef _PLATFORM_MSIC_THERMAL_H_ +#define _PLATFORM_MSIC_THERMAL_H_ + +extern void __init *msic_thermal_platform_data (void *info) + __attribute__((weak)); +#endif
arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.c new file +36 -0
@@ -0,0 +1,36 @@ +/* +* platform_pmic_gpio.c: PMIC GPIO platform data initilization file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ + +#include <linux/kernel.h> +#include <linux/interrupt.h> +#include <linux/scatterlist.h> +#include <linux/gpio.h> +#include <linux/init.h> +#include <linux/sfi.h> +#include <asm/intel-mid.h> +#include <linux/intel_pmic_gpio.h> +#include "platform_pmic_gpio.h" + +void __init *pmic_gpio_platform_data (void *info) +{ +static struct intel_pmic_gpio_platform_data pmic_gpio_pdata; +int gpio_base =get_gpio_by_name ("pmic_gpio_base" ); + +if (gpio_base ==-1 ) + gpio_base =64 ; + pmic_gpio_pdata.gpio_base = gpio_base; + pmic_gpio_pdata.irq_base = gpio_base +INTEL_MID_IRQ_OFFSET ; + pmic_gpio_pdata.gpiointr =0xffffeff8 ; + +return &pmic_gpio_pdata; +} +
arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* platform_pmic_gpio.h: PMIC GPIO platform data header file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ +#ifndef _PLATFORM_PMIC_GPIO_H_ +#define _PLATFORM_PMIC_GPIO_H_ + +extern void __init *pmic_gpio_platform_data (void *info) __attribute__((weak)); +#endif
arch/x86/platform/intel-mid/device_libs/platform_tc35876x.c new file +29 -0
@@ -0,0 +1,29 @@ +/* +* platform_tc35876x.c: tc35876x platform data initilization file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ + +#include <linux/gpio.h> +#include <linux/i2c/tc35876x.h> +#include <asm/intel-mid.h> +#include "platform_tc35876x.h" + +/*tc35876x DSI_LVDS bridge chip and panel platform data*/ +void *tc35876x_platform_data (void *data) +{ +static struct tc35876x_platform_data pdata; + +/* gpio pins set to -1 will not be used by the driver */ + pdata.gpio_bridge_reset =get_gpio_by_name ("LCMB_RXEN" ); + pdata.gpio_panel_bl_en =get_gpio_by_name ("6S6P_BL_EN" ); + pdata.gpio_panel_vadd =get_gpio_by_name ("EN_VREG_LCD_V3P3" ); + +return &pdata; +}
arch/x86/platform/intel-mid/device_libs/platform_tc35876x.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* platform_tc35876x.h: tc35876x platform data header file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ +#ifndef _PLATFORM_TC35876X_H_ +#define _PLATFORM_TC35876X_H_ + +extern void *tc35876x_platform_data (void *info) __attribute__((weak)); +#endif
arch/x86/platform/intel-mid/device_libs/platform_tca6416.c new file +45 -0
45 lines not on this page · raw message
arch/x86/platform/intel-mid/device_libs/platform_tca6416.h new file +20 -0
@@ -0,0 +1,20 @@ +/* +* platform_tca6416.h: tca6416 platform data header file +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ +#ifndef _PLATFORM_TCA6416_H_ +#define _PLATFORM_TCA6416_H_ + +#define TCA6416_NAME "tca6416" +#define TCA6416_BASE "tca6416_base" +#define TCA6416_INTR "tca6416_int" + +extern void *tca6416_platform_data (void *info) __attribute__((weak)); +#endif
arch/x86/platform/intel-mid/intel-mid.c +3 -429
471 lines not on this page · raw message
arch/x86/platform/intel-mid/intel_mid_weak_decls.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* intel_mid_weak_decls.h: Weak declarations of intel-mid.c +* +* (C) Copyright 2013 Intel Corporation +* Author: Sathyanarayanan Kuppuswamy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ + + +/* __attribute__((weak)) makes these declarations overridable */ +extern struct devs_id __initconst device_ids[] __attribute__((weak));
Signature · 1 line
1.7.9.5
PATCH 10/13 intel_mid: Moved SFI related code to intel_mid_sfi.c
In reply to Sathyanarayanan KuppuswamyMoved SFI specific parsing/handling code to intel_mid_sfi.c. This will enable us to reuse our intel-mid code for platforms that supports firmware interfaces other than SFI (like ACPI).
--- arch/x86/include/asm/intel-mid.h | 1 + arch/x86/platform/intel-mid/Makefile | 5 +- arch/x86/platform/intel-mid/intel-mid.c | 450 ------------------------- arch/x86/platform/intel-mid/intel_mid_sfi.c | 485 +++++++++++++++++++++++++++ 4 files changed, 489 insertions(+), 452 deletions(-) create mode 100644 arch/x86/platform/intel-mid/intel_mid_sfi.c
arch/x86/include/asm/intel-mid.h +1 -0
@@ -18,6 +18,7 @@ extern int intel_mid_pci_init(void);extern int get_gpio_by_name (const char *name);extern void intel_scu_device_register (struct platform_device *pdev);extern int __init sfi_parse_mrtc (struct sfi_table_header *table); +extern int __init sfi_parse_mtmr (struct sfi_table_header *table);extern int sfi_mrtc_num;extern struct sfi_rtc_table_entry sfi_mrtc_array[];
arch/x86/platform/intel-mid/Makefile +3 -2
@@ -1,8 +1,9 @@ obj-$(CONFIG_X86_INTEL_MID) += intel-mid.o obj-$(CONFIG_X86_INTEL_MID) += intel_mid_vrtc.o obj-$(CONFIG_EARLY_PRINTK_INTEL_MID) += early_printk_intel_mid.o - +# SFI specific code +obj-$(CONFIG_SFI) += intel_mid_sfi.o # BOARD files obj-$(CONFIG_X86_INTEL_MID) += board.o # platform configuration for board devices -obj-y += device_libs/ +obj-y += device_libs/
arch/x86/platform/intel-mid/intel-mid.c +0 -450
477 lines not on this page · raw message
arch/x86/platform/intel-mid/intel_mid_sfi.c new file +485 -0
485 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 11/13 sfi: fix compiler warnings
In reply to Sathyanarayanan KuppuswamyFrom: Andy Shevchenko <[email protected]>
drivers/sfi/sfi_core.c:164:26: warning: no previous prototype for ‘sfi_map_table’ [-Wmissing-prototypes] drivers/sfi/sfi_core.c:192:6: warning: no previous prototype for ‘sfi_unmap_table’ [-Wmissing-prototypes]
--- drivers/sfi/sfi_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/sfi/sfi_core.c +2 -2
@@ -161,7 +161,7 @@ static int sfi_verify_table(struct sfi_table_header *table)* Check for common case that we can re-use mapping to SYST, * which requires syst_pa, syst_va to be initialized. */ -struct sfi_table_header *sfi_map_table (u64 pa) +static struct sfi_table_header *sfi_map_table (u64 pa) {struct sfi_table_header *th;u32 length;
@@ -189,7 +189,7 @@ struct sfi_table_header *sfi_map_table(u64 pa)* Undoes effect of sfi_map_table() by unmapping table * if it did not completely fit on same page as SYST. */ -void sfi_unmap_table (struct sfi_table_header *th) +static void sfi_unmap_table (struct sfi_table_header *th) {if (!TABLE_ON_PAGE (syst_va, th, th->len)) sfi_unmap_memory(th, TABLE_ON_PAGE(th, th, th->len) ?
Signature · 1 line
1.7.9.5
Re: [PATCH v1 11/13] sfi: fix compiler warnings
Quoted 1 line · Sathyanarayanan Kuppuswamy
From: Andy Shevchenko <[email protected]>
Can you use newer version [1] of this patch?
[1] https://lkml.org/lkml/2013/5/28/83
--
With Best Regards,
Andy Shevchenko
PATCH 12/13 gpiolib: append SFI helpers for GPIO API
In reply to Sathyanarayanan KuppuswamyFrom: Andy Shevchenko <[email protected]>
To support some (legacy) firmwares and platforms let's make life easier for their customers.
--- drivers/gpio/Kconfig | 4 +++ drivers/gpio/Makefile | 1 + drivers/gpio/gpiolib-sfi.c | 76 ++++++++++++++++++++++++++++++++++++++++++++ drivers/sfi/sfi_core.c | 7 ++++ include/linux/sfi_gpio.h | 27 ++++++++++++++++ 5 files changed, 115 insertions(+) create mode 100644 drivers/gpio/gpiolib-sfi.c create mode 100644 include/linux/sfi_gpio.h
drivers/gpio/Kconfig +4 -0
@@ -51,6 +51,10 @@ config OF_GPIO def_bool y depends on OF +config GPIO_SFI + def_bool y + depends on SFI + config GPIO_ACPI def_bool y depends on ACPI
drivers/gpio/Makefile +1 -0
@@ -5,6 +5,7 @@ ccflags-$(CONFIG_DEBUG_GPIO) += -DDEBUG obj-$(CONFIG_GPIO_DEVRES) += devres.o obj-$(CONFIG_GPIOLIB) += gpiolib.o obj-$(CONFIG_OF_GPIO) += gpiolib-of.o +obj-$(CONFIG_GPIO_SFI) += gpiolib-sfi.o obj-$(CONFIG_GPIO_ACPI) += gpiolib-acpi.o # Device drivers. Generally keep list sorted alphabetically
drivers/gpio/gpiolib-sfi.c new file +76 -0
76 lines not on this page · raw message
drivers/sfi/sfi_core.c +7 -0
@@ -67,6 +67,7 @@#include <linux/acpi.h> #include <linux/init.h> #include <linux/sfi.h> +#include <linux/sfi_gpio.h> #include <linux/slab.h> #include "sfi_core.h"
@@ -512,6 +513,12 @@ void __init sfi_init_late(void) syst_va =sfi_map_memory (syst_pa, length);sfi_acpi_init (); + +/* +* Parsing GPIO table first, since the DEVS table will need this table +* to map the pin name to the actual pin. +*/ +sfi_gpio_init (); }/*
include/linux/sfi_gpio.h new file +27 -0
@@ -0,0 +1,27 @@ +#ifndef _LINUX_SFI_GPIO_H_ +#define _LINUX_SFI_GPIO_H_ + +#include <linux/errno.h> +#include <linux/gpio.h> +#include <linux/sfi.h> + +#ifdef CONFIG_GPIO_SFI + +int sfi_get_gpio_by_name (const char *name); +int __init sfi_gpio_init (void ); + +#else /* CONFIG_GPIO_SFI */ + +static inline int sfi_get_gpio_by_name (const char *name); +{ +return -1 ; +} + +static inline int __init sfi_gpio_init (void ) +{ +return -ENODEV ; +} + +#endif /* CONFIG_GPIO_SFI */ + +#endif /* _LINUX_SFI_GPIO_H_ */
Signature · 1 line
1.7.9.5
Re: [PATCH v1 12/13] gpiolib: append SFI helpers for GPIO API
Quoted 4 lines · Sathyanarayanan Kuppuswamy
From: Andy Shevchenko <[email protected]>
To support some (legacy) firmwares and platforms let's make life easier for their customers.
I'd like Grant to have a look at this too, if possible.
Quoted 1 line
Change-Id: I39a0e3e0ed4e04a0d733801f59d46d76189195e8
We don't put Google Gerrit change-IDs into the kernel log. But fun to know you're using it...
(...)
drivers/gpio/gpiolib-sfi.c line 2
Quoted 4 lines
+++
b/drivers/gpio/gpiolib-sfi.cdrivers/gpio/gpiolib-sfi.c new file +2
-0@@ -0,0 +1,76 @@ +/* +* SFI helpers for GPIO API
Spell out "Simple Firmware Interface helpers..." it's not like everyone knows.
drivers/gpio/gpiolib-sfi.c line 34
Quoted 10 lines
drivers/gpio/gpiolib-sfi.c new file +10
-0+static struct sfi_gpio_table_entry *sfi_gpio_table; +static int sfi_gpio_num_entry; + +int sfi_get_gpio_by_name (const char *name) +{ +struct sfi_gpio_table_entry *pentry = sfi_gpio_table; +int i; + +if (!pentry) +return -1 ;
Don't you want to return a serious error code?
drivers/gpio/gpiolib-sfi.c line 41
Quoted 7 lines
drivers/gpio/gpiolib-sfi.c new file +7
-0+ +for (i =0 ; i < sfi_gpio_num_entry; i++, pentry++) { +if (!strncmp (name, pentry->pin_name,SFI_NAME_LEN )) +return pentry->pin_no; + } + +return -1 ;
Dito.
Quoted 2 lines
(quoted diff) +2
-0+} +EXPORT_SYMBOL_GPL(sfi_get_gpio_by_name);
(...)
Quoted 7 lines
include/linux/sfi_gpio.h new file +1
-0@@ -0,0 +1,27 @@ +#ifndef _LINUX_SFI_GPIO_H_
include/linux/sfi_gpio.h line 11
Quoted 10 lines
include/linux/sfi_gpio.h new file +10
-0+#define _LINUX_SFI_GPIO_H_ + +#include <linux/errno.h> +#include <linux/gpio.h> +#include <linux/sfi.h> + +#ifdef CONFIG_GPIO_SFI + +int sfi_get_gpio_by_name (const char *name); +int __init sfi_gpio_init (void );
IIRC you do not need to tag things with __init in header files.
include/linux/sfi_gpio.h line 17
Quoted 6 lines
include/linux/sfi_gpio.h new file +6
-0+ +#else /* CONFIG_GPIO_SFI */ + +static inline int sfi_get_gpio_by_name (const char *name); +{ +return -1 ;
Why -1? -ENOTSUPP? Or some other error code?
include/linux/sfi_gpio.h line 20
Quoted 3 lines
include/linux/sfi_gpio.h new file +3
-0+} + +static inline int __init sfi_gpio_init (void )
Do not tag inline functions with __init.
Yours,
Linus Walleij
PATCH 1/1 gpiolib: append SFI helpers for GPIO API
To support some (legacy) firmwares and platforms let's make life easier for their customers.
This patch extracts SFI GPIO API from arch/x86/platform/mrst/mrst.c.
---
Since v1:
- address Linus' comments: self-descriptive error codes, removal of __init in header, better title in c-file.
drivers/gpio/Kconfig | 4 +++ drivers/gpio/Makefile | 1 + drivers/gpio/gpiolib-sfi.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/sfi/sfi_core.c | 7 +++++ include/linux/sfi_gpio.h | 27 ++++++++++++++++ 5 files changed, 115 insertions(+) create mode 100644 drivers/gpio/gpiolib-sfi.c create mode 100644 include/linux/sfi_gpio.h
drivers/gpio/Kconfig +4 -0
@@ -51,6 +51,10 @@ config OF_GPIO def_bool y depends on OF +config GPIO_SFI + def_bool y + depends on SFI + config GPIO_ACPI def_bool y depends on ACPI
drivers/gpio/Makefile +1 -0
@@ -5,6 +5,7 @@ ccflags-$(CONFIG_DEBUG_GPIO) += -DDEBUG obj-$(CONFIG_GPIO_DEVRES) += devres.o obj-$(CONFIG_GPIOLIB) += gpiolib.o obj-$(CONFIG_OF_GPIO) += gpiolib-of.o +obj-$(CONFIG_GPIO_SFI) += gpiolib-sfi.o obj-$(CONFIG_GPIO_ACPI) += gpiolib-acpi.o # Device drivers. Generally keep list sorted alphabetically
drivers/gpio/gpiolib-sfi.c new file +76 -0
76 lines not on this page · raw message
drivers/sfi/sfi_core.c +7 -0
@@ -67,6 +67,7 @@#include <linux/acpi.h> #include <linux/init.h> #include <linux/sfi.h> +#include <linux/sfi_gpio.h> #include <linux/slab.h> #include "sfi_core.h"
@@ -512,6 +513,12 @@ void __init sfi_init_late(void) syst_va =sfi_map_memory (syst_pa, length);sfi_acpi_init (); + +/* +* Parsing GPIO table first, since the DEVS table will need this table +* to map the pin name to the actual pin. +*/ +sfi_gpio_init (); }/*
include/linux/sfi_gpio.h new file +27 -0
@@ -0,0 +1,27 @@ +#ifndef _LINUX_SFI_GPIO_H_ +#define _LINUX_SFI_GPIO_H_ + +#include <linux/errno.h> +#include <linux/gpio.h> +#include <linux/sfi.h> + +#ifdef CONFIG_GPIO_SFI + +int sfi_get_gpio_by_name (const char *name); +int sfi_gpio_init (void ); + +#else /* CONFIG_GPIO_SFI */ + +static inline int sfi_get_gpio_by_name (const char *name); +{ +return -ENODEV ; +} + +static inline int sfi_gpio_init (void ) +{ +return -ENODEV ; +} + +#endif /* CONFIG_GPIO_SFI */ + +#endif /* _LINUX_SFI_GPIO_H_ */
Signature · 1 line
1.8.2.rc0.22.gb3600c3
Re: [PATCH v1.1] gpiolib: append SFI helpers for GPIO API
Quoted 5 lines · Andy Shevchenko
To support some (legacy) firmwares and platforms let's make life easier for their customers.
This patch extracts SFI GPIO API from
arch/x86/platform/mrst/mrst.c.
Quoted 8 lines
Signed-off-by Andy Shevchenko <[email protected]>Acked-by Len Brown <[email protected]>Cc Grant Likely <[email protected]>Cc Linus Walleij <[email protected]>---
Since v1:
- address Linus' comments: self-descriptive error codes, removal of__initin header, better title in c-file.
Hi Andy,
Some trivial coding style comment below.
~Ryan
Quoted 72 lines
drivers/gpio/Kconfig | 4 +++ drivers/gpio/Makefile | 1 + drivers/gpio/gpiolib-sfi.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/sfi/sfi_core.c | 7 +++++ include/linux/sfi_gpio.h | 27 ++++++++++++++++ 5 files changed, 115 insertions(+) create mode 100644 drivers/gpio/gpiolib-sfi.c create mode 100644 include/linux/sfi_gpio.hdrivers/gpio/Kconfig +4
-0@@ -51,6 +51,10 @@ config OF_GPIO def_bool y depends on OF +config GPIO_SFI + def_bool y + depends on SFI + config GPIO_ACPI def_bool y depends on ACPIdrivers/gpio/Makefile +1
-0@@ -5,6 +5,7 @@ ccflags-$(CONFIG_DEBUG_GPIO) += -DDEBUG obj-$(CONFIG_GPIO_DEVRES) += devres.o obj-$(CONFIG_GPIOLIB) += gpiolib.o obj-$(CONFIG_OF_GPIO) += gpiolib-of.o +obj-$(CONFIG_GPIO_SFI) += gpiolib-sfi.o obj-$(CONFIG_GPIO_ACPI) += gpiolib-acpi.o # Device drivers. Generally keep list sorted alphabeticallydrivers/gpio/gpiolib-sfi.c new file +29
-0@@ -0,0 +1,76 @@ +/* +* Simple Firmware Interface (SFI) helpers for GPIO API +* +* Copyright (C) 2013, Intel Corporation +* Author: Andy Shevchenko <[email protected]> +* +* Based on work done for Intel MID platforms (mrst.c) +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#define pr_fmt (fmt) "SFI: GPIO: " fmt + +#include <linux/errno.h> +#include <linux/kernel.h> +#include <linux/string.h> +#include <linux/slab.h> +#include <linux/gpio.h> +#include <linux/export.h> +#include <linux/sfi_gpio.h> +#include <linux/sfi.h> + +static struct sfi_gpio_table_entry *sfi_gpio_table; +static int sfi_gpio_num_entry; + +int sfi_get_gpio_by_name (const char *name) +{
drivers/gpio/gpiolib-sfi.c line 39
Quoted 10 lines
drivers/gpio/gpiolib-sfi.c new file +10
-0+struct sfi_gpio_table_entry *pentry = sfi_gpio_table; +int i; + +if (!pentry) +return -EINVAL ; + +for (i =0 ; i < sfi_gpio_num_entry; i++, pentry++) { +if (!strncmp (name, pentry->pin_name,SFI_NAME_LEN )) +return pentry->pin_no; + }
Nitpick - Don't need the braces on the for loop.
drivers/gpio/gpiolib-sfi.c line 47
Quoted 8 lines
drivers/gpio/gpiolib-sfi.c new file +8
-0+ +return -ENODEV ; +} +EXPORT_SYMBOL_GPL (sfi_get_gpio_by_name); + +static int __init sfi_gpio_parse (struct sfi_table_header *table) +{ +struct sfi_table_simple *sb = (struct sfi_table_simple *)table;
Using container_of is preferable to casting:
sb = container_of(table, struct sfi_table_simple, header);
drivers/gpio/gpiolib-sfi.c line 57
Quoted 10 lines
drivers/gpio/gpiolib-sfi.c new file +10
-0+struct sfi_gpio_table_entry *pentry; +int num, i; + +if (sfi_gpio_table) +return 0 ; + + num = SFI_GET_NUM_ENTRIES(sb, struct sfi_gpio_table_entry); + pentry = (struct sfi_gpio_table_entry *)sb->pentry; + + sfi_gpio_table =kmalloc (num *sizeof (*pentry),GFP_KERNEL );
Use kcalloc when you have a size and a count.
drivers/gpio/gpiolib-sfi.c line 68
Quoted 11 lines
drivers/gpio/gpiolib-sfi.c new file +11
-0+if (!sfi_gpio_table) +return -ENOMEM ; + +memcpy (sfi_gpio_table, pentry, num *sizeof (*pentry)); + sfi_gpio_num_entry = num; + +pr_debug ("Pin info:\n" ); +for (i =0 ; i < num; i++, pentry++) +pr_debug ("[%2d] chip = %16.16s, name = %16.16s, pin=%d\n" , i, + pentry->controller_name, pentry->pin_name, + pentry->pin_no);
Why "%16.16s" here? "%16s" will right justify with leading spaces, or "%-16s" will left justify with trailing spaces.
Quoted 67 lines
drivers/gpio/gpiolib-sfi.c new file +8
-0+ +return 0 ; +} + +int __init sfi_gpio_init (void ) +{ +return sfi_table_parse (SFI_SIG_GPIO ,NULL ,NULL , sfi_gpio_parse); +}drivers/sfi/sfi_core.c +7
-0@@ -67,6 +67,7 @@#include <linux/acpi.h> #include <linux/init.h> #include <linux/sfi.h> +#include <linux/sfi_gpio.h> #include <linux/slab.h> #include "sfi_core.h" @@ -512,6 +513,12 @@ void __init sfi_init_late(void) syst_va =sfi_map_memory (syst_pa, length);sfi_acpi_init (); + +/* +* Parsing GPIO table first, since the DEVS table will need this table +* to map the pin name to the actual pin. +*/ +sfi_gpio_init (); }/* include/linux/sfi_gpio.h new file +27
-0@@ -0,0 +1,27 @@ +#ifndef _LINUX_SFI_GPIO_H_ +#define _LINUX_SFI_GPIO_H_ + +#include <linux/errno.h> +#include <linux/gpio.h> +#include <linux/sfi.h> + +#ifdef CONFIG_GPIO_SFI + +int sfi_get_gpio_by_name (const char *name); +int sfi_gpio_init (void ); + +#else /* CONFIG_GPIO_SFI */ + +static inline int sfi_get_gpio_by_name (const char *name); +{ +return -ENODEV ; +} + +static inline int sfi_gpio_init (void ) +{ +return -ENODEV ; +} + +#endif /* CONFIG_GPIO_SFI */ + +#endif /* _LINUX_SFI_GPIO_H_ */
Re: [PATCH v1.1] gpiolib: append SFI helpers for GPIO API
Quoted 2 lines · Ryan Mallon
On 31/05/13 19:27, Andy Shevchenko wrote:
Some trivial coding style comment below.
[]
Quoted 6 lines
drivers/gpio/gpiolib-sfi.c line 39
Quoted 4 lines
drivers/gpio/gpiolib-sfi.c new file +4
-0+for (i =0 ; i < sfi_gpio_num_entry; i++, pentry++) { +if (!strncmp (name, pentry->pin_name,SFI_NAME_LEN )) +return pentry->pin_no; + }Nitpick - Don't need the braces on the for loop.
I'm not Andy but I think it's preferable to keep the braces when there's an if in the for loop.
Quoted 3 lines
drivers/gpio/gpiolib-sfi.c line 57
Quoted 1 line
drivers/gpio/gpiolib-sfi.c new file +1
-0+ sfi_gpio_table =kmalloc (num *sizeof (*pentry),GFP_KERNEL );Use kcalloc when you have a size and a count.
kmalloc_array unless you want zero'ed memory
Quoted 7 lines
drivers/gpio/gpiolib-sfi.c line 68
Quoted 4 lines
drivers/gpio/gpiolib-sfi.c new file +4
-0+for (i =0 ; i < num; i++, pentry++) +pr_debug ("[%2d] chip = %16.16s, name = %16.16s, pin=%d\n" , i, + pentry->controller_name, pentry->pin_name, + pentry->pin_no);Why "%16.16s" here? "%16s" will right justify with leading spaces, or "%-16s" will left justify with trailing spaces.
This limits the emitted length to 16 regardless of strlen(pentry->controller_name) / strlen(pentry->pin_name)
Re: [PATCH v1.1] gpiolib: append SFI helpers for GPIO API
Quoted 3 lines · Joe Perches
Quoted 2 lines · Ryan Mallon
On 31/05/13 19:27, Andy Shevchenko wrote:
Some trivial coding style comment below.
Thank you, Joe, for commenting this.
Quoted 9 lines
Quoted 6 lines
drivers/gpio/gpiolib-sfi.c line 39
Quoted 4 lines
drivers/gpio/gpiolib-sfi.c new file +4
-0+for (i =0 ; i < sfi_gpio_num_entry; i++, pentry++) { +if (!strncmp (name, pentry->pin_name,SFI_NAME_LEN )) +return pentry->pin_no; + }Nitpick - Don't need the braces on the for loop.
I'm not Andy but I think it's preferable to keep the braces when there's an if in the for loop.
This is my point too.
Quoted 5 lines
Quoted 3 lines
drivers/gpio/gpiolib-sfi.c line 57
Quoted 1 line
drivers/gpio/gpiolib-sfi.c new file +1
-0+ sfi_gpio_table =kmalloc (num *sizeof (*pentry),GFP_KERNEL );Use kcalloc when you have a size and a count.
kmalloc_arrayunless you want zero'ed memory
One proposed to use kmemdup to clean up a bit. What do you think?
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Re: [PATCH v1.1] gpiolib: append SFI helpers for GPIO API
Quoted 7 lines · Andy Shevchenko
Quoted 5 lines · Joe Perches
Quoted 3 lines · Ryan Mallon
drivers/gpio/gpiolib-sfi.c line 57
Quoted 1 line · Andy Shevchenko
drivers/gpio/gpiolib-sfi.c new file +1
-0+ sfi_gpio_table =kmalloc (num *sizeof (*pentry),GFP_KERNEL );Use kcalloc when you have a size and a count.
kmalloc_arrayunless you want zero'ed memoryOne proposed to use kmemdup to clean up a bit. What do you think?
Seems correct to use kmemdup but what validates num?
It seems like a possible error path exists there regardless of whether kmemdup is used or not.
Re: [PATCH v1.1] gpiolib: append SFI helpers for GPIO API
Quoted 10 lines · Joe Perches
Quoted 7 lines · Andy Shevchenko
Quoted 5 lines · Joe Perches
Quoted 3 lines · Ryan Mallon
Quoted 1 line · Andy Shevchenko
+
sfi_gpio_table=kmalloc(num * sizeof(*pentry), GFP_KERNEL);Use kcalloc when you have a size and a count.
kmalloc_arrayunless you want zero'ed memoryOne proposed to use kmemdup to clean up a bit. What do you think?
Seems correct to use kmemdup but what validates num?
num comes from SFI firmware. We only could rely on what kmalloc/kmemdup returns.
Quoted 2 lines
It seems like a possible error path exists there regardless of whether kmemdup is used or not.
That's true. The advantage of kmemdup is an implicit memcpy. Thus, we could drop away that line.
--
With Best Regards,
Andy Shevchenko
Re: [PATCH v1.1] gpiolib: append SFI helpers for GPIO API
In reply to Andy ShevchenkoQuoted 5 lines · Andy Shevchenko
To support some (legacy) firmwares and platforms let's make life easier for their customers.
This patch extracts SFI GPIO API from
arch/x86/platform/mrst/mrst.c.
Quoted 8 lines
Signed-off-by Andy Shevchenko <[email protected]>Acked-by Len Brown <[email protected]>Cc Grant Likely <[email protected]>Cc Linus Walleij <[email protected]>---
Since v1:
- address Linus' comments: self-descriptive error codes, removal of__initin header, better title in c-file.
I'm happy with this.
Yours,
Linus Walleij
PATCH 13/13 x86: mrst: move to generic SFI GPIO API
In reply to Sathyanarayanan KuppuswamyLet's use the common SFI helpers for GPIO API.
--- arch/x86/include/asm/intel-mid.h | 2 +- .../intel-mid/device_libs/platform_emc1403.c | 4 +- .../intel-mid/device_libs/platform_gpio_keys.c | 2 +- .../intel-mid/device_libs/platform_lis331.c | 4 +- .../intel-mid/device_libs/platform_max3111.c | 2 +- .../intel-mid/device_libs/platform_max7315.c | 4 +- .../intel-mid/device_libs/platform_mpu3050.c | 2 +- .../intel-mid/device_libs/platform_msic_gpio.c | 2 +- .../intel-mid/device_libs/platform_msic_ocd.c | 2 +- .../intel-mid/device_libs/platform_pmic_gpio.c | 2 +- .../intel-mid/device_libs/platform_tc35876x.c | 6 +-- .../intel-mid/device_libs/platform_tca6416.c | 4 +- arch/x86/platform/intel-mid/intel_mid_sfi.c | 51 -------------------- 13 files changed, 18 insertions(+), 69 deletions(-)
arch/x86/include/asm/intel-mid.h +1 -1
@@ -12,10 +12,10 @@#define _ASM_X86_INTEL_MID_H#include <linux/sfi.h> +#include <linux/sfi_gpio.h> #include <linux/platform_device.h> extern int intel_mid_pci_init (void ); -extern int get_gpio_by_name (const char *name);extern void intel_scu_device_register (struct platform_device *pdev);extern int __init sfi_parse_mrtc (struct sfi_table_header *table);extern int __init sfi_parse_mtmr (struct sfi_table_header *table);
arch/x86/platform/intel-mid/device_libs/platform_emc1403.c +2 -2
@@ -20,8 +20,8 @@ void __init *emc1403_platform_data(void *info) {static short intr2nd_pdata;struct i2c_board_info *i2c_info = info; -int intr =get_gpio_by_name ("thermal_int" ); -int intr2nd =get_gpio_by_name ("thermal_alert" ); +int intr =sfi_get_gpio_by_name ("thermal_int" ); +int intr2nd =sfi_get_gpio_by_name ("thermal_alert" );if (intr ==-1 || intr2nd ==-1 )return NULL ;
arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c +1 -1
@@ -62,7 +62,7 @@ static int __init pb_keys_init(void) num =sizeof (gpio_button) /sizeof (struct gpio_keys_button );for (i =0 ; i < num; i++) { - gb[i].gpio =get_gpio_by_name (gb[i].desc); + gb[i].gpio =sfi_get_gpio_by_name (gb[i].desc);pr_debug ("info[%2d]: name = %s, gpio = %d\n" , i, gb[i].desc, gb[i].gpio);if (gb[i].gpio ==-1 )
arch/x86/platform/intel-mid/device_libs/platform_lis331.c +2 -2
@@ -19,8 +19,8 @@ void __init *lis331dl_platform_data(void *info) {static short intr2nd_pdata;struct i2c_board_info *i2c_info = info; -int intr =get_gpio_by_name ("accel_int" ); -int intr2nd =get_gpio_by_name ("accel_2" ); +int intr =sfi_get_gpio_by_name ("accel_int" ); +int intr2nd =sfi_get_gpio_by_name ("accel_2" );if (intr ==-1 || intr2nd ==-1 )return NULL ;
arch/x86/platform/intel-mid/device_libs/platform_max3111.c +1 -1
@@ -18,7 +18,7 @@void __init *max3111_platform_data (void *info) {struct spi_board_info *spi_info = info; -int intr =get_gpio_by_name ("max3111_int" ); +int intr =sfi_get_gpio_by_name ("max3111_int" ); spi_info->mode =SPI_MODE_0 ;if (intr ==-1 )
arch/x86/platform/intel-mid/device_libs/platform_max7315.c +2 -2
@@ -45,8 +45,8 @@ void __init *max7315_platform_data(void *info)strcpy (intr_pin_name,"max7315_int" ); } - gpio_base =get_gpio_by_name (base_pin_name); - intr =get_gpio_by_name (intr_pin_name); + gpio_base =sfi_get_gpio_by_name (base_pin_name); + intr =sfi_get_gpio_by_name (intr_pin_name);if (gpio_base ==-1 )return NULL ;
arch/x86/platform/intel-mid/device_libs/platform_mpu3050.c +1 -1
@@ -18,7 +18,7 @@void *mpu3050_platform_data (void *info) {struct i2c_board_info *i2c_info = info; -int intr =get_gpio_by_name ("mpu3050_int" ); +int intr =sfi_get_gpio_by_name ("mpu3050_int" );if (intr ==-1 )return NULL ;
arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.c +1 -1
@@ -25,7 +25,7 @@ void __init *msic_gpio_platform_data(void *info) {static struct intel_msic_gpio_pdata msic_gpio_pdata; -int gpio =get_gpio_by_name ("msic_gpio_base" ); +int gpio =sfi_get_gpio_by_name ("msic_gpio_base" );if (gpio <0 )return NULL ;
arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.c +1 -1
@@ -26,7 +26,7 @@ void __init *msic_ocd_platform_data(void *info)static struct intel_msic_ocd_pdata msic_ocd_pdata;int gpio; - gpio =get_gpio_by_name ("ocd_gpio" ); + gpio =sfi_get_gpio_by_name ("ocd_gpio" );if (gpio <0 )return NULL ;
arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.c +1 -1
@@ -23,7 +23,7 @@void __init *pmic_gpio_platform_data (void *info) {static struct intel_pmic_gpio_platform_data pmic_gpio_pdata; -int gpio_base =get_gpio_by_name ("pmic_gpio_base" ); +int gpio_base =sfi_get_gpio_by_name ("pmic_gpio_base" );if (gpio_base ==-1 ) gpio_base =64 ;
arch/x86/platform/intel-mid/device_libs/platform_tc35876x.c +3 -3
@@ -21,9 +21,9 @@ void *tc35876x_platform_data(void *data)static struct tc35876x_platform_data pdata;/* gpio pins set to -1 will not be used by the driver */ - pdata.gpio_bridge_reset =get_gpio_by_name ("LCMB_RXEN" ); - pdata.gpio_panel_bl_en =get_gpio_by_name ("6S6P_BL_EN" ); - pdata.gpio_panel_vadd =get_gpio_by_name ("EN_VREG_LCD_V3P3" ); + pdata.gpio_bridge_reset =sfi_get_gpio_by_name ("LCMB_RXEN" ); + pdata.gpio_panel_bl_en =sfi_get_gpio_by_name ("6S6P_BL_EN" ); + pdata.gpio_panel_vadd =sfi_get_gpio_by_name ("EN_VREG_LCD_V3P3" );return &pdata; }
arch/x86/platform/intel-mid/device_libs/platform_tca6416.c +2 -2
@@ -28,8 +28,8 @@ void *tca6416_platform_data(void *info)strcpy (base_pin_name,TCA6416_BASE );strcpy (intr_pin_name,TCA6416_INTR ); - gpio_base =get_gpio_by_name (base_pin_name); - intr =get_gpio_by_name (intr_pin_name); + gpio_base =sfi_get_gpio_by_name (base_pin_name); + intr =sfi_get_gpio_by_name (intr_pin_name);if (gpio_base ==-1 )return NULL ;
arch/x86/platform/intel-mid/intel_mid_sfi.c +0 -51
80 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Quoted 6 lines · Sathyanarayanan Kuppuswamy
As Intel rolling out more SoC's after Moorestown, we need to re-structure the code in a way that is backward compatible and easy to expand.This patch set implements a flexible way to support multiple boards and devices.
Patch 1 - 5 fixes some indentation issue, compiler warnings and renames. Patch 6 - 13 refactors mrst code.
First of all, please, remove Gerrit IDs from the commit messages.
Quoted 3 lines
Andy Shevchenko (2):
sfi: fix compiler warnings
gpiolib: append SFI helpers for GPIO API
I still insist you may move my patches before you do split to the device_lib.
Now you do some cleaning up, than split, than move to new GPIO API. In proposed case you will have one step less.
Other comments are provided by patch.
P.S. There are new versions of my patches. One of them was published already, I put a link in the comment, the other will be ready soon (addressing Linus' comments).
Signature · 2 lines
With Best Regards, Andy Shevchenko