[v2,00/18] CSI2RX support on J721E

Message ID 20210526152308.16525-1-p.yadav@ti.com (mailing list archive)
Headers
Series CSI2RX support on J721E |

Message

Pratyush Yadav May 26, 2021, 3:22 p.m. UTC
  Hi,

This series adds support for CSI2 capture on J721E. It includes some
fixes to the Cadence CSI2RX driver, adds Rx support to Cadence DPHY
driver, and finally adds the TI CSI2RX wrapper driver.

Tested on TI's J721E with OV5640 sensor.

Changes in v2:
- Use phy_pm_runtime_get_sync() and phy_pm_runtime_put() before making
  calls to set PHY mode, etc. to make sure it is ready.
- Add all 64 threads, instead of having only the one thread being
  currently used by the driver.
- Use dmaengine_get_dma_device() instead of directly accessing
  dma->device->dev.
- Do not set dst_addr_width when configuring slave DMA.
- Move to a separate subdir and rename to j721e-csi2rx.c
- Convert compatible to ti,j721e-csi2rx.
- Move to use Media Controller centric APIs.
- Improve cleanup in probe when one of the steps fails.
- Add colorspace to formats database.
- Set hw_revision on media_device.
- Move video device initialization to probe time instead of register time.
- Rename to ti,j721e-csi2rx.yaml
- Add an entry in MAINTAINERS.
- Add a description for the binding.
- Change compatible to ti,j721e-csi2rx to make it SoC specific.
- Remove description from dmas, reg, power-domains.
- Remove a limit of 2 from #address-cells and #size-cells.
- Fix add ^ to csi-bridge subnode regex.
- Make ranges mandatory.
- Add unit address in example.
- Add a reference to cdns,csi2rx in csi-bridge subnode.
- Expand the example to include the csi-bridge subnode as well.
- Re-order subject prefixes.
- Drop reg description.
- Add a description for each DPHY clock.
- Rename dphy@... to phy@... in example.
- Add Laurent's R-by.
- Re-order subject prefixes.
- Re-order subject prefixes.
- Add power-domain to the example.
- Add Laurent's R-by.
- Re-order subject prefixes.
- Convert OV5640 to use runtime PM and drop Cadence CSI2RX s_power patch.
- Drop subdev call wrappers from cdns-csi2rx.
- Move VPE and CAL to a separate subdir.
- Rename ti-csi2rx.c to j721e-csi2rx.c

Paul Kocialkowski (1):
  phy: Distinguish between Rx and Tx for MIPI D-PHY with submodes

