platform, x86: Kill off Moorestown
PATCH 1/5 platform, x86: Kill off Moorestown
From: Alan Cox <[email protected]>
All production devices operate in the Oaktrail configuration with legacy PC elements present and an ACPI BIOS. Continue stripping out the Moorestown elements from the tree leaving Medfield.
---
drivers/platform/x86/Kconfig | 22 - drivers/platform/x86/Makefile | 1 drivers/platform/x86/intel_rar_register.c | 669 ----------------------------- include/linux/rar_register.h | 60 --- 4 files changed, 0 insertions(+), 752 deletions(-) delete mode 100644 drivers/platform/x86/intel_rar_register.c delete mode 100644 include/linux/rar_register.h
drivers/platform/x86/Kconfig +0 -22
@@ -677,28 +677,6 @@ config INTEL_MFLD_THERMAL Say Y here to enable thermal driver support for the Intel Medfield platform. -config RAR_REGISTER - bool "Restricted Access Region Register Driver" - depends on PCI && X86_MRST - default n - ---help--- - This driver allows other kernel drivers access to the - contents of the restricted access region control registers. - - The restricted access region control registers - (rar_registers) are used to pass address and - locking information on restricted access regions - to other drivers that use restricted access regions. - - The restricted access regions are regions of memory - on the Intel MID Platform that are not accessible to - the x86 processor, but are accessible to dedicated - processors on board peripheral devices. - - The purpose of the restricted access regions is to - protect sensitive data from compromise by unauthorized - programs running on the x86 processor. - config INTEL_IPS tristate "Intel Intelligent Power Sharing" depends on ACPI
drivers/platform/x86/Makefile +0 -1
@@ -34,7 +34,6 @@ obj-$(CONFIG_TOSHIBA_BT_RFKILL) += toshiba_bluetooth.o obj-$(CONFIG_INTEL_SCU_IPC) += intel_scu_ipc.o obj-$(CONFIG_INTEL_SCU_IPC_UTIL) += intel_scu_ipcutil.o obj-$(CONFIG_INTEL_MFLD_THERMAL) += intel_mid_thermal.o -obj-$(CONFIG_RAR_REGISTER) += intel_rar_register.o obj-$(CONFIG_INTEL_IPS) += intel_ips.o obj-$(CONFIG_GPIO_INTEL_PMIC) += intel_pmic_gpio.o obj-$(CONFIG_XO1_RFKILL) += xo1-rfkill.o
drivers/platform/x86/intel_rar_register.c deleted +0 -669
669 lines not on this page · raw message
include/linux/rar_register.h deleted +0 -60
60 lines not on this page · raw message
PATCH 2/5 intel_scu_ipc: Remove Moorestown support
From: Alan Cox <[email protected]>
[I've sent this repeatedly with no response, so it would be useful to know
if you are getting it and ignoring it or it's not getting to you Matthew.
If I don't get a response this time I'll start sending the platform x86 patches for Intel MID device directly to Linus]
All the production devices use the PC compatible version of this device so don't use the SCU interfaces or the SCU firmware interfaces.
Delete lots of code and conditional paths
---
drivers/platform/x86/intel_scu_ipc.c | 208 +++--------------------------- drivers/platform/x86/intel_scu_ipcutil.c | 32 +---- 2 files changed, 30 insertions(+), 210 deletions(-)
drivers/platform/x86/intel_scu_ipc.c +22 -186
@@ -159,7 +159,7 @@ static inline int busy_loop(void) /* Wait till scu status is busy *//* Read/Write power control(PMIC in Langwell, MSIC in PenWell) registers */ static int pwr_reg_rdwr (u16 *addr,u8 *data,u32 count,u32 op,u32 id) { -int i, nc, bytes, d; +int nc;u32 offset =0 ;int err;u8 cbuf[IPC_WWBUF_SIZE ] = { };
@@ -174,55 +174,34 @@ static int pwr_reg_rdwr(u16 *addr, u8 *data, u32 count, u32 op, u32 id)return -ENODEV ; } -if (platform !=MRST_CPU_CHIP_PENWELL ) { - bytes =0 ; - d =0 ; -for (i =0 ; i < count; i++) { - cbuf[bytes++] = addr[i]; - cbuf[bytes++] = addr[i] >>8 ; -if (id !=IPC_CMD_PCNTRL_R ) - cbuf[bytes++] = data[d++]; -if (id ==IPC_CMD_PCNTRL_M ) - cbuf[bytes++] = data[d++]; - } -for (i =0 ; i < bytes; i +=4 ) -ipc_data_writel (wbuf[i/4 ], i); -ipc_command (bytes <<16 | id <<12 |0 <<8 | op); - }else { -for (nc =0 ; nc < count; nc++, offset +=2 ) { - cbuf[offset] = addr[nc]; - cbuf[offset +1 ] = addr[nc] >>8 ; - } +for (nc =0 ; nc < count; nc++, offset +=2 ) { + cbuf[offset] = addr[nc]; + cbuf[offset +1 ] = addr[nc] >>8 ; + } -if (id ==IPC_CMD_PCNTRL_R ) { -for (nc =0 , offset =0 ; nc < count; nc++, offset +=4 ) -ipc_data_writel (wbuf[nc], offset); -ipc_command ((count*2 ) <<16 | id <<12 |0 <<8 | op); - }else if (id ==IPC_CMD_PCNTRL_W ) { -for (nc =0 ; nc < count; nc++, offset +=1 ) - cbuf[offset] = data[nc]; -for (nc =0 , offset =0 ; nc < count; nc++, offset +=4 ) -ipc_data_writel (wbuf[nc], offset); -ipc_command ((count*3 ) <<16 | id <<12 |0 <<8 | op); - }else if (id ==IPC_CMD_PCNTRL_M ) { - cbuf[offset] = data[0 ]; - cbuf[offset +1 ] = data[1 ]; -ipc_data_writel (wbuf[0 ],0 );/* Write wbuff */ -ipc_command (4 <<16 | id <<12 |0 <<8 | op); - } +if (id ==IPC_CMD_PCNTRL_R ) { +for (nc =0 , offset =0 ; nc < count; nc++, offset +=4 ) +ipc_data_writel (wbuf[nc], offset); +ipc_command ((count*2 ) <<16 | id <<12 |0 <<8 | op); + }else if (id ==IPC_CMD_PCNTRL_W ) { +for (nc =0 ; nc < count; nc++, offset +=1 ) + cbuf[offset] = data[nc]; +for (nc =0 , offset =0 ; nc < count; nc++, offset +=4 ) +ipc_data_writel (wbuf[nc], offset); +ipc_command ((count*3 ) <<16 | id <<12 |0 <<8 | op); + }else if (id ==IPC_CMD_PCNTRL_M ) { + cbuf[offset] = data[0 ]; + cbuf[offset +1 ] = data[1 ]; +ipc_data_writel (wbuf[0 ],0 );/* Write wbuff */ +ipc_command (4 <<16 | id <<12 |0 <<8 | op); } err =busy_loop ();if (id ==IPC_CMD_PCNTRL_R ) {/* Read rbuf */ /* Workaround: values are read as 0 without memcpy_fromio */ memcpy_fromio (cbuf, ipcdev.ipc_base +0x90 ,16 ); -if (platform !=MRST_CPU_CHIP_PENWELL ) { -for (nc =0 , offset =2 ; nc < count; nc++, offset +=3 ) - data[nc] =ipc_data_readb (offset); - }else { -for (nc =0 ; nc < count; nc++) - data[nc] =ipc_data_readb (nc); - } +for (nc =0 ; nc < count; nc++) + data[nc] =ipc_data_readb (nc); }mutex_unlock (&ipclock);return err;
@@ -503,148 +482,6 @@ int intel_scu_ipc_i2c_cntrl(u32 addr, u32 *data) }EXPORT_SYMBOL (intel_scu_ipc_i2c_cntrl); -#define IPC_FW_LOAD_ADDR 0xFFFC0000/* Storage location for FW image */ -#define IPC_FW_UPDATE_MBOX_ADDR 0xFFFFDFF4/* Mailbox between ipc and scu */ -#define IPC_MAX_FW_SIZE 262144/* 256K storage size for loading the FW image */ -#define IPC_FW_MIP_HEADER_SIZE 2048/* Firmware MIP header size */ -/* IPC inform SCU to get ready for update process */ -#define IPC_CMD_FW_UPDATE_READY 0x10FE -/* IPC inform SCU to go for update process */ -#define IPC_CMD_FW_UPDATE_GO 0x20FE -/* Status code for fw update */ -#define IPC_FW_UPDATE_SUCCESS 0x444f4e45/* Status code 'DONE' */ -#define IPC_FW_UPDATE_BADN 0x4241444E/* Status code 'BADN' */ -#define IPC_FW_TXHIGH 0x54784849/* Status code 'IPC_FW_TXHIGH' */ -#define IPC_FW_TXLOW 0x54784c4f/* Status code 'IPC_FW_TXLOW' */ - -struct fw_update_mailbox { -u32 status; -u32 scu_flag; -u32 driver_flag; -}; - - -/** -* intel_scu_ipc_fw_update - Firmware update utility -* @buffer: firmware buffer -* @length: size of firmware buffer -* -* This function provides an interface to load the firmware into -* the SCU. Returns 0 on success or -1 on failure -*/ -int intel_scu_ipc_fw_update (u8 *buffer,u32 length) -{ -void __iomem *fw_update_base; -struct fw_update_mailbox __iomem *mailbox =NULL ; -int retry_cnt =0 ; -u32 status; - -mutex_lock (&ipclock); - fw_update_base =ioremap_nocache (IPC_FW_LOAD_ADDR , (128 *1024 )); -if (fw_update_base ==NULL ) { -mutex_unlock (&ipclock); -return -ENOMEM ; - } - mailbox =ioremap_nocache (IPC_FW_UPDATE_MBOX_ADDR , -sizeof (struct fw_update_mailbox )); -if (mailbox ==NULL ) { -iounmap (fw_update_base); -mutex_unlock (&ipclock); -return -ENOMEM ; - } - -ipc_command (IPC_CMD_FW_UPDATE_READY ); - -/* Intitialize mailbox */ -writel (0 , &mailbox->status); -writel (0 , &mailbox->scu_flag); -writel (0 , &mailbox->driver_flag); - -/* Driver copies the 2KB MIP header to SRAM at 0xFFFC0000*/ -memcpy_toio (fw_update_base, buffer,0x800 ); - -/* Driver sends "FW Update" IPC command (CMD_ID 0xFE; MSG_ID 0x02). -* Upon receiving this command, SCU will write the 2K MIP header -* from 0xFFFC0000 into NAND. -* SCU will write a status code into the Mailbox, and then set scu_flag. -*/ - -ipc_command (IPC_CMD_FW_UPDATE_GO ); - -/*Driver stalls until scu_flag is set */ -while (readl (&mailbox->scu_flag) !=1 ) { -rmb (); -mdelay (1 ); - } - -/* Driver checks Mailbox status. -* If the status is 'BADN', then abort (bad NAND). -* If the status is 'IPC_FW_TXLOW', then continue. -*/ -while (readl (&mailbox->status) !=IPC_FW_TXLOW ) { -rmb (); -mdelay (10 ); - } -mdelay (10 ); - -update_retry: -if (retry_cnt >5 ) - goto update_end; - -if (readl (&mailbox->status) !=IPC_FW_TXLOW ) - goto update_end; - buffer = buffer +0x800 ; -memcpy_toio (fw_update_base, buffer,0x20000 ); -writel (1 , &mailbox->driver_flag); -while (readl (&mailbox->scu_flag) ==1 ) { -rmb (); -mdelay (1 ); - } - -/* check for 'BADN' */ -if (readl (&mailbox->status) ==IPC_FW_UPDATE_BADN ) - goto update_end; - -while (readl (&mailbox->status) !=IPC_FW_TXHIGH ) { -rmb (); -mdelay (10 ); - } -mdelay (10 ); - -if (readl (&mailbox->status) !=IPC_FW_TXHIGH ) - goto update_end; - - buffer = buffer +0x20000 ; -memcpy_toio (fw_update_base, buffer,0x20000 ); -writel (0 , &mailbox->driver_flag); - -while (mailbox->scu_flag ==0 ) { -rmb (); -mdelay (1 ); - } - -/* check for 'BADN' */ -if (readl (&mailbox->status) ==IPC_FW_UPDATE_BADN ) - goto update_end; - -if (readl (&mailbox->status) ==IPC_FW_TXLOW ) { - ++retry_cnt; - goto update_retry; - } - -update_end: - status =readl (&mailbox->status); - -iounmap (fw_update_base); -iounmap (mailbox); -mutex_unlock (&ipclock); - -if (status ==IPC_FW_UPDATE_SUCCESS ) -return 0 ; -return -EIO ; -} -EXPORT_SYMBOL (intel_scu_ipc_fw_update); -/* * Interrupt handler gets called when ioc bit of IPC_COMMAND_REG set to 1 * When ioc bit is set to 1, caller api must wait for interrupt handler called
@@ -727,7 +564,6 @@ static void ipc_remove(struct pci_dev *pdev) }static DEFINE_PCI_DEVICE_TABLE (pci_ids) = { - {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x080e )}, {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x082a )}, {0 ,} };
drivers/platform/x86/intel_scu_ipcutil.c +8 -24
@@ -26,13 +26,10 @@static int major; -#define MAX_FW_SIZE 264192 -/* ioctl commnds */ #define INTE_SCU_IPC_REGISTER_READ 0#define INTE_SCU_IPC_REGISTER_WRITE 1#define INTE_SCU_IPC_REGISTER_UPDATE 2 -#define INTE_SCU_IPC_FW_UPDATE 0xA2struct scu_ipc_data {u32 count;/* No. of registers */
@@ -88,27 +85,14 @@ static long scu_ipc_ioctl(struct file *fp, unsigned int cmd,if (!capable (CAP_SYS_RAWIO ))return -EPERM ; -if (cmd ==INTE_SCU_IPC_FW_UPDATE ) { -u8 *fwbuf =kmalloc (MAX_FW_SIZE ,GFP_KERNEL ); -if (fwbuf ==NULL ) -return -ENOMEM ; -if (copy_from_user (fwbuf, (u8 *)arg,MAX_FW_SIZE )) { -kfree (fwbuf); -return -EFAULT ; - } - ret =intel_scu_ipc_fw_update (fwbuf,MAX_FW_SIZE ); -kfree (fwbuf); -return ret; - }else { -if (copy_from_user (&data, argp,sizeof (struct scu_ipc_data ))) -return -EFAULT ; - ret =scu_reg_access (cmd, &data); -if (ret <0 ) -return ret; -if (copy_to_user (argp, &data,sizeof (struct scu_ipc_data ))) -return -EFAULT ; -return 0 ; - } +if (copy_from_user (&data, argp,sizeof (struct scu_ipc_data ))) +return -EFAULT ; + ret =scu_reg_access (cmd, &data); +if (ret <0 ) +return ret; +if (copy_to_user (argp, &data,sizeof (struct scu_ipc_data ))) +return -EFAULT ; +return 0 ; }static const struct file_operations scu_ipc_fops = {
PATCH 3/5 platform-x86: intel_mid_thermal: add msic_thermal alias
In reply to Alan CoxFrom: Mika Westerberg <[email protected]>
In newer boards this device is called "msic_thermal" instead of "msic_sensor". To support both we add suitable alias for the driver.
---
drivers/platform/x86/intel_mid_thermal.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/platform/x86/intel_mid_thermal.c +1 -0
@@ -550,6 +550,7 @@ static int mid_thermal_remove(struct platform_device *pdev)static const struct platform_device_id therm_id_table[] = { {DRIVER_NAME ,1 }, + {"msic_thermal" ,1 }, { } };
RE: [PATCH 3/5] platform-x86: intel_mid_thermal: add msic_thermal alias
Hi Alan,
Quoted 8 lines
-----Original Message-----
From: [email protected] [mailto:platform-driver-x86- [email protected]] On Behalf Of Alan Cox
Sent: Thursday, January 26, 2012 11:09 PM
To: [email protected]; [email protected]; linux- [email protected]
Subject: [PATCH 3/5] platform-x86:intel_mid_thermal: addmsic_thermalalias
Quoted 4 lines
From: Mika Westerberg <[email protected]>
In newer boards this device is called "
msic_thermal" instead of "msic_sensor". To support both we add suitable alias for the driver.
In all the medfield boards, that we use here, this is named 'msic_thermal'. So, maybe we should remove msic_sensor and just use msic_thermal. Or, Do you have any medfield boards that have this entry as 'msic_sensor' ?
Thanks,
Durga
Quoted 29 lines
Signed-off-by Mika Westerberg <[email protected]>Signed-off-by Kirill A. Shutemov <[email protected]>Signed-off-by Alan Cox <[email protected]>---
drivers/platform/x86/intel_mid_thermal.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)drivers/platform/x86/intel_mid_thermal.c +1
-1@@ -550,6 +550,7 @@ static int mid_thermal_remove(struct platform_device *pdev)static const struct platform_device_id therm_id_table[] = { {DRIVER_NAME ,1 }, + {"msic_thermal" ,1 }, { } }; --To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/5] platform-x86: intel_mid_thermal: add msic_thermal alias
Quoted 3 lines
In all the medfield boards, that we use here, this is named '
msic_thermal'. So, maybe we should removemsic_sensorand just usemsic_thermal. Or, Do you have any medfield boards that have this entry as 'msic_sensor' ?
I will check if we do.
Alan
PATCH 4/5 platform-x86: intel_mid_thermal: convert to use Intel MSIC API
In reply to Alan CoxFrom: Mika Westerberg <[email protected]>
Intel MSIC MFD driver provides common register access interface to the devices in the MSIC die so we use that instead of SCU IPC.
---
drivers/platform/x86/Kconfig | 2 +- drivers/platform/x86/intel_mid_thermal.c | 39 ++++++++++++++---------------- 2 files changed, 19 insertions(+), 22 deletions(-)
drivers/platform/x86/Kconfig +1 -1
@@ -672,7 +672,7 @@ config INTEL_MID_POWER_BUTTON config INTEL_MFLD_THERMAL tristate "Thermal driver for Intel Medfield platform" - depends on INTEL_SCU_IPC && THERMAL + depends on MFD_INTEL_MSIC && THERMAL help Say Y here to enable thermal driver support for the Intel Medfield platform.
drivers/platform/x86/intel_mid_thermal.c +18 -21
@@ -33,18 +33,15 @@#include <linux/slab.h> #include <linux/pm.h> #include <linux/thermal.h> - -#include <asm/intel_scu_ipc.h> +#include <linux/mfd/intel_msic.h> /* Number of thermal sensors */ #define MSIC_THERMAL_SENSORS 4/* ADC1 - thermal registers */ -#define MSIC_THERM_ADC1CNTL1 0x1C0#define MSIC_ADC_ENBL 0x10#define MSIC_ADC_START 0x08 -#define MSIC_THERM_ADC1CNTL3 0x1C2#define MSIC_ADCTHERM_ENBL 0x04#define MSIC_ADCRRDATA_ENBL 0x05#define MSIC_CHANL_MASK_VAL 0x0F
@@ -75,8 +72,8 @@#define ADC_VAL60C 315/* ADC base addresses */ -#define ADC_CHNL_START_ADDR 0x1C5/* increments by 1 */ -#define ADC_DATA_START_ADDR 0x1D4/* increments by 2 */ +#define ADC_CHNL_START_ADDR INTEL_MSIC_ADC1ADDR0/* increments by 1 */ +#define ADC_DATA_START_ADDR INTEL_MSIC_ADC1SNS0H/* increments by 2 */ /* MSIC die attributes */ #define MSIC_DIE_ADC_MIN 488
@@ -189,17 +186,17 @@ static int mid_read_temp(struct thermal_zone_device *tzd, unsigned long *temp) addr = td_info->chnl_addr;/* Enable the msic for conversion before reading */ - ret =intel_scu_ipc_iowrite8 (MSIC_THERM_ADC1CNTL3 ,MSIC_ADCRRDATA_ENBL ); + ret =intel_msic_reg_write (INTEL_MSIC_ADC1CNTL3 ,MSIC_ADCRRDATA_ENBL );if (ret)return ret;/* Re-toggle the RRDATARD bit (temporary workaround) */ - ret =intel_scu_ipc_iowrite8 (MSIC_THERM_ADC1CNTL3 ,MSIC_ADCTHERM_ENBL ); + ret =intel_msic_reg_write (INTEL_MSIC_ADC1CNTL3 ,MSIC_ADCTHERM_ENBL );if (ret)return ret;/* Read the higher bits of data */ - ret =intel_scu_ipc_ioread8 (addr, &data); + ret =intel_msic_reg_read (addr, &data);if (ret)return ret;
@@ -207,7 +204,7 @@ static int mid_read_temp(struct thermal_zone_device *tzd, unsigned long *temp) adc_val = (data <<2 ); addr++; - ret =intel_scu_ipc_ioread8 (addr, &data);/* Read lower bits */ + ret =intel_msic_reg_read (addr, &data);/* Read lower bits */ if (ret)return ret;
@@ -235,7 +232,7 @@ static int configure_adc(int val)int ret;uint8_t data; - ret =intel_scu_ipc_ioread8 (MSIC_THERM_ADC1CNTL1 , &data); + ret =intel_msic_reg_read (INTEL_MSIC_ADC1CNTL1 , &data);if (ret)return ret;
@@ -246,7 +243,7 @@ static int configure_adc(int val)/* Just stop the ADC */ data &= (~MSIC_ADC_START ); } -return intel_scu_ipc_iowrite8 (MSIC_THERM_ADC1CNTL1 , data); +return intel_msic_reg_write (INTEL_MSIC_ADC1CNTL1 , data); }/**
@@ -262,21 +259,21 @@ static int set_up_therm_channel(u16 base_addr)int ret;/* Enable all the sensor channels */ - ret =intel_scu_ipc_iowrite8 (base_addr,SKIN_SENSOR0_CODE ); + ret =intel_msic_reg_write (base_addr,SKIN_SENSOR0_CODE );if (ret)return ret; - ret =intel_scu_ipc_iowrite8 (base_addr +1 ,SKIN_SENSOR1_CODE ); + ret =intel_msic_reg_write (base_addr +1 ,SKIN_SENSOR1_CODE );if (ret)return ret; - ret =intel_scu_ipc_iowrite8 (base_addr +2 ,SYS_SENSOR_CODE ); + ret =intel_msic_reg_write (base_addr +2 ,SYS_SENSOR_CODE );if (ret)return ret;/* Since this is the last channel, set the stop bit * to 1 by ORing the DIE_SENSOR_CODE with 0x10 */ - ret =intel_scu_ipc_iowrite8 (base_addr +3 , + ret =intel_msic_reg_write (base_addr +3 , (MSIC_DIE_SENSOR_CODE |0x10 ));if (ret)return ret;
@@ -295,11 +292,11 @@ static int reset_stopbit(uint16_t addr) {int ret;uint8_t data; - ret =intel_scu_ipc_ioread8 (addr, &data); + ret =intel_msic_reg_read (addr, &data);if (ret)return ret;/* Set the stop bit to zero */ -return intel_scu_ipc_iowrite8 (addr, (data &0xEF )); +return intel_msic_reg_write (addr, (data &0xEF )); }/**
@@ -322,7 +319,7 @@ static int find_free_channel(void)uint8_t data;/* check whether ADC is enabled */ - ret =intel_scu_ipc_ioread8 (MSIC_THERM_ADC1CNTL1 , &data); + ret =intel_msic_reg_read (INTEL_MSIC_ADC1CNTL1 , &data);if (ret)return ret;
@@ -331,7 +328,7 @@ static int find_free_channel(void)/* ADC is already enabled; Looking for an empty channel */ for (i =0 ; i <ADC_CHANLS_MAX ; i++) { - ret =intel_scu_ipc_ioread8 (ADC_CHNL_START_ADDR + i, &data); + ret =intel_msic_reg_read (ADC_CHNL_START_ADDR + i, &data);if (ret)return ret;
@@ -359,7 +356,7 @@ static int mid_initialize_adc(struct device *dev)* Ensure that adctherm is disabled before we * initialize the ADC */ - ret =intel_scu_ipc_ioread8 (MSIC_THERM_ADC1CNTL3 , &data); + ret =intel_msic_reg_read (INTEL_MSIC_ADC1CNTL3 , &data);if (ret)return ret;
RE: [PATCH 4/5] platform-x86: intel_mid_thermal: convert to use Intel MSIC API
Quoted 11 lines
-----Original Message-----
From: [email protected] [mailto:platform-driver-x86- [email protected]] On Behalf Of Alan Cox
Sent: Thursday, January 26, 2012 11:10 PM
To: [email protected]; [email protected]; linux- [email protected]
Subject: [PATCH 4/5] platform-x86:intel_mid_thermal: convert to use Intel MSIC API
Quoted 5 lines
From: Mika Westerberg <[email protected]>
Intel MSIC MFD driver provides common register access interface to the devices in the MSIC die so we use that instead of SCU IPC.
Thanks,
Durga
Quoted 182 lines
Signed-off-by Mika Westerberg <[email protected]>Signed-off-by Kirill A. Shutemov <[email protected]>Signed-off-by Alan Cox <[email protected]>---
drivers/platform/x86/Kconfig | 2 +- drivers/platform/x86/intel_mid_thermal.c | 39 ++++++++++++++---------------- 2 files changed, 19 insertions(+), 22 deletions(-)drivers/platform/x86/Kconfig +1
-1@@ -672,7 +672,7 @@ config INTEL_MID_POWER_BUTTON config INTEL_MFLD_THERMAL tristate "Thermal driver for Intel Medfield platform" - depends on INTEL_SCU_IPC && THERMAL + depends on MFD_INTEL_MSIC && THERMAL help Say Y here to enable thermal driver support for the Intel Medfield platform.drivers/platform/x86/intel_mid_thermal.c +18
-22@@ -33,18 +33,15 @@#include <linux/slab.h> #include <linux/pm.h> #include <linux/thermal.h> - -#include <asm/intel_scu_ipc.h> +#include <linux/mfd/intel_msic.h> /* Number of thermal sensors */ #define MSIC_THERMAL_SENSORS 4/* ADC1 - thermal registers */ -#define MSIC_THERM_ADC1CNTL1 0x1C0#define MSIC_ADC_ENBL 0x10#define MSIC_ADC_START 0x08 -#define MSIC_THERM_ADC1CNTL3 0x1C2#define MSIC_ADCTHERM_ENBL 0x04#define MSIC_ADCRRDATA_ENBL 0x05#define MSIC_CHANL_MASK_VAL 0x0F@@ -75,8 +72,8 @@#define ADC_VAL60C 315/* ADC base addresses */ -#define ADC_CHNL_START_ADDR 0x1C5/* increments by 1 */ -#define ADC_DATA_START_ADDR 0x1D4/* increments by 2 */ +#define ADC_CHNL_START_ADDR INTEL_MSIC_ADC1ADDR0/* increments by 1 */ +#define ADC_DATA_START_ADDR INTEL_MSIC_ADC1SNS0H/* increments by 2 */ /* MSIC die attributes */ #define MSIC_DIE_ADC_MIN 488@@ -189,17 +186,17 @@ static int mid_read_temp(struct thermal_zone_device *tzd, unsigned long *temp) addr = td_info->chnl_addr;/* Enable the msic for conversion before reading */ - ret =intel_scu_ipc_iowrite8 (MSIC_THERM_ADC1CNTL3 ,MSIC_ADCRRDATA_ENBL ); + ret =intel_msic_reg_write (INTEL_MSIC_ADC1CNTL3 ,MSIC_ADCRRDATA_ENBL );if (ret)return ret;/* Re-toggle the RRDATARD bit (temporary workaround) */ - ret =intel_scu_ipc_iowrite8 (MSIC_THERM_ADC1CNTL3 ,MSIC_ADCTHERM_ENBL ); + ret =intel_msic_reg_write (INTEL_MSIC_ADC1CNTL3 ,MSIC_ADCTHERM_ENBL );if (ret)return ret;/* Read the higher bits of data */ - ret =intel_scu_ipc_ioread8 (addr, &data); + ret =intel_msic_reg_read (addr, &data);if (ret)return ret;@@ -207,7 +204,7 @@ static int mid_read_temp(struct thermal_zone_device *tzd, unsigned long *temp) adc_val = (data <<2 ); addr++; - ret =intel_scu_ipc_ioread8 (addr, &data);/* Read lower bits */ + ret =intel_msic_reg_read (addr, &data);/* Read lower bits */ if (ret)return ret;@@ -235,7 +232,7 @@ static int configure_adc(int val)int ret;uint8_t data; - ret =intel_scu_ipc_ioread8 (MSIC_THERM_ADC1CNTL1 , &data); + ret =intel_msic_reg_read (INTEL_MSIC_ADC1CNTL1 , &data);if (ret)return ret;@@ -246,7 +243,7 @@ static int configure_adc(int val)/* Just stop the ADC */ data &= (~MSIC_ADC_START ); } -return intel_scu_ipc_iowrite8 (MSIC_THERM_ADC1CNTL1 , data); +return intel_msic_reg_write (INTEL_MSIC_ADC1CNTL1 , data); }/** @@ -262,21 +259,21 @@ static int set_up_therm_channel(u16 base_addr)int ret;/* Enable all the sensor channels */ - ret =intel_scu_ipc_iowrite8 (base_addr,SKIN_SENSOR0_CODE ); + ret =intel_msic_reg_write (base_addr,SKIN_SENSOR0_CODE );if (ret)return ret; - ret =intel_scu_ipc_iowrite8 (base_addr +1 ,SKIN_SENSOR1_CODE ); + ret =intel_msic_reg_write (base_addr +1 ,SKIN_SENSOR1_CODE );if (ret)return ret; - ret =intel_scu_ipc_iowrite8 (base_addr +2 ,SYS_SENSOR_CODE ); + ret =intel_msic_reg_write (base_addr +2 ,SYS_SENSOR_CODE );if (ret)return ret;/* Since this is the last channel, set the stop bit * to 1 by ORing the DIE_SENSOR_CODE with 0x10 */ - ret =intel_scu_ipc_iowrite8 (base_addr +3 , + ret =intel_msic_reg_write (base_addr +3 , (MSIC_DIE_SENSOR_CODE |0x10 ));if (ret)return ret;@@ -295,11 +292,11 @@ static int reset_stopbit(uint16_t addr) {int ret;uint8_t data; - ret =intel_scu_ipc_ioread8 (addr, &data); + ret =intel_msic_reg_read (addr, &data);if (ret)return ret;/* Set the stop bit to zero */ -return intel_scu_ipc_iowrite8 (addr, (data &0xEF )); +return intel_msic_reg_write (addr, (data &0xEF )); }/** @@ -322,7 +319,7 @@ static int find_free_channel(void)uint8_t data;/* check whether ADC is enabled */ - ret =intel_scu_ipc_ioread8 (MSIC_THERM_ADC1CNTL1 , &data); + ret =intel_msic_reg_read (INTEL_MSIC_ADC1CNTL1 , &data);if (ret)return ret;@@ -331,7 +328,7 @@ static int find_free_channel(void)/* ADC is already enabled; Looking for an empty channel */ for (i =0 ; i <ADC_CHANLS_MAX ; i++) { - ret =intel_scu_ipc_ioread8 (ADC_CHNL_START_ADDR + i, &data); + ret =intel_msic_reg_read (ADC_CHNL_START_ADDR + i, &data);if (ret)return ret;@@ -359,7 +356,7 @@ static int mid_initialize_adc(struct device *dev)* Ensure that adctherm is disabled before we * initialize the ADC */ - ret =intel_scu_ipc_ioread8 (MSIC_THERM_ADC1CNTL3 , &data); + ret =intel_msic_reg_read (INTEL_MSIC_ADC1CNTL3 , &data);if (ret)return ret; --To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/5 platform-x86: intel_mid_thermal: turn off thermistor voltage by default
In reply to Alan CoxFrom: Mika Westerberg <[email protected]>
Instead of complaining that the voltage is on, we can just ask the MSIC to turn the voltage off. This should save some power.
Voltage for thermistors is turned on when ADC conversion is initiated.
---
drivers/platform/x86/intel_mid_thermal.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/platform/x86/intel_mid_thermal.c +4 -2
@@ -360,8 +360,10 @@ static int mid_initialize_adc(struct device *dev)if (ret)return ret; -if (data &MSIC_ADCTHERM_MASK ) -dev_warn (dev,"ADCTHERM already set" ); + data &= ~MSIC_ADCTHERM_MASK ; + ret =intel_msic_reg_write (INTEL_MSIC_ADC1CNTL3 , data); +if (ret) +return ret;/* Index of the first channel in which the stop bit is set */ channel_index =find_free_channel ();
RE: [PATCH 5/5] platform-x86: intel_mid_thermal: turn off thermistor voltage by default
Quoted 9 lines
-----Original Message-----
From: [email protected] [mailto:platform-driver-x86- [email protected]] On Behalf Of Alan Cox
Sent: Thursday, January 26, 2012 11:10 PM
To: [email protected]; [email protected]; linux- [email protected]
Subject: [PATCH 5/5] platform-x86:intel_mid_thermal: turn off thermistor voltage by default
Quoted 6 lines
From: Mika Westerberg <[email protected]>
Instead of complaining that the voltage is on, we can just ask the MSIC to turn the voltage off. This should save some power.
Voltage for thermistors is turned on when ADC conversion is initiated.
Thanks,
Durga
Quoted 34 lines
Signed-off-by Mika Westerberg <[email protected]>Signed-off-by Kirill A. Shutemov <[email protected]>Signed-off-by Alan Cox <[email protected]>---
drivers/platform/x86/intel_mid_thermal.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)drivers/platform/x86/intel_mid_thermal.c +4
-3@@ -360,8 +360,10 @@ static int mid_initialize_adc(struct device *dev)if (ret)return ret; -if (data &MSIC_ADCTHERM_MASK ) -dev_warn (dev,"ADCTHERM already set" ); + data &= ~MSIC_ADCTHERM_MASK ; + ret =intel_msic_reg_write (INTEL_MSIC_ADC1CNTL3 , data); +if (ret) +return ret;/* Index of the first channel in which the stop bit is set */ channel_index =find_free_channel (); --To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html