Add SMI driver
authorLuke Wren <wren6991@gmail.com>
Sat, 5 Sep 2015 00:14:45 +0000 (01:14 +0100)
committerDom Cobley <popcornmix@gmail.com>
Mon, 19 Feb 2024 11:31:35 +0000 (11:31 +0000)
commit092f32f5551a2a6ec193f733a5cdc7b2030957e9
tree927a1f5239804bddd510f24ce94ba7362aa04c14
parentdf5bd3dbd540686ca671cba8e0766f995213f5ec
Add SMI driver

Signed-off-by: Luke Wren <wren6991@gmail.com>
MISC: bcm2835: smi: use clock manager and fix reload issues

Use clock manager instead of self-made clockmanager.

Also fix some error paths that showd up during development
(especially missing release of dma resources on rmmod)

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
bcm2835_smi: re-add dereference to fix DMA transfers

bcm2835_smi_dev: Fix handling of word-odd lengths

The read and write functions did not use the correct pointer offset
when dealing with an odd number of bytes after a DMA transfer. Also,
only handle the remaining odd bytes if the DMA transfer completed
successfully.

Submitted-by: @madimario (GitHub)
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
misc: bcm2835_smi: Use proper enum types for dma_{,un}map_single()

Clang warns:

  drivers/misc/bcm2835_smi.c:692:4: warning: implicit conversion from enumeration type 'enum dma_transfer_direction' to different enumeration type 'enum dma_data_direction' [-Wenum-conversion]
                          DMA_MEM_TO_DEV);
                          ^~~~~~~~~~~~~~~
  ./include/linux/dma-mapping.h:406:66: note: expanded from macro 'dma_map_single'
  #define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, 0)
                                     ~~~~~~~~~~~~~~~~~~~~          ^
  drivers/misc/bcm2835_smi.c:705:35: warning: implicit conversion from enumeration type 'enum dma_transfer_direction' to different enumeration type 'enum dma_data_direction' [-Wenum-conversion]
                          (inst->dev, phy_addr, n_bytes, DMA_MEM_TO_DEV);
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
  ./include/linux/dma-mapping.h:407:70: note: expanded from macro 'dma_unmap_single'
  #define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, 0)
                                       ~~~~~~~~~~~~~~~~~~~~~~          ^
  drivers/misc/bcm2835_smi.c:751:12: warning: implicit conversion from enumeration type 'enum dma_transfer_direction' to different enumeration type 'enum dma_data_direction' [-Wenum-conversion]
                                                       DMA_DEV_TO_MEM);
                                                       ^~~~~~~~~~~~~~~
  ./include/linux/dma-mapping.h:406:66: note: expanded from macro 'dma_map_single'
  #define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, 0)
                                     ~~~~~~~~~~~~~~~~~~~~          ^
  drivers/misc/bcm2835_smi.c:761:50: warning: implicit conversion from enumeration type 'enum dma_transfer_direction' to different enumeration type 'enum dma_data_direction' [-Wenum-conversion]
                  dma_unmap_single(inst->dev, phy_addr, n_bytes, DMA_DEV_TO_MEM);
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
  ./include/linux/dma-mapping.h:407:70: note: expanded from macro 'dma_unmap_single'
  #define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, 0)
                                       ~~~~~~~~~~~~~~~~~~~~~~          ^
  4 warnings generated.

Use the proper enumerated type to clear up the warning. There is not
actually a bug here because the enumerated types have the same integer
value:

DMA_MEM_TO_DEV = DMA_TO_DEVICE = 1
DMA_DEV_TO_MEM = DMA_FROM_DEVICE = 2

Fixes: 93254d0f7bc8 ("Add SMI driver")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
bcm2835-smi: Use phys addresses for slave DMA config

Contrary to what struct snd_dmaengine_dai_dma_data suggests, the
configuration of addresses of DMA slave interfaces should be done in
CPU physical addresses.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Documentation/devicetree/bindings/misc/brcm,bcm2835-smi-dev.txt [new file with mode: 0644]
Documentation/devicetree/bindings/misc/brcm,bcm2835-smi.txt [new file with mode: 0644]
drivers/char/broadcom/Kconfig
drivers/char/broadcom/Makefile
drivers/char/broadcom/bcm2835_smi_dev.c [new file with mode: 0644]
drivers/misc/Kconfig
drivers/misc/Makefile
drivers/misc/bcm2835_smi.c [new file with mode: 0644]
include/linux/broadcom/bcm2835_smi.h [new file with mode: 0644]