Topcliff: Update PCH_CAN driver to 2.6.35
Subsystems (3)
PATCH 1/1 Topcliff: Update PCH_CAN driver to 2.6.35
CAN driver of Topcliff PCH
Topcliff PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in Topcliff PCH are actually devices sitting on AMBA bus. Topcliff PCH has CAN I/F. This driver enables CAN function.
--- drivers/net/can/Kconfig | 8 + drivers/net/can/Makefile | 1 + drivers/net/can/pch_can.c | 4076 +++++++++++++++++++++++++++++++++++++++++++++ drivers/net/can/pch_can.h | 435 +++++ 4 files changed, 4520 insertions(+), 0 deletions(-) create mode 100644 drivers/net/can/pch_can.c create mode 100644 drivers/net/can/pch_can.h
drivers/net/can/Kconfig +8 -0
@@ -73,6 +73,14 @@ config CAN_JANZ_ICAN3 This driver can also be built as a module. If so, the module will be called janz-ican3.ko. +config PCH_CAN + tristate "PCH CAN" + depends on CAN_DEV + ---help--- + This driver is for PCH CAN of Topcliff which is an IOH for x86 + embedded processor. + This driver can access CAN bus. + source "drivers/net/can/mscan/Kconfig" source "drivers/net/can/sja1000/Kconfig"
drivers/net/can/Makefile +1 -0
@@ -16,5 +16,6 @@ obj-$(CONFIG_CAN_TI_HECC) += ti_hecc.o obj-$(CONFIG_CAN_MCP251X) += mcp251x.o obj-$(CONFIG_CAN_BFIN) += bfin_can.o obj-$(CONFIG_CAN_JANZ_ICAN3) += janz-ican3.o +obj-$(CONFIG_PCH_CAN) += pch_can.o ccflags-$(CONFIG_CAN_DEBUG_DEVICES) := -DDEBUG
drivers/net/can/pch_can.c new file +4076 -0
2,980 lines not on this page · raw message
drivers/net/can/pch_can.h new file +435 -0
435 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
-- 1.6.0.6
_______________________________________________
MeeGo-dev mailing list
[email protected]
http://lists.meego.com/listinfo/meego-dev
Part of the diff is not shown here. View the raw message.
A message that is not in the archive (sent off-list or not yet received): 4C61EDE5.4030505-ECg8zkTtlr0C6LszWs/[email protected]
Hi,
2010/8/11 Masayuki Ohtak <masa-korg-ECg8zkTtlr0C6LszWs/[email protected]>:
Quoted 8 lines
CAN driver of Topcliff PCH
Topcliff PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in Topcliff PCH are actually devices sitting on AMBA bus. Topcliff PCH has CAN I/F. This driver enables CAN function.
I have a few questions:
1. Is your code based on Intel's CAN EP80579 ([1]) ?
2. Why don't you use kernel existing kfifo infrastructure? ([2]).
3. Can you provide a pointer to Topcliff PCH CAN I/F datasheet ?
thanks,
Daniel.
[1] http://www.intel.com/design/intarch/ep80579/sw_tools.htm
[2] http://lxr.linux.no/#linux+v2.6.35/kernel/kfifo.c
Quoted 19 lines
-----Original Message-----
From: Daniel Baluta [mailto:[email protected]]
Sent: Wednesday, August 11, 2010 6:37 PM
To: Masayuki Ohtak
Cc: [email protected]; Wolfgang Grandegger; [email protected]; [email protected]; Khor, Andrew Chih Howe; [email protected]; [email protected]; Wang, Qi; Wang, Yong Y
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: UpdatePCH_CANdriver to 2.6.35Hi,
2010/8/11 Masayuki Ohtak <[email protected]>:
Quoted 7 lines
CAN driver of Topcliff PCH
Topcliff PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in Topcliff PCH are actually devices sitting on AMBA bus. Topcliff PCH has CAN I/F. This driver enables CAN function.
Quoted 5 lines
Quoted 1 line
Signed-off-by Masayuki Ohtake <[email protected]>I have a few questions:
1. Is your code based on Intel's CAN EP80579 ([1]) ?
No.
Quoted 1 line
2. Why don't you use kernel existing kfifo infrastructure? ([2]).
Just take a look at kfifo.h. This structure has been changed. I remembered there was a spin_lock from kfifo previously. Currently it's been removed, good. OKI-sans, would you please take a look at ./include/linux/kfifo.h, and try to use this structure and APIs?
Daniel,
We're anxious to integrate those codes now. Perhaps it'll take us quite a long time to use kfifo. How about implementing it with the next version?
Best Regards,
Qi.
Quoted 1 line
3. Can you provide a pointer to Topcliff PCH CAN I/F datasheet ?
Currently this datasheet isn't open.
Quoted 6 lines
thanks,
Daniel.[1] http://www.intel.com/design/intarch/ep80579/sw_tools.htm
[2] http://lxr.linux.no/#linux+v2.6.35/kernel/kfifo.c
Quoted 31 lines · Qi
Quoted 19 lines
-----Original Message-----
From: Daniel Baluta [mailto:[email protected]]
Sent: Wednesday, August 11, 2010 6:37 PM
To: Masayuki Ohtak
Cc: [email protected]; Wolfgang Grandegger; [email protected]; [email protected]; Khor, Andrew Chih Howe; [email protected]; [email protected]; Wang, Qi; Wang, Yong Y
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: UpdatePCH_CANdriver to 2.6.35Hi,
2010/8/11 Masayuki Ohtak <[email protected]>:
Quoted 7 lines
CAN driver of Topcliff PCH
Topcliff PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in Topcliff PCH are actually devices sitting on AMBA bus. Topcliff PCH has CAN I/F. This driver enables CAN function.
Quoted 5 lines
Quoted 1 line
Signed-off-by Masayuki Ohtake <[email protected]>I have a few questions:
1. Is your code based on Intel's CAN EP80579 ([1]) ?
No.
Quoted 1 line
2. Why don't you use kernel existing kfifo infrastructure? ([2]).
Just take a look at
kfifo.h. This structure has been changed. I
remembered there was aspin_lockfrom kfifo previously. Currently it's
been removed, good.
OKI-sans, would you please take a look at./include/linux/kfifo.h, and try to use this structure and APIs?
Quoted 5 lines
Daniel,
We're anxious to integrate those codes now. Perhaps it'll take us quite a long time to use kfifo. How about implementing it with the next version?
What do you mean by this? Code isn't merged into the tree unless it is correct. Please fix this now, it's not that big of a deal.
Quoted 2 lines
Quoted 1 line
3. Can you provide a pointer to Topcliff PCH CAN I/F datasheet ?
Currently this datasheet isn't open.
Even under NDA? The Linux foundation offers a service to allow developers access to data sheets so that they can do kernel development and code review.
thanks,
greg k-h
Quoted 44 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Thursday, August 12, 2010 10:04 AM
To: Wang, Qi
Cc: Daniel Baluta; Masayuki Ohtak; [email protected]; Wolfgang Grandegger; [email protected]; [email protected]; Khor, Andrew Chih Howe; [email protected]; Wang, Yong Y
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: UpdatePCH_CANdriver to 2.6.35Quoted 6 lines · Qi
Quoted 6 lines
-----Original Message-----
From: Daniel Baluta [mailto:[email protected]]
Sent: Wednesday, August 11, 2010 6:37 PM
To: Masayuki Ohtak
Cc: [email protected]; Wolfgang Grandegger; [email protected]; [email protected]; Khor, AndrewChih
Quoted 2 lines
Quoted 2 lines
Howe; [email protected]; [email protected]; Wang, Qi; Wang, Yong Y
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: UpdatePCH_CANdriver to2.6.35
Quoted 15 lines
Quoted 15 lines
Hi,
2010/8/11 Masayuki Ohtak <[email protected]>:
Quoted 8 lines
CAN driver of Topcliff PCH
Topcliff PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in Topcliff PCH are actually devices sitting on AMBA bus. Topcliff PCH has CAN I/F. This driver enables CAN function.
Signed-off-by Masayuki Ohtake <[email protected]>I have a few questions:
Quoted 7 lines
Quoted 1 line
1. Is your code based on Intel's CAN EP80579 ([1]) ?
No.
Quoted 1 line
2. Why don't you use kernel existing kfifo infrastructure? ([2]).
Just take a look at
kfifo.h. This structure has been changed. I remembered there was aspin_lockfrom kfifo previously. Currently it's been removed, good.
OKI-sans, would you please take a look at./include/linux/kfifo.h, and try touse this structure and APIs?
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Daniel,
We're anxious to integrate those codes now. Perhaps it'll take us quite a long time to use kfifo. How about implementing it with the next version?
What do you mean by this? Code isn't merged into the tree unless it is correct. Please fix this now, it's not that big of a deal.
Hi Ohtak-san,
Would you please use kfifo structure? It'll take you some time to study it, but it's a good structure.
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
3. Can you provide a pointer to Topcliff PCH CAN I/F datasheet ?
Currently this datasheet isn't open.
Even under NDA? The Linux foundation offers a service to allow developers access to data sheets so that they can do kernel development and code review.
Hi Andrew,
Can ECG share those datasheet to the open source? Only with that datasheet, the upstream can review the source codes from OKI.
Best Regards,
Qi
Quoted 4 lines
thanks,
greg k-h
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Greg KH
Quoted 6 lines · Qi
Quoted 1 line
2. Why don't you use kernel existing kfifo infrastructure? ([2]).
Just take a look at
kfifo.h. This structure has been changed. I
remembered there was aspin_lockfrom kfifo previously. Currently it's
been removed, good.
OKI-sans, would you please take a look at./include/linux/kfifo.h, and try to use this structure and APIs?
Quoted 9 lines
Quoted 5 lines
Daniel,
We're anxious to integrate those codes now. Perhaps it'll take us quite a long time to use kfifo. How about implementing it with the next version?
What do you mean by this? Code isn't merged into the tree unless it is correct. Please fix this now, it's not that big of a deal.
Hello Qi,
i generally wonder what this FIFO is used for??
For me it looks like a artifact from a former chardev implementation, as several other code sniplets do (see comments from Wolfgang and Marc).
The network driver model is used for CAN drivers and therefore all the infrastructure for queueing inbound and outbound network traffic should be used from the Kernel like all other CAN drivers and all other ethernet drivers do.
Additionally there is a powerful infrastructure to support the special functions of CAN netdevices (like setting of bittimings, listen-only modes, or to produce CAN driver states etc.), that's part of the CAN drivers in drivers/net/can/ since it has gone mainline.
CAN netdevices are intentionally dumb (like the original ethernet adapters). This allows a simple driver interface between the kernel and the hardware driver, e.g. for queueing CAN frames. CAN drivers don't use any hardware rx-filtering(!) due to multiuser requirements and it's a vital requirement that the frames are not re-ordered on sending (by the 'some magic' CAN controller dealing with CAN-ID priorities, e.g. see tx-path in the MSCAN driver).
Quoted 1 line
From my perspective about 70% of your code is obsolete, as you implemented
tricky details (like FIFOs, bittiming tables or magic filter handlings), that's not needed at all.
Please take a look at the SJA1000 driver (for a low complex CAN controller) or at the TI driver (for a higher complex CAN controller) how these drivers handle the specialties of each hardware. And read some documentation in Documentation/networking/can.txt to get an impression about the concepts of the CAN implementation in the Linux Kernel and the CAN netdevices.
I strongly assume that your driver would be about 30 kBytes of code fitting into a single c-file like the ti_hecc.c does. And that's definitely easier for us to review and easier for you to maintain in the future ...
Thanks & best regards,
Oliver
Quoted 64 lines
-----Original Message-----
From: Oliver Hartkopp [mailto:[email protected]]
Sent: Thursday, August 12, 2010 2:26 PM
To: Wang, Qi
Cc: Greg KH; Daniel Baluta; Masayuki Ohtak; [email protected]; Wolfgang Grandegger; [email protected]; [email protected]; Khor, Andrew Chih Howe; [email protected]; Wang, Yong Y
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: UpdatePCH_CANdriver to 2.6.35Quoted 7 lines · Greg KH
Quoted 5 lines · Qi
Quoted 1 line
2. Why don't you use kernel existing kfifo infrastructure? ([2]).
Just take a look at
kfifo.h. This structure has been changed. I remembered there was aspin_lockfrom kfifo previously. Currently it's been removed, good.
OKI-sans, would you please take a look at./include/linux/kfifo.h, and try touse this structure and APIs?
Quoted 10 lines
Quoted 6 lines
Daniel,
We're anxious to integrate those codes now. Perhaps it'll take us quite a long time to use kfifo. How about implementing it with the next version?
What do you mean by this? Code isn't merged into the tree unless it is correct. Please fix this now, it's not that big of a deal.
Hello Qi,
i generally wonder what this FIFO is used for??
For me it looks like a artifact from a former chardev implementation, as several other code sniplets do (see comments from Wolfgang and Marc).
The network driver model is used for CAN drivers and therefore all the infrastructure for queueing inbound and outbound network traffic should be used from the Kernel like all other CAN drivers and all other ethernet drivers do.
Additionally there is a powerful infrastructure to support the special functions of CAN netdevices (like setting of bittimings, listen-only modes, or to produce CAN driver states etc.), that's part of the CAN drivers in
drivers/net/can/since it has gone mainline.CAN netdevices are intentionally dumb (like the original ethernet adapters). This allows a simple driver interface between the kernel and the hardware driver, e.g. for queueing CAN frames. CAN drivers don't use any hardware rx-filtering(!) due to multiuser requirements and it's a vital requirement that the frames are not re-ordered on sending (by the 'some magic' CAN controller dealing with CAN-ID priorities, e.g. see tx-path in the MSCAN driver).
From my perspective about 70% of your code is obsolete, as you implemented tricky details (like FIFOs, bittiming tables or magic filter handlings), that's not needed at all.
Please take a look at the SJA1000 driver (for a low complex CAN controller) or at the TI driver (for a higher complex CAN controller) how these drivers handle the specialties of each hardware. And read some documentation in
Documentation/networking/can.txtto get an impression about the concepts of the CAN implementation in the Linux Kernel and the CAN netdevices.
Quoted 6 lines
I strongly assume that your driver would be about 30 kBytes of code fitting into a single c-file like the
ti_hecc.cdoes. And that's definitely easier for us to review and easier for you to maintain in the future ...Thanks & best regards,
Oliver
Thank you for your commits.
Hi Qi-san
Quoted 1 line
OKI-sans, would you please take a look at
./include/linux/kfifo.h, and try to use this structure and APIs?
Thank you for your answer.
We will start doing the above next week.
Thanks, Ohtake
----- Original Message -----
From: "Wang, Qi" <[email protected]>
To: "Daniel Baluta" <[email protected]>; "Masayuki Ohtak" <[email protected]>
Cc: <[email protected]>; "Wolfgang Grandegger" <[email protected]>; <[email protected]>; <[email protected]>; "Khor, Andrew Chih Howe" <[email protected]>; <[email protected]>; <[email protected]>; "Wang, Yong Y" <[email protected]>
Sent: Thursday, August 12, 2010 10:42 AM
Subject: RE: [MeeGo-Dev][PATCH] Topcliff: Update PCH_CAN driver to 2.6.35
Quoted 19 lines
Quoted 19 lines
-----Original Message-----
From: Daniel Baluta [mailto:[email protected]]
Sent: Wednesday, August 11, 2010 6:37 PM
To: Masayuki Ohtak
Cc: [email protected]; Wolfgang Grandegger; [email protected]; [email protected]; Khor, Andrew Chih Howe; [email protected]; [email protected]; Wang, Qi; Wang, Yong Y
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: UpdatePCH_CANdriver to 2.6.35Hi,
2010/8/11 Masayuki Ohtak <[email protected]>:
Quoted 7 lines
CAN driver of Topcliff PCH
Topcliff PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in Topcliff PCH are actually devices sitting on AMBA bus. Topcliff PCH has CAN I/F. This driver enables CAN function.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Masayuki Ohtake <[email protected]>I have a few questions:
1. Is your code based on Intel's CAN EP80579 ([1]) ?
No.
Quoted 1 line
2. Why don't you use kernel existing kfifo infrastructure? ([2]).
Just take a look at
kfifo.h. This structure has been changed. I remembered there was aspin_lockfrom kfifo
previously. Currently it's been removed, good.
Quoted 5 lines
OKI-sans, would you please take a look at
./include/linux/kfifo.h, and try to use this structure and APIs?Daniel,
We're anxious to integrate those codes now. Perhaps it'll take us quite a long time to use kfifo. How about
implementing it with the next version?
Quoted 13 lines
Best Regards,
Qi.Quoted 1 line
3. Can you provide a pointer to Topcliff PCH CAN I/F datasheet ?
Currently this datasheet isn't open.
Quoted 6 lines
thanks,
Daniel.[1] http://www.intel.com/design/intarch/ep80579/sw_tools.htm
[2] http://lxr.linux.no/#linux+v2.6.35/kernel/kfifo.c
A message that is not in the archive (sent off-list or not yet received): D5AB6E638E5A3E4B8F4406B113A5A19A28EA26EB-QQHDSDV1ERZpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org
Quoted 2 lines
Quoted 1 line
1. Is your code based on Intel's CAN EP80579 ([1]) ?
No.
I want in the near future to write a Socket-CAN based driver for CAN EP80579. As far as I've seen from your implementation there are a lot of similarities between these
two drivers. Perhaps we can built a core part to both benefit from it.
Quoted 2 lines
Quoted 1 line
2. Why don't you use kernel existing kfifo infrastructure? ([2]).
Just take a look at
kfifo.h. This structure has been changed. I remembered there was aspin_lockfrom kfifo previously. Currently it's been removed, good.
Inded, the kfifo infrastructure has suffered great reworkings in the latest kernel versions, but this
is not an excuse to not use it.
Quoted 5 lines
OKI-sans, would you please take a look at
./include/linux/kfifo.h, and try to use this structure and APIs?Daniel,
We're anxious to integrate those codes now. Perhaps it'll take us quite a long time to use kfifo. How about implementing it with the next version?
In my opinion, as it looks now your code will never be accepted by the SocketCAN maintainers.
thanks,
Daniel.
Quoted 19 lines · Qi
Quoted 19 lines
-----Original Message-----
From: Daniel Baluta [mailto:[email protected]]
Sent: Wednesday, August 11, 2010 6:37 PM
To: Masayuki Ohtak
Cc: [email protected]; Wolfgang Grandegger; [email protected]; [email protected]; Khor, Andrew Chih Howe; [email protected]; arjan-VuQAYsv1563Yd54FQh9/[email protected]; Wang, Qi; Wang, Yong Y
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: UpdatePCH_CANdriver to 2.6.35Hi,
2010/8/11 Masayuki Ohtak <masa-korg-ECg8zkTtlr0C6LszWs/[email protected]>:
Quoted 7 lines
CAN driver of Topcliff PCH
Topcliff PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in Topcliff PCH are actually devices sitting on AMBA bus. Topcliff PCH has CAN I/F. This driver enables CAN function.
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
I have a few questions:
1. Is your code based on Intel's CAN EP80579 ([1]) ?
No.
For curiosity, is the controller similar to the OKI MSM9225 or ML9620?
Quoted 3 lines
Quoted 1 line
2. Why don't you use kernel existing kfifo infrastructure? ([2]).
Just take a look at
kfifo.h. This structure has been changed. I remembered there was aspin_lockfrom kfifo previously. Currently it's been removed, good. OKI-sans, would you please take a look at./include/linux/kfifo.h, and try to use this structure and APIs?
As I see it, the code related to that fifo is not used (== dead code)?
Quoted 3 lines
Daniel,
We're anxious to integrate those codes now. Perhaps it'll take us quite a long time to use kfifo. How about implementing it with the next version?
See above. What do you mean with the next version. The driver posted by Masayuki is far away from being accepted as it does not yet comply with the Socket-CAN driver API, to say the least.
Wolfgang.
Quoted 30 lines
-----Original Message-----
From: Wolfgang Grandegger [mailto:[email protected]]
Sent: Thursday, August 12, 2010 5:04 PM
To: Wang, Qi
Cc: Daniel Baluta; Masayuki Ohtak; [email protected]; [email protected]; [email protected]; Khor, Andrew Chih Howe; [email protected]; [email protected]; Wang, Yong Y
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: UpdatePCH_CANdriver to 2.6.35Quoted 6 lines · Qi
Quoted 6 lines
-----Original Message-----
From: Daniel Baluta [mailto:[email protected]]
Sent: Wednesday, August 11, 2010 6:37 PM
To: Masayuki Ohtak
Cc: [email protected]; Wolfgang Grandegger; [email protected]; [email protected]; Khor, AndrewChih
Quoted 13 lines
Quoted 13 lines
Howe; [email protected]; [email protected]; Wang, Qi; Wang, Yong Y
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: UpdatePCH_CANdriver to 2.6.35Hi,
2010/8/11 Masayuki Ohtak <[email protected]>:
Quoted 7 lines
CAN driver of Topcliff PCH
Topcliff PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in Topcliff PCH are actually devices sitting on AMBA bus. Topcliff PCH has CAN I/F. This driver enables CAN function.
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Masayuki Ohtake <[email protected]>I have a few questions:
1. Is your code based on Intel's CAN EP80579 ([1]) ?
No.
For curiosity, is the controller similar to the OKI MSM9225 or ML9620?
The Topcliff IOH is developed by OKI actually.
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
2. Why don't you use kernel existing kfifo infrastructure? ([2]).
Just take a look at
kfifo.h. This structure has been changed. I rememberedthere was a
spin_lockfrom kfifo previously. Currently it's been removed, good.Quoted 1 line
OKI-sans, would you please take a look at
./include/linux/kfifo.h, and try touse this structure and APIs?
As I see it, the code related to that fifo is not used (== dead code)?
I'm not familiar with kfifo structure, and I didn't like it because there need a spin_lock to use it.
Quoted 9 lines
Quoted 4 lines
Daniel,
We're anxious to integrate those codes now. Perhaps it'll take us quite a long
time to use kfifo. How about implementing it with the next version?
See above. What do you mean with the next version. The driver posted by Masayuki is far away from being accepted as it does not yet comply with the Socket-CAN driver API, to say the least.
I've few experience on CAN driver and it's also the first time for OKI-san to write Can driver. Would you please give us a reference and we'll follow it up. We only read 'can.txt' from kernel document. Thank you for your help in advance.
Quoted 2 lines
Wolfgang.
A message that is not in the archive (sent off-list or not yet received): D5AB6E638E5A3E4B8F4406B113A5A19A28EA2AB1-QQHDSDV1ERZpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org
Hi,
Quoted 1 line
I'm not familiar with kfifo structure, and I didn't like it because there need a
spin_lockto use it.
It seems that you don't need to use your own kfifo. Socket-CAN core has it's internal queues, you only have to fit in this infrastructure.
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines
Daniel,
We're anxious to integrate those codes now. Perhaps it'll take us quite a long
time to use kfifo. How about implementing it with the next version?
See above. What do you mean with the next version. The driver posted by Masayuki is far away from being accepted as it does not yet comply with the Socket-CAN driver API, to say the least.
I've few experience on CAN driver and it's also the first time for OKI-san to write Can driver. Would you please give us a reference and we'll follow it up. We only read 'can.txt' from kernel document. Thank you for your help in advance.
Oliver's email should be your starting point. Read the code from net/can and see how other drivers are built.
As I previously said I'm interested in writing a driver for CAN EP80579 controller,
but the start is pretty slow. Since your controller seems to be pretty similar we
can do some things in common.
I can help you, if you send me a pointer to your CAN controller datasheet + eventually
grant me access to your repo.
thanks,
Daniel.
Quoted 52 lines · Qi
Quoted 30 lines
-----Original Message-----
From: Wolfgang Grandegger [mailto:[email protected]]
Sent: Thursday, August 12, 2010 5:04 PM
To: Wang, Qi
Cc: Daniel Baluta; Masayuki Ohtak; [email protected]; [email protected]; [email protected]; Khor, Andrew Chih Howe; [email protected]; arjan-VuQAYsv1563Yd54FQh9/[email protected]; Wang, Yong Y
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: UpdatePCH_CANdriver to 2.6.35Quoted 6 lines · Qi
Quoted 6 lines
-----Original Message-----
From: Daniel Baluta [mailto:[email protected]]
Sent: Wednesday, August 11, 2010 6:37 PM
To: Masayuki Ohtak
Cc: [email protected]; Wolfgang Grandegger; [email protected]; [email protected]; Khor, AndrewChih
Quoted 13 lines
Quoted 13 lines
Howe; [email protected]; arjan-VuQAYsv1563Yd54FQh9/[email protected]; Wang, Qi; Wang, Yong Y
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: UpdatePCH_CANdriver to 2.6.35Hi,
2010/8/11 Masayuki Ohtak <masa-korg-ECg8zkTtlr0C6LszWs/[email protected]>:
Quoted 7 lines
CAN driver of Topcliff PCH
Topcliff PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in Topcliff PCH are actually devices sitting on AMBA bus. Topcliff PCH has CAN I/F. This driver enables CAN function.
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
I have a few questions:
1. Is your code based on Intel's CAN EP80579 ([1]) ?
No.
For curiosity, is the controller similar to the OKI MSM9225 or ML9620?
The Topcliff IOH is developed by OKI actually.
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
2. Why don't you use kernel existing kfifo infrastructure? ([2]).
Just take a look at
kfifo.h. This structure has been changed. I rememberedthere was a
spin_lockfrom kfifo previously. Currently it's been removed, good.Quoted 1 line
OKI-sans, would you please take a look at
./include/linux/kfifo.h, and try touse this structure and APIs?
As I see it, the code related to that fifo is not used (== dead code)?
I'm not familiar with kfifo structure, and I didn't like it because there need a
spin_lockto use it.Quoted 3 lines
Quoted 3 lines
Daniel,
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
We're anxious to integrate those codes now. Perhaps it'll take us quite a long
time to use kfifo. How about implementing it with the next version?
See above. What do you mean with the next version. The driver posted by Masayuki is far away from being accepted as it does not yet comply with the Socket-CAN driver API, to say the least.
I've few experience on CAN driver and it's also the first time for OKI-san to write Can driver. Would you please give us a reference and we'll follow it up. We only read 'can.txt' from kernel document. Thank you for your help in advance.
You are welcome. I think I/we already gave useful hints on what is missing and what examples to follow.
Wolfgang.
Hi Wolfgang,
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
Quoted 1 line
2. Why don't you use kernel existing kfifo infrastructure? ([2]).
Just take a look at
kfifo.h. This structure has been changed. I rememberedthere was a
spin_lockfrom kfifo previously. Currently it's been removed, good.Quoted 1 line
OKI-sans, would you please take a look at
./include/linux/kfifo.h, and try touse this structure and APIs?
As I see it, the code related to that fifo is not used (== dead code)?
I'm not familiar with kfifo structure, and I didn't like it because there need a
spin_lockto use it.
We are about to study kfifo infra structure.
I have a question.
It seems all CAN drivers accepted by upstream don't use kfifo infrastructure, right ? (I couldn't see message with "grep kfifo * in drivers/net/can")
If yes, why should we use the kfifo ?
If no, please show me the kfifo reference driver
Thanks, Ohtake(OKISEMI)
----- Original Message -----
From: "Wolfgang Grandegger" <[email protected]>
To: "Wang, Qi" <[email protected]>
Cc: "Khor, Andrew Chih Howe" <[email protected]>; <[email protected]>; <[email protected]>; <[email protected]>; "Wang, Yong Y" <[email protected]>; "Masayuki Ohtak" <[email protected]>; <[email protected]>; <[email protected]>
Sent: Friday, August 13, 2010 7:58 PM
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: Update PCH_CAN driver to 2.6.35
Quoted 53 lines · Qi
Quoted 52 lines
Quoted 30 lines
-----Original Message-----
From: Wolfgang Grandegger [mailto:[email protected]]
Sent: Thursday, August 12, 2010 5:04 PM
To: Wang, Qi
Cc: Daniel Baluta; Masayuki Ohtak; [email protected]; [email protected]; [email protected]; Khor, Andrew Chih Howe; [email protected]; [email protected]; Wang, Yong Y
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: UpdatePCH_CANdriver to 2.6.35Quoted 6 lines · Qi
Quoted 6 lines
-----Original Message-----
From: Daniel Baluta [mailto:[email protected]]
Sent: Wednesday, August 11, 2010 6:37 PM
To: Masayuki Ohtak
Cc: [email protected]; Wolfgang Grandegger; [email protected]; [email protected]; Khor, AndrewChih
Quoted 13 lines
Quoted 13 lines
Howe; [email protected]; [email protected]; Wang, Qi; Wang, Yong Y
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: UpdatePCH_CANdriver to 2.6.35Hi,
2010/8/11 Masayuki Ohtak <[email protected]>:
Quoted 7 lines
CAN driver of Topcliff PCH
Topcliff PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in Topcliff PCH are actually devices sitting on AMBA bus. Topcliff PCH has CAN I/F. This driver enables CAN function.
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Masayuki Ohtake <[email protected]>I have a few questions:
1. Is your code based on Intel's CAN EP80579 ([1]) ?
No.
For curiosity, is the controller similar to the OKI MSM9225 or ML9620?
The Topcliff IOH is developed by OKI actually.
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
2. Why don't you use kernel existing kfifo infrastructure? ([2]).
Just take a look at
kfifo.h. This structure has been changed. I rememberedthere was a
spin_lockfrom kfifo previously. Currently it's been removed, good.Quoted 1 line
OKI-sans, would you please take a look at
./include/linux/kfifo.h, and try touse this structure and APIs?
As I see it, the code related to that fifo is not used (== dead code)?
I'm not familiar with kfifo structure, and I didn't like it because there need a
spin_lockto use it.Quoted 3 lines
Quoted 3 lines
Daniel,
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
We're anxious to integrate those codes now. Perhaps it'll take us quite a long
time to use kfifo. How about implementing it with the next version?
See above. What do you mean with the next version. The driver posted by Masayuki is far away from being accepted as it does not yet comply with the Socket-CAN driver API, to say the least.
I've few experience on CAN driver and it's also the first time for OKI-san to write Can driver. Would you please
give us a reference and we'll follow it up. We only read 'can.txt' from kernel document. Thank you for your help in advance.
Quoted 10 lines
You are welcome. I think I/we already gave useful hints on what is missing and what examples to follow.
Wolfgang.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 000f01cb402d$34b675b0$66f8800a-a06+6cuVnkTSQfdrb5gaxUEOCMrvLtNR@public.gmane.org
Hi Ohtake,
Quoted 8 lines · Masayuki Ohtake
Hi Wolfgang,
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
2. Why don't you use kernel existing kfifo infrastructure? ([2]).
Just take a look at
kfifo.h. This structure has been changed. I rememberedthere was a
spin_lockfrom kfifo previously. Currently it's been removed, good.Quoted 1 line
OKI-sans, would you please take a look at
./include/linux/kfifo.h, and try touse this structure and APIs?
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
As I see it, the code related to that fifo is not used (== dead code)?
I'm not familiar with kfifo structure, and I didn't like it because there need a
spin_lockto use it.We are about to study kfifo infra structure.
I have a question.It seems all CAN drivers accepted by upstream don't use kfifo infrastructure, right ?
Right!
Quoted 4 lines
(I couldn't see message with "grep kfifo * in
drivers/net/can")If yes, why should we use the kfifo ?
If no, please show me the kfifo reference driver
Sorry, nobody (of the socketcan core developers) said that kfifo should be used. We believe, that an additional queuing of CAN messages is *not* needed at all. Just eliminate the related code and follow more closely the existing mainline drivers.
Wolfgang.
Hi Wolfgang,
Thank you for your comment.
We don't use kfifo infrastructure but brush up with current framework.
Thanks, Ohtake(OKISEMI)
----- Original Message -----
From: "Wolfgang Grandegger" <[email protected]>
To: "Masayuki Ohtake" <[email protected]>
Cc: "Wang, Qi" <[email protected]>; <[email protected]>; <[email protected]>; "Wang, Yong Y" <[email protected]>; <[email protected]>; <[email protected]>; <[email protected]>; "Khor, Andrew Chih Howe" <[email protected]>; "Morinaga" <[email protected]>
Sent: Friday, August 20, 2010 4:59 PM
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: Update PCH_CAN driver to 2.6.35
Quoted 37 lines
Hi Ohtake,
Quoted 8 lines · Masayuki Ohtake
Hi Wolfgang,
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
2. Why don't you use kernel existing kfifo infrastructure? ([2]).
Just take a look at
kfifo.h. This structure has been changed. I rememberedthere was a
spin_lockfrom kfifo previously. Currently it's been removed, good.Quoted 1 line
OKI-sans, would you please take a look at
./include/linux/kfifo.h, and try touse this structure and APIs?
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
As I see it, the code related to that fifo is not used (== dead code)?
I'm not familiar with kfifo structure, and I didn't like it because there need a
spin_lockto use it.We are about to study kfifo infra structure.
I have a question.It seems all CAN drivers accepted by upstream don't use kfifo infrastructure, right ?
Right!
Quoted 4 lines
(I couldn't see message with "grep kfifo * in
drivers/net/can")If yes, why should we use the kfifo ?
If no, please show me the kfifo reference driverSorry, nobody (of the socketcan core developers) said that kfifo should be used. We believe, that an additional queuing of CAN messages is *not* needed at all. Just eliminate the related code and follow more closely the existing mainline drivers.
Wolfgang.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello,
Quoted 5 lines · Masayuki Ohtak
CAN driver of Topcliff PCH
Topcliff PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in Topcliff PCH are actually devices sitting on AMBA bus.
That's interesting. Where can I/we find more information about this CAN controller, e.g. data-sheets. It seems to have a few interesting features (message scheduler, etc.).
Quoted 3 lines
Topcliff PCH has CAN I/F. This driver enables CAN function.
Thanks for your contribution. Unfortunately, there are many issues, especially the driver is not yet conform with the Socket-CAN driver API:
- My first observation was:
$ wc -l pch_can.c 4076 pch_can.c $ grep dev_dbg pch_can.c | wc -l 143
That's a lot of code, mainly debugging code, I think. This needs to be cleaned up sooner than later. dev_dbg's should be restricted to a few useful for the real users.
- The values for the hw-specific bit-timing registers should be derived from the calculated values in "priv->can.bittiming":
http://lxr.linux.no/#linux+v2.6.35/include/linux/can/netlink.h#L17
- The driver should handle state changes and communicate them to the user space via error messages, if possible.
- The driver should report errors to the user space via error messages.
- Bus errors seem not to be handled properly.I'm missing can_bus_off(). Does the controller recover from bus-off automatically?
- I see that the driver uses many TX and RX objects. How do you avoid out-of-order transmission and reception?
- Various CAN controller modes, like listen_only and loopback can be handled via "priv->can.ctrlmode". Please use that interface if appropriate.
- Please use a structure to describe the register layout, instead of defines to profit from type checking.
- As you are at it, please also fix coding style issues, especially for comments as described here:
http://lxr.linux.no/#linux+v2.6.35/Documentation/CodingStyle#L425
You can take the SJA1000 driver as example. Further useful information is here:
http://lxr.linux.no/#linux+v2.6.35/Documentation/networking/can.txt
http://svn.berlios.de/wsvn/socketcan/trunk/README.submitting-patches
It follows a quick review. It's to early for a detailed one:
...
Quoted 24 lines
drivers/net/can/pch_can.c new file +24
-0+/* Array to store the timing settings. */ +static struct pch_can_timing can_rec_timing[] = { +/* <Baud rate> <BRP> <TS1> <TS2> <SJW> */ +/* settings for 62.5MHz */ + {0xa ,0x250 ,0x7 ,0x0 ,0x0 ,0x0 ,0x0 },/* < 10 kbits/s */ + {0x14 ,0x8D ,0xB ,0x5 ,0x0 ,0x0 ,0x0 },/* < 20 kbits/s */ + {0x32 ,0x5C ,0x7 ,0x0 ,0x0 ,0x0 ,0x0 },/* < 50 kbits/s */ + {0x7d ,0x18 ,0xC ,0x5 ,0x0 ,0x0 ,0x0 },/* < 125 kbits/s */ + {0xfa ,0x18 ,0x7 ,0x0 ,0x0 ,0x0 ,0x0 },/* < 250 kbits/s */ + {0x1f4 ,0x8 ,0x9 ,0x2 ,0x0 ,0x0 ,0x0 },/* < 500 kbits/s */ + {0x320 ,0x5 ,0x8 ,0x2 ,0x0 ,0x0 ,0x0 },/* < 800 kbits/s */ + {0x3e8 ,0x2 ,0xC ,0x6 ,0x0 ,0x0 ,0x0 },/* < 1000 kbits/s */ + +/* settings for 24MHz */ + {0xa ,0xCF ,0x7 ,0x0 ,0x0 ,0x0 ,0x0 },/* < 10 kbits/s */ + {0x14 ,0x57 ,0x7 ,0x0 ,0x0 ,0x0 ,0x0 },/* < 20 kbits/s */ + {0x32 ,0xF ,0x7 ,0x0 ,0x0 ,0x0 ,0x0 },/* < 50 kbits/s */ + {0x7d ,0xF ,0x8 ,0x1 ,0x0 ,0x0 ,0x0 },/* < 125 kbits/s */ + {0xfa ,0x7 ,0x8 ,0x1 ,0x0 ,0x0 ,0x0 },/* < 250 kbits/s */ + {0x1f4 ,0x3 ,0x8 ,0x1 ,0x0 ,0x0 ,0x0 },/* < 500 kbits/s */ + {0x320 ,0x2 ,0x7 ,0x0 ,0x0 ,0x0 ,0x0 },/* < 800 kbits/s */ + {0x3e8 ,0x1 ,0x8 ,0x1 ,0x0 ,0x0 ,0x0 },/* < 1000 kbits/s */ + +/* settings for 50MHz */
drivers/net/can/pch_can.c line 123
Quoted 10 lines
drivers/net/can/pch_can.c new file +10
-0+ {0xa, 0xFA, 0xC, 0x5, 0x1, 0x0, 0x0}, /* < 10 kbits/s */ + {0x14, 0x7D, 0xC, 0x5, 0x1, 0x0, 0x0}, /* < 20 kbits/s */ + {0x32, 0x32, 0xF, 0x2, 0x0, 0x0, 0x0}, /* < 50 kbits/s */ + {0x7d, 0x19, 0xC, 0x1, 0x0, 0x0, 0x0}, /* < 125 kbits/s */ + {0xfa, 0xA, 0xF, 0x2, 0x0, 0x0, 0x0}, /* < 250 kbits/s */ + {0x1f4, 0x5, 0xF, 0x2, 0x0, 0x0, 0x0}, /* < 500 kbits/s */ + {0x320, 0x5, 0x8, 0x2, 0x1, 0x0, 0x0}, /* < 800 kbits/s */ + {0x3e8, 0x2, 0xF, 0x7, 0x0, 0x0, 0x0} /* < 1000 kbits/s */ + /* Add the new clock settings here. */ +};
Can't the register values be determined from the calculated one in "priv->can.bittiming"? See comment above. Be aware the the user might want to set custom values as described here:
http://lxr.linux.no/#linux+v2.6.35/Documentation/networking/can.txt#L730
Review
Quoted 2 lines
(quoted diff) +2
-0+ +static DEFINE_MUTEX(pch_can_mutex);
What is this mutex good for. At a first glance, I don't think it's needed.
Review
Quoted 2 lines
(quoted diff) +2
-0+ +#ifdef PCH_CAN_FIFO_MODE
The functions above are not used anywhere! Dead code? Please clean up.
Quoted 15 lines
drivers/net/can/pch_can.c new file +15
-0+static int check_can_fifo_status (int handle) +{ +int ret_val; +struct can_fifo *f = (struct can_fifo *) handle; + +if (f->head == f->tail) + ret_val =PCH_CAN_FIFO_EMPTY ; +else if (f->head->next == f->tail) + ret_val =PCH_CAN_FIFO_FULL ; +else + ret_val =PCH_CAN_FIFO_NOT_EMPTY ; + +return ret_val; +} +
...
drivers/net/can/pch_can.c line 3586
Quoted 13 lines
drivers/net/can/pch_can.c new file +13
-0+static netdev_tx_t pch_xmit (struct sk_buff *skb,struct net_device *ndev) +{ +int err;/* error variable. */ +int ret; +struct pch_can_msg msg;/* The message object for writing. */ +struct pch_can_priv *priv =netdev_priv (ndev); +struct pch_can_os *can_os = priv->pch_can_os_p; +struct can_frame *canframe_dat = (struct can_frame *)skb->data; +struct net_device_stats *stats = &ndev->stats; + + ret =mutex_lock_interruptible (&pch_can_mutex); +if (ret) +return -ERESTARTSYS ;
This is an invalid return code.
Quoted 23 lines
drivers/net/can/pch_can.c new file +23
-0+ +/* Translate CAN core format to CAN PCH's HW format */ +memset (&msg,0 ,sizeof (msg)); + msg.ide = canframe_dat->can_id &0x80000000 ; +if (canframe_dat->can_id &0x80000000 ) { + msg.ide =1 ; + msg.id = canframe_dat->can_id &0x1fffffff ;/* Extended +Message */ + }else { + msg.ide =0 ; + msg.id = canframe_dat->can_id &0x00000fff ;/* Standard +Message */ + + } + + msg.dlc = canframe_dat->can_dlc; +memcpy (&msg.data, canframe_dat->data,8 ); + +if (canframe_dat->can_id &0x40000000 ) + msg.rtr =1 ; +else + msg.rtr =0 ; +
drivers/net/can/pch_can.c line 3619
Quoted 10 lines
drivers/net/can/pch_can.c new file +10
-0+/* If device suspended. */ +if ((can_os->is_suspending) ==1 ) { +dev_err (&ndev->dev, +"%s -> Device is in suspend mode.\n" , __func__); +dev_dbg (&ndev->dev,"%s returns %d\n" , __func__, -EAGAIN ); + err = -EAGAIN ; + goto err_out; + } + +can_put_echo_skb (skb, ndev,0 );
This will not work, as you are using more than one TX object.
drivers/net/can/pch_can.c line 4073
Quoted 8 lines
drivers/net/can/pch_can.c new file +7
-0+MODULE_DESCRIPTION ("Controller Area Network Driver" ); +MODULE_LICENSE ("GPL" ); +MODULE_VERSION ("0.94" ); +module_param_named (pch_can_rx_buf_size, pch_can_rx_buf_size, int,444 ); +module_param_named (pch_can_tx_buf_size, pch_can_tx_buf_size, int,444 ); +module_param_named (pch_can_clock, pch_can_clock, int,444 ); +MODULE_DEVICE_TABLE (pci, pch_can_pcidev_id);
Please move these calls up to the beginning where the variables are defined and provide a proper description.
Quoted 8 lines
drivers/net/can/pch_can.c new file +3
-0+ +module_init (pch_can_pci_init); +module_exit (pch_can_pci_exit);drivers/net/can/pch_can.h new file +0
-0
...
Quoted 5 lines
drivers/net/can/pch_can.h new file +5
-0+/** +* struct pch_can_msg - CAN message structure +* @ide: Standard/extended msg +* @id: 11 or 29 bit msg id +* @dlc: Size of data
drivers/net/can/pch_can.h line 242
Quoted 10 lines
drivers/net/can/pch_can.h new file +10
-0+* @data: Message pay load +* @rtr: RTR message +*/ +struct pch_can_msg { +unsigned short ide; +unsigned int id; +unsigned short dlc; +unsigned char data[PCH_CAN_MSG_DATA_LEN ]; +unsigned short rtr; +};
Hm, why you can't use "struct can_frame".
Quoted 10 lines
drivers/net/can/pch_can.h new file +10
-0+ +/** +* pch_can_timing - CAN bittiming structure +* @bitrate: Bitrate (kbps) +* @cfg_bitrate: Bitrate +* @cfg_tseg1: Tseg1 +* @cfg_tseg2: Tseg2 +* @cfg_sjw: Sync jump width +* @smpl_mode: Sampling mode +* @edge_mode: Edge R / D
drivers/net/can/pch_can.h line 262
Quoted 10 lines
drivers/net/can/pch_can.h new file +10
-0+*/ +struct pch_can_timing { +unsigned int bitrate; +unsigned int cfg_bitrate; +unsigned int cfg_tseg1; +unsigned int cfg_tseg2; +unsigned int cfg_sjw; +unsigned int smpl_mode; +unsigned int edge_mode; +};
Ditto.
Quoted 113 lines
drivers/net/can/pch_can.h new file +113
-0+/** +* struct pch_can_error - CAN error structure +* @rxgte96: Rx err cnt >=96 +* @txgte96: Tx err cnt >=96 +* @error_stat: Error state of CAN node, +* 00=error active (normal) +* 01=error passive +* 1x=bus off +* @rx_err_cnt: Rx error count +* @tx_err_cnt: Tx error count +*/ +struct pch_can_error { +unsigned int rxgte96; +unsigned int txgte96; +unsigned int error_stat; +unsigned int rx_err_cnt; +unsigned int tx_err_cnt; +}; + +/** +* struct pch_can_acc_filter - CAN Filter structure +* @id: The id/mask data +* @id_ext: Standard/extended ID +* @rtr: RTR message +*/ +struct pch_can_acc_filter { +unsigned int id; +unsigned int id_ext; +unsigned int rtr; +}; + +/** +* struct pch_can_rx_filter - CAN RX filter +* @num: Filter number +* @umask: UMask value +* @amr: Acceptance Mask Reg +* @aidr: Acceptance Control Reg +*/ +struct pch_can_rx_filter { +unsigned int num; +unsigned int umask; +struct pch_can_acc_filter amr; +struct pch_can_acc_filter aidr; +}; + +/** +* struct pch_can_os - structure to store the CAN device information. +* @can: CAN: device handle +* @opened: Linux opened device +* @can_num: Linux: CAN Number +* @pci_remap: Linux: MMap regs +* @dev: Linux: PCI Device +* @irq: Linux: IRQ +* @block_mode: Blocking / non-blocking +* @rx_fifo: Rx FIFO +* @read_wait_queue: Linux: Read wait queue +* @write_wait_queue: Linux: Write wait queue +* @write_wait_flag: Linux: Write wait flag +* @read_wait_flag: Linux: Read wait flag +* @open_spinlock: Linux: Open lock variable +* @is_suspending: Linux: Is suspending state +* @inode: Linux: inode +* @timing: CAN: timing +* @run_mode: CAN: run mode +* @listen_mode: CAN: listen mode +* @arbiter_mode: CAN: arbiter mode +* @tx_enable: CAN: Tx buffer state +* @rx_enable: CAN: Rx buffer state +* @rx_link: CAN: Rx link set +* @int_enables: CAN: ints enabled +* @int_stat: CAN: int status +* @bus_off_interrupt: CAN: Buss off int flag +* @rx_filter: CAN: Rx filters +* @can_callback: CAN: callback function pointer +* @ndev: net_device pointer +* @tx_spinlock: CAN: transmission lock variable +*/ +struct pch_can_os { +int can; +unsigned int opened; +unsigned int can_num; +void __iomem *pci_remap; +struct pci_dev *dev; +unsigned int irq; +int block_mode; +int rx_fifo; +wait_queue_head_t read_wait_queue; +wait_queue_head_t write_wait_queue; +unsigned int write_wait_flag; +unsigned int read_wait_flag; +spinlock_t open_spinlock; +unsigned int is_suspending; +struct inode *inode; +struct pch_can_timing timing; +enum pch_can_run_mode run_mode; +enum pch_can_listen_mode listen_mode; +enum pch_can_arbiter arbiter_mode; +unsigned int tx_enable[MAX_MSG_OBJ ]; +unsigned int rx_enable[MAX_MSG_OBJ ]; +unsigned int rx_link[MAX_MSG_OBJ ]; +unsigned int int_enables; +unsigned int int_stat; +unsigned int bus_off_interrupt; +struct pch_can_rx_filter rx_filter[MAX_MSG_OBJ ]; +void (*can_callback) (struct pch_can_os *); +struct net_device *ndev; +spinlock_t tx_spinlock; +}; + +/** +* struct pch_can_priv - CAN driver private data structure +* @can: MUST be first member/field +* @ndev: Pointer to net_device structure
drivers/net/can/pch_can.h line 386
Quoted 10 lines
drivers/net/can/pch_can.h new file +10
-0+* @clk: unused +* @base: Base address +* @scc_ram_offset: unused +* @hecc_ram_offset: unused +* @mbx_offset: unused +* @int_line: unused +* @mbx_lock: unused +* @tx_head: unused +* @tx_tail: unused +* @rx_next: unused
Hm, if it's not used, what is it then good for? I stop reviewing here. It seems that you ported an existing driver to Linux!? I'm looking forward for an optimized and efficient solution.
Thanks,
Wolfgang.
A message that is not in the archive (sent off-list or not yet received): D5AB6E638E5A3E4B8F4406B113A5A19A28EA26CC@shsmsx501.ccr.corp.intel.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): D5AB6E638E5A3E4B8F4406B113A5A19A28EA29DF@shsmsx501.ccr.corp.intel.com
Sorry, for late response.
----- Original Message -----
From: "Wang, Qi" <[email protected]>
To: "Masayuki Ohtak" <[email protected]>
Cc: "Khor, Andrew Chih Howe" <[email protected]>; <[email protected]>; <[email protected]>; "Wang, Yong Y" <[email protected]>; "Wolfgang Grandegger" <[email protected]>
Sent: Thursday, August 12, 2010 6:00 PM
Subject: RE: [MeeGo-Dev][PATCH] Topcliff: Update PCH_CAN driver to 2.6.35
Quoted 73 lines
Hi Ohtak-san,
Would you please answer the question from Wolfgang?
Best Regards,
Qi.Quoted 66 lines
-----Original Message-----
From: Wolfgang Grandegger [mailto:[email protected]]
Sent: Thursday, August 12, 2010 4:55 PM
To: Wang, Qi
Cc: Masayuki Ohtak; Khor, Andrew Chih Howe; [email protected]; [email protected]; Wang, Yong Y
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: UpdatePCH_CANdriver to 2.6.35Quoted 18 lines · Qi
Quoted 18 lines
-----Original Message-----
From: Wolfgang Grandegger [mailto:[email protected]]
Sent: Wednesday, August 11, 2010 8:31 PM
To: Masayuki Ohtak
Cc: [email protected]; [email protected]; [email protected]; Khor, Andrew Chih Howe; [email protected]; [email protected]; Wang, Qi; Wang, Yong Y
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: UpdatePCH_CANdriver to 2.6.35Hello,
Quoted 5 lines · Masayuki Ohtak
CAN driver of Topcliff PCH
Topcliff PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in Topcliff PCH are actually devices sitting on AMBA bus.
Quoted 5 lines
Quoted 3 lines
That's interesting. Where can I/we find more information about this CAN controller, e.g. data-sheets. It seems to have a few interesting features (message scheduler, etc.).
I remove all the maillist, and show you something about this platform.
Like Greg, I also prefer the public discussion.
Quoted 2 lines
Topcliff PCH is connected with Tunnelcreak (A kind of ATOM-based processor,
which integrate Memory controller, GFX and RC). And Topcliff is a kind of stand-alone ARM-based processor, so it has AMBA-based peripherals, such as CAN, GBE, I2C.
Quoted 2 lines
Topcliff connected with Tunnelcreak via PCIe x1 lane. And
PCH_PHUBworksas a gateway, which transform PCIe transaction to AMBA transaction, and vice versa.
Quoted 2 lines
The datasheet of those two chips aren't open now.
Thanks for the info.
Quoted 17 lines
Quoted 17 lines
Quoted 3 lines
Topcliff PCH has CAN I/F. This driver enables CAN function.
Signed-off-by Masayuki Ohtake <[email protected]>Thanks for your contribution. Unfortunately, there are many issues, especially the driver is not yet conform with the Socket-CAN driver API:
- My first observation was:
$ wc -l pch_can.c 4076 pch_can.c $ grep dev_dbg pch_can.c | wc -l 143That's a lot of code, mainly debugging code, I think. This needs to be cleaned up sooner than later. dev_dbg's should be restricted to a few useful for the real users.
We will reduce dev_dbg code.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
- The values for the hw-specific bit-timing registers should be derived from the calculated values in "
priv->can.bittiming":http://lxr.linux.no/#linux+v2.6.35/include/linux/can/netlink.h#L17
I show current pch_can code below.
+static int pch_set_bittiming(struct net_device *ndev) +{
+ struct pch_can_priv *priv = netdev_priv(ndev);
+ struct pch_can_os *dev_can_os = priv->pch_can_os_p;
+ const struct can_bittiming *bt = &priv->can.bittiming;
Is the above TRUE, isn't it ?
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
- The driver should handle state changes and communicate them to the user space via error messages, if possible.
What's "state chage" mean ?
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
- The driver should report errors to the user space via error messages.
Is the above mean using alloc_can_err_skb and set error info and notify to kernel with netif_rx ?
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
- Bus errors seem not to be handled properly.I'm missing
can_bus_off(). Does the controller recover from bus-off automatically?
No.
CAN driver recovers from Bus-off state.
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines
- I see that the driver uses many TX and RX objects. How do you avoid out-of-order transmission and reception?
What do you mean out-of-order RX and TX?
Atom processor only supports in-order execution, and PCIe-based peripheralscan solve it with consumer-producer model. Actually IC designer will take care of out-of-order PCIe CPLD transaction.
I mean out-of-order transmission to or from the CAN bus. This is handled by the CAN controller hardware. It has nothing to to with the processor.
Cannot avoid occurring rx or tx our-of-order.
Thanks, Ohtake(OKISemi)
out-of-order tx objects - was Re: [MeeGo-Dev][PATCH] Topcliff: Update PCH_CAN driver to 2.6.35
Hello Ohtake,
i'm only picking up the out-of-order issue here ...
Quoted 10 lines · Masayuki Ohtake
Quoted 9 lines
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
- I see that the driver uses many TX and RX objects. How do you avoid out-of-order transmission and reception?
What do you mean out-of-order RX and TX?
Atom processor only supports in-order execution, and PCIe-based peripheralscan solve it with consumer-producer model. Actually IC designer will take care of out-of-order PCIe CPLD transaction.
I mean out-of-order transmission to or from the CAN bus. This is handled by the CAN controller hardware. It has nothing to to with the processor.
Cannot avoid occurring rx or tx our-of-order.
The CAN frames that are sent by the local system have to touch the wire in the same order as you put them into the socket as user.
An example:
You send CAN-frames with CAN Identifiers via can-raw sockets
0x1230x4560x010
and of course you expect these frames sent in exactly this order. This is easy to archive as you get each of these CAN frames out of the netdevices tx-queue in this order.
The problems comes up when you use multiple "tx objects" of your CAN controller. Some CAN controllers have a "magic intelligence" that leads to some re-ordering according to the CAN-Identifiers priority.
E.g.
0x1230x4560x010
leads to
0x1230x0100x456
because you pushed these CAN-frames into different tx objects and the CAN controller sorts them on its own by priority. For CAN newbies: A lower CAN-ID value has a higher priority in arbitration on the *physical* layer.
In the example above the CAN controller checks after sending the 0x123 CAN frame if there's a priority order in the tx objects that are ready to send, and selects 0x010 ...
This behaviour might be interesting in single-user/single-application environments - but it is just wrong in multi-user systems where several different applications use the (same) CAN bus. Standard networking behaviour.
Please ensure that the CAN frame order given by the tx-queue of the Linux kernel netdevice infrastructure is send on the wire in the same order.
This usually leads to the use of ONLY ONE tx object of your CAN controller. Probably you can use two tx objects to increase the throughput if this does not have any impact to the frame order. See your controllers documentation for details about this tx object behaviour.
I hope this makes the question of Wolfgang a bit clearer :-)
Regards,
Oliver
Hello,
Quoted 8 lines · Masayuki Ohtake
Sorry, for late response.
----- Original Message -----
From: "Wang, Qi" <[email protected]>
To: "Masayuki Ohtak" <[email protected]>
Cc: "Khor, Andrew Chih Howe" <[email protected]>; <[email protected]>; <[email protected]>; "Wang, Yong Y" <[email protected]>; "Wolfgang Grandegger" <[email protected]>
Sent: Thursday, August 12, 2010 6:00 PM
Subject: RE: [MeeGo-Dev][PATCH] Topcliff: UpdatePCH_CANdriver to 2.6.35
...
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
- The values for the hw-specific bit-timing registers should be derived from the calculated values in "
priv->can.bittiming":http://lxr.linux.no/#linux+v2.6.35/include/linux/can/netlink.h#L17
I show current
pch_cancode below.(quoted diff) +5
-0+static int pch_set_bittiming(struct net_device *ndev) +{ + struct pch_can_priv *priv = netdev_priv(ndev); + struct pch_can_os *dev_can_os = priv->pch_can_os_p; + const struct can_bittiming *bt = &priv->can.bittiming;
Quoted 1 line
Is the above TRUE, isn't it ?
The code fragment looks good. In that function you should then *derive* the values of the bit-timing registers from the data fields of "bt". For the SJA1000, you find the code here:
http://lxr.linux.no/#linux+v2.6.35/drivers/net/can/sja1000/sja1000.c#L202
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
- The driver should handle state changes and communicate them to the user space via error messages, if possible.
What's "state chage" mean ?
Googling for "can bis states" returned:
The CAN controller usually triggers an interrupt when the state changes, which allows the driver to track the CAN state and deliver that information to the user space.
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
- The driver should report errors to the user space via error messages.
Is the above mean using
alloc_can_err_skband set error info and notify to kernel withnetif_rx?
Yes. Please search "Documentation/networking/can.txt" for "error frames" for further information.
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
- Bus errors seem not to be handled properly.I'm missing
can_bus_off(). Does the controller recover from bus-off automatically?No.
CAN driver recovers from Bus-off state.
You mean: "It does *not" recover automatically"! Right?
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
- I see that the driver uses many TX and RX objects. How do you avoid out-of-order transmission and reception?
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
What do you mean out-of-order RX and TX?
Atom processor only supports in-order execution, and PCIe-based peripheralscan solve it with consumer-producer model. Actually IC designer will take care of out-of-order PCIe CPLD transaction.
I mean out-of-order transmission to or from the CAN bus. This is handled by the CAN controller hardware. It has nothing to to with the processor.
Cannot avoid occurring rx or tx our-of-order.
It is a *requirement* as Oliver already pointed out. It's easy to achieve if just one TX object is used but it might be tricky with more than one.
Wolfgang.
----- Original Message -----
From: "Wolfgang Grandegger" <[email protected]>
To: "Masayuki Ohtake" <masa-korg-ECg8zkTtlr0C6LszWs/[email protected]>
Cc: "Andrew Chih Howe" <[email protected]>; "Qi" <[email protected]>; "ML netdev" <[email protected]>; <[email protected]>; "ML linux-kernel" <[email protected]>; "Wang, Yong Y" <[email protected]>; <[email protected]>; <arjan-VuQAYsv1563Yd54FQh9/[email protected]>; "David S. Miller" <davem-fT/PcQaiUtIeIZ0/[email protected]>; "Christian Pellegrin" <[email protected]>; "Samuel Ortiz" <sameo-VuQAYsv1563Yd54FQh9/[email protected]>
Sent: Thursday, September 02, 2010 3:51 AM
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: Update PCH_CAN driver to 2.6.35
Quoted 15 lines
...
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
- The values for the hw-specific bit-timing registers should be derived from the calculated values in "
priv->can.bittiming":http://lxr.linux.no/#linux+v2.6.35/include/linux/can/netlink.h#L17
I show current
pch_cancode below.(quoted diff) +5
-0+static int pch_set_bittiming(struct net_device *ndev) +{ + struct pch_can_priv *priv = netdev_priv(ndev); + struct pch_can_os *dev_can_os = priv->pch_can_os_p; + const struct can_bittiming *bt = &priv->can.bittiming;
Quoted 8 lines
Quoted 1 line
Is the above TRUE, isn't it ?
The code fragment looks good. In that function you should then *derive* the values of the bit-timing registers from the data fields of "bt". For the SJA1000, you find the code here:
http://lxr.linux.no/#linux+v2.6.35/drivers/net/can/sja1000/sja1000.c#L202
I can't understand the your saying.
I think our can driver is implemented like your saying.
In function "pch_set_bittiming", get the value of the bit-timing registers from the data fields of "bt" at "pch_can_set_baud_custom" or "pch_can_set_baud_simple".
Could you indicate in more detail ?
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
- The driver should handle state changes and communicate them to the user space via error messages, if possible.
What's "state chage" mean ?
Googling for "can bis states" returned:
Quoted 4 lines
The CAN controller usually triggers an interrupt when the state changes, which allows the driver to track the CAN state and deliver that information to the user space.
I could understand your saying.
In our current code, our driver can detect state change, but doesn't notify to can-core module or kennel protocol stack.
We will modify our driver to notify to these.
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
- The driver should report errors to the user space via error messages.
Is the above mean using
alloc_can_err_skband set error info and notify to kernel withnetif_rx?Yes. Please search "
Documentation/networking/can.txt" for "error frames" for further information.
I understand.
We will modify.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
- Bus errors seem not to be handled properly.I'm missing
can_bus_off(). Does the controller recover from bus-off automatically?No.
CAN driver recovers from Bus-off state.You mean: "It does *not" recover automatically"! Right?
I meant like below.
CAN-HW itself can't recover from bus-off state automatically. Cooperate with CAN driver, CAN HW can do automatically.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
Quoted 5 lines
- I see that the driver uses many TX and RX objects. How do you avoid out-of-order transmission and reception?
What do you mean out-of-order RX and TX?
Atom processor only supports in-order execution, and PCIe-based peripheralscan solve it with consumer-producer model. Actually IC designer will take care of out-of-order PCIe CPLD transaction.
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
I mean out-of-order transmission to or from the CAN bus. This is handled by the CAN controller hardware. It has nothing to to with the processor.
Cannot avoid occurring rx or tx our-of-order.
It is a *requirement* as Oliver already pointed out. It's easy to achieve if just one TX object is used but it might be tricky with more than one.
I agree with your indication.
We will modify so that our CAN driver has only one tx/rx each object.
Thanks, Ohtake(OKISemi)
Quoted 31 lines · Masayuki Ohtake
----- Original Message -----
From: "Wolfgang Grandegger" <[email protected]>
To: "Masayuki Ohtake" <[email protected]>
Cc: "Andrew Chih Howe" <[email protected]>; "Qi" <[email protected]>; "ML netdev" <[email protected]>; <[email protected]>; "ML linux-kernel" <[email protected]>; "Wang, Yong Y" <[email protected]>; <[email protected]>; <[email protected]>; "David S. Miller" <[email protected]>; "Christian Pellegrin" <[email protected]>; "Samuel Ortiz" <[email protected]>
Sent: Thursday, September 02, 2010 3:51 AM
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: UpdatePCH_CANdriver to 2.6.35Quoted 21 lines
...
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
- The values for the hw-specific bit-timing registers should be derived from the calculated values in "
priv->can.bittiming":http://lxr.linux.no/#linux+v2.6.35/include/linux/can/netlink.h#L17
I show current
pch_cancode below.(quoted diff) +5
-0+static int pch_set_bittiming(struct net_device *ndev) +{ + struct pch_can_priv *priv = netdev_priv(ndev); + struct pch_can_os *dev_can_os = priv->pch_can_os_p; + const struct can_bittiming *bt = &priv->can.bittiming;Quoted 1 line
Is the above TRUE, isn't it ?
The code fragment looks good. In that function you should then *derive* the values of the bit-timing registers from the data fields of "bt". For the SJA1000, you find the code here:
Quoted 8 lines
I can't understand the your saying.
I think our can driver is implemented like your saying.In function "
pch_set_bittiming", get the value of the bit-timing registers from the data fields of "bt" at "pch_can_set_baud_custom" or "pch_can_set_baud_simple".
Please *remove* "pch_can_set_baud_custom" or "pch_can_set_baud_simple" and use the fields of "const struct can_bittiming *bt" *directly*:
/* Getting the appropriate register value. */ reg_val = (((bt->brp & MSK_BITT_BRP) << BIT_BITT_BRP) |
((bt->prop_seg + bt->phase_seg1 - 1) << BIT_BITT_TSEG1) |
...Quoted 1 line
Could you indicate in more detail ?
Please have a closer look to the link mentioned above.
Quoted 10 lines
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
- The driver should handle state changes and communicate them to the user space via error messages, if possible.
What's "state chage" mean ?
Googling for "can bis states" returned:
Quoted 1 line
Quoted 8 lines
Quoted 3 lines
The CAN controller usually triggers an interrupt when the state changes, which allows the driver to track the CAN state and deliver that information to the user space.
I could understand your saying.
In our current code, our driver can detect state change, but doesn't notify to can-core module or kennel protocol stack.
We will modify our driver to notify to these.
The code is your friend. Please have a more detailed look to the SJA1000 driver, e.g. search it for "state".
Wolfgang.
Quoted 6 lines · Masayuki Ohtak
CAN driver of Topcliff PCH
Topcliff PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in Topcliff PCH are actually devices sitting on AMBA bus. Topcliff PCH has CAN I/F. This driver enables CAN function.
Thanks for your contribution. Some remarks in addition to Wolfgang's.
- Try to send patches directly with git send-email
- Rebase your tree to net-next-2.6.
- don't use global variables
- don't use that "int handle", e.g.:
Quoted 19 lines
static int pch_can_msg_tx(int handle, struct
pch_can_msg*msg,
structnet_device*ndev){ u32 id1 = 0; u32 id2 = 0; u32 data_a1 = 0; u32 data_a2 = 0; u32 data_b1 = 0; u32 data_b2 = 0; u32 tx_disable_counter = 0; u32 buffer_status = 0; u32 tx_buffer_avail = 0; u32 status; u32 i; u32 counter; enum pch_can_run_mode run_mode; int retval = 0; u32 if1_creq;
Quoted 9 lines
if ((handle == 0) || (msg == NULL)) {
dev_err(&ndev->dev, "%s -> Invalid Parameter.\n", __func__);
retval = -EPERM;
}
else {
/* Obatining the remap address for access. */
struct can_hw *can = (struct can_hw *) handle;use a proper struct. There are numerous drawbacks, no type safety it's not 64 safe, bad style,...
- there are several checks for handle against 0 that make no real sense
- clean up you error paths:
if (error) {
/* error handling */
} else {
/* do real work */
}This leads to a big indention level in the interesting code path, making it very hard to read. Please rework your code this way:
if (error) {
/* error handling */
return error;
/* or */
goto out_handle_error;
}/* do real work */
- get rid of the intermediate struct pch_can_msg:
Your data path is:
struct can_frame -> struct pch_can_msg -> registers write from struct can_frame into registers directly
- what's the purpose of "p_can_os->can_callback", call the function directly from the interrupt handler
- implement NAPI
- get rid of "1 << BIT_SHIFT_SIX" and friend,
use "1 << 6" or "BIT(6)" if you like defines
- use defines to set bits in struct can_frame can_id
cheers, Marc
Signature · 4 lines
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 |
_______________________________________________
Socketcan-core mailing list [email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-core
----- Original Message -----
From: "Marc Kleine-Budde" <[email protected]>
To: "Masayuki Ohtak" <masa-korg-ECg8zkTtlr0C6LszWs/[email protected]>
Cc: <[email protected]>; "Wolfgang Grandegger" <[email protected]>; <[email protected]>; <[email protected]>; <[email protected]>; <[email protected]>; <arjan-VuQAYsv1563Yd54FQh9/[email protected]>; <[email protected]>; <[email protected]>
Sent: Wednesday, August 11, 2010 10:04 PM
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: Update PCH_CAN driver to 2.6.35
Hi Marc,
Quoted 1 line
- Try to send patches directly with git send-email
In our network environment, we can't use send-email.
Quoted 1 line
- don't use global variables
I have modified so that our patch doesn't use global variable except module parameter.
Quoted 1 line
- don't use that "int handle", e.g.:
I have deleted.
Quoted 4 lines
- get rid of the intermediate struct
pch_can_msg:
Your data path is:
structcan_frame-> structpch_can_msg-> registers write from structcan_frameinto registers directly
Since Topcliff CAN HW register assign is different from struct can_frame, I think intermediate structure is necessary.
Quoted 2 lines
- what's the purpose of "
p_can_os->can_callback", call the function directly from the interrupt handler
I have deleted
Quoted 1 line
- implement NAPI
Since Topcliff CAN HW register has only single rx buffer, I think NAPI is unnecessary.
Quoted 2 lines
- get rid of "1 <<
BIT_SHIFT_SIX" and friend,
use "1 << 6" or "BIT(6)" if you like defines
I have modified.
Quoted 1 line
- use defines to set bits in struct
can_framecan_id
I have modified.
I will resubmit modified our CAN patch soon.
Thanks, Ohtake(OKISemi)
A message that is not in the archive (sent off-list or not yet received): 005f01cb533e$5c21d530$66f8800a-a06+6cuVnkTSQfdrb5gaxUEOCMrvLtNR@public.gmane.org
Quoted 2 lines · Masayuki Ohtake
Quoted 1 line
- Try to send patches directly with git send-email
In our network environment, we can't use send-email.
that's bad...talk to your IT department :)
Quoted 7 lines
Quoted 1 line
- don't use global variables
I have modified so that our patch doesn't use global variable except module parameter.
Quoted 1 line
- don't use that "int handle", e.g.:
I have deleted.
Quoted 6 lines
Quoted 4 lines
- get rid of the intermediate struct
pch_can_msg:
Your data path is:
structcan_frame-> structpch_can_msg-> registers write from structcan_frameinto registers directlySince Topcliff CAN HW register assign is different from struct
can_frame, I think intermediate structure is necessary.
I don't see any reason for this. No other driver has an intermediate struct. Look at the other drivers.
Quoted 7 lines
Quoted 2 lines
- what's the purpose of "
p_can_os->can_callback", call the function directly from the interrupt handlerI have deleted
Quoted 1 line
- implement NAPI
Since Topcliff CAN HW register has only single rx buffer, I think NAPI is unnecessary.
Doesn't matter. Please try to implement it.
Quoted 10 lines
Quoted 2 lines
- get rid of "1<<
BIT_SHIFT_SIX" and friend,
use "1<< 6" or "BIT(6)" if you like definesI have modified.
Quoted 1 line
- use defines to set bits in struct
can_framecan_idI have modified.
I will resubmit modified our CAN patch soon.
Thanks, Ohtake(OKISemi)
cheers, Marc
Signature · 4 lines
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 |
Hi Marc,
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
- implement NAPI
Since Topcliff CAN HW register has only single rx buffer, I think NAPI is unnecessary.
Doesn't matter. Please try to implement it.
Our CAN driver must pull received data from CAN-HW rx buffer as fast as it can so that the received data is not over-written by next received data. In case of implemented with NAPI,
since NAPI has time-lagging after receiving first packet, probability of over-written(discarded) buffer is to be high. Thus, for our CAN HW, we should NOT implement with NAPI but normal "netif_rx".
Thanks, Ohtake(OKISemi)
----- Original Message -----
From: "Marc Kleine-Budde" <[email protected]>
To: "Masayuki Ohtake" <masa-korg-ECg8zkTtlr0C6LszWs/[email protected]>
Cc: <[email protected]>; <[email protected]>; <[email protected]>; <[email protected]>; <[email protected]>; <[email protected]>; "Morinaga" <morinaga526-ECg8zkTtlr0C6LszWs/[email protected]>; <[email protected]>; <arjan-VuQAYsv1563Yd54FQh9/[email protected]>; "Wolfgang Grandegger" <[email protected]>
Sent: Monday, September 13, 2010 9:29 PM
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: Update PCH_CAN driver to 2.6.35
Quoted 52 lines · Masayuki Ohtake
Quoted 2 lines
Quoted 1 line
- Try to send patches directly with git send-email
In our network environment, we can't use send-email.
that's bad...talk to your IT department :)
Quoted 7 lines
Quoted 1 line
- don't use global variables
I have modified so that our patch doesn't use global variable except module parameter.
Quoted 1 line
- don't use that "int handle", e.g.:
I have deleted.
Quoted 6 lines
Quoted 4 lines
- get rid of the intermediate struct
pch_can_msg:
Your data path is:
structcan_frame-> structpch_can_msg-> registers write from structcan_frameinto registers directlySince Topcliff CAN HW register assign is different from struct
can_frame, I think intermediate structure is necessary.I don't see any reason for this. No other driver has an intermediate struct. Look at the other drivers.
Quoted 7 lines
Quoted 2 lines
- what's the purpose of "
p_can_os->can_callback", call the function directly from the interrupt handlerI have deleted
Quoted 1 line
- implement NAPI
Since Topcliff CAN HW register has only single rx buffer, I think NAPI is unnecessary.
Doesn't matter. Please try to implement it.
Quoted 10 lines
Quoted 2 lines
- get rid of "1<<
BIT_SHIFT_SIX" and friend,
use "1<< 6" or "BIT(6)" if you like definesI have modified.
Quoted 1 line
- use defines to set bits in struct
can_framecan_idI have modified.
I will resubmit modified our CAN patch soon.
Thanks, Ohtake(OKISemi)
cheers, Marc
Signature · 4 lines
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 |
Marc Kleine-Budde
maintainerQuoted 4 lines · Masayuki Ohtake
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
- implement NAPI
Since Topcliff CAN HW register has only single rx buffer, I think NAPI is unnecessary.
Quoted 8 lines
Quoted 1 line
Doesn't matter. Please try to implement it.
Our CAN driver must pull received data from CAN-HW rx buffer as fast as it can so that the received data is not over-written by next received data. In case of implemented with NAPI,
since NAPI has time-lagging after receiving first packet, probability of over-written(discarded) buffer is to be high. Thus, for our CAN HW, we should NOT implement with NAPI but normal "netif_rx".
Okay, point taken.
Regarding the one and only rx buffer. Is it a driver or a hardware limitation?
BTW: Are the datasheets of this CAN core available somewhere?
cheers Marc
Signature · 4 lines
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 |
A message that is not in the archive (sent off-list or not yet received): 003a01cb53a6$4ca724d0$66f8800a-a06+6cuVnkTSQfdrb5gaxUEOCMrvLtNR@public.gmane.org
Quoted 6 lines · Masayuki Ohtake
Hi Marc,
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
- implement NAPI
Since Topcliff CAN HW register has only single rx buffer, I think NAPI is unnecessary.
Quoted 8 lines
Quoted 1 line
Doesn't matter. Please try to implement it.
Our CAN driver must pull received data from CAN-HW rx buffer as fast as it can so that the received data is not over-written by next received data. In case of implemented with NAPI,
since NAPI has time-lagging after receiving first packet, probability of over-written(discarded) buffer is to be high. Thus, for our CAN HW, we should NOT implement with NAPI but normal "netif_rx".
True, if you just use one RX-Object. But it just helps a little bit and it would be much better to use the buffering on RX messages in the CAN controller hardware, either by using more than one RX object, or combining RX objects to a FIFO, or whatever your CAN controller supports.
Wolfgang.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 16 lines · Wolfgang Grandegger
Quoted 6 lines · Masayuki Ohtake
Hi Marc,
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
- implement NAPI
Since Topcliff CAN HW register has only single rx buffer, I think NAPI is unnecessary.
Quoted 8 lines
Quoted 1 line
Doesn't matter. Please try to implement it.
Our CAN driver must pull received data from CAN-HW rx buffer as fast as it can so that the received data is not over-written by next received data. In case of implemented with NAPI,
since NAPI has time-lagging after receiving first packet, probability of over-written(discarded) buffer is to be high. Thus, for our CAN HW, we should NOT implement with NAPI but normal "netif_rx".
Quoted 4 lines
True, if you just use one RX-Object. But it just helps a little bit and it would be much better to use the buffering on RX messages in the CAN controller hardware, either by using more than one RX object, or combining RX objects to a FIFO, or whatever your CAN controller supports.
Good point!
As long as the order of the received CAN frames is not shuffled (-> plain FIFO behaviour) using more than one RX buffer is a good idea.
Just a remark:
During the IDF the informations about the Topcliff Controller Hub have been reworked, so that some of the documentation became available for the public:
http://edc.intel.com/Platforms/Atom-E6xx/#hardware
Especially the Datasheet for the Platform Controller Hub EG20T can be found:
http://download.intel.com/embedded/chipsets/datasheet/324211.pdf
In chapter 13 there are some details about the CAN controller.
Regards,
Oliver
Quoted 32 lines · Oliver Hartkopp
Quoted 16 lines · Wolfgang Grandegger
Quoted 6 lines · Masayuki Ohtake
Hi Marc,
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
- implement NAPI
Since Topcliff CAN HW register has only single rx buffer, I think NAPI is unnecessary.
Quoted 8 lines
Quoted 1 line
Doesn't matter. Please try to implement it.
Our CAN driver must pull received data from CAN-HW rx buffer as fast as it can so that the received data is not over-written by next received data. In case of implemented with NAPI,
since NAPI has time-lagging after receiving first packet, probability of over-written(discarded) buffer is to be high. Thus, for our CAN HW, we should NOT implement with NAPI but normal "netif_rx".Quoted 4 lines
True, if you just use one RX-Object. But it just helps a little bit and it would be much better to use the buffering on RX messages in the CAN controller hardware, either by using more than one RX object, or combining RX objects to a FIFO, or whatever your CAN controller supports.
Good point!
As long as the order of the received CAN frames is not shuffled (-> plain FIFO behaviour) using more than one RX buffer is a good idea.
Just a remark:
During the IDF the informations about the Topcliff Controller Hub have been reworked, so that some of the documentation became available for the public:
Quoted 7 lines
http://edc.intel.com/Platforms/Atom-E6xx/#hardware
Especially the Datasheet for the Platform Controller Hub EG20T can be found:
http://download.intel.com/embedded/chipsets/datasheet/324211.pdf
In chapter 13 there are some details about the CAN controller.
Ah, thanks for the link. The CAN controller seems then to be similar to the OKI MSM9225B.
Wolfgang.
Marc Kleine-Budde
maintainerQuoted 7 lines · Wolfgang Grandegger
Quoted 7 lines
Just a remark:
During the IDF the informations about the Topcliff Controller Hub have been reworked, so that some of the documentation became available for the public:
Quoted 8 lines
Quoted 5 lines
Especially the Datasheet for the Platform Controller Hub EG20T can be found:
http://download.intel.com/embedded/chipsets/datasheet/324211.pdf
In chapter 13 there are some details about the CAN controller.
Ah, thanks for the link. The CAN controller seems then to be similar to the OKI MSM9225B.
According to the datasheet for the msm9225 I found, the chip has got an 8 bit interface (mmap'ed or spi). The Intel is 32 bit based (most, maybe all, upper 16 bit are marked as reserverd).
cheers, Marc
Signature · 4 lines
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 |
Quoted 12 lines · Marc Kleine-Budde
Quoted 11 lines · Wolfgang Grandegger
Quoted 11 lines
Just a remark:
During the IDF the informations about the Topcliff Controller Hub have been reworked, so that some of the documentation became available for the public:
http://edc.intel.com/Platforms/Atom-E6xx/#hardware
Especially the Datasheet for the Platform Controller Hub EG20T can be found:
http://download.intel.com/embedded/chipsets/datasheet/324211.pdf
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
In chapter 13 there are some details about the CAN controller.
Ah, thanks for the link. The CAN controller seems then to be similar to the OKI MSM9225B.
According to the datasheet for the msm9225 I found, the chip has got an 8 bit interface (mmap'ed or spi). The Intel is 32 bit based (most, maybe all, upper 16 bit are marked as reserverd).
I said *similar*, especially in respect to ability of combining RX message objects to a fifo.
Wolfgang.
Quoted 2 lines · Masayuki Ohtake
Quoted 1 line
- Try to send patches directly with git send-email
In our network environment, we can't use send-email.
Then try setting up a Linux server to handle email issues to prevent patches from going through Exchange, which is known to corrupt patches. Lots of other companies do this for Linux development, including Microsoft :)
thanks,
greg k-h
Hi Greg,
Quoted 2 lines
Then try setting up a Linux server to handle email issues to prevent patches from going through Exchange, which is known to corrupt patches.
We want to use "git send-email".
I have already installed "git send-email".
What's else setting we need ?
Thanks, Ohtake(OKISemi)
----- Original Message -----
From: "Greg KH" <[email protected]>
To: "Masayuki Ohtake" <masa-korg-ECg8zkTtlr0C6LszWs/[email protected]>
Cc: "Marc Kleine-Budde" <[email protected]>; <[email protected]>; "Wolfgang Grandegger" <[email protected]>; <[email protected]>; <[email protected]>; <[email protected]>; <arjan-VuQAYsv1563Yd54FQh9/[email protected]>; <[email protected]>; <[email protected]>; "Morinaga" <morinaga526-ECg8zkTtlr0C6LszWs/[email protected]>
Sent: Tuesday, September 14, 2010 12:22 AM
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: Update PCH_CAN driver to 2.6.35
Quoted 13 lines · Masayuki Ohtake
Quoted 2 lines
Quoted 1 line
- Try to send patches directly with git send-email
In our network environment, we can't use send-email.
Then try setting up a Linux server to handle email issues to prevent patches from going through Exchange, which is known to corrupt patches. Lots of other companies do this for Linux development, including Microsoft :)
thanks,
greg k-h
A message that is not in the archive (sent off-list or not yet received): 00ca01cb53e9$a50c1930$66f8800a-a06+6cuVnkTSQfdrb5gaxUEOCMrvLtNR@public.gmane.org
Quoted 7 lines · Masayuki Ohtake
Hi Greg,
Quoted 2 lines
Then try setting up a Linux server to handle email issues to prevent patches from going through Exchange, which is known to corrupt patches.
We want to use "git send-email".
I have already installed "git send-email".
What's else setting we need ?
You just need to use it then :)
Read the documention on how to do so, it is quite detailed.
good luck,
greg k-h
Hi Greg,
We have already tried to execute "git send-email" for sending our patch. Command "git send-email" returns success message,
but destination email client can't receive the patch.
We will continue analyzing so that "git send-email" works well.
Thanks, Ohtake(OKISemi)
----- Original Message -----
From: "Greg KH" <[email protected]>
To: "Masayuki Ohtake" <masa-korg-ECg8zkTtlr0C6LszWs/[email protected]>
Cc: "Marc Kleine-Budde" <[email protected]>; <[email protected]>; "Wolfgang Grandegger" <[email protected]>; <[email protected]>; <[email protected]>; <[email protected]>; <arjan-VuQAYsv1563Yd54FQh9/[email protected]>; <[email protected]>; <[email protected]>; "Morinaga" <morinaga526-ECg8zkTtlr0C6LszWs/[email protected]>
Sent: Tuesday, September 14, 2010 10:10 PM
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: Update PCH_CAN driver to 2.6.35
Quoted 21 lines · Masayuki Ohtake
Quoted 7 lines
Hi Greg,
Quoted 2 lines
Then try setting up a Linux server to handle email issues to prevent patches from going through Exchange, which is known to corrupt patches.
We want to use "git send-email".
I have already installed "git send-email".
What's else setting we need ?You just need to use it then :)
Read the documention on how to do so, it is quite detailed.
good luck,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html