From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oliver Hartkopp Subject: Re: [RFC PATCH] can: m_can: Support higher speed CAN-FD bitrates Date: Thu, 19 Oct 2017 22:17:11 +0200 Message-ID: <6f916786-7a91-9265-7b43-635d022c61ab@hartkopp.net> References: <20170818193947.27862-1-fcooper@ti.com> <4f8f6b64-b2a2-b9dc-665c-f1c155daf994@ti.com> <532e09ae-775d-e8aa-e468-78e148c650da@Microchip.com> <88d4ddc4-b786-0205-6852-56e93182a1c9@ti.com> <08432016-e733-b827-b9aa-bc359dd837f5@pengutronix.de> <7ba515d9-7710-c152-a55a-f995b7f3d49a@ti.com> <848e965d-e6a1-8930-9064-0317563326c0@ti.com> <93c6d531-c38b-6f88-510f-59eb3e733b78@ti.com> <545ac690-10c8-b206-76dd-dbbe602eb6af@pengutronix.de> <0099eefa-32c8-a818-761c-667239d9ec3b@pengutronix.de> <4b53c9ff-395f-670f-b55c-38ccfb37ac30@gmx.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: <4b53c9ff-395f-670f-b55c-38ccfb37ac30@gmx.net> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: =?UTF-8?Q?Mario_H=c3=bcttel?= , Marc Kleine-Budde , Sekhar Nori , Franklin S Cooper Jr , "Yang, Wenyou" , wg@grandegger.com, quentin.schulz@free-electrons.com, edumazet@google.com, linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Wenyou Yang , Dong Aisheng , "Quadros, Roger" List-Id: linux-can.vger.kernel.org On 10/19/2017 09:54 PM, Mario Hüttel wrote: > On 10/19/2017 08:35 PM, Oliver Hartkopp wrote: >> We already have this 'dsample-point' implemented in the ip tool: >> >> $ ip link set vcan0 type can help >> Usage: ip link set DEVICE type can >>     [ bitrate BITRATE [ sample-point SAMPLE-POINT] ] | >>     [ tq TQ prop-seg PROP_SEG phase-seg1 PHASE-SEG1 >>        phase-seg2 PHASE-SEG2 [ sjw SJW ] ] >> >>     [ dbitrate BITRATE [ dsample-point SAMPLE-POINT] ] |  <<-- here! >>     [ dtq TQ dprop-seg PROP_SEG dphase-seg1 PHASE-SEG1 >>        dphase-seg2 PHASE-SEG2 [ dsjw SJW ] ] >> >> But AFAIK m_can is not using that value in m_can_set_bittiming(). >> > Actually I need some clarification. The sample point of the can core is > between the two time segments. > I always thought that the "sample point" options of the ip tool are used > in the internal > calculation of the two timing segments and is therefore no individual value. You are right. See picture at http://www.bittiming.can-wiki.info/ Usually you can give the bitrate and the sample point (which is at 75% aka 0.750 by default) and then the kernel-internal bitrate calculating algorithm calculates the tq prop-seg phase-seg1 phase-seg2 stuff. Alternatively you can provide the tq prop-seg phase-seg1 phase-seg2 stuff on your own which is set to the CAN controller registers then. For that reason my remark "m_can is not using that value" was wrong as m_can just uses the tq prop-seg phase-seg1 phase-seg2 stuff - either from the bitrate calculation or provided by the user. Thanks for the question ;-) Best, Oliver