Pratyush Yadav (17):
  phy: cdns-dphy: Prepare for Rx support
  phy: cdns-dphy: Allow setting mode
  phy: cdns-dphy: Add Rx support
  media: ov5640: Use runtime PM to control sensor power
  media: cadence: csi2rx: Add external DPHY support
  media: cadence: csi2rx: Soft reset the streams before starting capture
  media: cadence: csi2rx: Set the STOP bit when stopping a stream
  media: cadence: csi2rx: Fix stream data configuration
  media: cadence: csi2rx: Populate subdev devnode
  dmaengine: ti: k3-psil-j721e: Add entry for CSI2RX
  media: Re-structure TI platform drivers
  media: ti: Add CSI2RX support for J721E
  media: dt-bindings: Add DT bindings for TI J721E CSI2RX driver
  media: dt-bindings: Convert Cadence CSI2RX binding to YAML
  phy: dt-bindings: Convert Cadence DPHY binding to YAML
  phy: dt-bindings: cdns,dphy: make clocks optional
  phy: dt-bindings: cdns,dphy: add power-domains property

 .../devicetree/bindings/media/cdns,csi2rx.txt | 100 --
 .../bindings/media/cdns,csi2rx.yaml           | 164 ++++
 .../bindings/media/ti,j721e-csi2rx.yaml       | 101 ++
 .../devicetree/bindings/phy/cdns,dphy.txt     |  20 -
 .../devicetree/bindings/phy/cdns,dphy.yaml    |  54 ++
 MAINTAINERS                                   |  10 +-
 drivers/dma/ti/k3-psil-j721e.c                |  73 ++
 drivers/media/i2c/Kconfig                     |   2 +-
 drivers/media/i2c/ov5640.c                    | 124 ++-
 drivers/media/platform/Kconfig                |  12 +
 drivers/media/platform/Makefile               |   2 +-
 drivers/media/platform/cadence/cdns-csi2rx.c  | 196 +++-
 drivers/media/platform/ti/Makefile            |   4 +
 drivers/media/platform/ti/cal/Makefile        |   3 +
 .../{ti-vpe => ti/cal}/cal-camerarx.c         |   0
 .../platform/{ti-vpe => ti/cal}/cal-video.c   |   0
 .../media/platform/{ti-vpe => ti/cal}/cal.c   |   0
 .../media/platform/{ti-vpe => ti/cal}/cal.h   |   0
 .../platform/{ti-vpe => ti/cal}/cal_regs.h    |   0
 .../media/platform/ti/j721e-csi2rx/Makefile   |   2 +
 .../platform/ti/j721e-csi2rx/j721e-csi2rx.c   | 884 ++++++++++++++++++
 .../platform/{ti-vpe => ti/vpe}/Makefile      |   4 -
 .../media/platform/{ti-vpe => ti/vpe}/csc.c   |   0
 .../media/platform/{ti-vpe => ti/vpe}/csc.h   |   0
 .../media/platform/{ti-vpe => ti/vpe}/sc.c    |   0
 .../media/platform/{ti-vpe => ti/vpe}/sc.h    |   0
 .../platform/{ti-vpe => ti/vpe}/sc_coeff.h    |   0
 .../media/platform/{ti-vpe => ti/vpe}/vpdma.c |   0
 .../media/platform/{ti-vpe => ti/vpe}/vpdma.h |   0
 .../platform/{ti-vpe => ti/vpe}/vpdma_priv.h  |   0
 .../media/platform/{ti-vpe => ti/vpe}/vpe.c   |   0
 .../platform/{ti-vpe => ti/vpe}/vpe_regs.h    |   0
 drivers/phy/cadence/cdns-dphy.c               | 407 +++++++-
 include/linux/phy/phy-mipi-dphy.h             |  13 +
 34 files changed, 1950 insertions(+), 225 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/media/cdns,csi2rx.txt
 create mode 100644 Documentation/devicetree/bindings/media/cdns,csi2rx.yaml
 create mode 100644 Documentation/devicetree/bindings/media/ti,j721e-csi2rx.yaml
 delete mode 100644 Documentation/devicetree/bindings/phy/cdns,dphy.txt
 create mode 100644 Documentation/devicetree/bindings/phy/cdns,dphy.yaml
 create mode 100644 drivers/media/platform/ti/Makefile
 create mode 100644 drivers/media/platform/ti/cal/Makefile
 rename drivers/media/platform/{ti-vpe => ti/cal}/cal-camerarx.c (100%)
 rename drivers/media/platform/{ti-vpe => ti/cal}/cal-video.c (100%)
 rename drivers/media/platform/{ti-vpe => ti/cal}/cal.c (100%)
 rename drivers/media/platform/{ti-vpe => ti/cal}/cal.h (100%)
 rename drivers/media/platform/{ti-vpe => ti/cal}/cal_regs.h (100%)
 create mode 100644 drivers/media/platform/ti/j721e-csi2rx/Makefile
 create mode 100644 drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
 rename drivers/media/platform/{ti-vpe => ti/vpe}/Makefile (78%)
 rename drivers/media/platform/{ti-vpe => ti/vpe}/csc.c (100%)
 rename drivers/media/platform/{ti-vpe => ti/vpe}/csc.h (100%)
 rename drivers/media/platform/{ti-vpe => ti/vpe}/sc.c (100%)
 rename drivers/media/platform/{ti-vpe => ti/vpe}/sc.h (100%)
 rename drivers/media/platform/{ti-vpe => ti/vpe}/sc_coeff.h (100%)
 rename drivers/media/platform/{ti-vpe => ti/vpe}/vpdma.c (100%)
 rename drivers/media/platform/{ti-vpe => ti/vpe}/vpdma.h (100%)
 rename drivers/media/platform/{ti-vpe => ti/vpe}/vpdma_priv.h (100%)
 rename drivers/media/platform/{ti-vpe => ti/vpe}/vpe.c (100%)
 rename drivers/media/platform/{ti-vpe => ti/vpe}/vpe_regs.h (100%)
  

Comments

Tomi Valkeinen May 27, 2021, 12:42 p.m. UTC | #1
Hi Pratyush,

On 26/05/2021 18:22, Pratyush Yadav wrote:
> Hi,
> 
> This series adds support for CSI2 capture on J721E. It includes some
> fixes to the Cadence CSI2RX driver, adds Rx support to Cadence DPHY
> driver, and finally adds the TI CSI2RX wrapper driver.
> 
> Tested on TI's J721E with OV5640 sensor.

I'm having some trouble unloading and reloading the modules:

