Sorry Marc, i was probably wrong with my assumption below:

There IS a significant difference in the flexcan_chip_start() function of the
'freescale modified' flexcan driver posted by Mike:

The FLEXCAN_MCR_SRX_DIS bit is set there, which means:

---8<---
This bit defines whether FlexCAN is allowed to receive frames transmitted by
itself. If this bit is set to 1, frames transmitted by the module are not
stored in any message buffer, regardless if the message buffer is programmed
with an ID that matches the transmitted frame, and no interrupt flag or
interrupt signal is generated due to the frame reception.
0 Self reception enabled
1 Self reception disabled
---8<---

See the diff here:

--- flexcan     2011-07-19 23:30:55.411117151 +0200
+++ net-next-2.6/drivers/net/can/flexcan.c      2011-06-21 15:20:23.220000347 
+0200
@@ -540,12 +675,12 @@
         * choose format C
         *
         */
-       reg_mcr = flexcan_cb->read(&regs->mcr);
+       reg_mcr = readl(&regs->mcr);
        reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_FEN | FLEXCAN_MCR_HALT |
-               FLEXCAN_MCR_SUPV | FLEXCAN_MCR_WRN_EN | FLEXCAN_MCR_IDAM_C |
-               FLEXCAN_MCR_SRX_DIS;
+               FLEXCAN_MCR_SUPV | FLEXCAN_MCR_WRN_EN |
+               FLEXCAN_MCR_IDAM_C;
        dev_dbg(dev->dev.parent, "%s: writing mcr=0x%08x", __func__, reg_mcr);
-       flexcan_cb->write(reg_mcr, &regs->mcr);
+       writel(reg_mcr, &regs->mcr);
 
        /*
         * CTRL


Mike, please check if removing the FLEXCAN_MCR_SRX_DIS bit in reg_mcr fixes the
problem, when 'dev->flags |= IFF_ECHO' is enabled again.

Regards,
Oliver


On 19.07.2011 23:08, Oliver Hartkopp wrote:
> On 19.07.2011 21:50, Wolfgang Grandegger wrote:
> 
>>>>> Safe to assume that the flexcan driver doesn't support loopback as 
>>>>> described
>>>>> then?
>>>>>
>>>>> http://lxr.linux.no/#linux+v2.6.39/Documentation/networking/can.txt#L580
>>>>
>>>> Yes. Sigh.
>>>>
>>>> So this can be temporarily fixed by removing the line which sets IFF_ECHO 
>>>> ...
>>>> but of course should be fixed by implementing the can_echo_skb stuff.
>>>
>>>>>  dev->flags |= IFF_ECHO; /* we support local echo in hardware */
>>>
>>> IIRC, loopback is really done in hardware and the driver is working
>>> properly on ARM processors.
>>
>> See:
>>
>> https://lists.berlios.de/pipermail/socketcan-core/2010-June/004432.html
> 
> Yes, but i'm pretty sure Marc mixed up the hardware loopback of the FlexCAN
> controller with the IFF_ECHO requirement. The FlexCAN spec says:
> 
> "Loopback mode — The module enters this mode when the LPB bit in the control
> register is set to 1. In this mode, FlexCAN performs an internal loopback that
> can be used for self test operation. The bit stream output of the transmitter
> is internally fed back to the receiver input. The Rx CAN input
>  signal is ignored and the Tx CAN output goes to the recessive state (logic
> ‘1’). FlexCAN behaves as it normally does when transmitting and treats its own
> transmitted message as a message received from a remote node. In this mode,
> FlexCAN ignores the bit sent during the ACK slot in the CAN frame acknowledge
> field to ensure proper reception of its own message. Both transmit and receive
> interrupts are generated."
> 
> This means the "Rx CAN input signal is ignored" => only self test.
> 
> Regards,
> Oliver
> _______________________________________________
> Socketcan-users mailing list
> [email protected]
> https://lists.berlios.de/mailman/listinfo/socketcan-users

_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users

Reply via email to