Add support control UP board CPLD/FPGA pin control
Subsystems (5)
v5 cover Add support control UP board CPLD/FPGA pin control
The UP board <https://up-board.org/> is the computer board for Professional Makers and Industrial Applications. We want to upstream the UP board 40-pin GP-bus Kernel driver for giving the users better experience on the software release. (not just download from UP board github)
These patches are generated from the Linux kernel mainline tag v6.0.
This is the PATCH V5 and fixed kernel test robot compiler warning and addressed Lee Jones review comments.
larry.lai (3):
mfd: Add support for UP board CPLD/FPGA
pinctrl: Add support pin control for UP board CPLD/FPGA
leds: Add support for UP board CPLD onboard LEDS
drivers/leds/Kconfig | 10 + drivers/leds/Makefile | 1 + drivers/leds/leds-upboard.c | 79 ++ drivers/mfd/Kconfig | 12 + drivers/mfd/Makefile | 1 + drivers/mfd/upboard-fpga.c | 492 +++++++++++ drivers/pinctrl/Kconfig | 14 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-upboard.c | 1377 +++++++++++++++++++++++++++++ include/linux/mfd/upboard-fpga.h | 55 ++ 10 files changed, 2042 insertions(+) create mode 100644 drivers/leds/leds-upboard.c create mode 100644 drivers/mfd/upboard-fpga.c create mode 100644 drivers/pinctrl/pinctrl-upboard.c create mode 100644 include/linux/mfd/upboard-fpga.h
Signature · 1 line
2.17.1
PATCH v5 1/3 mfd: Add support for UP board CPLD/FPGA
The UP Squared board <http://www.upboard.com> implements certain features (pin control, onboard LEDs or CEC) through an on-board CPLD/FPGA.
This driver implements the line protocol to read and write registers from the FPGA through regmap. The register address map is also included.
The UP Boards provide a few I/O pin headers (for both GPIO and functions), including a 40-pin Raspberry Pi compatible header.
This patch implements support for the FPGA-based pin controller that manages direction and enable state for those header pins.
Partial support UP boards:
* UP core + CREX
* UP core + CRST02
---
PATCH V4 -> PATCH V5
(1) Refer 2023/05/25 Lee Jones review, cleaned up coding style and addressed review comments.
(2) Synchronizing upboard github to v1.0.5 tag.
RFC 2023/04/25 -> PATCH V4
(1) Fixed kernel test robot compiler warning.
(2) Remove mistakes with wrong Reviewed-by tags.
RFC 2022/11/23 -> RFC 2023/04/25
(1) Refer 2022/12/08 Andy Shevchenko review, cleaned up coding style and addressed review comments.
PATCH V3 -> RFC 2022/11/23:
(1) Refer 2022/11/16 Lee Jones review, cleaned up coding style and addressed review comments.
(2) Description on the UP Boards FPGA register read/write protocols PATCH V2 -> V3:
(1) fixed kernel test robot compiler warning.
PATCH V1 -> V2:
(1) Synchronizing upboard github to rc2.
(2) Refer 2022/10/31 Lee Jones review, fixed some of the issues.
---
--- drivers/mfd/Kconfig | 12 + drivers/mfd/Makefile | 1 + drivers/mfd/upboard-fpga.c | 492 +++++++++++++++++++++++++++++++ include/linux/mfd/upboard-fpga.h | 55 ++++ 4 files changed, 560 insertions(+) create mode 100644 drivers/mfd/upboard-fpga.c create mode 100644 include/linux/mfd/upboard-fpga.h
drivers/mfd/Kconfig +12 -0
@@ -2104,6 +2104,18 @@ config MFD_QCOM_PM8008 under it in the device tree. Additional drivers must be enabled in order to use the functionality of the device. +config MFD_INTEL_UPBOARD_FPGA + tristate "Support for the Intel platform foundation kit UP board FPGA" + select MFD_CORE + depends on X86 && ACPI + help + Select this option to enable the Intel AAEON UP and UP^2 on-board FPGA. + This is core driver for the UP board that implements certain (pin + control, onboard LEDs or CEC) through an on-board FPGA. + + To compile this driver as a module, choose M here: the module will be + called upboard-fpga. + menu "Multimedia Capabilities Port drivers" depends on ARCH_SA1100
drivers/mfd/Makefile +1 -0
@@ -250,6 +250,7 @@ obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o obj-$(CONFIG_MFD_ALTERA_SYSMGR) += altera-sysmgr.o obj-$(CONFIG_MFD_STPMIC1) += stpmic1.o obj-$(CONFIG_MFD_SUN4I_GPADC) += sun4i-gpadc.o +obj-$(CONFIG_MFD_INTEL_UPBOARD_FPGA) += upboard-fpga.o obj-$(CONFIG_MFD_STM32_LPTIMER) += stm32-lptimer.o obj-$(CONFIG_MFD_STM32_TIMERS) += stm32-timers.o
drivers/mfd/upboard-fpga.c new file +492 -0
492 lines not on this page · raw message
include/linux/mfd/upboard-fpga.h new file +55 -0
55 lines not on this page · raw message
Signature · 1 line
2.17.1
kernel test robot
build botRe: [PATCH V5 1/3] mfd: Add support for UP board CPLD/FPGA
kernel test robot noticed the following build warnings:
Hi larry.lai,
kernel test robot noticed the following build warnings:
[auto build test WARNING on lee-mfd/for-mfd-fixes]
[also build test WARNING on pavel-leds/for-next]
[cannot apply to lee-mfd/for-mfd-next linusw-pinctrl/devel linusw-pinctrl/for-next] [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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/larry-lai/pinctrl-Add-support-pin-control-for-UP-board-CPLD-FPGA/20230809-013857 base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-fixes patch link: https://lore.kernel.org/r/20230808145601.9401-2-larry.lai%40yunjingtech.com patch subject: [PATCH V5 1/3] mfd: Add support for UP board CPLD/FPGA config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20230810/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce: (https://download.01.org/0day-ci/archive/20230810/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/mfd/upboard-fpga.c:344:5: warning: no previous prototype for 'upboard_led_gpio_register' [-Wmissing-prototypes]
344 | int upboard_led_gpio_register(struct upboard_fpga *fpga)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mfd/upboard-fpga.c: In function 'upboard_fpga_probe':
>> drivers/mfd/upboard-fpga.c:460:30: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
460 | ddata->regmap_config = fpga_data->regmap_config;
| ^vim +/upboard_led_gpio_register +344 drivers/mfd/upboard-fpga.c
343
> 344 int upboard_led_gpio_register(struct upboard_fpga *fpga)
345 {
346 struct gpio_led blue_led, yellow_led, green_led, red_led;
347 struct gpio_desc *desc;
348 static struct gpio_led leds[4];
349 int num_leds = 0;
350 int ret;
351
352 desc = devm_gpiod_get(fpga->dev, "blue", GPIOD_OUT_LOW);
353 if (!IS_ERR(desc)) {
354 blue_led.name = "upboard:blue:";
355 blue_led.gpio = desc_to_gpio(desc);
356 blue_led.default_state = LEDS_GPIO_DEFSTATE_KEEP;
357 leds[num_leds++] = blue_led;
358 devm_gpiod_put(fpga->dev, desc);
359 }
360
361 desc = devm_gpiod_get(fpga->dev, "yellow", GPIOD_OUT_LOW);
362 if (!IS_ERR(desc)) {
363 yellow_led.name = "upboard:yellow:";
364 yellow_led.gpio = desc_to_gpio(desc);
365 yellow_led.default_state = LEDS_GPIO_DEFSTATE_KEEP;
366 leds[num_leds++] = yellow_led;
367 devm_gpiod_put(fpga->dev, desc);
368 }
369
370 desc = devm_gpiod_get(fpga->dev, "green", GPIOD_OUT_LOW);
371 if (!IS_ERR(desc)) {
372 green_led.name = "upboard:green:";
373 green_led.gpio = desc_to_gpio(desc);
374 green_led.default_state = LEDS_GPIO_DEFSTATE_KEEP;
375 leds[num_leds++] = green_led;
376 devm_gpiod_put(fpga->dev, desc);
377 }
378
379 desc = devm_gpiod_get(fpga->dev, "red", GPIOD_OUT_LOW);
380 if (!IS_ERR(desc)) {
381 red_led.name = "upboard:red:";
382 red_led.gpio = desc_to_gpio(desc);
383 red_led.default_state = LEDS_GPIO_DEFSTATE_KEEP;
384 leds[num_leds++] = red_led;
385 devm_gpiod_put(fpga->dev, desc);
386 }
387
388 /* No optional LEDs defined */
389 if (num_leds == 0)
390 return 0;
391
392 pdata.num_leds = num_leds;
393 pdata.leds = leds;
394
395 ret = devm_mfd_add_devices(fpga->dev, PLATFORM_DEVID_AUTO,
396 upboard_gpio_led_cells,
397 ARRAY_SIZE(upboard_gpio_led_cells),
398 NULL, 0, NULL);
399 if (ret) {
400 dev_err(fpga->dev, "Failed to add GPIO LEDs, %d", ret);
401 return ret;
402 }
403
404 return 0;
405 }
406
407 /*
408 * -------------------------------------- ------------
409 * | Intel SOC,1.8V | --- |ADC Chip | native driver
410 * | GPIO/I2C/SPI/UART/PWM | |SPI/I2C |
411 * -------------------------------------- -------------
412 * | |
413 * ----------------------------------------------------------
414 * | CPLD/FPGA Driver | upboard-fpga CPLD control driver
415 * | provide more GPIO driving power | register leds-upboard
416 * | HAT 40 pin mux function | register pinctrl-upboard
417 * ---------------------------------------------------------
418 * | |
419 * ---------- -------------------------------------------
420 * |3 or 4| | HAT 40 pins, 3.3V | leds-upboard
421 * | Leds | |GPIO/ADC/I2C/SPI/UART/PWM | pinctrl-upboard
422 * ---------- -------------------------------------------
423 */
424 static const struct acpi_device_id upboard_fpga_acpi_match[] = {
425 { "AANT0000", (kernel_ulong_t)&upboard_pinctrl_data },
426 { "AANT0F00", (kernel_ulong_t)&upboard_up_fpga_data },
427 { "AANT0F01", (kernel_ulong_t)&upboard_up2_fpga_data },
428 { "AANT0F02", (kernel_ulong_t)&upboard_up_fpga_data },
429 { "AANT0F03", (kernel_ulong_t)&upboard_upcore_crst02_fpga_data },
430 { "AANT0F04", (kernel_ulong_t)&upboard_up_fpga_data },
431 { }
432 };
433 MODULE_DEVICE_TABLE(acpi, upboard_fpga_acpi_match);
434
435 static int __init upboard_fpga_probe(struct platform_device *pdev)
436 {
437 struct device *dev = &pdev->dev;
438 struct upboard_fpga *ddata;
439 const struct acpi_device_id *id;
440 const struct upboard_fpga_data *fpga_data;
441 int ret;
442
443 id = acpi_match_device(upboard_fpga_acpi_match, dev);
444 if (!id)
445 return -ENODEV;
446
447 fpga_data = (const struct upboard_fpga_data *) id->driver_data;
448
449 ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL);
450 if (!ddata)
451 return -ENOMEM;
452
453 platform_set_drvdata(pdev, ddata);
454 ddata->dev = dev;
455
456 ddata->regmap = devm_regmap_init(dev, NULL, ddata, fpga_data->regmap_config);
457 if (IS_ERR(ddata->regmap))
458 return PTR_ERR(ddata->regmap);
459
> 460 ddata->regmap_config = fpga_data->regmap_config;
461
462 ret = upboard_fpga_gpio_init(ddata);
463 if (ret) {
464 /* Not FPGA firmware, abort FPGA GPIO initialize process */
465 dev_warn(dev, "Failed to initialize FPGA common GPIOs: %d", ret);
466 } else {
467 upboard_fpga_verify_device(ddata);
468 }
469
470 ret = upboard_led_gpio_register(ddata);
471 if (ret) {
472 /* LEDs are optional. */
473 dev_warn(dev, "Failed to register LEDs: %d", ret);
474 }
475
476 return devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO,
477 fpga_data->cells,
478 fpga_data->ncells,
479 NULL, 0, NULL); 480 }
481
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH v5 2/3 pinctrl: Add support pin control for UP board CPLD/FPGA
In reply to larry.laiThe UP Squared board <http://www.upboard.com> implements certain features (pin control) through an on-board FPGA.
---
PATCH V4 -> PATCH V5
(1) Fixed kernel test robot compiler warning.
(2) Synchronizing upboard github to v1.0.5 tag.
RFC 2023/04/25 -> PATCH V4
(1) Fixed kernel test robot compiler warning.
(2) Remove mistakes with wrong Reviewed-by tags.
RFC 2022/11/23 -> RFC 2023/04/25
(1) Refer 2022/12/08 Andy Shevchenko review, cleaned up coding style and addressed review comments.
PATCH V3 -> RFC 2022/11/23:
(1) Refer 2022/11/09 Linus Walleij review, cleaned up coding style and addressed review comments.
PATCH V2 -> V3:
There's no change.
PATCH V1 -> V2:
(1) Synchronized with upboard github to rc2
(2) Refer 2022/10/19 Mark Brown and Andy Shevchenko review, we removed the regmap and acpi patches and implement in upboard pinctrl driver.
(3) Refer 2022/10/19 Andy Shevchenko review, fixed the coding style issues, removed using gpio_xxxx API and removed including <linux/gpio.h>.
---
--- drivers/pinctrl/Kconfig | 14 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-upboard.c | 1377 +++++++++++++++++++++++++++++ 3 files changed, 1392 insertions(+) create mode 100644 drivers/pinctrl/pinctrl-upboard.c
drivers/pinctrl/Kconfig +14 -0
@@ -483,6 +483,20 @@ config PINCTRL_THUNDERBAY rate control and direction control. This module will be called as pinctrl-thunderbay. +config PINCTRL_UPBOARD + tristate "UP board FPGA pin controller" + depends on (X86 && ACPI) || COMPILE_TEST + depends on MFD_INTEL_UPBOARD_FPGA + select GENERIC_PINCONF + select PINMUX + select PINCONF + help + Pin controller for the FPGA GPIO lines on UP boards. Due to the + hardware layout, these are meant to be controlled in tandem with their + corresponding Intel SoC GPIOs. + To compile this driver as a module, choose M here: the module + will be called pinctrl-upboard. + config PINCTRL_ZYNQ bool "Pinctrl driver for Xilinx Zynq" depends on ARCH_ZYNQ
drivers/pinctrl/Makefile +1 -0
@@ -48,6 +48,7 @@ obj-$(CONFIG_PINCTRL_STMFX) += pinctrl-stmfx.o obj-$(CONFIG_PINCTRL_SX150X) += pinctrl-sx150x.o obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o obj-$(CONFIG_PINCTRL_THUNDERBAY) += pinctrl-thunderbay.o +obj-$(CONFIG_PINCTRL_UPBOARD) += pinctrl-upboard.o obj-$(CONFIG_PINCTRL_ZYNQMP) += pinctrl-zynqmp.o obj-$(CONFIG_PINCTRL_ZYNQ) += pinctrl-zynq.o
drivers/pinctrl/pinctrl-upboard.c new file +1377 -0
1,377 lines not on this page · raw message
Signature · 1 line
2.17.1
kernel test robot
build botRe: [PATCH V5 2/3] pinctrl: Add support pin control for UP board CPLD/FPGA
kernel test robot noticed the following build warnings:
Hi larry.lai,
kernel test robot noticed the following build warnings:
[auto build test WARNING on lee-mfd/for-mfd-fixes]
[also build test WARNING on pavel-leds/for-next]
[cannot apply to lee-mfd/for-mfd-next linusw-pinctrl/devel linusw-pinctrl/for-next linus/master v6.5-rc5 next-20230809] [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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/larry-lai/pinctrl-Add-support-pin-control-for-UP-board-CPLD-FPGA/20230809-013857 base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-fixes patch link: https://lore.kernel.org/r/20230808145601.9401-3-larry.lai%40yunjingtech.com patch subject: [PATCH V5 2/3] pinctrl: Add support pin control for UP board CPLD/FPGA config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20230810/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce: (https://download.01.org/0day-ci/archive/20230810/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
drivers/pinctrl/pinctrl-upboard.c: In function 'upboard_pin_dbg_show':
drivers/pinctrl/pinctrl-upboard.c:737:17: error: implicit declaration of function 'seq_puts' [-Werror=implicit-function-declaration]
737 | seq_puts(s, "GPIO ");
| ^~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:739:17: error: implicit declaration of function 'seq_printf'; did you mean 'bstr_printf'? [-Werror=implicit-function-declaration]
739 | seq_printf(s, "mode %d ", mode);
| ^~~~~~~~~~
| bstr_printf
>> drivers/pinctrl/pinctrl-upboard.c:727:13: warning: unused variable 'locked' [-Wunused-variable]
727 | int locked;
| ^~~~~~
drivers/pinctrl/pinctrl-upboard.c: In function 'upboard_alt_func_enable':
>> drivers/pinctrl/pinctrl-upboard.c:792:9: warning: ISO C90 forbids variable length array 'offset' [-Wvla]
792 | int offset[pctrl->pctldesc->npins];
| ^~~
>> drivers/pinctrl/pinctrl-upboard.c:805:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
805 | bool input = false;
| ^~~~
drivers/pinctrl/pinctrl-upboard.c: In function 'upboard_gpio_request':
drivers/pinctrl/pinctrl-upboard.c:936:16: error: implicit declaration of function 'pinctrl_gpio_request'; did you mean 'upboard_gpio_request'? [-Werror=implicit-function-declaration]
936 | return pinctrl_gpio_request(gpio);
| ^~~~~~~~~~~~~~~~~~~~
| upboard_gpio_request
drivers/pinctrl/pinctrl-upboard.c: In function 'upboard_gpio_free':
drivers/pinctrl/pinctrl-upboard.c:945:9: error: implicit declaration of function 'pinctrl_gpio_free' [-Werror=implicit-function-declaration]
945 | pinctrl_gpio_free(gpio);
| ^~~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c: In function 'upboard_gpio_get_direction':
drivers/pinctrl/pinctrl-upboard.c:958:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
958 | unsigned int padcfg0 = readl(pctrl->pins[pin].regs);
| ^~~~~~~~
drivers/pinctrl/pinctrl-upboard.c: In function 'upboard_gpio_direction_input':
drivers/pinctrl/pinctrl-upboard.c:1039:16: error: implicit declaration of function 'pinctrl_gpio_direction_input'; did you mean 'upboard_gpio_direction_input'? [-Werror=implicit-function-declaration]
1039 | return pinctrl_gpio_direction_input(gpio);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| upboard_gpio_direction_input
drivers/pinctrl/pinctrl-upboard.c: In function 'upboard_gpio_direction_output':
drivers/pinctrl/pinctrl-upboard.c:1051:16: error: implicit declaration of function 'pinctrl_gpio_direction_output'; did you mean 'upboard_gpio_direction_output'? [-Werror=implicit-function-declaration]
1051 | return pinctrl_gpio_direction_output(gpio);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| upboard_gpio_direction_output
drivers/pinctrl/pinctrl-upboard.c: At top level:
>> drivers/pinctrl/pinctrl-upboard.c:1106:5: warning: no previous prototype for 'upboard_acpi_node_pin_mapping' [-Wmissing-prototypes]
1106 | int upboard_acpi_node_pin_mapping(struct upboard_fpga *fpga,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/pinctrl/pinctrl-upboard.c:91:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
91 | #define BOARD_UP_APL03 9
| ^
drivers/pinctrl/pinctrl-upboard.c:1166:26: note: in expansion of macro 'BOARD_UP_APL03'
1166 | .ident = BOARD_UP_APL03,
| ^~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:91:49: note: (near initialization for 'upboard_dmi_table[0].ident')
91 | #define BOARD_UP_APL03 9
| ^
drivers/pinctrl/pinctrl-upboard.c:1166:26: note: in expansion of macro 'BOARD_UP_APL03'
1166 | .ident = BOARD_UP_APL03,
| ^~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:88:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
88 | #define BOARD_UP_WHL01 5
| ^
drivers/pinctrl/pinctrl-upboard.c:1173:26: note: in expansion of macro 'BOARD_UP_WHL01'
1173 | .ident = BOARD_UP_WHL01,
| ^~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:88:49: note: (near initialization for 'upboard_dmi_table[1].ident')
88 | #define BOARD_UP_WHL01 5
| ^
drivers/pinctrl/pinctrl-upboard.c:1173:26: note: in expansion of macro 'BOARD_UP_WHL01'
1173 | .ident = BOARD_UP_WHL01,
| ^~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:93:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
93 | #define BOARD_UPX_TGL 11
| ^~
drivers/pinctrl/pinctrl-upboard.c:1180:26: note: in expansion of macro 'BOARD_UPX_TGL'
1180 | .ident = BOARD_UPX_TGL,
| ^~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:93:49: note: (near initialization for 'upboard_dmi_table[2].ident')
93 | #define BOARD_UPX_TGL 11
| ^~
drivers/pinctrl/pinctrl-upboard.c:1180:26: note: in expansion of macro 'BOARD_UPX_TGL'
1180 | .ident = BOARD_UPX_TGL,
| ^~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:95:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
95 | #define BOARD_UPN_EHL01 13
| ^~
drivers/pinctrl/pinctrl-upboard.c:1187:26: note: in expansion of macro 'BOARD_UPN_EHL01'
1187 | .ident = BOARD_UPN_EHL01,
| ^~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:95:49: note: (near initialization for 'upboard_dmi_table[3].ident')
95 | #define BOARD_UPN_EHL01 13
| ^~
drivers/pinctrl/pinctrl-upboard.c:1187:26: note: in expansion of macro 'BOARD_UPN_EHL01'
1187 | .ident = BOARD_UPN_EHL01,
| ^~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:95:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
95 | #define BOARD_UPN_EHL01 13
| ^~
drivers/pinctrl/pinctrl-upboard.c:96:49: note: in expansion of macro 'BOARD_UPN_EHL01'
96 | #define BOARD_UPS_EHL01 BOARD_UPN_EHL01
| ^~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:1194:26: note: in expansion of macro 'BOARD_UPS_EHL01'
1194 | .ident = BOARD_UPS_EHL01,
| ^~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:95:49: note: (near initialization for 'upboard_dmi_table[4].ident')
95 | #define BOARD_UPN_EHL01 13
| ^~
drivers/pinctrl/pinctrl-upboard.c:96:49: note: in expansion of macro 'BOARD_UPN_EHL01'
96 | #define BOARD_UPS_EHL01 BOARD_UPN_EHL01
| ^~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:1194:26: note: in expansion of macro 'BOARD_UPS_EHL01'
1194 | .ident = BOARD_UPS_EHL01,
| ^~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:97:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
97 | #define BOARD_UPX_ADLP01 15
| ^~
drivers/pinctrl/pinctrl-upboard.c:1201:26: note: in expansion of macro 'BOARD_UPX_ADLP01'
1201 | .ident = BOARD_UPX_ADLP01,
| ^~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:97:49: note: (near initialization for 'upboard_dmi_table[5].ident')
97 | #define BOARD_UPX_ADLP01 15
| ^~
drivers/pinctrl/pinctrl-upboard.c:1201:26: note: in expansion of macro 'BOARD_UPX_ADLP01'
1201 | .ident = BOARD_UPX_ADLP01,
| ^~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:98:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
98 | #define BOARD_UPN_ADLN01 16
| ^~
drivers/pinctrl/pinctrl-upboard.c:1208:26: note: in expansion of macro 'BOARD_UPN_ADLN01'
1208 | .ident = BOARD_UPN_ADLN01,
| ^~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:98:49: note: (near initialization for 'upboard_dmi_table[6].ident')
98 | #define BOARD_UPN_ADLN01 16
| ^~
drivers/pinctrl/pinctrl-upboard.c:1208:26: note: in expansion of macro 'BOARD_UPN_ADLN01'
1208 | .ident = BOARD_UPN_ADLN01,
| ^~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:97:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
97 | #define BOARD_UPX_ADLP01 15
| ^~
drivers/pinctrl/pinctrl-upboard.c:99:49: note: in expansion of macro 'BOARD_UPX_ADLP01'
99 | #define BOARD_UPS_ADLP01 BOARD_UPX_ADLP01
| ^~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:1215:26: note: in expansion of macro 'BOARD_UPS_ADLP01'
1215 | .ident = BOARD_UPS_ADLP01,
| ^~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:97:49: note: (near initialization for 'upboard_dmi_table[7].ident')
97 | #define BOARD_UPX_ADLP01 15
| ^~
drivers/pinctrl/pinctrl-upboard.c:99:49: note: in expansion of macro 'BOARD_UPX_ADLP01'
99 | #define BOARD_UPS_ADLP01 BOARD_UPX_ADLP01
| ^~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:1215:26: note: in expansion of macro 'BOARD_UPS_ADLP01'
1215 | .ident = BOARD_UPS_ADLP01,
| ^~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:98:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
98 | #define BOARD_UPN_ADLN01 16
| ^~
drivers/pinctrl/pinctrl-upboard.c:100:49: note: in expansion of macro 'BOARD_UPN_ADLN01'
100 | #define BOARD_UP_ADLN01 BOARD_UPN_ADLN01
| ^~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:1222:26: note: in expansion of macro 'BOARD_UP_ADLN01'
1222 | .ident = BOARD_UP_ADLN01,
| ^~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:98:49: note: (near initialization for 'upboard_dmi_table[8].ident')
98 | #define BOARD_UPN_ADLN01 16
| ^~
drivers/pinctrl/pinctrl-upboard.c:100:49: note: in expansion of macro 'BOARD_UPN_ADLN01'
100 | #define BOARD_UP_ADLN01 BOARD_UPN_ADLN01
| ^~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:1222:26: note: in expansion of macro 'BOARD_UP_ADLN01'
1222 | .ident = BOARD_UP_ADLN01,
| ^~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c: In function 'upboard_pinctrl_probe':
>> drivers/pinctrl/pinctrl-upboard.c:1353:30: warning: assignment to 'int' from 'const char *' makes integer from pointer without a cast [-Wint-conversion]
1353 | pctrl->ident = system_id->ident;
| ^
drivers/pinctrl/pinctrl-upboard.c: At top level:
>> drivers/pinctrl/pinctrl-upboard.c:327:38: warning: 'pin_functions' defined but not used [-Wunused-const-variable=]
327 | static const struct upboard_function pin_functions[] = {
| ^~~~~~~~~~~~~
>> drivers/pinctrl/pinctrl-upboard.c:305:38: warning: 'pin_groups' defined but not used [-Wunused-const-variable=]
305 | static const struct upboard_pingroup pin_groups[] = {
| ^~~~~~~~~~cc1: some warnings being treated as errors
vim +/locked +727 drivers/pinctrl/pinctrl-upboard.c
720
721 static void upboard_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
722 unsigned int pin)
723 {
724 struct upboard_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
725 void __iomem *padcfg;
726 u32 cfg0, cfg1, mode;
> 727 int locked;
728
729 if (pctrl->pins[pin].regs == NULL)
730 return;
731
732 cfg0 = readl(pctrl->pins[pin].regs);
733 cfg1 = readl(pctrl->pins[pin].regs + PADCFG1);
734
735 mode = (cfg0 & PADCFG0_PMODE_MASK) >> PADCFG0_PMODE_SHIFT;
736 if (mode == PADCFG0_PMODE_GPIO)
> 737 seq_puts(s, "GPIO ");
738 else
> 739 seq_printf(s, "mode %d ", mode);
740
741 seq_printf(s, "0x%08x 0x%08x", cfg0, cfg1);
742
743 /* Dump the additional PADCFG registers if available */
744 padcfg = pctrl->pins[pin].regs + PADCFG2;
745 if (padcfg)
746 seq_printf(s, " 0x%08x", readl(padcfg));
747
748 seq_printf(s, " 0x%08x", pctrl->pins[pin].regs);
749 }
750
751 static const struct pinctrl_ops upboard_pinctrl_ops = {
752 .get_groups_count = upboard_get_groups_count,
753 .get_group_name = upboard_get_group_name,
754 .pin_dbg_show = upboard_pin_dbg_show,
755 };
756
757 static struct pinctrl_desc upboard_up_pinctrl_desc = {
758 .pins = upboard_up_pins,
759 .npins = ARRAY_SIZE(upboard_up_pins),
760 .pctlops = &upboard_pinctrl_ops,
761 .pmxops = &upboard_pinmux_ops,
762 .owner = THIS_MODULE,
763 };
764
765 static struct pinctrl_desc upboard_up2_pinctrl_desc = {
766 .pins = upboard_up2_pins,
767 .npins = ARRAY_SIZE(upboard_up2_pins),
768 .pctlops = &upboard_pinctrl_ops,
769 .pmxops = &upboard_pinmux_ops,
770 .owner = THIS_MODULE,
771 };
772
773 static struct pinctrl_desc upboard_upcore_crex_pinctrl_desc = {
774 .pins = upboard_upcore_crex_pins,
775 .npins = ARRAY_SIZE(upboard_upcore_crex_pins),
776 .pctlops = &upboard_pinctrl_ops,
777 .pmxops = &upboard_pinmux_ops,
778 .owner = THIS_MODULE,
779 };
780
781 static struct pinctrl_desc upboard_upcore_crst02_pinctrl_desc = {
782 .pins = upboard_upcore_crst02_pins,
783 .npins = ARRAY_SIZE(upboard_upcore_crst02_pins),
784 .pctlops = &upboard_pinctrl_ops,
785 .pmxops = &upboard_pinmux_ops,
786 .owner = THIS_MODULE,
787 };
788
789 static void upboard_alt_func_enable(struct gpio_chip *gc, const char *name, int id)
790 {
791 struct upboard_pinctrl *pctrl = container_of(gc, struct upboard_pinctrl, chip);
> 792 int offset[pctrl->pctldesc->npins];
793 int i, cnt;
794
795 /* find all pins */
796 for (i = 0, cnt = 0; i < pctrl->pctldesc->npins; i++) {
797 if (strstr(pctrl->pctldesc->pins[i].name, name))
798 offset[cnt++] = i;
799 }
800
801 /* change to alternate function */
802 for (i = 0; i < cnt; i++) {
803 if (pctrl->pins[offset[i]].regs == NULL)
804 continue;
> 805 bool input = false; 806 int mode = 0; /* default GPIO */
807 unsigned int val = readl(pctrl->pins[offset[i]].regs);
808
809 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "I2C") ||
810 strstr(pctrl->pctldesc->pins[offset[i]].name, "PINMUX")) {
811 mode = 1;
812 switch (id) {
813 case BOARD_UPN_ADLN01:
814 case BOARD_UPX_ADLP01:
815 mode = 2;
816 break;
817 default:
818 break;
819 }
820
821 val |= mode<<PADCFG0_PMODE_SHIFT;
822 writel(val, pctrl->pins[offset[i]].regs);
823 upboard_fpga_request_free(pctrl->pctldev, offset[i]);
824 continue;
825 }
826
827 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "UART")) {
828 mode = 1;
829 switch (id) {
830 case BOARD_UPN_EHL01:
831 mode = 4;
832 break;
833 case BOARD_UPN_ADLN01:
834 case BOARD_UPX_ADLP01:
835 mode = 2;
836 break;
837 default:
838 break;
839 }
840 }
841
842 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "SPI")) {
843 mode = 1;
844 switch (id) {
845 case BOARD_UP_WHL01:
846 mode = 3;
847 break;
848 case BOARD_UPN_ADLN01:
849 case BOARD_UPX_ADLP01:
850 mode = 7;
851 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "MOSI")) {
852 val &= ~PADCFG0_GPIOTXDIS;
853 val |= PADCFG0_GPIORXDIS;
854 }
855
856 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "MISO"))
857 val |= PADCFG0_GPIORXDIS;
858
859 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CLK")) {
860 val &= ~PADCFG0_GPIOTXDIS;
861 val |= PADCFG0_GPIORXDIS;
862 }
863 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CS0"))
864 val |= PADCFG0_GPIORXDIS;
865
866 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CS1"))
867 continue;
868 break;
869 default:
870 break;
871 }
872 }
873
874 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "I2S")) {
875 mode = 1;
876 switch (id) {
877 case BOARD_UPX_ADLP01:
878 mode = 4;
879 break;
880 default:
881 break;
882 }
883 }
884
885 val |= mode<<PADCFG0_PMODE_SHIFT;
886 writel(val, pctrl->pins[offset[i]].regs);
887
888 /* input pins */
889 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "RX"))
890 input = true;
891
892 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CTS"))
893 input = true;
894
895 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "ADC")) {
896 input = true;
897 if (id == BOARD_UP_APL01)
898 upboard_fpga_request_enable(pctrl->pctldev, NULL, offset[i]);
899 else
900 upboard_fpga_request_free(pctrl->pctldev, offset[i]);
901 }
902
903 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "MISO"))
904 input = true;
905
906 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "DIN"))
907 input = true;
908
909 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "SDI"))
910 input = true;
911
912 upboard_fpga_set_direction(pctrl->pctldev, NULL, offset[i], input);
913 }
914 }
915
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH V5 2/3] pinctrl: Add support pin control for UP board CPLD/FPGA
In reply to larry.laiHi Larry,
thanks for your patch!
I would really like Andy to look at this, because ACPI and I'm not good at ACPI.
Quoted 6 lines · larry.lai
The UP Squared board <http://www.upboard.com> implements certain features (pin control) through an on-board FPGA.
Reported-by kernel test robot <[email protected]>Signed-off-by Gary Wang <[email protected]>Signed-off-by larry.lai <[email protected]>
(...)
drivers/pinctrl/pinctrl-upboard.c line 810
Quoted 2 lines
drivers/pinctrl/pinctrl-upboard.c new file +2
-0+if (strstr (pctrl->pctldesc->pins[offset[i]].name,"I2C" ) || +strstr (pctrl->pctldesc->pins[offset[i]].name,"PINMUX" )) {
I think there is something like match a string list in the kernel, Andy will know.
Quoted 16 lines
drivers/pinctrl/pinctrl-upboard.c new file +16
-0+static int upboard_gpio_get (struct gpio_chip *gc,unsigned int offset) +{ + struct upboard_pinctrl *pctrl = container_of(gc, struct upboard_pinctrl, chip); +unsigned int pin = pctrl->rpi_mapping[offset]; +int gpio =upboard_rpi_to_native_gpio (gc, offset); + +if (gpio <0 ) +return gpio; + +/* APL03 board open drain GPIO */ +if (pctrl->ident ==BOARD_UP_APL03 ) { +int val =0 ; + +switch (pin) { +case 0 : +case 1 :
drivers/pinctrl/pinctrl-upboard.c line 991
Quoted 10 lines
drivers/pinctrl/pinctrl-upboard.c new file +10
-0+case 9 : +case 23 : + val =readl (pctrl->pins[pin].regs); +return val &0x00000003 ; +default : +break ; + } + } + +return gpiod_get_value (gpio_to_desc (gpio));
I don't really like this construction bouncing us back into the global GPIO numberspace to get to the descriptor of the corresponding native GPIO. gpio_to_desc() is an uglyhack and shall not be used.
You need to come up with something better here: request all the underlying GPIO descriptors with gpiod_get(dev, .. ASIS) and store them in an array. Look in e.g.drivers/gpio/gpio-aggregator.cdrivers/gpio/gpio-latch.c
for examples of how we do this in other drivers.
The underlying GPIO lines need to be specified somehow, in worst case using descriptor tables.
drivers/pinctrl/pinctrl-upboard.c
Quoted 4 lines
drivers/pinctrl/pinctrl-upboard.c new file +4
-0+/* DMI Matches for older bios without fpga initialization */ +static const struct dmi_system_id upboard_dmi_table[]__initconst = { + { + .ident =BOARD_U
A DMI table OK....
drivers/pinctrl/pinctrl-upboard.c line 1372
Quoted 6 lines
drivers/pinctrl/pinctrl-upboard.c new file +6
-0+static struct platform_driver upboard_pinctrl_driver = { + .driver = { + .name ="upboard-pinctrl" , + }, +}; +module_platform_driver_probe (upboard_pinctrl_driver, upboard_pinctrl_probe);
OK I don't know ACPI, but what I've seen the DMI table is supposed to be used for some kind of lookup, such as checking in .init if the device is there, so I don't get this. Also doesn't ACPI drivers use the ACPI bus?
Yours,
Linus Walleij
PATCH v5 3/3 leds: Add support for UP board CPLD onboard LEDS
In reply to larry.laiThe UP boards come with a few FPGA-controlled onboard LEDs:
* UP Board: yellow, green, red
* UP Squared: blue, yellow, green, red
This patch depends on patch "mfd: Add support for UP board CPLD/FPGA".
---
PATCH V4 -> PATCH V5 : There is no change.
RFC 2023/04/25 -> PATCH V4
(1) Fixed kernel test robot compiler warning.
(2) Remove mistakes with wrong Reviewed-by tags.
RFC 2022/11/23 --> RFC 2023/04/25: Refer 2022/12/08 Lee Jones review, cleaned up coding style.
PATCH V3 -> RFC 2022/11/23: Update the changes Copyright. PATCH V1 -> V3: There is no change.
PATCH --> PATCH V1: Refer 2022/10/03 Andy Shevchenko review, cleaned up coding style.
---
--- drivers/leds/Kconfig | 10 +++++ drivers/leds/Makefile | 1 + drivers/leds/leds-upboard.c | 79 +++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 drivers/leds/leds-upboard.c
drivers/leds/Kconfig +10 -0
@@ -872,6 +872,16 @@ source "drivers/leds/flash/Kconfig" comment "RGB LED drivers" source "drivers/leds/rgb/Kconfig" +config LEDS_UPBOARD + tristate "LED support for the UP board" + depends on LEDS_CLASS + depends on MFD_INTEL_UPBOARD_FPGA + help + This option enables support for the UP board LEDs. + + To compile this driver as a module, choose M here: the module + will be called leds-upboard. + comment "LED Triggers" source "drivers/leds/trigger/Kconfig"
drivers/leds/Makefile +1 -0
@@ -83,6 +83,7 @@ obj-$(CONFIG_LEDS_TI_LMU_COMMON) += leds-ti-lmu-common.o obj-$(CONFIG_LEDS_TLC591XX) += leds-tlc591xx.o obj-$(CONFIG_LEDS_TPS6105X) += leds-tps6105x.o obj-$(CONFIG_LEDS_TURRIS_OMNIA) += leds-turris-omnia.o +obj-$(CONFIG_LEDS_UPBOARD) += leds-upboard.o obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o
drivers/leds/leds-upboard.c new file +79 -0
79 lines not on this page · raw message
Signature · 1 line
2.17.1