Commit graph

9 commits

Author SHA1 Message Date
Sergey Shtylyov
0d3bf53e89 i2c: mlxbf: add IRQ check
The driver neglects to check the result of platform_get_irq()'s call and
blithely passes the negative error codes to devm_request_irq() (which
takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding
an original error code.  Stop calling devm_request_irq() with invalid
IRQ #s.

Fixes: b5b5b32081 ("i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
2021-04-14 10:20:45 +02:00
Andy Shevchenko
fd6ddaa0f5 i2c: drivers: Use generic definitions for bus frequencies (part 2)
Since we have generic definitions for bus frequencies, let's use them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Khalil Blaiech <kblaiech@nvidia.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
2021-04-05 23:00:58 +02:00
Wang Xiaojun
2bf9545626 i2c: mlxbf: Fix the return check of devm_ioremap and ioremap
devm_ioremap and ioremap may return NULL which cannot be checked
by IS_ERR.

Signed-off-by: Wang Xiaojun <wangxiaojun11@huawei.com>
Reported-by: Hulk Robot <hulkci@huawei.com>
Acked-by: Khalil Blaiech <kblaiech@nvidia.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
2020-12-05 14:52:35 +01:00
Khalil Blaiech
54b9c3d0ce i2c: mlxbf: Update author and maintainer email info
Correct the email addresses of the author and the maintainer
of the Mellanox BlueField I2C driver.

Fixes: b5b5b32081 ("i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC")
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Khalil Blaiech <kblaiech@nvidia.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
2020-11-06 15:52:19 +01:00
Khalil Blaiech
67ee9fda6e i2c: mlxbf: Update reference clock frequency
The reference clock frequency remains the same across Bluefield
products. Thus, update the frequency and rename the macro.

Fixes: b5b5b32081 ("i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC")
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Khalil Blaiech <kblaiech@nvidia.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
2020-11-06 15:52:11 +01:00
Khalil Blaiech
4b19d806ac i2c: mlxbf: Remove unecessary wrapper functions
Few wrapper functions are useless and can be inlined. So
delete mlxbf_i2c_read() and mlxbf_i2c_write() and replace
them with readl() and writel(), respectively. Also delete
mlxbf_i2c_read_data() and mlxbf_i2c_write() and replace
them with ioread32be() and iowrite32be(), respectively.

Fixes: b5b5b32081 ("i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC")
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Reviewed-by: Vadim Pasternak <vadimp@nvidia.com>
Signed-off-by: Khalil Blaiech <kblaiech@nvidia.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
2020-11-06 15:51:57 +01:00
Khalil Blaiech
08e019e27a i2c: mlxbf: Fix resrticted cast warning of sparse
Address warnings "warning: cast to restricted __be32" reported
by sparse.

Fixes: b5b5b32081 ("i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC")
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Reviewed-by: Vadim Pasternak <vadimp@nvidia.com>
Signed-off-by: Khalil Blaiech <kblaiech@nvidia.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
2020-11-06 15:51:47 +01:00
Khalil Blaiech
ed01ddc618 i2c: mlxbf: Add CONFIG_ACPI to guard ACPI function call
The build fails with "implicit declaration of function
'acpi_device_uid'" error. Thus, protect ACPI function calls
from being called when CONFIG_ACPI is disabled.

Fixes: b5b5b32081 ("i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC")
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Reviewed-by: Vadim Pasternak <vadimp@nvidia.com>
Signed-off-by: Khalil Blaiech <kblaiech@nvidia.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
2020-11-06 15:51:40 +01:00
Khalil Blaiech
b5b5b32081 i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC
Add BlueField I2C driver to offer master and slave support for
Mellanox BlueField SoCs. The driver implements an SMBus adapter
and interfaces to multiple busses that can be probed using both
ACPI and Device Tree infrastructures.

The driver supports several SMBus operations to transfer data
back and forth from/to various I2C devices. It is mainly intended
to be consumed by userspace tools and utilities, such as i2c-tools
and decode-dimms to collect memory module information.

On the other hand, the driver has a slave function to support,
among others, an IPMB interface that requires both master and
slave functions to handle transfers between the BlueField SoC
and a board management controllers (e.g., BMC).

Signed-off-by: Khalil Blaiech <kblaiech@mellanox.com>
Reviewed-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
2020-09-27 19:58:38 +02:00