All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/16] Support for Eberspächer Flexcard DCAN function
@ 2013-09-09  7:24 Benedikt Spranger
  2013-09-09  7:24 ` [PATCH 01/16] c_can_platform: add FlexCard D-CAN support Benedikt Spranger
                   ` (16 more replies)
  0 siblings, 17 replies; 39+ messages in thread
From: Benedikt Spranger @ 2013-09-09  7:24 UTC (permalink / raw)
  To: netdev
  Cc: Alexander Frank, Sebastian Andrzej Siewior, Holger Dengler,
	Benedikt Spranger

The Eberspächer Flexcard is a multifunctional PCI Mezzanine Card. This
patch-series adds support for the DCAN function. The Flexcard supports
up too 8 CAN devices and has some CAN related special features:
- own FIFO per device
- DMA for receiving CAN frames
- Firmware tracks CAN echo packets

Benedikt Spranger (16):
  c_can_platform: add FlexCard D-CAN support
  c_can: add generic D-CAN RAM initialization support
  c_can: simplify arbitration register handling
  c_can: fix receive buffer configuration
  c_can: use 32 bit access for D_CAN
  c_can: consider set bittiming may fail
  c_can: reconfigre message objects after leaving init state
  c_can: Add FlexCard CAN TX fifo support
  c_can: expicit 32bit access on D_CAN to message buffer data register
  c_can: add 16bit align 32bit access functions
  c_can: stop netqueue if hardware is busy
  c_can: Add flag to disable automatic retransmission of CAN frames
  c_can: flexcard: add ioctl to reset FIFO message object
  flexcard: can: CAN local loopback using SKB pflags
  flexcard: can: Configure CAN loopback packages (TXACK)
  c_can: fix TX packet accounting

 drivers/net/can/c_can/c_can.c          | 383 ++++++++++++++++++++++++++-------
 drivers/net/can/c_can/c_can.h          |   8 +
 drivers/net/can/c_can/c_can_platform.c | 191 +++++++++++++++-
 include/uapi/linux/can/netlink.h       |   2 +
 include/uapi/linux/can/raw.h           |  20 ++
 net/can/raw.c                          |  22 +-
 6 files changed, 526 insertions(+), 100 deletions(-)

-- 
1.8.4.rc3

