From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Wolfgang Grandegger <wg@grandegger.com>
Cc: linux-can@vger.kernel.org, bhupesh.sharma@st.com, tomoya.rohm@gmail.com
Subject: Re: [RFC v2 3/7] c_can: use different sets of interface registers for rx and tx
Date: Fri, 30 Nov 2012 09:39:13 +0100 [thread overview]
Message-ID: <50B870B1.4050907@pengutronix.de> (raw)
In-Reply-To: <1354199987-10350-4-git-send-email-wg@grandegger.com>
[-- Attachment #1: Type: text/plain, Size: 4953 bytes --]
On 11/29/2012 03:39 PM, Wolfgang Grandegger wrote:
> To avoid conflicts between CPU access to the message RAM we now
> use the first set of interface registers for RX and the second
> for TX.
>
> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
> ---
> drivers/net/can/c_can/c_can.c | 37 ++++++++++++++++++++++---------------
> 1 file changed, 22 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
> index 3ae356f..27e45e6 100644
> --- a/drivers/net/can/c_can/c_can.c
> +++ b/drivers/net/can/c_can/c_can.c
> @@ -158,6 +158,10 @@
> #define C_CAN_NEXT_MSG_OBJ_MASK (C_CAN_MSG_OBJ_TX_NUM - 1)
> #define RECEIVE_OBJECT_BITS 0x0000ffff
>
> +/* message interface used for rx and tx */
> +#define IFACE_RX 0
> +#define IFACE_TX 1
Can you give these defines a common C_CAN_ prefix? And you can make them
an enum and change the signature of the function you're changing below.
Marc
> +
> /* status interrupt */
> #define STATUS_INTERRUPT 0x8000
>
> @@ -544,7 +548,7 @@ static netdev_tx_t c_can_start_xmit(struct sk_buff *skb,
> msg_obj_no = get_tx_next_msg_obj(priv);
>
> /* prepare message object for transmission */
> - c_can_write_msg_object(dev, 0, frame, msg_obj_no);
> + c_can_write_msg_object(dev, IFACE_TX, frame, msg_obj_no);
> can_put_echo_skb(skb, dev, msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST);
>
> /*
> @@ -606,16 +610,18 @@ static void c_can_configure_msg_objects(struct net_device *dev)
> int i;
>
> /* first invalidate all message objects */
> - for (i = C_CAN_MSG_OBJ_RX_FIRST; i <= C_CAN_NO_OF_OBJECTS; i++)
> - c_can_inval_msg_object(dev, 0, i);
> + for (i = C_CAN_MSG_OBJ_RX_FIRST; i <= C_CAN_MSG_OBJ_RX_LAST; i++)
> + c_can_inval_msg_object(dev, IFACE_RX, i);
> + for (i = C_CAN_MSG_OBJ_TX_FIRST; i <= C_CAN_MSG_OBJ_TX_LAST; i++)
> + c_can_inval_msg_object(dev, IFACE_TX, i);
>
> /* setup receive message objects */
> for (i = C_CAN_MSG_OBJ_RX_FIRST; i < C_CAN_MSG_OBJ_RX_LAST; i++)
> - c_can_setup_receive_object(dev, 0, i, 0, 0,
> + c_can_setup_receive_object(dev, IFACE_RX, i, 0, 0,
> (IF_MCONT_RXIE | IF_MCONT_UMASK) & ~IF_MCONT_EOB);
>
> - c_can_setup_receive_object(dev, 0, C_CAN_MSG_OBJ_RX_LAST, 0, 0,
> - IF_MCONT_EOB | IF_MCONT_RXIE | IF_MCONT_UMASK);
> + c_can_setup_receive_object(dev, IFACE_RX, C_CAN_MSG_OBJ_RX_LAST,
> + 0, 0, IF_MCONT_EOB | IF_MCONT_RXIE | IF_MCONT_UMASK);
> }
>
> /*
> @@ -748,10 +754,10 @@ static void c_can_do_tx(struct net_device *dev)
> can_get_echo_skb(dev,
> msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST);
> stats->tx_bytes += priv->read_reg(priv,
> - C_CAN_IFACE(MSGCTRL_REG, 0))
> + C_CAN_IFACE(MSGCTRL_REG, IFACE_TX))
> & IF_MCONT_DLC_MASK;
> stats->tx_packets++;
> - c_can_inval_msg_object(dev, 0, msg_obj_no);
> + c_can_inval_msg_object(dev, IFACE_TX, msg_obj_no);
> } else {
> break;
> }
> @@ -801,16 +807,17 @@ static int c_can_do_rx_poll(struct net_device *dev, int quota)
> * message object n, we need to handle the same properly.
> */
> if (val & (1 << (msg_obj - 1))) {
> - c_can_object_get(dev, 0, msg_obj, IF_COMM_ALL &
> + c_can_object_get(dev, IFACE_RX, msg_obj, IF_COMM_ALL &
> ~IF_COMM_TXRQST);
> msg_ctrl_save = priv->read_reg(priv,
> - C_CAN_IFACE(MSGCTRL_REG, 0));
> + C_CAN_IFACE(MSGCTRL_REG, IFACE_RX));
>
> if (msg_ctrl_save & IF_MCONT_EOB)
> return num_rx_pkts;
>
> if (msg_ctrl_save & IF_MCONT_MSGLST) {
> - c_can_handle_lost_msg_obj(dev, 0, msg_obj);
> + c_can_handle_lost_msg_obj(dev, IFACE_RX,
> + msg_obj);
> num_rx_pkts++;
> quota--;
> continue;
> @@ -820,19 +827,19 @@ static int c_can_do_rx_poll(struct net_device *dev, int quota)
> continue;
>
> /* read the data from the message object */
> - c_can_read_msg_object(dev, 0, msg_ctrl_save);
> + c_can_read_msg_object(dev, IFACE_RX, msg_ctrl_save);
>
> if (msg_obj < C_CAN_MSG_RX_LOW_LAST)
> - c_can_mark_rx_msg_obj(dev, 0,
> + c_can_mark_rx_msg_obj(dev, IFACE_RX,
> msg_ctrl_save, msg_obj);
> else if (msg_obj > C_CAN_MSG_RX_LOW_LAST)
> /* activate this msg obj */
> - c_can_activate_rx_msg_obj(dev, 0,
> + c_can_activate_rx_msg_obj(dev, IFACE_RX,
> msg_ctrl_save, msg_obj);
> else if (msg_obj == C_CAN_MSG_RX_LOW_LAST)
> /* activate all lower message objects */
> c_can_activate_all_lower_rx_msg_obj(dev,
> - 0, msg_ctrl_save);
> + IFACE_RX, msg_ctrl_save);
>
> num_rx_pkts++;
> quota--;
>
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 261 bytes --]
next prev parent reply other threads:[~2012-11-30 8:39 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-29 14:39 [RFC v2 0/7] pch_can/c_can: fix races and add PCH support to c_can Wolfgang Grandegger
2012-11-29 14:39 ` [RFC v2 1/7] pch_can: add spinlocks to protect tx objects Wolfgang Grandegger
2012-11-29 14:39 ` [RFC v2 2/7] c_can: rename callback "initram" to "init" to more general usage Wolfgang Grandegger
2012-12-03 14:20 ` Alexander Stein
2012-12-03 14:32 ` Wolfgang Grandegger
2012-11-29 14:39 ` [RFC v2 3/7] c_can: use different sets of interface registers for rx and tx Wolfgang Grandegger
2012-11-30 8:39 ` Marc Kleine-Budde [this message]
2012-11-30 9:15 ` Wolfgang Grandegger
2012-11-29 14:39 ` [RFC v2 4/7] c_can_pci: introduce board specific PCI bar Wolfgang Grandegger
2012-11-30 8:45 ` Marc Kleine-Budde
2012-11-30 9:11 ` Wolfgang Grandegger
2012-11-30 9:19 ` Marc Kleine-Budde
2012-11-29 14:39 ` [RFC v2 5/7] c_can_pci: enable PCI bus master only for MSI Wolfgang Grandegger
2012-11-30 8:54 ` Marc Kleine-Budde
2012-11-29 14:39 ` [RFC v2 6/7] c_can_pci: add support for PCH CAN on Intel EG20T PCH Wolfgang Grandegger
2012-11-29 14:39 ` [RFC v2 7/7] c_can: add spinlock to protect tx and rx objects Wolfgang Grandegger
2012-12-05 12:09 ` [RFC v2 0/7] pch_can/c_can: fix races and add PCH support to c_can Alexander Stein
2012-12-05 12:50 ` Wolfgang Grandegger
2012-12-05 14:46 ` Alexander Stein
2012-12-05 17:35 ` Wolfgang Grandegger
2012-12-05 21:52 ` Marc Kleine-Budde
2012-12-06 7:09 ` Wolfgang Grandegger
2012-12-06 8:35 ` Marc Kleine-Budde
2012-12-06 8:17 ` Wolfgang Grandegger
2012-12-06 13:38 ` Alexander Stein
2012-12-06 14:02 ` Marc Kleine-Budde
2012-12-06 14:31 ` Wolfgang Grandegger
2012-12-06 14:37 ` Marc Kleine-Budde
2012-12-06 14:56 ` Alexander Stein
2012-12-06 15:15 ` Wolfgang Grandegger
2012-12-06 15:27 ` Wolfgang Grandegger
2012-12-06 15:55 ` Alexander Stein
2012-12-06 17:14 ` Alexander Stein
2012-12-06 23:34 ` Marc Kleine-Budde
2012-12-07 9:26 ` Wolfgang Grandegger
2012-12-07 9:55 ` Marc Kleine-Budde
2012-12-07 10:00 ` Bhupesh SHARMA
2012-12-07 10:09 ` Marc Kleine-Budde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50B870B1.4050907@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=bhupesh.sharma@st.com \
--cc=linux-can@vger.kernel.org \
--cc=tomoya.rohm@gmail.com \
--cc=wg@grandegger.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.