rmmod ti_cal
rmmod j721e_csi2rx
rmmod cdns_csi2rx
rmmod cdns_dphy
rmmod ov5640
[   37.943128] ------------[ cut here ]------------
[   37.947752] WARNING: CPU: 1 PID: 628 at drivers/media/v4l2-core/v4l2-ctrls-core.c:1807 __v4l2_ctrl_handler_setup+0x15c/0x170
[   37.958963] Modules linked in: ov5640(-) v4l2_fwnode tidss ti_tfp410 tc358767 display_connector cdns_mhdp8546 panel_simple drm_kms_helper drm drm_panel_orientation_quirks cfbfill
rect cfbimgblt cfbcopyarea phy_j721e_wiz phy_cadence_torrent [last unloaded: cdns_dphy]
[   37.982455] CPU: 1 PID: 628 Comm: rmmod Not tainted 5.13.0-rc1-00205-g93acc23badc8 #3
[   37.990271] Hardware name: Texas Instruments K3 J721E SoC (DT)
[   37.996090] pstate: 60000005 (nZCv daif -PAN -UAO -TCO BTYPE=--)
[   38.002085] pc : __v4l2_ctrl_handler_setup+0x15c/0x170
[   38.007214] lr : __v4l2_ctrl_handler_setup+0x158/0x170
[   38.012343] sp : ffff80001476fae0
[   38.015648] x29: ffff80001476fae0 x28: ffff000806780000 x27: 0000000000000000
[   38.022781] x26: ffff00080300b448 x25: ffff000804ad4ac0 x24: 0000000000000001
[   38.029912] x23: 0000000000000000 x22: 0000000000000005 x21: ffff000801fa7880
[   38.037043] x20: ffff000801fa7888 x19: ffff000801fa7ba8 x18: 0000000000000000
[   38.044173] x17: 0000000000000000 x16: 0000000000000010 x15: 0000000000000001
[   38.051305] x14: 000000000000003b x13: 00000000aaaaaaab x12: ffff800011a915b8
[   38.058436] x11: 00000000000c001c x10: 000000008260a2b7 x9 : ffff800009362d9c
[   38.065566] x8 : ffff800011887100 x7 : 0000000000000000 x6 : 0000000000000001
[   38.072698] x5 : 0000000000000001 x4 : 0000000000000001 x3 : ffff800011260000
[   38.079829] x2 : 00000000000000c0 x1 : 00000000000000c0 x0 : 0000000000000000
[   38.086960] Call trace:
[   38.089399]  __v4l2_ctrl_handler_setup+0x15c/0x170
[   38.094181]  ov5640_resume+0x1fc/0x270 [ov5640]
[   38.098709]  __rpm_callback+0x98/0x160
[   38.102452]  rpm_callback+0x2c/0x90
[   38.105934]  rpm_resume+0x45c/0x6f4
[   38.109415]  __pm_runtime_resume+0x54/0xc0
[   38.113503]  __device_release_driver+0x40/0x240
[   38.118025]  driver_detach+0xd0/0x160
[   38.121680]  bus_remove_driver+0x68/0xe0
[   38.125595]  driver_unregister+0x3c/0x6c
[   38.129509]  i2c_del_driver+0x64/0xb0
[   38.133166]  ov5640_i2c_driver_exit+0x1c/0xc948 [ov5640]
[   38.138469]  __arm64_sys_delete_module+0x1b0/0x27c
[   38.143251]  invoke_syscall+0x50/0x120
[   38.146995]  el0_svc_common.constprop.0+0x68/0x104
[   38.151777]  do_el0_svc+0x30/0x9c
[   38.155086]  el0_svc+0x2c/0x54
[   38.158135]  el0_sync_handler+0x1a8/0x1ac
[   38.162136]  el0_sync+0x198/0x1c0
[   38.165444] irq event stamp: 11302
[   38.168837] hardirqs last  enabled at (11301): [<ffff800010bf4e40>] _raw_spin_unlock_irq+0x50/0xa0
[   38.177781] hardirqs last disabled at (11302): [<ffff800010be7a64>] el1_dbg+0x24/0xa0
[   38.185595] softirqs last  enabled at (10378): [<ffff800010010ba0>] __do_softirq+0x500/0x6bc
[   38.194017] softirqs last disabled at (10373): [<ffff80001005d4c4>] __irq_exit_rcu+0x1d4/0x1e0
[   38.202614] ---[ end trace 7037324a951cb149 ]---
rmmod v4l2_fwnode
insmod /root/nfs/work/linux/drivers/media/v4l2-core/v4l2-fwnode.ko
insmod /root/nfs/work/linux/drivers/phy/cadence/cdns-dphy.ko
insmod /root/nfs/work/linux/drivers/media/platform/cadence/cdns-csi2rx.ko
ERROR:   Unhandled External Abort received on 0x80000001 from S-EL1
ERROR:   exception reason=0 syndrome=0xbf000000
Unhandled Exception from EL1
x0             = 0x0000000000000000
x1             = 0xffff000804d59800
x2             = 0xffff8000146c4000
x3             = 0xffff800011260000
x4             = 0x0000000000000001
x5             = 0x0000000000000001
x6             = 0x0000000000000001
x7             = 0x0000000000000000
x8             = 0xffff800011887100
x9             = 0xffff800010bf5190
x10            = 0x000000008260a2b7
x11            = 0x00000000000c821d
x12            = 0xffff800011a915b8
x13            = 0x0000000000000001
x14            = 0x0000000000000000
x15            = 0x0000000000000020
x16            = 0x0000000000000000
x17            = 0x0000000000000000
x18            = 0x00000000fffffffb
x19            = 0xffff000806d44c00
x20            = 0x0000000000000000
x21            = 0xffff800009280058
x22            = 0xffff00080583c810
x23            = 0xffff00080583c800
x24            = 0xffff800009280058
x25            = 0x0000000000000047
x26            = 0xffff8000116d71d8
x27            = 0xffff800009280350
x28            = 0xffff800009280148
x29            = 0xffff80001432f850
x30            = 0xffff8000092506b8
scr_el3        = 0x000000000000073d
sctlr_el3      = 0x0000000030cd183f
cptr_el3       = 0x0000000000000000
tcr_el3        = 0x0000000080803520
daif           = 0x00000000000002c0
mair_el3       = 0x00000000004404ff
spsr_el3       = 0x0000000000000005
elr_el3        = 0xffff80000925043c
ttbr0_el3      = 0x0000000070010b00
esr_el3        = 0x00000000bf000000
far_el3        = 0x0000000000000000
spsr_el1       = 0x0000000060000005
elr_el1        = 0xffff800010be8cb0
spsr_abt       = 0x0000000000000000
spsr_und       = 0x0000000000000000
spsr_irq       = 0x0000000000000000
spsr_fiq       = 0x0000000000000000
sctlr_el1      = 0x0000000034d4d91d
actlr_el1      = 0x0000000000000000
cpacr_el1      = 0x0000000000300000
csselr_el1     = 0x0000000000000000
sp_el1         = 0xffff80001432f850
esr_el1        = 0x0000000056000000
ttbr0_el1      = 0x0000000882773200
ttbr1_el1      = 0x06d8000083180000
mair_el1       = 0x000c0400bb44ffff
amair_el1      = 0x0000000000000000
tcr_el1        = 0x00000034f5d07590
tpidr_el1      = 0xffff80086e790000
tpidr_el0      = 0x0000ffff895c6910
tpidrro_el0    = 0x0000000000000000
par_el1        = 0x0000000000000000
mpidr_el1      = 0x0000000080000001
afsr0_el1      = 0x0000000000000000
afsr1_el1      = 0x0000000000000000
contextidr_el1 = 0x0000000000000000
vbar_el1       = 0xffff800010011000
cntp_ctl_el0   = 0x0000000000000005
cntp_cval_el0  = 0x000000023f77b7a1
cntv_ctl_el0   = 0x0000000000000000
cntv_cval_el0  = 0x0000000000000000
cntkctl_el1    = 0x00000000000000d6
sp_el0         = 0x000000007000abd0
isr_el1        = 0x0000000000000040
dacr32_el2     = 0x0000000000000000
ifsr32_el2     = 0x0000000000000000
cpuectlr_el1   = 0x0000001b00000040
cpumerrsr_el1  = 0x0000000000000000
l2merrsr_el1   = 0x0000000000000000
  