^ permalink raw reply	[flat|nested] 39+ messages in thread
* Re: [PATCH 05/16] c_can: use 32 bit access for D_CAN
@ 2013-11-16 16:37 T Thayer
  2013-11-24 19:07 ` Marc Kleine-Budde
  0 siblings, 1 reply; 39+ messages in thread
From: T Thayer @ 2013-11-16 16:37 UTC (permalink / raw)
  To: b.spranger, Marc Kleine-Budde, linux-can

Hi,

What is the status of this patch?

This fixes the problem I was seeing for the D_CAN portion of the
driver which was
1. Transmitting 2 copies (probably the result of an AutoRetry)
2. Triggering a RX IRQ on a transmit because the Message Object # was
assigned to RX.
3. CAN statistics were not incrementing properly.

I just joined this mailing list and I don't have this email in my
history so I'm copying it below.

Thanks,

TT

--------------- snipped -----------------

On 09/09/2013 09:25 AM, Benedikt Spranger wrote:
> Other than the C_CAN 16 bit memory interface the D_CAN uses a 32bit memory
> interface. This causes some trouble while accessing the IFxCMR register in
> two 16bit chunks. Use 32bit access on D_CAN.
>
> Signed-off-by: Benedikt Spranger <b.spranger <at> linutronix.de>
> ---
>  drivers/net/can/c_can/c_can.c | 56 +++++++++++++++++++++++++++----------------
>  1 file changed, 35 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
> index 886163f..b3cfb85 100644
> --- a/drivers/net/can/c_can/c_can.c
> +++ b/drivers/net/can/c_can/c_can.c
>  <at>  <at>  -262,11 +262,32  <at>  <at>  static inline int get_tx_echo_msg_obj(const struct c_can_priv *priv)
>
>  static u32 c_can_read_reg32(struct c_can_priv *priv, enum reg index)

What about introducing priv->{read,write}_reg32 function pointers?

>  {
> - u32 val = priv->read_reg(priv, index);
> - val |= ((u32) priv->read_reg(priv, index + 1)) << 16;
> + u32 val;
> +
> + if (priv->type == BOSCH_D_CAN || priv->type == BOSCH_D_CAN_FLEXCARD) {
> + val = readl(priv->base + priv->regs[index]);
> + } else {
> + val = priv->read_reg(priv, index);
> + val |= ((u32) priv->read_reg(priv, index + 1)) << 16;
> + }
>   return val;
>  }
>
> +static void c_can_writereg32(struct c_can_priv *priv, enum reg index,
> + u16 high, u16 low)
> +{

If we decide not to introduce read/write 32 bit function pointers,
please rename your function to c_can_write_reg32() to match the pattern
of the read_reg32() function.

As you have converted some of the potential users of write_reg32() to
work with a single 32 bit value instead of two 16 bits, I think it's
better to call this function with a single 32 bite value.

> + u32 val;
> +
> + if (priv->type == BOSCH_D_CAN || priv->type == BOSCH_D_CAN_FLEXCARD) {
> + val = high << 16;
> + val |= low;
> + writel(val, priv->base + priv->regs[index]);
> + } else {
> + priv->write_reg(priv, index + 1, high);
> + priv->write_reg(priv, index, low);
> + }
> +}
> +
>  static void c_can_enable_all_interrupts(struct c_can_priv *priv,
>   int enable)
>  {
>  <at>  <at>  -309,10 +330,8  <at>  <at>  static inline void c_can_object_get(struct net_device *dev,
>   * register and message RAM must be complete in 6 CAN-CLK
>   * period.
>   */
> - priv->write_reg(priv, C_CAN_IFACE(COMMSK_REG, iface),
> - IFX_WRITE_LOW_16BIT(mask));
> - priv->write_reg(priv, C_CAN_IFACE(COMREQ_REG, iface),
> - IFX_WRITE_LOW_16BIT(objno));
> + c_can_writereg32(priv, C_CAN_IFACE(COMREQ_REG, iface),
> + IFX_WRITE_LOW_16BIT(mask), IFX_WRITE_LOW_16BIT(objno));
>
>   if (c_can_msg_obj_is_busy(priv, iface))
>   netdev_err(dev, "timed out in object get\n");
>  <at>  <at>  -329,9 +348,8  <at>  <at>  static inline void c_can_object_put(struct net_device *dev,
>   * register and message RAM must be complete in 6 CAN-CLK
>   * period.
>   */
> - priv->write_reg(priv, C_CAN_IFACE(COMMSK_REG, iface),
> - (IF_COMM_WR | IFX_WRITE_LOW_16BIT(mask)));
> - priv->write_reg(priv, C_CAN_IFACE(COMREQ_REG, iface),
> + c_can_writereg32(priv, C_CAN_IFACE(COMREQ_REG, iface),
> + IF_COMM_WR | IFX_WRITE_LOW_16BIT(mask),
>   IFX_WRITE_LOW_16BIT(objno));
>
>   if (c_can_msg_obj_is_busy(priv, iface))
>  <at>  <at>  -496,23 +514,19  <at>  <at>  static void c_can_setup_receive_object(struct net_device *dev, int iface,
>  {
>   struct c_can_priv *priv = netdev_priv(dev);
>
> - priv->write_reg(priv, C_CAN_IFACE(MASK1_REG, iface),
> - IFX_WRITE_LOW_16BIT(mask));
> -
>   /* According to C_CAN documentation, the reserved bit
>   * in IFx_MASK2 register is fixed 1
>   */
> - priv->write_reg(priv, C_CAN_IFACE(MASK2_REG, iface),
> - IFX_WRITE_HIGH_16BIT(mask) | BIT(13));
> -
> + c_can_writereg32(priv, C_CAN_IFACE(MASK1_REG, iface),
> + IFX_WRITE_HIGH_16BIT(mask) | BIT(13),
> + IFX_WRITE_LOW_16BIT(mask));
>   id |= IF_ARB_MSGVAL;
> - priv->write_reg(priv, C_CAN_IFACE(ARB1_REG, iface),
> - IFX_WRITE_LOW_16BIT(id));
> - priv->write_reg(priv, C_CAN_IFACE(ARB2_REG, iface),
> - (IFX_WRITE_HIGH_16BIT(id)));
> + c_can_writereg32(priv, C_CAN_IFACE(ARB1_REG, iface),
> + IFX_WRITE_HIGH_16BIT(id), IFX_WRITE_LOW_16BIT(id));
> + c_can_writereg32(priv, C_CAN_IFACE(MSGCTRL_REG, iface), 0, mcont);
>
> - priv->write_reg(priv, C_CAN_IFACE(MSGCTRL_REG, iface), mcont);
> - c_can_object_put(dev, iface, objno, IF_COMM_ALL & ~IF_COMM_TXRQST);
> + c_can_object_put(dev, iface, objno, IF_COMM_WR | IF_COMM_MASK |
> + IF_COMM_ARB | IF_COMM_CONTROL | IF_COMM_CLR_INT_PND);

I think the last change is unrelated.

>
>   netdev_dbg(dev, "obj no:%d, msgval:0x%08x\n", objno,
>   c_can_read_reg32(priv, C_CAN_MSGVAL1_REG));
>

Marc

^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2013-11-24 19:08 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-09  7:24 [PATCH 00/16] Support for Eberspächer Flexcard DCAN function Benedikt Spranger
2013-09-09  7:24 ` [PATCH 01/16] c_can_platform: add FlexCard D-CAN support Benedikt Spranger
2013-09-09  8:22   ` Marc Kleine-Budde
2013-09-09  8:22   ` Marc Kleine-Budde
2013-09-09  7:24 ` [PATCH 02/16] c_can: add generic D-CAN RAM initialization support Benedikt Spranger
2013-09-09  8:34   ` Marc Kleine-Budde
2013-09-09  7:25 ` [PATCH 03/16] c_can: simplify arbitration register handling Benedikt Spranger
2013-09-09  9:16   ` Marc Kleine-Budde
2013-09-09  9:16   ` Marc Kleine-Budde
2013-09-09  7:25 ` [PATCH 04/16] c_can: fix receive buffer configuration Benedikt Spranger
2013-09-09 10:51   ` Marc Kleine-Budde
2013-09-09  7:25 ` [PATCH 05/16] c_can: use 32 bit access for D_CAN Benedikt Spranger
2013-09-09  9:37   ` Marc Kleine-Budde
2013-09-09  7:25 ` [PATCH 06/16] c_can: consider set bittiming may fail Benedikt Spranger
2013-09-09  9:39   ` Marc Kleine-Budde
2013-09-09  9:39   ` Marc Kleine-Budde
2013-09-09  7:25 ` [PATCH 07/16] c_can: reconfigre message objects after leaving init state Benedikt Spranger
2013-09-09  7:25 ` [PATCH 08/16] c_can: Add FlexCard CAN TX fifo support Benedikt Spranger
2013-09-09  9:47   ` Marc Kleine-Budde
2013-09-09  7:25 ` [PATCH 09/16] c_can: expicit 32bit access on D_CAN to message buffer data register Benedikt Spranger
2013-09-09 11:20   ` Marc Kleine-Budde
2013-09-09  7:25 ` [PATCH 10/16] c_can: add 16bit align 32bit access functions Benedikt Spranger
2013-09-09  9:57   ` Marc Kleine-Budde
2013-09-09  7:25 ` [PATCH 11/16] c_can: stop netqueue if hardware is busy Benedikt Spranger
2013-09-09 10:05   ` Marc Kleine-Budde
2013-09-09 10:21   ` Marc Kleine-Budde
2013-09-09  7:25 ` [PATCH 12/16] c_can: Add flag to disable automatic retransmission of CAN frames Benedikt Spranger
2013-09-09 10:21   ` Marc Kleine-Budde
2013-09-09 10:34     ` Marc Kleine-Budde
2013-09-09  7:25 ` [PATCH 13/16] c_can: flexcard: add ioctl to reset FIFO message object Benedikt Spranger
2013-09-09 10:24   ` Marc Kleine-Budde
2013-09-09  7:25 ` [PATCH 14/16] flexcard: can: CAN local loopback using SKB pflags Benedikt Spranger
2013-09-09  7:25 ` [PATCH 15/16] flexcard: can: Configure CAN loopback packages (TXACK) Benedikt Spranger
2013-09-09 10:29   ` Marc Kleine-Budde
2013-09-09  7:25 ` [PATCH 16/16] c_can: fix TX packet accounting Benedikt Spranger
2013-09-09 10:31   ` Marc Kleine-Budde
2013-09-09  7:54 ` [PATCH 00/16] Support for Eberspächer Flexcard DCAN function Marc Kleine-Budde
  -- strict thread matches above, loose matches on Subject: below --
2013-11-16 16:37 [PATCH 05/16] c_can: use 32 bit access for D_CAN T Thayer
2013-11-24 19:07 ` 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.