at91_can.c (0199f866615921ddc5d22fbbab7510e8b403d40c) | at91_can.c (88bfb9a713563550b1febb1a89b3a192efe2d091) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * at91_can.c - CAN network driver for AT91 SoC CAN controller 4 * 5 * (C) 2007 by Hans J. Koch <hjk@hansjkoch.de> 6 * (C) 2008, 2009, 2010, 2011 by Marc Kleine-Budde <kernel@pengutronix.de> 7 */ 8 --- 629 unchanged lines hidden (view full) --- 638 * 639 * Like it or not, but the chip always saves a received CAN message 640 * into the first free mailbox it finds (starting with the 641 * lowest). This makes it very difficult to read the messages in the 642 * right order from the chip. This is how we work around that problem: 643 * 644 * The first message goes into mb nr. 1 and issues an interrupt. All 645 * rx ints are disabled in the interrupt handler and a napi poll is | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * at91_can.c - CAN network driver for AT91 SoC CAN controller 4 * 5 * (C) 2007 by Hans J. Koch <hjk@hansjkoch.de> 6 * (C) 2008, 2009, 2010, 2011 by Marc Kleine-Budde <kernel@pengutronix.de> 7 */ 8 --- 629 unchanged lines hidden (view full) --- 638 * 639 * Like it or not, but the chip always saves a received CAN message 640 * into the first free mailbox it finds (starting with the 641 * lowest). This makes it very difficult to read the messages in the 642 * right order from the chip. This is how we work around that problem: 643 * 644 * The first message goes into mb nr. 1 and issues an interrupt. All 645 * rx ints are disabled in the interrupt handler and a napi poll is |
646 * scheduled. We read the mailbox, but do _not_ reenable the mb (to | 646 * scheduled. We read the mailbox, but do _not_ re-enable the mb (to |
647 * receive another message). 648 * 649 * lower mbxs upper 650 * ____^______ __^__ 651 * / \ / \ 652 * +-+-+-+-+-+-+-+-++-+-+-+-+ 653 * | |x|x|x|x|x|x|x|| | | | | 654 * +-+-+-+-+-+-+-+-++-+-+-+-+ 655 * 0 0 0 0 0 0 0 0 0 0 1 1 \ mail 656 * 0 1 2 3 4 5 6 7 8 9 0 1 / box 657 * ^ 658 * | 659 * \ 660 * unused, due to chip bug 661 * 662 * The variable priv->rx_next points to the next mailbox to read a 663 * message from. As long we're in the lower mailboxes we just read the | 647 * receive another message). 648 * 649 * lower mbxs upper 650 * ____^______ __^__ 651 * / \ / \ 652 * +-+-+-+-+-+-+-+-++-+-+-+-+ 653 * | |x|x|x|x|x|x|x|| | | | | 654 * +-+-+-+-+-+-+-+-++-+-+-+-+ 655 * 0 0 0 0 0 0 0 0 0 0 1 1 \ mail 656 * 0 1 2 3 4 5 6 7 8 9 0 1 / box 657 * ^ 658 * | 659 * \ 660 * unused, due to chip bug 661 * 662 * The variable priv->rx_next points to the next mailbox to read a 663 * message from. As long we're in the lower mailboxes we just read the |
664 * mailbox but not reenable it. | 664 * mailbox but not re-enable it. |
665 * | 665 * |
666 * With completion of the last of the lower mailboxes, we reenable the | 666 * With completion of the last of the lower mailboxes, we re-enable the |
667 * whole first group, but continue to look for filled mailboxes in the 668 * upper mailboxes. Imagine the second group like overflow mailboxes, 669 * which takes CAN messages if the lower goup is full. While in the | 667 * whole first group, but continue to look for filled mailboxes in the 668 * upper mailboxes. Imagine the second group like overflow mailboxes, 669 * which takes CAN messages if the lower goup is full. While in the |
670 * upper group we reenable the mailbox right after reading it. Giving | 670 * upper group we re-enable the mailbox right after reading it. Giving |
671 * the chip more room to store messages. 672 * 673 * After finishing we look again in the lower group if we've still 674 * quota. 675 * 676 */ 677static int at91_poll_rx(struct net_device *dev, int quota) 678{ --- 737 unchanged lines hidden --- | 671 * the chip more room to store messages. 672 * 673 * After finishing we look again in the lower group if we've still 674 * quota. 675 * 676 */ 677static int at91_poll_rx(struct net_device *dev, int quota) 678{ --- 737 unchanged lines hidden --- |