Tomi Valkeinen May 27, 2021, 1:23 p.m. UTC | #2
Hi Pratyush,

On 26/05/2021 18:22, Pratyush Yadav wrote:
> Hi,
> 
> This series adds support for CSI2 capture on J721E. It includes some
> fixes to the Cadence CSI2RX driver, adds Rx support to Cadence DPHY
> driver, and finally adds the TI CSI2RX wrapper driver.
> 
> Tested on TI's J721E with OV5640 sensor.

I also see this after a few captures:

[   84.115503] ------------[ cut here ]------------
[   84.120144] DMA-API: ti-udma 31150000.dma-controller: mapping sg segment longer than device claims to support [len=1900544] [max=65536]
[   84.132376] WARNING: CPU: 1 PID: 594 at kernel/dma/debug.c:1172 debug_dma_map_sg+0x304/0x390
[   84.140804] Modules linked in: ov5640 ti_cal j721e_csi2rx cdns_csi2rx cdns_dphy v4l2_fwnode tidss ti_tfp410 tc358767 display_connector cdns_mhdp8546 panel_simple drm_kms_helper d
rm drm_panel_orientation_quirks cfbfillrect cfbimgblt cfbcopyarea phy_j721e_wiz phy_cadence_torrent
[   84.165298] CPU: 1 PID: 594 Comm: cam-mplex.py Not tainted 5.13.0-rc1-00206-g98bb91e95a28-dirty #5
[   84.174236] Hardware name: Texas Instruments K3 J721E SoC (DT)
[   84.180051] pstate: 60000005 (nZCv daif -PAN -UAO -TCO BTYPE=--)
[   84.186041] pc : debug_dma_map_sg+0x304/0x390
[   84.190383] lr : debug_dma_map_sg+0x304/0x390
[   84.194725] sp : ffff800014d0f730
[   84.198026] x29: ffff800014d0f730 x28: ffff000801544680 x27: ffffffffffffffff
[   84.205148] x26: 0000000000000000 x25: 0000000000000002 x24: 0000000000000001
[   84.212269] x23: ffff80001163abe0 x22: 0000000000000000 x21: 0000000000000001
[   84.219390] x20: ffff000801fa3010 x19: ffff0008075c7580 x18: 0000000000000000
[   84.226510] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000030
[   84.233630] x14: 6e61687420726567 x13: 6e6f6c20746e656d x12: 7420736d69616c63
[   84.240751] x11: 2065636976656420 x10: ffff8000116b18f8 x9 : ffff8000100eb920
[   84.247871] x8 : ffff8000116598f8 x7 : ffff8000116b18f8 x6 : 0000000000000001
[   84.254991] x5 : 0000000000000001 x4 : 0000000000000001 x3 : 0000000000000000
[   84.262111] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0008066f8000
[   84.269230] Call trace:
[   84.271665]  debug_dma_map_sg+0x304/0x390
[   84.275660]  dma_map_sg_attrs+0x70/0xb0
[   84.279486]  drm_gem_map_dma_buf+0x6c/0xf0 [drm]
[   84.284177]  __map_dma_buf+0x28/0x80
[   84.287742]  dma_buf_map_attachment+0xe4/0x200
[   84.292172]  vb2_dc_map_dmabuf+0x3c/0x150
[   84.296171]  __prepare_dmabuf+0x1dc/0x514
[   84.300168]  __buf_prepare+0x1a0/0x25c
[   84.303903]  vb2_core_qbuf+0x3d4/0x72c
[   84.307638]  vb2_qbuf+0x9c/0xf4
[   84.310767]  vb2_ioctl_qbuf+0x68/0x7c
[   84.314416]  v4l_qbuf+0x54/0x70
[   84.317545]  __video_do_ioctl+0x194/0x400
[   84.321541]  video_usercopy+0x19c/0x910
[   84.325362]  video_ioctl2+0x24/0x40
[   84.328837]  v4l2_ioctl+0x4c/0x70
[   84.332141]  __arm64_sys_ioctl+0xb4/0xfc
[   84.336053]  invoke_syscall+0x50/0x120
[   84.339791]  el0_svc_common.constprop.0+0x68/0x104
[   84.344569]  do_el0_svc+0x30/0x9c
[   84.347872]  el0_svc+0x2c/0x54
[   84.350916]  el0_sync_handler+0x1a8/0x1ac
[   84.354911]  el0_sync+0x198/0x1c0
[   84.358215] irq event stamp: 0
[   84.361256] hardirqs last  enabled at (0): [<0000000000000000>] 0x0
[   84.367507] hardirqs last disabled at (0): [<ffff80001004fe2c>] copy_process+0x44c/0x1800
[   84.375667] softirqs last  enabled at (0): [<ffff80001004fe2c>] copy_process+0x44c/0x1800
[   84.383824] softirqs last disabled at (0): [<0000000000000000>] 0x0
[   84.390073] ---[ end trace af3448c784059129 ]---
  
