In message: [PATCH linux-yocto] v6.1/standard/bcm-2xxx-rpi: synchronize with 
reference branch
on 22/10/2024 Kevin Hao wrote:

> From: Bruce Ashfield <bruce.ashfi...@gmail.com>
> 
> Signed-off-by: Bruce Ashfield <bruce.ashfi...@gmail.com>
> [Kevin: Adjust the patch subject prefix.]
> Signed-off-by: Kevin Hao <haoke...@gmail.com>
> ---
> Hi Bruce,
> 
> This patch is cherry-picked from v5.15/standard/bcm-2xxx-rpi and it is
> also needed by the following two branches:
>   v6.1/standard/bcm-2xxx-rpi
>   v6.1/standard/preempt-rt/bcm-2xxx-rpi

merged.

Bruce

> ---
>  drivers/mailbox/bcm2835-mailbox.c |  1 -
>  drivers/usb/host/xhci-mem.c       | 50 
> ++++-----------------------------------
>  drivers/usb/host/xhci-ring.c      |  2 +-
>  3 files changed, 6 insertions(+), 47 deletions(-)
> 
> diff --git a/drivers/mailbox/bcm2835-mailbox.c 
> b/drivers/mailbox/bcm2835-mailbox.c
> index 09195a697829..278fe6f714d7 100644
> --- a/drivers/mailbox/bcm2835-mailbox.c
> +++ b/drivers/mailbox/bcm2835-mailbox.c
> @@ -150,7 +150,6 @@ static int bcm2835_mbox_probe(struct platform_device 
> *pdev)
>       ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0),
>                              bcm2835_mbox_irq, IRQF_NO_SUSPEND, dev_name(dev),
>                              mbox);
> -
>       if (ret) {
>               dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n",
>                       ret);
> diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
> index 34f6cc76509c..94c0956f37f1 100644
> --- a/drivers/usb/host/xhci-mem.c
> +++ b/drivers/usb/host/xhci-mem.c
> @@ -2310,6 +2310,7 @@ xhci_alloc_interrupter(struct xhci_hcd *xhci, unsigned 
> int intr_num, gfp_t flags
>       struct xhci_interrupter *ir;
>       u64 erst_base;
>       u32 erst_size;
> +     unsigned int val;
>       int ret;
>  
>       if (intr_num > xhci->max_interrupters) {
> @@ -2328,8 +2329,9 @@ xhci_alloc_interrupter(struct xhci_hcd *xhci, unsigned 
> int intr_num, gfp_t flags
>               return NULL;
>  
>       ir->ir_set = &xhci->run_regs->ir_set[intr_num];
> -     ir->event_ring = xhci_ring_alloc(xhci, ERST_NUM_SEGS, 1, TYPE_EVENT,
> -                                     0, flags);
> +     val = 1 << HCS_ERST_MAX(xhci->hcs_params2);
> +     val = min_t(unsigned int, ERST_MAX_SEGS, val);
> +     ir->event_ring = xhci_ring_alloc(xhci, val, 1, TYPE_EVENT, 0, flags);
>       if (!ir->event_ring) {
>               xhci_warn(xhci, "Failed to allocate interrupter %d event 
> ring\n", intr_num);
>               goto fail_ir;
> @@ -2344,7 +2346,7 @@ xhci_alloc_interrupter(struct xhci_hcd *xhci, unsigned 
> int intr_num, gfp_t flags
>       /* set ERST count with the number of entries in the segment table */
>       erst_size = readl(&ir->ir_set->erst_size);
>       erst_size &= ERST_SIZE_MASK;
> -     erst_size |= ERST_NUM_SEGS;
> +     erst_size |= val;
>       writel(erst_size, &ir->ir_set->erst_size);
>  
>       erst_base = xhci_read_64(xhci, &ir->ir_set->erst_base);
> @@ -2493,48 +2495,6 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
>       xhci->dba = (void __iomem *) xhci->cap_regs + val;
>       /* Set ir_set to interrupt register set 0 */
>  
> -     /*
> -      * Event ring setup: Allocate a normal ring, but also setup
> -      * the event ring segment table (ERST).  Section 4.9.3.
> -      */
> -     val2 = 1 << HCS_ERST_MAX(xhci->hcs_params2);
> -     val2 = min_t(unsigned int, ERST_MAX_SEGS, val2);
> -     xhci_dbg_trace(xhci, trace_xhci_dbg_init, "// Allocating event ring");
> -     xhci->event_ring = xhci_ring_alloc(xhci, val2, 1, TYPE_EVENT,
> -                                        0, flags);
> -     if (!xhci->event_ring)
> -             goto fail;
> -     if (xhci_check_trb_in_td_math(xhci) < 0)
> -             goto fail;
> -
> -     ret = xhci_alloc_erst(xhci, xhci->event_ring, &xhci->erst, flags);
> -     if (ret)
> -             goto fail;
> -
> -     /* set ERST count with the number of entries in the segment table */
> -     val = readl(&xhci->ir_set->erst_size);
> -     val &= ERST_SIZE_MASK;
> -     val |= val2;
> -     xhci_dbg_trace(xhci, trace_xhci_dbg_init,
> -                     "// Write ERST size = %i to ir_set 0 (some bits 
> preserved)",
> -                     val);
> -     writel(val, &xhci->ir_set->erst_size);
> -
> -     xhci_dbg_trace(xhci, trace_xhci_dbg_init,
> -                     "// Set ERST entries to point to event ring.");
> -     /* set the segment table base address */
> -     xhci_dbg_trace(xhci, trace_xhci_dbg_init,
> -                     "// Set ERST base address for ir_set 0 = 0x%llx",
> -                     (unsigned long long)xhci->erst.erst_dma_addr);
> -     val_64 = xhci_read_64(xhci, &xhci->ir_set->erst_base);
> -     val_64 &= ERST_PTR_MASK;
> -     val_64 |= (xhci->erst.erst_dma_addr & (u64) ~ERST_PTR_MASK);
> -     xhci_write_64(xhci, val_64, &xhci->ir_set->erst_base);
> -
> -     /* Set the event ring dequeue address */
> -     xhci_set_hc_event_deq(xhci);
> -     xhci_dbg_trace(xhci, trace_xhci_dbg_init,
> -                     "Wrote ERST address to ir_set 0.");
>       /* allocate and set up primary interrupter with an event ring. */
>       xhci_dbg_trace(xhci, trace_xhci_dbg_init,
>                      "Allocating primary event ring");
> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
> index 2f856af64de3..809d7d7ed5a1 100644
> --- a/drivers/usb/host/xhci-ring.c
> +++ b/drivers/usb/host/xhci-ring.c
> @@ -3197,7 +3197,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd)
>        * that clears the EHB.
>        */
>       while (xhci_handle_event(xhci, ir) > 0) {
> -             if (event_loop++ < TRBS_PER_SEGMENT / 2)
> +             if (event_loop++ < ir->event_ring->trbs_per_seg / 2)
>                       continue;
>               xhci_update_erst_dequeue(xhci, ir, event_ring_deq);
>               event_ring_deq = ir->event_ring->dequeue;
> 
> ---
> base-commit: b75c71b8e0f41eb05295774ea86e6a4f20005da6
> change-id: 20241022-v6-16-rpi-db9adb65a695
> 
> Best regards,
> -- 
> Kevin Hao <haoke...@gmail.com>
> 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#14491): 
https://lists.yoctoproject.org/g/linux-yocto/message/14491
Mute This Topic: https://lists.yoctoproject.org/mt/109147009/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to