[linux-yocto][linux-yocto v5.4/standard/nxp-s32g2xx][PATCH] s32: flexcan: integrate two patches that fix the same bug

2021-02-01 Thread Xu, Yanfei
From: Yanfei Xu 

Commit:621e14659f37("can: flexcan: drop repetitive execution
can_rx_offload_add_timestamp") and commit:3713ba3e41db("s32: flexcan:
Remove duplicated code as part of kernel 5.4-rt initial merge") fix the
same flexcan bug in different way, and both of them are contained in
codes, that causes the flexcan_open() always run failed.

Here we remove the commit:621e14659f37 and intergrate codes, and revert
a relevant commit:26f171fbcbe1("s32: flexcan: Remove unused function
flexcan_mailbox_read()")

Signed-off-by: Yanfei Xu 
---
 drivers/net/can/flexcan.c | 133 ++
 1 file changed, 133 insertions(+)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 9cf016f7021a..38c6041d3b65 100755
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -1051,6 +1051,117 @@ static inline struct flexcan_priv 
*rx_offload_to_priv(struct can_rx_offload *off
return container_of(offload, struct flexcan_priv, offload);
 }
 
+static unsigned int flexcan_mailbox_read(struct can_rx_offload *offload,
+bool drop, struct sk_buff **skb,
+u32 *timestamp, unsigned int n)
+{
+   struct flexcan_priv *priv = rx_offload_to_priv(offload);
+   struct flexcan_regs __iomem *regs = priv->regs;
+   struct flexcan_mb __iomem *mb;
+   struct canfd_frame *cf;
+   u32 reg_ctrl, reg_id, reg_iflag1;
+   int i, j;
+   unsigned long flags;
+
+   mb = flexcan_get_mb(priv, n);
+
+   spin_lock_irqsave(>timer_access, flags);
+   if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) {
+   u32 code;
+
+   do {
+   reg_ctrl = priv->read(>can_ctrl);
+   } while (reg_ctrl & FLEXCAN_MB_CODE_RX_BUSY_BIT);
+
+   /* is this MB empty? */
+   code = reg_ctrl & FLEXCAN_MB_CODE_MASK;
+   if ((code != FLEXCAN_MB_CODE_RX_FULL) &&
+   (code != FLEXCAN_MB_CODE_RX_OVERRUN)) {
+   spin_unlock_irqrestore(>timer_access, flags);
+   return 0;
+   }
+
+   if (code == FLEXCAN_MB_CODE_RX_OVERRUN) {
+   /* This MB was overrun, we lost data */
+   offload->dev->stats.rx_over_errors++;
+   offload->dev->stats.rx_errors++;
+   }
+   } else {
+   reg_iflag1 = priv->read(>iflag1);
+   if (!(reg_iflag1 & FLEXCAN_IFLAG_RX_FIFO_AVAILABLE)) {
+   spin_unlock_irqrestore(>timer_access, flags);
+   return 0;
+   }
+
+   reg_ctrl = priv->read(>can_ctrl);
+   }
+
+   if (!drop) {
+   if (reg_ctrl & FLEXCAN_MB_CNT_EDL)
+   *skb = alloc_canfd_skb(offload->dev, );
+   else
+   *skb = alloc_can_skb(offload->dev,
+(struct can_frame **));
+
+   if (!*skb)
+   goto ack_mailbox;
+
+   /* increase timstamp to full 32 bit */
+   *timestamp = reg_ctrl << 16;
+
+   reg_id = priv->read(>can_id);
+   if (reg_ctrl & FLEXCAN_MB_CNT_IDE)
+   cf->can_id = ((reg_id >> 0) & CAN_EFF_MASK) |
+CAN_EFF_FLAG;
+   else
+   cf->can_id = (reg_id >> 18) & CAN_SFF_MASK;
+
+   if (reg_ctrl & FLEXCAN_MB_CNT_EDL) {
+   cf->len = can_dlc2len((reg_ctrl >> 16) & 0x0F);
+
+
+   if (reg_ctrl & FLEXCAN_MB_CNT_BRS)
+   cf->flags |= CANFD_BRS;
+   } else {
+   cf->len = get_can_dlc((reg_ctrl >> 16) & 0x0F);
+
+   if (reg_ctrl & FLEXCAN_MB_CNT_RTR)
+   cf->can_id |= CAN_RTR_FLAG;
+   }
+
+   if (reg_ctrl & FLEXCAN_MB_CNT_ESI) {
+   cf->flags |= CANFD_ESI;
+   netdev_warn(priv->can.dev, "ESI Error\n");
+   }
+
+   for (i = 0, j = 0; i < cf->len; i += sizeof(u32), j++) {
+   __be32 data = cpu_to_be32(priv->read(>data[j]));
+   *(__be32 *)(cf->data + i) = data;
+   }
+   }
+
+ack_mailbox:   
+   /* mark as read */
+   if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) {
+   /* Clear IRQ */
+   if (n < 32)
+   priv->write(BIT(n), >iflag1);
+   else
+   priv->write(BIT(n - 32), >iflag2);
+   } else {
+   priv->write(FLEXCAN_IFLAG_RX_FIFO_AVAILABLE, >iflag1);
+   }
+
+   /* Read the Free Running Timer. It is optional but recommended
+* to unlock Mailbox as soon as possible and make it available

Re: [linux-yocto][yocto-kernel-cache][yocto-5.4][PATCH] ti-j72xx: add CONFIG_EXPERT config

2021-02-01 Thread Bruce Ashfield
In theory this is something that we shouldn't be setting
on a per-BSP basis, but instead using something more common
like the developer ktype.

But we've already got this in a few BSPs, and I'll not
bother with the clean up for now, so this is merged.

Bruce

In message: [linux-yocto][yocto-kernel-cache][yocto-5.4][PATCH] ti-j72xx: add 
CONFIG_EXPERT config
on 01/02/2021 Xulin Sun wrote:

> CONFIG_EXPERT will involve the CONFIG_COMPAT, which is to execute 32-bit
> userspace applications. Usually this COMPAT config depends on 4K PAGES,
> now this BSP is 64K_PAGES. So need to add the EXPERT config.
> 
> Signed-off-by: Xulin Sun 
> ---
>  bsp/ti-j72xx/ti-j72xx.cfg | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/bsp/ti-j72xx/ti-j72xx.cfg b/bsp/ti-j72xx/ti-j72xx.cfg
> index 4bec5b2b..122f6954 100755
> --- a/bsp/ti-j72xx/ti-j72xx.cfg
> +++ b/bsp/ti-j72xx/ti-j72xx.cfg
> @@ -28,6 +28,7 @@ CONFIG_ARCH_K3_AM6_SOC=y
>  CONFIG_CMA=y
>  CONFIG_DMA_CMA=y
>  
> +CONFIG_EXPERT=y
>  CONFIG_ARM64_64K_PAGES=y
>  CONFIG_TRANSPARENT_HUGEPAGE=y
>  CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y
> -- 
> 2.17.1
> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9441): 
https://lists.yoctoproject.org/g/linux-yocto/message/9441
Mute This Topic: https://lists.yoctoproject.org/mt/80274483/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [linux-yocto][yocto-kernel-cache][yocto-5.4][PATCH] nxp-imx8: add USB support

2021-02-01 Thread Bruce Ashfield
merged

Bruce


In message: [linux-yocto][yocto-kernel-cache][yocto-5.4][PATCH] nxp-imx8: add 
USB support
on 27/01/2021 Jun Miao wrote:

> Enable the CONFIGS for ChipIdea Highspeed Dual Role Controller support, and 
> the
> USB connector is on the imx8qmmek Base Board(MCIMX8-8X-BB).
> 
> Signed-off-by: Jun Miao 
> ---
>  bsp/nxp-imx8/nxp-imx8.cfg | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/bsp/nxp-imx8/nxp-imx8.cfg b/bsp/nxp-imx8/nxp-imx8.cfg
> index 42e4c6a5..65114274 100644
> --- a/bsp/nxp-imx8/nxp-imx8.cfg
> +++ b/bsp/nxp-imx8/nxp-imx8.cfg
> @@ -66,6 +66,9 @@ CONFIG_USB_ULPI=y
>  CONFIG_USB_ULPI_VIEWPORT=y
>  CONFIG_USB_SNP_CORE=y
>  CONFIG_USB_SNP_UDC_PLAT=y
> +CONFIG_USB_CHIPIDEA=y
> +CONFIG_USB_CHIPIDEA_UDC=y
> +CONFIG_USB_CHIPIDEA_HOST=y
>  
>  #
>  ## Random Number Generation
> -- 
> 2.25.1
> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9440): 
https://lists.yoctoproject.org/g/linux-yocto/message/9440
Mute This Topic: https://lists.yoctoproject.org/mt/80154460/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-