mfd: ahc1ec0: Add support for Advantech embedded controller
PATCH 1/3 mfd: ahc1ec0: Add support for Advantech embedded controller
AHC1EC0 is the embedded controller driver for Advantech industrial products. This provides sub-devices such as hwmon and watchdog, and also expose functions for sud-devices to read/write the value to embedded controller.
--- drivers/mfd/Kconfig | 9 + drivers/mfd/Makefile | 2 + drivers/mfd/ahc1ec0.c | 1420 +++++++++++++++++++++++++++++++++++ include/linux/mfd/ahc1ec0.h | 327 ++++++++ 4 files changed, 1758 insertions(+) create mode 100644 drivers/mfd/ahc1ec0.c create mode 100644 include/linux/mfd/ahc1ec0.h
drivers/mfd/Kconfig +9 -0
@@ -2118,5 +2118,14 @@ config SGI_MFD_IOC3 If you have an SGI Origin, Octane, or a PCI IOC3 card, then say Y. Otherwise say N. +config MFD_AHC1EC0 + tristate "Advantech Embedded Controller Module" + select MFD_CORE + help + This is the core function that for Advantech EC drivers. It + includes the sub-devices such as hwmon, watchdog, etc. And also + provides expose functions for sub-devices to read/write the value + to embedded controller. + endmenu endif
drivers/mfd/Makefile +2 -0
@@ -264,3 +264,5 @@ obj-$(CONFIG_MFD_STMFX) += stmfx.o obj-$(CONFIG_MFD_KHADAS_MCU) += khadas-mcu.o obj-$(CONFIG_SGI_MFD_IOC3) += ioc3.o + +obj-$(CONFIG_MFD_AHC1EC0) += ahc1ec0.o
drivers/mfd/ahc1ec0.c new file +1420 -0
1,420 lines not on this page · raw message
include/linux/mfd/ahc1ec0.h new file +327 -0
327 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 2/3 mfd: ahc1ec0-hwmon: Add sub-device hwmon for Advantech embedded controller
This is one of sub-device driver for Advantech embedded controller AHC1EC0. This driver provides sysfs ABI for Advantech related applications to monitor the system status.
--- drivers/mfd/Kconfig | 8 + drivers/mfd/Makefile | 1 + drivers/mfd/ahc1ec0-hwmon.c | 1514 +++++++++++++++++++++++++++++++++++ 3 files changed, 1523 insertions(+) create mode 100644 drivers/mfd/ahc1ec0-hwmon.c
drivers/mfd/Kconfig +8 -0
@@ -2127,5 +2127,13 @@ config MFD_AHC1EC0 provides expose functions for sub-devices to read/write the value to embedded controller. +config MFD_AHC1EC0_HWMON + tristate "Advantech EC Hareware Monitor Function" + depends on MFD_AHC1EC0 + help + This is sub-device for Advantech embedded controller AHC1EC0. This + driver provides the sysfs attribues for applications to monitor + the system status. + endmenu endif
drivers/mfd/Makefile +1 -0
@@ -266,3 +266,4 @@ obj-$(CONFIG_MFD_KHADAS_MCU) += khadas-mcu.o obj-$(CONFIG_SGI_MFD_IOC3) += ioc3.o obj-$(CONFIG_MFD_AHC1EC0) += ahc1ec0.o +obj-$(CONFIG_MFD_AHC1EC0_HWMON) += ahc1ec0-hwmon.o
drivers/mfd/ahc1ec0-hwmon.c new file +1514 -0
1,514 lines not on this page · raw message
Signature · 1 line
2.17.1
kernel test robot
build botRe: [PATCH 2/3] mfd: ahc1ec0-hwmon: Add sub-device hwmon for Advantech embedded controller
Thank you for the patch! Perhaps something to improve:
Hi Shihlun,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on linux/master v5.9]
[cannot apply to lee-mfd/for-mfd-next next-20201013]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Shihlun-Lin/mfd-ahc1ec0-Add-support-for-Advantech-embedded-controller/20201014-164627 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b5fc7a89e58bcc059a3d5e4db79c481fb437de59 config: x86_64-allyesconfig (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/ac7622765e9bf99891a911be7a47e27b5afe3a35 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Shihlun-Lin/mfd-ahc1ec0-Add-support-for-Advantech-embedded-controller/20201014-164627 git checkout ac7622765e9bf99891a911be7a47e27b5afe3a35 # save the attached .config to linux build tree make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/mfd/ahc1ec0-hwmon.c:1280:6: warning: no previous prototype for 'adv_ec_init_hwmon_profile' [-Wmissing-prototypes]
1280 | void adv_ec_init_hwmon_profile(u32 profile, struct adv_ec_platform_data *plat_data)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
vim +/adv_ec_init_hwmon_profile +1280 drivers/mfd/ahc1ec0-hwmon.c
1279
> 1280 void adv_ec_init_hwmon_profile(u32 profile, struct adv_ec_platform_data *plat_data)
1281 {
1282 int i;
1283 struct HW_PIN_TBL *ptbl = &lmsensor_data.pin_tbl;
1284 struct Dynamic_Tab *dym_tbl = plat_data->dym_tbl;
1285
1286 lmsensor_data.bios_product_name = plat_data->bios_product_name;
1287 lmsensor_data.profile = &advec_profile[profile];
1288
1289 for (i = 0; i < EC_MAX_TBL_NUM ; i++) {
1290 switch (dym_tbl[i].DeviceID) {
1291 case EC_DID_CMOSBAT:
1292 ptbl->vbat[0] = dym_tbl[i].HWPinNumber;
1293 ptbl->vbat[1] = 1;
1294 break;
1295 case EC_DID_CMOSBAT_X2:
1296 ptbl->vbat[0] = dym_tbl[i].HWPinNumber;
1297 ptbl->vbat[1] = 2;
1298 break;
1299 case EC_DID_CMOSBAT_X10:
1300 ptbl->vbat[0] = dym_tbl[i].HWPinNumber;
1301 ptbl->vbat[1] = 10;
1302 break;
1303 case EC_DID_5VS0:
1304 case EC_DID_5VS5:
1305 ptbl->v5[0] = dym_tbl[i].HWPinNumber;
1306 ptbl->v5[1] = 1;
1307 break;
1308 case EC_DID_5VS0_X2:
1309 case EC_DID_5VS5_X2:
1310 ptbl->v5[0] = dym_tbl[i].HWPinNumber;
1311 ptbl->v5[1] = 2;
1312 break;
1313 case EC_DID_5VS0_X10:
1314 case EC_DID_5VS5_X10:
1315 ptbl->v5[0] = dym_tbl[i].HWPinNumber;
1316 ptbl->v5[1] = 10;
1317 break;
1318 case EC_DID_12VS0:
1319 ptbl->v12[0] = dym_tbl[i].HWPinNumber;
1320 ptbl->v12[1] = 1;
1321 break;
1322 case EC_DID_12VS0_X2:
1323 ptbl->v12[0] = dym_tbl[i].HWPinNumber;
1324 ptbl->v12[1] = 2;
1325 break;
1326 case EC_DID_12VS0_X10:
1327 ptbl->v12[0] = dym_tbl[i].HWPinNumber;
1328 ptbl->v12[1] = 10;
1329 break;
1330 case EC_DID_VCOREA:
1331 case EC_DID_VCOREB:
1332 ptbl->vcore[0] = dym_tbl[i].HWPinNumber;
1333 ptbl->vcore[1] = 1;
1334 break;
1335 case EC_DID_VCOREA_X2:
1336 case EC_DID_VCOREB_X2:
1337 ptbl->vcore[0] = dym_tbl[i].HWPinNumber;
1338 ptbl->vcore[1] = 2;
1339 break;
1340 case EC_DID_VCOREA_X10:
1341 case EC_DID_VCOREB_X10:
1342 ptbl->vcore[0] = dym_tbl[i].HWPinNumber;
1343 ptbl->vcore[1] = 10;
1344 break;
1345 case EC_DID_DC:
1346 ptbl->vdc[0] = dym_tbl[i].HWPinNumber;
1347 ptbl->vdc[1] = 1;
1348 break;
1349 case EC_DID_DC_X2:
1350 ptbl->vdc[0] = dym_tbl[i].HWPinNumber;
1351 ptbl->vdc[1] = 2;
1352 break;
1353 case EC_DID_DC_X10:
1354 ptbl->vdc[0] = dym_tbl[i].HWPinNumber;
1355 ptbl->vdc[1] = 10;
1356 break;
1357 case EC_DID_CURRENT:
1358 ptbl->ec_current[0] = dym_tbl[i].HWPinNumber;
1359 ptbl->ec_current[1] = 1;
1360 break;
1361 case EC_DID_SMBOEM0:
1362 lmsensor_data.ec_smboem0.HWPinNumber = dym_tbl[i].HWPinNumber;
1363 break;
1364 default:
1365 break;
1366 }
1367 }
1368 }
1369
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
PATCH 3/3 mfd: ahc1ec0-wdt: Add sub-device watchdog for Advantech embedded controller
In reply to Shihlun LinThis is one of sub-device driver for Advantech embedded controller AHC1EC0. This driver provide watchdog functionality for Advantech related applications to restart the system.
--- drivers/mfd/Kconfig | 4 + drivers/mfd/Makefile | 3 +- drivers/mfd/ahc1ec0-wdt.c | 506 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 512 insertions(+), 1 deletion(-) create mode 100644 drivers/mfd/ahc1ec0-wdt.c
drivers/mfd/Kconfig +4 -0
@@ -2135,5 +2135,9 @@ config MFD_AHC1EC0_HWMON driver provides the sysfs attribues for applications to monitor the system status. +config MFD_AHC1EC0_WDT + tristate "Advantech EC Watchdog Function" + depends on MFD_AHC1EC0 + endmenu endif
drivers/mfd/Makefile +2 -1
@@ -265,5 +265,6 @@ obj-$(CONFIG_MFD_KHADAS_MCU) += khadas-mcu.o obj-$(CONFIG_SGI_MFD_IOC3) += ioc3.o -obj-$(CONFIG_MFD_AHC1EC0) += ahc1ec0.o +obj-$(CONFIG_MFD_AHC1EC0) += ahc1ec0.o obj-$(CONFIG_MFD_AHC1EC0_HWMON) += ahc1ec0-hwmon.o +obj-$(CONFIG_MFD_AHC1EC0_WDT) += ahc1ec0-wdt.o
drivers/mfd/ahc1ec0-wdt.c new file +506 -0
506 lines not on this page · raw message
Signature · 1 line
2.17.1
kernel test robot
build botRe: [PATCH 3/3] mfd: ahc1ec0-wdt: Add sub-device watchdog for Advantech embedded controller
Thank you for the patch! Perhaps something to improve:
Hi Shihlun,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on linux/master v5.9]
[cannot apply to lee-mfd/for-mfd-next next-20201013]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Shihlun-Lin/mfd-ahc1ec0-Add-support-for-Advantech-embedded-controller/20201014-164627 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b5fc7a89e58bcc059a3d5e4db79c481fb437de59 config: parisc-randconfig-r003-20201014 (attached as .config) compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/c0d1228cbc430e5be6ac8a311f8fa783f9285628
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Shihlun-Lin/mfd-ahc1ec0-Add-support-for-Advantech-embedded-controller/20201014-164627 git checkout c0d1228cbc430e5be6ac8a311f8fa783f9285628
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
drivers/mfd/ahc1ec0-wdt.c: In function 'wdt_proc_read':
>> drivers/mfd/ahc1ec0-wdt.c:162:17: warning: variable 'name' set but not used [-Wunused-but-set-variable]
162 | unsigned char *name, *chip_name, *is_enable;
| ^~~~
drivers/mfd/ahc1ec0-wdt.c: In function 'adv_ec_wdt_probe':
>> drivers/mfd/ahc1ec0-wdt.c:426:31: warning: variable 'adv_ec_data' set but not used [-Wunused-but-set-variable]
426 | struct adv_ec_platform_data *adv_ec_data;
| ^~~~~~~~~~~vim +/name +162 drivers/mfd/ahc1ec0-wdt.c
159
160 static int wdt_proc_read(struct seq_file *m, void *p)
161 {
> 162 unsigned char *name, *chip_name, *is_enable; 163 unsigned long current_timeout = 0; 164 165 name = m->private; 166 167 chip_name = wdt_data.chip_name; 168 current_timeout = wdt_data.current_timeout; 169 is_enable = wdt_data.is_enable; 170 171 seq_printf(m, "name : %s\n", chip_name); 172 seq_printf(m, "timeout : %ld\n", current_timeout); 173 seq_printf(m, "is_enable : %s\n", is_enable);
174
175 return 0;
176 }
177
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botThank you for the patch! Perhaps something to improve:
Hi Shihlun,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on linux/master v5.9]
[cannot apply to lee-mfd/for-mfd-next next-20201013]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Shihlun-Lin/mfd-ahc1ec0-Add-support-for-Advantech-embedded-controller/20201014-164627 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b5fc7a89e58bcc059a3d5e4db79c481fb437de59 config: riscv-allyesconfig (attached as .config) compiler: riscv64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/f939b81446bccbb73682a795ea5422386d6b15bb
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Shihlun-Lin/mfd-ahc1ec0-Add-support-for-Advantech-embedded-controller/20201014-164627 git checkout f939b81446bccbb73682a795ea5422386d6b15bb
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
drivers/mfd/ahc1ec0.c:71:5: warning: no previous prototype for 'wait_ibf' [-Wmissing-prototypes]
71 | int wait_ibf(void)
| ^~~~~~~~
drivers/mfd/ahc1ec0.c:86:5: warning: no previous prototype for 'wait_obf' [-Wmissing-prototypes]
86 | int wait_obf(void)
| ^~~~~~~~
drivers/mfd/ahc1ec0.c:101:5: warning: no previous prototype for 'read_hw_ram' [-Wmissing-prototypes]
101 | int read_hw_ram(uchar addr, uchar *data)
| ^~~~~~~~~~~
drivers/mfd/ahc1ec0.c:182:5: warning: no previous prototype for 'wait_smbus_protocol_finish' [-Wmissing-prototypes]
182 | int wait_smbus_protocol_finish(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mfd/ahc1ec0.c:203:5: warning: no previous prototype for 'adv_get_dynamic_tab' [-Wmissing-prototypes]
203 | int adv_get_dynamic_tab(struct adv_ec_platform_data *pdata)
| ^~~~~~~~~~~~~~~~~~~
drivers/mfd/ahc1ec0.c:409:5: warning: no previous prototype for 'write_acpi_value' [-Wmissing-prototypes]
409 | int write_acpi_value(uchar addr, uchar value)
| ^~~~~~~~~~~~~~~~
drivers/mfd/ahc1ec0.c:442:5: warning: no previous prototype for 'read_gpio_status' [-Wmissing-prototypes]
442 | int read_gpio_status(uchar PinNumber, uchar *pvalue)
| ^~~~~~~~~~~~~~~~
drivers/mfd/ahc1ec0.c:493:5: warning: no previous prototype for 'write_gpio_status' [-Wmissing-prototypes]
493 | int write_gpio_status(uchar PinNumber, uchar value)
| ^~~~~~~~~~~~~~~~~
drivers/mfd/ahc1ec0.c:538:5: warning: no previous prototype for 'read_gpio_dir' [-Wmissing-prototypes]
538 | int read_gpio_dir(uchar PinNumber, uchar *pvalue)
| ^~~~~~~~~~~~~
drivers/mfd/ahc1ec0.c:585:5: warning: no previous prototype for 'write_gpio_dir' [-Wmissing-prototypes]
585 | int write_gpio_dir(uchar PinNumber, uchar value)
| ^~~~~~~~~~~~~~
drivers/mfd/ahc1ec0.c:631:5: warning: no previous prototype for 'write_hw_extend_ram' [-Wmissing-prototypes]
631 | int write_hw_extend_ram(uchar addr, uchar data)
| ^~~~~~~~~~~~~~~~~~~
drivers/mfd/ahc1ec0.c:866:5: warning: no previous prototype for 'smbus_write_byte' [-Wmissing-prototypes]
866 | int smbus_write_byte(struct EC_SMBUS_WRITE_BYTE *ptr_ec_smbus_write_byte)
| ^~~~~~~~~~~~~~~~
drivers/mfd/ahc1ec0.c:946:5: warning: no previous prototype for 'read_onekey_status' [-Wmissing-prototypes]
946 | int read_onekey_status(uchar addr, uchar *pdata)
| ^~~~~~~~~~~~~~~~~~
drivers/mfd/ahc1ec0.c:990:5: warning: no previous prototype for 'write_onekey_status' [-Wmissing-prototypes]
990 | int write_onekey_status(uchar addr)
| ^~~~~~~~~~~~~~~~~~~
drivers/mfd/ahc1ec0.c:1024:5: warning: no previous prototype for 'ec_oem_get_status' [-Wmissing-prototypes]
1024 | int ec_oem_get_status(uchar addr, uchar *pdata)
| ^~~~~~~~~~~~~~~~~
drivers/mfd/ahc1ec0.c:1076:5: warning: no previous prototype for 'ec_oem_set_status' [-Wmissing-prototypes]
1076 | int ec_oem_set_status(uchar addr, uchar pdata)
| ^~~~~~~~~~~~~~~~~
drivers/mfd/ahc1ec0.c: In function 'adv_ec_get_productname':
drivers/mfd/ahc1ec0.c:1167:13: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]
1167 | (char *)ioremap_cache(((unsigned int *)&uc_ptaddr[index+0x18])[0],
| ^~~~~~~~~~~~~
| ioremap_uc
>> drivers/mfd/ahc1ec0.c:1167:5: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
1167 | (char *)ioremap_cache(((unsigned int *)&uc_ptaddr[index+0x18])[0],
| ^
At top level:
drivers/mfd/ahc1ec0.c:1244:30: warning: 'adv_ec_util_cells' defined but not used [-Wunused-const-variable=]
1244 | static const struct mfd_cell adv_ec_util_cells[] = {
| ^~~~~~~~~~~~~~~~~cc1: some warnings being treated as errors
vim +1167 drivers/mfd/ahc1ec0.c
1124
1125 static int adv_ec_get_productname(char *product)
1126 {
1127 static unsigned char *uc_ptaddr;
1128 static unsigned char *uc_epsaddr;
1129 int index = 0, eps_table;
1130 int i = 0;
1131 int length = 0;
1132 int type0_str = 0;
1133 int type1_str = 0;
1134 int is_advantech = 0;
1135
1136 uc_ptaddr = ioremap(AMI_UEFI_ADVANTECH_BOARD_NAME_ADDRESS,
1137 AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH);
1138 if (!uc_ptaddr) {
1139 pr_err("Error: ioremap_nocache()");
1140 return -ENXIO;
1141 }
1142
1143 /* Try to Read the product name from UEFI BIOS(DMI) EPS table */
1144 for (index = 0; index < AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH; index++) {
1145 if (uc_ptaddr[index] == '_'
1146 && uc_ptaddr[index+0x1] == 'S'
1147 && uc_ptaddr[index+0x2] == 'M'
1148 && uc_ptaddr[index+0x3] == '_'
1149 && uc_ptaddr[index+0x10] == '_'
1150 && uc_ptaddr[index+0x11] == 'D'
1151 && uc_ptaddr[index+0x12] == 'M'
1152 && uc_ptaddr[index+0x13] == 'I'
1153 && uc_ptaddr[index+0x14] == '_'
1154 ) {
1155 eps_table = 1;
1156 break;
1157 }
1158 }
1159
1160 /* If EPS table exist, read type1(system information) */
1161 if (eps_table) {
1162 uc_epsaddr =
1163 (char *)ioremap(((unsigned int *)&uc_ptaddr[index+0x18])[0],
1164 ((unsigned short *)&uc_ptaddr[index+0x16])[0]);
1165 if (!uc_epsaddr) {
1166 uc_epsaddr =
> 1167 (char *)ioremap_cache(((unsigned int *)&uc_ptaddr[index+0x18])[0],
1168 ((unsigned short *)&uc_ptaddr[index+0x16])[0]);
1169 if (!uc_epsaddr) {
1170 pr_err("Error: both ioremap() and ioremap_cache() exec failed!");
1171 return -ENXIO;
1172 }
1173 }
1174
1175 type0_str = (int)uc_epsaddr[1];
1176 for (i = type0_str; i < (type0_str+512); i++) {
1177 if (uc_epsaddr[i] == 0 && uc_epsaddr[i+1] == 0 && uc_epsaddr[i+2] == 1) {
1178 type1_str = i + uc_epsaddr[i+3];
1179 break;
1180 }
1181 }
1182 for (i = type1_str; i < (type1_str+512); i++) {
1183 if (!strncmp(&uc_epsaddr[i], "Advantech", 9))
1184 is_advantech = 1;
1185
1186 if (uc_epsaddr[i] == 0) {
1187 i++;
1188 type1_str = i;
1189 break;
1190 }
1191 }
1192 length = 2;
1193 while ((uc_epsaddr[type1_str + length] != 0)
1194 && (length < AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH)) {
1195 length += 1;
1196 }
1197 memmove(product, &uc_epsaddr[type1_str], length);
1198 iounmap((void *)uc_epsaddr);
1199 if (is_advantech) {
1200 iounmap((void *)uc_ptaddr);
1201 return 0;
1202 }
1203 }
1204
1205 /* It is an old BIOS, read from 0x000F0000 */
1206 for (index = 0; index < (AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH - 3); index++) {
1207 if (!strncmp(&uc_ptaddr[index], "TPC", 3)
1208 || !strncmp(&uc_ptaddr[index], "UNO", 3)
1209 || !strncmp(&uc_ptaddr[index], "ITA", 3)
1210 || !strncmp(&uc_ptaddr[index], "MIO", 3)
1211 || !strncmp(&uc_ptaddr[index], "ECU", 3)
1212 || !strncmp(&uc_ptaddr[index], "APAX", 4)) 1213 break;
1214 }
1215
1216 if (index == (AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH - 3)) {
1217 pr_err("%s: Can't find the product name, line: %d", __func__, __LINE__);
1218 product[0] = '\0';
1219 iounmap((void *)uc_ptaddr);
1220 return -ENODATA;
1221 }
1222
1223 /* Use char "Space" (ASCII code: 32) to check the end of the Product Name. */
1224 for (i = 0; (uc_ptaddr[index+i] != 32) && (i < 31); i++)
1225 product[i] = uc_ptaddr[index+i];
1226
1227 product[i] = '\0';
1228 pr_info("%s: BIOS Product Name = %s, line: %d", __func__, product, __LINE__);
1229
1230 iounmap((void *)uc_ptaddr);
1231
1232 return 0;
1233 }
1234
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
kernel test robot
build botThank you for the patch! Yet something to improve:
Hi Shihlun,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on linux/master v5.9]
[cannot apply to lee-mfd/for-mfd-next next-20201013]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Shihlun-Lin/mfd-ahc1ec0-Add-support-for-Advantech-embedded-controller/20201014-164627 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b5fc7a89e58bcc059a3d5e4db79c481fb437de59 config: parisc-randconfig-r003-20201014 (attached as .config) compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/f939b81446bccbb73682a795ea5422386d6b15bb
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Shihlun-Lin/mfd-ahc1ec0-Add-support-for-Advantech-embedded-controller/20201014-164627 git checkout f939b81446bccbb73682a795ea5422386d6b15bb
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc
If you fix the issue, kindly add following tag as appropriate
All error/warnings (new ones prefixed by >>):
>> drivers/mfd/ahc1ec0.c:71:5: warning: no previous prototype for 'wait_ibf' [-Wmissing-prototypes]
71 | int wait_ibf(void)
| ^~~~~~~~
>> drivers/mfd/ahc1ec0.c:86:5: warning: no previous prototype for 'wait_obf' [-Wmissing-prototypes]
86 | int wait_obf(void)
| ^~~~~~~~
>> drivers/mfd/ahc1ec0.c:101:5: warning: no previous prototype for 'read_hw_ram' [-Wmissing-prototypes]
101 | int read_hw_ram(uchar addr, uchar *data)
| ^~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:182:5: warning: no previous prototype for 'wait_smbus_protocol_finish' [-Wmissing-prototypes]
182 | int wait_smbus_protocol_finish(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:203:5: warning: no previous prototype for 'adv_get_dynamic_tab' [-Wmissing-prototypes]
203 | int adv_get_dynamic_tab(struct adv_ec_platform_data *pdata)
| ^~~~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:409:5: warning: no previous prototype for 'write_acpi_value' [-Wmissing-prototypes]
409 | int write_acpi_value(uchar addr, uchar value)
| ^~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:442:5: warning: no previous prototype for 'read_gpio_status' [-Wmissing-prototypes]
442 | int read_gpio_status(uchar PinNumber, uchar *pvalue)
| ^~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:493:5: warning: no previous prototype for 'write_gpio_status' [-Wmissing-prototypes]
493 | int write_gpio_status(uchar PinNumber, uchar value)
| ^~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:538:5: warning: no previous prototype for 'read_gpio_dir' [-Wmissing-prototypes]
538 | int read_gpio_dir(uchar PinNumber, uchar *pvalue)
| ^~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:585:5: warning: no previous prototype for 'write_gpio_dir' [-Wmissing-prototypes]
585 | int write_gpio_dir(uchar PinNumber, uchar value)
| ^~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:631:5: warning: no previous prototype for 'write_hw_extend_ram' [-Wmissing-prototypes]
631 | int write_hw_extend_ram(uchar addr, uchar data)
| ^~~~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:866:5: warning: no previous prototype for 'smbus_write_byte' [-Wmissing-prototypes]
866 | int smbus_write_byte(struct EC_SMBUS_WRITE_BYTE *ptr_ec_smbus_write_byte)
| ^~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:946:5: warning: no previous prototype for 'read_onekey_status' [-Wmissing-prototypes]
946 | int read_onekey_status(uchar addr, uchar *pdata)
| ^~~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:990:5: warning: no previous prototype for 'write_onekey_status' [-Wmissing-prototypes]
990 | int write_onekey_status(uchar addr)
| ^~~~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:1024:5: warning: no previous prototype for 'ec_oem_get_status' [-Wmissing-prototypes]
1024 | int ec_oem_get_status(uchar addr, uchar *pdata)
| ^~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:1076:5: warning: no previous prototype for 'ec_oem_set_status' [-Wmissing-prototypes]
1076 | int ec_oem_set_status(uchar addr, uchar pdata)
| ^~~~~~~~~~~~~~~~~
drivers/mfd/ahc1ec0.c: In function 'adv_ec_get_productname':
>> drivers/mfd/ahc1ec0.c:1167:13: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]
1167 | (char *)ioremap_cache(((unsigned int *)&uc_ptaddr[index+0x18])[0],
| ^~~~~~~~~~~~~
| ioremap_uc
At top level:
drivers/mfd/ahc1ec0.c:1244:30: warning: 'adv_ec_util_cells' defined but not used [-Wunused-const-variable=]
1244 | static const struct mfd_cell adv_ec_util_cells[] = {
| ^~~~~~~~~~~~~~~~~cc1: some warnings being treated as errors
vim +1167 drivers/mfd/ahc1ec0.c
988
989 /* Set One Key Recovery status */
> 990 int write_onekey_status(uchar addr)
991 {
992 int ret;
993
994 mutex_lock(&lock);
995
996 /* Step 0. Wait IBF clear */
997 ret = wait_ibf();
998 if (ret)
999 goto error;
1000
1001 /* Step 1. Send "One Key Recovery" command to EC Command port */
1002 outb(EC_ONE_KEY_FLAG, EC_COMMAND_PORT);
1003
1004 /* Step 2. Wait IBF clear */
1005 ret = wait_ibf();
1006 if (ret)
1007 goto error;
1008
1009 /* Step 3. Send "One Key Recovery function" address to EC Data port */
1010 outb(addr, EC_STATUS_PORT);
1011
1012 mutex_unlock(&lock);
1013
1014 pr_debug("%s: addr= %d, line: %d", __func__, addr, __LINE__);
1015 return 0;
1016
1017 error:
1018 mutex_unlock(&lock);
1019 pr_debug("%s: Wait for IBF too long. line: %d", __func__, __LINE__);
1020 return ret;
1021 }
1022
1023 /* EC OEM get status */
> 1024 int ec_oem_get_status(uchar addr, uchar *pdata)
1025 {
1026 int ret;
1027
1028 mutex_lock(&lock);
1029
1030 /* Init return value */
1031 *pdata = 0;
1032
1033 /* Step 0. Wait IBF clear */
1034 ret = wait_ibf();
1035 if (ret)
1036 goto error;
1037
1038 /* Step 1. Send "ASG OEM" command to EC Command port */
1039 outb(EC_ASG_OEM, EC_COMMAND_PORT);
1040
1041 /* Step 2. Wait IBF clear */
1042 ret = wait_ibf();
1043 if (ret)
1044 goto error;
1045
1046 /* Step 3. Send "ASG OEM STATUS READ" address to EC Data port */
1047 outb(EC_ASG_OEM_READ, EC_STATUS_PORT);
1048
1049 /* Step 4. Wait IBF clear */
1050 ret = wait_ibf();
1051 if (ret)
1052 goto error;
1053
1054 /* Step 5. Send "OEM STATUS" address to EC Data port */
1055 outb(addr, EC_STATUS_PORT);
1056
1057 /* Step 6. Wait OBF set */
1058 ret = wait_obf();
1059 if (ret)
1060 goto error;
1061
1062 /* Step 7. Get "OEM STATUS" data from EC Data port */
1063 *pdata = inb(EC_STATUS_PORT);
1064
1065 pr_debug("%s: data= %d, line: %d", __func__, *pdata, __LINE__);
1066 mutex_unlock(&lock);
1067 return 0;
1068
1069 error:
1070 mutex_unlock(&lock);
1071 pr_warn("%s: Wait for IBF or OBF too long. line: %d", __func__, __LINE__);
1072 return ret;
1073 }
1074
1075 /* EC OEM set status */
> 1076 int ec_oem_set_status(uchar addr, uchar pdata)
1077 {
1078 int ret;
1079
1080 mutex_lock(&lock);
1081
1082 /* Step 0. Wait IBF clear */
1083 ret = wait_ibf();
1084 if (ret)
1085 goto error;
1086
1087 /* Step 1. Send "ASG OEM" command to EC Command port */
1088 outb(EC_ASG_OEM, EC_COMMAND_PORT);
1089
1090 /* Step 2. Wait IBF clear */
1091 ret = wait_ibf();
1092 if (ret)
1093 goto error;
1094
1095 /* Step 3. Send "ASG OEM STATUS WRITE" address to EC Data port */
1096 outb(EC_ASG_OEM_WRITE, EC_STATUS_PORT);
1097
1098 /* Step 4. Wait IBF clear */
1099 ret = wait_ibf();
1100 if (ret)
1101 goto error;
1102
1103 /* Step 5. Send "OEM STATUS" address to EC Data port */
1104 outb(addr, EC_STATUS_PORT);
1105
1106 /* Step 6. Wait IBF clear */
1107 ret = wait_ibf();
1108 if (ret)
1109 goto error;
1110
1111 /* Step 7. Send "OEM STATUS" status to EC Data port */
1112 outb(pdata, EC_STATUS_PORT);
1113
1114 pr_debug("%s: data= %d, line: %d", __func__, pdata, __LINE__);
1115 mutex_unlock(&lock);
1116 return 0;
1117
1118 error:
1119 mutex_unlock(&lock);
1120 pr_warn("%s: Wait for IBF or OBF too long. line: %d", __func__, __LINE__);
1121
1122 return ret;
1123 }
1124
1125 static int adv_ec_get_productname(char *product)
1126 {
1127 static unsigned char *uc_ptaddr;
1128 static unsigned char *uc_epsaddr;
1129 int index = 0, eps_table;
1130 int i = 0;
1131 int length = 0;
1132 int type0_str = 0;
1133 int type1_str = 0;
1134 int is_advantech = 0;
1135
1136 uc_ptaddr = ioremap(AMI_UEFI_ADVANTECH_BOARD_NAME_ADDRESS,
1137 AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH);
1138 if (!uc_ptaddr) {
1139 pr_err("Error: ioremap_nocache()");
1140 return -ENXIO;
1141 }
1142
1143 /* Try to Read the product name from UEFI BIOS(DMI) EPS table */
1144 for (index = 0; index < AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH; index++) {
1145 if (uc_ptaddr[index] == '_'
1146 && uc_ptaddr[index+0x1] == 'S'
1147 && uc_ptaddr[index+0x2] == 'M'
1148 && uc_ptaddr[index+0x3] == '_'
1149 && uc_ptaddr[index+0x10] == '_'
1150 && uc_ptaddr[index+0x11] == 'D'
1151 && uc_ptaddr[index+0x12] == 'M'
1152 && uc_ptaddr[index+0x13] == 'I'
1153 && uc_ptaddr[index+0x14] == '_'
1154 ) {
1155 eps_table = 1;
1156 break;
1157 }
1158 }
1159
1160 /* If EPS table exist, read type1(system information) */
1161 if (eps_table) {
1162 uc_epsaddr =
1163 (char *)ioremap(((unsigned int *)&uc_ptaddr[index+0x18])[0],
1164 ((unsigned short *)&uc_ptaddr[index+0x16])[0]);
1165 if (!uc_epsaddr) {
1166 uc_epsaddr =
> 1167 (char *)ioremap_cache(((unsigned int *)&uc_ptaddr[index+0x18])[0],
1168 ((unsigned short *)&uc_ptaddr[index+0x16])[0]);
1169 if (!uc_epsaddr) {
1170 pr_err("Error: both ioremap() and ioremap_cache() exec failed!");
1171 return -ENXIO;
1172 }
1173 }
1174
1175 type0_str = (int)uc_epsaddr[1];
1176 for (i = type0_str; i < (type0_str+512); i++) {
1177 if (uc_epsaddr[i] == 0 && uc_epsaddr[i+1] == 0 && uc_epsaddr[i+2] == 1) {
1178 type1_str = i + uc_epsaddr[i+3];
1179 break;
1180 }
1181 }
1182 for (i = type1_str; i < (type1_str+512); i++) {
1183 if (!strncmp(&uc_epsaddr[i], "Advantech", 9))
1184 is_advantech = 1;
1185
1186 if (uc_epsaddr[i] == 0) {
1187 i++;
1188 type1_str = i;
1189 break;
1190 }
1191 }
1192 length = 2;
1193 while ((uc_epsaddr[type1_str + length] != 0)
1194 && (length < AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH)) {
1195 length += 1;
1196 }
1197 memmove(product, &uc_epsaddr[type1_str], length);
1198 iounmap((void *)uc_epsaddr);
1199 if (is_advantech) {
1200 iounmap((void *)uc_ptaddr);
1201 return 0;
1202 }
1203 }
1204
1205 /* It is an old BIOS, read from 0x000F0000 */
1206 for (index = 0; index < (AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH - 3); index++) {
1207 if (!strncmp(&uc_ptaddr[index], "TPC", 3)
1208 || !strncmp(&uc_ptaddr[index], "UNO", 3)
1209 || !strncmp(&uc_ptaddr[index], "ITA", 3)
1210 || !strncmp(&uc_ptaddr[index], "MIO", 3)
1211 || !strncmp(&uc_ptaddr[index], "ECU", 3)
1212 || !strncmp(&uc_ptaddr[index], "APAX", 4)) 1213 break;
1214 }
1215
1216 if (index == (AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH - 3)) {
1217 pr_err("%s: Can't find the product name, line: %d", __func__, __LINE__);
1218 product[0] = '\0';
1219 iounmap((void *)uc_ptaddr);
1220 return -ENODATA;
1221 }
1222
1223 /* Use char "Space" (ASCII code: 32) to check the end of the Product Name. */
1224 for (i = 0; (uc_ptaddr[index+i] != 32) && (i < 31); i++)
1225 product[i] = uc_ptaddr[index+i];
1226
1227 product[i] = '\0';
1228 pr_info("%s: BIOS Product Name = %s, line: %d", __func__, product, __LINE__);
1229
1230 iounmap((void *)uc_ptaddr);
1231
1232 return 0;
1233 }
1234
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]