: tcan4x5x: rework regmap support
Subsystems (2)
Marc Kleine-Budde
maintainerHello,
this series first cleans up the the SPI regmap and then fixes several problem:
- tcan4x5x_regmap_gather_write(), tcan4x5x_regmap_read():
Do not place variable "addr" on stack and use it as buffer for SPI transfer. Buffers for SPI transfers must be allocated from DMA save memory.
- tcan4x5x_regmap_gather_write(), tcan4x5x_regmap_read():
Halfe number of SPI transfers by using a single buffer + memcpy(). This improves the performance, especially on SPI controllers, which use interrupt based transfers.
- Use "8" bits per word, not "32". This makes it possible to use this driver on SoCs like the Raspberry Pi, which SPI host controller drivers only support 8 bits per word.
With this series, the driver is able to detect a tcan4x5x on a Raspberry Pi.
regards,
Marc
Marc Kleine-Budde
maintainerPATCH 1/16 can: tcan4x5x: replace DEVICE_NAME by KBUILD_MODNAME
This patch replaces the DEVICE_NAME macro by KBUILD_MODNAME and removed the superfluous DEVICE_NAME.
--- drivers/net/can/m_can/tcan4x5x.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/can/m_can/tcan4x5x.c +3 -4
@@ -10,7 +10,6 @@#include "m_can.h" -#define DEVICE_NAME "tcan4x5x"#define TCAN4X5X_EXT_CLK_DEF 40000000#define TCAN4X5X_DEV_ID0 0x00
@@ -132,7 +131,7 @@ static inline struct tcan4x5x_priv *cdev_to_priv(struct m_can_classdev *cdev) }static struct can_bittiming_const tcan4x5x_bittiming_const = { - .name =DEVICE_NAME , + .name =KBUILD_MODNAME , .tseg1_min =2 , .tseg1_max =31 , .tseg2_min =2 ,
@@ -144,7 +143,7 @@ static struct can_bittiming_const tcan4x5x_bittiming_const = { };static struct can_bittiming_const tcan4x5x_data_bittiming_const = { - .name =DEVICE_NAME , + .name =KBUILD_MODNAME , .tseg1_min =1 , .tseg1_max =32 , .tseg2_min =1 ,
@@ -544,7 +543,7 @@ MODULE_DEVICE_TABLE(spi, tcan4x5x_id_table);static struct spi_driver tcan4x5x_can_driver = { .driver = { - .name =DEVICE_NAME , + .name =KBUILD_MODNAME , .of_match_table = tcan4x5x_of_match, .pm =NULL , },
base-commit: efd5a1584537698220578227e6467638307c2a0b
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 2/16 can: tcan4x5x: beautify indention of tcan4x5x_of_match and tcan4x5x_id_table
In reply to Marc Kleine-BuddeThis patch beautifies the indention of the tcan4x5x_of_match and tcan4x5x_id_table.
--- drivers/net/can/m_can/tcan4x5x.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/net/can/m_can/tcan4x5x.c +8 -5
@@ -527,17 +527,20 @@ static int tcan4x5x_can_remove(struct spi_device *spi) }static const struct of_device_id tcan4x5x_of_match[] = { - { .compatible ="ti,tcan4x5x" , }, - { } + { + .compatible ="ti,tcan4x5x" , + }, { +/* sentinel */ + }, };MODULE_DEVICE_TABLE (of, tcan4x5x_of_match);static const struct spi_device_id tcan4x5x_id_table[] = { { - .name ="tcan4x5x" , - .driver_data =0 , + .name ="tcan4x5x" , + }, { +/* sentinel */ }, - { } };MODULE_DEVICE_TABLE (spi, tcan4x5x_id_table);
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 3/16 can: tcan4x5x: rename tcan4x5x.c -> tcan4x5x-core.c
In reply to Marc Kleine-BuddeThis is a preparation patch to move the regmap related code into a seperate file. This patch removes the tcan4x5x.c to tcan4x5x-core.c.
---
drivers/net/can/m_can/Makefile | 3 +++
drivers/net/can/m_can/{tcan4x5x.c => tcan4x5x-core.c} | 0
2 files changed, 3 insertions(+)
rename drivers/net/can/m_can/{tcan4x5x.c => tcan4x5x-core.c} (100%)drivers/net/can/m_can/Makefile +3 -0
@@ -7,3 +7,6 @@ obj-$(CONFIG_CAN_M_CAN) += m_can.o obj-$(CONFIG_CAN_M_CAN_PCI) += m_can_pci.o obj-$(CONFIG_CAN_M_CAN_PLATFORM) += m_can_platform.o obj-$(CONFIG_CAN_M_CAN_TCAN4X5X) += tcan4x5x.o + +tcan4x5x-objs := +tcan4x5x-objs += tcan4x5x-core.o
drivers/net/can/m_can/tcan4x5x-core.c renamed from drivers/net/can/m_can/tcan4x5x.c +0 -0
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 4/16 can: tcan4x5x: move regmap code into seperate file
In reply to Marc Kleine-BuddeThis patch moves the regmap code into a seperate file.
--- drivers/net/can/m_can/Makefile | 1 + drivers/net/can/m_can/tcan4x5x-core.c | 104 +----------------------- drivers/net/can/m_can/tcan4x5x-regmap.c | 95 ++++++++++++++++++++++ drivers/net/can/m_can/tcan4x5x.h | 34 ++++++++ 4 files changed, 133 insertions(+), 101 deletions(-) create mode 100644 drivers/net/can/m_can/tcan4x5x-regmap.c create mode 100644 drivers/net/can/m_can/tcan4x5x.h
drivers/net/can/m_can/Makefile +1 -0
@@ -10,3 +10,4 @@ obj-$(CONFIG_CAN_M_CAN_TCAN4X5X) += tcan4x5x.o tcan4x5x-objs := tcan4x5x-objs += tcan4x5x-core.o +tcan4x5x-objs += tcan4x5x-regmap.o
drivers/net/can/m_can/tcan4x5x-core.c +3 -101
145 lines not on this page · raw message
drivers/net/can/m_can/tcan4x5x-regmap.c new file +95 -0
95 lines not on this page · raw message
drivers/net/can/m_can/tcan4x5x.h new file +34 -0
@@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0 +* +* tcan4x5x - Texas Instruments TCAN4x5x Family CAN controller driver +* +* Copyright (c) 2020 Pengutronix, +* Marc Kleine-Budde <[email protected]> +*/ + +#ifndef _TCAN4X5X_H +#define _TCAN4X5X_H + +#include <linux/gpio/consumer.h> +#include <linux/regmap.h> +#include <linux/regmap.h> +#include <linux/regulator/consumer.h> +#include <linux/spi/spi.h> + +#include "m_can.h" + +struct tcan4x5x_priv { +struct m_can_classdev cdev; + +struct regmap *regmap; +struct spi_device *spi; + +struct gpio_desc *reset_gpio; +struct gpio_desc *device_wake_gpio; +struct gpio_desc *device_state_gpio; +struct regulator *power; +}; + +int tcan4x5x_regmap_init (struct tcan4x5x_priv *priv); + +#endif
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 5/16 can: tcan4x5x: mark struct regmap_bus tcan4x5x_bus as constant
In reply to Marc Kleine-BuddeThis patch marks the struct regmap_bus tcan4x5x_bus as constant.
--- drivers/net/can/m_can/tcan4x5x-regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/m_can/tcan4x5x-regmap.c +1 -1
@@ -76,7 +76,7 @@ static const struct regmap_config tcan4x5x_regmap = { .max_register = TCAN4X5X_MAX_REGISTER, }; -static struct regmap_bus tcan4x5x_bus = { +static const struct regmap_bus tcan4x5x_bus = { .write = tcan4x5x_regmap_write, .gather_write = regmap_spi_gather_write, .async_write = regmap_spi_async_write,
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 6/16 can: tcan4x5x: tcan4x5x_bus: remove not needed read_flag_mask
In reply to Marc Kleine-BuddeWith C99 initializers, all non mentioned members are initialzied to 0, so remove not needed initialization of read_flag_mask.
--- drivers/net/can/m_can/tcan4x5x-regmap.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/can/m_can/tcan4x5x-regmap.c +0 -1
@@ -82,7 +82,6 @@ static const struct regmap_bus tcan4x5x_bus = { .async_write = regmap_spi_async_write, .async_alloc = regmap_spi_async_alloc, .read = tcan4x5x_regmap_read, - .read_flag_mask = 0x00, .reg_format_endian_default = REGMAP_ENDIAN_NATIVE, .val_format_endian_default = REGMAP_ENDIAN_NATIVE, };
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 7/16 can: tcan4x5x: remove regmap async support
In reply to Marc Kleine-BuddeThe driver doesn't use regmap async support, so remove the stubs.
--- drivers/net/can/m_can/tcan4x5x-regmap.c | 15 --------------- 1 file changed, 15 deletions(-)
drivers/net/can/m_can/tcan4x5x-regmap.c +0 -15
@@ -44,19 +44,6 @@ static int tcan4x5x_regmap_write(void *context, const void *data, size_t count)return regmap_spi_gather_write (context, reg,4 , val, count -4 ); } -static int regmap_spi_async_write (void *context, -const void *reg,size_t reg_len, -const void *val,size_t val_len, -struct regmap_async *a) -{ -return -ENOTSUPP ; -} - -static struct regmap_async *regmap_spi_async_alloc (void ) -{ -return NULL ; -} -static int tcan4x5x_regmap_read (void *context,const void *reg,size_t reg_size,void *val,size_t val_size)
@@ -79,8 +66,6 @@ static const struct regmap_config tcan4x5x_regmap = {static const struct regmap_bus tcan4x5x_bus = { .write = tcan4x5x_regmap_write, .gather_write = regmap_spi_gather_write, - .async_write = regmap_spi_async_write, - .async_alloc = regmap_spi_async_alloc, .read = tcan4x5x_regmap_read, .reg_format_endian_default =REGMAP_ENDIAN_NATIVE , .val_format_endian_default =REGMAP_ENDIAN_NATIVE ,
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 8/16 can: tcan4x5x: rename regmap_spi_gather_write() -> tcan4x5x_regmap_gather_write()
In reply to Marc Kleine-BuddeThis patch renames the regmap_spi_gather_write() function to tcan4x5x_regmap_gather_write(). Now it has a "tcan4x5x_" prefix as all other functions in this driver.
--- drivers/net/can/m_can/tcan4x5x-regmap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/can/m_can/tcan4x5x-regmap.c +5 -5
@@ -14,9 +14,9 @@#define TCAN4X5X_MAX_REGISTER 0x8fff -static int regmap_spi_gather_write (void *context,const void *reg, -size_t reg_len,const void *val, -size_t val_len) +static int tcan4x5x_regmap_gather_write (void *context,const void *reg, +size_t reg_len,const void *val, +size_t val_len) {struct device *dev = context;struct spi_device *spi =to_spi_device (dev);
@@ -41,7 +41,7 @@ static int tcan4x5x_regmap_write(void *context, const void *data, size_t count)u16 *reg = (u16 *)(data);const u32 *val = data +4 ; -return regmap_spi_gather_write (context, reg,4 , val, count -4 ); +return tcan4x5x_regmap_gather_write (context, reg,4 , val, count -4 ); } static int tcan4x5x_regmap_read(void *context,
@@ -65,7 +65,7 @@ static const struct regmap_config tcan4x5x_regmap = {static const struct regmap_bus tcan4x5x_bus = { .write = tcan4x5x_regmap_write, - .gather_write = regmap_spi_gather_write, + .gather_write = tcan4x5x_regmap_gather_write, .read = tcan4x5x_regmap_read, .reg_format_endian_default =REGMAP_ENDIAN_NATIVE , .val_format_endian_default =REGMAP_ENDIAN_NATIVE ,
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 9/16 can: tcan4x5x: tcan4x5x_regmap_write(): remove not needed casts and replace 4 by sizeof
In reply to Marc Kleine-BuddeThis patch simplifies the tcan4x5x_regmap_write(0 function by removing not needed casts and replaces hardcoded "4" by appropriate sizeof()s.
--- drivers/net/can/m_can/tcan4x5x-regmap.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/can/m_can/tcan4x5x-regmap.c +3 -4
@@ -38,10 +38,9 @@ static int tcan4x5x_regmap_gather_write(void *context, const void *reg,static int tcan4x5x_regmap_write (void *context,const void *data,size_t count) { -u16 *reg = (u16 *)(data); -const u32 *val = data +4 ; - -return tcan4x5x_regmap_gather_write (context, reg,4 , val, count -4 ); +return tcan4x5x_regmap_gather_write (context, data,sizeof (u32), + data +sizeof (u32), + count -sizeof (u32)); } static int tcan4x5x_regmap_read(void *context,
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 10/16 can: tcan4x5x: tcan4x5x_regmap_init(): use spi as context pointer
In reply to Marc Kleine-BuddeThis patch replaces the context pointer of the regmap callback functions by a pointer to the spi_device. This saves one level of indirection in the callbacks.
--- drivers/net/can/m_can/tcan4x5x-regmap.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/can/m_can/tcan4x5x-regmap.c +3 -5
@@ -18,8 +18,7 @@ static int tcan4x5x_regmap_gather_write(void *context, const void *reg, size_t reg_len, const void *val, size_t val_len) { - struct device *dev = context; -struct spi_device *spi =to_spi_device (dev); + struct spi_device *spi = context;struct spi_message m;u32 addr; struct spi_transfer t[2] = {
@@ -47,8 +46,7 @@ static int tcan4x5x_regmap_read(void *context, const void *reg, size_t reg_size, void *val, size_t val_size) { - struct device *dev = context; -struct spi_device *spi =to_spi_device (dev); + struct spi_device *spi = context;u32 addr =TCAN4X5X_READ_CMD | (*((u16 *)reg) <<8 ) | val_size >>2 ;
@@ -73,6 +71,6 @@ static const struct regmap_bus tcan4x5x_bus = {int tcan4x5x_regmap_init (struct tcan4x5x_priv *priv) { priv->regmap =devm_regmap_init (&priv->spi->dev, &tcan4x5x_bus, - &priv->spi->dev, &tcan4x5x_regmap); + priv->spi, &tcan4x5x_regmap);return PTR_ERR_OR_ZERO (priv->regmap); }
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 11/16 can: tcan4x5x: fix max register value
In reply to Marc Kleine-BuddeThis patch fixes the max register value for the regmap.
--- drivers/net/can/m_can/tcan4x5x-regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/m_can/tcan4x5x-regmap.c +1 -1
@@ -12,7 +12,7 @@#define TCAN4X5X_WRITE_CMD (0x61 << 24)#define TCAN4X5X_READ_CMD (0x41 << 24) -#define TCAN4X5X_MAX_REGISTER 0x8fff +#define TCAN4X5X_MAX_REGISTER 0x8ffc static int tcan4x5x_regmap_gather_write(void *context, const void *reg, size_t reg_len, const void *val,
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 12/16 can: tcan4x5x: tcan4x5x_regmap: set reg_stride to 4
In reply to Marc Kleine-BuddeThis patch sets the regmap stide to 4, as the chip only supports access on 32 bit alligned access.
--- drivers/net/can/m_can/tcan4x5x-regmap.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/can/m_can/tcan4x5x-regmap.c +1 -0
@@ -55,6 +55,7 @@ static int tcan4x5x_regmap_read(void *context,static const struct regmap_config tcan4x5x_regmap = { .reg_bits =32 , + .reg_stride =4 , .val_bits =32 , .cache_type =REGCACHE_NONE , .max_register =TCAN4X5X_MAX_REGISTER ,
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 13/16 can: tcan4x5x: add max_raw_{read,write} of 256
In reply to Marc Kleine-BuddeThe tcan4x5x chip support bulk read/write, but as the length field is only 8 bits wide, the maximum is 256. A length of 0 is treated as 256.
--- drivers/net/can/m_can/tcan4x5x-regmap.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/can/m_can/tcan4x5x-regmap.c +2 -0
@@ -67,6 +67,8 @@ static const struct regmap_bus tcan4x5x_bus = { .read = tcan4x5x_regmap_read, .reg_format_endian_default = REGMAP_ENDIAN_NATIVE, .val_format_endian_default = REGMAP_ENDIAN_NATIVE, + .max_raw_read = 256, + .max_raw_write = 256, };int tcan4x5x_regmap_init (struct tcan4x5x_priv *priv)
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 14/16 can: tcan4x5x: add {wr,rd}_table
In reply to Marc Kleine-BuddeThe memory space of the chip is not fully populated, so add a regmap range table to document this.
--- drivers/net/can/m_can/tcan4x5x-regmap.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/net/can/m_can/tcan4x5x-regmap.c +14 -0
@@ -53,10 +53,24 @@ static int tcan4x5x_regmap_read(void *context,return spi_write_then_read (spi, &addr, reg_size, (u32 *)val, val_size); } +static const struct regmap_range tcan4x5x_reg_table_yes_range[] = { +regmap_reg_range (0x0000 ,0x002c ),/* Device ID and SPI Registers */ +regmap_reg_range (0x0800 ,0x083c ),/* Device configuration registers and Interrupt Flags*/ +regmap_reg_range (0x1000 ,0x10fc ),/* M_CAN */ +regmap_reg_range (0x8000 ,0x87fc ),/* MRAM */ +}; + +static const struct regmap_access_table tcan4x5x_reg_table = { + .yes_ranges = tcan4x5x_reg_table_yes_range, + .n_yes_ranges =ARRAY_SIZE (tcan4x5x_reg_table_yes_range), +}; +static const struct regmap_config tcan4x5x_regmap = { .reg_bits =32 , .reg_stride =4 , .val_bits =32 , + .wr_table = &tcan4x5x_reg_table, + .rd_table = &tcan4x5x_reg_table, .cache_type =REGCACHE_NONE , .max_register =TCAN4X5X_MAX_REGISTER , };
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 15/16 can: tcan4x5x: rework SPI access
In reply to Marc Kleine-BuddeThis patch reworks the SPI access and fixes several probems:
- tcan4x5x_regmap_gather_write(), tcan4x5x_regmap_read():
Do not place variable "addr" on stack and use it as buffer for SPI transfer. Buffers for SPI transfers must be allocated from DMA save memory.
- tcan4x5x_regmap_gather_write(), tcan4x5x_regmap_read():
Halfe number of SPI transfers by using a single buffer + memcpy(). This improves the performance, especially on SPI controllers, which use interrupt based transfers.
- Use "8" bits per word, not "32". This makes it possible to use this driver on SoCs like the Raspberry Pi, which SPI host controller drivers only support 8 bits per word.
Note: this breaks half duplex only controllers. Support for them will be re-added in the next patch.
--- drivers/net/can/m_can/tcan4x5x-core.c | 2 +- drivers/net/can/m_can/tcan4x5x-regmap.c | 87 +++++++++++++++++-------- drivers/net/can/m_can/tcan4x5x.h | 23 +++++++ 3 files changed, 84 insertions(+), 28 deletions(-)
drivers/net/can/m_can/tcan4x5x-core.c +1 -1
@@ -380,7 +380,7 @@ static int tcan4x5x_can_probe(struct spi_device *spi)spi_set_drvdata (spi, priv);/* Configure the SPI bus */ - spi->bits_per_word =32 ; + spi->bits_per_word =8 ; ret =spi_setup (spi);if (ret) goto out_m_can_class_free_dev;
drivers/net/can/m_can/tcan4x5x-regmap.c +60 -27
129 lines not on this page · raw message
drivers/net/can/m_can/tcan4x5x.h +23 -0
@@ -17,6 +17,19 @@#include "m_can.h" +#define TCAN4X5X_SANITIZE_SPI 1 + +struct __packed tcan4x5x_buf_cmd { +u8 cmd; +__be16 addr; +u8 len; +}; + +struct __packed tcan4x5x_map_buf { +struct tcan4x5x_buf_cmd cmd; +u8 data[256 *sizeof (u32)]; +}____cacheline_aligned ; +struct tcan4x5x_priv {struct m_can_classdev cdev;
@@ -27,8 +40,18 @@ struct tcan4x5x_priv {struct gpio_desc *device_wake_gpio;struct gpio_desc *device_state_gpio;struct regulator *power; + +struct tcan4x5x_map_buf map_buf_rx; + struct tcan4x5x_map_buf map_buf_tx; }; +static inline void +tcan4x5x_spi_cmd_set_len (struct tcan4x5x_buf_cmd *cmd,u8 len) +{ +/* number of u32 */ + cmd->len = len >>2 ; +} +int tcan4x5x_regmap_init (struct tcan4x5x_priv *priv);#endif
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 16/16 can: tcan4x5x: add support for half-duplex controllers
In reply to Marc Kleine-BuddeThis patch adds back support for half-duplex controllers, which was removed in the last patch.
--- drivers/net/can/m_can/tcan4x5x-regmap.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/net/can/m_can/tcan4x5x-regmap.c +15 -6
@@ -51,7 +51,7 @@ static int tcan4x5x_regmap_read(void *context,struct tcan4x5x_priv *priv =spi_get_drvdata (spi);struct tcan4x5x_map_buf *buf_rx = &priv->map_buf_rx;struct tcan4x5x_map_buf *buf_tx = &priv->map_buf_tx; -struct spi_transfer xfer[] = { +struct spi_transfer xfer[2 ] = { { .tx_buf = buf_tx, }
@@ -66,17 +66,26 @@ static int tcan4x5x_regmap_read(void *context, sizeof(buf_tx->cmd.addr));tcan4x5x_spi_cmd_set_len (&buf_tx->cmd, val_len); - xfer[0 ].rx_buf = buf_rx; - xfer[0 ].len =sizeof (buf_tx->cmd) + val_len; +if (spi->controller->flags &SPI_CONTROLLER_HALF_DUPLEX ) { + xfer[0 ].len =sizeof (buf_tx->cmd); + + xfer[1 ].rx_buf = val_buf; + xfer[1 ].len = val_len; +spi_message_add_tail (&xfer[1 ], &msg); + }else { + xfer[0 ].rx_buf = buf_rx; + xfer[0 ].len =sizeof (buf_tx->cmd) + val_len; -if (TCAN4X5X_SANITIZE_SPI ) -memset (buf_tx->data,0x0 , val_len); +if (TCAN4X5X_SANITIZE_SPI ) +memset (buf_tx->data,0x0 , val_len); + } err =spi_sync (spi, &msg);if (err)return err; -memcpy (val_buf, buf_rx->data, val_len); +if (!(spi->controller->flags &SPI_CONTROLLER_HALF_DUPLEX )) +memcpy (val_buf, buf_rx->data, val_len);return 0 ; }
Signature · 1 line
2.29.2
Dan Murphy
Reviewed-byMarc
Quoted 15 lines · Marc Kleine-Budde
Hello,
this series first cleans up the the SPI regmap and then fixes several problem:
-tcan4x5x_regmap_gather_write(),tcan4x5x_regmap_read():
Do not place variable "addr" on stack and use it as buffer for SPI transfer. Buffers for SPI transfers must be allocated from DMA save memory.
-tcan4x5x_regmap_gather_write(),tcan4x5x_regmap_read():
Halfe number of SPI transfers by using a single buffer +memcpy(). This improves the performance, especially on SPI controllers, which use interrupt based transfers.
- Use "8" bits per word, not "32". This makes it possible to use this driver on SoCs like the Raspberry Pi, which SPI host controller drivers only support 8 bits per word.
Quoted 5 lines
With this series, the driver is able to detect a tcan4x5x on a Raspberry Pi.
regards,
Marc
Thanks for the clean up.
Dan
Quoted 1 line
Sean Nyekjaer
Tested-byQuoted 15 lines · Marc Kleine-Budde
Hello,
this series first cleans up the the SPI regmap and then fixes several problem:
-tcan4x5x_regmap_gather_write(),tcan4x5x_regmap_read():
Do not place variable "addr" on stack and use it as buffer for SPI transfer. Buffers for SPI transfers must be allocated from DMA save memory.
-tcan4x5x_regmap_gather_write(),tcan4x5x_regmap_read():
Halfe number of SPI transfers by using a single buffer +memcpy(). This improves the performance, especially on SPI controllers, which use interrupt based transfers.
- Use "8" bits per word, not "32". This makes it possible to use this driver on SoCs like the Raspberry Pi, which SPI host controller drivers only support 8 bits per word.
Quoted 5 lines
With this series, the driver is able to detect a tcan4x5x on a Raspberry Pi.
regards,
Marc
For this series...
/Sean