Pratyush Yadav June 3, 2021, 12:52 p.m. UTC | #3
On 27/05/21 04:23PM, Tomi Valkeinen wrote:
> Hi Pratyush,
> 
> On 26/05/2021 18:22, Pratyush Yadav wrote:
> > Hi,
> > 
> > This series adds support for CSI2 capture on J721E. It includes some
> > fixes to the Cadence CSI2RX driver, adds Rx support to Cadence DPHY
> > driver, and finally adds the TI CSI2RX wrapper driver.
> > 
> > Tested on TI's J721E with OV5640 sensor.
> 
> I also see this after a few captures:

Can you share the application/command you are using to test? I used 
yavta to test and didn't see any problems after leaving the stream on 
for around 10 minutes.

> 
> [   84.115503] ------------[ cut here ]------------
> [   84.120144] DMA-API: ti-udma 31150000.dma-controller: mapping sg segment longer than device claims to support [len=1900544] [max=65536]
> [   84.132376] WARNING: CPU: 1 PID: 594 at kernel/dma/debug.c:1172 debug_dma_map_sg+0x304/0x390
> [   84.140804] Modules linked in: ov5640 ti_cal j721e_csi2rx cdns_csi2rx cdns_dphy v4l2_fwnode tidss ti_tfp410 tc358767 display_connector cdns_mhdp8546 panel_simple drm_kms_helper d
> rm drm_panel_orientation_quirks cfbfillrect cfbimgblt cfbcopyarea phy_j721e_wiz phy_cadence_torrent
> [   84.165298] CPU: 1 PID: 594 Comm: cam-mplex.py Not tainted 5.13.0-rc1-00206-g98bb91e95a28-dirty #5
> [   84.174236] Hardware name: Texas Instruments K3 J721E SoC (DT)
> [   84.180051] pstate: 60000005 (nZCv daif -PAN -UAO -TCO BTYPE=--)
> [   84.186041] pc : debug_dma_map_sg+0x304/0x390
> [   84.190383] lr : debug_dma_map_sg+0x304/0x390
> [   84.194725] sp : ffff800014d0f730
> [   84.198026] x29: ffff800014d0f730 x28: ffff000801544680 x27: ffffffffffffffff
> [   84.205148] x26: 0000000000000000 x25: 0000000000000002 x24: 0000000000000001
> [   84.212269] x23: ffff80001163abe0 x22: 0000000000000000 x21: 0000000000000001
> [   84.219390] x20: ffff000801fa3010 x19: ffff0008075c7580 x18: 0000000000000000
> [   84.226510] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000030
> [   84.233630] x14: 6e61687420726567 x13: 6e6f6c20746e656d x12: 7420736d69616c63
> [   84.240751] x11: 2065636976656420 x10: ffff8000116b18f8 x9 : ffff8000100eb920
> [   84.247871] x8 : ffff8000116598f8 x7 : ffff8000116b18f8 x6 : 0000000000000001
> [   84.254991] x5 : 0000000000000001 x4 : 0000000000000001 x3 : 0000000000000000
> [   84.262111] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0008066f8000
> [   84.269230] Call trace:
> [   84.271665]  debug_dma_map_sg+0x304/0x390
> [   84.275660]  dma_map_sg_attrs+0x70/0xb0
> [   84.279486]  drm_gem_map_dma_buf+0x6c/0xf0 [drm]
> [   84.284177]  __map_dma_buf+0x28/0x80
> [   84.287742]  dma_buf_map_attachment+0xe4/0x200
> [   84.292172]  vb2_dc_map_dmabuf+0x3c/0x150
> [   84.296171]  __prepare_dmabuf+0x1dc/0x514
> [   84.300168]  __buf_prepare+0x1a0/0x25c
> [   84.303903]  vb2_core_qbuf+0x3d4/0x72c
> [   84.307638]  vb2_qbuf+0x9c/0xf4
> [   84.310767]  vb2_ioctl_qbuf+0x68/0x7c
> [   84.314416]  v4l_qbuf+0x54/0x70
> [   84.317545]  __video_do_ioctl+0x194/0x400
> [   84.321541]  video_usercopy+0x19c/0x910
> [   84.325362]  video_ioctl2+0x24/0x40
> [   84.328837]  v4l2_ioctl+0x4c/0x70
> [   84.332141]  __arm64_sys_ioctl+0xb4/0xfc
> [   84.336053]  invoke_syscall+0x50/0x120
> [   84.339791]  el0_svc_common.constprop.0+0x68/0x104
> [   84.344569]  do_el0_svc+0x30/0x9c
> [   84.347872]  el0_svc+0x2c/0x54
> [   84.350916]  el0_sync_handler+0x1a8/0x1ac
> [   84.354911]  el0_sync+0x198/0x1c0
> [   84.358215] irq event stamp: 0
> [   84.361256] hardirqs last  enabled at (0): [<0000000000000000>] 0x0
> [   84.367507] hardirqs last disabled at (0): [<ffff80001004fe2c>] copy_process+0x44c/0x1800
> [   84.375667] softirqs last  enabled at (0): [<ffff80001004fe2c>] copy_process+0x44c/0x1800
> [   84.383824] softirqs last disabled at (0): [<0000000000000000>] 0x0
> [   84.390073] ---[ end trace af3448c784059129 ]---
  
