Add Intel LJCA device driver
Subsystems (6)
cover Add Intel LJCA device driver
Add driver for Intel La Jolla Cove Adapter (LJCA) device. This is a USB-GPIO, USB-I2C and USB-SPI device. We add 4 drivers to support this device: a USB driver, a GPIO chip driver, a I2C controller driver and a SPI controller driver.
Ye Xiang (5):
mfd: Add support for Intel LJCA device
gpio: Add support for Intel LJCA USB GPIO driver
i2c: Add support for Intel LJCA USB I2C driver
spi: Add support for Intel LJCA USB SPI driver
Documentation: Add ABI doc for attributes of LJCA device
.../ABI/testing/sysfs-bus-usb-devices-ljca | 22 + drivers/gpio/Kconfig | 10 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-ljca.c | 454 ++++++++ drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-ljca.c | 357 +++++++ drivers/mfd/Kconfig | 13 + drivers/mfd/Makefile | 1 + drivers/mfd/ljca.c | 977 ++++++++++++++++++ drivers/spi/Kconfig | 10 + drivers/spi/Makefile | 1 + drivers/spi/spi-ljca.c | 291 ++++++ include/linux/mfd/ljca.h | 95 ++ 14 files changed, 2243 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-usb-devices-ljca create mode 100644 drivers/gpio/gpio-ljca.c create mode 100644 drivers/i2c/busses/i2c-ljca.c create mode 100644 drivers/mfd/ljca.c create mode 100644 drivers/spi/spi-ljca.c create mode 100644 include/linux/mfd/ljca.h
Signature · 1 line
2.34.1
PATCH 1/5 mfd: Add support for Intel LJCA device
This patch implements the USB part of Intel USB-I2C/GPIO/SPI adapter device named "La Jolla Cove Adapter" (LJCA).
The communication between the various LJCA module drivers and the hardware will be muxed/demuxed by this driver. The sub-module of LJCA can use ljca_transfer() to issue a transfer between host and hardware.
Each sub-module of LJCA device is identified by type field within the LJCA message header.
The minimum code in ASL that covers this board is
Scope (\_SB.PCI0.DWC3.RHUB.HS01)
{
Device (GPIO)
{
Name (_ADR, Zero)
Name (_STA, 0x0F)
}
Device (I2C)
{
Name (_ADR, One)
Name (_STA, 0x0F)
}
Device (SPI)
{
Name (_ADR, 0x02)
Name (_STA, 0x0F)
}
}--- drivers/mfd/Kconfig | 13 + drivers/mfd/Makefile | 1 + drivers/mfd/ljca.c | 977 +++++++++++++++++++++++++++++++++++++++ include/linux/mfd/ljca.h | 95 ++++ 4 files changed, 1086 insertions(+) create mode 100644 drivers/mfd/ljca.c create mode 100644 include/linux/mfd/ljca.h
drivers/mfd/Kconfig +13 -0
@@ -411,6 +411,19 @@ config MFD_DLN2 etc. must be enabled in order to use the functionality of the device. +config MFD_LJCA + tristate "Intel La Jolla Cove Adapter support" + select MFD_CORE + depends on USB + help + This adds support for Intel La Jolla Cove USB-I2C/SPI/GPIO + Master Adapter (LJCA). Additional drivers such as I2C_LJCA, + GPIO_LJCA and SPI_LJCA must be enabled in order to use the + functionality of the device. + + This driver can also be built as a module. If so, the module + will be called ljca. + config MFD_ENE_KB3930 tristate "ENE KB3930 Embedded Controller support" depends on I2C
drivers/mfd/Makefile +1 -0
@@ -237,6 +237,7 @@ obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o obj-$(CONFIG_MFD_HI6421_SPMI) += hi6421-spmi-pmic.o obj-$(CONFIG_MFD_HI655X_PMIC) += hi655x-pmic.o obj-$(CONFIG_MFD_DLN2) += dln2.o +obj-$(CONFIG_MFD_LJCA) += ljca.o obj-$(CONFIG_MFD_RT4831) += rt4831.o obj-$(CONFIG_MFD_RT5033) += rt5033.o obj-$(CONFIG_MFD_RT5120) += rt5120.o
drivers/mfd/ljca.c new file +977 -0
977 lines not on this page · raw message
include/linux/mfd/ljca.h new file +95 -0
95 lines not on this page · raw message
Signature · 1 line
2.34.1
Lee Jones
maintainerRe: [PATCH 1/5] mfd: Add support for Intel LJCA device
Quoted 2 lines · Ye Xiang
This patch implements the USB part of Intel USB-I2C/GPIO/SPI adapter device named "La Jolla Cove Adapter" (LJCA).
The "USB part" should live in drivers/usb.
You can use MFD to register each of the components, but all of the USB functionality needs moving somewhere else.
Quoted 39 lines
The communication between the various LJCA module drivers and the hardware will be muxed/demuxed by this driver. The sub-module of LJCA can use
ljca_transfer()to issue a transfer between host and hardware.Each sub-module of LJCA device is identified by type field within the LJCA message header.
The minimum code in ASL that covers this board is
Scope (\_SB.PCI0.DWC3.RHUB.HS01){ Device (GPIO) { Name (_ADR, Zero) Name (_STA, 0x0F) } Device (I2C) { Name (_ADR, One) Name (_STA, 0x0F) } Device (SPI) { Name (_ADR, 0x02) Name (_STA, 0x0F) } }Signed-off-by Ye Xiang <[email protected]>--- drivers/mfd/Kconfig | 13 + drivers/mfd/Makefile | 1 + drivers/mfd/ljca.c | 977 +++++++++++++++++++++++++++++++++++++++ include/linux/mfd/ljca.h | 95 ++++ 4 files changed, 1086 insertions(+) create mode 100644 drivers/mfd/ljca.c create mode 100644 include/linux/mfd/ljca.h
Signature · 1 line
Lee Jones [李琼斯]
Re: [PATCH 1/5] mfd: Add support for Intel LJCA device
Hi Lee,
Thanks for the review.
Quoted 6 lines · Lee Jones
Quoted 2 lines · Ye Xiang
This patch implements the USB part of Intel USB-I2C/GPIO/SPI adapter device named "La Jolla Cove Adapter" (LJCA).
The "USB part" should live in
drivers/usb.
What about putting ljca.c to drivers/usb/misc?
Quoted 3 lines
You can use MFD to register each of the components, but all of the USB functionality needs moving somewhere else.
Ok, Now the USB functionality drivers have already been put to related driver
folders: spi-ljca in drivers/spi, i2c-ljca in drivers/i2c, and gpio-ljca in drivers/gpio.
Quoted 43 lines
Quoted 40 lines
The communication between the various LJCA module drivers and the hardware will be muxed/demuxed by this driver. The sub-module of LJCA can use
ljca_transfer()to issue a transfer between host and hardware.Each sub-module of LJCA device is identified by type field within the LJCA message header.
The minimum code in ASL that covers this board is
Scope (\_SB.PCI0.DWC3.RHUB.HS01){ Device (GPIO) { Name (_ADR, Zero) Name (_STA, 0x0F) } Device (I2C) { Name (_ADR, One) Name (_STA, 0x0F) } Device (SPI) { Name (_ADR, 0x02) Name (_STA, 0x0F) } }Signed-off-by Ye Xiang <[email protected]>--- drivers/mfd/Kconfig | 13 + drivers/mfd/Makefile | 1 + drivers/mfd/ljca.c | 977 +++++++++++++++++++++++++++++++++++++++ include/linux/mfd/ljca.h | 95 ++++ 4 files changed, 1086 insertions(+) create mode 100644 drivers/mfd/ljca.c create mode 100644 include/linux/mfd/ljca.hSignature · 1 line
Lee Jones [李琼斯]
Lee Jones
maintainerRe: [PATCH 1/5] mfd: Add support for Intel LJCA device
Quoted 11 lines · Xiang
Hi Lee,
Thanks for the review.
Quoted 6 lines · Lee Jones
Quoted 2 lines · Ye Xiang
This patch implements the USB part of Intel USB-I2C/GPIO/SPI adapter device named "La Jolla Cove Adapter" (LJCA).
The "USB part" should live in
drivers/usb.What about putting
ljca.ctodrivers/usb/misc?
Sounds reasonable to to me at first glance.
However, that will ultimately be up to the USB maintainers.
Signature · 1 line
Lee Jones [李琼斯]
PATCH 2/5 gpio: Add support for Intel LJCA USB GPIO driver
In reply to Ye XiangThis patch implements the GPIO function of Intel USB-I2C/GPIO/SPI adapter device named "La Jolla Cove Adapter" (LJCA). It communicate with LJCA GPIO module with specific protocol through interfaces exported by LJCA USB driver.
--- drivers/gpio/Kconfig | 10 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-ljca.c | 454 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 465 insertions(+) create mode 100644 drivers/gpio/gpio-ljca.c
drivers/gpio/Kconfig +10 -0
@@ -1257,6 +1257,16 @@ config GPIO_KEMPLD This driver can also be built as a module. If so, the module will be called gpio-kempld. +config GPIO_LJCA + tristate "INTEL La Jolla Cove Adapter GPIO support" + depends on MFD_LJCA + help + Select this option to enable GPIO driver for the INTEL + La Jolla Cove Adapter (LJCA) board. + + This driver can also be built as a module. If so, the module + will be called gpio-ljca. + config GPIO_LP3943 tristate "TI/National Semiconductor LP3943 GPIO expander" depends on MFD_LP3943
drivers/gpio/Makefile +1 -0
@@ -78,6 +78,7 @@ obj-$(CONFIG_GPIO_IXP4XX) += gpio-ixp4xx.o obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o obj-$(CONFIG_GPIO_KEMPLD) += gpio-kempld.o obj-$(CONFIG_GPIO_LATCH) += gpio-latch.o +obj-$(CONFIG_GPIO_LJCA) += gpio-ljca.o obj-$(CONFIG_GPIO_LOGICVC) += gpio-logicvc.o obj-$(CONFIG_GPIO_LOONGSON1) += gpio-loongson1.o obj-$(CONFIG_GPIO_LOONGSON) += gpio-loongson.o
drivers/gpio/gpio-ljca.c new file +454 -0
454 lines not on this page · raw message
Signature · 1 line
2.34.1
kernel test robot
build botRe: [PATCH 2/5] gpio: Add support for Intel LJCA USB GPIO driver
Thank you for the patch! Perhaps something to improve:
Hi Ye,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on lee-mfd/for-mfd-next]
[also build test WARNING on wsa/i2c/for-next broonie-spi/for-next linus/master v6.2-rc8] [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/Ye-Xiang/mfd-Add-support-for-Intel-LJCA-device/20230220-023253 base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next patch link: https://lore.kernel.org/r/20230219183059.1029525-3-xiang.ye%40intel.com patch subject: [PATCH 2/5] gpio: Add support for Intel LJCA USB GPIO driver config: hexagon-randconfig-r005-20230220 (https://download.01.org/0day-ci/archive/20230220/[email protected]/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project db89896bbbd2251fff457699635acbbedeead27f)
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/intel-lab-lkp/linux/commit/ddd4f4ee32eff2fd7cb9933efdc8966d58894160
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Ye-Xiang/mfd-Add-support-for-Intel-LJCA-device/20230220-023253 git checkout ddd4f4ee32eff2fd7cb9933efdc8966d58894160
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/gpio/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from drivers/gpio/gpio-ljca.c:12:
In file included from include/linux/gpio/driver.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/gpio/gpio-ljca.c:12:
In file included from include/linux/gpio/driver.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/gpio/gpio-ljca.c:12:
In file included from include/linux/gpio/driver.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
>> drivers/gpio/gpio-ljca.c:436:40: warning: unused variable 'ljca_gpio_id' [-Wunused-const-variable]
static const struct platform_device_id ljca_gpio_id[] = {
^7 warnings generated.
vim +/ljca_gpio_id +436 drivers/gpio/gpio-ljca.c
434
435 #define LJCA_GPIO_DRV_NAME "ljca-gpio"
> 436 static const struct platform_device_id ljca_gpio_id[] = { 437 { LJCA_GPIO_DRV_NAME, 0 },
438 { /* sentinel */ }
439 };
440 MODULE_DEVICE_TABLE(platform, ljca_gpio_id);
441
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
kernel test robot
build botRe: [PATCH 2/5] gpio: Add support for Intel LJCA USB GPIO driver
In reply to Ye XiangThank you for the patch! Perhaps something to improve:
Hi Ye,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on lee-mfd/for-mfd-next]
[also build test WARNING on lee-mfd/for-mfd-fixes wsa/i2c/for-next broonie-spi/for-next linus/master v6.2-rc8] [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/Ye-Xiang/mfd-Add-support-for-Intel-LJCA-device/20230220-023253 base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next patch link: https://lore.kernel.org/r/20230219183059.1029525-3-xiang.ye%40intel.com patch subject: [PATCH 2/5] gpio: Add support for Intel LJCA USB GPIO driver config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20230220/[email protected]/config) compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/ddd4f4ee32eff2fd7cb9933efdc8966d58894160
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Ye-Xiang/mfd-Add-support-for-Intel-LJCA-device/20230220-023253 git checkout ddd4f4ee32eff2fd7cb9933efdc8966d58894160
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 olddefconfig
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/gpio/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/gpio/gpio-ljca.c:436:40: warning: 'ljca_gpio_id' defined but not used [-Wunused-const-variable=]
436 | static const struct platform_device_id ljca_gpio_id[] = {
| ^~~~~~~~~~~~vim +/ljca_gpio_id +436 drivers/gpio/gpio-ljca.c
434
435 #define LJCA_GPIO_DRV_NAME "ljca-gpio"
> 436 static const struct platform_device_id ljca_gpio_id[] = { 437 { LJCA_GPIO_DRV_NAME, 0 },
438 { /* sentinel */ }
439 };
440 MODULE_DEVICE_TABLE(platform, ljca_gpio_id);
441
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
Re: [PATCH 2/5] gpio: Add support for Intel LJCA USB GPIO driver
In reply to Ye XiangHi Ye,
thanks for your patch!
I think your colleague Andy Shevchenko will provide the most detailed and deep feedback, but here are some things I spotted immediately:
Quoted 6 lines · Ye Xiang
This patch implements the GPIO function of Intel USB-I2C/GPIO/SPI adapter device named "La Jolla Cove Adapter" (LJCA). It communicate with LJCA GPIO module with specific protocol through interfaces exported by LJCA USB driver.
Signed-off-by Ye Xiang <[email protected]>
(...)
drivers/gpio/Kconfig config GPIO_KEMPLD · line 1262
Quoted 3 lines
drivers/gpio/Kconfig +3
-0+config GPIO_LJCA + tristate "INTEL La Jolla Cove Adapter GPIO support" + depends on MFD_LJCA
I would add
default MFD_LJCA
so if you activate the MFD you get this subdriver by default as module or built-in depending on what the MFD is built as.
(Same goes for the other subdrivers I guess)
In addition you need:
select GPIOLIB_IRQCHIP
since you use this facility.
Quoted 1 line
+static struct
irq_chipljca_gpio_irqchip= {
static const ...
drivers/gpio/gpio-ljca.c line 364
Quoted 9 lines
drivers/gpio/gpio-ljca.c new file +9
-0+ .name = "ljca-irq", + .irq_mask = ljca_irq_mask, + .irq_unmask = ljca_irq_unmask, + .irq_set_type = ljca_irq_set_type, + .irq_bus_lock = ljca_irq_bus_lock, + .irq_bus_sync_unlock = ljca_irq_bus_unlock, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +};
Yours,
Linus Walleij
Re: [PATCH 2/5] gpio: Add support for Intel LJCA USB GPIO driver
Hi Walleij,
Thanks for the review.
Quoted 23 lines · Linus Walleij
Hi Ye,
thanks for your patch!
I think your colleague Andy Shevchenko will provide the most detailed and deep feedback, but here are some things I spotted immediately:
Quoted 6 lines · Ye Xiang
This patch implements the GPIO function of Intel USB-I2C/GPIO/SPI adapter device named "La Jolla Cove Adapter" (LJCA). It communicate with LJCA GPIO module with specific protocol through interfaces exported by LJCA USB driver.
Signed-off-by Ye Xiang <[email protected]>(...)
drivers/gpio/Kconfig config GPIO_KEMPLD · line 1262
Quoted 3 lines
drivers/gpio/Kconfig +3
-0+config GPIO_LJCA + tristate "INTEL La Jolla Cove Adapter GPIO support" + depends on MFD_LJCAI would add
Quoted 7 lines
default
MFD_LJCAso if you activate the MFD you get this subdriver by default as module or built-in depending on what the MFD is built as.
(Same goes for the other subdrivers I guess)
Agree, I will add "default MFD_LJCA" on all the LJCA subdrivers.
Quoted 10 lines
In addition you need:
select
GPIOLIB_IRQCHIPsince you use this facility.
Quoted 1 line
+static struct
irq_chipljca_gpio_irqchip= {static const ...
Yes, I will add "select GPIOLIB_IRQCHIP" and use "static const" here.
Quoted 11 lines
drivers/gpio/gpio-ljca.c line 364
Quoted 10 lines
drivers/gpio/gpio-ljca.c new file +9
-0+ .name = "ljca-irq", + .irq_mask = ljca_irq_mask, + .irq_unmask = ljca_irq_unmask, + .irq_set_type = ljca_irq_set_type, + .irq_bus_lock = ljca_irq_bus_lock, + .irq_bus_sync_unlock = ljca_irq_bus_unlock, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +};
Quoted 2 lines
Yours,
Linus Walleij
Thanks
Ye Xiang
PATCH 3/5 i2c: Add support for Intel LJCA USB I2C driver
In reply to Ye XiangThis patch implements the I2C function of Intel USB-I2C/GPIO/SPI adapter device named "La Jolla Cove Adapter" (LJCA). It communicate with LJCA I2c module with specific protocol through interfaces exported by LJCA USB driver.
--- drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-ljca.c | 357 ++++++++++++++++++++++++++++++++++ 3 files changed, 368 insertions(+) create mode 100644 drivers/i2c/busses/i2c-ljca.c
drivers/i2c/busses/Kconfig +10 -0
@@ -1243,6 +1243,16 @@ config I2C_DLN2 This driver can also be built as a module. If so, the module will be called i2c-dln2. +config I2C_LJCA + tristate "I2C functionality of Intel La Jolla Cove Adapter" + depends on MFD_LJCA + help + If you say yes to this option, I2C functionality support of Intel + La Jolla Cove Adapter (LJCA) will be included. + + This driver can also be built as a module. If so, the module + will be called i2c-ljca. + config I2C_CP2615 tristate "Silicon Labs CP2615 USB sound card and I2C adapter" depends on USB
drivers/i2c/busses/Makefile +1 -0
@@ -131,6 +131,7 @@ obj-$(CONFIG_I2C_RCAR) += i2c-rcar.o # External I2C/SMBus adapter drivers obj-$(CONFIG_I2C_DIOLAN_U2C) += i2c-diolan-u2c.o obj-$(CONFIG_I2C_DLN2) += i2c-dln2.o +obj-$(CONFIG_I2C_LJCA) += i2c-ljca.o obj-$(CONFIG_I2C_CP2615) += i2c-cp2615.o obj-$(CONFIG_I2C_PARPORT) += i2c-parport.o obj-$(CONFIG_I2C_PCI1XXXX) += i2c-mchp-pci1xxxx.o
drivers/i2c/busses/i2c-ljca.c new file +357 -0
357 lines not on this page · raw message
Signature · 1 line
2.34.1
kernel test robot
build botRe: [PATCH 3/5] i2c: Add support for Intel LJCA USB I2C driver
Thank you for the patch! Perhaps something to improve:
Hi Ye,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on lee-mfd/for-mfd-next]
[also build test WARNING on lee-mfd/for-mfd-fixes wsa/i2c/for-next broonie-spi/for-next linus/master v6.2-rc8 next-20230217] [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/Ye-Xiang/mfd-Add-support-for-Intel-LJCA-device/20230220-023253 base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next patch link: https://lore.kernel.org/r/20230219183059.1029525-4-xiang.ye%40intel.com patch subject: [PATCH 3/5] i2c: Add support for Intel LJCA USB I2C driver config: hexagon-randconfig-r016-20230220 (https://download.01.org/0day-ci/archive/20230220/[email protected]/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project db89896bbbd2251fff457699635acbbedeead27f)
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/intel-lab-lkp/linux/commit/9faeca641d7d776bbd8158b606a77830eddde590
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Ye-Xiang/mfd-Add-support-for-Intel-LJCA-device/20230220-023253
git checkout 9faeca641d7d776bbd8158b606a77830eddde590
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/i2c/busses/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from drivers/i2c/busses/i2c-ljca.c:11:
In file included from include/linux/i2c.h:19:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:26:
In file included from include/linux/kernel_stat.h:9:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/i2c/busses/i2c-ljca.c:11:
In file included from include/linux/i2c.h:19:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:26:
In file included from include/linux/kernel_stat.h:9:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/i2c/busses/i2c-ljca.c:11:
In file included from include/linux/i2c.h:19:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:26:
In file included from include/linux/kernel_stat.h:9:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
>> drivers/i2c/busses/i2c-ljca.c:78:63: warning: operator '?:' has lower precedence than '|'; '|' will be evaluated first [-Wbitwise-conditional-parentheses]
return (slave_addr << 1) | (type == LJCA_I2C_READ_XFER_TYPE) ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
drivers/i2c/busses/i2c-ljca.c:78:63: note: place parentheses around the '|' expression to silence this warning
return (slave_addr << 1) | (type == LJCA_I2C_READ_XFER_TYPE) ?
^
( )
drivers/i2c/busses/i2c-ljca.c:78:63: note: place parentheses around the '?:' expression to evaluate it first
return (slave_addr << 1) | (type == LJCA_I2C_READ_XFER_TYPE) ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
>> drivers/i2c/busses/i2c-ljca.c:339:40: warning: unused variable 'ljca_i2c_id' [-Wunused-const-variable]
static const struct platform_device_id ljca_i2c_id[] = {
^8 warnings generated.
vim +78 drivers/i2c/busses/i2c-ljca.c
75
76 static u8 ljca_i2c_format_slave_addr(u8 slave_addr, u8 type)
77 {
> 78 return (slave_addr << 1) | (type == LJCA_I2C_READ_XFER_TYPE) ?
79 LJCA_I2C_SLAVE_TRANSFER_READ :
80 LJCA_I2C_SLAVE_TRANSFER_WRITE;
81 }
82 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
kernel test robot
build botRe: [PATCH 3/5] i2c: Add support for Intel LJCA USB I2C driver
In reply to Ye XiangThank you for the patch! Perhaps something to improve:
Hi Ye,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on lee-mfd/for-mfd-next]
[also build test WARNING on lee-mfd/for-mfd-fixes wsa/i2c/for-next broonie-spi/for-next linus/master v6.2-rc8] [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/Ye-Xiang/mfd-Add-support-for-Intel-LJCA-device/20230220-023253 base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next patch link: https://lore.kernel.org/r/20230219183059.1029525-4-xiang.ye%40intel.com patch subject: [PATCH 3/5] i2c: Add support for Intel LJCA USB I2C driver config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230220/[email protected]/config) compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/9faeca641d7d776bbd8158b606a77830eddde590
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Ye-Xiang/mfd-Add-support-for-Intel-LJCA-device/20230220-023253 git checkout 9faeca641d7d776bbd8158b606a77830eddde590
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 olddefconfig
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/i2c/busses/ drivers/spi/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/i2c/busses/i2c-ljca.c:339:40: warning: 'ljca_i2c_id' defined but not used [-Wunused-const-variable=]
339 | static const struct platform_device_id ljca_i2c_id[] = {
| ^~~~~~~~~~~vim +/ljca_i2c_id +339 drivers/i2c/busses/i2c-ljca.c
337
338 #define LJCA_I2C_DRV_NAME "ljca-i2c"
> 339 static const struct platform_device_id ljca_i2c_id[] = { 340 { LJCA_I2C_DRV_NAME, 0 },
341 { /* sentinel */ }
342 };
343 MODULE_DEVICE_TABLE(platform, ljca_i2c_id);
344
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
PATCH 4/5 spi: Add support for Intel LJCA USB SPI driver
In reply to Ye XiangThis patch implements the SPI function of Intel USB-I2C/GPIO/SPI adapter device named "La Jolla Cove Adapter" (LJCA). It communicate with LJCA SPI module with specific protocol through interfaces exported by LJCA USB driver.
--- drivers/spi/Kconfig | 10 ++ drivers/spi/Makefile | 1 + drivers/spi/spi-ljca.c | 291 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 302 insertions(+) create mode 100644 drivers/spi/spi-ljca.c
drivers/spi/Kconfig +10 -0
@@ -396,6 +396,16 @@ config SPI_HISI_SFC_V3XX This enables support for HiSilicon v3xx SPI NOR flash controller found in hi16xx chipsets. +config SPI_LJCA + tristate "Intel La Jolla Cove Adapter SPI support" + depends on MFD_LJCA + help + Select this option to enable SPI driver for the Intel + La Jolla Cove Adapter (LJCA) board. + + This driver can also be built as a module. If so, the module + will be called spi-ljca. + config SPI_NXP_FLEXSPI tristate "NXP Flex SPI controller" depends on ARCH_LAYERSCAPE || HAS_IOMEM
drivers/spi/Makefile +1 -0
@@ -68,6 +68,7 @@ obj-$(CONFIG_SPI_INTEL_PCI) += spi-intel-pci.o obj-$(CONFIG_SPI_INTEL_PLATFORM) += spi-intel-platform.o obj-$(CONFIG_SPI_LANTIQ_SSC) += spi-lantiq-ssc.o obj-$(CONFIG_SPI_JCORE) += spi-jcore.o +obj-$(CONFIG_SPI_LJCA) += spi-ljca.o obj-$(CONFIG_SPI_LM70_LLP) += spi-lm70llp.o obj-$(CONFIG_SPI_LP8841_RTC) += spi-lp8841-rtc.o obj-$(CONFIG_SPI_MESON_SPICC) += spi-meson-spicc.o
drivers/spi/spi-ljca.c new file +291 -0
291 lines not on this page · raw message
Signature · 1 line
2.34.1
kernel test robot
build botRe: [PATCH 4/5] spi: Add support for Intel LJCA USB SPI driver
Thank you for the patch! Perhaps something to improve:
Hi Ye,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on lee-mfd/for-mfd-next]
[also build test WARNING on lee-mfd/for-mfd-fixes wsa/i2c/for-next broonie-spi/for-next linus/master v6.2] [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/Ye-Xiang/mfd-Add-support-for-Intel-LJCA-device/20230220-023253 base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next patch link: https://lore.kernel.org/r/20230219183059.1029525-5-xiang.ye%40intel.com patch subject: [PATCH 4/5] spi: Add support for Intel LJCA USB SPI driver config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230220/[email protected]/config) compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/6fbec44daa135bd057079083efafd579c710467e
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Ye-Xiang/mfd-Add-support-for-Intel-LJCA-device/20230220-023253 git checkout 6fbec44daa135bd057079083efafd579c710467e
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 olddefconfig
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/spi/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/spi/spi-ljca.c:269:40: warning: 'ljca_spi_id' defined but not used [-Wunused-const-variable=]
269 | static const struct platform_device_id ljca_spi_id[] = {
| ^~~~~~~~~~~vim +/ljca_spi_id +269 drivers/spi/spi-ljca.c
267
268 #define LJCA_SPI_DRV_NAME "ljca-spi"
> 269 static const struct platform_device_id ljca_spi_id[] = { 270 { LJCA_SPI_DRV_NAME, 0 },
271 { /* sentinel */ }
272 };
273 MODULE_DEVICE_TABLE(platform, ljca_spi_id);
274
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
PATCH 5/5 Documentation: Add ABI doc for attributes of LJCA device
In reply to Ye XiangAdd sysfs attributes Documentation entries for LJCA device
--- .../ABI/testing/sysfs-bus-usb-devices-ljca | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-usb-devices-ljca
Documentation/ABI/testing/sysfs-bus-usb-devices-ljca new file +22 -0
@@ -0,0 +1,22 @@ +What: /sys/bus/usb/.../version +Date: July 2023 +KernelVersion: 6.4 +Contact: Ye Xiang <[email protected]> +Description: + Provides the current firmware version of LJCA device. + The format is Major.Minor.Patch.Build, where + Major, Minor, Patch, and Build are decimal numbers. + For example: 1.0.0.256 + +What: /sys/bus/usb/.../cmd +Date: July 2023 +KernelVersion: 6.4 +Contact: Ye Xiang <[email protected]> +Description: + Commands supported by LJCA device. + When read, it will return valid commands. + When write with a command, it will execute the command. + Valid commands are [dfu, reset, debug] + dfu: Force LJCA device to enter DFU mode. + reset: Trigger soft reset for LJCA device. + debug: Enable debug logging.
Signature · 1 line
2.34.1
Re: [PATCH 5/5] Documentation: Add ABI doc for attributes of LJCA device
Hi Ye,
thanks for your patch!
Quoted 3 lines · Ye Xiang
Add sysfs attributes Documentation entries for LJCA device
Signed-off-by Ye Xiang <[email protected]>
(...)
Documentation/ABI/testing/sysfs-bus-usb-devices-ljca line 22
Quoted 12 lines
Documentation/ABI/testing/sysfs-bus-usb-devices-ljca new file +12
-0+What: /sys/bus/usb/.../cmd +Date: July 2023 +KernelVersion: 6.4 +Contact: Ye Xiang <[email protected]> +Description: + Commands supported by LJCA device. + When read, it will return valid commands. + When write with a command, it will execute the command. + Valid commands are [dfu, reset, debug] + dfu: Force LJCA device to enter DFU mode. + reset: Trigger soft reset for LJCA device. + debug: Enable debug logging.
Given that there are kernel drivers for this device, it looks pretty dangerous to make it possible for userspace to reset the device?
But maybe it will re-enumerate when you do this so all drivers unload cleanly and then re-probe?
I guess the DFU mode will use the USB standard class for updating the firmware?
Perhaps a short blurb on the use case for each string could be helpful, like "echo dfu to this file so as to put the device into DFU mode so the firmware can be updated".
Is the idea that e.g. fwupdmgr should provide a front-end for this?
Yours,
Linus Walleij
Re: [PATCH 5/5] Documentation: Add ABI doc for attributes of LJCA device
Hi Walleij,
Thanks for the review.
Quoted 10 lines · Linus Walleij
Hi Ye,
thanks for your patch!
Quoted 3 lines · Ye Xiang
Add sysfs attributes Documentation entries for LJCA device
Signed-off-by Ye Xiang <[email protected]>(...)
Quoted 15 lines
Documentation/ABI/testing/sysfs-bus-usb-devices-ljca line 22
Quoted 12 lines
Documentation/ABI/testing/sysfs-bus-usb-devices-ljca new file +12
-0+What: /sys/bus/usb/.../cmd +Date: July 2023 +KernelVersion: 6.4 +Contact: Ye Xiang <[email protected]> +Description: + Commands supported by LJCA device. + When read, it will return valid commands. + When write with a command, it will execute the command. + Valid commands are [dfu, reset, debug] + dfu: Force LJCA device to enter DFU mode. + reset: Trigger soft reset for LJCA device. + debug: Enable debug logging.Given that there are kernel drivers for this device, it looks pretty dangerous to make it possible for userspace to reset the device?
Agree. I would just remove the reset cmd on the next version. User access LJCA will fail during reset because the reset cmd could cause LJCA down for a short time.
Quoted 3 lines
But maybe it will re-enumerate when you do this so all drivers unload cleanly and then re-probe?
No, I haven't implemented the re-probe yet. It seems quite complicated to make sure all drivers depend on LJCA re-init. So, I would just stop exporting the reset interface to userspace.
Quoted 3 lines
I guess the DFU mode will use the USB standard class for updating the firmware?
Yes.
Quoted 4 lines
Perhaps a short blurb on the use case for each string could be helpful, like "echo dfu to this file so as to put the device into DFU mode so the firmware can be updated".
Thanks will add this blurb.
Quoted 2 lines
Is the idea that e.g. fwupdmgr should provide a front-end for this?
We haven't implemented a front-end in fwupdmgr. dfu-util is used to update LJCA firmware manually currently. Maybe we will consider implementing this in fwupdmgr later.
Quoted 3 lines
Yours,
Linus Walleij
--
Thanks
Ye Xiang
Re: [PATCH 5/5] Documentation: Add ABI doc for attributes of LJCA device
Quoted 7 lines · Xiang
Quoted 1 line · Linus Walleij
Is the idea that e.g. fwupdmgr should provide a front-end for this?
We haven't implemented a front-end in fwupdmgr. dfu-util is used to update LJCA firmware manually currently. Maybe we will consider implementing this in fwupdmgr later.
It's a matter of process rather than implementation really, but if you can please communicate upward to the project that if this is to go into consumer hands (i.e. be used by random people on random laptops) the firmware update should come via fwupdmgr.
Yours,
Linus Walleij