* [bug report] PCI: rockchip: Add EP driver for Rockchip PCIe controller
@ 2018-07-12 12:33 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2018-07-12 12:33 UTC (permalink / raw)
To: shawn.lin; +Cc: linux-pci, linux-rockchip
Hello Shawn Lin,
The patch cf590b078391: "PCI: rockchip: Add EP driver for Rockchip
PCIe controller" from May 9, 2018, leads to the following static
checker warning:
drivers/pci/controller/pcie-rockchip-ep.c:380 rockchip_pcie_ep_assert_intx()
warn: '(1 << (19))' 524288 can't fit into 65535 'status'
drivers/pci/controller/pcie-rockchip-ep.c
347 static void rockchip_pcie_ep_assert_intx(struct rockchip_pcie_ep *ep, u8 fn,
348 u8 intx, bool is_asserted)
349 {
350 struct rockchip_pcie *rockchip = &ep->rockchip;
351 u32 r = ep->max_regions - 1;
352 u32 offset;
353 u16 status;
354 u8 msg_code;
355
356 if (unlikely(ep->irq_pci_addr != ROCKCHIP_PCIE_EP_PCI_LEGACY_IRQ_ADDR ||
357 ep->irq_pci_fn != fn)) {
358 rockchip_pcie_prog_ep_ob_atu(rockchip, fn, r,
359 AXI_WRAPPER_NOR_MSG,
360 ep->irq_phys_addr, 0, 0);
361 ep->irq_pci_addr = ROCKCHIP_PCIE_EP_PCI_LEGACY_IRQ_ADDR;
362 ep->irq_pci_fn = fn;
363 }
364
365 intx &= 3;
366 if (is_asserted) {
367 ep->irq_pending |= BIT(intx);
368 msg_code = ROCKCHIP_PCIE_MSG_CODE_ASSERT_INTA + intx;
369 } else {
370 ep->irq_pending &= ~BIT(intx);
371 msg_code = ROCKCHIP_PCIE_MSG_CODE_DEASSERT_INTA + intx;
372 }
373
374 status = rockchip_pcie_read(rockchip,
375 ROCKCHIP_PCIE_EP_FUNC_BASE(fn) +
376 ROCKCHIP_PCIE_EP_CMD_STATUS);
377 status &= ROCKCHIP_PCIE_EP_CMD_STATUS_IS;
378
379 if ((status != 0) ^ (ep->irq_pending != 0)) {
380 status ^= ROCKCHIP_PCIE_EP_CMD_STATUS_IS;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
status is a u16 but we're twiddling BIT(19).
381 rockchip_pcie_write(rockchip, status,
382 ROCKCHIP_PCIE_EP_FUNC_BASE(fn) +
383 ROCKCHIP_PCIE_EP_CMD_STATUS);
384 }
385
386 offset =
387 ROCKCHIP_PCIE_MSG_ROUTING(ROCKCHIP_PCIE_MSG_ROUTING_LOCAL_INTX) |
388 ROCKCHIP_PCIE_MSG_CODE(msg_code) | ROCKCHIP_PCIE_MSG_NO_DATA;
389 writel(0, ep->irq_cpu_addr + offset);
390 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* [bug report] PCI: rockchip: Add EP driver for Rockchip PCIe controller
@ 2018-07-12 12:33 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2018-07-12 12:33 UTC (permalink / raw)
To: shawn.lin-TNX95d0MmH7DzftRWevZcw
Cc: linux-pci-u79uwXL29TY76Z2rM5mHXA,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Hello Shawn Lin,
The patch cf590b078391: "PCI: rockchip: Add EP driver for Rockchip
PCIe controller" from May 9, 2018, leads to the following static
checker warning:
drivers/pci/controller/pcie-rockchip-ep.c:380 rockchip_pcie_ep_assert_intx()
warn: '(1 << (19))' 524288 can't fit into 65535 'status'
drivers/pci/controller/pcie-rockchip-ep.c
347 static void rockchip_pcie_ep_assert_intx(struct rockchip_pcie_ep *ep, u8 fn,
348 u8 intx, bool is_asserted)
349 {
350 struct rockchip_pcie *rockchip = &ep->rockchip;
351 u32 r = ep->max_regions - 1;
352 u32 offset;
353 u16 status;
354 u8 msg_code;
355
356 if (unlikely(ep->irq_pci_addr != ROCKCHIP_PCIE_EP_PCI_LEGACY_IRQ_ADDR ||
357 ep->irq_pci_fn != fn)) {
358 rockchip_pcie_prog_ep_ob_atu(rockchip, fn, r,
359 AXI_WRAPPER_NOR_MSG,
360 ep->irq_phys_addr, 0, 0);
361 ep->irq_pci_addr = ROCKCHIP_PCIE_EP_PCI_LEGACY_IRQ_ADDR;
362 ep->irq_pci_fn = fn;
363 }
364
365 intx &= 3;
366 if (is_asserted) {
367 ep->irq_pending |= BIT(intx);
368 msg_code = ROCKCHIP_PCIE_MSG_CODE_ASSERT_INTA + intx;
369 } else {
370 ep->irq_pending &= ~BIT(intx);
371 msg_code = ROCKCHIP_PCIE_MSG_CODE_DEASSERT_INTA + intx;
372 }
373
374 status = rockchip_pcie_read(rockchip,
375 ROCKCHIP_PCIE_EP_FUNC_BASE(fn) +
376 ROCKCHIP_PCIE_EP_CMD_STATUS);
377 status &= ROCKCHIP_PCIE_EP_CMD_STATUS_IS;
378
379 if ((status != 0) ^ (ep->irq_pending != 0)) {
380 status ^= ROCKCHIP_PCIE_EP_CMD_STATUS_IS;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
status is a u16 but we're twiddling BIT(19).
381 rockchip_pcie_write(rockchip, status,
382 ROCKCHIP_PCIE_EP_FUNC_BASE(fn) +
383 ROCKCHIP_PCIE_EP_CMD_STATUS);
384 }
385
386 offset =
387 ROCKCHIP_PCIE_MSG_ROUTING(ROCKCHIP_PCIE_MSG_ROUTING_LOCAL_INTX) |
388 ROCKCHIP_PCIE_MSG_CODE(msg_code) | ROCKCHIP_PCIE_MSG_NO_DATA;
389 writel(0, ep->irq_cpu_addr + offset);
390 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-12 12:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-12 12:33 [bug report] PCI: rockchip: Add EP driver for Rockchip PCIe controller Dan Carpenter
2018-07-12 12:33 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.