pull-request: can-next 2020-11-30
Subsystems (5)
Marc Kleine-Budde
maintainerHello Jakub, hello David,
here's a pull request of 14 patches for net-next/master.
Gustavo A. R. Silva's patch for the pcan_usb driver fixes fall-through warnings for Clang.
The next 5 patches target the mcp251xfd driver and are by Ursula Maplehurst and me. They optimizie the TEF and RX path by reducing number of SPI core requests to set the UINC bit.
The remaining 8 patches target the m_can driver. The first 4 are various cleanups for the SPI binding driver (tcan4x5x) by Sean Nyekjaer, Dan Murphy and me. Followed by 4 cleanup patches by me for the m_can and m_can_platform driver.
regards,
Marc
---
The following changes since commit e71d2b957ee49fe3ed35a384a4e31774de1316c1:
Merge branch 'net-ipa-start-adding-ipa-v4-5-support' (2020-11-28 12:14:02 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git tags/linux-can-next-for-5.11-20201130
for you to fetch changes up to 6d9986b46fc12f4a36fc243698deb774323b76f3:
can: m_can: m_can_class_unregister(): move right after m_can_class_register() (2020-11-30 14:55:41 +0100)
----------------------------------------------------------------
linux-can-next-for-5.11-20201130
----------------------------------------------------------------
Dan Murphy (1):
can: tcan4x5x: rename parse_config() function
Gustavo A. R. Silva (1):
can: pcan_usb_core: fix fall-through warnings for Clang
Marc Kleine-Budde (10):
can: mcp251xfd: mcp25xxfd_ring_alloc(): add define instead open coding the maximum number of RX objects
can: mcp251xfd: struct mcp251xfd_priv::tef to array of length 1
can: mcp251xfd: move struct mcp251xfd_tef_ring definition
can: mcp251xfd: tef-path: reduce number of SPI core requests to set UINC bit
can: tcan4x5x: remove mram_start and reg_offset from struct tcan4x5x_priv
can: tcan4x5x: tcan4x5x_can_probe(): remove probe failed error message
can: m_can: Kconfig: convert the into menu
can: m_can: remove not used variable struct m_can_classdev::freq
can: m_can: m_can_plat_remove(): remove unneeded platform_set_drvdata()
can: m_can: m_can_class_unregister(): move right after m_can_class_register()
Sean Nyekjaer (1):
can: tcan4x5x: tcan4x5x_clear_interrupts(): remove redundant return statement
Ursula Maplehurst (1):
can: mcp25xxfd: rx-path: reduce number of SPI core requests to set UINC bit
drivers/net/can/m_can/Kconfig | 8 +- drivers/net/can/m_can/m_can.c | 16 +-- drivers/net/can/m_can/m_can.h | 1 - drivers/net/can/m_can/m_can_platform.c | 2 - drivers/net/can/m_can/tcan4x5x.c | 28 ++--- drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 136 +++++++++++++++++++------ drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 30 +++--- drivers/net/can/usb/peak_usb/pcan_usb_core.c | 9 +- 8 files changed, 151 insertions(+), 79 deletions(-)
Marc Kleine-Budde
maintainerPATCH 1/14 can: pcan_usb_core: fix fall-through warnings for Clang
From: "Gustavo A. R. Silva" <[email protected]>
In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning by moving the "default" to the end of the "switch" statement and explicitly adding a break statement instead of letting the code fall through to the next case.
--- drivers/net/can/usb/peak_usb/pcan_usb_core.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/can/usb/peak_usb/pcan_usb_core.c +5 -4
@@ -295,15 +295,16 @@ static void peak_usb_write_bulk_callback(struct urb *urb)netif_trans_update (netdev);break ; -default : -if (net_ratelimit ()) -netdev_err (netdev,"Tx urb aborted (%d)\n" , - urb->status);case -EPROTO :case -ENOENT :case -ECONNRESET :case -ESHUTDOWN : +break ; +default : +if (net_ratelimit ()) +netdev_err (netdev,"Tx urb aborted (%d)\n" , + urb->status);break ; }
base-commit: e71d2b957ee49fe3ed35a384a4e31774de1316c1
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 2/14 can: mcp251xfd: mcp25xxfd_ring_alloc(): add define instead open coding the maximum number of RX objects
In reply to Marc Kleine-BuddeThis patch add a define for the maximum number of RX objects instead of open coding it.
--- drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 3 ++- drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +2 -1
@@ -416,7 +416,8 @@ static int mcp251xfd_ring_alloc(struct mcp251xfd_priv *priv)int rx_obj_num; rx_obj_num = ram_free / rx_obj_size; - rx_obj_num =min (1 << (fls (rx_obj_num) -1 ),32 ); + rx_obj_num =min (1 << (fls (rx_obj_num) -1 ), +MCP251XFD_RX_OBJ_NUM_MAX ); rx_ring =kzalloc (sizeof (*rx_ring) + rx_obj_size * rx_obj_num,GFP_KERNEL );
drivers/net/can/spi/mcp251xfd/mcp251xfd.h +1 -0
@@ -368,6 +368,7 @@* FIFO setup: tef: 8*12 bytes = 96 bytes, tx: 8*16 bytes = 128 bytes * FIFO setup: tef: 4*12 bytes = 48 bytes, tx: 4*72 bytes = 288 bytes */ +#define MCP251XFD_RX_OBJ_NUM_MAX 32#define MCP251XFD_TX_OBJ_NUM_CAN 8#define MCP251XFD_TX_OBJ_NUM_CANFD 4
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 3/14 can: mcp25xxfd: rx-path: reduce number of SPI core requests to set UINC bit
In reply to Marc Kleine-BuddeFrom: Ursula Maplehurst <[email protected]>
Reduce the number of separate SPI core requests when setting the UINC bit in the RX FIFO, and instead batch them up into a single SPI core request.
--- .../net/can/spi/mcp251xfd/mcp251xfd-core.c | 51 ++++++++++++++++--- drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 2 + 2 files changed, 45 insertions(+), 8 deletions(-)
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +43 -8
@@ -332,7 +332,7 @@ static void mcp251xfd_ring_init(struct mcp251xfd_priv *priv)u32 val;u16 addr;u8 len; -int i; +int i, j;/* TEF */ priv->tef.head =0 ;
@@ -370,6 +370,23 @@ static void mcp251xfd_ring_init(struct mcp251xfd_priv *priv) prev_rx_ring->obj_num; prev_rx_ring = rx_ring; + +/* FIFO increment RX tail pointer */ + addr =MCP251XFD_REG_FIFOCON (rx_ring->fifo_nr); + val =MCP251XFD_REG_FIFOCON_UINC ; + len =mcp251xfd_cmd_prepare_write_reg (priv, &rx_ring->uinc_buf, + addr, val, val); + +for (j =0 ; j <ARRAY_SIZE (rx_ring->uinc_xfer); j++) { +struct spi_transfer *xfer; + + xfer = &rx_ring->uinc_xfer[j]; + xfer->tx_buf = &rx_ring->uinc_buf; + xfer->len = len; + xfer->cs_change =1 ; + xfer->cs_change_delay.value =0 ; + xfer->cs_change_delay.unit =SPI_DELAY_UNIT_NSECS ; + } } }
@@ -1440,13 +1457,7 @@ mcp251xfd_handle_rxif_one(struct mcp251xfd_priv *priv,if (err) stats->rx_fifo_errors++; - ring->tail++; - -/* finally increment the RX pointer */ -return regmap_update_bits (priv->map_reg, -MCP251XFD_REG_FIFOCON (ring->fifo_nr), -GENMASK (15 ,8 ), -MCP251XFD_REG_FIFOCON_UINC ); +return 0 ; } static inline int
@@ -1478,6 +1489,8 @@ mcp251xfd_handle_rxif_ring(struct mcp251xfd_priv *priv,return err;while ((len =mcp251xfd_get_rx_linear_len (ring))) { +struct spi_transfer *last_xfer; + rx_tail =mcp251xfd_get_rx_tail (ring); err = mcp251xfd_rx_obj_read(priv, ring, hw_rx_obj,
@@ -1492,6 +1505,28 @@ mcp251xfd_handle_rxif_ring(struct mcp251xfd_priv *priv,if (err)return err; } + +/* Increment the RX FIFO tail pointer 'len' times in a +* single SPI message. +*/ + ring->tail += len; + +/* Note: +* +* "cs_change == 1" on the last transfer results in an +* active chip select after the complete SPI +* message. This causes the controller to interpret +* the next register access as data. Temporary set +* "cs_change" of the last transfer to "0" to properly +* deactivate the chip select at the end of the +* message. +*/ + last_xfer = &ring->uinc_xfer[len -1 ]; + last_xfer->cs_change =0 ; + err =spi_sync_transfer (priv->spi, ring->uinc_xfer, len); + last_xfer->cs_change =1 ; +if (err) +return err; }return 0 ;
drivers/net/can/spi/mcp251xfd/mcp251xfd.h +2 -0
@@ -528,6 +528,8 @@ struct mcp251xfd_rx_ring {u8 obj_num;u8 obj_size; +union mcp251xfd_write_reg_buf uinc_buf; +struct spi_transfer uinc_xfer[MCP251XFD_RX_OBJ_NUM_MAX ];struct mcp251xfd_hw_rx_obj_canfd obj[]; };
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 4/14 can: mcp251xfd: struct mcp251xfd_priv::tef to array of length 1
In reply to Marc Kleine-BuddeThis patch converts the struct mcp251xfd_tef_ring member within the struct mcp251xfd_priv into an array of length one. This way all rings (tef, tx and rx) can be accessed in the same way.
--- drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 18 ++++++++++-------- drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 8 ++++---- 2 files changed, 14 insertions(+), 12 deletions(-)
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +10 -8
@@ -326,6 +326,7 @@ mcp251xfd_tx_ring_init_tx_obj(const struct mcp251xfd_priv *priv,static void mcp251xfd_ring_init (struct mcp251xfd_priv *priv) { +struct mcp251xfd_tef_ring *tef_ring;struct mcp251xfd_tx_ring *tx_ring;struct mcp251xfd_rx_ring *rx_ring, *prev_rx_ring =NULL ;struct mcp251xfd_tx_obj *tx_obj;
@@ -335,8 +336,9 @@ static void mcp251xfd_ring_init(struct mcp251xfd_priv *priv)int i, j;/* TEF */ - priv->tef.head =0 ; - priv->tef.tail =0 ; + tef_ring = priv->tef; + tef_ring->head =0 ; + tef_ring->tail =0 ;/* TX */ tx_ring = priv->tx;
@@ -1219,7 +1221,7 @@ mcp251xfd_handle_tefif_recover(const struct mcp251xfd_priv *priv, const u32 seq) tef_sta &MCP251XFD_REG_TEFSTA_TEFFIF ?"full" : tef_sta &MCP251XFD_REG_TEFSTA_TEFNEIF ?"not empty" :"empty" , - seq, priv->tef.tail, priv->tef.head, tx_ring->head); + seq, priv->tef->tail, priv->tef->head, tx_ring->head);/* The Sequence Number in the TEF doesn't match our tef_tail. */ return -EAGAIN ;
@@ -1243,7 +1245,7 @@ mcp251xfd_handle_tefif_one(struct mcp251xfd_priv *priv,*/ seq_masked = seq &field_mask (MCP251XFD_OBJ_FLAGS_SEQ_MCP2517FD_MASK ); - tef_tail_masked = priv->tef.tail & + tef_tail_masked = priv->tef->tail &field_mask (MCP251XFD_OBJ_FLAGS_SEQ_MCP2517FD_MASK );if (seq_masked != tef_tail_masked)return mcp251xfd_handle_tefif_recover (priv, seq);
@@ -1261,7 +1263,7 @@ mcp251xfd_handle_tefif_one(struct mcp251xfd_priv *priv,if (err)return err; - priv->tef.tail++; + priv->tef->tail++; tx_ring->tail++;return mcp251xfd_check_tef_tail (priv);
@@ -1281,12 +1283,12 @@ static int mcp251xfd_tef_ring_update(struct mcp251xfd_priv *priv)/* chip_tx_tail, is the next TX-Object send by the HW. * The new TEF head must be >= the old head, ... */ - new_head =round_down (priv->tef.head, tx_ring->obj_num) + chip_tx_tail; -if (new_head <= priv->tef.head) + new_head =round_down (priv->tef->head, tx_ring->obj_num) + chip_tx_tail; +if (new_head <= priv->tef->head) new_head += tx_ring->obj_num;/* ... but it cannot exceed the TX head. */ - priv->tef.head =min (new_head, tx_ring->head); + priv->tef->head =min (new_head, tx_ring->head);return mcp251xfd_check_tef_tail (priv); }
drivers/net/can/spi/mcp251xfd/mcp251xfd.h +4 -4
@@ -583,7 +583,7 @@ struct mcp251xfd_priv {struct spi_device *spi;u32 spi_max_speed_hz_orig; -struct mcp251xfd_tef_ring tef; +struct mcp251xfd_tef_ring tef[1 ];struct mcp251xfd_tx_ring tx[1 ];struct mcp251xfd_rx_ring *rx[1 ];
@@ -744,17 +744,17 @@ mcp251xfd_get_rx_obj_addr(const struct mcp251xfd_rx_ring *ring, u8 n)static inline u8 mcp251xfd_get_tef_head (const struct mcp251xfd_priv *priv) { -return priv->tef.head & (priv->tx->obj_num -1 ); +return priv->tef->head & (priv->tx->obj_num -1 ); }static inline u8 mcp251xfd_get_tef_tail (const struct mcp251xfd_priv *priv) { -return priv->tef.tail & (priv->tx->obj_num -1 ); +return priv->tef->tail & (priv->tx->obj_num -1 ); }static inline u8 mcp251xfd_get_tef_len (const struct mcp251xfd_priv *priv) { -return priv->tef.head - priv->tef.tail; +return priv->tef->head - priv->tef->tail; }static inline u8 mcp251xfd_get_tef_linear_len (const struct mcp251xfd_priv *priv)
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 5/14 can: mcp251xfd: move struct mcp251xfd_tef_ring definition
In reply to Marc Kleine-BuddeThis patch moves the struct mcp251xfd_tef_ring upwards, so that the union mcp251xfd_write_reg_buf and struct spi_transfer can be made members of it.
--- drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/can/spi/mcp251xfd/mcp251xfd.h +8 -8
@@ -459,14 +459,6 @@ struct mcp251xfd_hw_rx_obj_canfd { u8 data[sizeof_field(struct canfd_frame, data)]; }; -struct mcp251xfd_tef_ring { -unsigned int head; -unsigned int tail; - -/* u8 obj_num equals tx_ring->obj_num */ -/* u8 obj_size equals sizeof(struct mcp251xfd_hw_tef_obj) */ -}; -struct __packed mcp251xfd_buf_cmd {__be16 cmd; };
@@ -506,6 +498,14 @@ struct mcp251xfd_tx_obj {union mcp251xfd_tx_obj_load_buf buf; }; +struct mcp251xfd_tef_ring { +unsigned int head; +unsigned int tail; + +/* u8 obj_num equals tx_ring->obj_num */ +/* u8 obj_size equals sizeof(struct mcp251xfd_hw_tef_obj) */ +}; +struct mcp251xfd_tx_ring {unsigned int head;unsigned int tail;
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 6/14 can: mcp251xfd: tef-path: reduce number of SPI core requests to set UINC bit
In reply to Marc Kleine-BuddeReduce the number of separate SPI core requests when setting the UINC bit in the TEF FIFO, and instead batch them up into a single SPI core request.
--- .../net/can/spi/mcp251xfd/mcp251xfd-core.c | 64 +++++++++++++++---- drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 3 + 2 files changed, 55 insertions(+), 12 deletions(-)
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +52 -12
@@ -340,6 +340,23 @@ static void mcp251xfd_ring_init(struct mcp251xfd_priv *priv) tef_ring->head =0 ; tef_ring->tail =0 ; +/* FIFO increment TEF tail pointer */ + addr =MCP251XFD_REG_TEFCON ; + val =MCP251XFD_REG_TEFCON_UINC ; + len =mcp251xfd_cmd_prepare_write_reg (priv, &tef_ring->uinc_buf, + addr, val, val); + +for (j =0 ; j <ARRAY_SIZE (tef_ring->uinc_xfer); j++) { +struct spi_transfer *xfer; + + xfer = &tef_ring->uinc_xfer[j]; + xfer->tx_buf = &tef_ring->uinc_buf; + xfer->len = len; + xfer->cs_change =1 ; + xfer->cs_change_delay.value =0 ; + xfer->cs_change_delay.unit =SPI_DELAY_UNIT_NSECS ; + } +/* TX */ tx_ring = priv->tx; tx_ring->head =0 ;
@@ -1231,10 +1248,8 @@ static int mcp251xfd_handle_tefif_one(struct mcp251xfd_priv *priv, const struct mcp251xfd_hw_tef_obj *hw_tef_obj) { - struct mcp251xfd_tx_ring *tx_ring = priv->tx; struct net_device_stats *stats = &priv->ndev->stats;u32 seq, seq_masked, tef_tail_masked; -int err; seq =FIELD_GET (MCP251XFD_OBJ_FLAGS_SEQ_MCP2518FD_MASK , hw_tef_obj->flags);
@@ -1255,18 +1270,9 @@ mcp251xfd_handle_tefif_one(struct mcp251xfd_priv *priv,mcp251xfd_get_tef_tail (priv), hw_tef_obj->ts); stats->tx_packets++; - -/* finally increment the TEF pointer */ - err =regmap_update_bits (priv->map_reg,MCP251XFD_REG_TEFCON , -GENMASK (15 ,8 ), -MCP251XFD_REG_TEFCON_UINC ); -if (err) -return err; - priv->tef->tail++; - tx_ring->tail++; -return mcp251xfd_check_tef_tail (priv); +return 0 ; }static int mcp251xfd_tef_ring_update (struct mcp251xfd_priv *priv)
@@ -1353,6 +1359,40 @@ static int mcp251xfd_handle_tefif(struct mcp251xfd_priv *priv) } out_netif_wake_queue: + len = i;/* number of handled goods TEFs */ +if (len) { +struct mcp251xfd_tef_ring *ring = priv->tef; +struct mcp251xfd_tx_ring *tx_ring = priv->tx; +struct spi_transfer *last_xfer; + + tx_ring->tail += len; + +/* Increment the TEF FIFO tail pointer 'len' times in +* a single SPI message. +*/ + +/* Note: +* +* "cs_change == 1" on the last transfer results in an +* active chip select after the complete SPI +* message. This causes the controller to interpret +* the next register access as data. Temporary set +* "cs_change" of the last transfer to "0" to properly +* deactivate the chip select at the end of the +* message. +*/ + last_xfer = &ring->uinc_xfer[len -1 ]; + last_xfer->cs_change =0 ; + err =spi_sync_transfer (priv->spi, ring->uinc_xfer, len); + last_xfer->cs_change =1 ; +if (err) +return err; + + err =mcp251xfd_check_tef_tail (priv); +if (err) +return err; + } +mcp251xfd_ecc_tefif_successful (priv);if (mcp251xfd_get_tx_free (priv->tx)) {
drivers/net/can/spi/mcp251xfd/mcp251xfd.h +3 -0
@@ -504,6 +504,9 @@ struct mcp251xfd_tef_ring {/* u8 obj_num equals tx_ring->obj_num */ /* u8 obj_size equals sizeof(struct mcp251xfd_hw_tef_obj) */ + +union mcp251xfd_write_reg_buf uinc_buf; +struct spi_transfer uinc_xfer[MCP251XFD_TX_OBJ_NUM_MAX ]; };struct mcp251xfd_tx_ring {
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 7/14 can: tcan4x5x: tcan4x5x_clear_interrupts(): remove redundant return statement
In reply to Marc Kleine-BuddeFrom: Sean Nyekjaer <[email protected]>
This patch removes a redundant return at the end of tcan4x5x_clear_interrupts().
--- drivers/net/can/m_can/tcan4x5x.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/can/m_can/tcan4x5x.c +2 -6
@@ -328,12 +328,8 @@ static int tcan4x5x_clear_interrupts(struct m_can_classdev *cdev)if (ret)return ret; - ret =tcan4x5x_write_tcan_reg (cdev,TCAN4X5X_ERROR_STATUS , -TCAN4X5X_CLEAR_ALL_INT ); -if (ret) -return ret; - -return ret; +return tcan4x5x_write_tcan_reg (cdev,TCAN4X5X_ERROR_STATUS , +TCAN4X5X_CLEAR_ALL_INT ); }static int tcan4x5x_init (struct m_can_classdev *cdev)
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 8/14 can: tcan4x5x: rename parse_config() function
In reply to Marc Kleine-BuddeFrom: Dan Murphy <[email protected]>
Rename the tcan4x5x_parse_config() function to tcan4x5x_get_gpios() since the function retrieves the gpio configurations from the firmware.
--- drivers/net/can/m_can/tcan4x5x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/can/m_can/tcan4x5x.c +2 -2
@@ -375,7 +375,7 @@ static int tcan4x5x_disable_state(struct m_can_classdev *cdev) TCAN4X5X_DISABLE_INH_MSK, 0x01); } -static int tcan4x5x_parse_config (struct m_can_classdev *cdev) +static int tcan4x5x_get_gpios (struct m_can_classdev *cdev) {struct tcan4x5x_priv *tcan4x5x = cdev->device_data;int ret;
@@ -498,7 +498,7 @@ static int tcan4x5x_can_probe(struct spi_device *spi)if (ret) goto out_clk; - ret =tcan4x5x_parse_config (mcan_class); + ret =tcan4x5x_get_gpios (mcan_class);if (ret) goto out_power;
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 9/14 can: tcan4x5x: remove mram_start and reg_offset from struct tcan4x5x_priv
In reply to Marc Kleine-BuddeBoth struct tcan4x5x_priv::mram_start and struct tcan4x5x_priv::reg_offset are only assigned once with a constant and then always used read-only. This patch changes the driver to use the constant directly instead.
--- drivers/net/can/m_can/tcan4x5x.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/net/can/m_can/tcan4x5x.c +4 -10
@@ -123,10 +123,6 @@ struct tcan4x5x_priv {struct gpio_desc *device_wake_gpio;struct gpio_desc *device_state_gpio;struct regulator *power; - -/* Register based ip */ -int mram_start; -int reg_offset; };static struct can_bittiming_const tcan4x5x_bittiming_const = {
@@ -260,7 +256,7 @@ static u32 tcan4x5x_read_reg(struct m_can_classdev *cdev, int reg)struct tcan4x5x_priv *priv = cdev->device_data;u32 val; -regmap_read (priv->regmap, priv->reg_offset + reg, &val); +regmap_read (priv->regmap,TCAN4X5X_MCAN_OFFSET + reg, &val);return val; }
@@ -270,7 +266,7 @@ static u32 tcan4x5x_read_fifo(struct m_can_classdev *cdev, int addr_offset)struct tcan4x5x_priv *priv = cdev->device_data;u32 val; -regmap_read (priv->regmap, priv->mram_start + addr_offset, &val); +regmap_read (priv->regmap,TCAN4X5X_MRAM_START + addr_offset, &val);return val; }
@@ -279,7 +275,7 @@ static int tcan4x5x_write_reg(struct m_can_classdev *cdev, int reg, int val) {struct tcan4x5x_priv *priv = cdev->device_data; -return regmap_write (priv->regmap, priv->reg_offset + reg, val); +return regmap_write (priv->regmap,TCAN4X5X_MCAN_OFFSET + reg, val); } static int tcan4x5x_write_fifo(struct m_can_classdev *cdev,
@@ -287,7 +283,7 @@ static int tcan4x5x_write_fifo(struct m_can_classdev *cdev, {struct tcan4x5x_priv *priv = cdev->device_data; -return regmap_write (priv->regmap, priv->mram_start + addr_offset, val); +return regmap_write (priv->regmap,TCAN4X5X_MRAM_START + addr_offset, val); }static int tcan4x5x_power_enable (struct regulator *reg,int enable)
@@ -465,8 +461,6 @@ static int tcan4x5x_can_probe(struct spi_device *spi) goto out_m_can_class_free_dev; } - priv->reg_offset =TCAN4X5X_MCAN_OFFSET ; - priv->mram_start =TCAN4X5X_MRAM_START ; priv->spi = spi; priv->mcan_dev = mcan_class;
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 10/14 can: tcan4x5x: tcan4x5x_can_probe(): remove probe failed error message
In reply to Marc Kleine-BuddeThe driver core already emits a probe failed error message, so remove this one from the driver.
--- drivers/net/can/m_can/tcan4x5x.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/can/m_can/tcan4x5x.c +0 -2
@@ -516,8 +516,6 @@ static int tcan4x5x_can_probe(struct spi_device *spi) } out_m_can_class_free_dev:m_can_class_free_dev (mcan_class->net); -dev_err (&spi->dev,"Probe failed, err=%d\n" , ret); -return ret; }
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 11/14 can: m_can: Kconfig: convert the into menu
In reply to Marc Kleine-BuddeSince there is more than one base driver for the m_can core, let's convert this into a menu.
--- drivers/net/can/m_can/Kconfig | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/can/m_can/Kconfig +5 -3
@@ -1,21 +1,21 @@ # SPDX-License-Identifier: GPL-2.0-only -config CAN_M_CAN +menuconfig CAN_M_CAN tristate "Bosch M_CAN support" help Say Y here if you want support for Bosch M_CAN controller framework. This is common support for devices that embed the Bosch M_CAN IP. +if CAN_M_CAN + config CAN_M_CAN_PLATFORM tristate "Bosch M_CAN support for io-mapped devices" depends on HAS_IOMEM - depends on CAN_M_CAN help Say Y here if you want support for IO Mapped Bosch M_CAN controller. This support is for devices that have the Bosch M_CAN controller IP embedded into the device and the IP is IO Mapped to the processor. config CAN_M_CAN_TCAN4X5X - depends on CAN_M_CAN depends on SPI select REGMAP_SPI tristate "TCAN4X5X M_CAN device"
@@ -23,3 +23,5 @@ config CAN_M_CAN_TCAN4X5X Say Y here if you want support for Texas Instruments TCAN4x5x M_CAN controller. This device is a peripheral device that uses the SPI bus for communication. + +endif
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 12/14 can: m_can: remove not used variable struct m_can_classdev::freq
In reply to Marc Kleine-BuddeThis patch removes the unused variable freq from the struct m_can_classdev.
--- drivers/net/can/m_can/m_can.h | 1 - 1 file changed, 1 deletion(-)
drivers/net/can/m_can/m_can.h +0 -1
@@ -89,7 +89,6 @@ struct m_can_classdev {void *device_data;int version; -int freq;u32 irqstatus;int pm_clock_support;
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 13/14 can: m_can: m_can_plat_remove(): remove unneeded platform_set_drvdata()
In reply to Marc Kleine-BuddeThere's no need to unset the drvdata on remove, so remove the unneeded call to platform_set_drvdata() in m_can_plat_remove().
--- drivers/net/can/m_can/m_can_platform.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/can/m_can/m_can_platform.c +0 -2
@@ -141,8 +141,6 @@ static int m_can_plat_remove(struct platform_device *pdev)m_can_class_free_dev (mcan_class->net); -platform_set_drvdata (pdev,NULL ); -return 0 ; }
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerPATCH 14/14 can: m_can: m_can_class_unregister(): move right after m_can_class_register()
In reply to Marc Kleine-BuddeThis patch moves the function m_can_class_unregister() directly after the m_can_class_register() function.
--- drivers/net/can/m_can/m_can.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/can/m_can/m_can.c +8 -8
@@ -1869,6 +1869,14 @@ int m_can_class_register(struct m_can_classdev *m_can_dev) }EXPORT_SYMBOL_GPL (m_can_class_register); +void m_can_class_unregister (struct m_can_classdev *m_can_dev) +{ +unregister_candev (m_can_dev->net); + +m_can_clk_stop (m_can_dev); +} +EXPORT_SYMBOL_GPL (m_can_class_unregister); +int m_can_class_suspend (struct device *dev) {struct net_device *ndev =dev_get_drvdata (dev);
@@ -1915,14 +1923,6 @@ int m_can_class_resume(struct device *dev) }EXPORT_SYMBOL_GPL (m_can_class_resume); -void m_can_class_unregister (struct m_can_classdev *m_can_dev) -{ -unregister_candev (m_can_dev->net); - -m_can_clk_stop (m_can_dev); -} -EXPORT_SYMBOL_GPL (m_can_class_unregister); -MODULE_AUTHOR ("Dong Aisheng <[email protected]>" );MODULE_AUTHOR ("Dan Murphy <[email protected]>" );MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.29.2
Jakub Kicinski
maintainerQuoted 7 lines · On Mon, 30 Nov 2020 15:14:18 +0100 Marc Kleine-Budde wrote:
Hello Jakub, hello David,
here's a pull request of 14 patches for net-next/master.
Gustavo A. R. Silva's patch for the
pcan_usbdriver fixes fall-through warnings for Clang.
Quoted 8 lines
The next 5 patches target the mcp251xfd driver and are by Ursula Maplehurst and me. They optimizie the TEF and RX path by reducing number of SPI core requests to set the UINC bit.
The remaining 8 patches target the
m_candriver. The first 4 are various cleanups for the SPI binding driver (tcan4x5x) by Sean Nyekjaer, Dan Murphy and me. Followed by 4 cleanup patches by me for them_canandm_can_platformdriver.
Pulled, thanks!