From: Wolfgang Grandegger <wg@grandegger.com>
To: Dan Murphy <dmurphy@ti.com>, mkl@pengutronix.de, davem@davemloft.net
Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 2/5] can: m_can: Migrate the m_can code to use the framework
Date: Thu, 28 Feb 2019 20:41:45 +0100 [thread overview]
Message-ID: <bae8adda-8cca-c865-d010-24084e13c2ce@grandegger.com> (raw)
In-Reply-To: <639f316a-1190-1e0e-0a1d-6008a1c332d7@ti.com>
Hello Dan,
Am 28.02.19 um 18:57 schrieb Dan Murphy:
> Wolfgang
>
> On 2/28/19 11:33 AM, Wolfgang Grandegger wrote:
>> Am 14.02.19 um 19:27 schrieb Dan Murphy:
>>> Migrate the m_can code to use the m_can_platform framework
>>> code.
>>>
>>> Signed-off-by: Dan Murphy <dmurphy@ti.com>
>>> ---
>>>
>>> v5 - Updated copyright, change m_can_classdev to m_can_priv, removed extra
>>> KCONFIG flag - https://lore.kernel.org/patchwork/patch/1033095/
>>>
>>> drivers/net/can/m_can/Kconfig | 8 +-
>>> drivers/net/can/m_can/Makefile | 1 +
>>> drivers/net/can/m_can/m_can.c | 745 ++++++++++++++++-----------------
>>> 3 files changed, 367 insertions(+), 387 deletions(-)
>>>
>>> diff --git a/drivers/net/can/m_can/Kconfig b/drivers/net/can/m_can/Kconfig
>>> index 04f20dd39007..66e31022a5fa 100644
>>> --- a/drivers/net/can/m_can/Kconfig
>>> +++ b/drivers/net/can/m_can/Kconfig
>>> @@ -1,5 +1,11 @@
>>> config CAN_M_CAN
>>> + tristate "Bosch M_CAN support"
>>> + ---help---
>>> + Say Y here if you want to support for Bosch M_CAN controller.
>>
>> Typo?
>>
>
> Maybe like you pointed out to update the help.
I was just not sure if it's correct English... but you know better!
>
>>> +
>>> +config CAN_M_CAN_PLATFORM
>>> + tristate "Bosch M_CAN support for io-mapped devices"
>>> depends on HAS_IOMEM
>>> - tristate "Bosch M_CAN devices"
>>> + depends on CAN_M_CAN
>>> ---help---
>>> Say Y here if you want to support for Bosch M_CAN controller.
>>
>> Please update the help.
>
> Ack
>>
>>> diff --git a/drivers/net/can/m_can/Makefile b/drivers/net/can/m_can/Makefile
>>> index 8bbd7f24f5be..057bbcdb3c74 100644
>>> --- a/drivers/net/can/m_can/Makefile
>>> +++ b/drivers/net/can/m_can/Makefile
>>> @@ -3,3 +3,4 @@
>>> #
>>>
>>> obj-$(CONFIG_CAN_M_CAN) += m_can.o
>>> +obj-$(CONFIG_CAN_M_CAN_PLATFORM) += m_can_platform.o
>>> diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
>>> index 9b449400376b..2ceccb870557 100644
>>> --- a/drivers/net/can/m_can/m_can.c
>>> +++ b/drivers/net/can/m_can/m_can.c
... snip ...
>>> @@ -924,6 +885,9 @@ static irqreturn_t m_can_isr(int irq, void *dev_id)
>>> }
>>> }
>>>
>>> + if (priv->ops->clr_dev_interrupts)
>>> + priv->ops->clr_dev_interrupts(priv);
>>
>> post_irq _handler?
>>
>
> I can clear them on entry as well
OK!
...snip...
>>> - niso_timeout = readl_poll_timeout((priv->base + M_CAN_CCCR), cccr_poll,
>>> - (cccr_poll == cccr_reg), 0, 10);
>>> + for (i = 0; i <= 10; i++) {
>>> + cccr_poll = m_can_read(priv, M_CAN_CCCR);
>>> + if (cccr_poll == cccr_reg)
>>> + niso_timeout = 0;
>>> + }
>>
>> There is no break and delay in the loop? What was the reason why you
>> can't use readl_poll_timeout()?
>>
>
> OK a break if NISO is supported then and probably could add a 1us delay original code on
> line 1232 had no delay but timeout at 10us.
>
> readl_poll_timeout is for iomapped devices. How would this work for peripherial devices?
Well, it takes much more time to read the register via SPI... maybe using
if (priv->is_peripherial) ...
to handle the different timings would make sense here.
>>>
>>> /* Clear NISO */
>>> cccr_reg &= ~(CCCR_NISO);
>>> @@ -1242,107 +1210,95 @@ static bool m_can_niso_supported(const struct m_can_priv *priv)
>>> return !niso_timeout;
>>> }
... snip...
>>> -static netdev_tx_t m_can_start_xmit(struct sk_buff *skb,
>>> - struct net_device *dev)
>>> +static void m_can_tx_handler(struct m_can_priv *priv)
>>> {
>>> - struct m_can_priv *priv = netdev_priv(dev);
>>> - struct canfd_frame *cf = (struct canfd_frame *)skb->data;
>>> + struct canfd_frame *cf = (struct canfd_frame *)priv->skb->data;
>>> + struct net_device *dev = priv->net;
>>> + struct sk_buff *skb = priv->skb;
>>
>> Maybe "tx_skb" is a clearer member name..
>
> Again this was named skb to minimize deltas from original code.
I mean "priv->tx_skb"!
> skb was passed into the start_xmit function and used throughout the function.
>
> Since there was little delta in this function I opt'd to keep the names as is.
>
Wolfgang.
next prev parent reply other threads:[~2019-02-28 19:41 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-14 18:27 [PATCH v5 0/5] M_CAN Framework re-write Dan Murphy
2019-02-14 18:27 ` [PATCH v5 1/5] can: m_can: Create a m_can platform framework Dan Murphy
2019-02-28 20:12 ` Wolfgang Grandegger
2019-02-28 20:18 ` Dan Murphy
2019-02-14 18:27 ` [PATCH v5 2/5] can: m_can: Migrate the m_can code to use the framework Dan Murphy
2019-02-28 17:33 ` Wolfgang Grandegger
2019-02-28 17:57 ` Dan Murphy
2019-02-28 19:41 ` Wolfgang Grandegger [this message]
2019-02-28 19:59 ` Dan Murphy
2019-02-14 18:27 ` [PATCH v5 3/5] can: m_can: Rename m_can_priv to m_can_classdev Dan Murphy
2019-02-14 18:27 ` [PATCH v5 4/5] dt-bindings: can: tcan4x5x: Add DT bindings for TCAN4x5X driver Dan Murphy
2019-02-14 18:27 ` [PATCH v5 5/5] can: tcan4x5x: Add tcan4x5x driver to the kernel Dan Murphy
2019-02-28 17:50 ` Wolfgang Grandegger
2019-02-28 18:03 ` Dan Murphy
2019-02-28 20:07 ` Wolfgang Grandegger
2019-02-28 20:14 ` Dan Murphy
2019-02-21 16:24 ` [PATCH v5 0/5] M_CAN Framework re-write Dan Murphy
2019-02-21 16:41 ` Wolfgang Grandegger
2019-02-22 9:38 ` Wolfgang Grandegger
2019-02-22 12:50 ` Dan Murphy
2019-02-22 17:05 ` Dan Murphy
2019-02-24 11:27 ` Wolfgang Grandegger
2019-02-28 15:39 ` Dan Murphy
2019-02-28 16:40 ` Wolfgang Grandegger
2019-02-28 16:44 ` Dan Murphy
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=bae8adda-8cca-c865-d010-24084e13c2ce@grandegger.com \
--to=wg@grandegger.com \
--cc=davem@davemloft.net \
--cc=dmurphy@ti.com \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).