x86/platform/iosf_mbi: Remove duplicate definitions
Subsystems (6)
Andy Shevchenko
reviewerPATCH 1/1 x86/platform/iosf_mbi: Remove duplicate definitions
The read and write opcodes are global for all units on SoC and even across Intel SoCs. Remove duplication of corresponding constants. At the same time convert all current users.
No functional change.
--- arch/x86/include/asm/iosf_mbi.h | 49 +++++----------------- arch/x86/platform/atom/punit_atom_debug.c | 7 +--- drivers/i2c/busses/i2c-designware-baytrail.c | 17 +++----- drivers/powercap/intel_rapl.c | 10 ++--- drivers/thermal/intel_quark_dts_thermal.c | 61 ++++++++++++++-------------- drivers/thermal/intel_soc_dts_iosf.c | 43 ++++++++++---------- 6 files changed, 75 insertions(+), 112 deletions(-)
arch/x86/include/asm/iosf_mbi.h +11 -38
@@ -1,5 +1,5 @@/* -* iosf_mbi.h: Intel OnChip System Fabric MailBox access support +* Intel OnChip System Fabric MailBox access support */ #ifndef IOSF_MBI_SYMS_H
@@ -16,6 +16,16 @@#define MBI_MASK_LO 0x000000FF#define MBI_ENABLE 0xF0 +/* IOSF SB read/write opcodes */ +#define MBI_MMIO_READ 0x00 +#define MBI_MMIO_WRITE 0x01 +#define MBI_CR_READ 0x06 +#define MBI_CR_WRITE 0x07 +#define MBI_REG_READ 0x10 +#define MBI_REG_WRITE 0x11 +#define MBI_ESRAM_READ 0x12 +#define MBI_ESRAM_WRITE 0x13 +/* Baytrail available units */ #define BT_MBI_UNIT_AUNIT 0x00#define BT_MBI_UNIT_SMC 0x01
@@ -28,50 +38,13 @@#define BT_MBI_UNIT_SATA 0xA3#define BT_MBI_UNIT_PCIE 0xA6 -/* Baytrail read/write opcodes */ -#define BT_MBI_AUNIT_READ 0x10 -#define BT_MBI_AUNIT_WRITE 0x11 -#define BT_MBI_SMC_READ 0x10 -#define BT_MBI_SMC_WRITE 0x11 -#define BT_MBI_CPU_READ 0x10 -#define BT_MBI_CPU_WRITE 0x11 -#define BT_MBI_BUNIT_READ 0x10 -#define BT_MBI_BUNIT_WRITE 0x11 -#define BT_MBI_PMC_READ 0x06 -#define BT_MBI_PMC_WRITE 0x07 -#define BT_MBI_GFX_READ 0x00 -#define BT_MBI_GFX_WRITE 0x01 -#define BT_MBI_SMIO_READ 0x06 -#define BT_MBI_SMIO_WRITE 0x07 -#define BT_MBI_USB_READ 0x06 -#define BT_MBI_USB_WRITE 0x07 -#define BT_MBI_SATA_READ 0x00 -#define BT_MBI_SATA_WRITE 0x01 -#define BT_MBI_PCIE_READ 0x00 -#define BT_MBI_PCIE_WRITE 0x01 -/* Quark available units */ #define QRK_MBI_UNIT_HBA 0x00#define QRK_MBI_UNIT_HB 0x03#define QRK_MBI_UNIT_RMU 0x04#define QRK_MBI_UNIT_MM 0x05 -#define QRK_MBI_UNIT_MMESRAM 0x05#define QRK_MBI_UNIT_SOC 0x31 -/* Quark read/write opcodes */ -#define QRK_MBI_HBA_READ 0x10 -#define QRK_MBI_HBA_WRITE 0x11 -#define QRK_MBI_HB_READ 0x10 -#define QRK_MBI_HB_WRITE 0x11 -#define QRK_MBI_RMU_READ 0x10 -#define QRK_MBI_RMU_WRITE 0x11 -#define QRK_MBI_MM_READ 0x10 -#define QRK_MBI_MM_WRITE 0x11 -#define QRK_MBI_MMESRAM_READ 0x12 -#define QRK_MBI_MMESRAM_WRITE 0x13 -#define QRK_MBI_SOC_READ 0x06 -#define QRK_MBI_SOC_WRITE 0x07 -#if IS_ENABLED (CONFIG_IOSF_MBI )bool iosf_mbi_available (void );
arch/x86/platform/atom/punit_atom_debug.c +2 -5
@@ -25,8 +25,6 @@#include <asm/cpu_device_id.h> #include <asm/iosf_mbi.h> -/* Side band Interface port */ -#define PUNIT_PORT 0x04/* Power gate status reg */ #define PWRGT_STATUS 0x61/* Subsystem config/status Video processor */
@@ -85,9 +83,8 @@ static int punit_dev_state_show(struct seq_file *seq_file, void *unused)seq_puts (seq_file,"\n\nPUNIT NORTH COMPLEX DEVICES :\n" );while (punit_devp->name) { - status =iosf_mbi_read (PUNIT_PORT ,BT_MBI_PMC_READ , - punit_devp->reg, - &punit_pwr_status); + status =iosf_mbi_read (BT_MBI_UNIT_PMC ,MBI_REG_READ , + punit_devp->reg, &punit_pwr_status);if (status) {seq_printf (seq_file,"%9s : Read Failed\n" , punit_devp->name);
drivers/i2c/busses/i2c-designware-baytrail.c +6 -11
@@ -34,8 +34,7 @@ static int get_sem(struct device *dev, u32 *sem)u32 data;int ret; - ret =iosf_mbi_read (BT_MBI_UNIT_PMC ,BT_MBI_BUNIT_READ ,PUNIT_SEMAPHORE , - &data); + ret =iosf_mbi_read (BT_MBI_UNIT_PMC ,MBI_REG_READ ,PUNIT_SEMAPHORE , &data);if (ret) {dev_err (dev,"iosf failed to read punit semaphore\n" );return ret;
@@ -50,21 +49,19 @@ static void reset_semaphore(struct device *dev) {u32 data; -if (iosf_mbi_read (BT_MBI_UNIT_PMC ,BT_MBI_BUNIT_READ , -PUNIT_SEMAPHORE , &data)) { +if (iosf_mbi_read (BT_MBI_UNIT_PMC ,MBI_REG_READ ,PUNIT_SEMAPHORE , &data)) {dev_err (dev,"iosf failed to reset punit semaphore during read\n" );return ; } data &= ~PUNIT_SEMAPHORE_BIT ; -if (iosf_mbi_write (BT_MBI_UNIT_PMC ,BT_MBI_BUNIT_WRITE , -PUNIT_SEMAPHORE , data)) +if (iosf_mbi_write (BT_MBI_UNIT_PMC ,MBI_REG_WRITE ,PUNIT_SEMAPHORE , data))dev_err (dev,"iosf failed to reset punit semaphore during write\n" ); }static int baytrail_i2c_acquire (struct dw_i2c_dev *dev) { -u32 sem; +u32 sem =PUNIT_SEMAPHORE_ACQUIRE ;int ret;unsigned long start, end;
@@ -77,8 +74,7 @@ static int baytrail_i2c_acquire(struct dw_i2c_dev *dev)return 0 ;/* host driver writes to side band semaphore register */ - ret =iosf_mbi_write (BT_MBI_UNIT_PMC ,BT_MBI_BUNIT_WRITE , -PUNIT_SEMAPHORE ,PUNIT_SEMAPHORE_ACQUIRE ); + ret =iosf_mbi_write (BT_MBI_UNIT_PMC ,MBI_REG_WRITE ,PUNIT_SEMAPHORE , sem);if (ret) {dev_err (dev->dev,"iosf punit semaphore request failed\n" );return ret;
@@ -102,8 +98,7 @@ static int baytrail_i2c_acquire(struct dw_i2c_dev *dev)dev_err (dev->dev,"punit semaphore timed out, resetting\n" );reset_semaphore (dev->dev); - ret =iosf_mbi_read (BT_MBI_UNIT_PMC ,BT_MBI_BUNIT_READ , -PUNIT_SEMAPHORE , &sem); + ret =iosf_mbi_read (BT_MBI_UNIT_PMC ,MBI_REG_READ ,PUNIT_SEMAPHORE , &sem);if (ret)dev_err (dev->dev,"iosf failed to read punit semaphore\n" );else
drivers/powercap/intel_rapl.c +5 -5
@@ -988,16 +988,16 @@ static void set_floor_freq_atom(struct rapl_domain *rd, bool enable) }if (!power_ctrl_orig_val) -iosf_mbi_read (BT_MBI_UNIT_PMC ,BT_MBI_PMC_READ , - rapl_defaults->floor_freq_reg_addr, - &power_ctrl_orig_val); +iosf_mbi_read (BT_MBI_UNIT_PMC ,MBI_CR_READ , + rapl_defaults->floor_freq_reg_addr, + &power_ctrl_orig_val); mdata = power_ctrl_orig_val;if (enable) { mdata &= ~(0x7f <<8 ); mdata |=1 <<8 ; } -iosf_mbi_write (BT_MBI_UNIT_PMC ,BT_MBI_PMC_WRITE , - rapl_defaults->floor_freq_reg_addr, mdata); +iosf_mbi_write (BT_MBI_UNIT_PMC ,MBI_CR_WRITE , + rapl_defaults->floor_freq_reg_addr, mdata); } static u64 rapl_compute_time_window_core(struct rapl_package *rp, u64 value,
drivers/thermal/intel_quark_dts_thermal.c +30 -31
132 lines not on this page · raw message
drivers/thermal/intel_soc_dts_iosf.c +21 -22
143 lines not on this page · raw message
Signature · 1 line
2.6.2
kbuild test robot
build botreproduce:
Hi Andy,
[auto build test ERROR on thermal/next]
[also build test ERROR on v4.3 next-20151111]
[cannot apply to tip/x86/core]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/x86-platform-iosf_mbi-Remove-duplicate-definitions/20151112-002509 base: https://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git next config: i386-allmodconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=i386
All error/warnings (new ones prefixed by >>):
arch/x86/platform/intel-quark/imr.c: In function 'imr_read':
>> arch/x86/platform/intel-quark/imr.c:114:39: error: 'QRK_MBI_MM_READ' undeclared (first use in this function)
ret = iosf_mbi_read(QRK_MBI_UNIT_MM, QRK_MBI_MM_READ,
^
arch/x86/platform/intel-quark/imr.c:114:39: note: each undeclared identifier is reported only once for each function it appears in
arch/x86/platform/intel-quark/imr.c: In function 'imr_write':
>> arch/x86/platform/intel-quark/imr.c:154:40: error: 'QRK_MBI_MM_WRITE' undeclared (first use in this function)
ret = iosf_mbi_write(QRK_MBI_UNIT_MM, QRK_MBI_MM_WRITE, reg++,
^
arch/x86/platform/intel-quark/imr.c: In function 'imr_read':
>> arch/x86/platform/intel-quark/imr.c:131:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^vim +/QRK_MBI_MM_READ +114 arch/x86/platform/intel-quark/imr.c
28a375df Bryan O'Donoghue 2015-01-30 108 */
28a375df Bryan O'Donoghue 2015-01-30 109 static int imr_read(struct imr_device *idev, u32 imr_id, struct imr_regs *imr)
28a375df Bryan O'Donoghue 2015-01-30 110 {
28a375df Bryan O'Donoghue 2015-01-30 111 u32 reg = imr_id * IMR_NUM_REGS + idev->reg_base;
28a375df Bryan O'Donoghue 2015-01-30 112 int ret;
28a375df Bryan O'Donoghue 2015-01-30 113
28a375df Bryan O'Donoghue 2015-01-30 @114 ret = iosf_mbi_read(QRK_MBI_UNIT_MM, QRK_MBI_MM_READ,
28a375df Bryan O'Donoghue 2015-01-30 115 reg++, &imr->addr_lo);
28a375df Bryan O'Donoghue 2015-01-30 116 if (ret)
28a375df Bryan O'Donoghue 2015-01-30 117 return ret;
28a375df Bryan O'Donoghue 2015-01-30 118
28a375df Bryan O'Donoghue 2015-01-30 119 ret = iosf_mbi_read(QRK_MBI_UNIT_MM, QRK_MBI_MM_READ,
28a375df Bryan O'Donoghue 2015-01-30 120 reg++, &imr->addr_hi);
28a375df Bryan O'Donoghue 2015-01-30 121 if (ret)
28a375df Bryan O'Donoghue 2015-01-30 122 return ret;
28a375df Bryan O'Donoghue 2015-01-30 123
28a375df Bryan O'Donoghue 2015-01-30 124 ret = iosf_mbi_read(QRK_MBI_UNIT_MM, QRK_MBI_MM_READ,
28a375df Bryan O'Donoghue 2015-01-30 125 reg++, &imr->rmask);
28a375df Bryan O'Donoghue 2015-01-30 126 if (ret)
28a375df Bryan O'Donoghue 2015-01-30 127 return ret;
28a375df Bryan O'Donoghue 2015-01-30 128
c11a25f4 Fengguang Wu 2015-02-19 129 return iosf_mbi_read(QRK_MBI_UNIT_MM, QRK_MBI_MM_READ,
28a375df Bryan O'Donoghue 2015-01-30 130 reg++, &imr->wmask);
28a375df Bryan O'Donoghue 2015-01-30 @131 }
28a375df Bryan O'Donoghue 2015-01-30 132
28a375df Bryan O'Donoghue 2015-01-30 133 /**
28a375df Bryan O'Donoghue 2015-01-30 134 * imr_write - write an IMR at a given index.
28a375df Bryan O'Donoghue 2015-01-30 135 *
28a375df Bryan O'Donoghue 2015-01-30 136 * Requires caller to hold imr mutex.
28a375df Bryan O'Donoghue 2015-01-30 137 * Note lock bits need to be written independently of address bits.
28a375df Bryan O'Donoghue 2015-01-30 138 *
28a375df Bryan O'Donoghue 2015-01-30 139 * @idev: pointer to imr_device structure.
28a375df Bryan O'Donoghue 2015-01-30 140 * @imr_id: IMR entry to write.
28a375df Bryan O'Donoghue 2015-01-30 141 * @imr: IMR structure representing address and access masks.
28a375df Bryan O'Donoghue 2015-01-30 142 * @lock: indicates if the IMR lock bit should be applied.
28a375df Bryan O'Donoghue 2015-01-30 143 * @return: 0 on success or error code passed from mbi_iosf on failure.
28a375df Bryan O'Donoghue 2015-01-30 144 */
28a375df Bryan O'Donoghue 2015-01-30 145 static int imr_write(struct imr_device *idev, u32 imr_id,
28a375df Bryan O'Donoghue 2015-01-30 146 struct imr_regs *imr, bool lock)
28a375df Bryan O'Donoghue 2015-01-30 147 {
28a375df Bryan O'Donoghue 2015-01-30 148 unsigned long flags;
28a375df Bryan O'Donoghue 2015-01-30 149 u32 reg = imr_id * IMR_NUM_REGS + idev->reg_base;
28a375df Bryan O'Donoghue 2015-01-30 150 int ret;
28a375df Bryan O'Donoghue 2015-01-30 151
28a375df Bryan O'Donoghue 2015-01-30 152 local_irq_save(flags);
28a375df Bryan O'Donoghue 2015-01-30 153
28a375df Bryan O'Donoghue 2015-01-30 @154 ret = iosf_mbi_write(QRK_MBI_UNIT_MM, QRK_MBI_MM_WRITE, reg++,
28a375df Bryan O'Donoghue 2015-01-30 155 imr->addr_lo);
28a375df Bryan O'Donoghue 2015-01-30 156 if (ret)
28a375df Bryan O'Donoghue 2015-01-30 157 goto failed;:::::: The code at line 114 was first introduced by commit
:::::: 28a375df16c2b6d01227541f3956568995aa5fda x86/intel/quark: Add Isolated Memory Regions for Quark X1000
:::::: TO: Bryan O'Donoghue <[email protected]> :::::: CC: Ingo Molnar <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation