* [RFC]: can-next 2021-06-16 - j1939, m_can, peak_pci
@ 2021-06-16 10:28 Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 1/9] can: j1939: fix checkpatch warnings Marc Kleine-Budde
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: Marc Kleine-Budde @ 2021-06-16 10:28 UTC (permalink / raw)
To: linux-can; +Cc: kernel
Hello, this is a series consisting of some j1939 enhancements,
removal of custom m_can bit timings and some peak_pci patches.
The last patch (9/9) is by Stephane Grosjean, I've changed the
indention a bit.
regards,
Marc
^ permalink raw reply [flat|nested] 10+ messages in thread
* [can-next-rfc 1/9] can: j1939: fix checkpatch warnings
2021-06-16 10:28 [RFC]: can-next 2021-06-16 - j1939, m_can, peak_pci Marc Kleine-Budde
@ 2021-06-16 10:28 ` Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 2/9] can: j1939: replace fall through comment by fallthrough pseudo-keyword Marc Kleine-Budde
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Marc Kleine-Budde @ 2021-06-16 10:28 UTC (permalink / raw)
To: linux-can; +Cc: kernel, Marc Kleine-Budde, Robin van der Gracht, Oleksij Rempel
This patch fixes a checkpatch warning about a long line and wrong
indention.
Cc: Robin van der Gracht <robin@protonic.nl>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
net/can/j1939/transport.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
index e09d087ba240..86cb943ef14a 100644
--- a/net/can/j1939/transport.c
+++ b/net/can/j1939/transport.c
@@ -800,7 +800,8 @@ static int j1939_session_tx_dat(struct j1939_session *session)
if (offset + len > se_skb->len) {
netdev_err_once(priv->ndev,
"%s: 0x%p: requested data outside of queued buffer: offset %i, len %i, pkt.tx: %i\n",
- __func__, session, skcb->offset, se_skb->len , session->pkt.tx);
+ __func__, session, se_skcb->offset,
+ se_skb->len, session->pkt.tx);
return -EOVERFLOW;
}
@@ -1069,7 +1070,7 @@ j1939_session_deactivate_activate_next(struct j1939_session *session)
}
static void __j1939_session_cancel(struct j1939_session *session,
- enum j1939_xtp_abort err)
+ enum j1939_xtp_abort err)
{
struct j1939_priv *priv = session->priv;
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [can-next-rfc 2/9] can: j1939: replace fall through comment by fallthrough pseudo-keyword
2021-06-16 10:28 [RFC]: can-next 2021-06-16 - j1939, m_can, peak_pci Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 1/9] can: j1939: fix checkpatch warnings Marc Kleine-Budde
@ 2021-06-16 10:28 ` Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 3/9] can: j1939: j1939_session_completed(): use consistent name se_skb for the session skb Marc Kleine-Budde
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Marc Kleine-Budde @ 2021-06-16 10:28 UTC (permalink / raw)
To: linux-can; +Cc: kernel, Marc Kleine-Budde, Robin van der Gracht, Oleksij Rempel
Replace the existing /* fall through */ comments the new
pseudo-keyword macro fallthrough.
Cc: Robin van der Gracht <robin@protonic.nl>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
net/can/j1939/transport.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
index 86cb943ef14a..25cb4447c20a 100644
--- a/net/can/j1939/transport.c
+++ b/net/can/j1939/transport.c
@@ -1240,12 +1240,14 @@ static bool j1939_xtp_rx_cmd_bad_pgn(struct j1939_session *session,
break;
case J1939_ETP_CMD_RTS:
- case J1939_TP_CMD_RTS: /* fall through */
+ fallthrough;
+ case J1939_TP_CMD_RTS:
abort = J1939_XTP_ABORT_BUSY;
break;
case J1939_ETP_CMD_CTS:
- case J1939_TP_CMD_CTS: /* fall through */
+ fallthrough;
+ case J1939_TP_CMD_CTS:
abort = J1939_XTP_ABORT_ECTS_UNXPECTED_PGN;
break;
@@ -1254,7 +1256,8 @@ static bool j1939_xtp_rx_cmd_bad_pgn(struct j1939_session *session,
break;
case J1939_ETP_CMD_EOMA:
- case J1939_TP_CMD_EOMA: /* fall through */
+ fallthrough;
+ case J1939_TP_CMD_EOMA:
abort = J1939_XTP_ABORT_OTHER;
break;
@@ -1769,7 +1772,8 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
break;
fallthrough;
case J1939_TP_CMD_BAM:
- case J1939_TP_CMD_CTS: /* fall through */
+ fallthrough;
+ case J1939_TP_CMD_CTS:
if (skcb->addr.type != J1939_ETP)
break;
fallthrough;
@@ -1970,7 +1974,8 @@ static void j1939_tp_cmd_recv(struct j1939_priv *priv, struct sk_buff *skb)
extd = J1939_ETP;
fallthrough;
case J1939_TP_CMD_BAM:
- case J1939_TP_CMD_RTS: /* fall through */
+ fallthrough;
+ case J1939_TP_CMD_RTS:
if (skcb->addr.type != extd)
return;
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [can-next-rfc 3/9] can: j1939: j1939_session_completed(): use consistent name se_skb for the session skb
2021-06-16 10:28 [RFC]: can-next 2021-06-16 - j1939, m_can, peak_pci Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 1/9] can: j1939: fix checkpatch warnings Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 2/9] can: j1939: replace fall through comment by fallthrough pseudo-keyword Marc Kleine-Budde
@ 2021-06-16 10:28 ` Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 4/9] can: j1939: j1939_session_tx_dat(): use consistent name se_skcb for session skb control buffer Marc Kleine-Budde
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Marc Kleine-Budde @ 2021-06-16 10:28 UTC (permalink / raw)
To: linux-can; +Cc: kernel, Marc Kleine-Budde, Robin van der Gracht, Oleksij Rempel
This patch changes the name of the "skb" variable in
j1939_session_completed() to "se_skb" as it's the session skb. The
same name is used in other functions for the session skb.
Cc: Robin van der Gracht <robin@protonic.nl>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
net/can/j1939/transport.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
index 25cb4447c20a..62d3b1185fc3 100644
--- a/net/can/j1939/transport.c
+++ b/net/can/j1939/transport.c
@@ -1168,12 +1168,12 @@ static enum hrtimer_restart j1939_tp_txtimer(struct hrtimer *hrtimer)
static void j1939_session_completed(struct j1939_session *session)
{
- struct sk_buff *skb;
+ struct sk_buff *se_skb;
if (!session->transmission) {
- skb = j1939_session_skb_find(session);
+ se_skb = j1939_session_skb_find(session);
/* distribute among j1939 receivers */
- j1939_sk_recv(session->priv, skb);
+ j1939_sk_recv(session->priv, se_skb);
}
j1939_session_deactivate_activate_next(session);
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [can-next-rfc 4/9] can: j1939: j1939_session_tx_dat(): use consistent name se_skcb for session skb control buffer
2021-06-16 10:28 [RFC]: can-next 2021-06-16 - j1939, m_can, peak_pci Marc Kleine-Budde
` (2 preceding siblings ...)
2021-06-16 10:28 ` [can-next-rfc 3/9] can: j1939: j1939_session_completed(): use consistent name se_skb for the session skb Marc Kleine-Budde
@ 2021-06-16 10:28 ` Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 5/9] can: j1939: j1939_xtp_rx_dat_one(): use separate pointer " Marc Kleine-Budde
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Marc Kleine-Budde @ 2021-06-16 10:28 UTC (permalink / raw)
To: linux-can; +Cc: kernel, Marc Kleine-Budde, Robin van der Gracht, Oleksij Rempel
This patch changes the name of the "skcb" variable in
j1939_session_tx_dat() to "se_skcb" as it's the session skb's control
buffer. The same name is used in other functions for the session skb's
control buffer.
Cc: Robin van der Gracht <robin@protonic.nl>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
net/can/j1939/transport.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
index 62d3b1185fc3..d6b78da2a986 100644
--- a/net/can/j1939/transport.c
+++ b/net/can/j1939/transport.c
@@ -768,7 +768,7 @@ static int j1939_session_tx_dpo(struct j1939_session *session)
static int j1939_session_tx_dat(struct j1939_session *session)
{
struct j1939_priv *priv = session->priv;
- struct j1939_sk_buff_cb *skcb;
+ struct j1939_sk_buff_cb *se_skcb;
int offset, pkt_done, pkt_end;
unsigned int len, pdelay;
struct sk_buff *se_skb;
@@ -780,7 +780,7 @@ static int j1939_session_tx_dat(struct j1939_session *session)
if (!se_skb)
return -ENOBUFS;
- skcb = j1939_skb_to_cb(se_skb);
+ se_skcb = j1939_skb_to_cb(se_skb);
tpdat = se_skb->data;
ret = 0;
pkt_done = 0;
@@ -792,7 +792,7 @@ static int j1939_session_tx_dat(struct j1939_session *session)
while (session->pkt.tx < pkt_end) {
dat[0] = session->pkt.tx - session->pkt.dpo + 1;
- offset = (session->pkt.tx * 7) - skcb->offset;
+ offset = (session->pkt.tx * 7) - se_skcb->offset;
len = se_skb->len - offset;
if (len > 7)
len = 7;
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [can-next-rfc 5/9] can: j1939: j1939_xtp_rx_dat_one(): use separate pointer for session skb control buffer
2021-06-16 10:28 [RFC]: can-next 2021-06-16 - j1939, m_can, peak_pci Marc Kleine-Budde
` (3 preceding siblings ...)
2021-06-16 10:28 ` [can-next-rfc 4/9] can: j1939: j1939_session_tx_dat(): use consistent name se_skcb for session skb control buffer Marc Kleine-Budde
@ 2021-06-16 10:28 ` Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 6/9] can: m_can: remove support for custom bit timing Marc Kleine-Budde
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Marc Kleine-Budde @ 2021-06-16 10:28 UTC (permalink / raw)
To: linux-can; +Cc: kernel, Marc Kleine-Budde, Robin van der Gracht, Oleksij Rempel
In the j1939_xtp_rx_dat_one() function, there are 2 variables (skb and
se_skb) holding a skb. The control buffer of the skbs is accessed one
after the other, but using the same "skcb" variable.
To avoid confusion introduce a new variable "se_skcb" to access the
se_skb's control buffer as done in the rest of this file, too.
Cc: Robin van der Gracht <robin@protonic.nl>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
net/can/j1939/transport.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
index d6b78da2a986..bbac0e321716 100644
--- a/net/can/j1939/transport.c
+++ b/net/can/j1939/transport.c
@@ -1747,7 +1747,7 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
struct sk_buff *skb)
{
struct j1939_priv *priv = session->priv;
- struct j1939_sk_buff_cb *skcb;
+ struct j1939_sk_buff_cb *skcb, *se_skcb;
struct sk_buff *se_skb;
const u8 *dat;
u8 *tpdat;
@@ -1798,8 +1798,8 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
goto out_session_cancel;
}
- skcb = j1939_skb_to_cb(se_skb);
- offset = packet * 7 - skcb->offset;
+ se_skcb = j1939_skb_to_cb(se_skb);
+ offset = packet * 7 - se_skcb->offset;
nbytes = se_skb->len - offset;
if (nbytes > 7)
nbytes = 7;
@@ -1827,7 +1827,7 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
if (packet == session->pkt.rx)
session->pkt.rx++;
- if (skcb->addr.type != J1939_ETP &&
+ if (se_skcb->addr.type != J1939_ETP &&
j1939_cb_is_broadcast(&session->skcb)) {
if (session->pkt.rx >= session->pkt.total)
final = true;
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [can-next-rfc 6/9] can: m_can: remove support for custom bit timing
2021-06-16 10:28 [RFC]: can-next 2021-06-16 - j1939, m_can, peak_pci Marc Kleine-Budde
` (4 preceding siblings ...)
2021-06-16 10:28 ` [can-next-rfc 5/9] can: j1939: j1939_xtp_rx_dat_one(): use separate pointer " Marc Kleine-Budde
@ 2021-06-16 10:28 ` Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 7/9] can: peak_pci: convert comments to network style comments Marc Kleine-Budde
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Marc Kleine-Budde @ 2021-06-16 10:28 UTC (permalink / raw)
To: linux-can; +Cc: kernel, Marc Kleine-Budde, Chandrasekar Ramakrishnan
Since commit aee2b3ccc8a6 ("can: tcan4x5x: fix bittiming const, use
common bittiming from m_can driver") there is no use of the device
specific bit timing parameters (m_can_classdev::bit_timing and struct
m_can_classdev::data_timing).
This patch removes the support for custom bit timing from the driver,
as the common bit timing works for all known IP core implementations.
Cc: Chandrasekar Ramakrishnan <rcsekar@samsung.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/m_can/m_can.c | 24 ++++++------------------
drivers/net/can/m_can/m_can.h | 3 ---
2 files changed, 6 insertions(+), 21 deletions(-)
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index bba2a449ac70..3a2afa54aca2 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -1436,32 +1436,20 @@ static int m_can_dev_setup(struct m_can_classdev *cdev)
case 30:
/* CAN_CTRLMODE_FD_NON_ISO is fixed with M_CAN IP v3.0.x */
can_set_static_ctrlmode(dev, CAN_CTRLMODE_FD_NON_ISO);
- cdev->can.bittiming_const = cdev->bit_timing ?
- cdev->bit_timing : &m_can_bittiming_const_30X;
-
- cdev->can.data_bittiming_const = cdev->data_timing ?
- cdev->data_timing :
- &m_can_data_bittiming_const_30X;
+ cdev->can.bittiming_const = &m_can_bittiming_const_30X;
+ cdev->can.data_bittiming_const = &m_can_data_bittiming_const_30X;
break;
case 31:
/* CAN_CTRLMODE_FD_NON_ISO is fixed with M_CAN IP v3.1.x */
can_set_static_ctrlmode(dev, CAN_CTRLMODE_FD_NON_ISO);
- cdev->can.bittiming_const = cdev->bit_timing ?
- cdev->bit_timing : &m_can_bittiming_const_31X;
-
- cdev->can.data_bittiming_const = cdev->data_timing ?
- cdev->data_timing :
- &m_can_data_bittiming_const_31X;
+ cdev->can.bittiming_const = &m_can_bittiming_const_31X;
+ cdev->can.data_bittiming_const = &m_can_data_bittiming_const_31X;
break;
case 32:
case 33:
/* Support both MCAN version v3.2.x and v3.3.0 */
- cdev->can.bittiming_const = cdev->bit_timing ?
- cdev->bit_timing : &m_can_bittiming_const_31X;
-
- cdev->can.data_bittiming_const = cdev->data_timing ?
- cdev->data_timing :
- &m_can_data_bittiming_const_31X;
+ cdev->can.bittiming_const = &m_can_bittiming_const_31X;
+ cdev->can.data_bittiming_const = &m_can_data_bittiming_const_31X;
cdev->can.ctrlmode_supported |=
(m_can_niso_supported(cdev) ?
diff --git a/drivers/net/can/m_can/m_can.h b/drivers/net/can/m_can/m_can.h
index ace071c3e58c..ea53322d110e 100644
--- a/drivers/net/can/m_can/m_can.h
+++ b/drivers/net/can/m_can/m_can.h
@@ -83,9 +83,6 @@ struct m_can_classdev {
struct work_struct tx_work;
struct sk_buff *tx_skb;
- struct can_bittiming_const *bit_timing;
- struct can_bittiming_const *data_timing;
-
struct m_can_ops *ops;
int version;
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [can-next-rfc 7/9] can: peak_pci: convert comments to network style comments
2021-06-16 10:28 [RFC]: can-next 2021-06-16 - j1939, m_can, peak_pci Marc Kleine-Budde
` (5 preceding siblings ...)
2021-06-16 10:28 ` [can-next-rfc 6/9] can: m_can: remove support for custom bit timing Marc Kleine-Budde
@ 2021-06-16 10:28 ` Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 8/9] can: peak_pci: fix checkpatch warnings Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 9/9] can: peak_pci: Add name and FW version of the card in kernel buffer Marc Kleine-Budde
8 siblings, 0 replies; 10+ messages in thread
From: Marc Kleine-Budde @ 2021-06-16 10:28 UTC (permalink / raw)
To: linux-can; +Cc: kernel, Marc Kleine-Budde, Stephane Grosjean
This patch converts all comments to network subsystem style comments.
Cc: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/sja1000/peak_pci.c | 49 +++++++++---------------------
1 file changed, 14 insertions(+), 35 deletions(-)
diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c
index 84eac8cb8686..5fec26c6df42 100644
--- a/drivers/net/can/sja1000/peak_pci.c
+++ b/drivers/net/can/sja1000/peak_pci.c
@@ -41,9 +41,7 @@ struct peak_pci_chan {
#define PEAK_PCI_CDR (CDR_CBP | CDR_CLKOUT_MASK)
#define PEAK_PCI_OCR OCR_TX0_PUSHPULL
-/*
- * Important PITA registers
- */
+/* Important PITA registers */
#define PITA_ICR 0x00 /* Interrupt control register */
#define PITA_GPIOICR 0x18 /* GPIO interface control register */
#define PITA_MISC 0x1C /* Miscellaneous register */
@@ -88,9 +86,7 @@ static const struct pci_device_id peak_pci_tbl[] = {
MODULE_DEVICE_TABLE(pci, peak_pci_tbl);
#ifdef CONFIG_CAN_PEAK_PCIEC
-/*
- * PCAN-ExpressCard needs I2C bit-banging configuration option.
- */
+/* PCAN-ExpressCard needs I2C bit-banging configuration option. */
/* GPIOICR byte access offsets */
#define PITA_GPOUT 0x18 /* GPx output value */
@@ -230,9 +226,7 @@ static int pita_getscl(void *data)
return (readb(card->cfg_base + PITA_GPIN) & PITA_GPIN_SCL) ? 1 : 0;
}
-/*
- * write commands to the LED chip though the I2C-bus of the PCAN-PCIeC
- */
+/* write commands to the LED chip though the I2C-bus of the PCAN-PCIeC */
static int peak_pciec_write_pca9553(struct peak_pciec_card *card,
u8 offset, u8 data)
{
@@ -261,9 +255,7 @@ static int peak_pciec_write_pca9553(struct peak_pciec_card *card,
return 0;
}
-/*
- * delayed work callback used to control the LEDs
- */
+/* delayed work callback used to control the LEDs */
static void peak_pciec_led_work(struct work_struct *work)
{
struct peak_pciec_card *card =
@@ -309,9 +301,7 @@ static void peak_pciec_led_work(struct work_struct *work)
schedule_delayed_work(&card->led_work, HZ);
}
-/*
- * set LEDs blinking state
- */
+/* set LEDs blinking state */
static void peak_pciec_set_leds(struct peak_pciec_card *card, u8 led_mask, u8 s)
{
u8 new_led = card->led_cache;
@@ -328,25 +318,19 @@ static void peak_pciec_set_leds(struct peak_pciec_card *card, u8 led_mask, u8 s)
peak_pciec_write_pca9553(card, 5, new_led);
}
-/*
- * start one second delayed work to control LEDs
- */
+/* start one second delayed work to control LEDs */
static void peak_pciec_start_led_work(struct peak_pciec_card *card)
{
schedule_delayed_work(&card->led_work, HZ);
}
-/*
- * stop LEDs delayed work
- */
+/* stop LEDs delayed work */
static void peak_pciec_stop_led_work(struct peak_pciec_card *card)
{
cancel_delayed_work_sync(&card->led_work);
}
-/*
- * initialize the PCA9553 4-bit I2C-bus LED chip
- */
+/* initialize the PCA9553 4-bit I2C-bus LED chip */
static int peak_pciec_init_leds(struct peak_pciec_card *card)
{
int err;
@@ -375,17 +359,14 @@ static int peak_pciec_init_leds(struct peak_pciec_card *card)
return peak_pciec_write_pca9553(card, 5, PCA9553_LS0_INIT);
}
-/*
- * restore LEDs state to off peak_pciec_leds_exit
- */
+/* restore LEDs state to off peak_pciec_leds_exit */
static void peak_pciec_leds_exit(struct peak_pciec_card *card)
{
/* switch LEDs to off */
peak_pciec_write_pca9553(card, 5, PCA9553_LED_OFF_ALL);
}
-/*
- * normal write sja1000 register method overloaded to catch when controller
+/* normal write sja1000 register method overloaded to catch when controller
* is started or stopped, to control leds
*/
static void peak_pciec_write_reg(const struct sja1000_priv *priv,
@@ -506,9 +487,7 @@ static void peak_pciec_remove(struct peak_pciec_card *card)
#else /* CONFIG_CAN_PEAK_PCIEC */
-/*
- * Placebo functions when PCAN-ExpressCard support is not selected
- */
+/* Placebo functions when PCAN-ExpressCard support is not selected */
static inline int peak_pciec_probe(struct pci_dev *pdev, struct net_device *dev)
{
return -ENODEV;
@@ -642,8 +621,7 @@ static int peak_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
chan->prev_dev = pci_get_drvdata(pdev);
pci_set_drvdata(pdev, dev);
- /*
- * PCAN-ExpressCard needs some additional i2c init.
+ /* PCAN-ExpressCard needs some additional i2c init.
* This must be done *before* register_sja1000dev() but
* *after* devices linkage
*/
@@ -709,7 +687,8 @@ static int peak_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* pci_xxx_config_word() return positive PCIBIOS_xxx error codes while
* the probe() function must return a negative errno in case of failure
- * (err is unchanged if negative) */
+ * (err is unchanged if negative)
+ */
return pcibios_err_to_errno(err);
}
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [can-next-rfc 8/9] can: peak_pci: fix checkpatch warnings
2021-06-16 10:28 [RFC]: can-next 2021-06-16 - j1939, m_can, peak_pci Marc Kleine-Budde
` (6 preceding siblings ...)
2021-06-16 10:28 ` [can-next-rfc 7/9] can: peak_pci: convert comments to network style comments Marc Kleine-Budde
@ 2021-06-16 10:28 ` Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 9/9] can: peak_pci: Add name and FW version of the card in kernel buffer Marc Kleine-Budde
8 siblings, 0 replies; 10+ messages in thread
From: Marc Kleine-Budde @ 2021-06-16 10:28 UTC (permalink / raw)
To: linux-can; +Cc: kernel, Marc Kleine-Budde, Stephane Grosjean
This patch cleans several checkpatch warnings in the peak_pci driver.
Cc: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/sja1000/peak_pci.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c
index 5fec26c6df42..aff8a1dee135 100644
--- a/drivers/net/can/sja1000/peak_pci.c
+++ b/drivers/net/can/sja1000/peak_pci.c
@@ -152,12 +152,14 @@ static void peak_pci_write_reg(const struct sja1000_priv *priv,
static inline void pita_set_scl_highz(struct peak_pciec_card *card)
{
u8 gp_outen = readb(card->cfg_base + PITA_GPOEN) & ~PITA_GPIN_SCL;
+
writeb(gp_outen, card->cfg_base + PITA_GPOEN);
}
static inline void pita_set_sda_highz(struct peak_pciec_card *card)
{
u8 gp_outen = readb(card->cfg_base + PITA_GPOEN) & ~PITA_GPIN_SDA;
+
writeb(gp_outen, card->cfg_base + PITA_GPOEN);
}
@@ -242,7 +244,7 @@ static int peak_pciec_write_pca9553(struct peak_pciec_card *card,
int ret;
/* cache led mask */
- if ((offset == 5) && (data == card->led_cache))
+ if (offset == 5 && data == card->led_cache)
return 0;
ret = i2c_transfer(&card->led_chip, &msg, 1);
@@ -424,7 +426,7 @@ static int peak_pciec_probe(struct pci_dev *pdev, struct net_device *dev)
/* channel is the first one: do the init part */
} else {
/* create the bit banging I2C adapter structure */
- card = kzalloc(sizeof(struct peak_pciec_card), GFP_KERNEL);
+ card = kzalloc(sizeof(*card), GFP_KERNEL);
if (!card)
return -ENOMEM;
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [can-next-rfc 9/9] can: peak_pci: Add name and FW version of the card in kernel buffer
2021-06-16 10:28 [RFC]: can-next 2021-06-16 - j1939, m_can, peak_pci Marc Kleine-Budde
` (7 preceding siblings ...)
2021-06-16 10:28 ` [can-next-rfc 8/9] can: peak_pci: fix checkpatch warnings Marc Kleine-Budde
@ 2021-06-16 10:28 ` Marc Kleine-Budde
8 siblings, 0 replies; 10+ messages in thread
From: Marc Kleine-Budde @ 2021-06-16 10:28 UTC (permalink / raw)
To: linux-can; +Cc: kernel, Stephane Grosjean, Marc Kleine-Budde
From: Stephane Grosjean <s.grosjean@peak-system.com>
This patch adds name and (possibly) firmware version information to
the kernel about the detected PEAK-System CAN - PCI/PCIe interface
card.
Link: https://lore.kernel.org/r/20210607151720.13571-1-s.grosjean@peak-system.com
Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
[mkl: reformated struct pci_device_id peak_pci_tbl]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/sja1000/peak_pci.c | 64 +++++++++++++++++++++++++-----
1 file changed, 53 insertions(+), 11 deletions(-)
diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c
index aff8a1dee135..6db90dc4bc9d 100644
--- a/drivers/net/can/sja1000/peak_pci.c
+++ b/drivers/net/can/sja1000/peak_pci.c
@@ -28,6 +28,10 @@ MODULE_LICENSE("GPL v2");
#define DRV_NAME "peak_pci"
+/* FPGA cards FW version registers */
+#define PEAK_VER_REG1 0x40
+#define PEAK_VER_REG2 0x44
+
struct peak_pciec_card;
struct peak_pci_chan {
void __iomem *cfg_base; /* Common for all channels */
@@ -68,19 +72,41 @@ static const u16 peak_pci_icr_masks[PEAK_PCI_CHAN_MAX] = {
};
static const struct pci_device_id peak_pci_tbl[] = {
- {PEAK_PCI_VENDOR_ID, PEAK_PCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
- {PEAK_PCI_VENDOR_ID, PEAK_PCIE_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
- {PEAK_PCI_VENDOR_ID, PEAK_MPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
- {PEAK_PCI_VENDOR_ID, PEAK_MPCIE_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
- {PEAK_PCI_VENDOR_ID, PEAK_PC_104P_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
- {PEAK_PCI_VENDOR_ID, PEAK_PCI_104E_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
- {PEAK_PCI_VENDOR_ID, PEAK_CPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
- {PEAK_PCI_VENDOR_ID, PEAK_PCIE_OEM_ID, PCI_ANY_ID, PCI_ANY_ID,},
+ {
+ PEAK_PCI_VENDOR_ID, PEAK_PCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,
+ .driver_data = (kernel_ulong_t)"PCAN-PCI",
+ }, {
+ PEAK_PCI_VENDOR_ID, PEAK_PCIE_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,
+ .driver_data = (kernel_ulong_t)"PCAN-PCI Express",
+ }, {
+ PEAK_PCI_VENDOR_ID, PEAK_MPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,
+ .driver_data = (kernel_ulong_t)"PCAN-miniPCI",
+ }, {
+ PEAK_PCI_VENDOR_ID, PEAK_MPCIE_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,
+ .driver_data = (kernel_ulong_t)"PCAN-miniPCIe",
+ }, {
+ PEAK_PCI_VENDOR_ID, PEAK_PC_104P_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,
+ .driver_data = (kernel_ulong_t)"PCAN-PC/104-Plus Quad",
+ }, {
+ PEAK_PCI_VENDOR_ID, PEAK_PCI_104E_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,
+ .driver_data = (kernel_ulong_t)"PCAN-PCI/104-Express",
+ }, {
+ PEAK_PCI_VENDOR_ID, PEAK_CPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,
+ .driver_data = (kernel_ulong_t)"PCAN-cPCI",
+ }, {
+ PEAK_PCI_VENDOR_ID, PEAK_PCIE_OEM_ID, PCI_ANY_ID, PCI_ANY_ID,
+ .driver_data = (kernel_ulong_t)"PCAN-Chip PCIe",
+ },
#ifdef CONFIG_CAN_PEAK_PCIEC
- {PEAK_PCI_VENDOR_ID, PEAK_PCIEC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
- {PEAK_PCI_VENDOR_ID, PEAK_PCIEC34_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
+ {
+ PEAK_PCI_VENDOR_ID, PEAK_PCIEC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,
+ .driver_data = (kernel_ulong_t)"PCAN-ExpressCard",
+ }, {
+ PEAK_PCI_VENDOR_ID, PEAK_PCIEC34_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,
+ .driver_data = (kernel_ulong_t)"PCAN-ExpressCard 34",
+ },
#endif
- {0,}
+ { /* sentinel */ }
};
MODULE_DEVICE_TABLE(pci, peak_pci_tbl);
@@ -530,6 +556,7 @@ static int peak_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
void __iomem *cfg_base, *reg_base;
u16 sub_sys_id, icr;
int i, err, channels;
+ char fw_str[14] = "";
err = pci_enable_device(pdev);
if (err)
@@ -583,6 +610,21 @@ static int peak_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* Leave parport mux mode */
writeb(0x04, cfg_base + PITA_MISC + 3);
+ /* FPGA equipped card if not 0 */
+ if (readl(cfg_base + PEAK_VER_REG1)) {
+ /* FPGA card: display version of the running firmware */
+ u32 fw_ver = readl(cfg_base + PEAK_VER_REG2);
+
+ snprintf(fw_str, sizeof(fw_str), " FW v%u.%u.%u",
+ (fw_ver >> 12) & 0xf,
+ (fw_ver >> 8) & 0xf,
+ (fw_ver >> 4) & 0xf);
+ }
+
+ /* Display commercial name (and, eventually, FW version) of the card */
+ dev_info(&pdev->dev, "%ux CAN %s%s\n",
+ channels, (const char *)ent->driver_data, fw_str);
+
icr = readw(cfg_base + PITA_ICR + 2);
for (i = 0; i < channels; i++) {
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-06-16 10:28 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16 10:28 [RFC]: can-next 2021-06-16 - j1939, m_can, peak_pci Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 1/9] can: j1939: fix checkpatch warnings Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 2/9] can: j1939: replace fall through comment by fallthrough pseudo-keyword Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 3/9] can: j1939: j1939_session_completed(): use consistent name se_skb for the session skb Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 4/9] can: j1939: j1939_session_tx_dat(): use consistent name se_skcb for session skb control buffer Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 5/9] can: j1939: j1939_xtp_rx_dat_one(): use separate pointer " Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 6/9] can: m_can: remove support for custom bit timing Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 7/9] can: peak_pci: convert comments to network style comments Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 8/9] can: peak_pci: fix checkpatch warnings Marc Kleine-Budde
2021-06-16 10:28 ` [can-next-rfc 9/9] can: peak_pci: Add name and FW version of the card in kernel buffer Marc Kleine-Budde
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.