Pratyush Yadav June 3, 2021, 12:54 p.m. UTC | #4
On 27/05/21 03:42PM, Tomi Valkeinen wrote:
> Hi Pratyush,
> 
> On 26/05/2021 18:22, Pratyush Yadav wrote:
> > Hi,
> > 
> > This series adds support for CSI2 capture on J721E. It includes some
> > fixes to the Cadence CSI2RX driver, adds Rx support to Cadence DPHY
> > driver, and finally adds the TI CSI2RX wrapper driver.
> > 
> > Tested on TI's J721E with OV5640 sensor.
> 
> I'm having some trouble unloading and reloading the modules:
> 
> rmmod ti_cal
> rmmod j721e_csi2rx
> rmmod cdns_csi2rx
> rmmod cdns_dphy
> rmmod ov5640

I did some basic module insertion/removal testing but I didn't try 
removing the sensor module. I will check and see what the problem is.

> [   37.943128] ------------[ cut here ]------------
> [   37.947752] WARNING: CPU: 1 PID: 628 at drivers/media/v4l2-core/v4l2-ctrls-core.c:1807 __v4l2_ctrl_handler_setup+0x15c/0x170
> [   37.958963] Modules linked in: ov5640(-) v4l2_fwnode tidss ti_tfp410 tc358767 display_connector cdns_mhdp8546 panel_simple drm_kms_helper drm drm_panel_orientation_quirks cfbfill
> rect cfbimgblt cfbcopyarea phy_j721e_wiz phy_cadence_torrent [last unloaded: cdns_dphy]
> [   37.982455] CPU: 1 PID: 628 Comm: rmmod Not tainted 5.13.0-rc1-00205-g93acc23badc8 #3
> [   37.990271] Hardware name: Texas Instruments K3 J721E SoC (DT)
> [   37.996090] pstate: 60000005 (nZCv daif -PAN -UAO -TCO BTYPE=--)
> [   38.002085] pc : __v4l2_ctrl_handler_setup+0x15c/0x170
> [   38.007214] lr : __v4l2_ctrl_handler_setup+0x158/0x170
> [   38.012343] sp : ffff80001476fae0
> [   38.015648] x29: ffff80001476fae0 x28: ffff000806780000 x27: 0000000000000000
> [   38.022781] x26: ffff00080300b448 x25: ffff000804ad4ac0 x24: 0000000000000001
> [   38.029912] x23: 0000000000000000 x22: 0000000000000005 x21: ffff000801fa7880
> [   38.037043] x20: ffff000801fa7888 x19: ffff000801fa7ba8 x18: 0000000000000000
> [   38.044173] x17: 0000000000000000 x16: 0000000000000010 x15: 0000000000000001
> [   38.051305] x14: 000000000000003b x13: 00000000aaaaaaab x12: ffff800011a915b8
> [   38.058436] x11: 00000000000c001c x10: 000000008260a2b7 x9 : ffff800009362d9c
> [   38.065566] x8 : ffff800011887100 x7 : 0000000000000000 x6 : 0000000000000001
> [   38.072698] x5 : 0000000000000001 x4 : 0000000000000001 x3 : ffff800011260000
> [   38.079829] x2 : 00000000000000c0 x1 : 00000000000000c0 x0 : 0000000000000000
> [   38.086960] Call trace:
> [   38.089399]  __v4l2_ctrl_handler_setup+0x15c/0x170
> [   38.094181]  ov5640_resume+0x1fc/0x270 [ov5640]
> [   38.098709]  __rpm_callback+0x98/0x160
> [   38.102452]  rpm_callback+0x2c/0x90
> [   38.105934]  rpm_resume+0x45c/0x6f4
> [   38.109415]  __pm_runtime_resume+0x54/0xc0
> [   38.113503]  __device_release_driver+0x40/0x240
> [   38.118025]  driver_detach+0xd0/0x160
> [   38.121680]  bus_remove_driver+0x68/0xe0
> [   38.125595]  driver_unregister+0x3c/0x6c
> [   38.129509]  i2c_del_driver+0x64/0xb0
> [   38.133166]  ov5640_i2c_driver_exit+0x1c/0xc948 [ov5640]
> [   38.138469]  __arm64_sys_delete_module+0x1b0/0x27c
> [   38.143251]  invoke_syscall+0x50/0x120
> [   38.146995]  el0_svc_common.constprop.0+0x68/0x104
> [   38.151777]  do_el0_svc+0x30/0x9c
> [   38.155086]  el0_svc+0x2c/0x54
> [   38.158135]  el0_sync_handler+0x1a8/0x1ac
> [   38.162136]  el0_sync+0x198/0x1c0
> [   38.165444] irq event stamp: 11302
> [   38.168837] hardirqs last  enabled at (11301): [<ffff800010bf4e40>] _raw_spin_unlock_irq+0x50/0xa0
> [   38.177781] hardirqs last disabled at (11302): [<ffff800010be7a64>] el1_dbg+0x24/0xa0
> [   38.185595] softirqs last  enabled at (10378): [<ffff800010010ba0>] __do_softirq+0x500/0x6bc
> [   38.194017] softirqs last disabled at (10373): [<ffff80001005d4c4>] __irq_exit_rcu+0x1d4/0x1e0
> [   38.202614] ---[ end trace 7037324a951cb149 ]---
> rmmod v4l2_fwnode
> insmod /root/nfs/work/linux/drivers/media/v4l2-core/v4l2-fwnode.ko
> insmod /root/nfs/work/linux/drivers/phy/cadence/cdns-dphy.ko
> insmod /root/nfs/work/linux/drivers/media/platform/cadence/cdns-csi2rx.ko
> ERROR:   Unhandled External Abort received on 0x80000001 from S-EL1
> ERROR:   exception reason=0 syndrome=0xbf000000
> Unhandled Exception from EL1
> x0             = 0x0000000000000000
> x1             = 0xffff000804d59800
> x2             = 0xffff8000146c4000
> x3             = 0xffff800011260000
> x4             = 0x0000000000000001
> x5             = 0x0000000000000001
> x6             = 0x0000000000000001
> x7             = 0x0000000000000000
> x8             = 0xffff800011887100
> x9             = 0xffff800010bf5190
> x10            = 0x000000008260a2b7
> x11            = 0x00000000000c821d
> x12            = 0xffff800011a915b8
> x13            = 0x0000000000000001
> x14            = 0x0000000000000000
> x15            = 0x0000000000000020
> x16            = 0x0000000000000000
> x17            = 0x0000000000000000
> x18            = 0x00000000fffffffb
> x19            = 0xffff000806d44c00
> x20            = 0x0000000000000000
> x21            = 0xffff800009280058
> x22            = 0xffff00080583c810
> x23            = 0xffff00080583c800
> x24            = 0xffff800009280058
> x25            = 0x0000000000000047
> x26            = 0xffff8000116d71d8
> x27            = 0xffff800009280350
> x28            = 0xffff800009280148
> x29            = 0xffff80001432f850
> x30            = 0xffff8000092506b8
> scr_el3        = 0x000000000000073d
> sctlr_el3      = 0x0000000030cd183f
> cptr_el3       = 0x0000000000000000
> tcr_el3        = 0x0000000080803520
> daif           = 0x00000000000002c0
> mair_el3       = 0x00000000004404ff
> spsr_el3       = 0x0000000000000005
> elr_el3        = 0xffff80000925043c
> ttbr0_el3      = 0x0000000070010b00
> esr_el3        = 0x00000000bf000000
> far_el3        = 0x0000000000000000
> spsr_el1       = 0x0000000060000005
> elr_el1        = 0xffff800010be8cb0
> spsr_abt       = 0x0000000000000000
> spsr_und       = 0x0000000000000000
> spsr_irq       = 0x0000000000000000
> spsr_fiq       = 0x0000000000000000
> sctlr_el1      = 0x0000000034d4d91d
> actlr_el1      = 0x0000000000000000
> cpacr_el1      = 0x0000000000300000
> csselr_el1     = 0x0000000000000000
> sp_el1         = 0xffff80001432f850
> esr_el1        = 0x0000000056000000
> ttbr0_el1      = 0x0000000882773200
> ttbr1_el1      = 0x06d8000083180000
> mair_el1       = 0x000c0400bb44ffff
> amair_el1      = 0x0000000000000000
> tcr_el1        = 0x00000034f5d07590
> tpidr_el1      = 0xffff80086e790000
> tpidr_el0      = 0x0000ffff895c6910
> tpidrro_el0    = 0x0000000000000000
> par_el1        = 0x0000000000000000
> mpidr_el1      = 0x0000000080000001
> afsr0_el1      = 0x0000000000000000
> afsr1_el1      = 0x0000000000000000
> contextidr_el1 = 0x0000000000000000
> vbar_el1       = 0xffff800010011000
> cntp_ctl_el0   = 0x0000000000000005
> cntp_cval_el0  = 0x000000023f77b7a1
> cntv_ctl_el0   = 0x0000000000000000
> cntv_cval_el0  = 0x0000000000000000
> cntkctl_el1    = 0x00000000000000d6
> sp_el0         = 0x000000007000abd0
> isr_el1        = 0x0000000000000040
> dacr32_el2     = 0x0000000000000000
> ifsr32_el2     = 0x0000000000000000
> cpuectlr_el1   = 0x0000001b00000040
> cpumerrsr_el1  = 0x0000000000000000
> l2merrsr_el1   = 0x0000000000000000
  
Tomi Valkeinen June 4, 2021, 7:54 a.m. UTC | #5
On 03/06/2021 15:52, Pratyush Yadav wrote:
> On 27/05/21 04:23PM, Tomi Valkeinen wrote:
>> Hi Pratyush,
>>
>> On 26/05/2021 18:22, Pratyush Yadav wrote:
>>> Hi,
>>>
>>> This series adds support for CSI2 capture on J721E. It includes some
>>> fixes to the Cadence CSI2RX driver, adds Rx support to Cadence DPHY
>>> driver, and finally adds the TI CSI2RX wrapper driver.
>>>
>>> Tested on TI's J721E with OV5640 sensor.
>>
>> I also see this after a few captures:
> 
> Can you share the application/command you are using to test? I used
> yavta to test and didn't see any problems after leaving the stream on
> for around 10 minutes.

You need to have CONFIG_DMA_API_DEBUG enabled. I think that's not 
enabled by default on TI configs.

  Tomi