Commit Graph

13 Commits

Author SHA1 Message Date
Jean Delvare
9b50fe117d misc: keba: Add hardware dependency
Only propose KEBA CP500 drivers on architectures where the device
exists, unless build-testing.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Gerhard Engleder <eg@keba.com>
Link: https://lore.kernel.org/r/20241104142217.1dad57cf@endymion.delvare
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-07 09:53:46 +01:00
Gerhard Engleder
c3c3a3e219 misc: keba: Fix missing I2C dependency
Kernel test robot reported a build error on csky:

drivers/misc/keba/cp500.c:287:(.text+0x1c0): undefined reference to `i2c_verify_client'

Add I2C dependency to fix build error.

Fixes: 7948483001 ("misc: keba: Add SPI controller device")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202410130817.NXBCxx4q-lkp@intel.com/
Signed-off-by: Gerhard Engleder <eg@keba.com>
Link: https://lore.kernel.org/r/20241016182751.10457-1-gerhard@engleder-embedded.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-18 13:42:18 +02:00
Gerhard Engleder
a27b406a49 misc: keba: Add UART devices
Add support for the UART auxiliary devices. This enables access to up to
3 different UARTs, which are implemented in the FPGA.

Signed-off-by: Gerhard Engleder <eg@keba.com>
Link: https://lore.kernel.org/r/20241011191257.19702-9-gerhard@engleder-embedded.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-13 17:16:57 +02:00
Gerhard Engleder
ca7b844b91 misc: keba: Add battery device
Add support for the battery auxiliary device. This enables monitoring of
the battery.

Signed-off-by: Gerhard Engleder <eg@keba.com>
Link: https://lore.kernel.org/r/20241011191257.19702-8-gerhard@engleder-embedded.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-13 17:16:57 +02:00
Gerhard Engleder
f965d315bc misc: keba: Add fan device
Add support for the fan auxiliary device. This enables monitoring of the
fan.

Signed-off-by: Gerhard Engleder <eg@keba.com>
Link: https://lore.kernel.org/r/20241011191257.19702-7-gerhard@engleder-embedded.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-13 17:16:57 +02:00
Gerhard Engleder
c6576d9195 misc: keba: Support EEPROM sections as separate devices
The main EEPROM of KEBA CP500 devices is divided into two sections. One
section for type label data like device name, order number, serial
number and so on. The second section is reserved for arbitrary data
stored by the user.

The two sections have a defined range. The first 3 kB for the type label
and the remaining 1 kB for user data. The type label is written during
production and can fill up the whole 3 kB. Thus, the range is fixed and
cannot be changed dynamically.

The two sections cannot be presented as NVMEM cells. A NVMEM cell is
always read and written at once, because the data presented to the user
can differ from the data stored in the physical NVMEM cell. Thus, NVMEM
cells would lead to reading 3 kB for every type label access, even if
only the device name is read. So performance would suffer. But it is
also an indication that NVMEM cells are designed for small data cells
within NVMEM devices.

Register separate NVMEM devices for every section. This enables safe
access to every section. Also different access rights are then possible.

Signed-off-by: Gerhard Engleder <eg@keba.com>
Link: https://lore.kernel.org/r/20241011191257.19702-6-gerhard@engleder-embedded.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-13 17:16:57 +02:00
Gerhard Engleder
366898e7a1 misc: keba: Add LAN9252 driver
KEBA CP500 devices use the LAN9252 controller for EtherCAT
communication. For a stable Ethernet link the PHY registers of the
controller need to be configured correctly. This driver configures these
PHY registers as required.

Signed-off-by: Gerhard Engleder <eg@keba.com>
Link: https://lore.kernel.org/r/20241011191257.19702-5-gerhard@engleder-embedded.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-13 17:16:57 +02:00
Gerhard Engleder
7948483001 misc: keba: Add SPI controller device
Add support for the SPI controller auxiliary device. This enables access
to the SPI flash of the FPGA and some other SPI devices.

The actual list of SPI devices is detected by reading some bits out of
the previously registered I2C EEPROM.

Signed-off-by: Gerhard Engleder <eg@keba.com>
Link: https://lore.kernel.org/r/20241011191257.19702-4-gerhard@engleder-embedded.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-13 17:16:57 +02:00
Gerhard Engleder
14afb74969 misc: keba: Use capital letters for I2C error message
Print "I2C" instead of "i2c" in error message as "I2C" is the official
name for the bus.

Signed-off-by: Gerhard Engleder <eg@keba.com>
Link: https://lore.kernel.org/r/20241011191257.19702-3-gerhard@engleder-embedded.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-13 17:16:57 +02:00
Gerhard Engleder
d9996de40b misc: keba: Use variable ret for return values
One function of the cp500 driver uses the variable name retval for
return values but all others use the variable name ret. Use ret for
return values in all functions.

Signed-off-by: Gerhard Engleder <eg@keba.com>
Link: https://lore.kernel.org/r/20241011191257.19702-2-gerhard@engleder-embedded.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-13 17:16:57 +02:00
Gerhard Engleder
7d32e779eb misc: keba: Fix sysfs group creation
sysfs_create_group() races with userspace. Use dev_groups instead which
prevents all the problems of sysfs_create_group().

Fixes: a194467676 ("misc: keba: Add basic KEBA CP500 system FPGA support")
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Gerhard Engleder <eg@keba.com>
Link: https://lore.kernel.org/r/20240819192645.50171-1-gerhard@engleder-embedded.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-03 12:37:29 +02:00
Gerhard Engleder
e56af94b9b misc: keba: Fix missing AUXILIARY_BUS dependency
The cp500 driver creates auxiliary devices. Kernel configs without
CONFIG_AUXILIARY_BUS lead to warnings like this:

cp500.c: undefined reference to `auxiliary_device_init'
cp500.c: undefined reference to `__auxiliary_device_add'

Add missing dependency to AUXILIARY_BUS to KEBA_CP500 Kconfig.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202407081327.2DR4Ltu9-lkp@intel.com/
Fixes: a194467676 ("misc: keba: Add basic KEBA CP500 system FPGA support")
Signed-off-by: Gerhard Engleder <eg@keba.com>
Link: https://lore.kernel.org/r/20240708180049.12713-1-gerhard@engleder-embedded.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-09 18:54:38 +02:00
Gerhard Engleder
a194467676 misc: keba: Add basic KEBA CP500 system FPGA support
The KEBA CP500 system FPGA is a PCIe device, which consists of multiple
IP cores. Every IP core has its own auxiliary driver. The cp500 driver
registers an auxiliary device for each device and the corresponding
drivers are loaded by the Linux driver infrastructure.

Currently 3 variants of this device exists. Every variant has its own
PCI device ID, which is used to determine the list of available IP
cores. In this first version only the auxiliary device for the I2C
controller is registered.

Besides the auxiliary device registration some other basic functions of
the FPGA are implemented; e.g, FPGA version sysfs file, keep FPGA
configuration on reset sysfs file, error message for errors on the
internal AXI bus of the FPGA.

Signed-off-by: Gerhard Engleder <eg@keba.com>
Link: https://lore.kernel.org/r/20240630194740.7137-2-gerhard@engleder-embedded.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-04 12:29:07 +02:00