linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* remove arch/sh
@ 2023-01-13  6:23 Christoph Hellwig
  2023-01-13  6:23 ` [PATCH 01/22] gpu/drm: remove the shmobile drm driver Christoph Hellwig
                   ` (21 more replies)
  0 siblings, 22 replies; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Hi all,

arch/sh has been a long drag because it supports a lot of SOCs, and most
of them haven't even been converted to device tree infrastructure.  These
SOCs are generally obsolete as well, and all of the support has been barely
maintained for almost 10 years, and not at all for more than 1 year.

Drop arch/sh and everything that depends on it.

Diffstat:
 Documentation/sh/booting.rst                             |   12 
 Documentation/sh/features.rst                            |    3 
 Documentation/sh/index.rst                               |   56 
 Documentation/sh/new-machine.rst                         |  277 -
 Documentation/sh/register-banks.rst                      |   40 
 arch/sh/Kbuild                                           |    7 
 arch/sh/Kconfig                                          |  793 ----
 arch/sh/Kconfig.cpu                                      |  100 
 arch/sh/Kconfig.debug                                    |   78 
 arch/sh/Makefile                                         |  215 -
 arch/sh/boards/Kconfig                                   |  400 --
 arch/sh/boards/Makefile                                  |   20 
 arch/sh/boards/board-apsh4a3a.c                          |  182 
 arch/sh/boards/board-apsh4ad0a.c                         |  132 
 arch/sh/boards/board-edosk7705.c                         |   79 
 arch/sh/boards/board-edosk7760.c                         |  178 
 arch/sh/boards/board-espt.c                              |  105 
 arch/sh/boards/board-magicpanelr2.c                      |  390 --
 arch/sh/boards/board-polaris.c                           |  156 
 arch/sh/boards/board-secureedge5410.c                    |   75 
 arch/sh/boards/board-sh2007.c                            |  146 
 arch/sh/boards/board-sh7757lcr.c                         |  604 ---
 arch/sh/boards/board-sh7785lcr.c                         |  384 --
 arch/sh/boards/board-shmin.c                             |   35 
 arch/sh/boards/board-titan.c                             |   21 
 arch/sh/boards/board-urquell.c                           |  218 -
 arch/sh/boards/mach-ap325rxa/Makefile                    |    3 
 arch/sh/boards/mach-ap325rxa/sdram.S                     |   66 
 arch/sh/boards/mach-ap325rxa/setup.c                     |  573 ---
 arch/sh/boards/mach-dreamcast/Makefile                   |    7 
 arch/sh/boards/mach-dreamcast/irq.c                      |  155 
 arch/sh/boards/mach-dreamcast/rtc.c                      |   96 
 arch/sh/boards/mach-dreamcast/setup.c                    |   39 
 arch/sh/boards/mach-ecovec24/Makefile                    |   10 
 arch/sh/boards/mach-ecovec24/sdram.S                     |  108 
 arch/sh/boards/mach-ecovec24/setup.c                     | 1521 --------
 arch/sh/boards/mach-highlander/Kconfig                   |   26 
 arch/sh/boards/mach-highlander/Makefile                  |   12 
 arch/sh/boards/mach-highlander/irq-r7780mp.c             |   71 
 arch/sh/boards/mach-highlander/irq-r7780rp.c             |   64 
 arch/sh/boards/mach-highlander/irq-r7785rp.c             |   83 
 arch/sh/boards/mach-highlander/pinmux-r7785rp.c          |   17 
 arch/sh/boards/mach-highlander/psw.c                     |  119 
 arch/sh/boards/mach-highlander/setup.c                   |  416 --
 arch/sh/boards/mach-hp6xx/Makefile                       |    8 
 arch/sh/boards/mach-hp6xx/hp6xx_apm.c                    |  109 
 arch/sh/boards/mach-hp6xx/pm.c                           |  156 
 arch/sh/boards/mach-hp6xx/pm_wakeup.S                    |   39 
 arch/sh/boards/mach-hp6xx/setup.c                        |  172 
 arch/sh/boards/mach-kfr2r09/Makefile                     |    5 
 arch/sh/boards/mach-kfr2r09/lcd_wqvga.c                  |  275 -
 arch/sh/boards/mach-kfr2r09/sdram.S                      |   77 
 arch/sh/boards/mach-kfr2r09/setup.c                      |  649 ---
 arch/sh/boards/mach-landisk/Makefile                     |    6 
 arch/sh/boards/mach-landisk/gio.c                        |  164 
 arch/sh/boards/mach-landisk/irq.c                        |   63 
 arch/sh/boards/mach-landisk/psw.c                        |  140 
 arch/sh/boards/mach-landisk/setup.c                      |  102 
 arch/sh/boards/mach-lboxre2/Makefile                     |    6 
 arch/sh/boards/mach-lboxre2/irq.c                        |   27 
 arch/sh/boards/mach-lboxre2/setup.c                      |   79 
 arch/sh/boards/mach-microdev/Makefile                    |    6 
 arch/sh/boards/mach-microdev/fdc37c93xapm.c              |  157 
 arch/sh/boards/mach-microdev/io.c                        |  123 
 arch/sh/boards/mach-microdev/irq.c                       |  150 
 arch/sh/boards/mach-microdev/setup.c                     |  197 -
 arch/sh/boards/mach-migor/Kconfig                        |   16 
 arch/sh/boards/mach-migor/Makefile                       |    3 
 arch/sh/boards/mach-migor/lcd_qvga.c                     |  163 
 arch/sh/boards/mach-migor/sdram.S                        |   66 
 arch/sh/boards/mach-migor/setup.c                        |  649 ---
 arch/sh/boards/mach-r2d/Kconfig                          |   24 
 arch/sh/boards/mach-r2d/Makefile                         |    6 
 arch/sh/boards/mach-r2d/irq.c                            |  156 
 arch/sh/boards/mach-r2d/setup.c                          |  305 -
 arch/sh/boards/mach-rsk/Kconfig                          |   29 
 arch/sh/boards/mach-rsk/Makefile                         |    5 
 arch/sh/boards/mach-rsk/devices-rsk7203.c                |  137 
 arch/sh/boards/mach-rsk/devices-rsk7264.c                |   55 
 arch/sh/boards/mach-rsk/devices-rsk7269.c                |   57 
 arch/sh/boards/mach-rsk/setup.c                          |   84 
 arch/sh/boards/mach-sdk7780/Kconfig                      |   17 
 arch/sh/boards/mach-sdk7780/Makefile                     |    6 
 arch/sh/boards/mach-sdk7780/irq.c                        |   43 
 arch/sh/boards/mach-sdk7780/setup.c                      |   96 
 arch/sh/boards/mach-sdk7786/Makefile                     |    5 
 arch/sh/boards/mach-sdk7786/fpga.c                       |   69 
 arch/sh/boards/mach-sdk7786/gpio.c                       |   46 
 arch/sh/boards/mach-sdk7786/irq.c                        |   45 
 arch/sh/boards/mach-sdk7786/nmi.c                        |   80 
 arch/sh/boards/mach-sdk7786/setup.c                      |  266 -
 arch/sh/boards/mach-sdk7786/sram.c                       |   69 
 arch/sh/boards/mach-se/7206/Makefile                     |    6 
 arch/sh/boards/mach-se/7206/irq.c                        |  151 
 arch/sh/boards/mach-se/7206/setup.c                      |   96 
 arch/sh/boards/mach-se/7343/Makefile                     |    6 
 arch/sh/boards/mach-se/7343/irq.c                        |  123 
 arch/sh/boards/mach-se/7343/setup.c                      |  182 
 arch/sh/boards/mach-se/770x/Makefile                     |    6 
 arch/sh/boards/mach-se/770x/irq.c                        |  109 
 arch/sh/boards/mach-se/770x/setup.c                      |  205 -
 arch/sh/boards/mach-se/7721/Makefile                     |    2 
 arch/sh/boards/mach-se/7721/irq.c                        |   42 
 arch/sh/boards/mach-se/7721/setup.c                      |   92 
 arch/sh/boards/mach-se/7722/Makefile                     |   11 
 arch/sh/boards/mach-se/7722/irq.c                        |  116 
 arch/sh/boards/mach-se/7722/setup.c                      |  190 
 arch/sh/boards/mach-se/7724/Makefile                     |   11 
 arch/sh/boards/mach-se/7724/irq.c                        |  143 
 arch/sh/boards/mach-se/7724/sdram.S                      |  128 
 arch/sh/boards/mach-se/7724/setup.c                      |  986 -----
 arch/sh/boards/mach-se/7751/Makefile                     |    6 
 arch/sh/boards/mach-se/7751/irq.c                        |   51 
 arch/sh/boards/mach-se/7751/setup.c                      |   60 
 arch/sh/boards/mach-se/7780/Makefile                     |   11 
 arch/sh/boards/mach-se/7780/irq.c                        |   65 
 arch/sh/boards/mach-se/7780/setup.c                      |  111 
 arch/sh/boards/mach-se/Makefile                          |   11 
 arch/sh/boards/mach-se/board-se7619.c                    |   27 
 arch/sh/boards/mach-sh03/Makefile                        |    7 
 arch/sh/boards/mach-sh03/rtc.c                           |  143 
 arch/sh/boards/mach-sh03/setup.c                         |   97 
 arch/sh/boards/mach-sh7763rdp/Makefile                   |    2 
 arch/sh/boards/mach-sh7763rdp/irq.c                      |   42 
 arch/sh/boards/mach-sh7763rdp/setup.c                    |  213 -
 arch/sh/boards/mach-x3proto/Makefile                     |    4 
 arch/sh/boards/mach-x3proto/gpio.c                       |  136 
 arch/sh/boards/mach-x3proto/ilsel.c                      |  156 
 arch/sh/boards/mach-x3proto/setup.c                      |  270 -
 arch/sh/boards/of-generic.c                              |  172 
 arch/sh/boot/.gitignore                                  |    5 
 arch/sh/boot/Makefile                                    |  115 
 arch/sh/boot/compressed/.gitignore                       |    2 
 arch/sh/boot/compressed/Makefile                         |   66 
 arch/sh/boot/compressed/ashiftrt.S                       |    2 
 arch/sh/boot/compressed/ashldi3.c                        |    2 
 arch/sh/boot/compressed/ashlsi3.S                        |    2 
 arch/sh/boot/compressed/ashrsi3.S                        |    2 
 arch/sh/boot/compressed/cache.c                          |   13 
 arch/sh/boot/compressed/head_32.S                        |  126 
 arch/sh/boot/compressed/head_64.S                        |  159 
 arch/sh/boot/compressed/lshrsi3.S                        |    2 
 arch/sh/boot/compressed/misc.c                           |  146 
 arch/sh/boot/compressed/vmlinux.scr                      |   10 
 arch/sh/boot/dts/Makefile                                |    2 
 arch/sh/boot/dts/j2_mimas_v2.dts                         |   99 
 arch/sh/boot/romimage/Makefile                           |   30 
 arch/sh/boot/romimage/head.S                             |   85 
 arch/sh/boot/romimage/mmcif-sh7724.c                     |   78 
 arch/sh/boot/romimage/vmlinux.scr                        |    8 
 arch/sh/cchips/Kconfig                                   |   46 
 arch/sh/cchips/hd6446x/Makefile                          |    4 
 arch/sh/cchips/hd6446x/hd64461.c                         |  112 
 arch/sh/configs/ap325rxa_defconfig                       |  103 
 arch/sh/configs/apsh4a3a_defconfig                       |   91 
 arch/sh/configs/apsh4ad0a_defconfig                      |  122 
 arch/sh/configs/dreamcast_defconfig                      |   72 
 arch/sh/configs/ecovec24-romimage_defconfig              |   58 
 arch/sh/configs/ecovec24_defconfig                       |  132 
 arch/sh/configs/edosk7705_defconfig                      |   35 
 arch/sh/configs/edosk7760_defconfig                      |  114 
 arch/sh/configs/espt_defconfig                           |  114 
 arch/sh/configs/hp6xx_defconfig                          |   60 
 arch/sh/configs/j2_defconfig                             |   42 
 arch/sh/configs/kfr2r09-romimage_defconfig               |   53 
 arch/sh/configs/kfr2r09_defconfig                        |   84 
 arch/sh/configs/landisk_defconfig                        |  115 
 arch/sh/configs/lboxre2_defconfig                        |   62 
 arch/sh/configs/magicpanelr2_defconfig                   |   90 
 arch/sh/configs/microdev_defconfig                       |   43 
 arch/sh/configs/migor_defconfig                          |   94 
 arch/sh/configs/polaris_defconfig                        |   83 
 arch/sh/configs/r7780mp_defconfig                        |  109 
 arch/sh/configs/r7785rp_defconfig                        |  107 
 arch/sh/configs/rsk7201_defconfig                        |   63 
 arch/sh/configs/rsk7203_defconfig                        |  121 
 arch/sh/configs/rsk7264_defconfig                        |   71 
 arch/sh/configs/rsk7269_defconfig                        |   56 
 arch/sh/configs/rts7751r2d1_defconfig                    |   91 
 arch/sh/configs/rts7751r2dplus_defconfig                 |   96 
 arch/sh/configs/sdk7780_defconfig                        |  139 
 arch/sh/configs/sdk7786_defconfig                        |  217 -
 arch/sh/configs/se7206_defconfig                         |  108 
 arch/sh/configs/se7343_defconfig                         |   96 
 arch/sh/configs/se7619_defconfig                         |   43 
 arch/sh/configs/se7705_defconfig                         |   54 
 arch/sh/configs/se7712_defconfig                         |  101 
 arch/sh/configs/se7721_defconfig                         |  127 
 arch/sh/configs/se7722_defconfig                         |   56 
 arch/sh/configs/se7724_defconfig                         |  132 
 arch/sh/configs/se7750_defconfig                         |   55 
 arch/sh/configs/se7751_defconfig                         |   46 
 arch/sh/configs/se7780_defconfig                         |  106 
 arch/sh/configs/secureedge5410_defconfig                 |   53 
 arch/sh/configs/sh03_defconfig                           |  126 
 arch/sh/configs/sh2007_defconfig                         |  199 -
 arch/sh/configs/sh7710voipgw_defconfig                   |   55 
 arch/sh/configs/sh7724_generic_defconfig                 |   41 
 arch/sh/configs/sh7757lcr_defconfig                      |   85 
 arch/sh/configs/sh7763rdp_defconfig                      |  116 
 arch/sh/configs/sh7770_generic_defconfig                 |   43 
 arch/sh/configs/sh7785lcr_32bit_defconfig                |  149 
 arch/sh/configs/sh7785lcr_defconfig                      |  117 
 arch/sh/configs/shmin_defconfig                          |   52 
 arch/sh/configs/shx3_defconfig                           |  103 
 arch/sh/configs/titan_defconfig                          |  272 -
 arch/sh/configs/ul2_defconfig                            |   84 
 arch/sh/configs/urquell_defconfig                        |  147 
 arch/sh/drivers/Kconfig                                  |   20 
 arch/sh/drivers/Makefile                                 |   11 
 arch/sh/drivers/dma/Kconfig                              |   74 
 arch/sh/drivers/dma/Makefile                             |    9 
 arch/sh/drivers/dma/dma-api.c                            |  417 --
 arch/sh/drivers/dma/dma-g2.c                             |  197 -
 arch/sh/drivers/dma/dma-pvr2.c                           |  102 
 arch/sh/drivers/dma/dma-sh.c                             |  414 --
 arch/sh/drivers/dma/dma-sysfs.c                          |  164 
 arch/sh/drivers/dma/dmabrg.c                             |  196 -
 arch/sh/drivers/heartbeat.c                              |  152 
 arch/sh/drivers/pci/Makefile                             |   27 
 arch/sh/drivers/pci/common.c                             |  159 
 arch/sh/drivers/pci/fixups-dreamcast.c                   |   84 
 arch/sh/drivers/pci/fixups-landisk.c                     |   57 
 arch/sh/drivers/pci/fixups-r7780rp.c                     |   18 
 arch/sh/drivers/pci/fixups-rts7751r2d.c                  |   64 
 arch/sh/drivers/pci/fixups-sdk7780.c                     |   40 
 arch/sh/drivers/pci/fixups-sdk7786.c                     |   64 
 arch/sh/drivers/pci/fixups-se7751.c                      |  113 
 arch/sh/drivers/pci/fixups-sh03.c                        |   33 
 arch/sh/drivers/pci/fixups-snapgear.c                    |   37 
 arch/sh/drivers/pci/fixups-titan.c                       |   36 
 arch/sh/drivers/pci/ops-dreamcast.c                      |   79 
 arch/sh/drivers/pci/ops-sh4.c                            |  105 
 arch/sh/drivers/pci/ops-sh7786.c                         |  168 
 arch/sh/drivers/pci/pci-dreamcast.c                      |   97 
 arch/sh/drivers/pci/pci-sh4.h                            |  182 
 arch/sh/drivers/pci/pci-sh7751.c                         |  179 
 arch/sh/drivers/pci/pci-sh7751.h                         |  126 
 arch/sh/drivers/pci/pci-sh7780.c                         |  407 --
 arch/sh/drivers/pci/pci-sh7780.h                         |   43 
 arch/sh/drivers/pci/pci.c                                |  298 -
 arch/sh/drivers/pci/pcie-sh7786.c                        |  609 ---
 arch/sh/drivers/pci/pcie-sh7786.h                        |  577 ---
 arch/sh/drivers/platform_early.c                         |  340 -
 arch/sh/drivers/push-switch.c                            |  136 
 arch/sh/drivers/superhyway/Makefile                      |    7 
 arch/sh/drivers/superhyway/ops-sh4-202.c                 |  168 
 arch/sh/include/asm/Kbuild                               |    5 
 arch/sh/include/asm/adc.h                                |   12 
 arch/sh/include/asm/addrspace.h                          |   63 
 arch/sh/include/asm/alignment.h                          |   22 
 arch/sh/include/asm/asm-offsets.h                        |    2 
 arch/sh/include/asm/atomic-grb.h                         |   86 
 arch/sh/include/asm/atomic-irq.h                         |   72 
 arch/sh/include/asm/atomic-llsc.h                        |   88 
 arch/sh/include/asm/atomic.h                             |   38 
 arch/sh/include/asm/barrier.h                            |   45 
 arch/sh/include/asm/bitops-cas.h                         |   94 
 arch/sh/include/asm/bitops-grb.h                         |  173 
 arch/sh/include/asm/bitops-llsc.h                        |  147 
 arch/sh/include/asm/bitops-op32.h                        |  143 
 arch/sh/include/asm/bitops.h                             |   72 
 arch/sh/include/asm/bl_bit.h                             |    2 
 arch/sh/include/asm/bl_bit_32.h                          |   34 
 arch/sh/include/asm/bug.h                                |  121 
 arch/sh/include/asm/bugs.h                               |   74 
 arch/sh/include/asm/cache.h                              |   46 
 arch/sh/include/asm/cache_insns.h                        |    2 
 arch/sh/include/asm/cache_insns_32.h                     |   22 
 arch/sh/include/asm/cacheflush.h                         |  106 
 arch/sh/include/asm/checksum.h                           |    2 
 arch/sh/include/asm/checksum_32.h                        |  203 -
 arch/sh/include/asm/clock.h                              |   17 
 arch/sh/include/asm/cmpxchg-cas.h                        |   25 
 arch/sh/include/asm/cmpxchg-grb.h                        |   95 
 arch/sh/include/asm/cmpxchg-irq.h                        |   54 
 arch/sh/include/asm/cmpxchg-llsc.h                       |   53 
 arch/sh/include/asm/cmpxchg-xchg.h                       |   50 
 arch/sh/include/asm/cmpxchg.h                            |   74 
 arch/sh/include/asm/device.h                             |   17 
 arch/sh/include/asm/dma-register.h                       |   50 
 arch/sh/include/asm/dma.h                                |  140 
 arch/sh/include/asm/dmabrg.h                             |   24 
 arch/sh/include/asm/dwarf.h                              |  417 --
 arch/sh/include/asm/elf.h                                |  211 -
 arch/sh/include/asm/entry-macros.S                       |  123 
 arch/sh/include/asm/extable.h                            |    7 
 arch/sh/include/asm/fb.h                                 |   20 
 arch/sh/include/asm/fixmap.h                             |   86 
 arch/sh/include/asm/flat.h                               |   33 
 arch/sh/include/asm/fpu.h                                |   69 
 arch/sh/include/asm/freq.h                               |   12 
 arch/sh/include/asm/ftrace.h                             |   48 
 arch/sh/include/asm/futex-cas.h                          |   35 
 arch/sh/include/asm/futex-irq.h                          |   25 
 arch/sh/include/asm/futex-llsc.h                         |   42 
 arch/sh/include/asm/futex.h                              |   72 
 arch/sh/include/asm/gpio.h                               |   50 
 arch/sh/include/asm/hardirq.h                            |   11 
 arch/sh/include/asm/hd64461.h                            |  252 -
 arch/sh/include/asm/heartbeat.h                          |   19 
 arch/sh/include/asm/hugetlb.h                            |   38 
 arch/sh/include/asm/hw_breakpoint.h                      |   70 
 arch/sh/include/asm/hw_irq.h                             |   36 
 arch/sh/include/asm/i2c-sh7760.h                         |   21 
 arch/sh/include/asm/io.h                                 |  294 -
 arch/sh/include/asm/io_generic.h                         |   19 
 arch/sh/include/asm/io_noioport.h                        |   86 
 arch/sh/include/asm/io_trapped.h                         |   59 
 arch/sh/include/asm/irq.h                                |   58 
 arch/sh/include/asm/irqflags.h                           |   10 
 arch/sh/include/asm/kdebug.h                             |   19 
 arch/sh/include/asm/kexec.h                              |   72 
 arch/sh/include/asm/kgdb.h                               |   38 
 arch/sh/include/asm/kprobes.h                            |   57 
 arch/sh/include/asm/linkage.h                            |    8 
 arch/sh/include/asm/machvec.h                            |   41 
 arch/sh/include/asm/mmiowb.h                             |   12 
 arch/sh/include/asm/mmu.h                                |  107 
 arch/sh/include/asm/mmu_context.h                        |  178 
 arch/sh/include/asm/mmu_context_32.h                     |   51 
 arch/sh/include/asm/mmzone.h                             |   45 
 arch/sh/include/asm/module.h                             |   14 
 arch/sh/include/asm/page.h                               |  186 
 arch/sh/include/asm/pci.h                                |   91 
 arch/sh/include/asm/perf_event.h                         |   30 
 arch/sh/include/asm/pgalloc.h                            |   40 
 arch/sh/include/asm/pgtable-2level.h                     |   24 
 arch/sh/include/asm/pgtable-3level.h                     |   59 
 arch/sh/include/asm/pgtable.h                            |  150 
 arch/sh/include/asm/pgtable_32.h                         |  462 --
 arch/sh/include/asm/platform_early.h                     |   61 
 arch/sh/include/asm/posix_types.h                        |    2 
 arch/sh/include/asm/processor.h                          |  173 
 arch/sh/include/asm/processor_32.h                       |  202 -
 arch/sh/include/asm/ptrace.h                             |  139 
 arch/sh/include/asm/ptrace_32.h                          |   14 
 arch/sh/include/asm/push-switch.h                        |   32 
 arch/sh/include/asm/reboot.h                             |   22 
 arch/sh/include/asm/romimage-macros.h                    |   74 
 arch/sh/include/asm/rtc.h                                |   15 
 arch/sh/include/asm/seccomp.h                            |   21 
 arch/sh/include/asm/sections.h                           |   12 
 arch/sh/include/asm/setup.h                              |   25 
 arch/sh/include/asm/sfp-machine.h                        |   80 
 arch/sh/include/asm/sh7760fb.h                           |  198 -
 arch/sh/include/asm/sh_bios.h                            |   28 
 arch/sh/include/asm/shmparam.h                           |   19 
 arch/sh/include/asm/siu.h                                |   20 
 arch/sh/include/asm/smc37c93x.h                          |  191 -
 arch/sh/include/asm/smp-ops.h                            |   52 
 arch/sh/include/asm/smp.h                                |   83 
 arch/sh/include/asm/sparsemem.h                          |   12 
 arch/sh/include/asm/spi.h                                |   14 
 arch/sh/include/asm/spinlock-cas.h                       |   89 
 arch/sh/include/asm/spinlock-llsc.h                      |  198 -
 arch/sh/include/asm/spinlock.h                           |   19 
 arch/sh/include/asm/spinlock_types.h                     |   22 
 arch/sh/include/asm/sram.h                               |   39 
 arch/sh/include/asm/stackprotector.h                     |   21 
 arch/sh/include/asm/stacktrace.h                         |   21 
 arch/sh/include/asm/string.h                             |    2 
 arch/sh/include/asm/string_32.h                          |  102 
 arch/sh/include/asm/suspend.h                            |   97 
 arch/sh/include/asm/switch_to.h                          |    7 
 arch/sh/include/asm/switch_to_32.h                       |  131 
 arch/sh/include/asm/syscall.h                            |    9 
 arch/sh/include/asm/syscall_32.h                         |   69 
 arch/sh/include/asm/syscalls.h                           |   14 
 arch/sh/include/asm/syscalls_32.h                        |   27 
 arch/sh/include/asm/thread_info.h                        |  171 
 arch/sh/include/asm/timex.h                              |   24 
 arch/sh/include/asm/tlb.h                                |   29 
 arch/sh/include/asm/tlbflush.h                           |   52 
 arch/sh/include/asm/topology.h                           |   28 
 arch/sh/include/asm/traps.h                              |   18 
 arch/sh/include/asm/traps_32.h                           |   61 
 arch/sh/include/asm/types.h                              |   16 
 arch/sh/include/asm/uaccess.h                            |  133 
 arch/sh/include/asm/uaccess_32.h                         |  227 -
 arch/sh/include/asm/uncached.h                           |   59 
 arch/sh/include/asm/unistd.h                             |   31 
 arch/sh/include/asm/unwinder.h                           |   32 
 arch/sh/include/asm/user.h                               |   55 
 arch/sh/include/asm/vermagic.h                           |   30 
 arch/sh/include/asm/vga.h                                |    7 
 arch/sh/include/asm/vmalloc.h                            |    4 
 arch/sh/include/asm/vmlinux.lds.h                        |   18 
 arch/sh/include/asm/watchdog.h                           |  159 
 arch/sh/include/asm/word-at-a-time.h                     |   54 
 arch/sh/include/cpu-common/cpu/addrspace.h               |   16 
 arch/sh/include/cpu-common/cpu/mmu_context.h             |   13 
 arch/sh/include/cpu-common/cpu/pfc.h                     |   18 
 arch/sh/include/cpu-common/cpu/rtc.h                     |    9 
 arch/sh/include/cpu-common/cpu/sigcontext.h              |   18 
 arch/sh/include/cpu-common/cpu/timer.h                   |    7 
 arch/sh/include/cpu-sh2/cpu/cache.h                      |   40 
 arch/sh/include/cpu-sh2/cpu/freq.h                       |   15 
 arch/sh/include/cpu-sh2/cpu/watchdog.h                   |   66 
 arch/sh/include/cpu-sh2a/cpu/addrspace.h                 |   11 
 arch/sh/include/cpu-sh2a/cpu/cache.h                     |   40 
 arch/sh/include/cpu-sh2a/cpu/freq.h                      |   13 
 arch/sh/include/cpu-sh2a/cpu/rtc.h                       |    9 
 arch/sh/include/cpu-sh2a/cpu/sh7203.h                    |  144 
 arch/sh/include/cpu-sh2a/cpu/sh7264.h                    |  169 
 arch/sh/include/cpu-sh2a/cpu/sh7269.h                    |  213 -
 arch/sh/include/cpu-sh2a/cpu/watchdog.h                  |    2 
 arch/sh/include/cpu-sh3/cpu/adc.h                        |   29 
 arch/sh/include/cpu-sh3/cpu/cache.h                      |   40 
 arch/sh/include/cpu-sh3/cpu/dac.h                        |   42 
 arch/sh/include/cpu-sh3/cpu/dma-register.h               |   38 
 arch/sh/include/cpu-sh3/cpu/dma.h                        |   19 
 arch/sh/include/cpu-sh3/cpu/freq.h                       |   24 
 arch/sh/include/cpu-sh3/cpu/gpio.h                       |   78 
 arch/sh/include/cpu-sh3/cpu/mmu_context.h                |   42 
 arch/sh/include/cpu-sh3/cpu/serial.h                     |   11 
 arch/sh/include/cpu-sh3/cpu/sh7720.h                     |  175 
 arch/sh/include/cpu-sh3/cpu/watchdog.h                   |   22 
 arch/sh/include/cpu-sh4/cpu/addrspace.h                  |   41 
 arch/sh/include/cpu-sh4/cpu/cache.h                      |   41 
 arch/sh/include/cpu-sh4/cpu/dma-register.h               |   98 
 arch/sh/include/cpu-sh4/cpu/dma.h                        |   18 
 arch/sh/include/cpu-sh4/cpu/fpu.h                        |   30 
 arch/sh/include/cpu-sh4/cpu/freq.h                       |   74 
 arch/sh/include/cpu-sh4/cpu/mmu_context.h                |   79 
 arch/sh/include/cpu-sh4/cpu/rtc.h                        |   14 
 arch/sh/include/cpu-sh4/cpu/sh7722.h                     |  252 -
 arch/sh/include/cpu-sh4/cpu/sh7723.h                     |  285 -
 arch/sh/include/cpu-sh4/cpu/sh7724.h                     |  319 -
 arch/sh/include/cpu-sh4/cpu/sh7734.h                     |  307 -
 arch/sh/include/cpu-sh4/cpu/sh7757.h                     |  290 -
 arch/sh/include/cpu-sh4/cpu/sh7785.h                     |  260 -
 arch/sh/include/cpu-sh4/cpu/sh7786.h                     |  138 
 arch/sh/include/cpu-sh4/cpu/shx3.h                       |   65 
 arch/sh/include/cpu-sh4/cpu/sigcontext.h                 |   25 
 arch/sh/include/cpu-sh4/cpu/sq.h                         |   33 
 arch/sh/include/cpu-sh4/cpu/watchdog.h                   |   41 
 arch/sh/include/cpu-sh4a/cpu/dma.h                       |   72 
 arch/sh/include/cpu-sh4a/cpu/serial.h                    |    8 
 arch/sh/include/mach-common/mach/highlander.h            |  208 -
 arch/sh/include/mach-common/mach/hp6xx.h                 |   59 
 arch/sh/include/mach-common/mach/lboxre2.h               |   24 
 arch/sh/include/mach-common/mach/magicpanelr2.h          |   64 
 arch/sh/include/mach-common/mach/mangle-port.h           |   46 
 arch/sh/include/mach-common/mach/microdev.h              |   69 
 arch/sh/include/mach-common/mach/r2d.h                   |   71 
 arch/sh/include/mach-common/mach/romimage.h              |   12 
 arch/sh/include/mach-common/mach/sdk7780.h               |   79 
 arch/sh/include/mach-common/mach/secureedge5410.h        |   47 
 arch/sh/include/mach-common/mach/sh2007.h                |  118 
 arch/sh/include/mach-common/mach/sh7763rdp.h             |   50 
 arch/sh/include/mach-common/mach/sh7785lcr.h             |   58 
 arch/sh/include/mach-common/mach/shmin.h                 |   10 
 arch/sh/include/mach-common/mach/titan.h                 |   20 
 arch/sh/include/mach-common/mach/urquell.h               |   69 
 arch/sh/include/mach-dreamcast/mach/dma.h                |   29 
 arch/sh/include/mach-dreamcast/mach/maple.h              |   38 
 arch/sh/include/mach-dreamcast/mach/pci.h                |   24 
 arch/sh/include/mach-dreamcast/mach/sysasic.h            |   46 
 arch/sh/include/mach-ecovec24/mach/partner-jet-setup.txt |   82 
 arch/sh/include/mach-ecovec24/mach/romimage.h            |   48 
 arch/sh/include/mach-kfr2r09/mach/kfr2r09.h              |   24 
 arch/sh/include/mach-kfr2r09/mach/partner-jet-setup.txt  |  144 
 arch/sh/include/mach-kfr2r09/mach/romimage.h             |   31 
 arch/sh/include/mach-landisk/mach/gio.h                  |   38 
 arch/sh/include/mach-landisk/mach/iodata_landisk.h       |   46 
 arch/sh/include/mach-migor/mach/migor.h                  |   16 
 arch/sh/include/mach-sdk7786/mach/fpga.h                 |  156 
 arch/sh/include/mach-sdk7786/mach/irq.h                  |    8 
 arch/sh/include/mach-se/mach/mrshpc.h                    |   53 
 arch/sh/include/mach-se/mach/se.h                        |  120 
 arch/sh/include/mach-se/mach/se7206.h                    |   14 
 arch/sh/include/mach-se/mach/se7343.h                    |  143 
 arch/sh/include/mach-se/mach/se7721.h                    |   68 
 arch/sh/include/mach-se/mach/se7722.h                    |   98 
 arch/sh/include/mach-se/mach/se7724.h                    |   69 
 arch/sh/include/mach-se/mach/se7751.h                    |   75 
 arch/sh/include/mach-se/mach/se7780.h                    |  106 
 arch/sh/include/mach-sh03/mach/io.h                      |   26 
 arch/sh/include/mach-sh03/mach/sh03.h                    |   19 
 arch/sh/include/mach-x3proto/mach/hardware.h             |   13 
 arch/sh/include/mach-x3proto/mach/ilsel.h                |   46 
 arch/sh/include/uapi/asm/Kbuild                          |    4 
 arch/sh/include/uapi/asm/auxvec.h                        |   39 
 arch/sh/include/uapi/asm/byteorder.h                     |   11 
 arch/sh/include/uapi/asm/cachectl.h                      |   20 
 arch/sh/include/uapi/asm/cpu-features.h                  |   28 
 arch/sh/include/uapi/asm/hw_breakpoint.h                 |    5 
 arch/sh/include/uapi/asm/ioctls.h                        |  116 
 arch/sh/include/uapi/asm/posix_types.h                   |    2 
 arch/sh/include/uapi/asm/posix_types_32.h                |   23 
 arch/sh/include/uapi/asm/ptrace.h                        |   30 
 arch/sh/include/uapi/asm/ptrace_32.h                     |   78 
 arch/sh/include/uapi/asm/sigcontext.h                    |   25 
 arch/sh/include/uapi/asm/signal.h                        |   18 
 arch/sh/include/uapi/asm/sockios.h                       |   18 
 arch/sh/include/uapi/asm/stat.h                          |   78 
 arch/sh/include/uapi/asm/swab.h                          |   50 
 arch/sh/include/uapi/asm/unistd.h                        |    2 
 arch/sh/kernel/.gitignore                                |    2 
 arch/sh/kernel/Makefile                                  |   49 
 arch/sh/kernel/asm-offsets.c                             |   60 
 arch/sh/kernel/cpu/Makefile                              |   21 
 arch/sh/kernel/cpu/adc.c                                 |   37 
 arch/sh/kernel/cpu/clock-cpg.c                           |   78 
 arch/sh/kernel/cpu/clock.c                               |   52 
 arch/sh/kernel/cpu/fpu.c                                 |   92 
 arch/sh/kernel/cpu/init.c                                |  366 -
 arch/sh/kernel/cpu/irq/Makefile                          |    6 
 arch/sh/kernel/cpu/irq/imask.c                           |   85 
 arch/sh/kernel/cpu/irq/ipr.c                             |   80 
 arch/sh/kernel/cpu/pfc.c                                 |   25 
 arch/sh/kernel/cpu/proc.c                                |  151 
 arch/sh/kernel/cpu/sh2/Makefile                          |   12 
 arch/sh/kernel/cpu/sh2/clock-sh7619.c                    |   74 
 arch/sh/kernel/cpu/sh2/entry.S                           |  373 -
 arch/sh/kernel/cpu/sh2/ex.S                              |   44 
 arch/sh/kernel/cpu/sh2/probe.c                           |   71 
 arch/sh/kernel/cpu/sh2/setup-sh7619.c                    |  205 -
 arch/sh/kernel/cpu/sh2/smp-j2.c                          |  136 
 arch/sh/kernel/cpu/sh2a/Makefile                         |   25 
 arch/sh/kernel/cpu/sh2a/clock-sh7201.c                   |   82 
 arch/sh/kernel/cpu/sh2a/clock-sh7203.c                   |   78 
 arch/sh/kernel/cpu/sh2a/clock-sh7206.c                   |   80 
 arch/sh/kernel/cpu/sh2a/clock-sh7264.c                   |  157 
 arch/sh/kernel/cpu/sh2a/clock-sh7269.c                   |  181 
 arch/sh/kernel/cpu/sh2a/entry.S                          |  247 -
 arch/sh/kernel/cpu/sh2a/ex.S                             |   70 
 arch/sh/kernel/cpu/sh2a/fpu.c                            |  572 ---
 arch/sh/kernel/cpu/sh2a/opcode_helper.c                  |   51 
 arch/sh/kernel/cpu/sh2a/pinmux-sh7203.c                  |   27 
 arch/sh/kernel/cpu/sh2a/pinmux-sh7264.c                  |   27 
 arch/sh/kernel/cpu/sh2a/pinmux-sh7269.c                  |   28 
 arch/sh/kernel/cpu/sh2a/probe.c                          |   57 
 arch/sh/kernel/cpu/sh2a/setup-mxg.c                      |  175 
 arch/sh/kernel/cpu/sh2a/setup-sh7201.c                   |  418 --
 arch/sh/kernel/cpu/sh2a/setup-sh7203.c                   |  355 -
 arch/sh/kernel/cpu/sh2a/setup-sh7206.c                   |  291 -
 arch/sh/kernel/cpu/sh2a/setup-sh7264.c                   |  552 --
 arch/sh/kernel/cpu/sh2a/setup-sh7269.c                   |  568 --
 arch/sh/kernel/cpu/sh3/Makefile                          |   34 
 arch/sh/kernel/cpu/sh3/clock-sh3.c                       |   86 
 arch/sh/kernel/cpu/sh3/clock-sh7705.c                    |   81 
 arch/sh/kernel/cpu/sh3/clock-sh7706.c                    |   81 
 arch/sh/kernel/cpu/sh3/clock-sh7709.c                    |   82 
 arch/sh/kernel/cpu/sh3/clock-sh7710.c                    |   75 
 arch/sh/kernel/cpu/sh3/clock-sh7712.c                    |   68 
 arch/sh/kernel/cpu/sh3/entry.S                           |  509 --
 arch/sh/kernel/cpu/sh3/ex.S                              |   56 
 arch/sh/kernel/cpu/sh3/pinmux-sh7720.c                   |   27 
 arch/sh/kernel/cpu/sh3/probe.c                           |  108 
 arch/sh/kernel/cpu/sh3/serial-sh770x.c                   |   34 
 arch/sh/kernel/cpu/sh3/serial-sh7710.c                   |   21 
 arch/sh/kernel/cpu/sh3/serial-sh7720.c                   |   38 
 arch/sh/kernel/cpu/sh3/setup-sh3.c                       |   69 
 arch/sh/kernel/cpu/sh3/setup-sh7705.c                    |  190 
 arch/sh/kernel/cpu/sh3/setup-sh770x.c                    |  246 -
 arch/sh/kernel/cpu/sh3/setup-sh7710.c                    |  189 
 arch/sh/kernel/cpu/sh3/setup-sh7720.c                    |  286 -
 arch/sh/kernel/cpu/sh3/swsusp.S                          |  144 
 arch/sh/kernel/cpu/sh4/Makefile                          |   37 
 arch/sh/kernel/cpu/sh4/clock-sh4-202.c                   |  174 
 arch/sh/kernel/cpu/sh4/clock-sh4.c                       |   77 
 arch/sh/kernel/cpu/sh4/fpu.c                             |  425 --
 arch/sh/kernel/cpu/sh4/perf_event.c                      |  265 -
 arch/sh/kernel/cpu/sh4/probe.c                           |  260 -
 arch/sh/kernel/cpu/sh4/setup-sh4-202.c                   |  139 
 arch/sh/kernel/cpu/sh4/setup-sh7750.c                    |  359 -
 arch/sh/kernel/cpu/sh4/setup-sh7760.c                    |  297 -
 arch/sh/kernel/cpu/sh4/softfloat.c                       |  930 ----
 arch/sh/kernel/cpu/sh4/sq.c                              |  414 --
 arch/sh/kernel/cpu/sh4a/Makefile                         |   53 
 arch/sh/kernel/cpu/sh4a/clock-sh7343.c                   |  277 -
 arch/sh/kernel/cpu/sh4a/clock-sh7366.c                   |  270 -
 arch/sh/kernel/cpu/sh4a/clock-sh7722.c                   |  253 -
 arch/sh/kernel/cpu/sh4a/clock-sh7723.c                   |  301 -
 arch/sh/kernel/cpu/sh4a/clock-sh7724.c                   |  367 -
 arch/sh/kernel/cpu/sh4a/clock-sh7734.c                   |  256 -
 arch/sh/kernel/cpu/sh4a/clock-sh7757.c                   |  152 
 arch/sh/kernel/cpu/sh4a/clock-sh7763.c                   |  116 
 arch/sh/kernel/cpu/sh4a/clock-sh7770.c                   |   70 
 arch/sh/kernel/cpu/sh4a/clock-sh7780.c                   |  122 
 arch/sh/kernel/cpu/sh4a/clock-sh7785.c                   |  174 
 arch/sh/kernel/cpu/sh4a/clock-sh7786.c                   |  189 
 arch/sh/kernel/cpu/sh4a/clock-shx3.c                     |  148 
 arch/sh/kernel/cpu/sh4a/intc-shx3.c                      |   31 
 arch/sh/kernel/cpu/sh4a/perf_event.c                     |  299 -
 arch/sh/kernel/cpu/sh4a/pinmux-sh7722.c                  |   21 
 arch/sh/kernel/cpu/sh4a/pinmux-sh7723.c                  |   27 
 arch/sh/kernel/cpu/sh4a/pinmux-sh7724.c                  |   32 
 arch/sh/kernel/cpu/sh4a/pinmux-sh7734.c                  |   32 
 arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c                  |   32 
 arch/sh/kernel/cpu/sh4a/pinmux-sh7785.c                  |   27 
 arch/sh/kernel/cpu/sh4a/pinmux-sh7786.c                  |   32 
 arch/sh/kernel/cpu/sh4a/pinmux-shx3.c                    |   26 
 arch/sh/kernel/cpu/sh4a/serial-sh7722.c                  |   24 
 arch/sh/kernel/cpu/sh4a/setup-sh7343.c                   |  444 --
 arch/sh/kernel/cpu/sh4a/setup-sh7366.c                   |  388 --
 arch/sh/kernel/cpu/sh4a/setup-sh7722.c                   |  666 ---
 arch/sh/kernel/cpu/sh4a/setup-sh7723.c                   |  644 ---
 arch/sh/kernel/cpu/sh4a/setup-sh7724.c                   | 1288 ------
 arch/sh/kernel/cpu/sh4a/setup-sh7734.c                   |  621 ---
 arch/sh/kernel/cpu/sh4a/setup-sh7757.c                   | 1242 ------
 arch/sh/kernel/cpu/sh4a/setup-sh7763.c                   |  455 --
 arch/sh/kernel/cpu/sh4a/setup-sh7770.c                   |  571 ---
 arch/sh/kernel/cpu/sh4a/setup-sh7780.c                   |  505 --
 arch/sh/kernel/cpu/sh4a/setup-sh7785.c                   |  608 ---
 arch/sh/kernel/cpu/sh4a/setup-sh7786.c                   |  841 ----
 arch/sh/kernel/cpu/sh4a/setup-shx3.c                     |  396 --
 arch/sh/kernel/cpu/sh4a/smp-shx3.c                       |  146 
 arch/sh/kernel/cpu/sh4a/ubc.c                            |  130 
 arch/sh/kernel/cpu/shmobile/Makefile                     |    8 
 arch/sh/kernel/cpu/shmobile/cpuidle.c                    |   95 
 arch/sh/kernel/cpu/shmobile/pm.c                         |  153 
 arch/sh/kernel/cpu/shmobile/sleep.S                      |  402 --
 arch/sh/kernel/crash_dump.c                              |   27 
 arch/sh/kernel/debugtraps.S                              |   38 
 arch/sh/kernel/disassemble.c                             |  572 ---
 arch/sh/kernel/dma-coherent.c                            |   33 
 arch/sh/kernel/dumpstack.c                               |  156 
 arch/sh/kernel/dwarf.c                                   | 1206 ------
 arch/sh/kernel/entry-common.S                            |  400 --
 arch/sh/kernel/ftrace.c                                  |  365 -
 arch/sh/kernel/head_32.S                                 |  365 -
 arch/sh/kernel/hw_breakpoint.c                           |  408 --
 arch/sh/kernel/idle.c                                    |   57 
 arch/sh/kernel/io.c                                      |  111 
 arch/sh/kernel/io_trapped.c                              |  291 -
 arch/sh/kernel/iomap.c                                   |  162 
 arch/sh/kernel/ioport.c                                  |   41 
 arch/sh/kernel/irq.c                                     |  249 -
 arch/sh/kernel/irq_32.c                                  |   54 
 arch/sh/kernel/kdebugfs.c                                |   14 
 arch/sh/kernel/kgdb.c                                    |  378 -
 arch/sh/kernel/kprobes.c                                 |  452 --
 arch/sh/kernel/machine_kexec.c                           |  204 -
 arch/sh/kernel/machvec.c                                 |  122 
 arch/sh/kernel/module.c                                  |  104 
 arch/sh/kernel/nmi_debug.c                               |   75 
 arch/sh/kernel/perf_callchain.c                          |   32 
 arch/sh/kernel/perf_event.c                              |  363 -
 arch/sh/kernel/process.c                                 |   77 
 arch/sh/kernel/process_32.c                              |  197 -
 arch/sh/kernel/ptrace.c                                  |   34 
 arch/sh/kernel/ptrace_32.c                               |  487 --
 arch/sh/kernel/reboot.c                                  |   96 
 arch/sh/kernel/relocate_kernel.S                         |  230 -
 arch/sh/kernel/return_address.c                          |   56 
 arch/sh/kernel/setup.c                                   |  356 -
 arch/sh/kernel/sh_bios.c                                 |  169 
 arch/sh/kernel/sh_ksyms_32.c                             |  118 
 arch/sh/kernel/signal_32.c                               |  507 --
 arch/sh/kernel/smp.c                                     |  471 --
 arch/sh/kernel/stacktrace.c                              |   79 
 arch/sh/kernel/swsusp.c                                  |   35 
 arch/sh/kernel/sys_sh.c                                  |   96 
 arch/sh/kernel/sys_sh32.c                                |   61 
 arch/sh/kernel/syscalls/Makefile                         |   32 
 arch/sh/kernel/syscalls/syscall.tbl                      |  455 --
 arch/sh/kernel/syscalls_32.S                             |   17 
 arch/sh/kernel/time.c                                    |   45 
 arch/sh/kernel/topology.c                                |   74 
 arch/sh/kernel/traps.c                                   |  204 -
 arch/sh/kernel/traps_32.c                                |  795 ----
 arch/sh/kernel/unwinder.c                                |  165 
 arch/sh/kernel/vmlinux.lds.S                             |   82 
 arch/sh/kernel/vsyscall/.gitignore                       |    2 
 arch/sh/kernel/vsyscall/Makefile                         |   36 
 arch/sh/kernel/vsyscall/vsyscall-note.S                  |   26 
 arch/sh/kernel/vsyscall/vsyscall-sigreturn.S             |   75 
 arch/sh/kernel/vsyscall/vsyscall-syscall.S               |   11 
 arch/sh/kernel/vsyscall/vsyscall-trapa.S                 |   40 
 arch/sh/kernel/vsyscall/vsyscall.c                       |   93 
 arch/sh/kernel/vsyscall/vsyscall.lds.S                   |   85 
 arch/sh/lib/Makefile                                     |   32 
 arch/sh/lib/__clear_user.S                               |  109 
 arch/sh/lib/ashiftrt.S                                   |  128 
 arch/sh/lib/ashldi3.c                                    |   30 
 arch/sh/lib/ashlsi3.S                                    |  189 
 arch/sh/lib/ashrdi3.c                                    |   32 
 arch/sh/lib/ashrsi3.S                                    |  179 
 arch/sh/lib/checksum.S                                   |  365 -
 arch/sh/lib/copy_page.S                                  |  390 --
 arch/sh/lib/delay.c                                      |   54 
 arch/sh/lib/div64-generic.c                              |   20 
 arch/sh/lib/div64.S                                      |   47 
 arch/sh/lib/io.c                                         |   79 
 arch/sh/lib/libgcc.h                                     |   27 
 arch/sh/lib/lshrdi3.c                                    |   30 
 arch/sh/lib/lshrsi3.S                                    |  188 
 arch/sh/lib/mcount.S                                     |  287 -
 arch/sh/lib/memchr.S                                     |   27 
 arch/sh/lib/memcpy-sh4.S                                 |  800 ----
 arch/sh/lib/memcpy.S                                     |  228 -
 arch/sh/lib/memmove.S                                    |  255 -
 arch/sh/lib/memset-sh4.S                                 |  108 
 arch/sh/lib/memset.S                                     |   59 
 arch/sh/lib/movmem.S                                     |  217 -
 arch/sh/lib/strlen.S                                     |   71 
 arch/sh/lib/udiv_qrnnd.S                                 |   60 
 arch/sh/lib/udivsi3.S                                    |   66 
 arch/sh/lib/udivsi3_i4i-Os.S                             |  128 
 arch/sh/lib/udivsi3_i4i.S                                |  645 ---
 arch/sh/math-emu/Makefile                                |    2 
 arch/sh/math-emu/math.c                                  |  506 --
 arch/sh/math-emu/sfp-util.h                              |   73 
 arch/sh/mm/Kconfig                                       |  254 -
 arch/sh/mm/Makefile                                      |   45 
 arch/sh/mm/alignment.c                                   |  189 
 arch/sh/mm/asids-debugfs.c                               |   59 
 arch/sh/mm/cache-debugfs.c                               |  109 
 arch/sh/mm/cache-j2.c                                    |   64 
 arch/sh/mm/cache-sh2.c                                   |   90 
 arch/sh/mm/cache-sh2a.c                                  |  188 
 arch/sh/mm/cache-sh3.c                                   |  102 
 arch/sh/mm/cache-sh4.c                                   |  390 --
 arch/sh/mm/cache-sh7705.c                                |  194 -
 arch/sh/mm/cache-shx3.c                                  |   44 
 arch/sh/mm/cache.c                                       |  360 -
 arch/sh/mm/consistent.c                                  |   65 
 arch/sh/mm/extable_32.c                                  |   24 
 arch/sh/mm/fault.c                                       |  504 --
 arch/sh/mm/flush-sh4.c                                   |  111 
 arch/sh/mm/hugetlbpage.c                                 |   82 
 arch/sh/mm/init.c                                        |  424 --
 arch/sh/mm/ioremap.c                                     |  192 -
 arch/sh/mm/ioremap.h                                     |   23 
 arch/sh/mm/ioremap_fixed.c                               |  135 
 arch/sh/mm/kmap.c                                        |   65 
 arch/sh/mm/mmap.c                                        |  184 
 arch/sh/mm/nommu.c                                       |   98 
 arch/sh/mm/numa.c                                        |   56 
 arch/sh/mm/pgtable.c                                     |   57 
 arch/sh/mm/pmb.c                                         |  887 ----
 arch/sh/mm/sram.c                                        |   35 
 arch/sh/mm/tlb-debugfs.c                                 |  160 
 arch/sh/mm/tlb-pteaex.c                                  |  106 
 arch/sh/mm/tlb-sh3.c                                     |   95 
 arch/sh/mm/tlb-sh4.c                                     |  108 
 arch/sh/mm/tlb-urb.c                                     |   93 
 arch/sh/mm/tlbex_32.c                                    |   82 
 arch/sh/mm/tlbflush_32.c                                 |  137 
 arch/sh/mm/uncached.c                                    |   44 
 arch/sh/tools/Makefile                                   |   16 
 arch/sh/tools/gen-mach-types                             |   48 
 arch/sh/tools/mach-types                                 |   67 
 b/Documentation/arch.rst                                 |    1 
 b/Documentation/watchdog/watchdog-parameters.rst         |   12 
 b/MAINTAINERS                                            |   10 
 b/drivers/Makefile                                       |    1 
 b/drivers/base/platform.c                                |    4 
 b/drivers/clocksource/sh_cmt.c                           |   16 
 b/drivers/clocksource/sh_mtu2.c                          |   16 
 b/drivers/clocksource/sh_tmu.c                           |   17 
 b/drivers/cpufreq/Kconfig                                |   14 
 b/drivers/cpufreq/Makefile                               |    1 
 b/drivers/dma/sh/Kconfig                                 |   20 
 b/drivers/dma/sh/Makefile                                |   13 
 b/drivers/gpu/drm/Kconfig                                |    2 
 b/drivers/gpu/drm/Makefile                               |    1 
 b/drivers/i2c/busses/Kconfig                             |   13 
 b/drivers/i2c/busses/Makefile                            |    1 
 b/drivers/input/keyboard/Kconfig                         |   10 
 b/drivers/input/keyboard/Makefile                        |    1 
 b/drivers/media/platform/renesas/Kconfig                 |   11 
 b/drivers/media/platform/renesas/Makefile                |    1 
 b/drivers/mmc/host/Kconfig                               |    6 
 b/drivers/mmc/host/sh_mmcif.c                            |   21 
 b/drivers/mtd/nand/raw/Kconfig                           |    8 
 b/drivers/mtd/nand/raw/Makefile                          |    1 
 b/drivers/net/ethernet/8390/Kconfig                      |   14 
 b/drivers/net/ethernet/8390/Makefile                     |    1 
 b/drivers/net/ethernet/renesas/Kconfig                   |    2 
 b/drivers/net/ethernet/smsc/Kconfig                      |    4 
 b/drivers/pinctrl/renesas/Kconfig                        |   63 
 b/drivers/pinctrl/renesas/Makefile                       |   27 
 b/drivers/pinctrl/renesas/core.c                         |  598 ---
 b/drivers/rtc/Kconfig                                    |    4 
 b/drivers/rtc/rtc-sh.c                                   |   18 
 b/drivers/spi/Kconfig                                    |   24 
 b/drivers/spi/Makefile                                   |    3 
 b/drivers/tty/serial/Kconfig                             |    3 
 b/drivers/tty/serial/sh-sci.c                            |   57 
 b/drivers/tty/vt/keyboard.c                              |    2 
 b/drivers/usb/host/Kconfig                               |   18 
 b/drivers/usb/host/ehci-hcd.c                            |    7 
 b/drivers/usb/renesas_usbhs/Kconfig                      |    2 
 b/drivers/video/console/Kconfig                          |    2 
 b/drivers/video/fbdev/Kconfig                            |   17 
 b/drivers/video/fbdev/Makefile                           |    1 
 b/drivers/video/logo/Kconfig                             |   15 
 b/drivers/video/logo/Makefile                            |    3 
 b/drivers/video/logo/logo.c                              |   12 
 b/drivers/watchdog/Kconfig                               |   20 
 b/drivers/watchdog/Makefile                              |    3 
 b/fs/Kconfig.binfmt                                      |    2 
 b/fs/minix/Kconfig                                       |    2 
 b/include/linux/cpuhotplug.h                             |    1 
 b/include/linux/platform_device.h                        |   15 
 b/include/linux/sh_intc.h                                |    4 
 b/include/linux/shdma-base.h                             |    4 
 b/init/Kconfig                                           |    2 
 b/kernel/sysctl.c                                        |    3 
 b/lib/Kconfig.debug                                      |    2 
 b/lib/math/div64.c                                       |    4 
 b/lib/test_user_copy.c                                   |    3 
 b/scripts/coccinelle/misc/cond_no_effect.cocci           |   13 
 b/scripts/head-object-list.txt                           |    1 
 b/sound/Kconfig                                          |    2 
 b/sound/Makefile                                         |    2 
 b/sound/soc/sh/Kconfig                                   |   48 
 b/sound/soc/sh/Makefile                                  |   16 
 b/sound/soc/sh/fsi.c                                     |    9 
 b/tools/include/asm/barrier.h                            |    2 
 b/tools/perf/util/dwarf-regs.c                           |    1 
 drivers/cpufreq/sh-cpufreq.c                             |  175 
 drivers/dma/sh/shdma-base.c                              | 1052 -----
 drivers/dma/sh/shdma.h                                   |   61 
 drivers/dma/sh/shdmac.c                                  |  938 ----
 drivers/gpu/drm/shmobile/Kconfig                         |   12 
 drivers/gpu/drm/shmobile/Makefile                        |    8 
 drivers/gpu/drm/shmobile/shmob_drm_backlight.c           |   82 
 drivers/gpu/drm/shmobile/shmob_drm_backlight.h           |   19 
 drivers/gpu/drm/shmobile/shmob_drm_crtc.c                |  683 ---
 drivers/gpu/drm/shmobile/shmob_drm_crtc.h                |   55 
 drivers/gpu/drm/shmobile/shmob_drm_drv.c                 |  303 -
 drivers/gpu/drm/shmobile/shmob_drm_drv.h                 |   42 
 drivers/gpu/drm/shmobile/shmob_drm_kms.c                 |  150 
 drivers/gpu/drm/shmobile/shmob_drm_kms.h                 |   29 
 drivers/gpu/drm/shmobile/shmob_drm_plane.c               |  261 -
 drivers/gpu/drm/shmobile/shmob_drm_plane.h               |   19 
 drivers/gpu/drm/shmobile/shmob_drm_regs.h                |  310 -
 drivers/i2c/busses/i2c-sh7760.c                          |  565 --
 drivers/input/keyboard/sh_keysc.c                        |  334 -
 drivers/media/platform/renesas/sh_vou.c                  | 1375 -------
 drivers/mtd/nand/raw/sh_flctl.c                          | 1234 ------
 drivers/net/ethernet/8390/stnic.c                        |  302 -
 drivers/pinctrl/renesas/pfc-sh7203.c                     | 1577 --------
 drivers/pinctrl/renesas/pfc-sh7264.c                     | 2131 -----------
 drivers/pinctrl/renesas/pfc-sh7269.c                     | 2851 ---------------
 drivers/pinctrl/renesas/pfc-sh7720.c                     | 1201 ------
 drivers/pinctrl/renesas/pfc-sh7722.c                     | 1703 --------
 drivers/pinctrl/renesas/pfc-sh7723.c                     | 1902 ----------
 drivers/pinctrl/renesas/pfc-sh7724.c                     | 2177 -----------
 drivers/pinctrl/renesas/pfc-sh7734.c                     | 2408 ------------
 drivers/pinctrl/renesas/pfc-sh7757.c                     | 2219 -----------
 drivers/pinctrl/renesas/pfc-sh7785.c                     | 1258 ------
 drivers/pinctrl/renesas/pfc-sh7786.c                     |  809 ----
 drivers/pinctrl/renesas/pfc-shx3.c                       |  557 --
 drivers/sh/Kconfig                                       |    6 
 drivers/sh/Makefile                                      |   12 
 drivers/sh/clk/Makefile                                  |    4 
 drivers/sh/clk/core.c                                    |  624 ---
 drivers/sh/clk/cpg.c                                     |  477 --
 drivers/sh/intc/Kconfig                                  |   44 
 drivers/sh/intc/Makefile                                 |    6 
 drivers/sh/intc/access.c                                 |  246 -
 drivers/sh/intc/balancing.c                              |   97 
 drivers/sh/intc/chip.c                                   |  211 -
 drivers/sh/intc/core.c                                   |  501 --
 drivers/sh/intc/handle.c                                 |  306 -
 drivers/sh/intc/internals.h                              |  191 -
 drivers/sh/intc/irqdomain.c                              |   68 
 drivers/sh/intc/userimask.c                              |   84 
 drivers/sh/intc/virq-debugfs.c                           |   54 
 drivers/sh/intc/virq.c                                   |  269 -
 drivers/sh/maple/Makefile                                |    4 
 drivers/sh/maple/maple.c                                 |  895 ----
 drivers/sh/pm_runtime.c                                  |   40 
 drivers/sh/superhyway/Makefile                           |    8 
 drivers/sh/superhyway/superhyway-sysfs.c                 |   54 
 drivers/sh/superhyway/superhyway.c                       |  234 -
 drivers/spi/spi-jcore.c                                  |  235 -
 drivers/spi/spi-sh-sci.c                                 |  197 -
 drivers/spi/spi-sh.c                                     |  474 --
 drivers/usb/host/ehci-sh.c                               |  182 
 drivers/video/fbdev/sh7760fb.c                           |  587 ---
 drivers/video/logo/logo_superh_clut224.ppm               | 1604 --------
 drivers/video/logo/logo_superh_vga16.ppm                 | 1604 --------
 drivers/watchdog/shwdt.c                                 |  344 -
 include/linux/mtd/sh_flctl.h                             |  180 
 include/linux/sh_clk.h                                   |  213 -
 include/linux/superhyway.h                               |  107 
 sound/sh/Kconfig                                         |   32 
 sound/sh/Makefile                                        |   11 
 sound/sh/aica.c                                          |  628 ---
 sound/sh/aica.h                                          |   68 
 sound/sh/sh_dac_audio.c                                  |  412 --
 sound/soc/sh/dma-sh7760.c                                |  334 -
 sound/soc/sh/hac.c                                       |  345 -
 sound/soc/sh/migor.c                                     |  205 -
 sound/soc/sh/sh7760-ac97.c                               |   72 
 sound/soc/sh/siu.h                                       |  180 
 sound/soc/sh/siu_dai.c                                   |  799 ----
 sound/soc/sh/siu_pcm.c                                   |  553 --
 sound/soc/sh/ssi.c                                       |  403 --
 896 files changed, 46 insertions(+), 138518 deletions(-)

^ permalink raw reply	[flat|nested] 80+ messages in thread

* [PATCH 01/22] gpu/drm: remove the shmobile drm driver
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
@ 2023-01-13  6:23 ` Christoph Hellwig
  2023-01-13  7:46   ` Laurent Pinchart
  2023-01-13  6:23 ` [PATCH 02/22] usb: remove the dead USB_OHCI_SH option Christoph Hellwig
                   ` (20 subsequent siblings)
  21 siblings, 1 reply; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

This driver depends on ARM && ARCH_SHMOBILE, but ARCH_SHMOBILE can only be
set for each/sh, making the driver dead code except for the COMPILE_TEST
case.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/gpu/drm/Kconfig                       |   2 -
 drivers/gpu/drm/Makefile                      |   1 -
 drivers/gpu/drm/shmobile/Kconfig              |  12 -
 drivers/gpu/drm/shmobile/Makefile             |   8 -
 .../gpu/drm/shmobile/shmob_drm_backlight.c    |  82 ---
 .../gpu/drm/shmobile/shmob_drm_backlight.h    |  19 -
 drivers/gpu/drm/shmobile/shmob_drm_crtc.c     | 683 ------------------
 drivers/gpu/drm/shmobile/shmob_drm_crtc.h     |  55 --
 drivers/gpu/drm/shmobile/shmob_drm_drv.c      | 303 --------
 drivers/gpu/drm/shmobile/shmob_drm_drv.h      |  42 --
 drivers/gpu/drm/shmobile/shmob_drm_kms.c      | 150 ----
 drivers/gpu/drm/shmobile/shmob_drm_kms.h      |  29 -
 drivers/gpu/drm/shmobile/shmob_drm_plane.c    | 261 -------
 drivers/gpu/drm/shmobile/shmob_drm_plane.h    |  19 -
 drivers/gpu/drm/shmobile/shmob_drm_regs.h     | 310 --------
 15 files changed, 1976 deletions(-)
 delete mode 100644 drivers/gpu/drm/shmobile/Kconfig
 delete mode 100644 drivers/gpu/drm/shmobile/Makefile
 delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_backlight.c
 delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_backlight.h
 delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_crtc.c
 delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_crtc.h
 delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_drv.c
 delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_drv.h
 delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_kms.c
 delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_kms.h
 delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_plane.c
 delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_plane.h
 delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_regs.h

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 315cbdf6197927..1cb4bcb0714c87 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -286,8 +286,6 @@ source "drivers/gpu/drm/atmel-hlcdc/Kconfig"
 
 source "drivers/gpu/drm/rcar-du/Kconfig"
 
-source "drivers/gpu/drm/shmobile/Kconfig"
-
 source "drivers/gpu/drm/sun4i/Kconfig"
 
 source "drivers/gpu/drm/omapdrm/Kconfig"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index cc637343d87b09..87709cf7db8145 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -160,7 +160,6 @@ obj-$(CONFIG_DRM_AST) += ast/
 obj-$(CONFIG_DRM_ARMADA) += armada/
 obj-$(CONFIG_DRM_ATMEL_HLCDC)	+= atmel-hlcdc/
 obj-y			+= rcar-du/
-obj-$(CONFIG_DRM_SHMOBILE) +=shmobile/
 obj-y			+= omapdrm/
 obj-$(CONFIG_DRM_SUN4I) += sun4i/
 obj-y			+= tilcdc/
diff --git a/drivers/gpu/drm/shmobile/Kconfig b/drivers/gpu/drm/shmobile/Kconfig
deleted file mode 100644
index 4ec5dc74a6b0b8..00000000000000
--- a/drivers/gpu/drm/shmobile/Kconfig
+++ /dev/null
@@ -1,12 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-config DRM_SHMOBILE
-	tristate "DRM Support for SH Mobile"
-	depends on DRM && ARM
-	depends on ARCH_SHMOBILE || COMPILE_TEST
-	select BACKLIGHT_CLASS_DEVICE
-	select DRM_KMS_HELPER
-	select DRM_GEM_DMA_HELPER
-	help
-	  Choose this option if you have an SH Mobile chipset.
-	  If M is selected the module will be called shmob-drm.
-
diff --git a/drivers/gpu/drm/shmobile/Makefile b/drivers/gpu/drm/shmobile/Makefile
deleted file mode 100644
index 861edafed8562c..00000000000000
--- a/drivers/gpu/drm/shmobile/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-shmob-drm-y := shmob_drm_backlight.o \
-	       shmob_drm_crtc.o \
-	       shmob_drm_drv.o \
-	       shmob_drm_kms.o \
-	       shmob_drm_plane.o
-
-obj-$(CONFIG_DRM_SHMOBILE)	+= shmob-drm.o
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_backlight.c b/drivers/gpu/drm/shmobile/shmob_drm_backlight.c
deleted file mode 100644
index 794573badfe860..00000000000000
--- a/drivers/gpu/drm/shmobile/shmob_drm_backlight.c
+++ /dev/null
@@ -1,82 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * shmob_drm_backlight.c  --  SH Mobile DRM Backlight
- *
- * Copyright (C) 2012 Renesas Electronics Corporation
- *
- * Laurent Pinchart (laurent.pinchart@ideasonboard.com)
- */
-
-#include <linux/backlight.h>
-
-#include "shmob_drm_backlight.h"
-#include "shmob_drm_crtc.h"
-#include "shmob_drm_drv.h"
-
-static int shmob_drm_backlight_update(struct backlight_device *bdev)
-{
-	struct shmob_drm_connector *scon = bl_get_data(bdev);
-	struct shmob_drm_device *sdev = scon->connector.dev->dev_private;
-	const struct shmob_drm_backlight_data *bdata = &sdev->pdata->backlight;
-	int brightness = backlight_get_brightness(bdev);
-
-	return bdata->set_brightness(brightness);
-}
-
-static int shmob_drm_backlight_get_brightness(struct backlight_device *bdev)
-{
-	struct shmob_drm_connector *scon = bl_get_data(bdev);
-	struct shmob_drm_device *sdev = scon->connector.dev->dev_private;
-	const struct shmob_drm_backlight_data *bdata = &sdev->pdata->backlight;
-
-	return bdata->get_brightness();
-}
-
-static const struct backlight_ops shmob_drm_backlight_ops = {
-	.options	= BL_CORE_SUSPENDRESUME,
-	.update_status	= shmob_drm_backlight_update,
-	.get_brightness	= shmob_drm_backlight_get_brightness,
-};
-
-void shmob_drm_backlight_dpms(struct shmob_drm_connector *scon, int mode)
-{
-	if (scon->backlight == NULL)
-		return;
-
-	scon->backlight->props.power = mode == DRM_MODE_DPMS_ON
-				     ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;
-	backlight_update_status(scon->backlight);
-}
-
-int shmob_drm_backlight_init(struct shmob_drm_connector *scon)
-{
-	struct shmob_drm_device *sdev = scon->connector.dev->dev_private;
-	const struct shmob_drm_backlight_data *bdata = &sdev->pdata->backlight;
-	struct drm_connector *connector = &scon->connector;
-	struct drm_device *dev = connector->dev;
-	struct backlight_device *backlight;
-
-	if (!bdata->max_brightness)
-		return 0;
-
-	backlight = backlight_device_register(bdata->name, dev->dev, scon,
-					      &shmob_drm_backlight_ops, NULL);
-	if (IS_ERR(backlight)) {
-		dev_err(dev->dev, "unable to register backlight device: %ld\n",
-			PTR_ERR(backlight));
-		return PTR_ERR(backlight);
-	}
-
-	backlight->props.max_brightness = bdata->max_brightness;
-	backlight->props.brightness = bdata->max_brightness;
-	backlight->props.power = FB_BLANK_POWERDOWN;
-	backlight_update_status(backlight);
-
-	scon->backlight = backlight;
-	return 0;
-}
-
-void shmob_drm_backlight_exit(struct shmob_drm_connector *scon)
-{
-	backlight_device_unregister(scon->backlight);
-}
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_backlight.h b/drivers/gpu/drm/shmobile/shmob_drm_backlight.h
deleted file mode 100644
index d9abb7a60be5c4..00000000000000
--- a/drivers/gpu/drm/shmobile/shmob_drm_backlight.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * shmob_drm_backlight.h  --  SH Mobile DRM Backlight
- *
- * Copyright (C) 2012 Renesas Electronics Corporation
- *
- * Laurent Pinchart (laurent.pinchart@ideasonboard.com)
- */
-
-#ifndef __SHMOB_DRM_BACKLIGHT_H__
-#define __SHMOB_DRM_BACKLIGHT_H__
-
-struct shmob_drm_connector;
-
-void shmob_drm_backlight_dpms(struct shmob_drm_connector *scon, int mode);
-int shmob_drm_backlight_init(struct shmob_drm_connector *scon);
-void shmob_drm_backlight_exit(struct shmob_drm_connector *scon);
-
-#endif /* __SHMOB_DRM_BACKLIGHT_H__ */
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
deleted file mode 100644
index 4624c0aff51ffa..00000000000000
--- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
+++ /dev/null
@@ -1,683 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * shmob_drm_crtc.c  --  SH Mobile DRM CRTCs
- *
- * Copyright (C) 2012 Renesas Electronics Corporation
- *
- * Laurent Pinchart (laurent.pinchart@ideasonboard.com)
- */
-
-#include <linux/backlight.h>
-#include <linux/clk.h>
-
-#include <drm/drm_crtc.h>
-#include <drm/drm_crtc_helper.h>
-#include <drm/drm_fb_dma_helper.h>
-#include <drm/drm_fourcc.h>
-#include <drm/drm_framebuffer.h>
-#include <drm/drm_gem_dma_helper.h>
-#include <drm/drm_probe_helper.h>
-#include <drm/drm_simple_kms_helper.h>
-#include <drm/drm_vblank.h>
-
-#include "shmob_drm_backlight.h"
-#include "shmob_drm_crtc.h"
-#include "shmob_drm_drv.h"
-#include "shmob_drm_kms.h"
-#include "shmob_drm_plane.h"
-#include "shmob_drm_regs.h"
-
-/*
- * TODO: panel support
- */
-
-/* -----------------------------------------------------------------------------
- * Clock management
- */
-
-static int shmob_drm_clk_on(struct shmob_drm_device *sdev)
-{
-	int ret;
-
-	if (sdev->clock) {
-		ret = clk_prepare_enable(sdev->clock);
-		if (ret < 0)
-			return ret;
-	}
-
-	return 0;
-}
-
-static void shmob_drm_clk_off(struct shmob_drm_device *sdev)
-{
-	if (sdev->clock)
-		clk_disable_unprepare(sdev->clock);
-}
-
-/* -----------------------------------------------------------------------------
- * CRTC
- */
-
-static void shmob_drm_crtc_setup_geometry(struct shmob_drm_crtc *scrtc)
-{
-	struct drm_crtc *crtc = &scrtc->crtc;
-	struct shmob_drm_device *sdev = crtc->dev->dev_private;
-	const struct shmob_drm_interface_data *idata = &sdev->pdata->iface;
-	const struct drm_display_mode *mode = &crtc->mode;
-	u32 value;
-
-	value = sdev->ldmt1r
-	      | ((mode->flags & DRM_MODE_FLAG_PVSYNC) ? 0 : LDMT1R_VPOL)
-	      | ((mode->flags & DRM_MODE_FLAG_PHSYNC) ? 0 : LDMT1R_HPOL)
-	      | ((idata->flags & SHMOB_DRM_IFACE_FL_DWPOL) ? LDMT1R_DWPOL : 0)
-	      | ((idata->flags & SHMOB_DRM_IFACE_FL_DIPOL) ? LDMT1R_DIPOL : 0)
-	      | ((idata->flags & SHMOB_DRM_IFACE_FL_DAPOL) ? LDMT1R_DAPOL : 0)
-	      | ((idata->flags & SHMOB_DRM_IFACE_FL_HSCNT) ? LDMT1R_HSCNT : 0)
-	      | ((idata->flags & SHMOB_DRM_IFACE_FL_DWCNT) ? LDMT1R_DWCNT : 0);
-	lcdc_write(sdev, LDMT1R, value);
-
-	if (idata->interface >= SHMOB_DRM_IFACE_SYS8A &&
-	    idata->interface <= SHMOB_DRM_IFACE_SYS24) {
-		/* Setup SYS bus. */
-		value = (idata->sys.cs_setup << LDMT2R_CSUP_SHIFT)
-		      | (idata->sys.vsync_active_high ? LDMT2R_RSV : 0)
-		      | (idata->sys.vsync_dir_input ? LDMT2R_VSEL : 0)
-		      | (idata->sys.write_setup << LDMT2R_WCSC_SHIFT)
-		      | (idata->sys.write_cycle << LDMT2R_WCEC_SHIFT)
-		      | (idata->sys.write_strobe << LDMT2R_WCLW_SHIFT);
-		lcdc_write(sdev, LDMT2R, value);
-
-		value = (idata->sys.read_latch << LDMT3R_RDLC_SHIFT)
-		      | (idata->sys.read_setup << LDMT3R_RCSC_SHIFT)
-		      | (idata->sys.read_cycle << LDMT3R_RCEC_SHIFT)
-		      | (idata->sys.read_strobe << LDMT3R_RCLW_SHIFT);
-		lcdc_write(sdev, LDMT3R, value);
-	}
-
-	value = ((mode->hdisplay / 8) << 16)			/* HDCN */
-	      | (mode->htotal / 8);				/* HTCN */
-	lcdc_write(sdev, LDHCNR, value);
-
-	value = (((mode->hsync_end - mode->hsync_start) / 8) << 16) /* HSYNW */
-	      | (mode->hsync_start / 8);			/* HSYNP */
-	lcdc_write(sdev, LDHSYNR, value);
-
-	value = ((mode->hdisplay & 7) << 24) | ((mode->htotal & 7) << 16)
-	      | (((mode->hsync_end - mode->hsync_start) & 7) << 8)
-	      | (mode->hsync_start & 7);
-	lcdc_write(sdev, LDHAJR, value);
-
-	value = ((mode->vdisplay) << 16)			/* VDLN */
-	      | mode->vtotal;					/* VTLN */
-	lcdc_write(sdev, LDVLNR, value);
-
-	value = ((mode->vsync_end - mode->vsync_start) << 16)	/* VSYNW */
-	      | mode->vsync_start;				/* VSYNP */
-	lcdc_write(sdev, LDVSYNR, value);
-}
-
-static void shmob_drm_crtc_start_stop(struct shmob_drm_crtc *scrtc, bool start)
-{
-	struct shmob_drm_device *sdev = scrtc->crtc.dev->dev_private;
-	u32 value;
-
-	value = lcdc_read(sdev, LDCNT2R);
-	if (start)
-		lcdc_write(sdev, LDCNT2R, value | LDCNT2R_DO);
-	else
-		lcdc_write(sdev, LDCNT2R, value & ~LDCNT2R_DO);
-
-	/* Wait until power is applied/stopped. */
-	while (1) {
-		value = lcdc_read(sdev, LDPMR) & LDPMR_LPS;
-		if ((start && value) || (!start && !value))
-			break;
-
-		cpu_relax();
-	}
-
-	if (!start) {
-		/* Stop the dot clock. */
-		lcdc_write(sdev, LDDCKSTPR, LDDCKSTPR_DCKSTP);
-	}
-}
-
-/*
- * shmob_drm_crtc_start - Configure and start the LCDC
- * @scrtc: the SH Mobile CRTC
- *
- * Configure and start the LCDC device. External devices (clocks, MERAM, panels,
- * ...) are not touched by this function.
- */
-static void shmob_drm_crtc_start(struct shmob_drm_crtc *scrtc)
-{
-	struct drm_crtc *crtc = &scrtc->crtc;
-	struct shmob_drm_device *sdev = crtc->dev->dev_private;
-	const struct shmob_drm_interface_data *idata = &sdev->pdata->iface;
-	const struct shmob_drm_format_info *format;
-	struct drm_device *dev = sdev->ddev;
-	struct drm_plane *plane;
-	u32 value;
-	int ret;
-
-	if (scrtc->started)
-		return;
-
-	format = shmob_drm_format_info(crtc->primary->fb->format->format);
-	if (WARN_ON(format == NULL))
-		return;
-
-	/* Enable clocks before accessing the hardware. */
-	ret = shmob_drm_clk_on(sdev);
-	if (ret < 0)
-		return;
-
-	/* Reset and enable the LCDC. */
-	lcdc_write(sdev, LDCNT2R, lcdc_read(sdev, LDCNT2R) | LDCNT2R_BR);
-	lcdc_wait_bit(sdev, LDCNT2R, LDCNT2R_BR, 0);
-	lcdc_write(sdev, LDCNT2R, LDCNT2R_ME);
-
-	/* Stop the LCDC first and disable all interrupts. */
-	shmob_drm_crtc_start_stop(scrtc, false);
-	lcdc_write(sdev, LDINTR, 0);
-
-	/* Configure power supply, dot clocks and start them. */
-	lcdc_write(sdev, LDPMR, 0);
-
-	value = sdev->lddckr;
-	if (idata->clk_div) {
-		/* FIXME: sh7724 can only use 42, 48, 54 and 60 for the divider
-		 * denominator.
-		 */
-		lcdc_write(sdev, LDDCKPAT1R, 0);
-		lcdc_write(sdev, LDDCKPAT2R, (1 << (idata->clk_div / 2)) - 1);
-
-		if (idata->clk_div == 1)
-			value |= LDDCKR_MOSEL;
-		else
-			value |= idata->clk_div;
-	}
-
-	lcdc_write(sdev, LDDCKR, value);
-	lcdc_write(sdev, LDDCKSTPR, 0);
-	lcdc_wait_bit(sdev, LDDCKSTPR, ~0, 0);
-
-	/* TODO: Setup SYS panel */
-
-	/* Setup geometry, format, frame buffer memory and operation mode. */
-	shmob_drm_crtc_setup_geometry(scrtc);
-
-	/* TODO: Handle YUV colorspaces. Hardcode REC709 for now. */
-	lcdc_write(sdev, LDDFR, format->lddfr | LDDFR_CF1);
-	lcdc_write(sdev, LDMLSR, scrtc->line_size);
-	lcdc_write(sdev, LDSA1R, scrtc->dma[0]);
-	if (format->yuv)
-		lcdc_write(sdev, LDSA2R, scrtc->dma[1]);
-	lcdc_write(sdev, LDSM1R, 0);
-
-	/* Word and long word swap. */
-	switch (format->fourcc) {
-	case DRM_FORMAT_RGB565:
-	case DRM_FORMAT_NV21:
-	case DRM_FORMAT_NV61:
-	case DRM_FORMAT_NV42:
-		value = LDDDSR_LS | LDDDSR_WS;
-		break;
-	case DRM_FORMAT_RGB888:
-	case DRM_FORMAT_NV12:
-	case DRM_FORMAT_NV16:
-	case DRM_FORMAT_NV24:
-		value = LDDDSR_LS | LDDDSR_WS | LDDDSR_BS;
-		break;
-	case DRM_FORMAT_ARGB8888:
-	default:
-		value = LDDDSR_LS;
-		break;
-	}
-	lcdc_write(sdev, LDDDSR, value);
-
-	/* Setup planes. */
-	drm_for_each_legacy_plane(plane, dev) {
-		if (plane->crtc == crtc)
-			shmob_drm_plane_setup(plane);
-	}
-
-	/* Enable the display output. */
-	lcdc_write(sdev, LDCNT1R, LDCNT1R_DE);
-
-	shmob_drm_crtc_start_stop(scrtc, true);
-
-	scrtc->started = true;
-}
-
-static void shmob_drm_crtc_stop(struct shmob_drm_crtc *scrtc)
-{
-	struct drm_crtc *crtc = &scrtc->crtc;
-	struct shmob_drm_device *sdev = crtc->dev->dev_private;
-
-	if (!scrtc->started)
-		return;
-
-	/* Stop the LCDC. */
-	shmob_drm_crtc_start_stop(scrtc, false);
-
-	/* Disable the display output. */
-	lcdc_write(sdev, LDCNT1R, 0);
-
-	/* Stop clocks. */
-	shmob_drm_clk_off(sdev);
-
-	scrtc->started = false;
-}
-
-void shmob_drm_crtc_suspend(struct shmob_drm_crtc *scrtc)
-{
-	shmob_drm_crtc_stop(scrtc);
-}
-
-void shmob_drm_crtc_resume(struct shmob_drm_crtc *scrtc)
-{
-	if (scrtc->dpms != DRM_MODE_DPMS_ON)
-		return;
-
-	shmob_drm_crtc_start(scrtc);
-}
-
-static void shmob_drm_crtc_compute_base(struct shmob_drm_crtc *scrtc,
-					int x, int y)
-{
-	struct drm_crtc *crtc = &scrtc->crtc;
-	struct drm_framebuffer *fb = crtc->primary->fb;
-	struct drm_gem_dma_object *gem;
-	unsigned int bpp;
-
-	bpp = scrtc->format->yuv ? 8 : scrtc->format->bpp;
-	gem = drm_fb_dma_get_gem_obj(fb, 0);
-	scrtc->dma[0] = gem->dma_addr + fb->offsets[0]
-		      + y * fb->pitches[0] + x * bpp / 8;
-
-	if (scrtc->format->yuv) {
-		bpp = scrtc->format->bpp - 8;
-		gem = drm_fb_dma_get_gem_obj(fb, 1);
-		scrtc->dma[1] = gem->dma_addr + fb->offsets[1]
-			      + y / (bpp == 4 ? 2 : 1) * fb->pitches[1]
-			      + x * (bpp == 16 ? 2 : 1);
-	}
-}
-
-static void shmob_drm_crtc_update_base(struct shmob_drm_crtc *scrtc)
-{
-	struct drm_crtc *crtc = &scrtc->crtc;
-	struct shmob_drm_device *sdev = crtc->dev->dev_private;
-
-	shmob_drm_crtc_compute_base(scrtc, crtc->x, crtc->y);
-
-	lcdc_write_mirror(sdev, LDSA1R, scrtc->dma[0]);
-	if (scrtc->format->yuv)
-		lcdc_write_mirror(sdev, LDSA2R, scrtc->dma[1]);
-
-	lcdc_write(sdev, LDRCNTR, lcdc_read(sdev, LDRCNTR) ^ LDRCNTR_MRS);
-}
-
-#define to_shmob_crtc(c)	container_of(c, struct shmob_drm_crtc, crtc)
-
-static void shmob_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
-{
-	struct shmob_drm_crtc *scrtc = to_shmob_crtc(crtc);
-
-	if (scrtc->dpms == mode)
-		return;
-
-	if (mode == DRM_MODE_DPMS_ON)
-		shmob_drm_crtc_start(scrtc);
-	else
-		shmob_drm_crtc_stop(scrtc);
-
-	scrtc->dpms = mode;
-}
-
-static void shmob_drm_crtc_mode_prepare(struct drm_crtc *crtc)
-{
-	shmob_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
-}
-
-static int shmob_drm_crtc_mode_set(struct drm_crtc *crtc,
-				   struct drm_display_mode *mode,
-				   struct drm_display_mode *adjusted_mode,
-				   int x, int y,
-				   struct drm_framebuffer *old_fb)
-{
-	struct shmob_drm_crtc *scrtc = to_shmob_crtc(crtc);
-	struct shmob_drm_device *sdev = crtc->dev->dev_private;
-	const struct shmob_drm_format_info *format;
-
-	format = shmob_drm_format_info(crtc->primary->fb->format->format);
-	if (format == NULL) {
-		dev_dbg(sdev->dev, "mode_set: unsupported format %08x\n",
-			crtc->primary->fb->format->format);
-		return -EINVAL;
-	}
-
-	scrtc->format = format;
-	scrtc->line_size = crtc->primary->fb->pitches[0];
-
-	shmob_drm_crtc_compute_base(scrtc, x, y);
-
-	return 0;
-}
-
-static void shmob_drm_crtc_mode_commit(struct drm_crtc *crtc)
-{
-	shmob_drm_crtc_dpms(crtc, DRM_MODE_DPMS_ON);
-}
-
-static int shmob_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
-					struct drm_framebuffer *old_fb)
-{
-	shmob_drm_crtc_update_base(to_shmob_crtc(crtc));
-
-	return 0;
-}
-
-static const struct drm_crtc_helper_funcs crtc_helper_funcs = {
-	.dpms = shmob_drm_crtc_dpms,
-	.prepare = shmob_drm_crtc_mode_prepare,
-	.commit = shmob_drm_crtc_mode_commit,
-	.mode_set = shmob_drm_crtc_mode_set,
-	.mode_set_base = shmob_drm_crtc_mode_set_base,
-};
-
-void shmob_drm_crtc_finish_page_flip(struct shmob_drm_crtc *scrtc)
-{
-	struct drm_pending_vblank_event *event;
-	struct drm_device *dev = scrtc->crtc.dev;
-	unsigned long flags;
-
-	spin_lock_irqsave(&dev->event_lock, flags);
-	event = scrtc->event;
-	scrtc->event = NULL;
-	if (event) {
-		drm_crtc_send_vblank_event(&scrtc->crtc, event);
-		drm_crtc_vblank_put(&scrtc->crtc);
-	}
-	spin_unlock_irqrestore(&dev->event_lock, flags);
-}
-
-static int shmob_drm_crtc_page_flip(struct drm_crtc *crtc,
-				    struct drm_framebuffer *fb,
-				    struct drm_pending_vblank_event *event,
-				    uint32_t page_flip_flags,
-				    struct drm_modeset_acquire_ctx *ctx)
-{
-	struct shmob_drm_crtc *scrtc = to_shmob_crtc(crtc);
-	struct drm_device *dev = scrtc->crtc.dev;
-	unsigned long flags;
-
-	spin_lock_irqsave(&dev->event_lock, flags);
-	if (scrtc->event != NULL) {
-		spin_unlock_irqrestore(&dev->event_lock, flags);
-		return -EBUSY;
-	}
-	spin_unlock_irqrestore(&dev->event_lock, flags);
-
-	crtc->primary->fb = fb;
-	shmob_drm_crtc_update_base(scrtc);
-
-	if (event) {
-		event->pipe = 0;
-		drm_crtc_vblank_get(&scrtc->crtc);
-		spin_lock_irqsave(&dev->event_lock, flags);
-		scrtc->event = event;
-		spin_unlock_irqrestore(&dev->event_lock, flags);
-	}
-
-	return 0;
-}
-
-static void shmob_drm_crtc_enable_vblank(struct shmob_drm_device *sdev,
-					 bool enable)
-{
-	unsigned long flags;
-	u32 ldintr;
-
-	/* Be careful not to acknowledge any pending interrupt. */
-	spin_lock_irqsave(&sdev->irq_lock, flags);
-	ldintr = lcdc_read(sdev, LDINTR) | LDINTR_STATUS_MASK;
-	if (enable)
-		ldintr |= LDINTR_VEE;
-	else
-		ldintr &= ~LDINTR_VEE;
-	lcdc_write(sdev, LDINTR, ldintr);
-	spin_unlock_irqrestore(&sdev->irq_lock, flags);
-}
-
-static int shmob_drm_enable_vblank(struct drm_crtc *crtc)
-{
-	struct shmob_drm_device *sdev = crtc->dev->dev_private;
-
-	shmob_drm_crtc_enable_vblank(sdev, true);
-
-	return 0;
-}
-
-static void shmob_drm_disable_vblank(struct drm_crtc *crtc)
-{
-	struct shmob_drm_device *sdev = crtc->dev->dev_private;
-
-	shmob_drm_crtc_enable_vblank(sdev, false);
-}
-
-static const struct drm_crtc_funcs crtc_funcs = {
-	.destroy = drm_crtc_cleanup,
-	.set_config = drm_crtc_helper_set_config,
-	.page_flip = shmob_drm_crtc_page_flip,
-	.enable_vblank = shmob_drm_enable_vblank,
-	.disable_vblank = shmob_drm_disable_vblank,
-};
-
-int shmob_drm_crtc_create(struct shmob_drm_device *sdev)
-{
-	struct drm_crtc *crtc = &sdev->crtc.crtc;
-	int ret;
-
-	sdev->crtc.dpms = DRM_MODE_DPMS_OFF;
-
-	ret = drm_crtc_init(sdev->ddev, crtc, &crtc_funcs);
-	if (ret < 0)
-		return ret;
-
-	drm_crtc_helper_add(crtc, &crtc_helper_funcs);
-
-	return 0;
-}
-
-/* -----------------------------------------------------------------------------
- * Encoder
- */
-
-#define to_shmob_encoder(e) \
-	container_of(e, struct shmob_drm_encoder, encoder)
-
-static void shmob_drm_encoder_dpms(struct drm_encoder *encoder, int mode)
-{
-	struct shmob_drm_encoder *senc = to_shmob_encoder(encoder);
-	struct shmob_drm_device *sdev = encoder->dev->dev_private;
-	struct shmob_drm_connector *scon = &sdev->connector;
-
-	if (senc->dpms == mode)
-		return;
-
-	shmob_drm_backlight_dpms(scon, mode);
-
-	senc->dpms = mode;
-}
-
-static bool shmob_drm_encoder_mode_fixup(struct drm_encoder *encoder,
-					 const struct drm_display_mode *mode,
-					 struct drm_display_mode *adjusted_mode)
-{
-	struct drm_device *dev = encoder->dev;
-	struct shmob_drm_device *sdev = dev->dev_private;
-	struct drm_connector *connector = &sdev->connector.connector;
-	const struct drm_display_mode *panel_mode;
-
-	if (list_empty(&connector->modes)) {
-		dev_dbg(dev->dev, "mode_fixup: empty modes list\n");
-		return false;
-	}
-
-	/* The flat panel mode is fixed, just copy it to the adjusted mode. */
-	panel_mode = list_first_entry(&connector->modes,
-				      struct drm_display_mode, head);
-	drm_mode_copy(adjusted_mode, panel_mode);
-
-	return true;
-}
-
-static void shmob_drm_encoder_mode_prepare(struct drm_encoder *encoder)
-{
-	/* No-op, everything is handled in the CRTC code. */
-}
-
-static void shmob_drm_encoder_mode_set(struct drm_encoder *encoder,
-				       struct drm_display_mode *mode,
-				       struct drm_display_mode *adjusted_mode)
-{
-	/* No-op, everything is handled in the CRTC code. */
-}
-
-static void shmob_drm_encoder_mode_commit(struct drm_encoder *encoder)
-{
-	/* No-op, everything is handled in the CRTC code. */
-}
-
-static const struct drm_encoder_helper_funcs encoder_helper_funcs = {
-	.dpms = shmob_drm_encoder_dpms,
-	.mode_fixup = shmob_drm_encoder_mode_fixup,
-	.prepare = shmob_drm_encoder_mode_prepare,
-	.commit = shmob_drm_encoder_mode_commit,
-	.mode_set = shmob_drm_encoder_mode_set,
-};
-
-int shmob_drm_encoder_create(struct shmob_drm_device *sdev)
-{
-	struct drm_encoder *encoder = &sdev->encoder.encoder;
-	int ret;
-
-	sdev->encoder.dpms = DRM_MODE_DPMS_OFF;
-
-	encoder->possible_crtcs = 1;
-
-	ret = drm_simple_encoder_init(sdev->ddev, encoder,
-				      DRM_MODE_ENCODER_LVDS);
-	if (ret < 0)
-		return ret;
-
-	drm_encoder_helper_add(encoder, &encoder_helper_funcs);
-
-	return 0;
-}
-
-/* -----------------------------------------------------------------------------
- * Connector
- */
-
-#define to_shmob_connector(c) \
-	container_of(c, struct shmob_drm_connector, connector)
-
-static int shmob_drm_connector_get_modes(struct drm_connector *connector)
-{
-	struct shmob_drm_device *sdev = connector->dev->dev_private;
-	struct drm_display_mode *mode;
-
-	mode = drm_mode_create(connector->dev);
-	if (mode == NULL)
-		return 0;
-
-	mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER;
-	mode->clock = sdev->pdata->panel.mode.clock;
-	mode->hdisplay = sdev->pdata->panel.mode.hdisplay;
-	mode->hsync_start = sdev->pdata->panel.mode.hsync_start;
-	mode->hsync_end = sdev->pdata->panel.mode.hsync_end;
-	mode->htotal = sdev->pdata->panel.mode.htotal;
-	mode->vdisplay = sdev->pdata->panel.mode.vdisplay;
-	mode->vsync_start = sdev->pdata->panel.mode.vsync_start;
-	mode->vsync_end = sdev->pdata->panel.mode.vsync_end;
-	mode->vtotal = sdev->pdata->panel.mode.vtotal;
-	mode->flags = sdev->pdata->panel.mode.flags;
-
-	drm_mode_set_name(mode);
-	drm_mode_probed_add(connector, mode);
-
-	connector->display_info.width_mm = sdev->pdata->panel.width_mm;
-	connector->display_info.height_mm = sdev->pdata->panel.height_mm;
-
-	return 1;
-}
-
-static struct drm_encoder *
-shmob_drm_connector_best_encoder(struct drm_connector *connector)
-{
-	struct shmob_drm_connector *scon = to_shmob_connector(connector);
-
-	return scon->encoder;
-}
-
-static const struct drm_connector_helper_funcs connector_helper_funcs = {
-	.get_modes = shmob_drm_connector_get_modes,
-	.best_encoder = shmob_drm_connector_best_encoder,
-};
-
-static void shmob_drm_connector_destroy(struct drm_connector *connector)
-{
-	struct shmob_drm_connector *scon = to_shmob_connector(connector);
-
-	shmob_drm_backlight_exit(scon);
-	drm_connector_unregister(connector);
-	drm_connector_cleanup(connector);
-}
-
-static const struct drm_connector_funcs connector_funcs = {
-	.dpms = drm_helper_connector_dpms,
-	.fill_modes = drm_helper_probe_single_connector_modes,
-	.destroy = shmob_drm_connector_destroy,
-};
-
-int shmob_drm_connector_create(struct shmob_drm_device *sdev,
-			       struct drm_encoder *encoder)
-{
-	struct drm_connector *connector = &sdev->connector.connector;
-	int ret;
-
-	sdev->connector.encoder = encoder;
-
-	connector->display_info.width_mm = sdev->pdata->panel.width_mm;
-	connector->display_info.height_mm = sdev->pdata->panel.height_mm;
-
-	ret = drm_connector_init(sdev->ddev, connector, &connector_funcs,
-				 DRM_MODE_CONNECTOR_LVDS);
-	if (ret < 0)
-		return ret;
-
-	drm_connector_helper_add(connector, &connector_helper_funcs);
-
-	ret = shmob_drm_backlight_init(&sdev->connector);
-	if (ret < 0)
-		goto err_cleanup;
-
-	ret = drm_connector_attach_encoder(connector, encoder);
-	if (ret < 0)
-		goto err_backlight;
-
-	drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
-	drm_object_property_set_value(&connector->base,
-		sdev->ddev->mode_config.dpms_property, DRM_MODE_DPMS_OFF);
-
-	return 0;
-
-err_backlight:
-	shmob_drm_backlight_exit(&sdev->connector);
-err_cleanup:
-	drm_connector_cleanup(connector);
-	return ret;
-}
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.h b/drivers/gpu/drm/shmobile/shmob_drm_crtc.h
deleted file mode 100644
index 21718843f46d3d..00000000000000
--- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * shmob_drm_crtc.h  --  SH Mobile DRM CRTCs
- *
- * Copyright (C) 2012 Renesas Electronics Corporation
- *
- * Laurent Pinchart (laurent.pinchart@ideasonboard.com)
- */
-
-#ifndef __SHMOB_DRM_CRTC_H__
-#define __SHMOB_DRM_CRTC_H__
-
-#include <drm/drm_crtc.h>
-#include <drm/drm_connector.h>
-#include <drm/drm_encoder.h>
-
-struct backlight_device;
-struct drm_pending_vblank_event;
-struct shmob_drm_device;
-struct shmob_drm_format_info;
-
-struct shmob_drm_crtc {
-	struct drm_crtc crtc;
-
-	struct drm_pending_vblank_event *event;
-	int dpms;
-
-	const struct shmob_drm_format_info *format;
-	unsigned long dma[2];
-	unsigned int line_size;
-	bool started;
-};
-
-struct shmob_drm_encoder {
-	struct drm_encoder encoder;
-	int dpms;
-};
-
-struct shmob_drm_connector {
-	struct drm_connector connector;
-	struct drm_encoder *encoder;
-
-	struct backlight_device *backlight;
-};
-
-int shmob_drm_crtc_create(struct shmob_drm_device *sdev);
-void shmob_drm_crtc_finish_page_flip(struct shmob_drm_crtc *scrtc);
-void shmob_drm_crtc_suspend(struct shmob_drm_crtc *scrtc);
-void shmob_drm_crtc_resume(struct shmob_drm_crtc *scrtc);
-
-int shmob_drm_encoder_create(struct shmob_drm_device *sdev);
-int shmob_drm_connector_create(struct shmob_drm_device *sdev,
-			       struct drm_encoder *encoder);
-
-#endif /* __SHMOB_DRM_CRTC_H__ */
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
deleted file mode 100644
index 3d511fa3891364..00000000000000
--- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
+++ /dev/null
@@ -1,303 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * shmob_drm_drv.c  --  SH Mobile DRM driver
- *
- * Copyright (C) 2012 Renesas Electronics Corporation
- *
- * Laurent Pinchart (laurent.pinchart@ideasonboard.com)
- */
-
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/pm.h>
-#include <linux/slab.h>
-
-#include <drm/drm_crtc_helper.h>
-#include <drm/drm_drv.h>
-#include <drm/drm_gem_dma_helper.h>
-#include <drm/drm_module.h>
-#include <drm/drm_probe_helper.h>
-#include <drm/drm_vblank.h>
-
-#include "shmob_drm_drv.h"
-#include "shmob_drm_kms.h"
-#include "shmob_drm_plane.h"
-#include "shmob_drm_regs.h"
-
-/* -----------------------------------------------------------------------------
- * Hardware initialization
- */
-
-static int shmob_drm_init_interface(struct shmob_drm_device *sdev)
-{
-	static const u32 ldmt1r[] = {
-		[SHMOB_DRM_IFACE_RGB8] = LDMT1R_MIFTYP_RGB8,
-		[SHMOB_DRM_IFACE_RGB9] = LDMT1R_MIFTYP_RGB9,
-		[SHMOB_DRM_IFACE_RGB12A] = LDMT1R_MIFTYP_RGB12A,
-		[SHMOB_DRM_IFACE_RGB12B] = LDMT1R_MIFTYP_RGB12B,
-		[SHMOB_DRM_IFACE_RGB16] = LDMT1R_MIFTYP_RGB16,
-		[SHMOB_DRM_IFACE_RGB18] = LDMT1R_MIFTYP_RGB18,
-		[SHMOB_DRM_IFACE_RGB24] = LDMT1R_MIFTYP_RGB24,
-		[SHMOB_DRM_IFACE_YUV422] = LDMT1R_MIFTYP_YCBCR,
-		[SHMOB_DRM_IFACE_SYS8A] = LDMT1R_IFM | LDMT1R_MIFTYP_SYS8A,
-		[SHMOB_DRM_IFACE_SYS8B] = LDMT1R_IFM | LDMT1R_MIFTYP_SYS8B,
-		[SHMOB_DRM_IFACE_SYS8C] = LDMT1R_IFM | LDMT1R_MIFTYP_SYS8C,
-		[SHMOB_DRM_IFACE_SYS8D] = LDMT1R_IFM | LDMT1R_MIFTYP_SYS8D,
-		[SHMOB_DRM_IFACE_SYS9] = LDMT1R_IFM | LDMT1R_MIFTYP_SYS9,
-		[SHMOB_DRM_IFACE_SYS12] = LDMT1R_IFM | LDMT1R_MIFTYP_SYS12,
-		[SHMOB_DRM_IFACE_SYS16A] = LDMT1R_IFM | LDMT1R_MIFTYP_SYS16A,
-		[SHMOB_DRM_IFACE_SYS16B] = LDMT1R_IFM | LDMT1R_MIFTYP_SYS16B,
-		[SHMOB_DRM_IFACE_SYS16C] = LDMT1R_IFM | LDMT1R_MIFTYP_SYS16C,
-		[SHMOB_DRM_IFACE_SYS18] = LDMT1R_IFM | LDMT1R_MIFTYP_SYS18,
-		[SHMOB_DRM_IFACE_SYS24] = LDMT1R_IFM | LDMT1R_MIFTYP_SYS24,
-	};
-
-	if (sdev->pdata->iface.interface >= ARRAY_SIZE(ldmt1r)) {
-		dev_err(sdev->dev, "invalid interface type %u\n",
-			sdev->pdata->iface.interface);
-		return -EINVAL;
-	}
-
-	sdev->ldmt1r = ldmt1r[sdev->pdata->iface.interface];
-	return 0;
-}
-
-static int shmob_drm_setup_clocks(struct shmob_drm_device *sdev,
-					    enum shmob_drm_clk_source clksrc)
-{
-	struct clk *clk;
-	char *clkname;
-
-	switch (clksrc) {
-	case SHMOB_DRM_CLK_BUS:
-		clkname = "bus_clk";
-		sdev->lddckr = LDDCKR_ICKSEL_BUS;
-		break;
-	case SHMOB_DRM_CLK_PERIPHERAL:
-		clkname = "peripheral_clk";
-		sdev->lddckr = LDDCKR_ICKSEL_MIPI;
-		break;
-	case SHMOB_DRM_CLK_EXTERNAL:
-		clkname = NULL;
-		sdev->lddckr = LDDCKR_ICKSEL_HDMI;
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	clk = devm_clk_get(sdev->dev, clkname);
-	if (IS_ERR(clk)) {
-		dev_err(sdev->dev, "cannot get dot clock %s\n", clkname);
-		return PTR_ERR(clk);
-	}
-
-	sdev->clock = clk;
-	return 0;
-}
-
-/* -----------------------------------------------------------------------------
- * DRM operations
- */
-
-static irqreturn_t shmob_drm_irq(int irq, void *arg)
-{
-	struct drm_device *dev = arg;
-	struct shmob_drm_device *sdev = dev->dev_private;
-	unsigned long flags;
-	u32 status;
-
-	/* Acknowledge interrupts. Putting interrupt enable and interrupt flag
-	 * bits in the same register is really brain-dead design and requires
-	 * taking a spinlock.
-	 */
-	spin_lock_irqsave(&sdev->irq_lock, flags);
-	status = lcdc_read(sdev, LDINTR);
-	lcdc_write(sdev, LDINTR, status ^ LDINTR_STATUS_MASK);
-	spin_unlock_irqrestore(&sdev->irq_lock, flags);
-
-	if (status & LDINTR_VES) {
-		drm_handle_vblank(dev, 0);
-		shmob_drm_crtc_finish_page_flip(&sdev->crtc);
-	}
-
-	return IRQ_HANDLED;
-}
-
-DEFINE_DRM_GEM_DMA_FOPS(shmob_drm_fops);
-
-static const struct drm_driver shmob_drm_driver = {
-	.driver_features	= DRIVER_GEM | DRIVER_MODESET,
-	DRM_GEM_DMA_DRIVER_OPS,
-	.fops			= &shmob_drm_fops,
-	.name			= "shmob-drm",
-	.desc			= "Renesas SH Mobile DRM",
-	.date			= "20120424",
-	.major			= 1,
-	.minor			= 0,
-};
-
-/* -----------------------------------------------------------------------------
- * Power management
- */
-
-#ifdef CONFIG_PM_SLEEP
-static int shmob_drm_pm_suspend(struct device *dev)
-{
-	struct shmob_drm_device *sdev = dev_get_drvdata(dev);
-
-	drm_kms_helper_poll_disable(sdev->ddev);
-	shmob_drm_crtc_suspend(&sdev->crtc);
-
-	return 0;
-}
-
-static int shmob_drm_pm_resume(struct device *dev)
-{
-	struct shmob_drm_device *sdev = dev_get_drvdata(dev);
-
-	drm_modeset_lock_all(sdev->ddev);
-	shmob_drm_crtc_resume(&sdev->crtc);
-	drm_modeset_unlock_all(sdev->ddev);
-
-	drm_kms_helper_poll_enable(sdev->ddev);
-	return 0;
-}
-#endif
-
-static const struct dev_pm_ops shmob_drm_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(shmob_drm_pm_suspend, shmob_drm_pm_resume)
-};
-
-/* -----------------------------------------------------------------------------
- * Platform driver
- */
-
-static int shmob_drm_remove(struct platform_device *pdev)
-{
-	struct shmob_drm_device *sdev = platform_get_drvdata(pdev);
-	struct drm_device *ddev = sdev->ddev;
-
-	drm_dev_unregister(ddev);
-	drm_kms_helper_poll_fini(ddev);
-	free_irq(sdev->irq, ddev);
-	drm_dev_put(ddev);
-
-	return 0;
-}
-
-static int shmob_drm_probe(struct platform_device *pdev)
-{
-	struct shmob_drm_platform_data *pdata = pdev->dev.platform_data;
-	struct shmob_drm_device *sdev;
-	struct drm_device *ddev;
-	unsigned int i;
-	int ret;
-
-	if (pdata == NULL) {
-		dev_err(&pdev->dev, "no platform data\n");
-		return -EINVAL;
-	}
-
-	/*
-	 * Allocate and initialize the driver private data, I/O resources and
-	 * clocks.
-	 */
-	sdev = devm_kzalloc(&pdev->dev, sizeof(*sdev), GFP_KERNEL);
-	if (sdev == NULL)
-		return -ENOMEM;
-
-	sdev->dev = &pdev->dev;
-	sdev->pdata = pdata;
-	spin_lock_init(&sdev->irq_lock);
-
-	platform_set_drvdata(pdev, sdev);
-
-	sdev->mmio = devm_platform_ioremap_resource(pdev, 0);
-	if (IS_ERR(sdev->mmio))
-		return PTR_ERR(sdev->mmio);
-
-	ret = shmob_drm_setup_clocks(sdev, pdata->clk_source);
-	if (ret < 0)
-		return ret;
-
-	ret = shmob_drm_init_interface(sdev);
-	if (ret < 0)
-		return ret;
-
-	/* Allocate and initialize the DRM device. */
-	ddev = drm_dev_alloc(&shmob_drm_driver, &pdev->dev);
-	if (IS_ERR(ddev))
-		return PTR_ERR(ddev);
-
-	sdev->ddev = ddev;
-	ddev->dev_private = sdev;
-
-	ret = shmob_drm_modeset_init(sdev);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "failed to initialize mode setting\n");
-		goto err_free_drm_dev;
-	}
-
-	for (i = 0; i < 4; ++i) {
-		ret = shmob_drm_plane_create(sdev, i);
-		if (ret < 0) {
-			dev_err(&pdev->dev, "failed to create plane %u\n", i);
-			goto err_modeset_cleanup;
-		}
-	}
-
-	ret = drm_vblank_init(ddev, 1);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "failed to initialize vblank\n");
-		goto err_modeset_cleanup;
-	}
-
-	ret = platform_get_irq(pdev, 0);
-	if (ret < 0)
-		goto err_modeset_cleanup;
-	sdev->irq = ret;
-
-	ret = request_irq(sdev->irq, shmob_drm_irq, 0, ddev->driver->name,
-			  ddev);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "failed to install IRQ handler\n");
-		goto err_modeset_cleanup;
-	}
-
-	/*
-	 * Register the DRM device with the core and the connectors with
-	 * sysfs.
-	 */
-	ret = drm_dev_register(ddev, 0);
-	if (ret < 0)
-		goto err_irq_uninstall;
-
-	return 0;
-
-err_irq_uninstall:
-	free_irq(sdev->irq, ddev);
-err_modeset_cleanup:
-	drm_kms_helper_poll_fini(ddev);
-err_free_drm_dev:
-	drm_dev_put(ddev);
-
-	return ret;
-}
-
-static struct platform_driver shmob_drm_platform_driver = {
-	.probe		= shmob_drm_probe,
-	.remove		= shmob_drm_remove,
-	.driver		= {
-		.name	= "shmob-drm",
-		.pm	= &shmob_drm_pm_ops,
-	},
-};
-
-drm_module_platform_driver(shmob_drm_platform_driver);
-
-MODULE_AUTHOR("Laurent Pinchart <laurent.pinchart@ideasonboard.com>");
-MODULE_DESCRIPTION("Renesas SH Mobile DRM Driver");
-MODULE_LICENSE("GPL");
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.h b/drivers/gpu/drm/shmobile/shmob_drm_drv.h
deleted file mode 100644
index 4964ddd5ab7472..00000000000000
--- a/drivers/gpu/drm/shmobile/shmob_drm_drv.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * shmob_drm.h  --  SH Mobile DRM driver
- *
- * Copyright (C) 2012 Renesas Electronics Corporation
- *
- * Laurent Pinchart (laurent.pinchart@ideasonboard.com)
- */
-
-#ifndef __SHMOB_DRM_DRV_H__
-#define __SHMOB_DRM_DRV_H__
-
-#include <linux/kernel.h>
-#include <linux/platform_data/shmob_drm.h>
-#include <linux/spinlock.h>
-
-#include "shmob_drm_crtc.h"
-
-struct clk;
-struct device;
-struct drm_device;
-
-struct shmob_drm_device {
-	struct device *dev;
-	const struct shmob_drm_platform_data *pdata;
-
-	void __iomem *mmio;
-	struct clk *clock;
-	u32 lddckr;
-	u32 ldmt1r;
-
-	unsigned int irq;
-	spinlock_t irq_lock;		/* Protects hardware LDINTR register */
-
-	struct drm_device *ddev;
-
-	struct shmob_drm_crtc crtc;
-	struct shmob_drm_encoder encoder;
-	struct shmob_drm_connector connector;
-};
-
-#endif /* __SHMOB_DRM_DRV_H__ */
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_kms.c b/drivers/gpu/drm/shmobile/shmob_drm_kms.c
deleted file mode 100644
index 60a2c8d8a0d947..00000000000000
--- a/drivers/gpu/drm/shmobile/shmob_drm_kms.c
+++ /dev/null
@@ -1,150 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * shmob_drm_kms.c  --  SH Mobile DRM Mode Setting
- *
- * Copyright (C) 2012 Renesas Electronics Corporation
- *
- * Laurent Pinchart (laurent.pinchart@ideasonboard.com)
- */
-
-#include <drm/drm_crtc.h>
-#include <drm/drm_crtc_helper.h>
-#include <drm/drm_fourcc.h>
-#include <drm/drm_gem_dma_helper.h>
-#include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_probe_helper.h>
-
-#include "shmob_drm_crtc.h"
-#include "shmob_drm_drv.h"
-#include "shmob_drm_kms.h"
-#include "shmob_drm_regs.h"
-
-/* -----------------------------------------------------------------------------
- * Format helpers
- */
-
-static const struct shmob_drm_format_info shmob_drm_format_infos[] = {
-	{
-		.fourcc = DRM_FORMAT_RGB565,
-		.bpp = 16,
-		.yuv = false,
-		.lddfr = LDDFR_PKF_RGB16,
-	}, {
-		.fourcc = DRM_FORMAT_RGB888,
-		.bpp = 24,
-		.yuv = false,
-		.lddfr = LDDFR_PKF_RGB24,
-	}, {
-		.fourcc = DRM_FORMAT_ARGB8888,
-		.bpp = 32,
-		.yuv = false,
-		.lddfr = LDDFR_PKF_ARGB32,
-	}, {
-		.fourcc = DRM_FORMAT_NV12,
-		.bpp = 12,
-		.yuv = true,
-		.lddfr = LDDFR_CC | LDDFR_YF_420,
-	}, {
-		.fourcc = DRM_FORMAT_NV21,
-		.bpp = 12,
-		.yuv = true,
-		.lddfr = LDDFR_CC | LDDFR_YF_420,
-	}, {
-		.fourcc = DRM_FORMAT_NV16,
-		.bpp = 16,
-		.yuv = true,
-		.lddfr = LDDFR_CC | LDDFR_YF_422,
-	}, {
-		.fourcc = DRM_FORMAT_NV61,
-		.bpp = 16,
-		.yuv = true,
-		.lddfr = LDDFR_CC | LDDFR_YF_422,
-	}, {
-		.fourcc = DRM_FORMAT_NV24,
-		.bpp = 24,
-		.yuv = true,
-		.lddfr = LDDFR_CC | LDDFR_YF_444,
-	}, {
-		.fourcc = DRM_FORMAT_NV42,
-		.bpp = 24,
-		.yuv = true,
-		.lddfr = LDDFR_CC | LDDFR_YF_444,
-	},
-};
-
-const struct shmob_drm_format_info *shmob_drm_format_info(u32 fourcc)
-{
-	unsigned int i;
-
-	for (i = 0; i < ARRAY_SIZE(shmob_drm_format_infos); ++i) {
-		if (shmob_drm_format_infos[i].fourcc == fourcc)
-			return &shmob_drm_format_infos[i];
-	}
-
-	return NULL;
-}
-
-/* -----------------------------------------------------------------------------
- * Frame buffer
- */
-
-static struct drm_framebuffer *
-shmob_drm_fb_create(struct drm_device *dev, struct drm_file *file_priv,
-		    const struct drm_mode_fb_cmd2 *mode_cmd)
-{
-	const struct shmob_drm_format_info *format;
-
-	format = shmob_drm_format_info(mode_cmd->pixel_format);
-	if (format == NULL) {
-		dev_dbg(dev->dev, "unsupported pixel format %08x\n",
-			mode_cmd->pixel_format);
-		return ERR_PTR(-EINVAL);
-	}
-
-	if (mode_cmd->pitches[0] & 7 || mode_cmd->pitches[0] >= 65536) {
-		dev_dbg(dev->dev, "invalid pitch value %u\n",
-			mode_cmd->pitches[0]);
-		return ERR_PTR(-EINVAL);
-	}
-
-	if (format->yuv) {
-		unsigned int chroma_cpp = format->bpp == 24 ? 2 : 1;
-
-		if (mode_cmd->pitches[1] != mode_cmd->pitches[0] * chroma_cpp) {
-			dev_dbg(dev->dev,
-				"luma and chroma pitches do not match\n");
-			return ERR_PTR(-EINVAL);
-		}
-	}
-
-	return drm_gem_fb_create(dev, file_priv, mode_cmd);
-}
-
-static const struct drm_mode_config_funcs shmob_drm_mode_config_funcs = {
-	.fb_create = shmob_drm_fb_create,
-};
-
-int shmob_drm_modeset_init(struct shmob_drm_device *sdev)
-{
-	int ret;
-
-	ret = drmm_mode_config_init(sdev->ddev);
-	if (ret)
-		return ret;
-
-	shmob_drm_crtc_create(sdev);
-	shmob_drm_encoder_create(sdev);
-	shmob_drm_connector_create(sdev, &sdev->encoder.encoder);
-
-	drm_kms_helper_poll_init(sdev->ddev);
-
-	sdev->ddev->mode_config.min_width = 0;
-	sdev->ddev->mode_config.min_height = 0;
-	sdev->ddev->mode_config.max_width = 4095;
-	sdev->ddev->mode_config.max_height = 4095;
-	sdev->ddev->mode_config.funcs = &shmob_drm_mode_config_funcs;
-
-	drm_helper_disable_unused_functions(sdev->ddev);
-
-	return 0;
-}
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_kms.h b/drivers/gpu/drm/shmobile/shmob_drm_kms.h
deleted file mode 100644
index 0347b1fd2338a8..00000000000000
--- a/drivers/gpu/drm/shmobile/shmob_drm_kms.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * shmob_drm_kms.h  --  SH Mobile DRM Mode Setting
- *
- * Copyright (C) 2012 Renesas Electronics Corporation
- *
- * Laurent Pinchart (laurent.pinchart@ideasonboard.com)
- */
-
-#ifndef __SHMOB_DRM_KMS_H__
-#define __SHMOB_DRM_KMS_H__
-
-#include <linux/types.h>
-
-struct drm_gem_dma_object;
-struct shmob_drm_device;
-
-struct shmob_drm_format_info {
-	u32 fourcc;
-	unsigned int bpp;
-	bool yuv;
-	u32 lddfr;
-};
-
-const struct shmob_drm_format_info *shmob_drm_format_info(u32 fourcc);
-
-int shmob_drm_modeset_init(struct shmob_drm_device *sdev);
-
-#endif /* __SHMOB_DRM_KMS_H__ */
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_plane.c b/drivers/gpu/drm/shmobile/shmob_drm_plane.c
deleted file mode 100644
index 6c5f0cbe7d95b9..00000000000000
--- a/drivers/gpu/drm/shmobile/shmob_drm_plane.c
+++ /dev/null
@@ -1,261 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * shmob_drm_plane.c  --  SH Mobile DRM Planes
- *
- * Copyright (C) 2012 Renesas Electronics Corporation
- *
- * Laurent Pinchart (laurent.pinchart@ideasonboard.com)
- */
-
-#include <drm/drm_crtc.h>
-#include <drm/drm_crtc_helper.h>
-#include <drm/drm_fb_dma_helper.h>
-#include <drm/drm_fourcc.h>
-#include <drm/drm_framebuffer.h>
-#include <drm/drm_gem_dma_helper.h>
-
-#include "shmob_drm_drv.h"
-#include "shmob_drm_kms.h"
-#include "shmob_drm_plane.h"
-#include "shmob_drm_regs.h"
-
-struct shmob_drm_plane {
-	struct drm_plane plane;
-	unsigned int index;
-	unsigned int alpha;
-
-	const struct shmob_drm_format_info *format;
-	unsigned long dma[2];
-
-	unsigned int src_x;
-	unsigned int src_y;
-	unsigned int crtc_x;
-	unsigned int crtc_y;
-	unsigned int crtc_w;
-	unsigned int crtc_h;
-};
-
-#define to_shmob_plane(p)	container_of(p, struct shmob_drm_plane, plane)
-
-static void shmob_drm_plane_compute_base(struct shmob_drm_plane *splane,
-					 struct drm_framebuffer *fb,
-					 int x, int y)
-{
-	struct drm_gem_dma_object *gem;
-	unsigned int bpp;
-
-	bpp = splane->format->yuv ? 8 : splane->format->bpp;
-	gem = drm_fb_dma_get_gem_obj(fb, 0);
-	splane->dma[0] = gem->dma_addr + fb->offsets[0]
-		       + y * fb->pitches[0] + x * bpp / 8;
-
-	if (splane->format->yuv) {
-		bpp = splane->format->bpp - 8;
-		gem = drm_fb_dma_get_gem_obj(fb, 1);
-		splane->dma[1] = gem->dma_addr + fb->offsets[1]
-			       + y / (bpp == 4 ? 2 : 1) * fb->pitches[1]
-			       + x * (bpp == 16 ? 2 : 1);
-	}
-}
-
-static void __shmob_drm_plane_setup(struct shmob_drm_plane *splane,
-				    struct drm_framebuffer *fb)
-{
-	struct shmob_drm_device *sdev = splane->plane.dev->dev_private;
-	u32 format;
-
-	/* TODO: Support ROP3 mode */
-	format = LDBBSIFR_EN | (splane->alpha << LDBBSIFR_LAY_SHIFT);
-
-	switch (splane->format->fourcc) {
-	case DRM_FORMAT_RGB565:
-	case DRM_FORMAT_NV21:
-	case DRM_FORMAT_NV61:
-	case DRM_FORMAT_NV42:
-		format |= LDBBSIFR_SWPL | LDBBSIFR_SWPW;
-		break;
-	case DRM_FORMAT_RGB888:
-	case DRM_FORMAT_NV12:
-	case DRM_FORMAT_NV16:
-	case DRM_FORMAT_NV24:
-		format |= LDBBSIFR_SWPL | LDBBSIFR_SWPW | LDBBSIFR_SWPB;
-		break;
-	case DRM_FORMAT_ARGB8888:
-	default:
-		format |= LDBBSIFR_SWPL;
-		break;
-	}
-
-	switch (splane->format->fourcc) {
-	case DRM_FORMAT_RGB565:
-		format |= LDBBSIFR_AL_1 | LDBBSIFR_RY | LDBBSIFR_RPKF_RGB16;
-		break;
-	case DRM_FORMAT_RGB888:
-		format |= LDBBSIFR_AL_1 | LDBBSIFR_RY | LDBBSIFR_RPKF_RGB24;
-		break;
-	case DRM_FORMAT_ARGB8888:
-		format |= LDBBSIFR_AL_PK | LDBBSIFR_RY | LDDFR_PKF_ARGB32;
-		break;
-	case DRM_FORMAT_NV12:
-	case DRM_FORMAT_NV21:
-		format |= LDBBSIFR_AL_1 | LDBBSIFR_CHRR_420;
-		break;
-	case DRM_FORMAT_NV16:
-	case DRM_FORMAT_NV61:
-		format |= LDBBSIFR_AL_1 | LDBBSIFR_CHRR_422;
-		break;
-	case DRM_FORMAT_NV24:
-	case DRM_FORMAT_NV42:
-		format |= LDBBSIFR_AL_1 | LDBBSIFR_CHRR_444;
-		break;
-	}
-
-#define plane_reg_dump(sdev, splane, reg) \
-	dev_dbg(sdev->ddev->dev, "%s(%u): %s 0x%08x 0x%08x\n", __func__, \
-		splane->index, #reg, \
-		lcdc_read(sdev, reg(splane->index)), \
-		lcdc_read(sdev, reg(splane->index) + LCDC_SIDE_B_OFFSET))
-
-	plane_reg_dump(sdev, splane, LDBnBSIFR);
-	plane_reg_dump(sdev, splane, LDBnBSSZR);
-	plane_reg_dump(sdev, splane, LDBnBLOCR);
-	plane_reg_dump(sdev, splane, LDBnBSMWR);
-	plane_reg_dump(sdev, splane, LDBnBSAYR);
-	plane_reg_dump(sdev, splane, LDBnBSACR);
-
-	lcdc_write(sdev, LDBCR, LDBCR_UPC(splane->index));
-	dev_dbg(sdev->ddev->dev, "%s(%u): %s 0x%08x\n", __func__, splane->index,
-		"LDBCR", lcdc_read(sdev, LDBCR));
-
-	lcdc_write(sdev, LDBnBSIFR(splane->index), format);
-
-	lcdc_write(sdev, LDBnBSSZR(splane->index),
-		   (splane->crtc_h << LDBBSSZR_BVSS_SHIFT) |
-		   (splane->crtc_w << LDBBSSZR_BHSS_SHIFT));
-	lcdc_write(sdev, LDBnBLOCR(splane->index),
-		   (splane->crtc_y << LDBBLOCR_CVLC_SHIFT) |
-		   (splane->crtc_x << LDBBLOCR_CHLC_SHIFT));
-	lcdc_write(sdev, LDBnBSMWR(splane->index),
-		   fb->pitches[0] << LDBBSMWR_BSMW_SHIFT);
-
-	shmob_drm_plane_compute_base(splane, fb, splane->src_x, splane->src_y);
-
-	lcdc_write(sdev, LDBnBSAYR(splane->index), splane->dma[0]);
-	if (splane->format->yuv)
-		lcdc_write(sdev, LDBnBSACR(splane->index), splane->dma[1]);
-
-	lcdc_write(sdev, LDBCR,
-		   LDBCR_UPF(splane->index) | LDBCR_UPD(splane->index));
-	dev_dbg(sdev->ddev->dev, "%s(%u): %s 0x%08x\n", __func__, splane->index,
-		"LDBCR", lcdc_read(sdev, LDBCR));
-
-	plane_reg_dump(sdev, splane, LDBnBSIFR);
-	plane_reg_dump(sdev, splane, LDBnBSSZR);
-	plane_reg_dump(sdev, splane, LDBnBLOCR);
-	plane_reg_dump(sdev, splane, LDBnBSMWR);
-	plane_reg_dump(sdev, splane, LDBnBSAYR);
-	plane_reg_dump(sdev, splane, LDBnBSACR);
-}
-
-void shmob_drm_plane_setup(struct drm_plane *plane)
-{
-	struct shmob_drm_plane *splane = to_shmob_plane(plane);
-
-	if (plane->fb == NULL)
-		return;
-
-	__shmob_drm_plane_setup(splane, plane->fb);
-}
-
-static int
-shmob_drm_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
-		       struct drm_framebuffer *fb, int crtc_x, int crtc_y,
-		       unsigned int crtc_w, unsigned int crtc_h,
-		       uint32_t src_x, uint32_t src_y,
-		       uint32_t src_w, uint32_t src_h,
-		       struct drm_modeset_acquire_ctx *ctx)
-{
-	struct shmob_drm_plane *splane = to_shmob_plane(plane);
-	struct shmob_drm_device *sdev = plane->dev->dev_private;
-	const struct shmob_drm_format_info *format;
-
-	format = shmob_drm_format_info(fb->format->format);
-	if (format == NULL) {
-		dev_dbg(sdev->dev, "update_plane: unsupported format %08x\n",
-			fb->format->format);
-		return -EINVAL;
-	}
-
-	if (src_w >> 16 != crtc_w || src_h >> 16 != crtc_h) {
-		dev_dbg(sdev->dev, "%s: scaling not supported\n", __func__);
-		return -EINVAL;
-	}
-
-	splane->format = format;
-
-	splane->src_x = src_x >> 16;
-	splane->src_y = src_y >> 16;
-	splane->crtc_x = crtc_x;
-	splane->crtc_y = crtc_y;
-	splane->crtc_w = crtc_w;
-	splane->crtc_h = crtc_h;
-
-	__shmob_drm_plane_setup(splane, fb);
-	return 0;
-}
-
-static int shmob_drm_plane_disable(struct drm_plane *plane,
-				   struct drm_modeset_acquire_ctx *ctx)
-{
-	struct shmob_drm_plane *splane = to_shmob_plane(plane);
-	struct shmob_drm_device *sdev = plane->dev->dev_private;
-
-	splane->format = NULL;
-
-	lcdc_write(sdev, LDBnBSIFR(splane->index), 0);
-	return 0;
-}
-
-static void shmob_drm_plane_destroy(struct drm_plane *plane)
-{
-	drm_plane_force_disable(plane);
-	drm_plane_cleanup(plane);
-}
-
-static const struct drm_plane_funcs shmob_drm_plane_funcs = {
-	.update_plane = shmob_drm_plane_update,
-	.disable_plane = shmob_drm_plane_disable,
-	.destroy = shmob_drm_plane_destroy,
-};
-
-static const uint32_t formats[] = {
-	DRM_FORMAT_RGB565,
-	DRM_FORMAT_RGB888,
-	DRM_FORMAT_ARGB8888,
-	DRM_FORMAT_NV12,
-	DRM_FORMAT_NV21,
-	DRM_FORMAT_NV16,
-	DRM_FORMAT_NV61,
-	DRM_FORMAT_NV24,
-	DRM_FORMAT_NV42,
-};
-
-int shmob_drm_plane_create(struct shmob_drm_device *sdev, unsigned int index)
-{
-	struct shmob_drm_plane *splane;
-	int ret;
-
-	splane = devm_kzalloc(sdev->dev, sizeof(*splane), GFP_KERNEL);
-	if (splane == NULL)
-		return -ENOMEM;
-
-	splane->index = index;
-	splane->alpha = 255;
-
-	ret = drm_universal_plane_init(sdev->ddev, &splane->plane, 1,
-				       &shmob_drm_plane_funcs,
-				       formats, ARRAY_SIZE(formats), NULL,
-				       DRM_PLANE_TYPE_OVERLAY, NULL);
-
-	return ret;
-}
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_plane.h b/drivers/gpu/drm/shmobile/shmob_drm_plane.h
deleted file mode 100644
index e72b21a4288fc2..00000000000000
--- a/drivers/gpu/drm/shmobile/shmob_drm_plane.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * shmob_drm_plane.h  --  SH Mobile DRM Planes
- *
- * Copyright (C) 2012 Renesas Electronics Corporation
- *
- * Laurent Pinchart (laurent.pinchart@ideasonboard.com)
- */
-
-#ifndef __SHMOB_DRM_PLANE_H__
-#define __SHMOB_DRM_PLANE_H__
-
-struct drm_plane;
-struct shmob_drm_device;
-
-int shmob_drm_plane_create(struct shmob_drm_device *sdev, unsigned int index);
-void shmob_drm_plane_setup(struct drm_plane *plane);
-
-#endif /* __SHMOB_DRM_PLANE_H__ */
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_regs.h b/drivers/gpu/drm/shmobile/shmob_drm_regs.h
deleted file mode 100644
index 058533685c4cd0..00000000000000
--- a/drivers/gpu/drm/shmobile/shmob_drm_regs.h
+++ /dev/null
@@ -1,310 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * shmob_drm_regs.h  --  SH Mobile DRM registers
- *
- * Copyright (C) 2012 Renesas Electronics Corporation
- *
- * Laurent Pinchart (laurent.pinchart@ideasonboard.com)
- */
-
-#ifndef __SHMOB_DRM_REGS_H__
-#define __SHMOB_DRM_REGS_H__
-
-#include <linux/io.h>
-#include <linux/jiffies.h>
-
-#include "shmob_drm_drv.h"
-
-/* Register definitions */
-#define LDDCKPAT1R		0x400
-#define LDDCKPAT2R		0x404
-#define LDDCKR			0x410
-#define LDDCKR_ICKSEL_BUS	(0 << 16)
-#define LDDCKR_ICKSEL_MIPI	(1 << 16)
-#define LDDCKR_ICKSEL_HDMI	(2 << 16)
-#define LDDCKR_ICKSEL_EXT	(3 << 16)
-#define LDDCKR_ICKSEL_MASK	(7 << 16)
-#define LDDCKR_MOSEL		(1 << 6)
-#define LDDCKSTPR		0x414
-#define LDDCKSTPR_DCKSTS	(1 << 16)
-#define LDDCKSTPR_DCKSTP	(1 << 0)
-#define LDMT1R			0x418
-#define LDMT1R_VPOL		(1 << 28)
-#define LDMT1R_HPOL		(1 << 27)
-#define LDMT1R_DWPOL		(1 << 26)
-#define LDMT1R_DIPOL		(1 << 25)
-#define LDMT1R_DAPOL		(1 << 24)
-#define LDMT1R_HSCNT		(1 << 17)
-#define LDMT1R_DWCNT		(1 << 16)
-#define LDMT1R_IFM		(1 << 12)
-#define LDMT1R_MIFTYP_RGB8	(0x0 << 0)
-#define LDMT1R_MIFTYP_RGB9	(0x4 << 0)
-#define LDMT1R_MIFTYP_RGB12A	(0x5 << 0)
-#define LDMT1R_MIFTYP_RGB12B	(0x6 << 0)
-#define LDMT1R_MIFTYP_RGB16	(0x7 << 0)
-#define LDMT1R_MIFTYP_RGB18	(0xa << 0)
-#define LDMT1R_MIFTYP_RGB24	(0xb << 0)
-#define LDMT1R_MIFTYP_YCBCR	(0xf << 0)
-#define LDMT1R_MIFTYP_SYS8A	(0x0 << 0)
-#define LDMT1R_MIFTYP_SYS8B	(0x1 << 0)
-#define LDMT1R_MIFTYP_SYS8C	(0x2 << 0)
-#define LDMT1R_MIFTYP_SYS8D	(0x3 << 0)
-#define LDMT1R_MIFTYP_SYS9	(0x4 << 0)
-#define LDMT1R_MIFTYP_SYS12	(0x5 << 0)
-#define LDMT1R_MIFTYP_SYS16A	(0x7 << 0)
-#define LDMT1R_MIFTYP_SYS16B	(0x8 << 0)
-#define LDMT1R_MIFTYP_SYS16C	(0x9 << 0)
-#define LDMT1R_MIFTYP_SYS18	(0xa << 0)
-#define LDMT1R_MIFTYP_SYS24	(0xb << 0)
-#define LDMT1R_MIFTYP_MASK	(0xf << 0)
-#define LDMT2R			0x41c
-#define LDMT2R_CSUP_MASK	(7 << 26)
-#define LDMT2R_CSUP_SHIFT	26
-#define LDMT2R_RSV		(1 << 25)
-#define LDMT2R_VSEL		(1 << 24)
-#define LDMT2R_WCSC_MASK	(0xff << 16)
-#define LDMT2R_WCSC_SHIFT	16
-#define LDMT2R_WCEC_MASK	(0xff << 8)
-#define LDMT2R_WCEC_SHIFT	8
-#define LDMT2R_WCLW_MASK	(0xff << 0)
-#define LDMT2R_WCLW_SHIFT	0
-#define LDMT3R			0x420
-#define LDMT3R_RDLC_MASK	(0x3f << 24)
-#define LDMT3R_RDLC_SHIFT	24
-#define LDMT3R_RCSC_MASK	(0xff << 16)
-#define LDMT3R_RCSC_SHIFT	16
-#define LDMT3R_RCEC_MASK	(0xff << 8)
-#define LDMT3R_RCEC_SHIFT	8
-#define LDMT3R_RCLW_MASK	(0xff << 0)
-#define LDMT3R_RCLW_SHIFT	0
-#define LDDFR			0x424
-#define LDDFR_CF1		(1 << 18)
-#define LDDFR_CF0		(1 << 17)
-#define LDDFR_CC		(1 << 16)
-#define LDDFR_YF_420		(0 << 8)
-#define LDDFR_YF_422		(1 << 8)
-#define LDDFR_YF_444		(2 << 8)
-#define LDDFR_YF_MASK		(3 << 8)
-#define LDDFR_PKF_ARGB32	(0x00 << 0)
-#define LDDFR_PKF_RGB16		(0x03 << 0)
-#define LDDFR_PKF_RGB24		(0x0b << 0)
-#define LDDFR_PKF_MASK		(0x1f << 0)
-#define LDSM1R			0x428
-#define LDSM1R_OS		(1 << 0)
-#define LDSM2R			0x42c
-#define LDSM2R_OSTRG		(1 << 0)
-#define LDSA1R			0x430
-#define LDSA2R			0x434
-#define LDMLSR			0x438
-#define LDWBFR			0x43c
-#define LDWBCNTR		0x440
-#define LDWBAR			0x444
-#define LDHCNR			0x448
-#define LDHSYNR			0x44c
-#define LDVLNR			0x450
-#define LDVSYNR			0x454
-#define LDHPDR			0x458
-#define LDVPDR			0x45c
-#define LDPMR			0x460
-#define LDPMR_LPS		(3 << 0)
-#define LDINTR			0x468
-#define LDINTR_FE		(1 << 10)
-#define LDINTR_VSE		(1 << 9)
-#define LDINTR_VEE		(1 << 8)
-#define LDINTR_FS		(1 << 2)
-#define LDINTR_VSS		(1 << 1)
-#define LDINTR_VES		(1 << 0)
-#define LDINTR_STATUS_MASK	(0xff << 0)
-#define LDSR			0x46c
-#define LDSR_MSS		(1 << 10)
-#define LDSR_MRS		(1 << 8)
-#define LDSR_AS			(1 << 1)
-#define LDCNT1R			0x470
-#define LDCNT1R_DE		(1 << 0)
-#define LDCNT2R			0x474
-#define LDCNT2R_BR		(1 << 8)
-#define LDCNT2R_MD		(1 << 3)
-#define LDCNT2R_SE		(1 << 2)
-#define LDCNT2R_ME		(1 << 1)
-#define LDCNT2R_DO		(1 << 0)
-#define LDRCNTR			0x478
-#define LDRCNTR_SRS		(1 << 17)
-#define LDRCNTR_SRC		(1 << 16)
-#define LDRCNTR_MRS		(1 << 1)
-#define LDRCNTR_MRC		(1 << 0)
-#define LDDDSR			0x47c
-#define LDDDSR_LS		(1 << 2)
-#define LDDDSR_WS		(1 << 1)
-#define LDDDSR_BS		(1 << 0)
-#define LDHAJR			0x4a0
-
-#define LDDWD0R			0x800
-#define LDDWDxR_WDACT		(1 << 28)
-#define LDDWDxR_RSW		(1 << 24)
-#define LDDRDR			0x840
-#define LDDRDR_RSR		(1 << 24)
-#define LDDRDR_DRD_MASK		(0x3ffff << 0)
-#define LDDWAR			0x900
-#define LDDWAR_WA		(1 << 0)
-#define LDDRAR			0x904
-#define LDDRAR_RA		(1 << 0)
-
-#define LDBCR			0xb00
-#define LDBCR_UPC(n)		(1 << ((n) + 16))
-#define LDBCR_UPF(n)		(1 << ((n) + 8))
-#define LDBCR_UPD(n)		(1 << ((n) + 0))
-#define LDBnBSIFR(n)		(0xb20 + (n) * 0x20 + 0x00)
-#define LDBBSIFR_EN		(1 << 31)
-#define LDBBSIFR_VS		(1 << 29)
-#define LDBBSIFR_BRSEL		(1 << 28)
-#define LDBBSIFR_MX		(1 << 27)
-#define LDBBSIFR_MY		(1 << 26)
-#define LDBBSIFR_CV3		(3 << 24)
-#define LDBBSIFR_CV2		(2 << 24)
-#define LDBBSIFR_CV1		(1 << 24)
-#define LDBBSIFR_CV0		(0 << 24)
-#define LDBBSIFR_CV_MASK	(3 << 24)
-#define LDBBSIFR_LAY_MASK	(0xff << 16)
-#define LDBBSIFR_LAY_SHIFT	16
-#define LDBBSIFR_ROP3_MASK	(0xff << 16)
-#define LDBBSIFR_ROP3_SHIFT	16
-#define LDBBSIFR_AL_PL8		(3 << 14)
-#define LDBBSIFR_AL_PL1		(2 << 14)
-#define LDBBSIFR_AL_PK		(1 << 14)
-#define LDBBSIFR_AL_1		(0 << 14)
-#define LDBBSIFR_AL_MASK	(3 << 14)
-#define LDBBSIFR_SWPL		(1 << 10)
-#define LDBBSIFR_SWPW		(1 << 9)
-#define LDBBSIFR_SWPB		(1 << 8)
-#define LDBBSIFR_RY		(1 << 7)
-#define LDBBSIFR_CHRR_420	(2 << 0)
-#define LDBBSIFR_CHRR_422	(1 << 0)
-#define LDBBSIFR_CHRR_444	(0 << 0)
-#define LDBBSIFR_RPKF_ARGB32	(0x00 << 0)
-#define LDBBSIFR_RPKF_RGB16	(0x03 << 0)
-#define LDBBSIFR_RPKF_RGB24	(0x0b << 0)
-#define LDBBSIFR_RPKF_MASK	(0x1f << 0)
-#define LDBnBSSZR(n)		(0xb20 + (n) * 0x20 + 0x04)
-#define LDBBSSZR_BVSS_MASK	(0xfff << 16)
-#define LDBBSSZR_BVSS_SHIFT	16
-#define LDBBSSZR_BHSS_MASK	(0xfff << 0)
-#define LDBBSSZR_BHSS_SHIFT	0
-#define LDBnBLOCR(n)		(0xb20 + (n) * 0x20 + 0x08)
-#define LDBBLOCR_CVLC_MASK	(0xfff << 16)
-#define LDBBLOCR_CVLC_SHIFT	16
-#define LDBBLOCR_CHLC_MASK	(0xfff << 0)
-#define LDBBLOCR_CHLC_SHIFT	0
-#define LDBnBSMWR(n)		(0xb20 + (n) * 0x20 + 0x0c)
-#define LDBBSMWR_BSMWA_MASK	(0xffff << 16)
-#define LDBBSMWR_BSMWA_SHIFT	16
-#define LDBBSMWR_BSMW_MASK	(0xffff << 0)
-#define LDBBSMWR_BSMW_SHIFT	0
-#define LDBnBSAYR(n)		(0xb20 + (n) * 0x20 + 0x10)
-#define LDBBSAYR_FG1A_MASK	(0xff << 24)
-#define LDBBSAYR_FG1A_SHIFT	24
-#define LDBBSAYR_FG1R_MASK	(0xff << 16)
-#define LDBBSAYR_FG1R_SHIFT	16
-#define LDBBSAYR_FG1G_MASK	(0xff << 8)
-#define LDBBSAYR_FG1G_SHIFT	8
-#define LDBBSAYR_FG1B_MASK	(0xff << 0)
-#define LDBBSAYR_FG1B_SHIFT	0
-#define LDBnBSACR(n)		(0xb20 + (n) * 0x20 + 0x14)
-#define LDBBSACR_FG2A_MASK	(0xff << 24)
-#define LDBBSACR_FG2A_SHIFT	24
-#define LDBBSACR_FG2R_MASK	(0xff << 16)
-#define LDBBSACR_FG2R_SHIFT	16
-#define LDBBSACR_FG2G_MASK	(0xff << 8)
-#define LDBBSACR_FG2G_SHIFT	8
-#define LDBBSACR_FG2B_MASK	(0xff << 0)
-#define LDBBSACR_FG2B_SHIFT	0
-#define LDBnBSAAR(n)		(0xb20 + (n) * 0x20 + 0x18)
-#define LDBBSAAR_AP_MASK	(0xff << 24)
-#define LDBBSAAR_AP_SHIFT	24
-#define LDBBSAAR_R_MASK		(0xff << 16)
-#define LDBBSAAR_R_SHIFT	16
-#define LDBBSAAR_GY_MASK	(0xff << 8)
-#define LDBBSAAR_GY_SHIFT	8
-#define LDBBSAAR_B_MASK		(0xff << 0)
-#define LDBBSAAR_B_SHIFT	0
-#define LDBnBPPCR(n)		(0xb20 + (n) * 0x20 + 0x1c)
-#define LDBBPPCR_AP_MASK	(0xff << 24)
-#define LDBBPPCR_AP_SHIFT	24
-#define LDBBPPCR_R_MASK		(0xff << 16)
-#define LDBBPPCR_R_SHIFT	16
-#define LDBBPPCR_GY_MASK	(0xff << 8)
-#define LDBBPPCR_GY_SHIFT	8
-#define LDBBPPCR_B_MASK		(0xff << 0)
-#define LDBBPPCR_B_SHIFT	0
-#define LDBnBBGCL(n)		(0xb10 + (n) * 0x04)
-#define LDBBBGCL_BGA_MASK	(0xff << 24)
-#define LDBBBGCL_BGA_SHIFT	24
-#define LDBBBGCL_BGR_MASK	(0xff << 16)
-#define LDBBBGCL_BGR_SHIFT	16
-#define LDBBBGCL_BGG_MASK	(0xff << 8)
-#define LDBBBGCL_BGG_SHIFT	8
-#define LDBBBGCL_BGB_MASK	(0xff << 0)
-#define LDBBBGCL_BGB_SHIFT	0
-
-#define LCDC_SIDE_B_OFFSET	0x1000
-#define LCDC_MIRROR_OFFSET	0x2000
-
-static inline bool lcdc_is_banked(u32 reg)
-{
-	switch (reg) {
-	case LDMT1R:
-	case LDMT2R:
-	case LDMT3R:
-	case LDDFR:
-	case LDSM1R:
-	case LDSA1R:
-	case LDSA2R:
-	case LDMLSR:
-	case LDWBFR:
-	case LDWBCNTR:
-	case LDWBAR:
-	case LDHCNR:
-	case LDHSYNR:
-	case LDVLNR:
-	case LDVSYNR:
-	case LDHPDR:
-	case LDVPDR:
-	case LDHAJR:
-		return true;
-	default:
-		return reg >= LDBnBBGCL(0) && reg <= LDBnBPPCR(3);
-	}
-}
-
-static inline void lcdc_write_mirror(struct shmob_drm_device *sdev, u32 reg,
-				     u32 data)
-{
-	iowrite32(data, sdev->mmio + reg + LCDC_MIRROR_OFFSET);
-}
-
-static inline void lcdc_write(struct shmob_drm_device *sdev, u32 reg, u32 data)
-{
-	iowrite32(data, sdev->mmio + reg);
-	if (lcdc_is_banked(reg))
-		iowrite32(data, sdev->mmio + reg + LCDC_SIDE_B_OFFSET);
-}
-
-static inline u32 lcdc_read(struct shmob_drm_device *sdev, u32 reg)
-{
-	return ioread32(sdev->mmio + reg);
-}
-
-static inline int lcdc_wait_bit(struct shmob_drm_device *sdev, u32 reg,
-				u32 mask, u32 until)
-{
-	unsigned long timeout = jiffies + msecs_to_jiffies(5);
-
-	while ((lcdc_read(sdev, reg) & mask) != until) {
-		if (time_after(jiffies, timeout))
-			return -ETIMEDOUT;
-		cpu_relax();
-	}
-
-	return 0;
-}
-
-#endif /* __SHMOB_DRM_REGS_H__ */
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 02/22] usb: remove the dead USB_OHCI_SH option
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
  2023-01-13  6:23 ` [PATCH 01/22] gpu/drm: remove the shmobile drm driver Christoph Hellwig
@ 2023-01-13  6:23 ` Christoph Hellwig
  2023-01-13  7:12   ` Greg Kroah-Hartman
  2023-01-13  8:59   ` Geert Uytterhoeven
  2023-01-13  6:23 ` [PATCH 04/22] sound: remove sound/sh Christoph Hellwig
                   ` (19 subsequent siblings)
  21 siblings, 2 replies; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

USB_OHCI_SH is a dummy option that never builds any code, remove it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/usb/host/Kconfig | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 8d799d23c476e1..ca5f657c092cf4 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -548,17 +548,6 @@ config USB_OHCI_HCD_SSB
 
 	  If unsure, say N.
 
-config USB_OHCI_SH
-	bool "OHCI support for SuperH USB controller (DEPRECATED)"
-	depends on SUPERH || COMPILE_TEST
-	select USB_OHCI_HCD_PLATFORM
-	help
-	  This option is deprecated now and the driver was removed, use
-	  USB_OHCI_HCD_PLATFORM instead.
-
-	  Enables support for the on-chip OHCI controller on the SuperH.
-	  If you use the PCI OHCI controller, this option is not necessary.
-
 config USB_OHCI_EXYNOS
 	tristate "OHCI support for Samsung S5P/Exynos SoC Series"
 	depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 04/22] sound: remove sound/sh
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
  2023-01-13  6:23 ` [PATCH 01/22] gpu/drm: remove the shmobile drm driver Christoph Hellwig
  2023-01-13  6:23 ` [PATCH 02/22] usb: remove the dead USB_OHCI_SH option Christoph Hellwig
@ 2023-01-13  6:23 ` Christoph Hellwig
  2023-01-13 16:18   ` Takashi Iwai
  2023-01-13  6:23 ` [PATCH 05/22] sound: remove sh-specific sounds/soc/sh drivers Christoph Hellwig
                   ` (18 subsequent siblings)
  21 siblings, 1 reply; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Now that arch/sh is removed these drivers are dead code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 sound/Kconfig           |   2 -
 sound/Makefile          |   2 +-
 sound/sh/Kconfig        |  32 --
 sound/sh/Makefile       |  11 -
 sound/sh/aica.c         | 628 ----------------------------------------
 sound/sh/aica.h         |  68 -----
 sound/sh/sh_dac_audio.c | 412 --------------------------
 7 files changed, 1 insertion(+), 1154 deletions(-)
 delete mode 100644 sound/sh/Kconfig
 delete mode 100644 sound/sh/Makefile
 delete mode 100644 sound/sh/aica.c
 delete mode 100644 sound/sh/aica.h
 delete mode 100644 sound/sh/sh_dac_audio.c

diff --git a/sound/Kconfig b/sound/Kconfig
index e56d96d2b11cae..14361bb428baa1 100644
--- a/sound/Kconfig
+++ b/sound/Kconfig
@@ -75,8 +75,6 @@ source "sound/spi/Kconfig"
 
 source "sound/mips/Kconfig"
 
-source "sound/sh/Kconfig"
-
 # the following will depend on the order of config.
 # here assuming USB is defined before ALSA
 source "sound/usb/Kconfig"
diff --git a/sound/Makefile b/sound/Makefile
index 04ef04b1168f39..bb4b8806321c67 100644
--- a/sound/Makefile
+++ b/sound/Makefile
@@ -4,7 +4,7 @@
 
 obj-$(CONFIG_SOUND) += soundcore.o
 obj-$(CONFIG_DMASOUND) += oss/dmasound/
-obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ synth/ usb/ \
+obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ synth/ usb/ \
 	firewire/ sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ hda/ x86/ xen/ \
 	virtio/
 obj-$(CONFIG_SND_AOA) += aoa/
diff --git a/sound/sh/Kconfig b/sound/sh/Kconfig
deleted file mode 100644
index b75fbb3236a7b9..00000000000000
--- a/sound/sh/Kconfig
+++ /dev/null
@@ -1,32 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-# ALSA SH drivers
-
-menuconfig SND_SUPERH
-	bool "SUPERH sound devices"
-	depends on SUPERH
-	default y
-	help
-	  Support for sound devices specific to SUPERH architectures.
-	  Drivers that are implemented on ASoC can be found in
-	  "ALSA for SoC audio support" section.
-
-if SND_SUPERH
-
-config SND_AICA
-	tristate "Dreamcast Yamaha AICA sound"
-	depends on SH_DREAMCAST
-	select SND_PCM
-	select G2_DMA
-	help
-	  ALSA Sound driver for the SEGA Dreamcast console.
-
-config SND_SH_DAC_AUDIO
-	tristate "SuperH DAC audio support"
-	depends on SND
-	depends on CPU_SH3 && HIGH_RES_TIMERS
-	select SND_PCM
-	help
-	  Say Y here to include support for the on-chip DAC.
-
-endif	# SND_SUPERH
-
diff --git a/sound/sh/Makefile b/sound/sh/Makefile
deleted file mode 100644
index c0bbc500c17c73..00000000000000
--- a/sound/sh/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# Makefile for ALSA
-#
-
-snd-aica-objs := aica.o
-snd-sh_dac_audio-objs := sh_dac_audio.o
-
-# Toplevel Module Dependency
-obj-$(CONFIG_SND_AICA) += snd-aica.o
-obj-$(CONFIG_SND_SH_DAC_AUDIO) += snd-sh_dac_audio.o
diff --git a/sound/sh/aica.c b/sound/sh/aica.c
deleted file mode 100644
index 6e9d6bd67369af..00000000000000
--- a/sound/sh/aica.c
+++ /dev/null
@@ -1,628 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
-*
-* Copyright Adrian McMenamin 2005, 2006, 2007
-* <adrian@mcmen.demon.co.uk>
-* Requires firmware (BSD licenced) available from:
-* http://linuxdc.cvs.sourceforge.net/linuxdc/linux-sh-dc/sound/oss/aica/firmware/
-* or the maintainer
-*/
-
-#include <linux/init.h>
-#include <linux/jiffies.h>
-#include <linux/slab.h>
-#include <linux/time.h>
-#include <linux/wait.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/firmware.h>
-#include <linux/timer.h>
-#include <linux/delay.h>
-#include <linux/workqueue.h>
-#include <linux/io.h>
-#include <sound/core.h>
-#include <sound/control.h>
-#include <sound/pcm.h>
-#include <sound/initval.h>
-#include <sound/info.h>
-#include <asm/dma.h>
-#include <mach/sysasic.h>
-#include "aica.h"
-
-MODULE_AUTHOR("Adrian McMenamin <adrian@mcmen.demon.co.uk>");
-MODULE_DESCRIPTION("Dreamcast AICA sound (pcm) driver");
-MODULE_LICENSE("GPL");
-MODULE_FIRMWARE("aica_firmware.bin");
-
-/* module parameters */
-#define CARD_NAME "AICA"
-static int index = -1;
-static char *id;
-static bool enable = 1;
-module_param(index, int, 0444);
-MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard.");
-module_param(id, charp, 0444);
-MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard.");
-module_param(enable, bool, 0644);
-MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard.");
-
-/* Simple platform device */
-static struct platform_device *pd;
-static struct resource aica_memory_space[2] = {
-	{
-	 .name = "AICA ARM CONTROL",
-	 .start = ARM_RESET_REGISTER,
-	 .flags = IORESOURCE_MEM,
-	 .end = ARM_RESET_REGISTER + 3,
-	 },
-	{
-	 .name = "AICA Sound RAM",
-	 .start = SPU_MEMORY_BASE,
-	 .flags = IORESOURCE_MEM,
-	 .end = SPU_MEMORY_BASE + 0x200000 - 1,
-	 },
-};
-
-/* SPU specific functions */
-/* spu_write_wait - wait for G2-SH FIFO to clear */
-static void spu_write_wait(void)
-{
-	int time_count;
-	time_count = 0;
-	while (1) {
-		if (!(readl(G2_FIFO) & 0x11))
-			break;
-		/* To ensure hardware failure doesn't wedge kernel */
-		time_count++;
-		if (time_count > 0x10000) {
-			snd_printk
-			    ("WARNING: G2 FIFO appears to be blocked.\n");
-			break;
-		}
-	}
-}
-
-/* spu_memset - write to memory in SPU address space */
-static void spu_memset(u32 toi, u32 what, int length)
-{
-	int i;
-	unsigned long flags;
-	if (snd_BUG_ON(length % 4))
-		return;
-	for (i = 0; i < length; i++) {
-		if (!(i % 8))
-			spu_write_wait();
-		local_irq_save(flags);
-		writel(what, toi + SPU_MEMORY_BASE);
-		local_irq_restore(flags);
-		toi++;
-	}
-}
-
-/* spu_memload - write to SPU address space */
-static void spu_memload(u32 toi, const void *from, int length)
-{
-	unsigned long flags;
-	const u32 *froml = from;
-	u32 __iomem *to = (u32 __iomem *) (SPU_MEMORY_BASE + toi);
-	int i;
-	u32 val;
-	length = DIV_ROUND_UP(length, 4);
-	spu_write_wait();
-	for (i = 0; i < length; i++) {
-		if (!(i % 8))
-			spu_write_wait();
-		val = *froml;
-		local_irq_save(flags);
-		writel(val, to);
-		local_irq_restore(flags);
-		froml++;
-		to++;
-	}
-}
-
-/* spu_disable - set spu registers to stop sound output */
-static void spu_disable(void)
-{
-	int i;
-	unsigned long flags;
-	u32 regval;
-	spu_write_wait();
-	regval = readl(ARM_RESET_REGISTER);
-	regval |= 1;
-	spu_write_wait();
-	local_irq_save(flags);
-	writel(regval, ARM_RESET_REGISTER);
-	local_irq_restore(flags);
-	for (i = 0; i < 64; i++) {
-		spu_write_wait();
-		regval = readl(SPU_REGISTER_BASE + (i * 0x80));
-		regval = (regval & ~0x4000) | 0x8000;
-		spu_write_wait();
-		local_irq_save(flags);
-		writel(regval, SPU_REGISTER_BASE + (i * 0x80));
-		local_irq_restore(flags);
-	}
-}
-
-/* spu_enable - set spu registers to enable sound output */
-static void spu_enable(void)
-{
-	unsigned long flags;
-	u32 regval = readl(ARM_RESET_REGISTER);
-	regval &= ~1;
-	spu_write_wait();
-	local_irq_save(flags);
-	writel(regval, ARM_RESET_REGISTER);
-	local_irq_restore(flags);
-}
-
-/* 
- * Halt the sound processor, clear the memory,
- * load some default ARM7 code, and then restart ARM7
-*/
-static void spu_reset(void)
-{
-	unsigned long flags;
-	spu_disable();
-	spu_memset(0, 0, 0x200000 / 4);
-	/* Put ARM7 in endless loop */
-	local_irq_save(flags);
-	__raw_writel(0xea000002, SPU_MEMORY_BASE);
-	local_irq_restore(flags);
-	spu_enable();
-}
-
-/* aica_chn_start - write to spu to start playback */
-static void aica_chn_start(void)
-{
-	unsigned long flags;
-	spu_write_wait();
-	local_irq_save(flags);
-	writel(AICA_CMD_KICK | AICA_CMD_START, (u32 *) AICA_CONTROL_POINT);
-	local_irq_restore(flags);
-}
-
-/* aica_chn_halt - write to spu to halt playback */
-static void aica_chn_halt(void)
-{
-	unsigned long flags;
-	spu_write_wait();
-	local_irq_save(flags);
-	writel(AICA_CMD_KICK | AICA_CMD_STOP, (u32 *) AICA_CONTROL_POINT);
-	local_irq_restore(flags);
-}
-
-/* ALSA code below */
-static const struct snd_pcm_hardware snd_pcm_aica_playback_hw = {
-	.info = (SNDRV_PCM_INFO_NONINTERLEAVED),
-	.formats =
-	    (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE |
-	     SNDRV_PCM_FMTBIT_IMA_ADPCM),
-	.rates = SNDRV_PCM_RATE_8000_48000,
-	.rate_min = 8000,
-	.rate_max = 48000,
-	.channels_min = 1,
-	.channels_max = 2,
-	.buffer_bytes_max = AICA_BUFFER_SIZE,
-	.period_bytes_min = AICA_PERIOD_SIZE,
-	.period_bytes_max = AICA_PERIOD_SIZE,
-	.periods_min = AICA_PERIOD_NUMBER,
-	.periods_max = AICA_PERIOD_NUMBER,
-};
-
-static int aica_dma_transfer(int channels, int buffer_size,
-			     struct snd_pcm_substream *substream)
-{
-	int q, err, period_offset;
-	struct snd_card_aica *dreamcastcard;
-	struct snd_pcm_runtime *runtime;
-	unsigned long flags;
-	err = 0;
-	dreamcastcard = substream->pcm->private_data;
-	period_offset = dreamcastcard->clicks;
-	period_offset %= (AICA_PERIOD_NUMBER / channels);
-	runtime = substream->runtime;
-	for (q = 0; q < channels; q++) {
-		local_irq_save(flags);
-		err = dma_xfer(AICA_DMA_CHANNEL,
-			       (unsigned long) (runtime->dma_area +
-						(AICA_BUFFER_SIZE * q) /
-						channels +
-						AICA_PERIOD_SIZE *
-						period_offset),
-			       AICA_CHANNEL0_OFFSET + q * CHANNEL_OFFSET +
-			       AICA_PERIOD_SIZE * period_offset,
-			       buffer_size / channels, AICA_DMA_MODE);
-		if (unlikely(err < 0)) {
-			local_irq_restore(flags);
-			break;
-		}
-		dma_wait_for_completion(AICA_DMA_CHANNEL);
-		local_irq_restore(flags);
-	}
-	return err;
-}
-
-static void startup_aica(struct snd_card_aica *dreamcastcard)
-{
-	spu_memload(AICA_CHANNEL0_CONTROL_OFFSET,
-		    dreamcastcard->channel, sizeof(struct aica_channel));
-	aica_chn_start();
-}
-
-static void run_spu_dma(struct work_struct *work)
-{
-	int buffer_size;
-	struct snd_pcm_runtime *runtime;
-	struct snd_card_aica *dreamcastcard;
-	dreamcastcard =
-	    container_of(work, struct snd_card_aica, spu_dma_work);
-	runtime = dreamcastcard->substream->runtime;
-	if (unlikely(dreamcastcard->dma_check == 0)) {
-		buffer_size =
-		    frames_to_bytes(runtime, runtime->buffer_size);
-		if (runtime->channels > 1)
-			dreamcastcard->channel->flags |= 0x01;
-		aica_dma_transfer(runtime->channels, buffer_size,
-				  dreamcastcard->substream);
-		startup_aica(dreamcastcard);
-		dreamcastcard->clicks =
-		    buffer_size / (AICA_PERIOD_SIZE * runtime->channels);
-		return;
-	} else {
-		aica_dma_transfer(runtime->channels,
-				  AICA_PERIOD_SIZE * runtime->channels,
-				  dreamcastcard->substream);
-		snd_pcm_period_elapsed(dreamcastcard->substream);
-		dreamcastcard->clicks++;
-		if (unlikely(dreamcastcard->clicks >= AICA_PERIOD_NUMBER))
-			dreamcastcard->clicks %= AICA_PERIOD_NUMBER;
-		mod_timer(&dreamcastcard->timer, jiffies + 1);
-	}
-}
-
-static void aica_period_elapsed(struct timer_list *t)
-{
-	struct snd_card_aica *dreamcastcard = from_timer(dreamcastcard,
-							      t, timer);
-	struct snd_pcm_substream *substream = dreamcastcard->substream;
-	/*timer function - so cannot sleep */
-	int play_period;
-	struct snd_pcm_runtime *runtime;
-	runtime = substream->runtime;
-	dreamcastcard = substream->pcm->private_data;
-	/* Have we played out an additional period? */
-	play_period =
-	    frames_to_bytes(runtime,
-			    readl
-			    (AICA_CONTROL_CHANNEL_SAMPLE_NUMBER)) /
-	    AICA_PERIOD_SIZE;
-	if (play_period == dreamcastcard->current_period) {
-		/* reschedule the timer */
-		mod_timer(&(dreamcastcard->timer), jiffies + 1);
-		return;
-	}
-	if (runtime->channels > 1)
-		dreamcastcard->current_period = play_period;
-	if (unlikely(dreamcastcard->dma_check == 0))
-		dreamcastcard->dma_check = 1;
-	schedule_work(&(dreamcastcard->spu_dma_work));
-}
-
-static void spu_begin_dma(struct snd_pcm_substream *substream)
-{
-	struct snd_card_aica *dreamcastcard;
-	struct snd_pcm_runtime *runtime;
-	runtime = substream->runtime;
-	dreamcastcard = substream->pcm->private_data;
-	/*get the queue to do the work */
-	schedule_work(&(dreamcastcard->spu_dma_work));
-	mod_timer(&dreamcastcard->timer, jiffies + 4);
-}
-
-static int snd_aicapcm_pcm_open(struct snd_pcm_substream
-				*substream)
-{
-	struct snd_pcm_runtime *runtime;
-	struct aica_channel *channel;
-	struct snd_card_aica *dreamcastcard;
-	if (!enable)
-		return -ENOENT;
-	dreamcastcard = substream->pcm->private_data;
-	channel = kmalloc(sizeof(struct aica_channel), GFP_KERNEL);
-	if (!channel)
-		return -ENOMEM;
-	/* set defaults for channel */
-	channel->sfmt = SM_8BIT;
-	channel->cmd = AICA_CMD_START;
-	channel->vol = dreamcastcard->master_volume;
-	channel->pan = 0x80;
-	channel->pos = 0;
-	channel->flags = 0;	/* default to mono */
-	dreamcastcard->channel = channel;
-	runtime = substream->runtime;
-	runtime->hw = snd_pcm_aica_playback_hw;
-	spu_enable();
-	dreamcastcard->clicks = 0;
-	dreamcastcard->current_period = 0;
-	dreamcastcard->dma_check = 0;
-	return 0;
-}
-
-static int snd_aicapcm_pcm_close(struct snd_pcm_substream
-				 *substream)
-{
-	struct snd_card_aica *dreamcastcard = substream->pcm->private_data;
-	flush_work(&(dreamcastcard->spu_dma_work));
-	del_timer(&dreamcastcard->timer);
-	dreamcastcard->substream = NULL;
-	kfree(dreamcastcard->channel);
-	spu_disable();
-	return 0;
-}
-
-static int snd_aicapcm_pcm_prepare(struct snd_pcm_substream
-				   *substream)
-{
-	struct snd_card_aica *dreamcastcard = substream->pcm->private_data;
-	if ((substream->runtime)->format == SNDRV_PCM_FORMAT_S16_LE)
-		dreamcastcard->channel->sfmt = SM_16BIT;
-	dreamcastcard->channel->freq = substream->runtime->rate;
-	dreamcastcard->substream = substream;
-	return 0;
-}
-
-static int snd_aicapcm_pcm_trigger(struct snd_pcm_substream
-				   *substream, int cmd)
-{
-	switch (cmd) {
-	case SNDRV_PCM_TRIGGER_START:
-		spu_begin_dma(substream);
-		break;
-	case SNDRV_PCM_TRIGGER_STOP:
-		aica_chn_halt();
-		break;
-	default:
-		return -EINVAL;
-	}
-	return 0;
-}
-
-static unsigned long snd_aicapcm_pcm_pointer(struct snd_pcm_substream
-					     *substream)
-{
-	return readl(AICA_CONTROL_CHANNEL_SAMPLE_NUMBER);
-}
-
-static const struct snd_pcm_ops snd_aicapcm_playback_ops = {
-	.open = snd_aicapcm_pcm_open,
-	.close = snd_aicapcm_pcm_close,
-	.prepare = snd_aicapcm_pcm_prepare,
-	.trigger = snd_aicapcm_pcm_trigger,
-	.pointer = snd_aicapcm_pcm_pointer,
-};
-
-/* TO DO: set up to handle more than one pcm instance */
-static int __init snd_aicapcmchip(struct snd_card_aica
-				  *dreamcastcard, int pcm_index)
-{
-	struct snd_pcm *pcm;
-	int err;
-	/* AICA has no capture ability */
-	err =
-	    snd_pcm_new(dreamcastcard->card, "AICA PCM", pcm_index, 1, 0,
-			&pcm);
-	if (unlikely(err < 0))
-		return err;
-	pcm->private_data = dreamcastcard;
-	strcpy(pcm->name, "AICA PCM");
-	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
-			&snd_aicapcm_playback_ops);
-	/* Allocate the DMA buffers */
-	snd_pcm_set_managed_buffer_all(pcm,
-				       SNDRV_DMA_TYPE_CONTINUOUS,
-				       NULL,
-				       AICA_BUFFER_SIZE,
-				       AICA_BUFFER_SIZE);
-	return 0;
-}
-
-/* Mixer controls */
-#define aica_pcmswitch_info		snd_ctl_boolean_mono_info
-
-static int aica_pcmswitch_get(struct snd_kcontrol *kcontrol,
-			      struct snd_ctl_elem_value *ucontrol)
-{
-	ucontrol->value.integer.value[0] = 1;	/* TO DO: Fix me */
-	return 0;
-}
-
-static int aica_pcmswitch_put(struct snd_kcontrol *kcontrol,
-			      struct snd_ctl_elem_value *ucontrol)
-{
-	if (ucontrol->value.integer.value[0] == 1)
-		return 0;	/* TO DO: Fix me */
-	else
-		aica_chn_halt();
-	return 0;
-}
-
-static int aica_pcmvolume_info(struct snd_kcontrol *kcontrol,
-			       struct snd_ctl_elem_info *uinfo)
-{
-	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
-	uinfo->count = 1;
-	uinfo->value.integer.min = 0;
-	uinfo->value.integer.max = 0xFF;
-	return 0;
-}
-
-static int aica_pcmvolume_get(struct snd_kcontrol *kcontrol,
-			      struct snd_ctl_elem_value *ucontrol)
-{
-	struct snd_card_aica *dreamcastcard;
-	dreamcastcard = kcontrol->private_data;
-	if (unlikely(!dreamcastcard->channel))
-		return -ETXTBSY;	/* we've not yet been set up */
-	ucontrol->value.integer.value[0] = dreamcastcard->channel->vol;
-	return 0;
-}
-
-static int aica_pcmvolume_put(struct snd_kcontrol *kcontrol,
-			      struct snd_ctl_elem_value *ucontrol)
-{
-	struct snd_card_aica *dreamcastcard;
-	unsigned int vol;
-	dreamcastcard = kcontrol->private_data;
-	if (unlikely(!dreamcastcard->channel))
-		return -ETXTBSY;
-	vol = ucontrol->value.integer.value[0];
-	if (vol > 0xff)
-		return -EINVAL;
-	if (unlikely(dreamcastcard->channel->vol == vol))
-		return 0;
-	dreamcastcard->channel->vol = ucontrol->value.integer.value[0];
-	dreamcastcard->master_volume = ucontrol->value.integer.value[0];
-	spu_memload(AICA_CHANNEL0_CONTROL_OFFSET,
-		    dreamcastcard->channel, sizeof(struct aica_channel));
-	return 1;
-}
-
-static const struct snd_kcontrol_new snd_aica_pcmswitch_control = {
-	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-	.name = "PCM Playback Switch",
-	.index = 0,
-	.info = aica_pcmswitch_info,
-	.get = aica_pcmswitch_get,
-	.put = aica_pcmswitch_put
-};
-
-static const struct snd_kcontrol_new snd_aica_pcmvolume_control = {
-	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-	.name = "PCM Playback Volume",
-	.index = 0,
-	.info = aica_pcmvolume_info,
-	.get = aica_pcmvolume_get,
-	.put = aica_pcmvolume_put
-};
-
-static int load_aica_firmware(void)
-{
-	int err;
-	const struct firmware *fw_entry;
-	spu_reset();
-	err = request_firmware(&fw_entry, "aica_firmware.bin", &pd->dev);
-	if (unlikely(err))
-		return err;
-	/* write firmware into memory */
-	spu_disable();
-	spu_memload(0, fw_entry->data, fw_entry->size);
-	spu_enable();
-	release_firmware(fw_entry);
-	return err;
-}
-
-static int add_aicamixer_controls(struct snd_card_aica *dreamcastcard)
-{
-	int err;
-	err = snd_ctl_add
-	    (dreamcastcard->card,
-	     snd_ctl_new1(&snd_aica_pcmvolume_control, dreamcastcard));
-	if (unlikely(err < 0))
-		return err;
-	err = snd_ctl_add
-	    (dreamcastcard->card,
-	     snd_ctl_new1(&snd_aica_pcmswitch_control, dreamcastcard));
-	if (unlikely(err < 0))
-		return err;
-	return 0;
-}
-
-static int snd_aica_remove(struct platform_device *devptr)
-{
-	struct snd_card_aica *dreamcastcard;
-	dreamcastcard = platform_get_drvdata(devptr);
-	if (unlikely(!dreamcastcard))
-		return -ENODEV;
-	snd_card_free(dreamcastcard->card);
-	kfree(dreamcastcard);
-	return 0;
-}
-
-static int snd_aica_probe(struct platform_device *devptr)
-{
-	int err;
-	struct snd_card_aica *dreamcastcard;
-	dreamcastcard = kzalloc(sizeof(struct snd_card_aica), GFP_KERNEL);
-	if (unlikely(!dreamcastcard))
-		return -ENOMEM;
-	err = snd_card_new(&devptr->dev, index, SND_AICA_DRIVER,
-			   THIS_MODULE, 0, &dreamcastcard->card);
-	if (unlikely(err < 0)) {
-		kfree(dreamcastcard);
-		return err;
-	}
-	strcpy(dreamcastcard->card->driver, "snd_aica");
-	strcpy(dreamcastcard->card->shortname, SND_AICA_DRIVER);
-	strcpy(dreamcastcard->card->longname,
-	       "Yamaha AICA Super Intelligent Sound Processor for SEGA Dreamcast");
-	/* Prepare to use the queue */
-	INIT_WORK(&(dreamcastcard->spu_dma_work), run_spu_dma);
-	timer_setup(&dreamcastcard->timer, aica_period_elapsed, 0);
-	/* Load the PCM 'chip' */
-	err = snd_aicapcmchip(dreamcastcard, 0);
-	if (unlikely(err < 0))
-		goto freedreamcast;
-	/* Add basic controls */
-	err = add_aicamixer_controls(dreamcastcard);
-	if (unlikely(err < 0))
-		goto freedreamcast;
-	/* Register the card with ALSA subsystem */
-	err = snd_card_register(dreamcastcard->card);
-	if (unlikely(err < 0))
-		goto freedreamcast;
-	platform_set_drvdata(devptr, dreamcastcard);
-	snd_printk
-	    ("ALSA Driver for Yamaha AICA Super Intelligent Sound Processor\n");
-	return 0;
-      freedreamcast:
-	snd_card_free(dreamcastcard->card);
-	kfree(dreamcastcard);
-	return err;
-}
-
-static struct platform_driver snd_aica_driver = {
-	.probe = snd_aica_probe,
-	.remove = snd_aica_remove,
-	.driver = {
-		.name = SND_AICA_DRIVER,
-	},
-};
-
-static int __init aica_init(void)
-{
-	int err;
-	err = platform_driver_register(&snd_aica_driver);
-	if (unlikely(err < 0))
-		return err;
-	pd = platform_device_register_simple(SND_AICA_DRIVER, -1,
-					     aica_memory_space, 2);
-	if (IS_ERR(pd)) {
-		platform_driver_unregister(&snd_aica_driver);
-		return PTR_ERR(pd);
-	}
-	/* Load the firmware */
-	return load_aica_firmware();
-}
-
-static void __exit aica_exit(void)
-{
-	platform_device_unregister(pd);
-	platform_driver_unregister(&snd_aica_driver);
-	/* Kill any sound still playing and reset ARM7 to safe state */
-	spu_reset();
-}
-
-module_init(aica_init);
-module_exit(aica_exit);
diff --git a/sound/sh/aica.h b/sound/sh/aica.h
deleted file mode 100644
index 021b132e088e82..00000000000000
--- a/sound/sh/aica.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/* aica.h
- * Header file for ALSA driver for
- * Sega Dreamcast Yamaha AICA sound
- * Copyright Adrian McMenamin
- * <adrian@mcmen.demon.co.uk>
- * 2006
- */
-
-/* SPU memory and register constants etc */
-#define G2_FIFO 0xa05f688c
-#define SPU_MEMORY_BASE 0xA0800000
-#define ARM_RESET_REGISTER 0xA0702C00
-#define SPU_REGISTER_BASE 0xA0700000
-
-/* AICA channels stuff */
-#define AICA_CONTROL_POINT 0xA0810000
-#define AICA_CONTROL_CHANNEL_SAMPLE_NUMBER 0xA0810008
-#define AICA_CHANNEL0_CONTROL_OFFSET 0x10004
-
-/* Command values */
-#define AICA_CMD_KICK 0x80000000
-#define AICA_CMD_NONE 0
-#define AICA_CMD_START 1
-#define AICA_CMD_STOP 2
-#define AICA_CMD_VOL 3
-
-/* Sound modes */
-#define SM_8BIT		1
-#define SM_16BIT	0
-#define SM_ADPCM	2
-
-/* Buffer and period size */
-#define AICA_BUFFER_SIZE 0x8000
-#define AICA_PERIOD_SIZE 0x800
-#define AICA_PERIOD_NUMBER 16
-
-#define AICA_CHANNEL0_OFFSET 0x11000
-#define AICA_CHANNEL1_OFFSET 0x21000
-#define CHANNEL_OFFSET 0x10000
-
-#define AICA_DMA_CHANNEL 5
-#define AICA_DMA_MODE 5
-
-#define SND_AICA_DRIVER "AICA"
-
-struct aica_channel {
-	uint32_t cmd;		/* Command ID           */
-	uint32_t pos;		/* Sample position      */
-	uint32_t length;	/* Sample length        */
-	uint32_t freq;		/* Frequency            */
-	uint32_t vol;		/* Volume 0-255         */
-	uint32_t pan;		/* Pan 0-255            */
-	uint32_t sfmt;		/* Sound format         */
-	uint32_t flags;		/* Bit flags            */
-};
-
-struct snd_card_aica {
-	struct work_struct spu_dma_work;
-	struct snd_card *card;
-	struct aica_channel *channel;
-	struct snd_pcm_substream *substream;
-	int clicks;
-	int current_period;
-	struct timer_list timer;
-	int master_volume;
-	int dma_check;
-};
diff --git a/sound/sh/sh_dac_audio.c b/sound/sh/sh_dac_audio.c
deleted file mode 100644
index 8ebd972846acb5..00000000000000
--- a/sound/sh/sh_dac_audio.c
+++ /dev/null
@@ -1,412 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * sh_dac_audio.c - SuperH DAC audio driver for ALSA
- *
- * Copyright (c) 2009 by Rafael Ignacio Zurita <rizurita@yahoo.com>
- *
- * Based on sh_dac_audio.c (Copyright (C) 2004, 2005 by Andriy Skulysh)
- */
-
-#include <linux/hrtimer.h>
-#include <linux/interrupt.h>
-#include <linux/io.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <sound/core.h>
-#include <sound/initval.h>
-#include <sound/pcm.h>
-#include <sound/sh_dac_audio.h>
-#include <asm/clock.h>
-#include <asm/hd64461.h>
-#include <mach/hp6xx.h>
-#include <cpu/dac.h>
-
-MODULE_AUTHOR("Rafael Ignacio Zurita <rizurita@yahoo.com>");
-MODULE_DESCRIPTION("SuperH DAC audio driver");
-MODULE_LICENSE("GPL");
-
-/* Module Parameters */
-static int index = SNDRV_DEFAULT_IDX1;
-static char *id = SNDRV_DEFAULT_STR1;
-module_param(index, int, 0444);
-MODULE_PARM_DESC(index, "Index value for SuperH DAC audio.");
-module_param(id, charp, 0444);
-MODULE_PARM_DESC(id, "ID string for SuperH DAC audio.");
-
-/* main struct */
-struct snd_sh_dac {
-	struct snd_card *card;
-	struct snd_pcm_substream *substream;
-	struct hrtimer hrtimer;
-	ktime_t wakeups_per_second;
-
-	int rate;
-	int empty;
-	char *data_buffer, *buffer_begin, *buffer_end;
-	int processed; /* bytes proccesed, to compare with period_size */
-	int buffer_size;
-	struct dac_audio_pdata *pdata;
-};
-
-
-static void dac_audio_start_timer(struct snd_sh_dac *chip)
-{
-	hrtimer_start(&chip->hrtimer, chip->wakeups_per_second,
-		      HRTIMER_MODE_REL);
-}
-
-static void dac_audio_stop_timer(struct snd_sh_dac *chip)
-{
-	hrtimer_cancel(&chip->hrtimer);
-}
-
-static void dac_audio_reset(struct snd_sh_dac *chip)
-{
-	dac_audio_stop_timer(chip);
-	chip->buffer_begin = chip->buffer_end = chip->data_buffer;
-	chip->processed = 0;
-	chip->empty = 1;
-}
-
-static void dac_audio_set_rate(struct snd_sh_dac *chip)
-{
-	chip->wakeups_per_second = 1000000000 / chip->rate;
-}
-
-
-/* PCM INTERFACE */
-
-static const struct snd_pcm_hardware snd_sh_dac_pcm_hw = {
-	.info			= (SNDRV_PCM_INFO_MMAP |
-					SNDRV_PCM_INFO_MMAP_VALID |
-					SNDRV_PCM_INFO_INTERLEAVED |
-					SNDRV_PCM_INFO_HALF_DUPLEX),
-	.formats		= SNDRV_PCM_FMTBIT_U8,
-	.rates			= SNDRV_PCM_RATE_8000,
-	.rate_min		= 8000,
-	.rate_max		= 8000,
-	.channels_min		= 1,
-	.channels_max		= 1,
-	.buffer_bytes_max	= (48*1024),
-	.period_bytes_min	= 1,
-	.period_bytes_max	= (48*1024),
-	.periods_min		= 1,
-	.periods_max		= 1024,
-};
-
-static int snd_sh_dac_pcm_open(struct snd_pcm_substream *substream)
-{
-	struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
-	struct snd_pcm_runtime *runtime = substream->runtime;
-
-	runtime->hw = snd_sh_dac_pcm_hw;
-
-	chip->substream = substream;
-	chip->buffer_begin = chip->buffer_end = chip->data_buffer;
-	chip->processed = 0;
-	chip->empty = 1;
-
-	chip->pdata->start(chip->pdata);
-
-	return 0;
-}
-
-static int snd_sh_dac_pcm_close(struct snd_pcm_substream *substream)
-{
-	struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
-
-	chip->substream = NULL;
-
-	dac_audio_stop_timer(chip);
-	chip->pdata->stop(chip->pdata);
-
-	return 0;
-}
-
-static int snd_sh_dac_pcm_prepare(struct snd_pcm_substream *substream)
-{
-	struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
-	struct snd_pcm_runtime *runtime = chip->substream->runtime;
-
-	chip->buffer_size = runtime->buffer_size;
-	memset(chip->data_buffer, 0, chip->pdata->buffer_size);
-
-	return 0;
-}
-
-static int snd_sh_dac_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
-{
-	struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
-
-	switch (cmd) {
-	case SNDRV_PCM_TRIGGER_START:
-		dac_audio_start_timer(chip);
-		break;
-	case SNDRV_PCM_TRIGGER_STOP:
-		chip->buffer_begin = chip->buffer_end = chip->data_buffer;
-		chip->processed = 0;
-		chip->empty = 1;
-		dac_audio_stop_timer(chip);
-		break;
-	default:
-		 return -EINVAL;
-	}
-
-	return 0;
-}
-
-static int snd_sh_dac_pcm_copy(struct snd_pcm_substream *substream,
-			       int channel, unsigned long pos,
-			       void __user *src, unsigned long count)
-{
-	/* channel is not used (interleaved data) */
-	struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
-
-	if (copy_from_user_toio(chip->data_buffer + pos, src, count))
-		return -EFAULT;
-	chip->buffer_end = chip->data_buffer + pos + count;
-
-	if (chip->empty) {
-		chip->empty = 0;
-		dac_audio_start_timer(chip);
-	}
-
-	return 0;
-}
-
-static int snd_sh_dac_pcm_copy_kernel(struct snd_pcm_substream *substream,
-				      int channel, unsigned long pos,
-				      void *src, unsigned long count)
-{
-	/* channel is not used (interleaved data) */
-	struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
-
-	memcpy_toio(chip->data_buffer + pos, src, count);
-	chip->buffer_end = chip->data_buffer + pos + count;
-
-	if (chip->empty) {
-		chip->empty = 0;
-		dac_audio_start_timer(chip);
-	}
-
-	return 0;
-}
-
-static int snd_sh_dac_pcm_silence(struct snd_pcm_substream *substream,
-				  int channel, unsigned long pos,
-				  unsigned long count)
-{
-	/* channel is not used (interleaved data) */
-	struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
-
-	memset_io(chip->data_buffer + pos, 0, count);
-	chip->buffer_end = chip->data_buffer + pos + count;
-
-	if (chip->empty) {
-		chip->empty = 0;
-		dac_audio_start_timer(chip);
-	}
-
-	return 0;
-}
-
-static
-snd_pcm_uframes_t snd_sh_dac_pcm_pointer(struct snd_pcm_substream *substream)
-{
-	struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
-	int pointer = chip->buffer_begin - chip->data_buffer;
-
-	return pointer;
-}
-
-/* pcm ops */
-static const struct snd_pcm_ops snd_sh_dac_pcm_ops = {
-	.open		= snd_sh_dac_pcm_open,
-	.close		= snd_sh_dac_pcm_close,
-	.prepare	= snd_sh_dac_pcm_prepare,
-	.trigger	= snd_sh_dac_pcm_trigger,
-	.pointer	= snd_sh_dac_pcm_pointer,
-	.copy_user	= snd_sh_dac_pcm_copy,
-	.copy_kernel	= snd_sh_dac_pcm_copy_kernel,
-	.fill_silence	= snd_sh_dac_pcm_silence,
-	.mmap		= snd_pcm_lib_mmap_iomem,
-};
-
-static int snd_sh_dac_pcm(struct snd_sh_dac *chip, int device)
-{
-	int err;
-	struct snd_pcm *pcm;
-
-	/* device should be always 0 for us */
-	err = snd_pcm_new(chip->card, "SH_DAC PCM", device, 1, 0, &pcm);
-	if (err < 0)
-		return err;
-
-	pcm->private_data = chip;
-	strcpy(pcm->name, "SH_DAC PCM");
-	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sh_dac_pcm_ops);
-
-	/* buffer size=48K */
-	snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
-				       NULL, 48 * 1024, 48 * 1024);
-
-	return 0;
-}
-/* END OF PCM INTERFACE */
-
-
-/* driver .remove  --  destructor */
-static int snd_sh_dac_remove(struct platform_device *devptr)
-{
-	snd_card_free(platform_get_drvdata(devptr));
-	return 0;
-}
-
-/* free -- it has been defined by create */
-static int snd_sh_dac_free(struct snd_sh_dac *chip)
-{
-	/* release the data */
-	kfree(chip->data_buffer);
-	kfree(chip);
-
-	return 0;
-}
-
-static int snd_sh_dac_dev_free(struct snd_device *device)
-{
-	struct snd_sh_dac *chip = device->device_data;
-
-	return snd_sh_dac_free(chip);
-}
-
-static enum hrtimer_restart sh_dac_audio_timer(struct hrtimer *handle)
-{
-	struct snd_sh_dac *chip = container_of(handle, struct snd_sh_dac,
-					       hrtimer);
-	struct snd_pcm_runtime *runtime = chip->substream->runtime;
-	ssize_t b_ps = frames_to_bytes(runtime, runtime->period_size);
-
-	if (!chip->empty) {
-		sh_dac_output(*chip->buffer_begin, chip->pdata->channel);
-		chip->buffer_begin++;
-
-		chip->processed++;
-		if (chip->processed >= b_ps) {
-			chip->processed -= b_ps;
-			snd_pcm_period_elapsed(chip->substream);
-		}
-
-		if (chip->buffer_begin == (chip->data_buffer +
-					   chip->buffer_size - 1))
-			chip->buffer_begin = chip->data_buffer;
-
-		if (chip->buffer_begin == chip->buffer_end)
-			chip->empty = 1;
-
-	}
-
-	if (!chip->empty)
-		hrtimer_start(&chip->hrtimer, chip->wakeups_per_second,
-			      HRTIMER_MODE_REL);
-
-	return HRTIMER_NORESTART;
-}
-
-/* create  --  chip-specific constructor for the cards components */
-static int snd_sh_dac_create(struct snd_card *card,
-			     struct platform_device *devptr,
-			     struct snd_sh_dac **rchip)
-{
-	struct snd_sh_dac *chip;
-	int err;
-
-	static const struct snd_device_ops ops = {
-		   .dev_free = snd_sh_dac_dev_free,
-	};
-
-	*rchip = NULL;
-
-	chip = kzalloc(sizeof(*chip), GFP_KERNEL);
-	if (chip == NULL)
-		return -ENOMEM;
-
-	chip->card = card;
-
-	hrtimer_init(&chip->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	chip->hrtimer.function = sh_dac_audio_timer;
-
-	dac_audio_reset(chip);
-	chip->rate = 8000;
-	dac_audio_set_rate(chip);
-
-	chip->pdata = devptr->dev.platform_data;
-
-	chip->data_buffer = kmalloc(chip->pdata->buffer_size, GFP_KERNEL);
-	if (chip->data_buffer == NULL) {
-		kfree(chip);
-		return -ENOMEM;
-	}
-
-	err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
-	if (err < 0) {
-		snd_sh_dac_free(chip);
-		return err;
-	}
-
-	*rchip = chip;
-
-	return 0;
-}
-
-/* driver .probe  --  constructor */
-static int snd_sh_dac_probe(struct platform_device *devptr)
-{
-	struct snd_sh_dac *chip;
-	struct snd_card *card;
-	int err;
-
-	err = snd_card_new(&devptr->dev, index, id, THIS_MODULE, 0, &card);
-	if (err < 0) {
-			snd_printk(KERN_ERR "cannot allocate the card\n");
-			return err;
-	}
-
-	err = snd_sh_dac_create(card, devptr, &chip);
-	if (err < 0)
-		goto probe_error;
-
-	err = snd_sh_dac_pcm(chip, 0);
-	if (err < 0)
-		goto probe_error;
-
-	strcpy(card->driver, "snd_sh_dac");
-	strcpy(card->shortname, "SuperH DAC audio driver");
-	printk(KERN_INFO "%s %s", card->longname, card->shortname);
-
-	err = snd_card_register(card);
-	if (err < 0)
-		goto probe_error;
-
-	snd_printk(KERN_INFO "ALSA driver for SuperH DAC audio");
-
-	platform_set_drvdata(devptr, card);
-	return 0;
-
-probe_error:
-	snd_card_free(card);
-	return err;
-}
-
-/*
- * "driver" definition
- */
-static struct platform_driver sh_dac_driver = {
-	.probe	= snd_sh_dac_probe,
-	.remove = snd_sh_dac_remove,
-	.driver = {
-		.name = "dac_audio",
-	},
-};
-
-module_platform_driver(sh_dac_driver);
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 05/22] sound: remove sh-specific sounds/soc/sh drivers
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
                   ` (2 preceding siblings ...)
  2023-01-13  6:23 ` [PATCH 04/22] sound: remove sound/sh Christoph Hellwig
@ 2023-01-13  6:23 ` Christoph Hellwig
  2023-01-17 22:52   ` Kuninori Morimoto
  2023-01-13  6:23 ` [PATCH 06/22] watchdog: remove the shwdt driver Christoph Hellwig
                   ` (17 subsequent siblings)
  21 siblings, 1 reply; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Now that arch/sh is removed these drivers are dead code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 sound/soc/sh/Kconfig       |  44 --
 sound/soc/sh/Makefile      |  16 -
 sound/soc/sh/dma-sh7760.c  | 334 ----------------
 sound/soc/sh/fsi.c         |   9 -
 sound/soc/sh/hac.c         | 345 ----------------
 sound/soc/sh/migor.c       | 205 ----------
 sound/soc/sh/sh7760-ac97.c |  72 ----
 sound/soc/sh/siu.h         | 180 ---------
 sound/soc/sh/siu_dai.c     | 799 -------------------------------------
 sound/soc/sh/siu_pcm.c     | 553 -------------------------
 sound/soc/sh/ssi.c         | 403 -------------------
 11 files changed, 2960 deletions(-)
 delete mode 100644 sound/soc/sh/dma-sh7760.c
 delete mode 100644 sound/soc/sh/hac.c
 delete mode 100644 sound/soc/sh/migor.c
 delete mode 100644 sound/soc/sh/sh7760-ac97.c
 delete mode 100644 sound/soc/sh/siu.h
 delete mode 100644 sound/soc/sh/siu_dai.c
 delete mode 100644 sound/soc/sh/siu_pcm.c
 delete mode 100644 sound/soc/sh/ssi.c

diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig
index 793a0326f32b46..4367927b81df20 100644
--- a/sound/soc/sh/Kconfig
+++ b/sound/soc/sh/Kconfig
@@ -2,25 +2,10 @@
 menu "SoC Audio support for Renesas SoCs"
 	depends on ARCH_RENESAS || COMPILE_TEST
 
-config SND_SOC_PCM_SH7760
-	tristate "SoC Audio support for Renesas SH7760"
-	depends on CPU_SUBTYPE_SH7760 && SH_DMABRG
-	help
-	  Enable this option for SH7760 AC97/I2S audio support.
-
-
 ##
 ## Audio unit modules
 ##
 
-config SND_SOC_SH4_HAC
-	tristate
-	select AC97_BUS
-	select SND_SOC_AC97_BUS
-
-config SND_SOC_SH4_SSI
-	tristate
-
 config SND_SOC_SH4_FSI
 	tristate "SH4 FSI support"
 	depends on COMMON_CLK
@@ -28,14 +13,6 @@ config SND_SOC_SH4_FSI
 	help
 	  This option enables FSI sound support
 
-config SND_SOC_SH4_SIU
-	tristate
-	depends on ARCH_SHMOBILE && HAVE_CLK
-	depends on DMADEVICES
-	select DMA_ENGINE
-	select SH_DMAE
-	select FW_LOADER
-
 config SND_SOC_RCAR
 	tristate "R-Car series SRU/SCU/SSIU/SSI support"
 	depends on COMMON_CLK
@@ -51,25 +28,4 @@ config SND_SOC_RZ
 	help
 	  This option enables RZ/G2L SSIF-2 sound support.
 
-##
-## Boards
-##
-
-config SND_SH7760_AC97
-	tristate "SH7760 AC97 sound support"
-	depends on CPU_SUBTYPE_SH7760 && SND_SOC_PCM_SH7760
-	select SND_SOC_SH4_HAC
-	select SND_SOC_AC97_CODEC
-	help
-	  This option enables generic sound support for the first
-	  AC97 unit of the SH7760.
-
-config SND_SIU_MIGOR
-	tristate "SIU sound support on Migo-R"
-	depends on SH_MIGOR && I2C
-	select SND_SOC_SH4_SIU
-	select SND_SOC_WM8978
-	help
-	  This option enables sound support for the SH7722 Migo-R board
-
 endmenu
diff --git a/sound/soc/sh/Makefile b/sound/soc/sh/Makefile
index f6fd79948f6ae9..c308dda887e633 100644
--- a/sound/soc/sh/Makefile
+++ b/sound/soc/sh/Makefile
@@ -1,28 +1,12 @@
 # SPDX-License-Identifier: GPL-2.0
-## DMA engines
-snd-soc-dma-sh7760-objs	:= dma-sh7760.o
-obj-$(CONFIG_SND_SOC_PCM_SH7760)	+= snd-soc-dma-sh7760.o
 
 ## audio units found on some SH-4
-snd-soc-hac-objs	:= hac.o
-snd-soc-ssi-objs	:= ssi.o
 snd-soc-fsi-objs	:= fsi.o
-snd-soc-siu-objs	:= siu_pcm.o siu_dai.o
-obj-$(CONFIG_SND_SOC_SH4_HAC)	+= snd-soc-hac.o
-obj-$(CONFIG_SND_SOC_SH4_SSI)	+= snd-soc-ssi.o
 obj-$(CONFIG_SND_SOC_SH4_FSI)	+= snd-soc-fsi.o
-obj-$(CONFIG_SND_SOC_SH4_SIU)	+= snd-soc-siu.o
 
 ## audio units for R-Car
 obj-$(CONFIG_SND_SOC_RCAR)	+= rcar/
 
-## boards
-snd-soc-sh7760-ac97-objs	:= sh7760-ac97.o
-snd-soc-migor-objs		:= migor.o
-
-obj-$(CONFIG_SND_SH7760_AC97)	+= snd-soc-sh7760-ac97.o
-obj-$(CONFIG_SND_SIU_MIGOR)	+= snd-soc-migor.o
-
 # RZ/G2L
 snd-soc-rz-ssi-objs		:= rz-ssi.o
 obj-$(CONFIG_SND_SOC_RZ)	+= snd-soc-rz-ssi.o
diff --git a/sound/soc/sh/dma-sh7760.c b/sound/soc/sh/dma-sh7760.c
deleted file mode 100644
index 121e48f984c50c..00000000000000
--- a/sound/soc/sh/dma-sh7760.c
+++ /dev/null
@@ -1,334 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// SH7760 ("camelot") DMABRG audio DMA unit support
-//
-// Copyright (C) 2007 Manuel Lauss <mano@roarinelk.homelinux.net>
-//
-// The SH7760 DMABRG provides 4 dma channels (2x rec, 2x play), which
-// trigger an interrupt when one half of the programmed transfer size
-// has been xmitted.
-//
-// FIXME: little-endian only for now
-
-#include <linux/module.h>
-#include <linux/gfp.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/dma-mapping.h>
-#include <sound/core.h>
-#include <sound/pcm.h>
-#include <sound/pcm_params.h>
-#include <sound/soc.h>
-#include <asm/dmabrg.h>
-
-
-/* registers and bits */
-#define BRGATXSAR	0x00
-#define BRGARXDAR	0x04
-#define BRGATXTCR	0x08
-#define BRGARXTCR	0x0C
-#define BRGACR		0x10
-#define BRGATXTCNT	0x14
-#define BRGARXTCNT	0x18
-
-#define ACR_RAR		(1 << 18)
-#define ACR_RDS		(1 << 17)
-#define ACR_RDE		(1 << 16)
-#define ACR_TAR		(1 << 2)
-#define ACR_TDS		(1 << 1)
-#define ACR_TDE		(1 << 0)
-
-/* receiver/transmitter data alignment */
-#define ACR_RAM_NONE	(0 << 24)
-#define ACR_RAM_4BYTE	(1 << 24)
-#define ACR_RAM_2WORD	(2 << 24)
-#define ACR_TAM_NONE	(0 << 8)
-#define ACR_TAM_4BYTE	(1 << 8)
-#define ACR_TAM_2WORD	(2 << 8)
-
-
-struct camelot_pcm {
-	unsigned long mmio;  /* DMABRG audio channel control reg MMIO */
-	unsigned int txid;    /* ID of first DMABRG IRQ for this unit */
-
-	struct snd_pcm_substream *tx_ss;
-	unsigned long tx_period_size;
-	unsigned int  tx_period;
-
-	struct snd_pcm_substream *rx_ss;
-	unsigned long rx_period_size;
-	unsigned int  rx_period;
-
-} cam_pcm_data[2] = {
-	{
-		.mmio	=	0xFE3C0040,
-		.txid	=	DMABRGIRQ_A0TXF,
-	},
-	{
-		.mmio	=	0xFE3C0060,
-		.txid	=	DMABRGIRQ_A1TXF,
-	},
-};
-
-#define BRGREG(x)	(*(unsigned long *)(cam->mmio + (x)))
-
-/*
- * set a minimum of 16kb per period, to avoid interrupt-"storm" and
- * resulting skipping. In general, the bigger the minimum size, the
- * better for overall system performance. (The SH7760 is a puny CPU
- * with a slow SDRAM interface and poor internal bus bandwidth,
- * *especially* when the LCDC is active).  The minimum for the DMAC
- * is 8 bytes; 16kbytes are enough to get skip-free playback of a
- * 44kHz/16bit/stereo MP3 on a lightly loaded system, and maintain
- * reasonable responsiveness in MPlayer.
- */
-#define DMABRG_PERIOD_MIN		16 * 1024
-#define DMABRG_PERIOD_MAX		0x03fffffc
-#define DMABRG_PREALLOC_BUFFER		32 * 1024
-#define DMABRG_PREALLOC_BUFFER_MAX	32 * 1024
-
-static const struct snd_pcm_hardware camelot_pcm_hardware = {
-	.info = (SNDRV_PCM_INFO_MMAP |
-		SNDRV_PCM_INFO_INTERLEAVED |
-		SNDRV_PCM_INFO_BLOCK_TRANSFER |
-		SNDRV_PCM_INFO_MMAP_VALID |
-		SNDRV_PCM_INFO_BATCH),
-	.buffer_bytes_max =	DMABRG_PERIOD_MAX,
-	.period_bytes_min =	DMABRG_PERIOD_MIN,
-	.period_bytes_max =	DMABRG_PERIOD_MAX / 2,
-	.periods_min =		2,
-	.periods_max =		2,
-	.fifo_size =		128,
-};
-
-static void camelot_txdma(void *data)
-{
-	struct camelot_pcm *cam = data;
-	cam->tx_period ^= 1;
-	snd_pcm_period_elapsed(cam->tx_ss);
-}
-
-static void camelot_rxdma(void *data)
-{
-	struct camelot_pcm *cam = data;
-	cam->rx_period ^= 1;
-	snd_pcm_period_elapsed(cam->rx_ss);
-}
-
-static int camelot_pcm_open(struct snd_soc_component *component,
-			    struct snd_pcm_substream *substream)
-{
-	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
-	struct camelot_pcm *cam = &cam_pcm_data[asoc_rtd_to_cpu(rtd, 0)->id];
-	int recv = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0:1;
-	int ret, dmairq;
-
-	snd_soc_set_runtime_hwparams(substream, &camelot_pcm_hardware);
-
-	/* DMABRG buffer half/full events */
-	dmairq = (recv) ? cam->txid + 2 : cam->txid;
-	if (recv) {
-		cam->rx_ss = substream;
-		ret = dmabrg_request_irq(dmairq, camelot_rxdma, cam);
-		if (unlikely(ret)) {
-			pr_debug("audio unit %d irqs already taken!\n",
-			     asoc_rtd_to_cpu(rtd, 0)->id);
-			return -EBUSY;
-		}
-		(void)dmabrg_request_irq(dmairq + 1,camelot_rxdma, cam);
-	} else {
-		cam->tx_ss = substream;
-		ret = dmabrg_request_irq(dmairq, camelot_txdma, cam);
-		if (unlikely(ret)) {
-			pr_debug("audio unit %d irqs already taken!\n",
-			     asoc_rtd_to_cpu(rtd, 0)->id);
-			return -EBUSY;
-		}
-		(void)dmabrg_request_irq(dmairq + 1, camelot_txdma, cam);
-	}
-	return 0;
-}
-
-static int camelot_pcm_close(struct snd_soc_component *component,
-			     struct snd_pcm_substream *substream)
-{
-	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
-	struct camelot_pcm *cam = &cam_pcm_data[asoc_rtd_to_cpu(rtd, 0)->id];
-	int recv = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0:1;
-	int dmairq;
-
-	dmairq = (recv) ? cam->txid + 2 : cam->txid;
-
-	if (recv)
-		cam->rx_ss = NULL;
-	else
-		cam->tx_ss = NULL;
-
-	dmabrg_free_irq(dmairq + 1);
-	dmabrg_free_irq(dmairq);
-
-	return 0;
-}
-
-static int camelot_hw_params(struct snd_soc_component *component,
-			     struct snd_pcm_substream *substream,
-			     struct snd_pcm_hw_params *hw_params)
-{
-	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
-	struct camelot_pcm *cam = &cam_pcm_data[asoc_rtd_to_cpu(rtd, 0)->id];
-	int recv = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0:1;
-
-	if (recv) {
-		cam->rx_period_size = params_period_bytes(hw_params);
-		cam->rx_period = 0;
-	} else {
-		cam->tx_period_size = params_period_bytes(hw_params);
-		cam->tx_period = 0;
-	}
-	return 0;
-}
-
-static int camelot_prepare(struct snd_soc_component *component,
-			   struct snd_pcm_substream *substream)
-{
-	struct snd_pcm_runtime *runtime = substream->runtime;
-	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
-	struct camelot_pcm *cam = &cam_pcm_data[asoc_rtd_to_cpu(rtd, 0)->id];
-
-	pr_debug("PCM data: addr 0x%08lx len %d\n",
-		 (u32)runtime->dma_addr, runtime->dma_bytes);
- 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-		BRGREG(BRGATXSAR) = (unsigned long)runtime->dma_area;
-		BRGREG(BRGATXTCR) = runtime->dma_bytes;
-	} else {
-		BRGREG(BRGARXDAR) = (unsigned long)runtime->dma_area;
-		BRGREG(BRGARXTCR) = runtime->dma_bytes;
-	}
-
-	return 0;
-}
-
-static inline void dmabrg_play_dma_start(struct camelot_pcm *cam)
-{
-	unsigned long acr = BRGREG(BRGACR) & ~(ACR_TDS | ACR_RDS);
-	/* start DMABRG engine: XFER start, auto-addr-reload */
-	BRGREG(BRGACR) = acr | ACR_TDE | ACR_TAR | ACR_TAM_2WORD;
-}
-
-static inline void dmabrg_play_dma_stop(struct camelot_pcm *cam)
-{
-	unsigned long acr = BRGREG(BRGACR) & ~(ACR_TDS | ACR_RDS);
-	/* forcibly terminate data transmission */
-	BRGREG(BRGACR) = acr | ACR_TDS;
-}
-
-static inline void dmabrg_rec_dma_start(struct camelot_pcm *cam)
-{
-	unsigned long acr = BRGREG(BRGACR) & ~(ACR_TDS | ACR_RDS);
-	/* start DMABRG engine: recv start, auto-reload */
-	BRGREG(BRGACR) = acr | ACR_RDE | ACR_RAR | ACR_RAM_2WORD;
-}
-
-static inline void dmabrg_rec_dma_stop(struct camelot_pcm *cam)
-{
-	unsigned long acr = BRGREG(BRGACR) & ~(ACR_TDS | ACR_RDS);
-	/* forcibly terminate data receiver */
-	BRGREG(BRGACR) = acr | ACR_RDS;
-}
-
-static int camelot_trigger(struct snd_soc_component *component,
-			   struct snd_pcm_substream *substream, int cmd)
-{
-	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
-	struct camelot_pcm *cam = &cam_pcm_data[asoc_rtd_to_cpu(rtd, 0)->id];
-	int recv = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0:1;
-
-	switch (cmd) {
-	case SNDRV_PCM_TRIGGER_START:
-		if (recv)
-			dmabrg_rec_dma_start(cam);
-		else
-			dmabrg_play_dma_start(cam);
-		break;
-	case SNDRV_PCM_TRIGGER_STOP:
-		if (recv)
-			dmabrg_rec_dma_stop(cam);
-		else
-			dmabrg_play_dma_stop(cam);
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
-static snd_pcm_uframes_t camelot_pos(struct snd_soc_component *component,
-				     struct snd_pcm_substream *substream)
-{
-	struct snd_pcm_runtime *runtime = substream->runtime;
-	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
-	struct camelot_pcm *cam = &cam_pcm_data[asoc_rtd_to_cpu(rtd, 0)->id];
-	int recv = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0:1;
-	unsigned long pos;
-
-	/* cannot use the DMABRG pointer register: under load, by the
-	 * time ALSA comes around to read the register, it is already
-	 * far ahead (or worse, already done with the fragment) of the
-	 * position at the time the IRQ was triggered, which results in
-	 * fast-playback sound in my test application (ScummVM)
-	 */
-	if (recv)
-		pos = cam->rx_period ? cam->rx_period_size : 0;
-	else
-		pos = cam->tx_period ? cam->tx_period_size : 0;
-
-	return bytes_to_frames(runtime, pos);
-}
-
-static int camelot_pcm_new(struct snd_soc_component *component,
-			   struct snd_soc_pcm_runtime *rtd)
-{
-	struct snd_pcm *pcm = rtd->pcm;
-
-	/* dont use SNDRV_DMA_TYPE_DEV, since it will oops the SH kernel
-	 * in MMAP mode (i.e. aplay -M)
-	 */
-	snd_pcm_set_managed_buffer_all(pcm,
-		SNDRV_DMA_TYPE_CONTINUOUS,
-		NULL,
-		DMABRG_PREALLOC_BUFFER,	DMABRG_PREALLOC_BUFFER_MAX);
-
-	return 0;
-}
-
-static const struct snd_soc_component_driver sh7760_soc_component = {
-	.open		= camelot_pcm_open,
-	.close		= camelot_pcm_close,
-	.hw_params	= camelot_hw_params,
-	.prepare	= camelot_prepare,
-	.trigger	= camelot_trigger,
-	.pointer	= camelot_pos,
-	.pcm_construct	= camelot_pcm_new,
-};
-
-static int sh7760_soc_platform_probe(struct platform_device *pdev)
-{
-	return devm_snd_soc_register_component(&pdev->dev, &sh7760_soc_component,
-					       NULL, 0);
-}
-
-static struct platform_driver sh7760_pcm_driver = {
-	.driver = {
-			.name = "sh7760-pcm-audio",
-	},
-
-	.probe = sh7760_soc_platform_probe,
-};
-
-module_platform_driver(sh7760_pcm_driver);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("SH7760 Audio DMA (DMABRG) driver");
-MODULE_AUTHOR("Manuel Lauss <mano@roarinelk.homelinux.net>");
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index f3edc2e3d9d7c4..c599070f2210f4 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -1372,16 +1372,7 @@ static int fsi_dma_probe(struct fsi_priv *fsi, struct fsi_stream *io, struct dev
 {
 	int is_play = fsi_stream_is_play(fsi, io);
 
-#ifdef CONFIG_SUPERH
-	dma_cap_mask_t mask;
-	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
-
-	io->chan = dma_request_channel(mask, shdma_chan_filter,
-				       (void *)io->dma_id);
-#else
 	io->chan = dma_request_slave_channel(dev, is_play ? "tx" : "rx");
-#endif
 	if (io->chan) {
 		struct dma_slave_config cfg = {};
 		int ret;
diff --git a/sound/soc/sh/hac.c b/sound/soc/sh/hac.c
deleted file mode 100644
index 46d145cbaf2970..00000000000000
--- a/sound/soc/sh/hac.c
+++ /dev/null
@@ -1,345 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Hitachi Audio Controller (AC97) support for SH7760/SH7780
-//
-// Copyright (c) 2007 Manuel Lauss <mano@roarinelk.homelinux.net>
-//
-// dont forget to set IPSEL/OMSEL register bits (in your board code) to
-// enable HAC output pins!
-
-/* BIG FAT FIXME: although the SH7760 has 2 independent AC97 units, only
- * the FIRST can be used since ASoC does not pass any information to the
- * ac97_read/write() functions regarding WHICH unit to use.  You'll have
- * to edit the code a bit to use the other AC97 unit.		--mlau
- */
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/interrupt.h>
-#include <linux/wait.h>
-#include <linux/delay.h>
-#include <sound/core.h>
-#include <sound/pcm.h>
-#include <sound/ac97_codec.h>
-#include <sound/initval.h>
-#include <sound/soc.h>
-
-/* regs and bits */
-#define HACCR		0x08
-#define HACCSAR		0x20
-#define HACCSDR		0x24
-#define HACPCML		0x28
-#define HACPCMR		0x2C
-#define HACTIER		0x50
-#define	HACTSR		0x54
-#define HACRIER		0x58
-#define HACRSR		0x5C
-#define HACACR		0x60
-
-#define CR_CR		(1 << 15)	/* "codec-ready" indicator */
-#define CR_CDRT		(1 << 11)	/* cold reset */
-#define CR_WMRT		(1 << 10)	/* warm reset */
-#define CR_B9		(1 << 9)	/* the mysterious "bit 9" */
-#define CR_ST		(1 << 5)	/* AC97 link start bit */
-
-#define CSAR_RD		(1 << 19)	/* AC97 data read bit */
-#define CSAR_WR		(0)
-
-#define TSR_CMDAMT	(1 << 31)
-#define TSR_CMDDMT	(1 << 30)
-
-#define RSR_STARY	(1 << 22)
-#define RSR_STDRY	(1 << 21)
-
-#define ACR_DMARX16	(1 << 30)
-#define ACR_DMATX16	(1 << 29)
-#define ACR_TX12ATOM	(1 << 26)
-#define ACR_DMARX20	((1 << 24) | (1 << 22))
-#define ACR_DMATX20	((1 << 23) | (1 << 21))
-
-#define CSDR_SHIFT	4
-#define CSDR_MASK	(0xffff << CSDR_SHIFT)
-#define CSAR_SHIFT	12
-#define CSAR_MASK	(0x7f << CSAR_SHIFT)
-
-#define AC97_WRITE_RETRY	1
-#define AC97_READ_RETRY		5
-
-/* manual-suggested AC97 codec access timeouts (us) */
-#define TMO_E1	500	/* 21 < E1 < 1000 */
-#define TMO_E2	13	/* 13 < E2 */
-#define TMO_E3	21	/* 21 < E3 */
-#define TMO_E4	500	/* 21 < E4 < 1000 */
-
-struct hac_priv {
-	unsigned long mmio;	/* HAC base address */
-} hac_cpu_data[] = {
-#if defined(CONFIG_CPU_SUBTYPE_SH7760)
-	{
-		.mmio	= 0xFE240000,
-	},
-	{
-		.mmio	= 0xFE250000,
-	},
-#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
-	{
-		.mmio	= 0xFFE40000,
-	},
-#else
-#error "Unsupported SuperH SoC"
-#endif
-};
-
-#define HACREG(reg)	(*(unsigned long *)(hac->mmio + (reg)))
-
-/*
- * AC97 read/write flow as outlined in the SH7760 manual (pages 903-906)
- */
-static int hac_get_codec_data(struct hac_priv *hac, unsigned short r,
-			      unsigned short *v)
-{
-	unsigned int to1, to2, i;
-	unsigned short adr;
-
-	for (i = AC97_READ_RETRY; i; i--) {
-		*v = 0;
-		/* wait for HAC to receive something from the codec */
-		for (to1 = TMO_E4;
-		     to1 && !(HACREG(HACRSR) & RSR_STARY);
-		     --to1)
-			udelay(1);
-		for (to2 = TMO_E4; 
-		     to2 && !(HACREG(HACRSR) & RSR_STDRY);
-		     --to2)
-			udelay(1);
-
-		if (!to1 && !to2)
-			return 0;	/* codec comm is down */
-
-		adr = ((HACREG(HACCSAR) & CSAR_MASK) >> CSAR_SHIFT);
-		*v  = ((HACREG(HACCSDR) & CSDR_MASK) >> CSDR_SHIFT);
-
-		HACREG(HACRSR) &= ~(RSR_STDRY | RSR_STARY);
-
-		if (r == adr)
-			break;
-
-		/* manual says: wait at least 21 usec before retrying */
-		udelay(21);
-	}
-	HACREG(HACRSR) &= ~(RSR_STDRY | RSR_STARY);
-	return i;
-}
-
-static unsigned short hac_read_codec_aux(struct hac_priv *hac,
-					 unsigned short reg)
-{
-	unsigned short val;
-	unsigned int i, to;
-
-	for (i = AC97_READ_RETRY; i; i--) {
-		/* send_read_request */
-		local_irq_disable();
-		HACREG(HACTSR) &= ~(TSR_CMDAMT);
-		HACREG(HACCSAR) = (reg << CSAR_SHIFT) | CSAR_RD;
-		local_irq_enable();
-
-		for (to = TMO_E3;
-		     to && !(HACREG(HACTSR) & TSR_CMDAMT);
-		     --to)
-			udelay(1);
-
-		HACREG(HACTSR) &= ~TSR_CMDAMT;
-		val = 0;
-		if (hac_get_codec_data(hac, reg, &val) != 0)
-			break;
-	}
-
-	return i ? val : ~0;
-}
-
-static void hac_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
-			   unsigned short val)
-{
-	int unit_id = 0 /* ac97->private_data */;
-	struct hac_priv *hac = &hac_cpu_data[unit_id];
-	unsigned int i, to;
-	/* write_codec_aux */
-	for (i = AC97_WRITE_RETRY; i; i--) {
-		/* send_write_request */
-		local_irq_disable();
-		HACREG(HACTSR) &= ~(TSR_CMDDMT | TSR_CMDAMT);
-		HACREG(HACCSDR) = (val << CSDR_SHIFT);
-		HACREG(HACCSAR) = (reg << CSAR_SHIFT) & (~CSAR_RD);
-		local_irq_enable();
-
-		/* poll-wait for CMDAMT and CMDDMT */
-		for (to = TMO_E1;
-		     to && !(HACREG(HACTSR) & (TSR_CMDAMT|TSR_CMDDMT));
-		     --to)
-			udelay(1);
-
-		HACREG(HACTSR) &= ~(TSR_CMDAMT | TSR_CMDDMT);
-		if (to)
-			break;
-		/* timeout, try again */
-	}
-}
-
-static unsigned short hac_ac97_read(struct snd_ac97 *ac97,
-				    unsigned short reg)
-{
-	int unit_id = 0 /* ac97->private_data */;
-	struct hac_priv *hac = &hac_cpu_data[unit_id];
-	return hac_read_codec_aux(hac, reg);
-}
-
-static void hac_ac97_warmrst(struct snd_ac97 *ac97)
-{
-	int unit_id = 0 /* ac97->private_data */;
-	struct hac_priv *hac = &hac_cpu_data[unit_id];
-	unsigned int tmo;
-
-	HACREG(HACCR) = CR_WMRT | CR_ST | CR_B9;
-	msleep(10);
-	HACREG(HACCR) = CR_ST | CR_B9;
-	for (tmo = 1000; (tmo > 0) && !(HACREG(HACCR) & CR_CR); tmo--)
-		udelay(1);
-
-	if (!tmo)
-		printk(KERN_INFO "hac: reset: AC97 link down!\n");
-	/* settings this bit lets us have a conversation with codec */
-	HACREG(HACACR) |= ACR_TX12ATOM;
-}
-
-static void hac_ac97_coldrst(struct snd_ac97 *ac97)
-{
-	int unit_id = 0 /* ac97->private_data */;
-	struct hac_priv *hac;
-	hac = &hac_cpu_data[unit_id];
-
-	HACREG(HACCR) = 0;
-	HACREG(HACCR) = CR_CDRT | CR_ST | CR_B9;
-	msleep(10);
-	hac_ac97_warmrst(ac97);
-}
-
-static struct snd_ac97_bus_ops hac_ac97_ops = {
-	.read	= hac_ac97_read,
-	.write	= hac_ac97_write,
-	.reset	= hac_ac97_coldrst,
-	.warm_reset = hac_ac97_warmrst,
-};
-
-static int hac_hw_params(struct snd_pcm_substream *substream,
-			 struct snd_pcm_hw_params *params,
-			 struct snd_soc_dai *dai)
-{
-	struct hac_priv *hac = &hac_cpu_data[dai->id];
-	int d = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0 : 1;
-
-	switch (params->msbits) {
-	case 16:
-		HACREG(HACACR) |= d ?  ACR_DMARX16 :  ACR_DMATX16;
-		HACREG(HACACR) &= d ? ~ACR_DMARX20 : ~ACR_DMATX20;
-		break;
-	case 20:
-		HACREG(HACACR) &= d ? ~ACR_DMARX16 : ~ACR_DMATX16;
-		HACREG(HACACR) |= d ?  ACR_DMARX20 :  ACR_DMATX20;
-		break;
-	default:
-		pr_debug("hac: invalid depth %d bit\n", params->msbits);
-		return -EINVAL;
-		break;
-	}
-
-	return 0;
-}
-
-#define AC97_RATES	\
-	SNDRV_PCM_RATE_8000_192000
-
-#define AC97_FMTS	\
-	SNDRV_PCM_FMTBIT_S16_LE
-
-static const struct snd_soc_dai_ops hac_dai_ops = {
-	.hw_params	= hac_hw_params,
-};
-
-static struct snd_soc_dai_driver sh4_hac_dai[] = {
-{
-	.name			= "hac-dai.0",
-	.playback = {
-		.rates		= AC97_RATES,
-		.formats	= AC97_FMTS,
-		.channels_min	= 2,
-		.channels_max	= 2,
-	},
-	.capture = {
-		.rates		= AC97_RATES,
-		.formats	= AC97_FMTS,
-		.channels_min	= 2,
-		.channels_max	= 2,
-	},
-	.ops = &hac_dai_ops,
-},
-#ifdef CONFIG_CPU_SUBTYPE_SH7760
-{
-	.name			= "hac-dai.1",
-	.id			= 1,
-	.playback = {
-		.rates		= AC97_RATES,
-		.formats	= AC97_FMTS,
-		.channels_min	= 2,
-		.channels_max	= 2,
-	},
-	.capture = {
-		.rates		= AC97_RATES,
-		.formats	= AC97_FMTS,
-		.channels_min	= 2,
-		.channels_max	= 2,
-	},
-	.ops = &hac_dai_ops,
-
-},
-#endif
-};
-
-static const struct snd_soc_component_driver sh4_hac_component = {
-	.name			= "sh4-hac",
-	.legacy_dai_naming	= 1,
-};
-
-static int hac_soc_platform_probe(struct platform_device *pdev)
-{
-	int ret;
-
-	ret = snd_soc_set_ac97_ops(&hac_ac97_ops);
-	if (ret != 0)
-		return ret;
-
-	return devm_snd_soc_register_component(&pdev->dev, &sh4_hac_component,
-					  sh4_hac_dai, ARRAY_SIZE(sh4_hac_dai));
-}
-
-static int hac_soc_platform_remove(struct platform_device *pdev)
-{
-	snd_soc_set_ac97_ops(NULL);
-	return 0;
-}
-
-static struct platform_driver hac_pcm_driver = {
-	.driver = {
-			.name = "hac-pcm-audio",
-	},
-
-	.probe = hac_soc_platform_probe,
-	.remove = hac_soc_platform_remove,
-};
-
-module_platform_driver(hac_pcm_driver);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("SuperH onchip HAC (AC97) audio driver");
-MODULE_AUTHOR("Manuel Lauss <mano@roarinelk.homelinux.net>");
diff --git a/sound/soc/sh/migor.c b/sound/soc/sh/migor.c
deleted file mode 100644
index 7082c12d3bf238..00000000000000
--- a/sound/soc/sh/migor.c
+++ /dev/null
@@ -1,205 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// ALSA SoC driver for Migo-R
-//
-// Copyright (C) 2009-2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
-
-#include <linux/clkdev.h>
-#include <linux/device.h>
-#include <linux/firmware.h>
-#include <linux/module.h>
-
-#include <asm/clock.h>
-
-#include <cpu/sh7722.h>
-
-#include <sound/core.h>
-#include <sound/pcm.h>
-#include <sound/soc.h>
-
-#include "../codecs/wm8978.h"
-#include "siu.h"
-
-/* Default 8000Hz sampling frequency */
-static unsigned long codec_freq = 8000 * 512;
-
-static unsigned int use_count;
-
-/* External clock, sourced from the codec at the SIUMCKB pin */
-static unsigned long siumckb_recalc(struct clk *clk)
-{
-	return codec_freq;
-}
-
-static struct sh_clk_ops siumckb_clk_ops = {
-	.recalc = siumckb_recalc,
-};
-
-static struct clk siumckb_clk = {
-	.ops		= &siumckb_clk_ops,
-	.rate		= 0, /* initialised at run-time */
-};
-
-static struct clk_lookup *siumckb_lookup;
-
-static int migor_hw_params(struct snd_pcm_substream *substream,
-			   struct snd_pcm_hw_params *params)
-{
-	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
-	struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
-	int ret;
-	unsigned int rate = params_rate(params);
-
-	ret = snd_soc_dai_set_sysclk(codec_dai, WM8978_PLL, 13000000,
-				     SND_SOC_CLOCK_IN);
-	if (ret < 0)
-		return ret;
-
-	ret = snd_soc_dai_set_clkdiv(codec_dai, WM8978_OPCLKRATE, rate * 512);
-	if (ret < 0)
-		return ret;
-
-	codec_freq = rate * 512;
-	/*
-	 * This propagates the parent frequency change to children and
-	 * recalculates the frequency table
-	 */
-	clk_set_rate(&siumckb_clk, codec_freq);
-	dev_dbg(codec_dai->dev, "%s: configure %luHz\n", __func__, codec_freq);
-
-	ret = snd_soc_dai_set_sysclk(asoc_rtd_to_cpu(rtd, 0), SIU_CLKB_EXT,
-				     codec_freq / 2, SND_SOC_CLOCK_IN);
-
-	if (!ret)
-		use_count++;
-
-	return ret;
-}
-
-static int migor_hw_free(struct snd_pcm_substream *substream)
-{
-	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
-	struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
-
-	if (use_count) {
-		use_count--;
-
-		if (!use_count)
-			snd_soc_dai_set_sysclk(codec_dai, WM8978_PLL, 0,
-					       SND_SOC_CLOCK_IN);
-	} else {
-		dev_dbg(codec_dai->dev, "Unbalanced hw_free!\n");
-	}
-
-	return 0;
-}
-
-static const struct snd_soc_ops migor_dai_ops = {
-	.hw_params = migor_hw_params,
-	.hw_free = migor_hw_free,
-};
-
-static const struct snd_soc_dapm_widget migor_dapm_widgets[] = {
-	SND_SOC_DAPM_HP("Headphone", NULL),
-	SND_SOC_DAPM_MIC("Onboard Microphone", NULL),
-	SND_SOC_DAPM_MIC("External Microphone", NULL),
-};
-
-static const struct snd_soc_dapm_route audio_map[] = {
-	/* Headphone output connected to LHP/RHP, enable OUT4 for VMID */
-	{ "Headphone", NULL,  "OUT4 VMID" },
-	{ "OUT4 VMID", NULL,  "LHP" },
-	{ "OUT4 VMID", NULL,  "RHP" },
-
-	/* On-board microphone */
-	{ "RMICN", NULL, "Mic Bias" },
-	{ "RMICP", NULL, "Mic Bias" },
-	{ "Mic Bias", NULL, "Onboard Microphone" },
-
-	/* External microphone */
-	{ "LMICN", NULL, "Mic Bias" },
-	{ "LMICP", NULL, "Mic Bias" },
-	{ "Mic Bias", NULL, "External Microphone" },
-};
-
-/* migor digital audio interface glue - connects codec <--> CPU */
-SND_SOC_DAILINK_DEFS(wm8978,
-	DAILINK_COMP_ARRAY(COMP_CPU("siu-pcm-audio")),
-	DAILINK_COMP_ARRAY(COMP_CODEC("wm8978.0-001a", "wm8978-hifi")),
-	DAILINK_COMP_ARRAY(COMP_PLATFORM("siu-pcm-audio")));
-
-static struct snd_soc_dai_link migor_dai = {
-	.name = "wm8978",
-	.stream_name = "WM8978",
-	.dai_fmt = SND_SOC_DAIFMT_NB_IF | SND_SOC_DAIFMT_I2S |
-		   SND_SOC_DAIFMT_CBS_CFS,
-	.ops = &migor_dai_ops,
-	SND_SOC_DAILINK_REG(wm8978),
-};
-
-/* migor audio machine driver */
-static struct snd_soc_card snd_soc_migor = {
-	.name = "Migo-R",
-	.owner = THIS_MODULE,
-	.dai_link = &migor_dai,
-	.num_links = 1,
-
-	.dapm_widgets = migor_dapm_widgets,
-	.num_dapm_widgets = ARRAY_SIZE(migor_dapm_widgets),
-	.dapm_routes = audio_map,
-	.num_dapm_routes = ARRAY_SIZE(audio_map),
-};
-
-static struct platform_device *migor_snd_device;
-
-static int __init migor_init(void)
-{
-	int ret;
-
-	ret = clk_register(&siumckb_clk);
-	if (ret < 0)
-		return ret;
-
-	siumckb_lookup = clkdev_create(&siumckb_clk, "siumckb_clk", NULL);
-	if (!siumckb_lookup) {
-		ret = -ENOMEM;
-		goto eclkdevalloc;
-	}
-
-	/* Port number used on this machine: port B */
-	migor_snd_device = platform_device_alloc("soc-audio", 1);
-	if (!migor_snd_device) {
-		ret = -ENOMEM;
-		goto epdevalloc;
-	}
-
-	platform_set_drvdata(migor_snd_device, &snd_soc_migor);
-
-	ret = platform_device_add(migor_snd_device);
-	if (ret)
-		goto epdevadd;
-
-	return 0;
-
-epdevadd:
-	platform_device_put(migor_snd_device);
-epdevalloc:
-	clkdev_drop(siumckb_lookup);
-eclkdevalloc:
-	clk_unregister(&siumckb_clk);
-	return ret;
-}
-
-static void __exit migor_exit(void)
-{
-	clkdev_drop(siumckb_lookup);
-	clk_unregister(&siumckb_clk);
-	platform_device_unregister(migor_snd_device);
-}
-
-module_init(migor_init);
-module_exit(migor_exit);
-
-MODULE_AUTHOR("Guennadi Liakhovetski <g.liakhovetski@gmx.de>");
-MODULE_DESCRIPTION("ALSA SoC Migor");
-MODULE_LICENSE("GPL v2");
diff --git a/sound/soc/sh/sh7760-ac97.c b/sound/soc/sh/sh7760-ac97.c
deleted file mode 100644
index d267243a159ba6..00000000000000
--- a/sound/soc/sh/sh7760-ac97.c
+++ /dev/null
@@ -1,72 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Generic AC97 sound support for SH7760
-//
-// (c) 2007 Manuel Lauss
-
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/platform_device.h>
-#include <sound/core.h>
-#include <sound/pcm.h>
-#include <sound/soc.h>
-#include <asm/io.h>
-
-#define IPSEL 0xFE400034
-
-SND_SOC_DAILINK_DEFS(ac97,
-	DAILINK_COMP_ARRAY(COMP_CPU("hac-dai.0")),	/* HAC0 */
-	DAILINK_COMP_ARRAY(COMP_CODEC("ac97-codec", "ac97-hifi")),
-	DAILINK_COMP_ARRAY(COMP_PLATFORM("sh7760-pcm-audio")));
-
-static struct snd_soc_dai_link sh7760_ac97_dai = {
-	.name = "AC97",
-	.stream_name = "AC97 HiFi",
-	SND_SOC_DAILINK_REG(ac97),
-};
-
-static struct snd_soc_card sh7760_ac97_soc_machine  = {
-	.name = "SH7760 AC97",
-	.owner = THIS_MODULE,
-	.dai_link = &sh7760_ac97_dai,
-	.num_links = 1,
-};
-
-static struct platform_device *sh7760_ac97_snd_device;
-
-static int __init sh7760_ac97_init(void)
-{
-	int ret;
-	unsigned short ipsel;
-
-	/* enable both AC97 controllers in pinmux reg */
-	ipsel = __raw_readw(IPSEL);
-	__raw_writew(ipsel | (3 << 10), IPSEL);
-
-	ret = -ENOMEM;
-	sh7760_ac97_snd_device = platform_device_alloc("soc-audio", -1);
-	if (!sh7760_ac97_snd_device)
-		goto out;
-
-	platform_set_drvdata(sh7760_ac97_snd_device,
-			     &sh7760_ac97_soc_machine);
-	ret = platform_device_add(sh7760_ac97_snd_device);
-
-	if (ret)
-		platform_device_put(sh7760_ac97_snd_device);
-
-out:
-	return ret;
-}
-
-static void __exit sh7760_ac97_exit(void)
-{
-	platform_device_unregister(sh7760_ac97_snd_device);
-}
-
-module_init(sh7760_ac97_init);
-module_exit(sh7760_ac97_exit);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("Generic SH7760 AC97 sound machine");
-MODULE_AUTHOR("Manuel Lauss <mano@roarinelk.homelinux.net>");
diff --git a/sound/soc/sh/siu.h b/sound/soc/sh/siu.h
deleted file mode 100644
index a675c36fc9d956..00000000000000
--- a/sound/soc/sh/siu.h
+++ /dev/null
@@ -1,180 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-//
-// siu.h - ALSA SoC driver for Renesas SH7343, SH7722 SIU peripheral.
-//
-// Copyright (C) 2009-2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
-// Copyright (C) 2006 Carlos Munoz <carlos@kenati.com>
-
-#ifndef SIU_H
-#define SIU_H
-
-/* Common kernel and user-space firmware-building defines and types */
-
-#define YRAM0_SIZE		(0x0040 / 4)		/* 16 */
-#define YRAM1_SIZE		(0x0080 / 4)		/* 32 */
-#define YRAM2_SIZE		(0x0040 / 4)		/* 16 */
-#define YRAM3_SIZE		(0x0080 / 4)		/* 32 */
-#define YRAM4_SIZE		(0x0080 / 4)		/* 32 */
-#define YRAM_DEF_SIZE		(YRAM0_SIZE + YRAM1_SIZE + YRAM2_SIZE + \
-				 YRAM3_SIZE + YRAM4_SIZE)
-#define YRAM_FIR_SIZE		(0x0400 / 4)		/* 256 */
-#define YRAM_IIR_SIZE		(0x0200 / 4)		/* 128 */
-
-#define XRAM0_SIZE		(0x0400 / 4)		/* 256 */
-#define XRAM1_SIZE		(0x0200 / 4)		/* 128 */
-#define XRAM2_SIZE		(0x0200 / 4)		/* 128 */
-
-/* PRAM program array size */
-#define PRAM0_SIZE		(0x0100 / 4)		/* 64 */
-#define PRAM1_SIZE		((0x2000 - 0x0100) / 4)	/* 1984 */
-
-#include <linux/types.h>
-
-struct siu_spb_param {
-	__u32	ab1a;	/* input FIFO address */
-	__u32	ab0a;	/* output FIFO address */
-	__u32	dir;	/* 0=the ather except CPUOUTPUT, 1=CPUINPUT */
-	__u32	event;	/* SPB program starting conditions */
-	__u32	stfifo;	/* STFIFO register setting value */
-	__u32	trdat;	/* TRDAT register setting value */
-};
-
-struct siu_firmware {
-	__u32			yram_fir_coeff[YRAM_FIR_SIZE];
-	__u32			pram0[PRAM0_SIZE];
-	__u32			pram1[PRAM1_SIZE];
-	__u32			yram0[YRAM0_SIZE];
-	__u32			yram1[YRAM1_SIZE];
-	__u32			yram2[YRAM2_SIZE];
-	__u32			yram3[YRAM3_SIZE];
-	__u32			yram4[YRAM4_SIZE];
-	__u32			spbpar_num;
-	struct siu_spb_param	spbpar[32];
-};
-
-#ifdef __KERNEL__
-
-#include <linux/dmaengine.h>
-#include <linux/interrupt.h>
-#include <linux/io.h>
-#include <linux/sh_dma.h>
-
-#include <sound/core.h>
-#include <sound/pcm.h>
-#include <sound/soc.h>
-
-#define SIU_PERIOD_BYTES_MAX	8192		/* DMA transfer/period size */
-#define SIU_PERIOD_BYTES_MIN	256		/* DMA transfer/period size */
-#define SIU_PERIODS_MAX		64		/* Max periods in buffer */
-#define SIU_PERIODS_MIN		4		/* Min periods in buffer */
-#define SIU_BUFFER_BYTES_MAX	(SIU_PERIOD_BYTES_MAX * SIU_PERIODS_MAX)
-
-/* SIU ports: only one can be used at a time */
-enum {
-	SIU_PORT_A,
-	SIU_PORT_B,
-	SIU_PORT_NUM,
-};
-
-/* SIU clock configuration */
-enum {
-	SIU_CLKA_PLL,
-	SIU_CLKA_EXT,
-	SIU_CLKB_PLL,
-	SIU_CLKB_EXT
-};
-
-struct device;
-struct siu_info {
-	struct device		*dev;
-	int			port_id;
-	u32 __iomem		*pram;
-	u32 __iomem		*xram;
-	u32 __iomem		*yram;
-	u32 __iomem		*reg;
-	struct siu_firmware	fw;
-};
-
-struct siu_stream {
-	struct work_struct		work;
-	struct snd_pcm_substream	*substream;
-	snd_pcm_format_t		format;
-	size_t				buf_bytes;
-	size_t				period_bytes;
-	int				cur_period;	/* Period currently in dma */
-	u32				volume;
-	snd_pcm_sframes_t		xfer_cnt;	/* Number of frames */
-	u8				rw_flg;		/* transfer status */
-	/* DMA status */
-	struct dma_chan			*chan;		/* DMA channel */
-	struct dma_async_tx_descriptor	*tx_desc;
-	dma_cookie_t			cookie;
-	struct sh_dmae_slave		param;
-};
-
-struct siu_port {
-	unsigned long		play_cap;	/* Used to track full duplex */
-	struct snd_pcm		*pcm;
-	struct siu_stream	playback;
-	struct siu_stream	capture;
-	u32			stfifo;		/* STFIFO value from firmware */
-	u32			trdat;		/* TRDAT value from firmware */
-};
-
-extern struct siu_port *siu_ports[SIU_PORT_NUM];
-
-static inline struct siu_port *siu_port_info(struct snd_pcm_substream *substream)
-{
-	struct platform_device *pdev =
-		to_platform_device(substream->pcm->card->dev);
-	return siu_ports[pdev->id];
-}
-
-/* Register access */
-static inline void siu_write32(u32 __iomem *addr, u32 val)
-{
-	__raw_writel(val, addr);
-}
-
-static inline u32 siu_read32(u32 __iomem *addr)
-{
-	return __raw_readl(addr);
-}
-
-/* SIU registers */
-#define SIU_IFCTL	(0x000 / sizeof(u32))
-#define SIU_SRCTL	(0x004 / sizeof(u32))
-#define SIU_SFORM	(0x008 / sizeof(u32))
-#define SIU_CKCTL	(0x00c / sizeof(u32))
-#define SIU_TRDAT	(0x010 / sizeof(u32))
-#define SIU_STFIFO	(0x014 / sizeof(u32))
-#define SIU_DPAK	(0x01c / sizeof(u32))
-#define SIU_CKREV	(0x020 / sizeof(u32))
-#define SIU_EVNTC	(0x028 / sizeof(u32))
-#define SIU_SBCTL	(0x040 / sizeof(u32))
-#define SIU_SBPSET	(0x044 / sizeof(u32))
-#define SIU_SBFSTS	(0x068 / sizeof(u32))
-#define SIU_SBDVCA	(0x06c / sizeof(u32))
-#define SIU_SBDVCB	(0x070 / sizeof(u32))
-#define SIU_SBACTIV	(0x074 / sizeof(u32))
-#define SIU_DMAIA	(0x090 / sizeof(u32))
-#define SIU_DMAIB	(0x094 / sizeof(u32))
-#define SIU_DMAOA	(0x098 / sizeof(u32))
-#define SIU_DMAOB	(0x09c / sizeof(u32))
-#define SIU_DMAML	(0x0a0 / sizeof(u32))
-#define SIU_SPSTS	(0x0cc / sizeof(u32))
-#define SIU_SPCTL	(0x0d0 / sizeof(u32))
-#define SIU_BRGASEL	(0x100 / sizeof(u32))
-#define SIU_BRRA	(0x104 / sizeof(u32))
-#define SIU_BRGBSEL	(0x108 / sizeof(u32))
-#define SIU_BRRB	(0x10c / sizeof(u32))
-
-extern const struct snd_soc_component_driver siu_component;
-extern struct siu_info *siu_i2s_data;
-
-int siu_init_port(int port, struct siu_port **port_info, struct snd_card *card);
-void siu_free_port(struct siu_port *port_info);
-
-#endif
-
-#endif /* SIU_H */
diff --git a/sound/soc/sh/siu_dai.c b/sound/soc/sh/siu_dai.c
deleted file mode 100644
index f2a386fcd92e4d..00000000000000
--- a/sound/soc/sh/siu_dai.c
+++ /dev/null
@@ -1,799 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-//
-// siu_dai.c - ALSA SoC driver for Renesas SH7343, SH7722 SIU peripheral.
-//
-// Copyright (C) 2009-2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
-// Copyright (C) 2006 Carlos Munoz <carlos@kenati.com>
-
-#include <linux/delay.h>
-#include <linux/firmware.h>
-#include <linux/pm_runtime.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-
-#include <asm/clock.h>
-#include <asm/siu.h>
-
-#include <sound/control.h>
-#include <sound/soc.h>
-
-#include "siu.h"
-
-/* Board specifics */
-#if defined(CONFIG_CPU_SUBTYPE_SH7722)
-# define SIU_MAX_VOLUME		0x1000
-#else
-# define SIU_MAX_VOLUME		0x7fff
-#endif
-
-#define PRAM_SIZE	0x2000
-#define XRAM_SIZE	0x800
-#define YRAM_SIZE	0x800
-
-#define XRAM_OFFSET	0x4000
-#define YRAM_OFFSET	0x6000
-#define REG_OFFSET	0xc000
-
-#define PLAYBACK_ENABLED	1
-#define CAPTURE_ENABLED		2
-
-#define VOLUME_CAPTURE		0
-#define VOLUME_PLAYBACK		1
-#define DFLT_VOLUME_LEVEL	0x08000800
-
-/*
- * SPDIF is only available on port A and on some SIU implementations it is only
- * available for input. Due to the lack of hardware to test it, SPDIF is left
- * disabled in this driver version
- */
-struct format_flag {
-	u32	i2s;
-	u32	pcm;
-	u32	spdif;
-	u32	mask;
-};
-
-struct port_flag {
-	struct format_flag	playback;
-	struct format_flag	capture;
-};
-
-struct siu_info *siu_i2s_data;
-
-static struct port_flag siu_flags[SIU_PORT_NUM] = {
-	[SIU_PORT_A] = {
-		.playback = {
-			.i2s	= 0x50000000,
-			.pcm	= 0x40000000,
-			.spdif	= 0x80000000,	/* not on all SIU versions */
-			.mask	= 0xd0000000,
-		},
-		.capture = {
-			.i2s	= 0x05000000,
-			.pcm	= 0x04000000,
-			.spdif	= 0x08000000,
-			.mask	= 0x0d000000,
-		},
-	},
-	[SIU_PORT_B] = {
-		.playback = {
-			.i2s	= 0x00500000,
-			.pcm	= 0x00400000,
-			.spdif	= 0,		/* impossible - turn off */
-			.mask	= 0x00500000,
-		},
-		.capture = {
-			.i2s	= 0x00050000,
-			.pcm	= 0x00040000,
-			.spdif	= 0,		/* impossible - turn off */
-			.mask	= 0x00050000,
-		},
-	},
-};
-
-static void siu_dai_start(struct siu_port *port_info)
-{
-	struct siu_info *info = siu_i2s_data;
-	u32 __iomem *base = info->reg;
-
-	dev_dbg(port_info->pcm->card->dev, "%s\n", __func__);
-
-	/* Issue software reset to siu */
-	siu_write32(base + SIU_SRCTL, 0);
-
-	/* Wait for the reset to take effect */
-	udelay(1);
-
-	port_info->stfifo = 0;
-	port_info->trdat = 0;
-
-	/* portA, portB, SIU operate */
-	siu_write32(base + SIU_SRCTL, 0x301);
-
-	/* portA=256fs, portB=256fs */
-	siu_write32(base + SIU_CKCTL, 0x40400000);
-
-	/* portA's BRG does not divide SIUCKA */
-	siu_write32(base + SIU_BRGASEL, 0);
-	siu_write32(base + SIU_BRRA, 0);
-
-	/* portB's BRG divides SIUCKB by half */
-	siu_write32(base + SIU_BRGBSEL, 1);
-	siu_write32(base + SIU_BRRB, 0);
-
-	siu_write32(base + SIU_IFCTL, 0x44440000);
-
-	/* portA: 32 bit/fs, master; portB: 32 bit/fs, master */
-	siu_write32(base + SIU_SFORM, 0x0c0c0000);
-
-	/*
-	 * Volume levels: looks like the DSP firmware implements volume controls
-	 * differently from what's described in the datasheet
-	 */
-	siu_write32(base + SIU_SBDVCA, port_info->playback.volume);
-	siu_write32(base + SIU_SBDVCB, port_info->capture.volume);
-}
-
-static void siu_dai_stop(struct siu_port *port_info)
-{
-	struct siu_info *info = siu_i2s_data;
-	u32 __iomem *base = info->reg;
-
-	/* SIU software reset */
-	siu_write32(base + SIU_SRCTL, 0);
-}
-
-static void siu_dai_spbAselect(struct siu_port *port_info)
-{
-	struct siu_info *info = siu_i2s_data;
-	struct siu_firmware *fw = &info->fw;
-	u32 *ydef = fw->yram0;
-	u32 idx;
-
-	/* path A use */
-	if (!info->port_id)
-		idx = 1;		/* portA */
-	else
-		idx = 2;		/* portB */
-
-	ydef[0] = (fw->spbpar[idx].ab1a << 16) |
-		(fw->spbpar[idx].ab0a << 8) |
-		(fw->spbpar[idx].dir << 7) | 3;
-	ydef[1] = fw->yram0[1];	/* 0x03000300 */
-	ydef[2] = (16 / 2) << 24;
-	ydef[3] = fw->yram0[3];	/* 0 */
-	ydef[4] = fw->yram0[4];	/* 0 */
-	ydef[7] = fw->spbpar[idx].event;
-	port_info->stfifo |= fw->spbpar[idx].stfifo;
-	port_info->trdat |= fw->spbpar[idx].trdat;
-}
-
-static void siu_dai_spbBselect(struct siu_port *port_info)
-{
-	struct siu_info *info = siu_i2s_data;
-	struct siu_firmware *fw = &info->fw;
-	u32 *ydef = fw->yram0;
-	u32 idx;
-
-	/* path B use */
-	if (!info->port_id)
-		idx = 7;		/* portA */
-	else
-		idx = 8;		/* portB */
-
-	ydef[5] = (fw->spbpar[idx].ab1a << 16) |
-		(fw->spbpar[idx].ab0a << 8) | 1;
-	ydef[6] = fw->spbpar[idx].event;
-	port_info->stfifo |= fw->spbpar[idx].stfifo;
-	port_info->trdat |= fw->spbpar[idx].trdat;
-}
-
-static void siu_dai_open(struct siu_stream *siu_stream)
-{
-	struct siu_info *info = siu_i2s_data;
-	u32 __iomem *base = info->reg;
-	u32 srctl, ifctl;
-
-	srctl = siu_read32(base + SIU_SRCTL);
-	ifctl = siu_read32(base + SIU_IFCTL);
-
-	switch (info->port_id) {
-	case SIU_PORT_A:
-		/* portA operates */
-		srctl |= 0x200;
-		ifctl &= ~0xc2;
-		break;
-	case SIU_PORT_B:
-		/* portB operates */
-		srctl |= 0x100;
-		ifctl &= ~0x31;
-		break;
-	}
-
-	siu_write32(base + SIU_SRCTL, srctl);
-	/* Unmute and configure portA */
-	siu_write32(base + SIU_IFCTL, ifctl);
-}
-
-/*
- * At the moment only fixed Left-upper, Left-lower, Right-upper, Right-lower
- * packing is supported
- */
-static void siu_dai_pcmdatapack(struct siu_stream *siu_stream)
-{
-	struct siu_info *info = siu_i2s_data;
-	u32 __iomem *base = info->reg;
-	u32 dpak;
-
-	dpak = siu_read32(base + SIU_DPAK);
-
-	switch (info->port_id) {
-	case SIU_PORT_A:
-		dpak &= ~0xc0000000;
-		break;
-	case SIU_PORT_B:
-		dpak &= ~0x00c00000;
-		break;
-	}
-
-	siu_write32(base + SIU_DPAK, dpak);
-}
-
-static int siu_dai_spbstart(struct siu_port *port_info)
-{
-	struct siu_info *info = siu_i2s_data;
-	u32 __iomem *base = info->reg;
-	struct siu_firmware *fw = &info->fw;
-	u32 *ydef = fw->yram0;
-	int cnt;
-	u32 __iomem *add;
-	u32 *ptr;
-
-	/* Load SPB Program in PRAM */
-	ptr = fw->pram0;
-	add = info->pram;
-	for (cnt = 0; cnt < PRAM0_SIZE; cnt++, add++, ptr++)
-		siu_write32(add, *ptr);
-
-	ptr = fw->pram1;
-	add = info->pram + (0x0100 / sizeof(u32));
-	for (cnt = 0; cnt < PRAM1_SIZE; cnt++, add++, ptr++)
-		siu_write32(add, *ptr);
-
-	/* XRAM initialization */
-	add = info->xram;
-	for (cnt = 0; cnt < XRAM0_SIZE + XRAM1_SIZE + XRAM2_SIZE; cnt++, add++)
-		siu_write32(add, 0);
-
-	/* YRAM variable area initialization */
-	add = info->yram;
-	for (cnt = 0; cnt < YRAM_DEF_SIZE; cnt++, add++)
-		siu_write32(add, ydef[cnt]);
-
-	/* YRAM FIR coefficient area initialization */
-	add = info->yram + (0x0200 / sizeof(u32));
-	for (cnt = 0; cnt < YRAM_FIR_SIZE; cnt++, add++)
-		siu_write32(add, fw->yram_fir_coeff[cnt]);
-
-	/* YRAM IIR coefficient area initialization */
-	add = info->yram + (0x0600 / sizeof(u32));
-	for (cnt = 0; cnt < YRAM_IIR_SIZE; cnt++, add++)
-		siu_write32(add, 0);
-
-	siu_write32(base + SIU_TRDAT, port_info->trdat);
-	port_info->trdat = 0x0;
-
-
-	/* SPB start condition: software */
-	siu_write32(base + SIU_SBACTIV, 0);
-	/* Start SPB */
-	siu_write32(base + SIU_SBCTL, 0xc0000000);
-	/* Wait for program to halt */
-	cnt = 0x10000;
-	while (--cnt && siu_read32(base + SIU_SBCTL) != 0x80000000)
-		cpu_relax();
-
-	if (!cnt)
-		return -EBUSY;
-
-	/* SPB program start address setting */
-	siu_write32(base + SIU_SBPSET, 0x00400000);
-	/* SPB hardware start(FIFOCTL source) */
-	siu_write32(base + SIU_SBACTIV, 0xc0000000);
-
-	return 0;
-}
-
-static void siu_dai_spbstop(struct siu_port *port_info)
-{
-	struct siu_info *info = siu_i2s_data;
-	u32 __iomem *base = info->reg;
-
-	siu_write32(base + SIU_SBACTIV, 0);
-	/* SPB stop */
-	siu_write32(base + SIU_SBCTL, 0);
-
-	port_info->stfifo = 0;
-}
-
-/*		API functions		*/
-
-/* Playback and capture hardware properties are identical */
-static const struct snd_pcm_hardware siu_dai_pcm_hw = {
-	.info			= SNDRV_PCM_INFO_INTERLEAVED,
-	.formats		= SNDRV_PCM_FMTBIT_S16,
-	.rates			= SNDRV_PCM_RATE_8000_48000,
-	.rate_min		= 8000,
-	.rate_max		= 48000,
-	.channels_min		= 2,
-	.channels_max		= 2,
-	.buffer_bytes_max	= SIU_BUFFER_BYTES_MAX,
-	.period_bytes_min	= SIU_PERIOD_BYTES_MIN,
-	.period_bytes_max	= SIU_PERIOD_BYTES_MAX,
-	.periods_min		= SIU_PERIODS_MIN,
-	.periods_max		= SIU_PERIODS_MAX,
-};
-
-static int siu_dai_info_volume(struct snd_kcontrol *kctrl,
-			       struct snd_ctl_elem_info *uinfo)
-{
-	struct siu_port *port_info = snd_kcontrol_chip(kctrl);
-
-	dev_dbg(port_info->pcm->card->dev, "%s\n", __func__);
-
-	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
-	uinfo->count = 2;
-	uinfo->value.integer.min = 0;
-	uinfo->value.integer.max = SIU_MAX_VOLUME;
-
-	return 0;
-}
-
-static int siu_dai_get_volume(struct snd_kcontrol *kctrl,
-			      struct snd_ctl_elem_value *ucontrol)
-{
-	struct siu_port *port_info = snd_kcontrol_chip(kctrl);
-	struct device *dev = port_info->pcm->card->dev;
-	u32 vol;
-
-	dev_dbg(dev, "%s\n", __func__);
-
-	switch (kctrl->private_value) {
-	case VOLUME_PLAYBACK:
-		/* Playback is always on port 0 */
-		vol = port_info->playback.volume;
-		ucontrol->value.integer.value[0] = vol & 0xffff;
-		ucontrol->value.integer.value[1] = vol >> 16 & 0xffff;
-		break;
-	case VOLUME_CAPTURE:
-		/* Capture is always on port 1 */
-		vol = port_info->capture.volume;
-		ucontrol->value.integer.value[0] = vol & 0xffff;
-		ucontrol->value.integer.value[1] = vol >> 16 & 0xffff;
-		break;
-	default:
-		dev_err(dev, "%s() invalid private_value=%ld\n",
-			__func__, kctrl->private_value);
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
-static int siu_dai_put_volume(struct snd_kcontrol *kctrl,
-			      struct snd_ctl_elem_value *ucontrol)
-{
-	struct siu_port *port_info = snd_kcontrol_chip(kctrl);
-	struct device *dev = port_info->pcm->card->dev;
-	struct siu_info *info = siu_i2s_data;
-	u32 __iomem *base = info->reg;
-	u32 new_vol;
-	u32 cur_vol;
-
-	dev_dbg(dev, "%s\n", __func__);
-
-	if (ucontrol->value.integer.value[0] < 0 ||
-	    ucontrol->value.integer.value[0] > SIU_MAX_VOLUME ||
-	    ucontrol->value.integer.value[1] < 0 ||
-	    ucontrol->value.integer.value[1] > SIU_MAX_VOLUME)
-		return -EINVAL;
-
-	new_vol = ucontrol->value.integer.value[0] |
-		ucontrol->value.integer.value[1] << 16;
-
-	/* See comment above - DSP firmware implementation */
-	switch (kctrl->private_value) {
-	case VOLUME_PLAYBACK:
-		/* Playback is always on port 0 */
-		cur_vol = port_info->playback.volume;
-		siu_write32(base + SIU_SBDVCA, new_vol);
-		port_info->playback.volume = new_vol;
-		break;
-	case VOLUME_CAPTURE:
-		/* Capture is always on port 1 */
-		cur_vol = port_info->capture.volume;
-		siu_write32(base + SIU_SBDVCB, new_vol);
-		port_info->capture.volume = new_vol;
-		break;
-	default:
-		dev_err(dev, "%s() invalid private_value=%ld\n",
-			__func__, kctrl->private_value);
-		return -EINVAL;
-	}
-
-	if (cur_vol != new_vol)
-		return 1;
-
-	return 0;
-}
-
-static const struct snd_kcontrol_new playback_controls = {
-	.iface		= SNDRV_CTL_ELEM_IFACE_MIXER,
-	.name		= "PCM Playback Volume",
-	.index		= 0,
-	.info		= siu_dai_info_volume,
-	.get		= siu_dai_get_volume,
-	.put		= siu_dai_put_volume,
-	.private_value	= VOLUME_PLAYBACK,
-};
-
-static const struct snd_kcontrol_new capture_controls = {
-	.iface		= SNDRV_CTL_ELEM_IFACE_MIXER,
-	.name		= "PCM Capture Volume",
-	.index		= 0,
-	.info		= siu_dai_info_volume,
-	.get		= siu_dai_get_volume,
-	.put		= siu_dai_put_volume,
-	.private_value	= VOLUME_CAPTURE,
-};
-
-int siu_init_port(int port, struct siu_port **port_info, struct snd_card *card)
-{
-	struct device *dev = card->dev;
-	struct snd_kcontrol *kctrl;
-	int ret;
-
-	*port_info = kzalloc(sizeof(**port_info), GFP_KERNEL);
-	if (!*port_info)
-		return -ENOMEM;
-
-	dev_dbg(dev, "%s: port #%d@%p\n", __func__, port, *port_info);
-
-	(*port_info)->playback.volume = DFLT_VOLUME_LEVEL;
-	(*port_info)->capture.volume = DFLT_VOLUME_LEVEL;
-
-	/*
-	 * Add mixer support. The SPB is used to change the volume. Both
-	 * ports use the same SPB. Therefore, we only register one
-	 * control instance since it will be used by both channels.
-	 * In error case we continue without controls.
-	 */
-	kctrl = snd_ctl_new1(&playback_controls, *port_info);
-	ret = snd_ctl_add(card, kctrl);
-	if (ret < 0)
-		dev_err(dev,
-			"failed to add playback controls %p port=%d err=%d\n",
-			kctrl, port, ret);
-
-	kctrl = snd_ctl_new1(&capture_controls, *port_info);
-	ret = snd_ctl_add(card, kctrl);
-	if (ret < 0)
-		dev_err(dev,
-			"failed to add capture controls %p port=%d err=%d\n",
-			kctrl, port, ret);
-
-	return 0;
-}
-
-void siu_free_port(struct siu_port *port_info)
-{
-	kfree(port_info);
-}
-
-static int siu_dai_startup(struct snd_pcm_substream *substream,
-			   struct snd_soc_dai *dai)
-{
-	struct siu_info *info = snd_soc_dai_get_drvdata(dai);
-	struct snd_pcm_runtime *rt = substream->runtime;
-	struct siu_port	*port_info = siu_port_info(substream);
-	int ret;
-
-	dev_dbg(substream->pcm->card->dev, "%s: port=%d@%p\n", __func__,
-		info->port_id, port_info);
-
-	snd_soc_set_runtime_hwparams(substream, &siu_dai_pcm_hw);
-
-	ret = snd_pcm_hw_constraint_integer(rt, SNDRV_PCM_HW_PARAM_PERIODS);
-	if (unlikely(ret < 0))
-		return ret;
-
-	siu_dai_start(port_info);
-
-	return 0;
-}
-
-static void siu_dai_shutdown(struct snd_pcm_substream *substream,
-			     struct snd_soc_dai *dai)
-{
-	struct siu_info *info = snd_soc_dai_get_drvdata(dai);
-	struct siu_port	*port_info = siu_port_info(substream);
-
-	dev_dbg(substream->pcm->card->dev, "%s: port=%d@%p\n", __func__,
-		info->port_id, port_info);
-
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-		port_info->play_cap &= ~PLAYBACK_ENABLED;
-	else
-		port_info->play_cap &= ~CAPTURE_ENABLED;
-
-	/* Stop the siu if the other stream is not using it */
-	if (!port_info->play_cap) {
-		/* during stmread or stmwrite ? */
-		if (WARN_ON(port_info->playback.rw_flg || port_info->capture.rw_flg))
-			return;
-		siu_dai_spbstop(port_info);
-		siu_dai_stop(port_info);
-	}
-}
-
-/* PCM part of siu_dai_playback_prepare() / siu_dai_capture_prepare() */
-static int siu_dai_prepare(struct snd_pcm_substream *substream,
-			   struct snd_soc_dai *dai)
-{
-	struct siu_info *info = snd_soc_dai_get_drvdata(dai);
-	struct snd_pcm_runtime *rt = substream->runtime;
-	struct siu_port *port_info = siu_port_info(substream);
-	struct siu_stream *siu_stream;
-	int self, ret;
-
-	dev_dbg(substream->pcm->card->dev,
-		"%s: port %d, active streams %lx, %d channels\n",
-		__func__, info->port_id, port_info->play_cap, rt->channels);
-
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-		self = PLAYBACK_ENABLED;
-		siu_stream = &port_info->playback;
-	} else {
-		self = CAPTURE_ENABLED;
-		siu_stream = &port_info->capture;
-	}
-
-	/* Set up the siu if not already done */
-	if (!port_info->play_cap) {
-		siu_stream->rw_flg = 0;	/* stream-data transfer flag */
-
-		siu_dai_spbAselect(port_info);
-		siu_dai_spbBselect(port_info);
-
-		siu_dai_open(siu_stream);
-
-		siu_dai_pcmdatapack(siu_stream);
-
-		ret = siu_dai_spbstart(port_info);
-		if (ret < 0)
-			goto fail;
-	} else {
-		ret = 0;
-	}
-
-	port_info->play_cap |= self;
-
-fail:
-	return ret;
-}
-
-/*
- * SIU can set bus format to I2S / PCM / SPDIF independently for playback and
- * capture, however, the current API sets the bus format globally for a DAI.
- */
-static int siu_dai_set_fmt(struct snd_soc_dai *dai,
-			   unsigned int fmt)
-{
-	struct siu_info *info = snd_soc_dai_get_drvdata(dai);
-	u32 __iomem *base = info->reg;
-	u32 ifctl;
-
-	dev_dbg(dai->dev, "%s: fmt 0x%x on port %d\n",
-		__func__, fmt, info->port_id);
-
-	if (info->port_id < 0)
-		return -ENODEV;
-
-	/* Here select between I2S / PCM / SPDIF */
-	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
-	case SND_SOC_DAIFMT_I2S:
-		ifctl = siu_flags[info->port_id].playback.i2s |
-			siu_flags[info->port_id].capture.i2s;
-		break;
-	case SND_SOC_DAIFMT_LEFT_J:
-		ifctl = siu_flags[info->port_id].playback.pcm |
-			siu_flags[info->port_id].capture.pcm;
-		break;
-	/* SPDIF disabled - see comment at the top */
-	default:
-		return -EINVAL;
-	}
-
-	ifctl |= ~(siu_flags[info->port_id].playback.mask |
-		   siu_flags[info->port_id].capture.mask) &
-		siu_read32(base + SIU_IFCTL);
-	siu_write32(base + SIU_IFCTL, ifctl);
-
-	return 0;
-}
-
-static int siu_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
-			      unsigned int freq, int dir)
-{
-	struct clk *siu_clk, *parent_clk;
-	char *siu_name, *parent_name;
-	int ret;
-
-	if (dir != SND_SOC_CLOCK_IN)
-		return -EINVAL;
-
-	dev_dbg(dai->dev, "%s: using clock %d\n", __func__, clk_id);
-
-	switch (clk_id) {
-	case SIU_CLKA_PLL:
-		siu_name = "siua_clk";
-		parent_name = "pll_clk";
-		break;
-	case SIU_CLKA_EXT:
-		siu_name = "siua_clk";
-		parent_name = "siumcka_clk";
-		break;
-	case SIU_CLKB_PLL:
-		siu_name = "siub_clk";
-		parent_name = "pll_clk";
-		break;
-	case SIU_CLKB_EXT:
-		siu_name = "siub_clk";
-		parent_name = "siumckb_clk";
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	siu_clk = clk_get(dai->dev, siu_name);
-	if (IS_ERR(siu_clk)) {
-		dev_err(dai->dev, "%s: cannot get a SIU clock: %ld\n", __func__,
-			PTR_ERR(siu_clk));
-		return PTR_ERR(siu_clk);
-	}
-
-	parent_clk = clk_get(dai->dev, parent_name);
-	if (IS_ERR(parent_clk)) {
-		ret = PTR_ERR(parent_clk);
-		dev_err(dai->dev, "cannot get a SIU clock parent: %d\n", ret);
-		goto epclkget;
-	}
-
-	ret = clk_set_parent(siu_clk, parent_clk);
-	if (ret < 0) {
-		dev_err(dai->dev, "cannot reparent the SIU clock: %d\n", ret);
-		goto eclksetp;
-	}
-
-	ret = clk_set_rate(siu_clk, freq);
-	if (ret < 0)
-		dev_err(dai->dev, "cannot set SIU clock rate: %d\n", ret);
-
-	/* TODO: when clkdev gets reference counting we'll move these to siu_dai_shutdown() */
-eclksetp:
-	clk_put(parent_clk);
-epclkget:
-	clk_put(siu_clk);
-
-	return ret;
-}
-
-static const struct snd_soc_dai_ops siu_dai_ops = {
-	.startup	= siu_dai_startup,
-	.shutdown	= siu_dai_shutdown,
-	.prepare	= siu_dai_prepare,
-	.set_sysclk	= siu_dai_set_sysclk,
-	.set_fmt	= siu_dai_set_fmt,
-};
-
-static struct snd_soc_dai_driver siu_i2s_dai = {
-	.name	= "siu-i2s-dai",
-	.playback = {
-		.channels_min = 2,
-		.channels_max = 2,
-		.formats = SNDRV_PCM_FMTBIT_S16,
-		.rates = SNDRV_PCM_RATE_8000_48000,
-	},
-	.capture = {
-		.channels_min = 2,
-		.channels_max = 2,
-		.formats = SNDRV_PCM_FMTBIT_S16,
-		.rates = SNDRV_PCM_RATE_8000_48000,
-	 },
-	.ops = &siu_dai_ops,
-};
-
-static int siu_probe(struct platform_device *pdev)
-{
-	const struct firmware *fw_entry;
-	struct resource *res, *region;
-	struct siu_info *info;
-	int ret;
-
-	info = devm_kmalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
-	if (!info)
-		return -ENOMEM;
-	siu_i2s_data = info;
-	info->dev = &pdev->dev;
-
-	ret = request_firmware(&fw_entry, "siu_spb.bin", &pdev->dev);
-	if (ret)
-		return ret;
-
-	/*
-	 * Loaded firmware is "const" - read only, but we have to modify it in
-	 * snd_siu_sh7343_spbAselect() and snd_siu_sh7343_spbBselect()
-	 */
-	memcpy(&info->fw, fw_entry->data, fw_entry->size);
-
-	release_firmware(fw_entry);
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -ENODEV;
-
-	region = devm_request_mem_region(&pdev->dev, res->start,
-					 resource_size(res), pdev->name);
-	if (!region) {
-		dev_err(&pdev->dev, "SIU region already claimed\n");
-		return -EBUSY;
-	}
-
-	info->pram = devm_ioremap(&pdev->dev, res->start, PRAM_SIZE);
-	if (!info->pram)
-		return -ENOMEM;
-	info->xram = devm_ioremap(&pdev->dev, res->start + XRAM_OFFSET,
-				  XRAM_SIZE);
-	if (!info->xram)
-		return -ENOMEM;
-	info->yram = devm_ioremap(&pdev->dev, res->start + YRAM_OFFSET,
-				  YRAM_SIZE);
-	if (!info->yram)
-		return -ENOMEM;
-	info->reg = devm_ioremap(&pdev->dev, res->start + REG_OFFSET,
-			    resource_size(res) - REG_OFFSET);
-	if (!info->reg)
-		return -ENOMEM;
-
-	dev_set_drvdata(&pdev->dev, info);
-
-	/* register using ARRAY version so we can keep dai name */
-	ret = devm_snd_soc_register_component(&pdev->dev, &siu_component,
-					      &siu_i2s_dai, 1);
-	if (ret < 0)
-		return ret;
-
-	pm_runtime_enable(&pdev->dev);
-
-	return 0;
-}
-
-static int siu_remove(struct platform_device *pdev)
-{
-	pm_runtime_disable(&pdev->dev);
-	return 0;
-}
-
-static struct platform_driver siu_driver = {
-	.driver 	= {
-		.name	= "siu-pcm-audio",
-	},
-	.probe		= siu_probe,
-	.remove		= siu_remove,
-};
-
-module_platform_driver(siu_driver);
-
-MODULE_AUTHOR("Carlos Munoz <carlos@kenati.com>");
-MODULE_DESCRIPTION("ALSA SoC SH7722 SIU driver");
-MODULE_LICENSE("GPL");
diff --git a/sound/soc/sh/siu_pcm.c b/sound/soc/sh/siu_pcm.c
deleted file mode 100644
index f15ff36e793455..00000000000000
--- a/sound/soc/sh/siu_pcm.c
+++ /dev/null
@@ -1,553 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-//
-// siu_pcm.c - ALSA driver for Renesas SH7343, SH7722 SIU peripheral.
-//
-// Copyright (C) 2009-2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
-// Copyright (C) 2006 Carlos Munoz <carlos@kenati.com>
-
-#include <linux/delay.h>
-#include <linux/dma-mapping.h>
-#include <linux/dmaengine.h>
-#include <linux/interrupt.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-
-#include <sound/control.h>
-#include <sound/core.h>
-#include <sound/pcm.h>
-#include <sound/pcm_params.h>
-#include <sound/soc.h>
-
-#include <asm/siu.h>
-
-#include "siu.h"
-
-#define DRV_NAME "siu-i2s"
-#define GET_MAX_PERIODS(buf_bytes, period_bytes) \
-				((buf_bytes) / (period_bytes))
-#define PERIOD_OFFSET(buf_addr, period_num, period_bytes) \
-				((buf_addr) + ((period_num) * (period_bytes)))
-
-#define RWF_STM_RD		0x01		/* Read in progress */
-#define RWF_STM_WT		0x02		/* Write in progress */
-
-struct siu_port *siu_ports[SIU_PORT_NUM];
-
-/* transfersize is number of u32 dma transfers per period */
-static int siu_pcm_stmwrite_stop(struct siu_port *port_info)
-{
-	struct siu_info *info = siu_i2s_data;
-	u32 __iomem *base = info->reg;
-	struct siu_stream *siu_stream = &port_info->playback;
-	u32 stfifo;
-
-	if (!siu_stream->rw_flg)
-		return -EPERM;
-
-	/* output FIFO disable */
-	stfifo = siu_read32(base + SIU_STFIFO);
-	siu_write32(base + SIU_STFIFO, stfifo & ~0x0c180c18);
-	pr_debug("%s: STFIFO %x -> %x\n", __func__,
-		 stfifo, stfifo & ~0x0c180c18);
-
-	/* during stmwrite clear */
-	siu_stream->rw_flg = 0;
-
-	return 0;
-}
-
-static int siu_pcm_stmwrite_start(struct siu_port *port_info)
-{
-	struct siu_stream *siu_stream = &port_info->playback;
-
-	if (siu_stream->rw_flg)
-		return -EPERM;
-
-	/* Current period in buffer */
-	port_info->playback.cur_period = 0;
-
-	/* during stmwrite flag set */
-	siu_stream->rw_flg = RWF_STM_WT;
-
-	/* DMA transfer start */
-	queue_work(system_highpri_wq, &siu_stream->work);
-
-	return 0;
-}
-
-static void siu_dma_tx_complete(void *arg)
-{
-	struct siu_stream *siu_stream = arg;
-
-	if (!siu_stream->rw_flg)
-		return;
-
-	/* Update completed period count */
-	if (++siu_stream->cur_period >=
-	    GET_MAX_PERIODS(siu_stream->buf_bytes,
-			    siu_stream->period_bytes))
-		siu_stream->cur_period = 0;
-
-	pr_debug("%s: done period #%d (%u/%u bytes), cookie %d\n",
-		__func__, siu_stream->cur_period,
-		siu_stream->cur_period * siu_stream->period_bytes,
-		siu_stream->buf_bytes, siu_stream->cookie);
-
-	queue_work(system_highpri_wq, &siu_stream->work);
-
-	/* Notify alsa: a period is done */
-	snd_pcm_period_elapsed(siu_stream->substream);
-}
-
-static int siu_pcm_wr_set(struct siu_port *port_info,
-			  dma_addr_t buff, u32 size)
-{
-	struct siu_info *info = siu_i2s_data;
-	u32 __iomem *base = info->reg;
-	struct siu_stream *siu_stream = &port_info->playback;
-	struct snd_pcm_substream *substream = siu_stream->substream;
-	struct device *dev = substream->pcm->card->dev;
-	struct dma_async_tx_descriptor *desc;
-	dma_cookie_t cookie;
-	struct scatterlist sg;
-	u32 stfifo;
-
-	sg_init_table(&sg, 1);
-	sg_set_page(&sg, pfn_to_page(PFN_DOWN(buff)),
-		    size, offset_in_page(buff));
-	sg_dma_len(&sg) = size;
-	sg_dma_address(&sg) = buff;
-
-	desc = dmaengine_prep_slave_sg(siu_stream->chan,
-		&sg, 1, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
-	if (!desc) {
-		dev_err(dev, "Failed to allocate a dma descriptor\n");
-		return -ENOMEM;
-	}
-
-	desc->callback = siu_dma_tx_complete;
-	desc->callback_param = siu_stream;
-	cookie = dmaengine_submit(desc);
-	if (cookie < 0) {
-		dev_err(dev, "Failed to submit a dma transfer\n");
-		return cookie;
-	}
-
-	siu_stream->tx_desc = desc;
-	siu_stream->cookie = cookie;
-
-	dma_async_issue_pending(siu_stream->chan);
-
-	/* only output FIFO enable */
-	stfifo = siu_read32(base + SIU_STFIFO);
-	siu_write32(base + SIU_STFIFO, stfifo | (port_info->stfifo & 0x0c180c18));
-	dev_dbg(dev, "%s: STFIFO %x -> %x\n", __func__,
-		stfifo, stfifo | (port_info->stfifo & 0x0c180c18));
-
-	return 0;
-}
-
-static int siu_pcm_rd_set(struct siu_port *port_info,
-			  dma_addr_t buff, size_t size)
-{
-	struct siu_info *info = siu_i2s_data;
-	u32 __iomem *base = info->reg;
-	struct siu_stream *siu_stream = &port_info->capture;
-	struct snd_pcm_substream *substream = siu_stream->substream;
-	struct device *dev = substream->pcm->card->dev;
-	struct dma_async_tx_descriptor *desc;
-	dma_cookie_t cookie;
-	struct scatterlist sg;
-	u32 stfifo;
-
-	dev_dbg(dev, "%s: %u@%llx\n", __func__, size, (unsigned long long)buff);
-
-	sg_init_table(&sg, 1);
-	sg_set_page(&sg, pfn_to_page(PFN_DOWN(buff)),
-		    size, offset_in_page(buff));
-	sg_dma_len(&sg) = size;
-	sg_dma_address(&sg) = buff;
-
-	desc = dmaengine_prep_slave_sg(siu_stream->chan,
-		&sg, 1, DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
-	if (!desc) {
-		dev_err(dev, "Failed to allocate dma descriptor\n");
-		return -ENOMEM;
-	}
-
-	desc->callback = siu_dma_tx_complete;
-	desc->callback_param = siu_stream;
-	cookie = dmaengine_submit(desc);
-	if (cookie < 0) {
-		dev_err(dev, "Failed to submit dma descriptor\n");
-		return cookie;
-	}
-
-	siu_stream->tx_desc = desc;
-	siu_stream->cookie = cookie;
-
-	dma_async_issue_pending(siu_stream->chan);
-
-	/* only input FIFO enable */
-	stfifo = siu_read32(base + SIU_STFIFO);
-	siu_write32(base + SIU_STFIFO, siu_read32(base + SIU_STFIFO) |
-		    (port_info->stfifo & 0x13071307));
-	dev_dbg(dev, "%s: STFIFO %x -> %x\n", __func__,
-		stfifo, stfifo | (port_info->stfifo & 0x13071307));
-
-	return 0;
-}
-
-static void siu_io_work(struct work_struct *work)
-{
-	struct siu_stream *siu_stream = container_of(work, struct siu_stream,
-						     work);
-	struct snd_pcm_substream *substream = siu_stream->substream;
-	struct device *dev = substream->pcm->card->dev;
-	struct snd_pcm_runtime *rt = substream->runtime;
-	struct siu_port *port_info = siu_port_info(substream);
-
-	dev_dbg(dev, "%s: flags %x\n", __func__, siu_stream->rw_flg);
-
-	if (!siu_stream->rw_flg) {
-		dev_dbg(dev, "%s: stream inactive\n", __func__);
-		return;
-	}
-
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
-		dma_addr_t buff;
-		size_t count;
-
-		buff = (dma_addr_t)PERIOD_OFFSET(rt->dma_addr,
-						siu_stream->cur_period,
-						siu_stream->period_bytes);
-		count = siu_stream->period_bytes;
-
-		/* DMA transfer start */
-		siu_pcm_rd_set(port_info, buff, count);
-	} else {
-		siu_pcm_wr_set(port_info,
-			       (dma_addr_t)PERIOD_OFFSET(rt->dma_addr,
-						siu_stream->cur_period,
-						siu_stream->period_bytes),
-			       siu_stream->period_bytes);
-	}
-}
-
-/* Capture */
-static int siu_pcm_stmread_start(struct siu_port *port_info)
-{
-	struct siu_stream *siu_stream = &port_info->capture;
-
-	if (siu_stream->xfer_cnt > 0x1000000)
-		return -EINVAL;
-	if (siu_stream->rw_flg)
-		return -EPERM;
-
-	/* Current period in buffer */
-	siu_stream->cur_period = 0;
-
-	/* during stmread flag set */
-	siu_stream->rw_flg = RWF_STM_RD;
-
-	queue_work(system_highpri_wq, &siu_stream->work);
-
-	return 0;
-}
-
-static int siu_pcm_stmread_stop(struct siu_port *port_info)
-{
-	struct siu_info *info = siu_i2s_data;
-	u32 __iomem *base = info->reg;
-	struct siu_stream *siu_stream = &port_info->capture;
-	struct device *dev = siu_stream->substream->pcm->card->dev;
-	u32 stfifo;
-
-	if (!siu_stream->rw_flg)
-		return -EPERM;
-
-	/* input FIFO disable */
-	stfifo = siu_read32(base + SIU_STFIFO);
-	siu_write32(base + SIU_STFIFO, stfifo & ~0x13071307);
-	dev_dbg(dev, "%s: STFIFO %x -> %x\n", __func__,
-		stfifo, stfifo & ~0x13071307);
-
-	/* during stmread flag clear */
-	siu_stream->rw_flg = 0;
-
-	return 0;
-}
-
-static bool filter(struct dma_chan *chan, void *secondary)
-{
-	struct sh_dmae_slave *param = secondary;
-
-	pr_debug("%s: secondary ID %d\n", __func__, param->shdma_slave.slave_id);
-
-	chan->private = &param->shdma_slave;
-	return true;
-}
-
-static int siu_pcm_open(struct snd_soc_component *component,
-			struct snd_pcm_substream *ss)
-{
-	/* Playback / Capture */
-	struct siu_platform *pdata = component->dev->platform_data;
-	struct siu_info *info = siu_i2s_data;
-	struct siu_port *port_info = siu_port_info(ss);
-	struct siu_stream *siu_stream;
-	u32 port = info->port_id;
-	struct device *dev = ss->pcm->card->dev;
-	dma_cap_mask_t mask;
-	struct sh_dmae_slave *param;
-
-	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
-
-	dev_dbg(dev, "%s, port=%d@%p\n", __func__, port, port_info);
-
-	if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-		siu_stream = &port_info->playback;
-		param = &siu_stream->param;
-		param->shdma_slave.slave_id = port ? pdata->dma_slave_tx_b :
-			pdata->dma_slave_tx_a;
-	} else {
-		siu_stream = &port_info->capture;
-		param = &siu_stream->param;
-		param->shdma_slave.slave_id = port ? pdata->dma_slave_rx_b :
-			pdata->dma_slave_rx_a;
-	}
-
-	/* Get DMA channel */
-	siu_stream->chan = dma_request_channel(mask, filter, param);
-	if (!siu_stream->chan) {
-		dev_err(dev, "DMA channel allocation failed!\n");
-		return -EBUSY;
-	}
-
-	siu_stream->substream = ss;
-
-	return 0;
-}
-
-static int siu_pcm_close(struct snd_soc_component *component,
-			 struct snd_pcm_substream *ss)
-{
-	struct siu_info *info = siu_i2s_data;
-	struct device *dev = ss->pcm->card->dev;
-	struct siu_port *port_info = siu_port_info(ss);
-	struct siu_stream *siu_stream;
-
-	dev_dbg(dev, "%s: port=%d\n", __func__, info->port_id);
-
-	if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
-		siu_stream = &port_info->playback;
-	else
-		siu_stream = &port_info->capture;
-
-	dma_release_channel(siu_stream->chan);
-	siu_stream->chan = NULL;
-
-	siu_stream->substream = NULL;
-
-	return 0;
-}
-
-static int siu_pcm_prepare(struct snd_soc_component *component,
-			   struct snd_pcm_substream *ss)
-{
-	struct siu_info *info = siu_i2s_data;
-	struct siu_port *port_info = siu_port_info(ss);
-	struct device *dev = ss->pcm->card->dev;
-	struct snd_pcm_runtime *rt;
-	struct siu_stream *siu_stream;
-	snd_pcm_sframes_t xfer_cnt;
-
-	if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
-		siu_stream = &port_info->playback;
-	else
-		siu_stream = &port_info->capture;
-
-	rt = siu_stream->substream->runtime;
-
-	siu_stream->buf_bytes = snd_pcm_lib_buffer_bytes(ss);
-	siu_stream->period_bytes = snd_pcm_lib_period_bytes(ss);
-
-	dev_dbg(dev, "%s: port=%d, %d channels, period=%u bytes\n", __func__,
-		info->port_id, rt->channels, siu_stream->period_bytes);
-
-	/* We only support buffers that are multiples of the period */
-	if (siu_stream->buf_bytes % siu_stream->period_bytes) {
-		dev_err(dev, "%s() - buffer=%d not multiple of period=%d\n",
-		       __func__, siu_stream->buf_bytes,
-		       siu_stream->period_bytes);
-		return -EINVAL;
-	}
-
-	xfer_cnt = bytes_to_frames(rt, siu_stream->period_bytes);
-	if (!xfer_cnt || xfer_cnt > 0x1000000)
-		return -EINVAL;
-
-	siu_stream->format = rt->format;
-	siu_stream->xfer_cnt = xfer_cnt;
-
-	dev_dbg(dev, "port=%d buf=%lx buf_bytes=%d period_bytes=%d "
-		"format=%d channels=%d xfer_cnt=%d\n", info->port_id,
-		(unsigned long)rt->dma_addr, siu_stream->buf_bytes,
-		siu_stream->period_bytes,
-		siu_stream->format, rt->channels, (int)xfer_cnt);
-
-	return 0;
-}
-
-static int siu_pcm_trigger(struct snd_soc_component *component,
-			   struct snd_pcm_substream *ss, int cmd)
-{
-	struct siu_info *info = siu_i2s_data;
-	struct device *dev = ss->pcm->card->dev;
-	struct siu_port *port_info = siu_port_info(ss);
-	int ret;
-
-	dev_dbg(dev, "%s: port=%d@%p, cmd=%d\n", __func__,
-		info->port_id, port_info, cmd);
-
-	switch (cmd) {
-	case SNDRV_PCM_TRIGGER_START:
-		if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
-			ret = siu_pcm_stmwrite_start(port_info);
-		else
-			ret = siu_pcm_stmread_start(port_info);
-
-		if (ret < 0)
-			dev_warn(dev, "%s: start failed on port=%d\n",
-				 __func__, info->port_id);
-
-		break;
-	case SNDRV_PCM_TRIGGER_STOP:
-		if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
-			siu_pcm_stmwrite_stop(port_info);
-		else
-			siu_pcm_stmread_stop(port_info);
-		ret = 0;
-
-		break;
-	default:
-		dev_err(dev, "%s() unsupported cmd=%d\n", __func__, cmd);
-		ret = -EINVAL;
-	}
-
-	return ret;
-}
-
-/*
- * So far only resolution of one period is supported, subject to extending the
- * dmangine API
- */
-static snd_pcm_uframes_t
-siu_pcm_pointer_dma(struct snd_soc_component *component,
-		    struct snd_pcm_substream *ss)
-{
-	struct device *dev = ss->pcm->card->dev;
-	struct siu_info *info = siu_i2s_data;
-	u32 __iomem *base = info->reg;
-	struct siu_port *port_info = siu_port_info(ss);
-	struct snd_pcm_runtime *rt = ss->runtime;
-	size_t ptr;
-	struct siu_stream *siu_stream;
-
-	if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
-		siu_stream = &port_info->playback;
-	else
-		siu_stream = &port_info->capture;
-
-	/*
-	 * ptr is the offset into the buffer where the dma is currently at. We
-	 * check if the dma buffer has just wrapped.
-	 */
-	ptr = PERIOD_OFFSET(rt->dma_addr,
-			    siu_stream->cur_period,
-			    siu_stream->period_bytes) - rt->dma_addr;
-
-	dev_dbg(dev,
-		"%s: port=%d, events %x, FSTS %x, xferred %u/%u, cookie %d\n",
-		__func__, info->port_id, siu_read32(base + SIU_EVNTC),
-		siu_read32(base + SIU_SBFSTS), ptr, siu_stream->buf_bytes,
-		siu_stream->cookie);
-
-	if (ptr >= siu_stream->buf_bytes)
-		ptr = 0;
-
-	return bytes_to_frames(ss->runtime, ptr);
-}
-
-static int siu_pcm_new(struct snd_soc_component *component,
-		       struct snd_soc_pcm_runtime *rtd)
-{
-	/* card->dev == socdev->dev, see snd_soc_new_pcms() */
-	struct snd_card *card = rtd->card->snd_card;
-	struct snd_pcm *pcm = rtd->pcm;
-	struct siu_info *info = siu_i2s_data;
-	struct platform_device *pdev = to_platform_device(card->dev);
-	int ret;
-	int i;
-
-	/* pdev->id selects between SIUA and SIUB */
-	if (pdev->id < 0 || pdev->id >= SIU_PORT_NUM)
-		return -EINVAL;
-
-	info->port_id = pdev->id;
-
-	/*
-	 * While the siu has 2 ports, only one port can be on at a time (only 1
-	 * SPB). So far all the boards using the siu had only one of the ports
-	 * wired to a codec. To simplify things, we only register one port with
-	 * alsa. In case both ports are needed, it should be changed here
-	 */
-	for (i = pdev->id; i < pdev->id + 1; i++) {
-		struct siu_port **port_info = &siu_ports[i];
-
-		ret = siu_init_port(i, port_info, card);
-		if (ret < 0)
-			return ret;
-
-		snd_pcm_set_managed_buffer_all(pcm,
-				SNDRV_DMA_TYPE_DEV, card->dev,
-				SIU_BUFFER_BYTES_MAX, SIU_BUFFER_BYTES_MAX);
-
-		(*port_info)->pcm = pcm;
-
-		/* IO works */
-		INIT_WORK(&(*port_info)->playback.work, siu_io_work);
-		INIT_WORK(&(*port_info)->capture.work, siu_io_work);
-	}
-
-	dev_info(card->dev, "SuperH SIU driver initialized.\n");
-	return 0;
-}
-
-static void siu_pcm_free(struct snd_soc_component *component,
-			 struct snd_pcm *pcm)
-{
-	struct platform_device *pdev = to_platform_device(pcm->card->dev);
-	struct siu_port *port_info = siu_ports[pdev->id];
-
-	cancel_work_sync(&port_info->capture.work);
-	cancel_work_sync(&port_info->playback.work);
-
-	siu_free_port(port_info);
-
-	dev_dbg(pcm->card->dev, "%s\n", __func__);
-}
-
-const struct snd_soc_component_driver siu_component = {
-	.name			= DRV_NAME,
-	.open			= siu_pcm_open,
-	.close			= siu_pcm_close,
-	.prepare		= siu_pcm_prepare,
-	.trigger		= siu_pcm_trigger,
-	.pointer		= siu_pcm_pointer_dma,
-	.pcm_construct		= siu_pcm_new,
-	.pcm_destruct		= siu_pcm_free,
-	.legacy_dai_naming	= 1,
-};
-EXPORT_SYMBOL_GPL(siu_component);
diff --git a/sound/soc/sh/ssi.c b/sound/soc/sh/ssi.c
deleted file mode 100644
index 96cf523c227343..00000000000000
--- a/sound/soc/sh/ssi.c
+++ /dev/null
@@ -1,403 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Serial Sound Interface (I2S) support for SH7760/SH7780
-//
-// Copyright (c) 2007 Manuel Lauss <mano@roarinelk.homelinux.net>
-//
-// dont forget to set IPSEL/OMSEL register bits (in your board code) to
-// enable SSI output pins!
-
-/*
- * LIMITATIONS:
- *	The SSI unit has only one physical data line, so full duplex is
- *	impossible.  This can be remedied  on the  SH7760 by  using the
- *	other SSI unit for recording; however the SH7780 has only 1 SSI
- *	unit, and its pins are shared with the AC97 unit,  among others.
- *
- * FEATURES:
- *	The SSI features "compressed mode": in this mode it continuously
- *	streams PCM data over the I2S lines and uses LRCK as a handshake
- *	signal.  Can be used to send compressed data (AC3/DTS) to a DSP.
- *	The number of bits sent over the wire in a frame can be adjusted
- *	and can be independent from the actual sample bit depth. This is
- *	useful to support TDM mode codecs like the AD1939 which have a
- *	fixed TDM slot size, regardless of sample resolution.
- */
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <sound/core.h>
-#include <sound/pcm.h>
-#include <sound/initval.h>
-#include <sound/soc.h>
-#include <asm/io.h>
-
-#define SSICR	0x00
-#define SSISR	0x04
-
-#define CR_DMAEN	(1 << 28)
-#define CR_CHNL_SHIFT	22
-#define CR_CHNL_MASK	(3 << CR_CHNL_SHIFT)
-#define CR_DWL_SHIFT	19
-#define CR_DWL_MASK	(7 << CR_DWL_SHIFT)
-#define CR_SWL_SHIFT	16
-#define CR_SWL_MASK	(7 << CR_SWL_SHIFT)
-#define CR_SCK_MASTER	(1 << 15)	/* bitclock master bit */
-#define CR_SWS_MASTER	(1 << 14)	/* wordselect master bit */
-#define CR_SCKP		(1 << 13)	/* I2Sclock polarity */
-#define CR_SWSP		(1 << 12)	/* LRCK polarity */
-#define CR_SPDP		(1 << 11)
-#define CR_SDTA		(1 << 10)	/* i2s alignment (msb/lsb) */
-#define CR_PDTA		(1 << 9)	/* fifo data alignment */
-#define CR_DEL		(1 << 8)	/* delay data by 1 i2sclk */
-#define CR_BREN		(1 << 7)	/* clock gating in burst mode */
-#define CR_CKDIV_SHIFT	4
-#define CR_CKDIV_MASK	(7 << CR_CKDIV_SHIFT)	/* bitclock divider */
-#define CR_MUTE		(1 << 3)	/* SSI mute */
-#define CR_CPEN		(1 << 2)	/* compressed mode */
-#define CR_TRMD		(1 << 1)	/* transmit/receive select */
-#define CR_EN		(1 << 0)	/* enable SSI */
-
-#define SSIREG(reg)	(*(unsigned long *)(ssi->mmio + (reg)))
-
-struct ssi_priv {
-	unsigned long mmio;
-	unsigned long sysclk;
-	int inuse;
-} ssi_cpu_data[] = {
-#if defined(CONFIG_CPU_SUBTYPE_SH7760)
-	{
-		.mmio	= 0xFE680000,
-	},
-	{
-		.mmio	= 0xFE690000,
-	},
-#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
-	{
-		.mmio	= 0xFFE70000,
-	},
-#else
-#error "Unsupported SuperH SoC"
-#endif
-};
-
-/*
- * track usage of the SSI; it is simplex-only so prevent attempts of
- * concurrent playback + capture. FIXME: any locking required?
- */
-static int ssi_startup(struct snd_pcm_substream *substream,
-		       struct snd_soc_dai *dai)
-{
-	struct ssi_priv *ssi = &ssi_cpu_data[dai->id];
-	if (ssi->inuse) {
-		pr_debug("ssi: already in use!\n");
-		return -EBUSY;
-	} else
-		ssi->inuse = 1;
-	return 0;
-}
-
-static void ssi_shutdown(struct snd_pcm_substream *substream,
-			 struct snd_soc_dai *dai)
-{
-	struct ssi_priv *ssi = &ssi_cpu_data[dai->id];
-
-	ssi->inuse = 0;
-}
-
-static int ssi_trigger(struct snd_pcm_substream *substream, int cmd,
-		       struct snd_soc_dai *dai)
-{
-	struct ssi_priv *ssi = &ssi_cpu_data[dai->id];
-
-	switch (cmd) {
-	case SNDRV_PCM_TRIGGER_START:
-		SSIREG(SSICR) |= CR_DMAEN | CR_EN;
-		break;
-	case SNDRV_PCM_TRIGGER_STOP:
-		SSIREG(SSICR) &= ~(CR_DMAEN | CR_EN);
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
-static int ssi_hw_params(struct snd_pcm_substream *substream,
-			 struct snd_pcm_hw_params *params,
-			 struct snd_soc_dai *dai)
-{
-	struct ssi_priv *ssi = &ssi_cpu_data[dai->id];
-	unsigned long ssicr = SSIREG(SSICR);
-	unsigned int bits, channels, swl, recv, i;
-
-	channels = params_channels(params);
-	bits = params->msbits;
-	recv = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? 0 : 1;
-
-	pr_debug("ssi_hw_params() enter\nssicr was    %08lx\n", ssicr);
-	pr_debug("bits: %u channels: %u\n", bits, channels);
-
-	ssicr &= ~(CR_TRMD | CR_CHNL_MASK | CR_DWL_MASK | CR_PDTA |
-		   CR_SWL_MASK);
-
-	/* direction (send/receive) */
-	if (!recv)
-		ssicr |= CR_TRMD;	/* transmit */
-
-	/* channels */
-	if ((channels < 2) || (channels > 8) || (channels & 1)) {
-		pr_debug("ssi: invalid number of channels\n");
-		return -EINVAL;
-	}
-	ssicr |= ((channels >> 1) - 1) << CR_CHNL_SHIFT;
-
-	/* DATA WORD LENGTH (DWL): databits in audio sample */
-	i = 0;
-	switch (bits) {
-	case 32: ++i;
-	case 24: ++i;
-	case 22: ++i;
-	case 20: ++i;
-	case 18: ++i;
-	case 16: ++i;
-		 ssicr |= i << CR_DWL_SHIFT;
-	case 8:	 break;
-	default:
-		pr_debug("ssi: invalid sample width\n");
-		return -EINVAL;
-	}
-
-	/*
-	 * SYSTEM WORD LENGTH: size in bits of half a frame over the I2S
-	 * wires. This is usually bits_per_sample x channels/2;  i.e. in
-	 * Stereo mode  the SWL equals DWL.  SWL can  be bigger than the
-	 * product of (channels_per_slot x samplebits), e.g.  for codecs
-	 * like the AD1939 which  only accept 32bit wide TDM slots.  For
-	 * "standard" I2S operation we set SWL = chans / 2 * DWL here.
-	 * Waiting for ASoC to get TDM support ;-)
-	 */
-	if ((bits > 16) && (bits <= 24)) {
-		bits = 24;	/* these are padded by the SSI */
-		/*ssicr |= CR_PDTA;*/ /* cpu/data endianness ? */
-	}
-	i = 0;
-	swl = (bits * channels) / 2;
-	switch (swl) {
-	case 256: ++i;
-	case 128: ++i;
-	case 64:  ++i;
-	case 48:  ++i;
-	case 32:  ++i;
-	case 16:  ++i;
-		  ssicr |= i << CR_SWL_SHIFT;
-	case 8:   break;
-	default:
-		pr_debug("ssi: invalid system word length computed\n");
-		return -EINVAL;
-	}
-
-	SSIREG(SSICR) = ssicr;
-
-	pr_debug("ssi_hw_params() leave\nssicr is now %08lx\n", ssicr);
-	return 0;
-}
-
-static int ssi_set_sysclk(struct snd_soc_dai *cpu_dai, int clk_id,
-			  unsigned int freq, int dir)
-{
-	struct ssi_priv *ssi = &ssi_cpu_data[cpu_dai->id];
-
-	ssi->sysclk = freq;
-
-	return 0;
-}
-
-/*
- * This divider is used to generate the SSI_SCK (I2S bitclock) from the
- * clock at the HAC_BIT_CLK ("oversampling clock") pin.
- */
-static int ssi_set_clkdiv(struct snd_soc_dai *dai, int did, int div)
-{
-	struct ssi_priv *ssi = &ssi_cpu_data[dai->id];
-	unsigned long ssicr;
-	int i;
-
-	i = 0;
-	ssicr = SSIREG(SSICR) & ~CR_CKDIV_MASK;
-	switch (div) {
-	case 16: ++i;
-	case 8:  ++i;
-	case 4:  ++i;
-	case 2:  ++i;
-		 SSIREG(SSICR) = ssicr | (i << CR_CKDIV_SHIFT);
-	case 1:  break;
-	default:
-		pr_debug("ssi: invalid sck divider %d\n", div);
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
-static int ssi_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
-{
-	struct ssi_priv *ssi = &ssi_cpu_data[dai->id];
-	unsigned long ssicr = SSIREG(SSICR);
-
-	pr_debug("ssi_set_fmt()\nssicr was    0x%08lx\n", ssicr);
-
-	ssicr &= ~(CR_DEL | CR_PDTA | CR_BREN | CR_SWSP | CR_SCKP |
-		   CR_SWS_MASTER | CR_SCK_MASTER);
-
-	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
-	case SND_SOC_DAIFMT_I2S:
-		break;
-	case SND_SOC_DAIFMT_RIGHT_J:
-		ssicr |= CR_DEL | CR_PDTA;
-		break;
-	case SND_SOC_DAIFMT_LEFT_J:
-		ssicr |= CR_DEL;
-		break;
-	default:
-		pr_debug("ssi: unsupported format\n");
-		return -EINVAL;
-	}
-
-	switch (fmt & SND_SOC_DAIFMT_CLOCK_MASK) {
-	case SND_SOC_DAIFMT_CONT:
-		break;
-	case SND_SOC_DAIFMT_GATED:
-		ssicr |= CR_BREN;
-		break;
-	}
-
-	switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
-	case SND_SOC_DAIFMT_NB_NF:
-		ssicr |= CR_SCKP;	/* sample data at low clkedge */
-		break;
-	case SND_SOC_DAIFMT_NB_IF:
-		ssicr |= CR_SCKP | CR_SWSP;
-		break;
-	case SND_SOC_DAIFMT_IB_NF:
-		break;
-	case SND_SOC_DAIFMT_IB_IF:
-		ssicr |= CR_SWSP;	/* word select starts low */
-		break;
-	default:
-		pr_debug("ssi: invalid inversion\n");
-		return -EINVAL;
-	}
-
-	switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
-	case SND_SOC_DAIFMT_BC_FC:
-		break;
-	case SND_SOC_DAIFMT_BP_FC:
-		ssicr |= CR_SCK_MASTER;
-		break;
-	case SND_SOC_DAIFMT_BC_FP:
-		ssicr |= CR_SWS_MASTER;
-		break;
-	case SND_SOC_DAIFMT_BP_FP:
-		ssicr |= CR_SWS_MASTER | CR_SCK_MASTER;
-		break;
-	default:
-		pr_debug("ssi: invalid master/secondary configuration\n");
-		return -EINVAL;
-	}
-
-	SSIREG(SSICR) = ssicr;
-	pr_debug("ssi_set_fmt() leave\nssicr is now 0x%08lx\n", ssicr);
-
-	return 0;
-}
-
-/* the SSI depends on an external clocksource (at HAC_BIT_CLK) even in
- * Master mode,  so really this is board specific;  the SSI can do any
- * rate with the right bitclk and divider settings.
- */
-#define SSI_RATES	\
-	SNDRV_PCM_RATE_8000_192000
-
-/* the SSI can do 8-32 bit samples, with 8 possible channels */
-#define SSI_FMTS	\
-	(SNDRV_PCM_FMTBIT_S8      | SNDRV_PCM_FMTBIT_U8      |	\
-	 SNDRV_PCM_FMTBIT_S16_LE  | SNDRV_PCM_FMTBIT_U16_LE  |	\
-	 SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_U20_3LE |	\
-	 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_U24_3LE |	\
-	 SNDRV_PCM_FMTBIT_S32_LE  | SNDRV_PCM_FMTBIT_U32_LE)
-
-static const struct snd_soc_dai_ops ssi_dai_ops = {
-	.startup	= ssi_startup,
-	.shutdown	= ssi_shutdown,
-	.trigger	= ssi_trigger,
-	.hw_params	= ssi_hw_params,
-	.set_sysclk	= ssi_set_sysclk,
-	.set_clkdiv	= ssi_set_clkdiv,
-	.set_fmt	= ssi_set_fmt,
-};
-
-static struct snd_soc_dai_driver sh4_ssi_dai[] = {
-{
-	.name			= "ssi-dai.0",
-	.playback = {
-		.rates		= SSI_RATES,
-		.formats	= SSI_FMTS,
-		.channels_min	= 2,
-		.channels_max	= 8,
-	},
-	.capture = {
-		.rates		= SSI_RATES,
-		.formats	= SSI_FMTS,
-		.channels_min	= 2,
-		.channels_max	= 8,
-	},
-	.ops = &ssi_dai_ops,
-},
-#ifdef CONFIG_CPU_SUBTYPE_SH7760
-{
-	.name			= "ssi-dai.1",
-	.playback = {
-		.rates		= SSI_RATES,
-		.formats	= SSI_FMTS,
-		.channels_min	= 2,
-		.channels_max	= 8,
-	},
-	.capture = {
-		.rates		= SSI_RATES,
-		.formats	= SSI_FMTS,
-		.channels_min	= 2,
-		.channels_max	= 8,
-	},
-	.ops = &ssi_dai_ops,
-},
-#endif
-};
-
-static const struct snd_soc_component_driver sh4_ssi_component = {
-	.name			= "sh4-ssi",
-	.legacy_dai_naming	= 1,
-};
-
-static int sh4_soc_dai_probe(struct platform_device *pdev)
-{
-	return devm_snd_soc_register_component(&pdev->dev, &sh4_ssi_component,
-					       sh4_ssi_dai,
-					       ARRAY_SIZE(sh4_ssi_dai));
-}
-
-static struct platform_driver sh4_ssi_driver = {
-	.driver = {
-			.name = "sh4-ssi-dai",
-	},
-
-	.probe = sh4_soc_dai_probe,
-};
-
-module_platform_driver(sh4_ssi_driver);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("SuperH onchip SSI (I2S) audio driver");
-MODULE_AUTHOR("Manuel Lauss <mano@roarinelk.homelinux.net>");
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 06/22] watchdog: remove the shwdt driver
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
                   ` (3 preceding siblings ...)
  2023-01-13  6:23 ` [PATCH 05/22] sound: remove sh-specific sounds/soc/sh drivers Christoph Hellwig
@ 2023-01-13  6:23 ` Christoph Hellwig
  2023-01-13 14:00   ` Guenter Roeck
  2023-01-13  6:23 ` [PATCH 07/22] cpufreq: remove the sh-cpufreq driver Christoph Hellwig
                   ` (16 subsequent siblings)
  21 siblings, 1 reply; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Now that arch/sh is removed this driver is dead code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 .../watchdog/watchdog-parameters.rst          |  12 -
 drivers/watchdog/Kconfig                      |  20 -
 drivers/watchdog/Makefile                     |   3 -
 drivers/watchdog/shwdt.c                      | 344 ------------------
 4 files changed, 379 deletions(-)
 delete mode 100644 drivers/watchdog/shwdt.c

diff --git a/Documentation/watchdog/watchdog-parameters.rst b/Documentation/watchdog/watchdog-parameters.rst
index 29153eed668900..553ac2f8ae23f7 100644
--- a/Documentation/watchdog/watchdog-parameters.rst
+++ b/Documentation/watchdog/watchdog-parameters.rst
@@ -579,18 +579,6 @@ scx200_wdt:
 
 -------------------------------------------------
 
-shwdt:
-    clock_division_ratio:
-	Clock division ratio. Valid ranges are from 0x5 (1.31ms)
-	to 0x7 (5.25ms). (default=7)
-    heartbeat:
-	Watchdog heartbeat in seconds. (1 <= heartbeat <= 3600, default=30
-    nowayout:
-	Watchdog cannot be stopped once started
-	(default=kernel config parameter)
-
--------------------------------------------------
-
 smsc37b787_wdt:
     timeout:
 	range is 1-255 units, default is 60
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 0bc40b763b0652..7db0a5e636cf65 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -2015,26 +2015,6 @@ config DIAG288_WATCHDOG
 	  To compile this driver as a module, choose M here. The module
 	  will be called diag288_wdt.
 
-# SUPERH (sh + sh64) Architecture
-
-config SH_WDT
-	tristate "SuperH Watchdog"
-	depends on SUPERH && (CPU_SH3 || CPU_SH4 || COMPILE_TEST)
-	select WATCHDOG_CORE
-	help
-	  This driver adds watchdog support for the integrated watchdog in the
-	  SuperH processors. If you have one of these processors and wish
-	  to have watchdog support enabled, say Y, otherwise say N.
-
-	  As a side note, saying Y here will automatically boost HZ to 1000
-	  so that the timer has a chance to clear the overflow counter. On
-	  slower systems (such as the SH-2 and SH-3) this will likely yield
-	  some performance issues. As such, the WDT should be avoided here
-	  unless it is absolutely necessary.
-
-	  To compile this driver as a module, choose M here: the
-	  module will be called shwdt.
-
 # SPARC Architecture
 
 # SPARC64 Architecture
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 9cbf6580f16c9f..a852ab4d7176ac 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -195,9 +195,6 @@ obj-$(CONFIG_WATCHDOG_RTAS) += wdrtas.o
 # S390 Architecture
 obj-$(CONFIG_DIAG288_WATCHDOG) += diag288_wdt.o
 
-# SUPERH (sh + sh64) Architecture
-obj-$(CONFIG_SH_WDT) += shwdt.o
-
 # SPARC Architecture
 
 # SPARC64 Architecture
diff --git a/drivers/watchdog/shwdt.c b/drivers/watchdog/shwdt.c
deleted file mode 100644
index f55533e0e0454e..00000000000000
--- a/drivers/watchdog/shwdt.c
+++ /dev/null
@@ -1,344 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * drivers/watchdog/shwdt.c
- *
- * Watchdog driver for integrated watchdog in the SuperH processors.
- *
- * Copyright (C) 2001 - 2012  Paul Mundt <lethal@linux-sh.org>
- *
- * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com>
- *     Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
- *
- * 19-Apr-2002 Rob Radez <rob@osinvestor.com>
- *     Added expect close support, made emulated timeout runtime changeable
- *     general cleanups, add some ioctls
- */
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/platform_device.h>
-#include <linux/init.h>
-#include <linux/types.h>
-#include <linux/spinlock.h>
-#include <linux/watchdog.h>
-#include <linux/pm_runtime.h>
-#include <linux/fs.h>
-#include <linux/mm.h>
-#include <linux/slab.h>
-#include <linux/io.h>
-#include <linux/clk.h>
-#include <linux/err.h>
-#include <asm/watchdog.h>
-
-#define DRV_NAME "sh-wdt"
-
-/*
- * Default clock division ratio is 5.25 msecs. For an additional table of
- * values, consult the asm-sh/watchdog.h. Overload this at module load
- * time.
- *
- * In order for this to work reliably we need to have HZ set to 1000 or
- * something quite higher than 100 (or we need a proper high-res timer
- * implementation that will deal with this properly), otherwise the 10ms
- * resolution of a jiffy is enough to trigger the overflow. For things like
- * the SH-4 and SH-5, this isn't necessarily that big of a problem, though
- * for the SH-2 and SH-3, this isn't recommended unless the WDT is absolutely
- * necssary.
- *
- * As a result of this timing problem, the only modes that are particularly
- * feasible are the 4096 and the 2048 divisors, which yield 5.25 and 2.62ms
- * overflow periods respectively.
- *
- * Also, since we can't really expect userspace to be responsive enough
- * before the overflow happens, we maintain two separate timers .. One in
- * the kernel for clearing out WOVF every 2ms or so (again, this depends on
- * HZ == 1000), and another for monitoring userspace writes to the WDT device.
- *
- * As such, we currently use a configurable heartbeat interval which defaults
- * to 30s. In this case, the userspace daemon is only responsible for periodic
- * writes to the device before the next heartbeat is scheduled. If the daemon
- * misses its deadline, the kernel timer will allow the WDT to overflow.
- */
-static int clock_division_ratio = WTCSR_CKS_4096;
-#define next_ping_period(cks)	(jiffies + msecs_to_jiffies(cks - 4))
-
-#define WATCHDOG_HEARTBEAT 30			/* 30 sec default heartbeat */
-static int heartbeat = WATCHDOG_HEARTBEAT;	/* in seconds */
-static bool nowayout = WATCHDOG_NOWAYOUT;
-static unsigned long next_heartbeat;
-
-struct sh_wdt {
-	void __iomem		*base;
-	struct device		*dev;
-	struct clk		*clk;
-	spinlock_t		lock;
-
-	struct timer_list	timer;
-};
-
-static int sh_wdt_start(struct watchdog_device *wdt_dev)
-{
-	struct sh_wdt *wdt = watchdog_get_drvdata(wdt_dev);
-	unsigned long flags;
-	u8 csr;
-
-	pm_runtime_get_sync(wdt->dev);
-	clk_enable(wdt->clk);
-
-	spin_lock_irqsave(&wdt->lock, flags);
-
-	next_heartbeat = jiffies + (heartbeat * HZ);
-	mod_timer(&wdt->timer, next_ping_period(clock_division_ratio));
-
-	csr = sh_wdt_read_csr();
-	csr |= WTCSR_WT | clock_division_ratio;
-	sh_wdt_write_csr(csr);
-
-	sh_wdt_write_cnt(0);
-
-	/*
-	 * These processors have a bit of an inconsistent initialization
-	 * process.. starting with SH-3, RSTS was moved to WTCSR, and the
-	 * RSTCSR register was removed.
-	 *
-	 * On the SH-2 however, in addition with bits being in different
-	 * locations, we must deal with RSTCSR outright..
-	 */
-	csr = sh_wdt_read_csr();
-	csr |= WTCSR_TME;
-	csr &= ~WTCSR_RSTS;
-	sh_wdt_write_csr(csr);
-
-#ifdef CONFIG_CPU_SH2
-	csr = sh_wdt_read_rstcsr();
-	csr &= ~RSTCSR_RSTS;
-	sh_wdt_write_rstcsr(csr);
-#endif
-	spin_unlock_irqrestore(&wdt->lock, flags);
-
-	return 0;
-}
-
-static int sh_wdt_stop(struct watchdog_device *wdt_dev)
-{
-	struct sh_wdt *wdt = watchdog_get_drvdata(wdt_dev);
-	unsigned long flags;
-	u8 csr;
-
-	spin_lock_irqsave(&wdt->lock, flags);
-
-	del_timer(&wdt->timer);
-
-	csr = sh_wdt_read_csr();
-	csr &= ~WTCSR_TME;
-	sh_wdt_write_csr(csr);
-
-	spin_unlock_irqrestore(&wdt->lock, flags);
-
-	clk_disable(wdt->clk);
-	pm_runtime_put_sync(wdt->dev);
-
-	return 0;
-}
-
-static int sh_wdt_keepalive(struct watchdog_device *wdt_dev)
-{
-	struct sh_wdt *wdt = watchdog_get_drvdata(wdt_dev);
-	unsigned long flags;
-
-	spin_lock_irqsave(&wdt->lock, flags);
-	next_heartbeat = jiffies + (heartbeat * HZ);
-	spin_unlock_irqrestore(&wdt->lock, flags);
-
-	return 0;
-}
-
-static int sh_wdt_set_heartbeat(struct watchdog_device *wdt_dev, unsigned t)
-{
-	struct sh_wdt *wdt = watchdog_get_drvdata(wdt_dev);
-	unsigned long flags;
-
-	if (unlikely(t < 1 || t > 3600)) /* arbitrary upper limit */
-		return -EINVAL;
-
-	spin_lock_irqsave(&wdt->lock, flags);
-	heartbeat = t;
-	wdt_dev->timeout = t;
-	spin_unlock_irqrestore(&wdt->lock, flags);
-
-	return 0;
-}
-
-static void sh_wdt_ping(struct timer_list *t)
-{
-	struct sh_wdt *wdt = from_timer(wdt, t, timer);
-	unsigned long flags;
-
-	spin_lock_irqsave(&wdt->lock, flags);
-	if (time_before(jiffies, next_heartbeat)) {
-		u8 csr;
-
-		csr = sh_wdt_read_csr();
-		csr &= ~WTCSR_IOVF;
-		sh_wdt_write_csr(csr);
-
-		sh_wdt_write_cnt(0);
-
-		mod_timer(&wdt->timer, next_ping_period(clock_division_ratio));
-	} else
-		dev_warn(wdt->dev, "Heartbeat lost! Will not ping "
-		         "the watchdog\n");
-	spin_unlock_irqrestore(&wdt->lock, flags);
-}
-
-static const struct watchdog_info sh_wdt_info = {
-	.options		= WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
-				  WDIOF_MAGICCLOSE,
-	.firmware_version	= 1,
-	.identity		= "SH WDT",
-};
-
-static const struct watchdog_ops sh_wdt_ops = {
-	.owner		= THIS_MODULE,
-	.start		= sh_wdt_start,
-	.stop		= sh_wdt_stop,
-	.ping		= sh_wdt_keepalive,
-	.set_timeout	= sh_wdt_set_heartbeat,
-};
-
-static struct watchdog_device sh_wdt_dev = {
-	.info	= &sh_wdt_info,
-	.ops	= &sh_wdt_ops,
-};
-
-static int sh_wdt_probe(struct platform_device *pdev)
-{
-	struct sh_wdt *wdt;
-	int rc;
-
-	/*
-	 * As this driver only covers the global watchdog case, reject
-	 * any attempts to register per-CPU watchdogs.
-	 */
-	if (pdev->id != -1)
-		return -EINVAL;
-
-	wdt = devm_kzalloc(&pdev->dev, sizeof(struct sh_wdt), GFP_KERNEL);
-	if (unlikely(!wdt))
-		return -ENOMEM;
-
-	wdt->dev = &pdev->dev;
-
-	wdt->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(wdt->clk)) {
-		/*
-		 * Clock framework support is optional, continue on
-		 * anyways if we don't find a matching clock.
-		 */
-		wdt->clk = NULL;
-	}
-
-	wdt->base = devm_platform_ioremap_resource(pdev, 0);
-	if (IS_ERR(wdt->base))
-		return PTR_ERR(wdt->base);
-
-	watchdog_set_nowayout(&sh_wdt_dev, nowayout);
-	watchdog_set_drvdata(&sh_wdt_dev, wdt);
-	sh_wdt_dev.parent = &pdev->dev;
-
-	spin_lock_init(&wdt->lock);
-
-	rc = sh_wdt_set_heartbeat(&sh_wdt_dev, heartbeat);
-	if (unlikely(rc)) {
-		/* Default timeout if invalid */
-		sh_wdt_set_heartbeat(&sh_wdt_dev, WATCHDOG_HEARTBEAT);
-
-		dev_warn(&pdev->dev,
-			 "heartbeat value must be 1<=x<=3600, using %d\n",
-			 sh_wdt_dev.timeout);
-	}
-
-	dev_info(&pdev->dev, "configured with heartbeat=%d sec (nowayout=%d)\n",
-		 sh_wdt_dev.timeout, nowayout);
-
-	rc = watchdog_register_device(&sh_wdt_dev);
-	if (unlikely(rc)) {
-		dev_err(&pdev->dev, "Can't register watchdog (err=%d)\n", rc);
-		return rc;
-	}
-
-	timer_setup(&wdt->timer, sh_wdt_ping, 0);
-	wdt->timer.expires	= next_ping_period(clock_division_ratio);
-
-	dev_info(&pdev->dev, "initialized.\n");
-
-	pm_runtime_enable(&pdev->dev);
-
-	return 0;
-}
-
-static int sh_wdt_remove(struct platform_device *pdev)
-{
-	watchdog_unregister_device(&sh_wdt_dev);
-
-	pm_runtime_disable(&pdev->dev);
-
-	return 0;
-}
-
-static void sh_wdt_shutdown(struct platform_device *pdev)
-{
-	sh_wdt_stop(&sh_wdt_dev);
-}
-
-static struct platform_driver sh_wdt_driver = {
-	.driver		= {
-		.name	= DRV_NAME,
-	},
-
-	.probe		= sh_wdt_probe,
-	.remove		= sh_wdt_remove,
-	.shutdown	= sh_wdt_shutdown,
-};
-
-static int __init sh_wdt_init(void)
-{
-	if (unlikely(clock_division_ratio < 0x5 ||
-		     clock_division_ratio > 0x7)) {
-		clock_division_ratio = WTCSR_CKS_4096;
-
-		pr_info("divisor must be 0x5<=x<=0x7, using %d\n",
-			clock_division_ratio);
-	}
-
-	return platform_driver_register(&sh_wdt_driver);
-}
-
-static void __exit sh_wdt_exit(void)
-{
-	platform_driver_unregister(&sh_wdt_driver);
-}
-module_init(sh_wdt_init);
-module_exit(sh_wdt_exit);
-
-MODULE_AUTHOR("Paul Mundt <lethal@linux-sh.org>");
-MODULE_DESCRIPTION("SuperH watchdog driver");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:" DRV_NAME);
-
-module_param(clock_division_ratio, int, 0);
-MODULE_PARM_DESC(clock_division_ratio,
-	"Clock division ratio. Valid ranges are from 0x5 (1.31ms) "
-	"to 0x7 (5.25ms). (default=" __MODULE_STRING(WTCSR_CKS_4096) ")");
-
-module_param(heartbeat, int, 0);
-MODULE_PARM_DESC(heartbeat,
-	"Watchdog heartbeat in seconds. (1 <= heartbeat <= 3600, default="
-				__MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
-
-module_param(nowayout, bool, 0);
-MODULE_PARM_DESC(nowayout,
-	"Watchdog cannot be stopped once started (default="
-				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 07/22] cpufreq: remove the sh-cpufreq driver
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
                   ` (4 preceding siblings ...)
  2023-01-13  6:23 ` [PATCH 06/22] watchdog: remove the shwdt driver Christoph Hellwig
@ 2023-01-13  6:23 ` Christoph Hellwig
  2023-01-13  6:23 ` [PATCH 08/22] dmaengine: remove the shdmac driver Christoph Hellwig
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Now that arch/sh is removed this driver is dead code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/cpufreq/Kconfig      |  14 ---
 drivers/cpufreq/Makefile     |   1 -
 drivers/cpufreq/sh-cpufreq.c | 175 -----------------------------------
 3 files changed, 190 deletions(-)
 delete mode 100644 drivers/cpufreq/sh-cpufreq.c

diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index 2a84fc63371e2e..75a7a486308d8c 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -298,20 +298,6 @@ config SPARC_US2E_CPUFREQ
 	  If in doubt, say N.
 endif
 
-if SUPERH
-config SH_CPU_FREQ
-	tristate "SuperH CPU Frequency driver"
-	help
-	  This adds the cpufreq driver for SuperH. Any CPU that supports
-	  clock rate rounding through the clock framework can use this
-	  driver. While it will make the kernel slightly larger, this is
-	  harmless for CPUs that don't support rate rounding. The driver
-	  will also generate a notice in the boot log before disabling
-	  itself if the CPU in question is not capable of rate rounding.
-
-	  If unsure, say N.
-endif
-
 config QORIQ_CPUFREQ
 	tristate "CPU frequency scaling driver for Freescale QorIQ SoCs"
 	depends on OF && COMMON_CLK
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index 32a7029e25ed81..9c16e77e3e87c0 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -112,6 +112,5 @@ obj-$(CONFIG_BMIPS_CPUFREQ)		+= bmips-cpufreq.o
 obj-$(CONFIG_IA64_ACPI_CPUFREQ)		+= ia64-acpi-cpufreq.o
 obj-$(CONFIG_LOONGSON2_CPUFREQ)		+= loongson2_cpufreq.o
 obj-$(CONFIG_LOONGSON1_CPUFREQ)		+= loongson1-cpufreq.o
-obj-$(CONFIG_SH_CPU_FREQ)		+= sh-cpufreq.o
 obj-$(CONFIG_SPARC_US2E_CPUFREQ)	+= sparc-us2e-cpufreq.o
 obj-$(CONFIG_SPARC_US3_CPUFREQ)		+= sparc-us3-cpufreq.o
diff --git a/drivers/cpufreq/sh-cpufreq.c b/drivers/cpufreq/sh-cpufreq.c
deleted file mode 100644
index b8704232c27b24..00000000000000
--- a/drivers/cpufreq/sh-cpufreq.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * cpufreq driver for the SuperH processors.
- *
- * Copyright (C) 2002 - 2012 Paul Mundt
- * Copyright (C) 2002 M. R. Brown
- *
- * Clock framework bits from arch/avr32/mach-at32ap/cpufreq.c
- *
- *   Copyright (C) 2004-2007 Atmel Corporation
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-#define pr_fmt(fmt) "cpufreq: " fmt
-
-#include <linux/types.h>
-#include <linux/cpufreq.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/err.h>
-#include <linux/cpumask.h>
-#include <linux/cpu.h>
-#include <linux/smp.h>
-#include <linux/clk.h>
-#include <linux/percpu.h>
-#include <linux/sh_clk.h>
-
-static DEFINE_PER_CPU(struct clk, sh_cpuclk);
-
-struct cpufreq_target {
-	struct cpufreq_policy	*policy;
-	unsigned int		freq;
-};
-
-static unsigned int sh_cpufreq_get(unsigned int cpu)
-{
-	return (clk_get_rate(&per_cpu(sh_cpuclk, cpu)) + 500) / 1000;
-}
-
-static long __sh_cpufreq_target(void *arg)
-{
-	struct cpufreq_target *target = arg;
-	struct cpufreq_policy *policy = target->policy;
-	int cpu = policy->cpu;
-	struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu);
-	struct cpufreq_freqs freqs;
-	struct device *dev;
-	long freq;
-
-	if (smp_processor_id() != cpu)
-		return -ENODEV;
-
-	dev = get_cpu_device(cpu);
-
-	/* Convert target_freq from kHz to Hz */
-	freq = clk_round_rate(cpuclk, target->freq * 1000);
-
-	if (freq < (policy->min * 1000) || freq > (policy->max * 1000))
-		return -EINVAL;
-
-	dev_dbg(dev, "requested frequency %u Hz\n", target->freq * 1000);
-
-	freqs.old	= sh_cpufreq_get(cpu);
-	freqs.new	= (freq + 500) / 1000;
-	freqs.flags	= 0;
-
-	cpufreq_freq_transition_begin(target->policy, &freqs);
-	clk_set_rate(cpuclk, freq);
-	cpufreq_freq_transition_end(target->policy, &freqs, 0);
-
-	dev_dbg(dev, "set frequency %lu Hz\n", freq);
-	return 0;
-}
-
-/*
- * Here we notify other drivers of the proposed change and the final change.
- */
-static int sh_cpufreq_target(struct cpufreq_policy *policy,
-			     unsigned int target_freq,
-			     unsigned int relation)
-{
-	struct cpufreq_target data = { .policy = policy, .freq = target_freq };
-
-	return work_on_cpu(policy->cpu, __sh_cpufreq_target, &data);
-}
-
-static int sh_cpufreq_verify(struct cpufreq_policy_data *policy)
-{
-	struct clk *cpuclk = &per_cpu(sh_cpuclk, policy->cpu);
-	struct cpufreq_frequency_table *freq_table;
-
-	freq_table = cpuclk->nr_freqs ? cpuclk->freq_table : NULL;
-	if (freq_table)
-		return cpufreq_frequency_table_verify(policy, freq_table);
-
-	cpufreq_verify_within_cpu_limits(policy);
-
-	policy->min = (clk_round_rate(cpuclk, 1) + 500) / 1000;
-	policy->max = (clk_round_rate(cpuclk, ~0UL) + 500) / 1000;
-
-	cpufreq_verify_within_cpu_limits(policy);
-	return 0;
-}
-
-static int sh_cpufreq_cpu_init(struct cpufreq_policy *policy)
-{
-	unsigned int cpu = policy->cpu;
-	struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu);
-	struct cpufreq_frequency_table *freq_table;
-	struct device *dev;
-
-	dev = get_cpu_device(cpu);
-
-	cpuclk = clk_get(dev, "cpu_clk");
-	if (IS_ERR(cpuclk)) {
-		dev_err(dev, "couldn't get CPU clk\n");
-		return PTR_ERR(cpuclk);
-	}
-
-	freq_table = cpuclk->nr_freqs ? cpuclk->freq_table : NULL;
-	if (freq_table) {
-		policy->freq_table = freq_table;
-	} else {
-		dev_notice(dev, "no frequency table found, falling back "
-			   "to rate rounding.\n");
-
-		policy->min = policy->cpuinfo.min_freq =
-			(clk_round_rate(cpuclk, 1) + 500) / 1000;
-		policy->max = policy->cpuinfo.max_freq =
-			(clk_round_rate(cpuclk, ~0UL) + 500) / 1000;
-	}
-
-	return 0;
-}
-
-static int sh_cpufreq_cpu_exit(struct cpufreq_policy *policy)
-{
-	unsigned int cpu = policy->cpu;
-	struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu);
-
-	clk_put(cpuclk);
-
-	return 0;
-}
-
-static struct cpufreq_driver sh_cpufreq_driver = {
-	.name		= "sh",
-	.flags		= CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING,
-	.get		= sh_cpufreq_get,
-	.target		= sh_cpufreq_target,
-	.verify		= sh_cpufreq_verify,
-	.init		= sh_cpufreq_cpu_init,
-	.exit		= sh_cpufreq_cpu_exit,
-	.attr		= cpufreq_generic_attr,
-};
-
-static int __init sh_cpufreq_module_init(void)
-{
-	pr_notice("SuperH CPU frequency driver.\n");
-	return cpufreq_register_driver(&sh_cpufreq_driver);
-}
-
-static void __exit sh_cpufreq_module_exit(void)
-{
-	cpufreq_unregister_driver(&sh_cpufreq_driver);
-}
-
-module_init(sh_cpufreq_module_init);
-module_exit(sh_cpufreq_module_exit);
-
-MODULE_AUTHOR("Paul Mundt <lethal@linux-sh.org>");
-MODULE_DESCRIPTION("cpufreq driver for SuperH");
-MODULE_LICENSE("GPL");
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 08/22] dmaengine: remove the shdmac driver
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
                   ` (5 preceding siblings ...)
  2023-01-13  6:23 ` [PATCH 07/22] cpufreq: remove the sh-cpufreq driver Christoph Hellwig
@ 2023-01-13  6:23 ` Christoph Hellwig
  2023-01-13  6:23 ` [PATCH 09/22] i2c: remove i2c-sh7760 Christoph Hellwig
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Now that arch/sh is removed this driver is dead code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/dma/sh/Kconfig      |   20 -
 drivers/dma/sh/Makefile     |   13 -
 drivers/dma/sh/shdma-base.c | 1052 -----------------------------------
 drivers/dma/sh/shdma.h      |   61 --
 drivers/dma/sh/shdmac.c     |  938 -------------------------------
 include/linux/shdma-base.h  |    4 -
 6 files changed, 2088 deletions(-)
 delete mode 100644 drivers/dma/sh/shdma-base.c
 delete mode 100644 drivers/dma/sh/shdma.h
 delete mode 100644 drivers/dma/sh/shdmac.c

diff --git a/drivers/dma/sh/Kconfig b/drivers/dma/sh/Kconfig
index c0b2997ab7fd93..744d4d8ff5353b 100644
--- a/drivers/dma/sh/Kconfig
+++ b/drivers/dma/sh/Kconfig
@@ -7,30 +7,10 @@ config RENESAS_DMA
 	bool
 	select DMA_ENGINE
 
-#
-# DMA Engine Helpers
-#
-
-config SH_DMAE_BASE
-	bool "Renesas SuperH DMA Engine support"
-	depends on SUPERH || COMPILE_TEST
-	depends on !SUPERH || SH_DMA
-	depends on !SH_DMA_API
-	default y
-	select RENESAS_DMA
-	help
-	  Enable support for the Renesas SuperH DMA controllers.
-
 #
 # DMA Controllers
 #
 
-config SH_DMAE
-	tristate "Renesas SuperH DMAC support"
-	depends on SH_DMAE_BASE
-	help
-	  Enable support for the Renesas SuperH DMA controllers.
-
 config RCAR_DMAC
 	tristate "Renesas R-Car Gen{2,3} and RZ/G{1,2} DMA Controller"
 	depends on ARCH_RENESAS || COMPILE_TEST
diff --git a/drivers/dma/sh/Makefile b/drivers/dma/sh/Makefile
index 360ab6d25e769d..07178651aa7279 100644
--- a/drivers/dma/sh/Makefile
+++ b/drivers/dma/sh/Makefile
@@ -1,17 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
-#
-# DMA Engine Helpers
-#
-
-obj-$(CONFIG_SH_DMAE_BASE) += shdma-base.o
-
-#
-# DMA Controllers
-#
-
-shdma-y := shdmac.o
-shdma-objs := $(shdma-y)
-obj-$(CONFIG_SH_DMAE) += shdma.o
 
 obj-$(CONFIG_RCAR_DMAC) += rcar-dmac.o
 obj-$(CONFIG_RENESAS_USB_DMAC) += usb-dmac.o
diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c
deleted file mode 100644
index 158e5e7defaeb0..00000000000000
--- a/drivers/dma/sh/shdma-base.c
+++ /dev/null
@@ -1,1052 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Dmaengine driver base library for DMA controllers, found on SH-based SoCs
- *
- * extracted from shdma.c
- *
- * Copyright (C) 2011-2012 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
- * Copyright (C) 2009 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
- * Copyright (C) 2009 Renesas Solutions, Inc. All rights reserved.
- * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
- */
-
-#include <linux/delay.h>
-#include <linux/shdma-base.h>
-#include <linux/dmaengine.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/module.h>
-#include <linux/pm_runtime.h>
-#include <linux/slab.h>
-#include <linux/spinlock.h>
-
-#include "../dmaengine.h"
-
-/* DMA descriptor control */
-enum shdma_desc_status {
-	DESC_IDLE,
-	DESC_PREPARED,
-	DESC_SUBMITTED,
-	DESC_COMPLETED,	/* completed, have to call callback */
-	DESC_WAITING,	/* callback called, waiting for ack / re-submit */
-};
-
-#define NR_DESCS_PER_CHANNEL 32
-
-#define to_shdma_chan(c) container_of(c, struct shdma_chan, dma_chan)
-#define to_shdma_dev(d) container_of(d, struct shdma_dev, dma_dev)
-
-/*
- * For slave DMA we assume, that there is a finite number of DMA slaves in the
- * system, and that each such slave can only use a finite number of channels.
- * We use slave channel IDs to make sure, that no such slave channel ID is
- * allocated more than once.
- */
-static unsigned int slave_num = 256;
-module_param(slave_num, uint, 0444);
-
-/* A bitmask with slave_num bits */
-static unsigned long *shdma_slave_used;
-
-/* Called under spin_lock_irq(&schan->chan_lock") */
-static void shdma_chan_xfer_ld_queue(struct shdma_chan *schan)
-{
-	struct shdma_dev *sdev = to_shdma_dev(schan->dma_chan.device);
-	const struct shdma_ops *ops = sdev->ops;
-	struct shdma_desc *sdesc;
-
-	/* DMA work check */
-	if (ops->channel_busy(schan))
-		return;
-
-	/* Find the first not transferred descriptor */
-	list_for_each_entry(sdesc, &schan->ld_queue, node)
-		if (sdesc->mark == DESC_SUBMITTED) {
-			ops->start_xfer(schan, sdesc);
-			break;
-		}
-}
-
-static dma_cookie_t shdma_tx_submit(struct dma_async_tx_descriptor *tx)
-{
-	struct shdma_desc *chunk, *c, *desc =
-		container_of(tx, struct shdma_desc, async_tx);
-	struct shdma_chan *schan = to_shdma_chan(tx->chan);
-	dma_async_tx_callback callback = tx->callback;
-	dma_cookie_t cookie;
-	bool power_up;
-
-	spin_lock_irq(&schan->chan_lock);
-
-	power_up = list_empty(&schan->ld_queue);
-
-	cookie = dma_cookie_assign(tx);
-
-	/* Mark all chunks of this descriptor as submitted, move to the queue */
-	list_for_each_entry_safe(chunk, c, desc->node.prev, node) {
-		/*
-		 * All chunks are on the global ld_free, so, we have to find
-		 * the end of the chain ourselves
-		 */
-		if (chunk != desc && (chunk->mark == DESC_IDLE ||
-				      chunk->async_tx.cookie > 0 ||
-				      chunk->async_tx.cookie == -EBUSY ||
-				      &chunk->node == &schan->ld_free))
-			break;
-		chunk->mark = DESC_SUBMITTED;
-		if (chunk->chunks == 1) {
-			chunk->async_tx.callback = callback;
-			chunk->async_tx.callback_param = tx->callback_param;
-		} else {
-			/* Callback goes to the last chunk */
-			chunk->async_tx.callback = NULL;
-		}
-		chunk->cookie = cookie;
-		list_move_tail(&chunk->node, &schan->ld_queue);
-
-		dev_dbg(schan->dev, "submit #%d@%p on %d\n",
-			tx->cookie, &chunk->async_tx, schan->id);
-	}
-
-	if (power_up) {
-		int ret;
-		schan->pm_state = SHDMA_PM_BUSY;
-
-		ret = pm_runtime_get(schan->dev);
-
-		spin_unlock_irq(&schan->chan_lock);
-		if (ret < 0)
-			dev_err(schan->dev, "%s(): GET = %d\n", __func__, ret);
-
-		pm_runtime_barrier(schan->dev);
-
-		spin_lock_irq(&schan->chan_lock);
-
-		/* Have we been reset, while waiting? */
-		if (schan->pm_state != SHDMA_PM_ESTABLISHED) {
-			struct shdma_dev *sdev =
-				to_shdma_dev(schan->dma_chan.device);
-			const struct shdma_ops *ops = sdev->ops;
-			dev_dbg(schan->dev, "Bring up channel %d\n",
-				schan->id);
-			/*
-			 * TODO: .xfer_setup() might fail on some platforms.
-			 * Make it int then, on error remove chunks from the
-			 * queue again
-			 */
-			ops->setup_xfer(schan, schan->slave_id);
-
-			if (schan->pm_state == SHDMA_PM_PENDING)
-				shdma_chan_xfer_ld_queue(schan);
-			schan->pm_state = SHDMA_PM_ESTABLISHED;
-		}
-	} else {
-		/*
-		 * Tell .device_issue_pending() not to run the queue, interrupts
-		 * will do it anyway
-		 */
-		schan->pm_state = SHDMA_PM_PENDING;
-	}
-
-	spin_unlock_irq(&schan->chan_lock);
-
-	return cookie;
-}
-
-/* Called with desc_lock held */
-static struct shdma_desc *shdma_get_desc(struct shdma_chan *schan)
-{
-	struct shdma_desc *sdesc;
-
-	list_for_each_entry(sdesc, &schan->ld_free, node)
-		if (sdesc->mark != DESC_PREPARED) {
-			BUG_ON(sdesc->mark != DESC_IDLE);
-			list_del(&sdesc->node);
-			return sdesc;
-		}
-
-	return NULL;
-}
-
-static int shdma_setup_slave(struct shdma_chan *schan, dma_addr_t slave_addr)
-{
-	struct shdma_dev *sdev = to_shdma_dev(schan->dma_chan.device);
-	const struct shdma_ops *ops = sdev->ops;
-	int ret, match;
-
-	if (schan->dev->of_node) {
-		match = schan->hw_req;
-		ret = ops->set_slave(schan, match, slave_addr, true);
-		if (ret < 0)
-			return ret;
-	} else {
-		match = schan->real_slave_id;
-	}
-
-	if (schan->real_slave_id < 0 || schan->real_slave_id >= slave_num)
-		return -EINVAL;
-
-	if (test_and_set_bit(schan->real_slave_id, shdma_slave_used))
-		return -EBUSY;
-
-	ret = ops->set_slave(schan, match, slave_addr, false);
-	if (ret < 0) {
-		clear_bit(schan->real_slave_id, shdma_slave_used);
-		return ret;
-	}
-
-	schan->slave_id = schan->real_slave_id;
-
-	return 0;
-}
-
-static int shdma_alloc_chan_resources(struct dma_chan *chan)
-{
-	struct shdma_chan *schan = to_shdma_chan(chan);
-	struct shdma_dev *sdev = to_shdma_dev(schan->dma_chan.device);
-	const struct shdma_ops *ops = sdev->ops;
-	struct shdma_desc *desc;
-	struct shdma_slave *slave = chan->private;
-	int ret, i;
-
-	/*
-	 * This relies on the guarantee from dmaengine that alloc_chan_resources
-	 * never runs concurrently with itself or free_chan_resources.
-	 */
-	if (slave) {
-		/* Legacy mode: .private is set in filter */
-		schan->real_slave_id = slave->slave_id;
-		ret = shdma_setup_slave(schan, 0);
-		if (ret < 0)
-			goto esetslave;
-	} else {
-		/* Normal mode: real_slave_id was set by filter */
-		schan->slave_id = -EINVAL;
-	}
-
-	schan->desc = kcalloc(NR_DESCS_PER_CHANNEL,
-			      sdev->desc_size, GFP_KERNEL);
-	if (!schan->desc) {
-		ret = -ENOMEM;
-		goto edescalloc;
-	}
-	schan->desc_num = NR_DESCS_PER_CHANNEL;
-
-	for (i = 0; i < NR_DESCS_PER_CHANNEL; i++) {
-		desc = ops->embedded_desc(schan->desc, i);
-		dma_async_tx_descriptor_init(&desc->async_tx,
-					     &schan->dma_chan);
-		desc->async_tx.tx_submit = shdma_tx_submit;
-		desc->mark = DESC_IDLE;
-
-		list_add(&desc->node, &schan->ld_free);
-	}
-
-	return NR_DESCS_PER_CHANNEL;
-
-edescalloc:
-	if (slave)
-esetslave:
-		clear_bit(slave->slave_id, shdma_slave_used);
-	chan->private = NULL;
-	return ret;
-}
-
-/*
- * This is the standard shdma filter function to be used as a replacement to the
- * "old" method, using the .private pointer.
- * You always have to pass a valid slave id as the argument, old drivers that
- * pass ERR_PTR(-EINVAL) as a filter parameter and set it up in dma_slave_config
- * need to be updated so we can remove the slave_id field from dma_slave_config.
- * parameter. If this filter is used, the slave driver, after calling
- * dma_request_channel(), will also have to call dmaengine_slave_config() with
- * .direction, and either .src_addr or .dst_addr set.
- *
- * NOTE: this filter doesn't support multiple DMAC drivers with the DMA_SLAVE
- * capability! If this becomes a requirement, hardware glue drivers, using this
- * services would have to provide their own filters, which first would check
- * the device driver, similar to how other DMAC drivers, e.g., sa11x0-dma.c, do
- * this, and only then, in case of a match, call this common filter.
- * NOTE 2: This filter function is also used in the DT case by shdma_of_xlate().
- * In that case the MID-RID value is used for slave channel filtering and is
- * passed to this function in the "arg" parameter.
- */
-bool shdma_chan_filter(struct dma_chan *chan, void *arg)
-{
-	struct shdma_chan *schan;
-	struct shdma_dev *sdev;
-	int slave_id = (long)arg;
-	int ret;
-
-	/* Only support channels handled by this driver. */
-	if (chan->device->device_alloc_chan_resources !=
-	    shdma_alloc_chan_resources)
-		return false;
-
-	schan = to_shdma_chan(chan);
-	sdev = to_shdma_dev(chan->device);
-
-	/*
-	 * For DT, the schan->slave_id field is generated by the
-	 * set_slave function from the slave ID that is passed in
-	 * from xlate. For the non-DT case, the slave ID is
-	 * directly passed into the filter function by the driver
-	 */
-	if (schan->dev->of_node) {
-		ret = sdev->ops->set_slave(schan, slave_id, 0, true);
-		if (ret < 0)
-			return false;
-
-		schan->real_slave_id = schan->slave_id;
-		return true;
-	}
-
-	if (slave_id < 0) {
-		/* No slave requested - arbitrary channel */
-		dev_warn(sdev->dma_dev.dev, "invalid slave ID passed to dma_request_slave\n");
-		return true;
-	}
-
-	if (slave_id >= slave_num)
-		return false;
-
-	ret = sdev->ops->set_slave(schan, slave_id, 0, true);
-	if (ret < 0)
-		return false;
-
-	schan->real_slave_id = slave_id;
-
-	return true;
-}
-EXPORT_SYMBOL(shdma_chan_filter);
-
-static dma_async_tx_callback __ld_cleanup(struct shdma_chan *schan, bool all)
-{
-	struct shdma_desc *desc, *_desc;
-	/* Is the "exposed" head of a chain acked? */
-	bool head_acked = false;
-	dma_cookie_t cookie = 0;
-	dma_async_tx_callback callback = NULL;
-	struct dmaengine_desc_callback cb;
-	unsigned long flags;
-	LIST_HEAD(cyclic_list);
-
-	memset(&cb, 0, sizeof(cb));
-	spin_lock_irqsave(&schan->chan_lock, flags);
-	list_for_each_entry_safe(desc, _desc, &schan->ld_queue, node) {
-		struct dma_async_tx_descriptor *tx = &desc->async_tx;
-
-		BUG_ON(tx->cookie > 0 && tx->cookie != desc->cookie);
-		BUG_ON(desc->mark != DESC_SUBMITTED &&
-		       desc->mark != DESC_COMPLETED &&
-		       desc->mark != DESC_WAITING);
-
-		/*
-		 * queue is ordered, and we use this loop to (1) clean up all
-		 * completed descriptors, and to (2) update descriptor flags of
-		 * any chunks in a (partially) completed chain
-		 */
-		if (!all && desc->mark == DESC_SUBMITTED &&
-		    desc->cookie != cookie)
-			break;
-
-		if (tx->cookie > 0)
-			cookie = tx->cookie;
-
-		if (desc->mark == DESC_COMPLETED && desc->chunks == 1) {
-			if (schan->dma_chan.completed_cookie != desc->cookie - 1)
-				dev_dbg(schan->dev,
-					"Completing cookie %d, expected %d\n",
-					desc->cookie,
-					schan->dma_chan.completed_cookie + 1);
-			schan->dma_chan.completed_cookie = desc->cookie;
-		}
-
-		/* Call callback on the last chunk */
-		if (desc->mark == DESC_COMPLETED && tx->callback) {
-			desc->mark = DESC_WAITING;
-			dmaengine_desc_get_callback(tx, &cb);
-			callback = tx->callback;
-			dev_dbg(schan->dev, "descriptor #%d@%p on %d callback\n",
-				tx->cookie, tx, schan->id);
-			BUG_ON(desc->chunks != 1);
-			break;
-		}
-
-		if (tx->cookie > 0 || tx->cookie == -EBUSY) {
-			if (desc->mark == DESC_COMPLETED) {
-				BUG_ON(tx->cookie < 0);
-				desc->mark = DESC_WAITING;
-			}
-			head_acked = async_tx_test_ack(tx);
-		} else {
-			switch (desc->mark) {
-			case DESC_COMPLETED:
-				desc->mark = DESC_WAITING;
-				fallthrough;
-			case DESC_WAITING:
-				if (head_acked)
-					async_tx_ack(&desc->async_tx);
-			}
-		}
-
-		dev_dbg(schan->dev, "descriptor %p #%d completed.\n",
-			tx, tx->cookie);
-
-		if (((desc->mark == DESC_COMPLETED ||
-		      desc->mark == DESC_WAITING) &&
-		     async_tx_test_ack(&desc->async_tx)) || all) {
-
-			if (all || !desc->cyclic) {
-				/* Remove from ld_queue list */
-				desc->mark = DESC_IDLE;
-				list_move(&desc->node, &schan->ld_free);
-			} else {
-				/* reuse as cyclic */
-				desc->mark = DESC_SUBMITTED;
-				list_move_tail(&desc->node, &cyclic_list);
-			}
-
-			if (list_empty(&schan->ld_queue)) {
-				dev_dbg(schan->dev, "Bring down channel %d\n", schan->id);
-				pm_runtime_put(schan->dev);
-				schan->pm_state = SHDMA_PM_ESTABLISHED;
-			} else if (schan->pm_state == SHDMA_PM_PENDING) {
-				shdma_chan_xfer_ld_queue(schan);
-			}
-		}
-	}
-
-	if (all && !callback)
-		/*
-		 * Terminating and the loop completed normally: forgive
-		 * uncompleted cookies
-		 */
-		schan->dma_chan.completed_cookie = schan->dma_chan.cookie;
-
-	list_splice_tail(&cyclic_list, &schan->ld_queue);
-
-	spin_unlock_irqrestore(&schan->chan_lock, flags);
-
-	dmaengine_desc_callback_invoke(&cb, NULL);
-
-	return callback;
-}
-
-/*
- * shdma_chan_ld_cleanup - Clean up link descriptors
- *
- * Clean up the ld_queue of DMA channel.
- */
-static void shdma_chan_ld_cleanup(struct shdma_chan *schan, bool all)
-{
-	while (__ld_cleanup(schan, all))
-		;
-}
-
-/*
- * shdma_free_chan_resources - Free all resources of the channel.
- */
-static void shdma_free_chan_resources(struct dma_chan *chan)
-{
-	struct shdma_chan *schan = to_shdma_chan(chan);
-	struct shdma_dev *sdev = to_shdma_dev(chan->device);
-	const struct shdma_ops *ops = sdev->ops;
-	LIST_HEAD(list);
-
-	/* Protect against ISR */
-	spin_lock_irq(&schan->chan_lock);
-	ops->halt_channel(schan);
-	spin_unlock_irq(&schan->chan_lock);
-
-	/* Now no new interrupts will occur */
-
-	/* Prepared and not submitted descriptors can still be on the queue */
-	if (!list_empty(&schan->ld_queue))
-		shdma_chan_ld_cleanup(schan, true);
-
-	if (schan->slave_id >= 0) {
-		/* The caller is holding dma_list_mutex */
-		clear_bit(schan->slave_id, shdma_slave_used);
-		chan->private = NULL;
-	}
-
-	schan->real_slave_id = 0;
-
-	spin_lock_irq(&schan->chan_lock);
-
-	list_splice_init(&schan->ld_free, &list);
-	schan->desc_num = 0;
-
-	spin_unlock_irq(&schan->chan_lock);
-
-	kfree(schan->desc);
-}
-
-/**
- * shdma_add_desc - get, set up and return one transfer descriptor
- * @schan:	DMA channel
- * @flags:	DMA transfer flags
- * @dst:	destination DMA address, incremented when direction equals
- *		DMA_DEV_TO_MEM or DMA_MEM_TO_MEM
- * @src:	source DMA address, incremented when direction equals
- *		DMA_MEM_TO_DEV or DMA_MEM_TO_MEM
- * @len:	DMA transfer length
- * @first:	if NULL, set to the current descriptor and cookie set to -EBUSY
- * @direction:	needed for slave DMA to decide which address to keep constant,
- *		equals DMA_MEM_TO_MEM for MEMCPY
- * Returns 0 or an error
- * Locks: called with desc_lock held
- */
-static struct shdma_desc *shdma_add_desc(struct shdma_chan *schan,
-	unsigned long flags, dma_addr_t *dst, dma_addr_t *src, size_t *len,
-	struct shdma_desc **first, enum dma_transfer_direction direction)
-{
-	struct shdma_dev *sdev = to_shdma_dev(schan->dma_chan.device);
-	const struct shdma_ops *ops = sdev->ops;
-	struct shdma_desc *new;
-	size_t copy_size = *len;
-
-	if (!copy_size)
-		return NULL;
-
-	/* Allocate the link descriptor from the free list */
-	new = shdma_get_desc(schan);
-	if (!new) {
-		dev_err(schan->dev, "No free link descriptor available\n");
-		return NULL;
-	}
-
-	ops->desc_setup(schan, new, *src, *dst, &copy_size);
-
-	if (!*first) {
-		/* First desc */
-		new->async_tx.cookie = -EBUSY;
-		*first = new;
-	} else {
-		/* Other desc - invisible to the user */
-		new->async_tx.cookie = -EINVAL;
-	}
-
-	dev_dbg(schan->dev,
-		"chaining (%zu/%zu)@%pad -> %pad with %p, cookie %d\n",
-		copy_size, *len, src, dst, &new->async_tx,
-		new->async_tx.cookie);
-
-	new->mark = DESC_PREPARED;
-	new->async_tx.flags = flags;
-	new->direction = direction;
-	new->partial = 0;
-
-	*len -= copy_size;
-	if (direction == DMA_MEM_TO_MEM || direction == DMA_MEM_TO_DEV)
-		*src += copy_size;
-	if (direction == DMA_MEM_TO_MEM || direction == DMA_DEV_TO_MEM)
-		*dst += copy_size;
-
-	return new;
-}
-
-/*
- * shdma_prep_sg - prepare transfer descriptors from an SG list
- *
- * Common routine for public (MEMCPY) and slave DMA. The MEMCPY case is also
- * converted to scatter-gather to guarantee consistent locking and a correct
- * list manipulation. For slave DMA direction carries the usual meaning, and,
- * logically, the SG list is RAM and the addr variable contains slave address,
- * e.g., the FIFO I/O register. For MEMCPY direction equals DMA_MEM_TO_MEM
- * and the SG list contains only one element and points at the source buffer.
- */
-static struct dma_async_tx_descriptor *shdma_prep_sg(struct shdma_chan *schan,
-	struct scatterlist *sgl, unsigned int sg_len, dma_addr_t *addr,
-	enum dma_transfer_direction direction, unsigned long flags, bool cyclic)
-{
-	struct scatterlist *sg;
-	struct shdma_desc *first = NULL, *new = NULL /* compiler... */;
-	LIST_HEAD(tx_list);
-	int chunks = 0;
-	unsigned long irq_flags;
-	int i;
-
-	for_each_sg(sgl, sg, sg_len, i)
-		chunks += DIV_ROUND_UP(sg_dma_len(sg), schan->max_xfer_len);
-
-	/* Have to lock the whole loop to protect against concurrent release */
-	spin_lock_irqsave(&schan->chan_lock, irq_flags);
-
-	/*
-	 * Chaining:
-	 * first descriptor is what user is dealing with in all API calls, its
-	 *	cookie is at first set to -EBUSY, at tx-submit to a positive
-	 *	number
-	 * if more than one chunk is needed further chunks have cookie = -EINVAL
-	 * the last chunk, if not equal to the first, has cookie = -ENOSPC
-	 * all chunks are linked onto the tx_list head with their .node heads
-	 *	only during this function, then they are immediately spliced
-	 *	back onto the free list in form of a chain
-	 */
-	for_each_sg(sgl, sg, sg_len, i) {
-		dma_addr_t sg_addr = sg_dma_address(sg);
-		size_t len = sg_dma_len(sg);
-
-		if (!len)
-			goto err_get_desc;
-
-		do {
-			dev_dbg(schan->dev, "Add SG #%d@%p[%zu], dma %pad\n",
-				i, sg, len, &sg_addr);
-
-			if (direction == DMA_DEV_TO_MEM)
-				new = shdma_add_desc(schan, flags,
-						&sg_addr, addr, &len, &first,
-						direction);
-			else
-				new = shdma_add_desc(schan, flags,
-						addr, &sg_addr, &len, &first,
-						direction);
-			if (!new)
-				goto err_get_desc;
-
-			new->cyclic = cyclic;
-			if (cyclic)
-				new->chunks = 1;
-			else
-				new->chunks = chunks--;
-			list_add_tail(&new->node, &tx_list);
-		} while (len);
-	}
-
-	if (new != first)
-		new->async_tx.cookie = -ENOSPC;
-
-	/* Put them back on the free list, so, they don't get lost */
-	list_splice_tail(&tx_list, &schan->ld_free);
-
-	spin_unlock_irqrestore(&schan->chan_lock, irq_flags);
-
-	return &first->async_tx;
-
-err_get_desc:
-	list_for_each_entry(new, &tx_list, node)
-		new->mark = DESC_IDLE;
-	list_splice(&tx_list, &schan->ld_free);
-
-	spin_unlock_irqrestore(&schan->chan_lock, irq_flags);
-
-	return NULL;
-}
-
-static struct dma_async_tx_descriptor *shdma_prep_memcpy(
-	struct dma_chan *chan, dma_addr_t dma_dest, dma_addr_t dma_src,
-	size_t len, unsigned long flags)
-{
-	struct shdma_chan *schan = to_shdma_chan(chan);
-	struct scatterlist sg;
-
-	if (!chan || !len)
-		return NULL;
-
-	BUG_ON(!schan->desc_num);
-
-	sg_init_table(&sg, 1);
-	sg_set_page(&sg, pfn_to_page(PFN_DOWN(dma_src)), len,
-		    offset_in_page(dma_src));
-	sg_dma_address(&sg) = dma_src;
-	sg_dma_len(&sg) = len;
-
-	return shdma_prep_sg(schan, &sg, 1, &dma_dest, DMA_MEM_TO_MEM,
-			     flags, false);
-}
-
-static struct dma_async_tx_descriptor *shdma_prep_slave_sg(
-	struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len,
-	enum dma_transfer_direction direction, unsigned long flags, void *context)
-{
-	struct shdma_chan *schan = to_shdma_chan(chan);
-	struct shdma_dev *sdev = to_shdma_dev(schan->dma_chan.device);
-	const struct shdma_ops *ops = sdev->ops;
-	int slave_id = schan->slave_id;
-	dma_addr_t slave_addr;
-
-	if (!chan)
-		return NULL;
-
-	BUG_ON(!schan->desc_num);
-
-	/* Someone calling slave DMA on a generic channel? */
-	if (slave_id < 0 || !sg_len) {
-		dev_warn(schan->dev, "%s: bad parameter: len=%d, id=%d\n",
-			 __func__, sg_len, slave_id);
-		return NULL;
-	}
-
-	slave_addr = ops->slave_addr(schan);
-
-	return shdma_prep_sg(schan, sgl, sg_len, &slave_addr,
-			     direction, flags, false);
-}
-
-#define SHDMA_MAX_SG_LEN 32
-
-static struct dma_async_tx_descriptor *shdma_prep_dma_cyclic(
-	struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
-	size_t period_len, enum dma_transfer_direction direction,
-	unsigned long flags)
-{
-	struct shdma_chan *schan = to_shdma_chan(chan);
-	struct shdma_dev *sdev = to_shdma_dev(schan->dma_chan.device);
-	struct dma_async_tx_descriptor *desc;
-	const struct shdma_ops *ops = sdev->ops;
-	unsigned int sg_len = buf_len / period_len;
-	int slave_id = schan->slave_id;
-	dma_addr_t slave_addr;
-	struct scatterlist *sgl;
-	int i;
-
-	if (!chan)
-		return NULL;
-
-	BUG_ON(!schan->desc_num);
-
-	if (sg_len > SHDMA_MAX_SG_LEN) {
-		dev_err(schan->dev, "sg length %d exceeds limit %d",
-				sg_len, SHDMA_MAX_SG_LEN);
-		return NULL;
-	}
-
-	/* Someone calling slave DMA on a generic channel? */
-	if (slave_id < 0 || (buf_len < period_len)) {
-		dev_warn(schan->dev,
-			"%s: bad parameter: buf_len=%zu, period_len=%zu, id=%d\n",
-			__func__, buf_len, period_len, slave_id);
-		return NULL;
-	}
-
-	slave_addr = ops->slave_addr(schan);
-
-	/*
-	 * Allocate the sg list dynamically as it would consumer too much stack
-	 * space.
-	 */
-	sgl = kmalloc_array(sg_len, sizeof(*sgl), GFP_KERNEL);
-	if (!sgl)
-		return NULL;
-
-	sg_init_table(sgl, sg_len);
-
-	for (i = 0; i < sg_len; i++) {
-		dma_addr_t src = buf_addr + (period_len * i);
-
-		sg_set_page(&sgl[i], pfn_to_page(PFN_DOWN(src)), period_len,
-			    offset_in_page(src));
-		sg_dma_address(&sgl[i]) = src;
-		sg_dma_len(&sgl[i]) = period_len;
-	}
-
-	desc = shdma_prep_sg(schan, sgl, sg_len, &slave_addr,
-			     direction, flags, true);
-
-	kfree(sgl);
-	return desc;
-}
-
-static int shdma_terminate_all(struct dma_chan *chan)
-{
-	struct shdma_chan *schan = to_shdma_chan(chan);
-	struct shdma_dev *sdev = to_shdma_dev(chan->device);
-	const struct shdma_ops *ops = sdev->ops;
-	unsigned long flags;
-
-	spin_lock_irqsave(&schan->chan_lock, flags);
-	ops->halt_channel(schan);
-
-	if (ops->get_partial && !list_empty(&schan->ld_queue)) {
-		/* Record partial transfer */
-		struct shdma_desc *desc = list_first_entry(&schan->ld_queue,
-							   struct shdma_desc, node);
-		desc->partial = ops->get_partial(schan, desc);
-	}
-
-	spin_unlock_irqrestore(&schan->chan_lock, flags);
-
-	shdma_chan_ld_cleanup(schan, true);
-
-	return 0;
-}
-
-static int shdma_config(struct dma_chan *chan,
-			struct dma_slave_config *config)
-{
-	struct shdma_chan *schan = to_shdma_chan(chan);
-
-	/*
-	 * So far only .slave_id is used, but the slave drivers are
-	 * encouraged to also set a transfer direction and an address.
-	 */
-	if (!config)
-		return -EINVAL;
-
-	/*
-	 * We could lock this, but you shouldn't be configuring the
-	 * channel, while using it...
-	 */
-	return shdma_setup_slave(schan,
-				 config->direction == DMA_DEV_TO_MEM ?
-				 config->src_addr : config->dst_addr);
-}
-
-static void shdma_issue_pending(struct dma_chan *chan)
-{
-	struct shdma_chan *schan = to_shdma_chan(chan);
-
-	spin_lock_irq(&schan->chan_lock);
-	if (schan->pm_state == SHDMA_PM_ESTABLISHED)
-		shdma_chan_xfer_ld_queue(schan);
-	else
-		schan->pm_state = SHDMA_PM_PENDING;
-	spin_unlock_irq(&schan->chan_lock);
-}
-
-static enum dma_status shdma_tx_status(struct dma_chan *chan,
-					dma_cookie_t cookie,
-					struct dma_tx_state *txstate)
-{
-	struct shdma_chan *schan = to_shdma_chan(chan);
-	enum dma_status status;
-	unsigned long flags;
-
-	shdma_chan_ld_cleanup(schan, false);
-
-	spin_lock_irqsave(&schan->chan_lock, flags);
-
-	status = dma_cookie_status(chan, cookie, txstate);
-
-	/*
-	 * If we don't find cookie on the queue, it has been aborted and we have
-	 * to report error
-	 */
-	if (status != DMA_COMPLETE) {
-		struct shdma_desc *sdesc;
-		status = DMA_ERROR;
-		list_for_each_entry(sdesc, &schan->ld_queue, node)
-			if (sdesc->cookie == cookie) {
-				status = DMA_IN_PROGRESS;
-				break;
-			}
-	}
-
-	spin_unlock_irqrestore(&schan->chan_lock, flags);
-
-	return status;
-}
-
-/* Called from error IRQ or NMI */
-bool shdma_reset(struct shdma_dev *sdev)
-{
-	const struct shdma_ops *ops = sdev->ops;
-	struct shdma_chan *schan;
-	unsigned int handled = 0;
-	int i;
-
-	/* Reset all channels */
-	shdma_for_each_chan(schan, sdev, i) {
-		struct shdma_desc *sdesc;
-		LIST_HEAD(dl);
-
-		if (!schan)
-			continue;
-
-		spin_lock(&schan->chan_lock);
-
-		/* Stop the channel */
-		ops->halt_channel(schan);
-
-		list_splice_init(&schan->ld_queue, &dl);
-
-		if (!list_empty(&dl)) {
-			dev_dbg(schan->dev, "Bring down channel %d\n", schan->id);
-			pm_runtime_put(schan->dev);
-		}
-		schan->pm_state = SHDMA_PM_ESTABLISHED;
-
-		spin_unlock(&schan->chan_lock);
-
-		/* Complete all  */
-		list_for_each_entry(sdesc, &dl, node) {
-			struct dma_async_tx_descriptor *tx = &sdesc->async_tx;
-
-			sdesc->mark = DESC_IDLE;
-			dmaengine_desc_get_callback_invoke(tx, NULL);
-		}
-
-		spin_lock(&schan->chan_lock);
-		list_splice(&dl, &schan->ld_free);
-		spin_unlock(&schan->chan_lock);
-
-		handled++;
-	}
-
-	return !!handled;
-}
-EXPORT_SYMBOL(shdma_reset);
-
-static irqreturn_t chan_irq(int irq, void *dev)
-{
-	struct shdma_chan *schan = dev;
-	const struct shdma_ops *ops =
-		to_shdma_dev(schan->dma_chan.device)->ops;
-	irqreturn_t ret;
-
-	spin_lock(&schan->chan_lock);
-
-	ret = ops->chan_irq(schan, irq) ? IRQ_WAKE_THREAD : IRQ_NONE;
-
-	spin_unlock(&schan->chan_lock);
-
-	return ret;
-}
-
-static irqreturn_t chan_irqt(int irq, void *dev)
-{
-	struct shdma_chan *schan = dev;
-	const struct shdma_ops *ops =
-		to_shdma_dev(schan->dma_chan.device)->ops;
-	struct shdma_desc *sdesc;
-
-	spin_lock_irq(&schan->chan_lock);
-	list_for_each_entry(sdesc, &schan->ld_queue, node) {
-		if (sdesc->mark == DESC_SUBMITTED &&
-		    ops->desc_completed(schan, sdesc)) {
-			dev_dbg(schan->dev, "done #%d@%p\n",
-				sdesc->async_tx.cookie, &sdesc->async_tx);
-			sdesc->mark = DESC_COMPLETED;
-			break;
-		}
-	}
-	/* Next desc */
-	shdma_chan_xfer_ld_queue(schan);
-	spin_unlock_irq(&schan->chan_lock);
-
-	shdma_chan_ld_cleanup(schan, false);
-
-	return IRQ_HANDLED;
-}
-
-int shdma_request_irq(struct shdma_chan *schan, int irq,
-			   unsigned long flags, const char *name)
-{
-	int ret = devm_request_threaded_irq(schan->dev, irq, chan_irq,
-					    chan_irqt, flags, name, schan);
-
-	schan->irq = ret < 0 ? ret : irq;
-
-	return ret;
-}
-EXPORT_SYMBOL(shdma_request_irq);
-
-void shdma_chan_probe(struct shdma_dev *sdev,
-			   struct shdma_chan *schan, int id)
-{
-	schan->pm_state = SHDMA_PM_ESTABLISHED;
-
-	/* reference struct dma_device */
-	schan->dma_chan.device = &sdev->dma_dev;
-	dma_cookie_init(&schan->dma_chan);
-
-	schan->dev = sdev->dma_dev.dev;
-	schan->id = id;
-
-	if (!schan->max_xfer_len)
-		schan->max_xfer_len = PAGE_SIZE;
-
-	spin_lock_init(&schan->chan_lock);
-
-	/* Init descripter manage list */
-	INIT_LIST_HEAD(&schan->ld_queue);
-	INIT_LIST_HEAD(&schan->ld_free);
-
-	/* Add the channel to DMA device channel list */
-	list_add_tail(&schan->dma_chan.device_node,
-			&sdev->dma_dev.channels);
-	sdev->schan[id] = schan;
-}
-EXPORT_SYMBOL(shdma_chan_probe);
-
-void shdma_chan_remove(struct shdma_chan *schan)
-{
-	list_del(&schan->dma_chan.device_node);
-}
-EXPORT_SYMBOL(shdma_chan_remove);
-
-int shdma_init(struct device *dev, struct shdma_dev *sdev,
-		    int chan_num)
-{
-	struct dma_device *dma_dev = &sdev->dma_dev;
-
-	/*
-	 * Require all call-backs for now, they can trivially be made optional
-	 * later as required
-	 */
-	if (!sdev->ops ||
-	    !sdev->desc_size ||
-	    !sdev->ops->embedded_desc ||
-	    !sdev->ops->start_xfer ||
-	    !sdev->ops->setup_xfer ||
-	    !sdev->ops->set_slave ||
-	    !sdev->ops->desc_setup ||
-	    !sdev->ops->slave_addr ||
-	    !sdev->ops->channel_busy ||
-	    !sdev->ops->halt_channel ||
-	    !sdev->ops->desc_completed)
-		return -EINVAL;
-
-	sdev->schan = kcalloc(chan_num, sizeof(*sdev->schan), GFP_KERNEL);
-	if (!sdev->schan)
-		return -ENOMEM;
-
-	INIT_LIST_HEAD(&dma_dev->channels);
-
-	/* Common and MEMCPY operations */
-	dma_dev->device_alloc_chan_resources
-		= shdma_alloc_chan_resources;
-	dma_dev->device_free_chan_resources = shdma_free_chan_resources;
-	dma_dev->device_prep_dma_memcpy = shdma_prep_memcpy;
-	dma_dev->device_tx_status = shdma_tx_status;
-	dma_dev->device_issue_pending = shdma_issue_pending;
-
-	/* Compulsory for DMA_SLAVE fields */
-	dma_dev->device_prep_slave_sg = shdma_prep_slave_sg;
-	dma_dev->device_prep_dma_cyclic = shdma_prep_dma_cyclic;
-	dma_dev->device_config = shdma_config;
-	dma_dev->device_terminate_all = shdma_terminate_all;
-
-	dma_dev->dev = dev;
-
-	return 0;
-}
-EXPORT_SYMBOL(shdma_init);
-
-void shdma_cleanup(struct shdma_dev *sdev)
-{
-	kfree(sdev->schan);
-}
-EXPORT_SYMBOL(shdma_cleanup);
-
-static int __init shdma_enter(void)
-{
-	shdma_slave_used = bitmap_zalloc(slave_num, GFP_KERNEL);
-	if (!shdma_slave_used)
-		return -ENOMEM;
-	return 0;
-}
-module_init(shdma_enter);
-
-static void __exit shdma_exit(void)
-{
-	bitmap_free(shdma_slave_used);
-}
-module_exit(shdma_exit);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("SH-DMA driver base library");
-MODULE_AUTHOR("Guennadi Liakhovetski <g.liakhovetski@gmx.de>");
diff --git a/drivers/dma/sh/shdma.h b/drivers/dma/sh/shdma.h
deleted file mode 100644
index 9c121a4b33ad82..00000000000000
--- a/drivers/dma/sh/shdma.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Renesas SuperH DMA Engine support
- *
- * Copyright (C) 2009 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
- * Copyright (C) 2009 Renesas Solutions, Inc. All rights reserved.
- *
- */
-#ifndef __DMA_SHDMA_H
-#define __DMA_SHDMA_H
-
-#include <linux/sh_dma.h>
-#include <linux/shdma-base.h>
-#include <linux/dmaengine.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-
-#define SH_DMAE_MAX_CHANNELS 20
-#define SH_DMAE_TCR_MAX 0x00FFFFFF	/* 16MB */
-
-struct device;
-
-struct sh_dmae_chan {
-	struct shdma_chan shdma_chan;
-	const struct sh_dmae_slave_config *config; /* Slave DMA configuration */
-	int xmit_shift;			/* log_2(bytes_per_xfer) */
-	void __iomem *base;
-	char dev_id[16];		/* unique name per DMAC of channel */
-	int pm_error;
-	dma_addr_t slave_addr;
-};
-
-struct sh_dmae_device {
-	struct shdma_dev shdma_dev;
-	struct sh_dmae_chan *chan[SH_DMAE_MAX_CHANNELS];
-	const struct sh_dmae_pdata *pdata;
-	struct list_head node;
-	void __iomem *chan_reg;
-	void __iomem *dmars;
-	unsigned int chcr_offset;
-	u32 chcr_ie_bit;
-};
-
-struct sh_dmae_regs {
-	u32 sar; /* SAR / source address */
-	u32 dar; /* DAR / destination address */
-	u32 tcr; /* TCR / transfer count */
-};
-
-struct sh_dmae_desc {
-	struct sh_dmae_regs hw;
-	struct shdma_desc shdma_desc;
-};
-
-#define to_sh_chan(chan) container_of(chan, struct sh_dmae_chan, shdma_chan)
-#define to_sh_desc(lh) container_of(lh, struct sh_desc, node)
-#define tx_to_sh_desc(tx) container_of(tx, struct sh_desc, async_tx)
-#define to_sh_dev(chan) container_of(chan->shdma_chan.dma_chan.device,\
-				     struct sh_dmae_device, shdma_dev.dma_dev)
-
-#endif	/* __DMA_SHDMA_H */
diff --git a/drivers/dma/sh/shdmac.c b/drivers/dma/sh/shdmac.c
deleted file mode 100644
index 5aafe548ca5f30..00000000000000
--- a/drivers/dma/sh/shdmac.c
+++ /dev/null
@@ -1,938 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Renesas SuperH DMA Engine support
- *
- * base is drivers/dma/flsdma.c
- *
- * Copyright (C) 2011-2012 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
- * Copyright (C) 2009 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
- * Copyright (C) 2009 Renesas Solutions, Inc. All rights reserved.
- * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
- *
- * - DMA of SuperH does not have Hardware DMA chain mode.
- * - MAX DMA size is 16MB.
- *
- */
-
-#include <linux/delay.h>
-#include <linux/dmaengine.h>
-#include <linux/err.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/kdebug.h>
-#include <linux/module.h>
-#include <linux/notifier.h>
-#include <linux/of.h>
-#include <linux/of_device.h>
-#include <linux/platform_device.h>
-#include <linux/pm_runtime.h>
-#include <linux/rculist.h>
-#include <linux/sh_dma.h>
-#include <linux/slab.h>
-#include <linux/spinlock.h>
-
-#include "../dmaengine.h"
-#include "shdma.h"
-
-/* DMA registers */
-#define SAR	0x00	/* Source Address Register */
-#define DAR	0x04	/* Destination Address Register */
-#define TCR	0x08	/* Transfer Count Register */
-#define CHCR	0x0C	/* Channel Control Register */
-#define DMAOR	0x40	/* DMA Operation Register */
-
-#define TEND	0x18 /* USB-DMAC */
-
-#define SH_DMAE_DRV_NAME "sh-dma-engine"
-
-/* Default MEMCPY transfer size = 2^2 = 4 bytes */
-#define LOG2_DEFAULT_XFER_SIZE	2
-#define SH_DMA_SLAVE_NUMBER 256
-#define SH_DMA_TCR_MAX (16 * 1024 * 1024 - 1)
-
-/*
- * Used for write-side mutual exclusion for the global device list,
- * read-side synchronization by way of RCU, and per-controller data.
- */
-static DEFINE_SPINLOCK(sh_dmae_lock);
-static LIST_HEAD(sh_dmae_devices);
-
-/*
- * Different DMAC implementations provide different ways to clear DMA channels:
- * (1) none - no CHCLR registers are available
- * (2) one CHCLR register per channel - 0 has to be written to it to clear
- *     channel buffers
- * (3) one CHCLR per several channels - 1 has to be written to the bit,
- *     corresponding to the specific channel to reset it
- */
-static void channel_clear(struct sh_dmae_chan *sh_dc)
-{
-	struct sh_dmae_device *shdev = to_sh_dev(sh_dc);
-	const struct sh_dmae_channel *chan_pdata = shdev->pdata->channel +
-		sh_dc->shdma_chan.id;
-	u32 val = shdev->pdata->chclr_bitwise ? 1 << chan_pdata->chclr_bit : 0;
-
-	__raw_writel(val, shdev->chan_reg + chan_pdata->chclr_offset);
-}
-
-static void sh_dmae_writel(struct sh_dmae_chan *sh_dc, u32 data, u32 reg)
-{
-	__raw_writel(data, sh_dc->base + reg);
-}
-
-static u32 sh_dmae_readl(struct sh_dmae_chan *sh_dc, u32 reg)
-{
-	return __raw_readl(sh_dc->base + reg);
-}
-
-static u16 dmaor_read(struct sh_dmae_device *shdev)
-{
-	void __iomem *addr = shdev->chan_reg + DMAOR;
-
-	if (shdev->pdata->dmaor_is_32bit)
-		return __raw_readl(addr);
-	else
-		return __raw_readw(addr);
-}
-
-static void dmaor_write(struct sh_dmae_device *shdev, u16 data)
-{
-	void __iomem *addr = shdev->chan_reg + DMAOR;
-
-	if (shdev->pdata->dmaor_is_32bit)
-		__raw_writel(data, addr);
-	else
-		__raw_writew(data, addr);
-}
-
-static void chcr_write(struct sh_dmae_chan *sh_dc, u32 data)
-{
-	struct sh_dmae_device *shdev = to_sh_dev(sh_dc);
-
-	__raw_writel(data, sh_dc->base + shdev->chcr_offset);
-}
-
-static u32 chcr_read(struct sh_dmae_chan *sh_dc)
-{
-	struct sh_dmae_device *shdev = to_sh_dev(sh_dc);
-
-	return __raw_readl(sh_dc->base + shdev->chcr_offset);
-}
-
-/*
- * Reset DMA controller
- *
- * SH7780 has two DMAOR register
- */
-static void sh_dmae_ctl_stop(struct sh_dmae_device *shdev)
-{
-	unsigned short dmaor;
-	unsigned long flags;
-
-	spin_lock_irqsave(&sh_dmae_lock, flags);
-
-	dmaor = dmaor_read(shdev);
-	dmaor_write(shdev, dmaor & ~(DMAOR_NMIF | DMAOR_AE | DMAOR_DME));
-
-	spin_unlock_irqrestore(&sh_dmae_lock, flags);
-}
-
-static int sh_dmae_rst(struct sh_dmae_device *shdev)
-{
-	unsigned short dmaor;
-	unsigned long flags;
-
-	spin_lock_irqsave(&sh_dmae_lock, flags);
-
-	dmaor = dmaor_read(shdev) & ~(DMAOR_NMIF | DMAOR_AE | DMAOR_DME);
-
-	if (shdev->pdata->chclr_present) {
-		int i;
-		for (i = 0; i < shdev->pdata->channel_num; i++) {
-			struct sh_dmae_chan *sh_chan = shdev->chan[i];
-			if (sh_chan)
-				channel_clear(sh_chan);
-		}
-	}
-
-	dmaor_write(shdev, dmaor | shdev->pdata->dmaor_init);
-
-	dmaor = dmaor_read(shdev);
-
-	spin_unlock_irqrestore(&sh_dmae_lock, flags);
-
-	if (dmaor & (DMAOR_AE | DMAOR_NMIF)) {
-		dev_warn(shdev->shdma_dev.dma_dev.dev, "Can't initialize DMAOR.\n");
-		return -EIO;
-	}
-	if (shdev->pdata->dmaor_init & ~dmaor)
-		dev_warn(shdev->shdma_dev.dma_dev.dev,
-			 "DMAOR=0x%x hasn't latched the initial value 0x%x.\n",
-			 dmaor, shdev->pdata->dmaor_init);
-	return 0;
-}
-
-static bool dmae_is_busy(struct sh_dmae_chan *sh_chan)
-{
-	u32 chcr = chcr_read(sh_chan);
-
-	if ((chcr & (CHCR_DE | CHCR_TE)) == CHCR_DE)
-		return true; /* working */
-
-	return false; /* waiting */
-}
-
-static unsigned int calc_xmit_shift(struct sh_dmae_chan *sh_chan, u32 chcr)
-{
-	struct sh_dmae_device *shdev = to_sh_dev(sh_chan);
-	const struct sh_dmae_pdata *pdata = shdev->pdata;
-	int cnt = ((chcr & pdata->ts_low_mask) >> pdata->ts_low_shift) |
-		((chcr & pdata->ts_high_mask) >> pdata->ts_high_shift);
-
-	if (cnt >= pdata->ts_shift_num)
-		cnt = 0;
-
-	return pdata->ts_shift[cnt];
-}
-
-static u32 log2size_to_chcr(struct sh_dmae_chan *sh_chan, int l2size)
-{
-	struct sh_dmae_device *shdev = to_sh_dev(sh_chan);
-	const struct sh_dmae_pdata *pdata = shdev->pdata;
-	int i;
-
-	for (i = 0; i < pdata->ts_shift_num; i++)
-		if (pdata->ts_shift[i] == l2size)
-			break;
-
-	if (i == pdata->ts_shift_num)
-		i = 0;
-
-	return ((i << pdata->ts_low_shift) & pdata->ts_low_mask) |
-		((i << pdata->ts_high_shift) & pdata->ts_high_mask);
-}
-
-static void dmae_set_reg(struct sh_dmae_chan *sh_chan, struct sh_dmae_regs *hw)
-{
-	sh_dmae_writel(sh_chan, hw->sar, SAR);
-	sh_dmae_writel(sh_chan, hw->dar, DAR);
-	sh_dmae_writel(sh_chan, hw->tcr >> sh_chan->xmit_shift, TCR);
-}
-
-static void dmae_start(struct sh_dmae_chan *sh_chan)
-{
-	struct sh_dmae_device *shdev = to_sh_dev(sh_chan);
-	u32 chcr = chcr_read(sh_chan);
-
-	if (shdev->pdata->needs_tend_set)
-		sh_dmae_writel(sh_chan, 0xFFFFFFFF, TEND);
-
-	chcr |= CHCR_DE | shdev->chcr_ie_bit;
-	chcr_write(sh_chan, chcr & ~CHCR_TE);
-}
-
-static void dmae_init(struct sh_dmae_chan *sh_chan)
-{
-	/*
-	 * Default configuration for dual address memory-memory transfer.
-	 */
-	u32 chcr = DM_INC | SM_INC | RS_AUTO | log2size_to_chcr(sh_chan,
-						   LOG2_DEFAULT_XFER_SIZE);
-	sh_chan->xmit_shift = calc_xmit_shift(sh_chan, chcr);
-	chcr_write(sh_chan, chcr);
-}
-
-static int dmae_set_chcr(struct sh_dmae_chan *sh_chan, u32 val)
-{
-	/* If DMA is active, cannot set CHCR. TODO: remove this superfluous check */
-	if (dmae_is_busy(sh_chan))
-		return -EBUSY;
-
-	sh_chan->xmit_shift = calc_xmit_shift(sh_chan, val);
-	chcr_write(sh_chan, val);
-
-	return 0;
-}
-
-static int dmae_set_dmars(struct sh_dmae_chan *sh_chan, u16 val)
-{
-	struct sh_dmae_device *shdev = to_sh_dev(sh_chan);
-	const struct sh_dmae_pdata *pdata = shdev->pdata;
-	const struct sh_dmae_channel *chan_pdata = &pdata->channel[sh_chan->shdma_chan.id];
-	void __iomem *addr = shdev->dmars;
-	unsigned int shift = chan_pdata->dmars_bit;
-
-	if (dmae_is_busy(sh_chan))
-		return -EBUSY;
-
-	if (pdata->no_dmars)
-		return 0;
-
-	/* in the case of a missing DMARS resource use first memory window */
-	if (!addr)
-		addr = shdev->chan_reg;
-	addr += chan_pdata->dmars;
-
-	__raw_writew((__raw_readw(addr) & (0xff00 >> shift)) | (val << shift),
-		     addr);
-
-	return 0;
-}
-
-static void sh_dmae_start_xfer(struct shdma_chan *schan,
-			       struct shdma_desc *sdesc)
-{
-	struct sh_dmae_chan *sh_chan = container_of(schan, struct sh_dmae_chan,
-						    shdma_chan);
-	struct sh_dmae_desc *sh_desc = container_of(sdesc,
-					struct sh_dmae_desc, shdma_desc);
-	dev_dbg(sh_chan->shdma_chan.dev, "Queue #%d to %d: %u@%x -> %x\n",
-		sdesc->async_tx.cookie, sh_chan->shdma_chan.id,
-		sh_desc->hw.tcr, sh_desc->hw.sar, sh_desc->hw.dar);
-	/* Get the ld start address from ld_queue */
-	dmae_set_reg(sh_chan, &sh_desc->hw);
-	dmae_start(sh_chan);
-}
-
-static bool sh_dmae_channel_busy(struct shdma_chan *schan)
-{
-	struct sh_dmae_chan *sh_chan = container_of(schan, struct sh_dmae_chan,
-						    shdma_chan);
-	return dmae_is_busy(sh_chan);
-}
-
-static void sh_dmae_setup_xfer(struct shdma_chan *schan,
-			       int slave_id)
-{
-	struct sh_dmae_chan *sh_chan = container_of(schan, struct sh_dmae_chan,
-						    shdma_chan);
-
-	if (slave_id >= 0) {
-		const struct sh_dmae_slave_config *cfg =
-			sh_chan->config;
-
-		dmae_set_dmars(sh_chan, cfg->mid_rid);
-		dmae_set_chcr(sh_chan, cfg->chcr);
-	} else {
-		dmae_init(sh_chan);
-	}
-}
-
-/*
- * Find a slave channel configuration from the contoller list by either a slave
- * ID in the non-DT case, or by a MID/RID value in the DT case
- */
-static const struct sh_dmae_slave_config *dmae_find_slave(
-	struct sh_dmae_chan *sh_chan, int match)
-{
-	struct sh_dmae_device *shdev = to_sh_dev(sh_chan);
-	const struct sh_dmae_pdata *pdata = shdev->pdata;
-	const struct sh_dmae_slave_config *cfg;
-	int i;
-
-	if (!sh_chan->shdma_chan.dev->of_node) {
-		if (match >= SH_DMA_SLAVE_NUMBER)
-			return NULL;
-
-		for (i = 0, cfg = pdata->slave; i < pdata->slave_num; i++, cfg++)
-			if (cfg->slave_id == match)
-				return cfg;
-	} else {
-		for (i = 0, cfg = pdata->slave; i < pdata->slave_num; i++, cfg++)
-			if (cfg->mid_rid == match) {
-				sh_chan->shdma_chan.slave_id = i;
-				return cfg;
-			}
-	}
-
-	return NULL;
-}
-
-static int sh_dmae_set_slave(struct shdma_chan *schan,
-			     int slave_id, dma_addr_t slave_addr, bool try)
-{
-	struct sh_dmae_chan *sh_chan = container_of(schan, struct sh_dmae_chan,
-						    shdma_chan);
-	const struct sh_dmae_slave_config *cfg = dmae_find_slave(sh_chan, slave_id);
-	if (!cfg)
-		return -ENXIO;
-
-	if (!try) {
-		sh_chan->config = cfg;
-		sh_chan->slave_addr = slave_addr ? : cfg->addr;
-	}
-
-	return 0;
-}
-
-static void dmae_halt(struct sh_dmae_chan *sh_chan)
-{
-	struct sh_dmae_device *shdev = to_sh_dev(sh_chan);
-	u32 chcr = chcr_read(sh_chan);
-
-	chcr &= ~(CHCR_DE | CHCR_TE | shdev->chcr_ie_bit);
-	chcr_write(sh_chan, chcr);
-}
-
-static int sh_dmae_desc_setup(struct shdma_chan *schan,
-			      struct shdma_desc *sdesc,
-			      dma_addr_t src, dma_addr_t dst, size_t *len)
-{
-	struct sh_dmae_desc *sh_desc = container_of(sdesc,
-					struct sh_dmae_desc, shdma_desc);
-
-	if (*len > schan->max_xfer_len)
-		*len = schan->max_xfer_len;
-
-	sh_desc->hw.sar = src;
-	sh_desc->hw.dar = dst;
-	sh_desc->hw.tcr = *len;
-
-	return 0;
-}
-
-static void sh_dmae_halt(struct shdma_chan *schan)
-{
-	struct sh_dmae_chan *sh_chan = container_of(schan, struct sh_dmae_chan,
-						    shdma_chan);
-	dmae_halt(sh_chan);
-}
-
-static bool sh_dmae_chan_irq(struct shdma_chan *schan, int irq)
-{
-	struct sh_dmae_chan *sh_chan = container_of(schan, struct sh_dmae_chan,
-						    shdma_chan);
-
-	if (!(chcr_read(sh_chan) & CHCR_TE))
-		return false;
-
-	/* DMA stop */
-	dmae_halt(sh_chan);
-
-	return true;
-}
-
-static size_t sh_dmae_get_partial(struct shdma_chan *schan,
-				  struct shdma_desc *sdesc)
-{
-	struct sh_dmae_chan *sh_chan = container_of(schan, struct sh_dmae_chan,
-						    shdma_chan);
-	struct sh_dmae_desc *sh_desc = container_of(sdesc,
-					struct sh_dmae_desc, shdma_desc);
-	return sh_desc->hw.tcr -
-		(sh_dmae_readl(sh_chan, TCR) << sh_chan->xmit_shift);
-}
-
-/* Called from error IRQ or NMI */
-static bool sh_dmae_reset(struct sh_dmae_device *shdev)
-{
-	bool ret;
-
-	/* halt the dma controller */
-	sh_dmae_ctl_stop(shdev);
-
-	/* We cannot detect, which channel caused the error, have to reset all */
-	ret = shdma_reset(&shdev->shdma_dev);
-
-	sh_dmae_rst(shdev);
-
-	return ret;
-}
-
-static irqreturn_t sh_dmae_err(int irq, void *data)
-{
-	struct sh_dmae_device *shdev = data;
-
-	if (!(dmaor_read(shdev) & DMAOR_AE))
-		return IRQ_NONE;
-
-	sh_dmae_reset(shdev);
-	return IRQ_HANDLED;
-}
-
-static bool sh_dmae_desc_completed(struct shdma_chan *schan,
-				   struct shdma_desc *sdesc)
-{
-	struct sh_dmae_chan *sh_chan = container_of(schan,
-					struct sh_dmae_chan, shdma_chan);
-	struct sh_dmae_desc *sh_desc = container_of(sdesc,
-					struct sh_dmae_desc, shdma_desc);
-	u32 sar_buf = sh_dmae_readl(sh_chan, SAR);
-	u32 dar_buf = sh_dmae_readl(sh_chan, DAR);
-
-	return	(sdesc->direction == DMA_DEV_TO_MEM &&
-		 (sh_desc->hw.dar + sh_desc->hw.tcr) == dar_buf) ||
-		(sdesc->direction != DMA_DEV_TO_MEM &&
-		 (sh_desc->hw.sar + sh_desc->hw.tcr) == sar_buf);
-}
-
-static bool sh_dmae_nmi_notify(struct sh_dmae_device *shdev)
-{
-	/* Fast path out if NMIF is not asserted for this controller */
-	if ((dmaor_read(shdev) & DMAOR_NMIF) == 0)
-		return false;
-
-	return sh_dmae_reset(shdev);
-}
-
-static int sh_dmae_nmi_handler(struct notifier_block *self,
-			       unsigned long cmd, void *data)
-{
-	struct sh_dmae_device *shdev;
-	int ret = NOTIFY_DONE;
-	bool triggered;
-
-	/*
-	 * Only concern ourselves with NMI events.
-	 *
-	 * Normally we would check the die chain value, but as this needs
-	 * to be architecture independent, check for NMI context instead.
-	 */
-	if (!in_nmi())
-		return NOTIFY_DONE;
-
-	rcu_read_lock();
-	list_for_each_entry_rcu(shdev, &sh_dmae_devices, node) {
-		/*
-		 * Only stop if one of the controllers has NMIF asserted,
-		 * we do not want to interfere with regular address error
-		 * handling or NMI events that don't concern the DMACs.
-		 */
-		triggered = sh_dmae_nmi_notify(shdev);
-		if (triggered == true)
-			ret = NOTIFY_OK;
-	}
-	rcu_read_unlock();
-
-	return ret;
-}
-
-static struct notifier_block sh_dmae_nmi_notifier __read_mostly = {
-	.notifier_call	= sh_dmae_nmi_handler,
-
-	/* Run before NMI debug handler and KGDB */
-	.priority	= 1,
-};
-
-static int sh_dmae_chan_probe(struct sh_dmae_device *shdev, int id,
-					int irq, unsigned long flags)
-{
-	const struct sh_dmae_channel *chan_pdata = &shdev->pdata->channel[id];
-	struct shdma_dev *sdev = &shdev->shdma_dev;
-	struct platform_device *pdev = to_platform_device(sdev->dma_dev.dev);
-	struct sh_dmae_chan *sh_chan;
-	struct shdma_chan *schan;
-	int err;
-
-	sh_chan = devm_kzalloc(sdev->dma_dev.dev, sizeof(struct sh_dmae_chan),
-			       GFP_KERNEL);
-	if (!sh_chan)
-		return -ENOMEM;
-
-	schan = &sh_chan->shdma_chan;
-	schan->max_xfer_len = SH_DMA_TCR_MAX + 1;
-
-	shdma_chan_probe(sdev, schan, id);
-
-	sh_chan->base = shdev->chan_reg + chan_pdata->offset;
-
-	/* set up channel irq */
-	if (pdev->id >= 0)
-		snprintf(sh_chan->dev_id, sizeof(sh_chan->dev_id),
-			 "sh-dmae%d.%d", pdev->id, id);
-	else
-		snprintf(sh_chan->dev_id, sizeof(sh_chan->dev_id),
-			 "sh-dma%d", id);
-
-	err = shdma_request_irq(schan, irq, flags, sh_chan->dev_id);
-	if (err) {
-		dev_err(sdev->dma_dev.dev,
-			"DMA channel %d request_irq error %d\n",
-			id, err);
-		goto err_no_irq;
-	}
-
-	shdev->chan[id] = sh_chan;
-	return 0;
-
-err_no_irq:
-	/* remove from dmaengine device node */
-	shdma_chan_remove(schan);
-	return err;
-}
-
-static void sh_dmae_chan_remove(struct sh_dmae_device *shdev)
-{
-	struct shdma_chan *schan;
-	int i;
-
-	shdma_for_each_chan(schan, &shdev->shdma_dev, i) {
-		BUG_ON(!schan);
-
-		shdma_chan_remove(schan);
-	}
-}
-
-#ifdef CONFIG_PM
-static int sh_dmae_runtime_suspend(struct device *dev)
-{
-	struct sh_dmae_device *shdev = dev_get_drvdata(dev);
-
-	sh_dmae_ctl_stop(shdev);
-	return 0;
-}
-
-static int sh_dmae_runtime_resume(struct device *dev)
-{
-	struct sh_dmae_device *shdev = dev_get_drvdata(dev);
-
-	return sh_dmae_rst(shdev);
-}
-#endif
-
-#ifdef CONFIG_PM_SLEEP
-static int sh_dmae_suspend(struct device *dev)
-{
-	struct sh_dmae_device *shdev = dev_get_drvdata(dev);
-
-	sh_dmae_ctl_stop(shdev);
-	return 0;
-}
-
-static int sh_dmae_resume(struct device *dev)
-{
-	struct sh_dmae_device *shdev = dev_get_drvdata(dev);
-	int i, ret;
-
-	ret = sh_dmae_rst(shdev);
-	if (ret < 0)
-		dev_err(dev, "Failed to reset!\n");
-
-	for (i = 0; i < shdev->pdata->channel_num; i++) {
-		struct sh_dmae_chan *sh_chan = shdev->chan[i];
-
-		if (!sh_chan->shdma_chan.desc_num)
-			continue;
-
-		if (sh_chan->shdma_chan.slave_id >= 0) {
-			const struct sh_dmae_slave_config *cfg = sh_chan->config;
-			dmae_set_dmars(sh_chan, cfg->mid_rid);
-			dmae_set_chcr(sh_chan, cfg->chcr);
-		} else {
-			dmae_init(sh_chan);
-		}
-	}
-
-	return 0;
-}
-#endif
-
-static const struct dev_pm_ops sh_dmae_pm = {
-	SET_SYSTEM_SLEEP_PM_OPS(sh_dmae_suspend, sh_dmae_resume)
-	SET_RUNTIME_PM_OPS(sh_dmae_runtime_suspend, sh_dmae_runtime_resume,
-			   NULL)
-};
-
-static dma_addr_t sh_dmae_slave_addr(struct shdma_chan *schan)
-{
-	struct sh_dmae_chan *sh_chan = container_of(schan,
-					struct sh_dmae_chan, shdma_chan);
-
-	/*
-	 * Implicit BUG_ON(!sh_chan->config)
-	 * This is an exclusive slave DMA operation, may only be called after a
-	 * successful slave configuration.
-	 */
-	return sh_chan->slave_addr;
-}
-
-static struct shdma_desc *sh_dmae_embedded_desc(void *buf, int i)
-{
-	return &((struct sh_dmae_desc *)buf)[i].shdma_desc;
-}
-
-static const struct shdma_ops sh_dmae_shdma_ops = {
-	.desc_completed = sh_dmae_desc_completed,
-	.halt_channel = sh_dmae_halt,
-	.channel_busy = sh_dmae_channel_busy,
-	.slave_addr = sh_dmae_slave_addr,
-	.desc_setup = sh_dmae_desc_setup,
-	.set_slave = sh_dmae_set_slave,
-	.setup_xfer = sh_dmae_setup_xfer,
-	.start_xfer = sh_dmae_start_xfer,
-	.embedded_desc = sh_dmae_embedded_desc,
-	.chan_irq = sh_dmae_chan_irq,
-	.get_partial = sh_dmae_get_partial,
-};
-
-static int sh_dmae_probe(struct platform_device *pdev)
-{
-	const enum dma_slave_buswidth widths =
-		DMA_SLAVE_BUSWIDTH_1_BYTE   | DMA_SLAVE_BUSWIDTH_2_BYTES |
-		DMA_SLAVE_BUSWIDTH_4_BYTES  | DMA_SLAVE_BUSWIDTH_8_BYTES |
-		DMA_SLAVE_BUSWIDTH_16_BYTES | DMA_SLAVE_BUSWIDTH_32_BYTES;
-	const struct sh_dmae_pdata *pdata;
-	unsigned long chan_flag[SH_DMAE_MAX_CHANNELS] = {};
-	int chan_irq[SH_DMAE_MAX_CHANNELS];
-	unsigned long irqflags = 0;
-	int err, errirq, i, irq_cnt = 0, irqres = 0, irq_cap = 0;
-	struct sh_dmae_device *shdev;
-	struct dma_device *dma_dev;
-	struct resource *chan, *dmars, *errirq_res, *chanirq_res;
-
-	if (pdev->dev.of_node)
-		pdata = of_device_get_match_data(&pdev->dev);
-	else
-		pdata = dev_get_platdata(&pdev->dev);
-
-	/* get platform data */
-	if (!pdata || !pdata->channel_num)
-		return -ENODEV;
-
-	chan = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	/* DMARS area is optional */
-	dmars = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	/*
-	 * IRQ resources:
-	 * 1. there always must be at least one IRQ IO-resource. On SH4 it is
-	 *    the error IRQ, in which case it is the only IRQ in this resource:
-	 *    start == end. If it is the only IRQ resource, all channels also
-	 *    use the same IRQ.
-	 * 2. DMA channel IRQ resources can be specified one per resource or in
-	 *    ranges (start != end)
-	 * 3. iff all events (channels and, optionally, error) on this
-	 *    controller use the same IRQ, only one IRQ resource can be
-	 *    specified, otherwise there must be one IRQ per channel, even if
-	 *    some of them are equal
-	 * 4. if all IRQs on this controller are equal or if some specific IRQs
-	 *    specify IORESOURCE_IRQ_SHAREABLE in their resources, they will be
-	 *    requested with the IRQF_SHARED flag
-	 */
-	errirq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!chan || !errirq_res)
-		return -ENODEV;
-
-	shdev = devm_kzalloc(&pdev->dev, sizeof(struct sh_dmae_device),
-			     GFP_KERNEL);
-	if (!shdev)
-		return -ENOMEM;
-
-	dma_dev = &shdev->shdma_dev.dma_dev;
-
-	shdev->chan_reg = devm_ioremap_resource(&pdev->dev, chan);
-	if (IS_ERR(shdev->chan_reg))
-		return PTR_ERR(shdev->chan_reg);
-	if (dmars) {
-		shdev->dmars = devm_ioremap_resource(&pdev->dev, dmars);
-		if (IS_ERR(shdev->dmars))
-			return PTR_ERR(shdev->dmars);
-	}
-
-	dma_dev->src_addr_widths = widths;
-	dma_dev->dst_addr_widths = widths;
-	dma_dev->directions = BIT(DMA_MEM_TO_DEV) | BIT(DMA_DEV_TO_MEM);
-	dma_dev->residue_granularity = DMA_RESIDUE_GRANULARITY_DESCRIPTOR;
-
-	if (!pdata->slave_only)
-		dma_cap_set(DMA_MEMCPY, dma_dev->cap_mask);
-	if (pdata->slave && pdata->slave_num)
-		dma_cap_set(DMA_SLAVE, dma_dev->cap_mask);
-
-	/* Default transfer size of 32 bytes requires 32-byte alignment */
-	dma_dev->copy_align = LOG2_DEFAULT_XFER_SIZE;
-
-	shdev->shdma_dev.ops = &sh_dmae_shdma_ops;
-	shdev->shdma_dev.desc_size = sizeof(struct sh_dmae_desc);
-	err = shdma_init(&pdev->dev, &shdev->shdma_dev,
-			      pdata->channel_num);
-	if (err < 0)
-		goto eshdma;
-
-	/* platform data */
-	shdev->pdata = pdata;
-
-	if (pdata->chcr_offset)
-		shdev->chcr_offset = pdata->chcr_offset;
-	else
-		shdev->chcr_offset = CHCR;
-
-	if (pdata->chcr_ie_bit)
-		shdev->chcr_ie_bit = pdata->chcr_ie_bit;
-	else
-		shdev->chcr_ie_bit = CHCR_IE;
-
-	platform_set_drvdata(pdev, shdev);
-
-	pm_runtime_enable(&pdev->dev);
-	err = pm_runtime_get_sync(&pdev->dev);
-	if (err < 0)
-		dev_err(&pdev->dev, "%s(): GET = %d\n", __func__, err);
-
-	spin_lock_irq(&sh_dmae_lock);
-	list_add_tail_rcu(&shdev->node, &sh_dmae_devices);
-	spin_unlock_irq(&sh_dmae_lock);
-
-	/* reset dma controller - only needed as a test */
-	err = sh_dmae_rst(shdev);
-	if (err)
-		goto rst_err;
-
-	if (IS_ENABLED(CONFIG_CPU_SH4) || IS_ENABLED(CONFIG_ARCH_RENESAS)) {
-		chanirq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
-
-		if (!chanirq_res)
-			chanirq_res = errirq_res;
-		else
-			irqres++;
-
-		if (chanirq_res == errirq_res ||
-		    (errirq_res->flags & IORESOURCE_BITS) == IORESOURCE_IRQ_SHAREABLE)
-			irqflags = IRQF_SHARED;
-
-		errirq = errirq_res->start;
-
-		err = devm_request_irq(&pdev->dev, errirq, sh_dmae_err,
-				       irqflags, "DMAC Address Error", shdev);
-		if (err) {
-			dev_err(&pdev->dev,
-				"DMA failed requesting irq #%d, error %d\n",
-				errirq, err);
-			goto eirq_err;
-		}
-	} else {
-		chanirq_res = errirq_res;
-	}
-
-	if (chanirq_res->start == chanirq_res->end &&
-	    !platform_get_resource(pdev, IORESOURCE_IRQ, 1)) {
-		/* Special case - all multiplexed */
-		for (; irq_cnt < pdata->channel_num; irq_cnt++) {
-			if (irq_cnt < SH_DMAE_MAX_CHANNELS) {
-				chan_irq[irq_cnt] = chanirq_res->start;
-				chan_flag[irq_cnt] = IRQF_SHARED;
-			} else {
-				irq_cap = 1;
-				break;
-			}
-		}
-	} else {
-		do {
-			for (i = chanirq_res->start; i <= chanirq_res->end; i++) {
-				if (irq_cnt >= SH_DMAE_MAX_CHANNELS) {
-					irq_cap = 1;
-					break;
-				}
-
-				if ((errirq_res->flags & IORESOURCE_BITS) ==
-				    IORESOURCE_IRQ_SHAREABLE)
-					chan_flag[irq_cnt] = IRQF_SHARED;
-				else
-					chan_flag[irq_cnt] = 0;
-				dev_dbg(&pdev->dev,
-					"Found IRQ %d for channel %d\n",
-					i, irq_cnt);
-				chan_irq[irq_cnt++] = i;
-			}
-
-			if (irq_cnt >= SH_DMAE_MAX_CHANNELS)
-				break;
-
-			chanirq_res = platform_get_resource(pdev,
-						IORESOURCE_IRQ, ++irqres);
-		} while (irq_cnt < pdata->channel_num && chanirq_res);
-	}
-
-	/* Create DMA Channel */
-	for (i = 0; i < irq_cnt; i++) {
-		err = sh_dmae_chan_probe(shdev, i, chan_irq[i], chan_flag[i]);
-		if (err)
-			goto chan_probe_err;
-	}
-
-	if (irq_cap)
-		dev_notice(&pdev->dev, "Attempting to register %d DMA "
-			   "channels when a maximum of %d are supported.\n",
-			   pdata->channel_num, SH_DMAE_MAX_CHANNELS);
-
-	pm_runtime_put(&pdev->dev);
-
-	err = dma_async_device_register(&shdev->shdma_dev.dma_dev);
-	if (err < 0)
-		goto edmadevreg;
-
-	return err;
-
-edmadevreg:
-	pm_runtime_get(&pdev->dev);
-
-chan_probe_err:
-	sh_dmae_chan_remove(shdev);
-
-eirq_err:
-rst_err:
-	spin_lock_irq(&sh_dmae_lock);
-	list_del_rcu(&shdev->node);
-	spin_unlock_irq(&sh_dmae_lock);
-
-	pm_runtime_put(&pdev->dev);
-	pm_runtime_disable(&pdev->dev);
-
-	shdma_cleanup(&shdev->shdma_dev);
-eshdma:
-	synchronize_rcu();
-
-	return err;
-}
-
-static int sh_dmae_remove(struct platform_device *pdev)
-{
-	struct sh_dmae_device *shdev = platform_get_drvdata(pdev);
-	struct dma_device *dma_dev = &shdev->shdma_dev.dma_dev;
-
-	dma_async_device_unregister(dma_dev);
-
-	spin_lock_irq(&sh_dmae_lock);
-	list_del_rcu(&shdev->node);
-	spin_unlock_irq(&sh_dmae_lock);
-
-	pm_runtime_disable(&pdev->dev);
-
-	sh_dmae_chan_remove(shdev);
-	shdma_cleanup(&shdev->shdma_dev);
-
-	synchronize_rcu();
-
-	return 0;
-}
-
-static struct platform_driver sh_dmae_driver = {
-	.driver		= {
-		.pm	= &sh_dmae_pm,
-		.name	= SH_DMAE_DRV_NAME,
-	},
-	.remove		= sh_dmae_remove,
-};
-
-static int __init sh_dmae_init(void)
-{
-	/* Wire up NMI handling */
-	int err = register_die_notifier(&sh_dmae_nmi_notifier);
-	if (err)
-		return err;
-
-	return platform_driver_probe(&sh_dmae_driver, sh_dmae_probe);
-}
-module_init(sh_dmae_init);
-
-static void __exit sh_dmae_exit(void)
-{
-	platform_driver_unregister(&sh_dmae_driver);
-
-	unregister_die_notifier(&sh_dmae_nmi_notifier);
-}
-module_exit(sh_dmae_exit);
-
-MODULE_AUTHOR("Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>");
-MODULE_DESCRIPTION("Renesas SH DMA Engine driver");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:" SH_DMAE_DRV_NAME);
diff --git a/include/linux/shdma-base.h b/include/linux/shdma-base.h
index 6dfd05ef5c2d9f..dd32aba344757f 100644
--- a/include/linux/shdma-base.h
+++ b/include/linux/shdma-base.h
@@ -122,13 +122,9 @@ void shdma_chan_remove(struct shdma_chan *schan);
 int shdma_init(struct device *dev, struct shdma_dev *sdev,
 		    int chan_num);
 void shdma_cleanup(struct shdma_dev *sdev);
-#if IS_ENABLED(CONFIG_SH_DMAE_BASE)
-bool shdma_chan_filter(struct dma_chan *chan, void *arg);
-#else
 static inline bool shdma_chan_filter(struct dma_chan *chan, void *arg)
 {
 	return false;
 }
-#endif
 
 #endif
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 09/22] i2c: remove i2c-sh7760
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
                   ` (6 preceding siblings ...)
  2023-01-13  6:23 ` [PATCH 08/22] dmaengine: remove the shdmac driver Christoph Hellwig
@ 2023-01-13  6:23 ` Christoph Hellwig
  2023-01-13  6:23 ` [PATCH 10/22] input: remove sh_keysc Christoph Hellwig
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Now that arch/sh is removed this driver is dead code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/i2c/busses/Kconfig      |   9 -
 drivers/i2c/busses/Makefile     |   1 -
 drivers/i2c/busses/i2c-sh7760.c | 565 --------------------------------
 3 files changed, 575 deletions(-)
 delete mode 100644 drivers/i2c/busses/i2c-sh7760.c

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 22602c512a6e50..44267a023fd19a 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -1016,15 +1016,6 @@ config I2C_S3C2410
 	  Say Y here to include support for I2C controller in the
 	  Samsung SoCs (S3C, S5Pv210, Exynos).
 
-config I2C_SH7760
-	tristate "Renesas SH7760 I2C Controller"
-	depends on CPU_SUBTYPE_SH7760
-	help
-	  This driver supports the 2 I2C interfaces on the Renesas SH7760.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called i2c-sh7760.
-
 config I2C_SH_MOBILE
 	tristate "SuperH Mobile I2C Controller"
 	depends on ARCH_RENESAS || COMPILE_TEST
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index e73cdb1d2b5a85..6be213e5e4dd16 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -104,7 +104,6 @@ obj-$(CONFIG_I2C_RIIC)		+= i2c-riic.o
 obj-$(CONFIG_I2C_RK3X)		+= i2c-rk3x.o
 obj-$(CONFIG_I2C_RZV2M)		+= i2c-rzv2m.o
 obj-$(CONFIG_I2C_S3C2410)	+= i2c-s3c2410.o
-obj-$(CONFIG_I2C_SH7760)	+= i2c-sh7760.o
 obj-$(CONFIG_I2C_SH_MOBILE)	+= i2c-sh_mobile.o
 obj-$(CONFIG_I2C_SIMTEC)	+= i2c-simtec.o
 obj-$(CONFIG_I2C_SPRD)		+= i2c-sprd.o
diff --git a/drivers/i2c/busses/i2c-sh7760.c b/drivers/i2c/busses/i2c-sh7760.c
deleted file mode 100644
index 319d1fa617c883..00000000000000
--- a/drivers/i2c/busses/i2c-sh7760.c
+++ /dev/null
@@ -1,565 +0,0 @@
-/*
- * I2C bus driver for the SH7760 I2C Interfaces.
- *
- * (c) 2005-2008 MSC Vertriebsges.m.b.H, Manuel Lauss <mlau@msc-ge.com>
- *
- * licensed under the terms outlined in the file COPYING.
- *
- */
-
-#include <linux/completion.h>
-#include <linux/delay.h>
-#include <linux/err.h>
-#include <linux/i2c.h>
-#include <linux/interrupt.h>
-#include <linux/ioport.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-#include <linux/io.h>
-#include <linux/module.h>
-
-#include <asm/clock.h>
-#include <asm/i2c-sh7760.h>
-
-/* register offsets */
-#define I2CSCR		0x0		/* slave ctrl		*/
-#define I2CMCR		0x4		/* master ctrl		*/
-#define I2CSSR		0x8		/* slave status		*/
-#define I2CMSR		0xC		/* master status	*/
-#define I2CSIER		0x10		/* slave irq enable	*/
-#define I2CMIER		0x14		/* master irq enable	*/
-#define I2CCCR		0x18		/* clock dividers	*/
-#define I2CSAR		0x1c		/* slave address	*/
-#define I2CMAR		0x20		/* master address	*/
-#define I2CRXTX		0x24		/* data port		*/
-#define I2CFCR		0x28		/* fifo control		*/
-#define I2CFSR		0x2C		/* fifo status		*/
-#define I2CFIER		0x30		/* fifo irq enable	*/
-#define I2CRFDR		0x34		/* rx fifo count	*/
-#define I2CTFDR		0x38		/* tx fifo count	*/
-
-#define REGSIZE		0x3C
-
-#define MCR_MDBS	0x80		/* non-fifo mode switch	*/
-#define MCR_FSCL	0x40		/* override SCL pin	*/
-#define MCR_FSDA	0x20		/* override SDA pin	*/
-#define MCR_OBPC	0x10		/* override pins	*/
-#define MCR_MIE		0x08		/* master if enable	*/
-#define MCR_TSBE	0x04
-#define MCR_FSB		0x02		/* force stop bit	*/
-#define MCR_ESG		0x01		/* en startbit gen.	*/
-
-#define MSR_MNR		0x40		/* nack received	*/
-#define MSR_MAL		0x20		/* arbitration lost	*/
-#define MSR_MST		0x10		/* sent a stop		*/
-#define MSR_MDE		0x08
-#define MSR_MDT		0x04
-#define MSR_MDR		0x02
-#define MSR_MAT		0x01		/* slave addr xfer done	*/
-
-#define MIE_MNRE	0x40		/* nack irq en		*/
-#define MIE_MALE	0x20		/* arblos irq en	*/
-#define MIE_MSTE	0x10		/* stop irq en		*/
-#define MIE_MDEE	0x08
-#define MIE_MDTE	0x04
-#define MIE_MDRE	0x02
-#define MIE_MATE	0x01		/* address sent irq en	*/
-
-#define FCR_RFRST	0x02		/* reset rx fifo	*/
-#define FCR_TFRST	0x01		/* reset tx fifo	*/
-
-#define FSR_TEND	0x04		/* last byte sent	*/
-#define FSR_RDF		0x02		/* rx fifo trigger	*/
-#define FSR_TDFE	0x01		/* tx fifo empty	*/
-
-#define FIER_TEIE	0x04		/* tx fifo empty irq en	*/
-#define FIER_RXIE	0x02		/* rx fifo trig irq en	*/
-#define FIER_TXIE	0x01		/* tx fifo trig irq en	*/
-
-#define FIFO_SIZE	16
-
-struct cami2c {
-	void __iomem *iobase;
-	struct i2c_adapter adap;
-
-	/* message processing */
-	struct i2c_msg	*msg;
-#define IDF_SEND	1
-#define IDF_RECV	2
-#define IDF_STOP	4
-	int		flags;
-
-#define IDS_DONE	1
-#define IDS_ARBLOST	2
-#define IDS_NACK	4
-	int		status;
-	struct completion xfer_done;
-
-	int irq;
-	struct resource *ioarea;
-};
-
-static inline void OUT32(struct cami2c *cam, int reg, unsigned long val)
-{
-	__raw_writel(val, (unsigned long)cam->iobase + reg);
-}
-
-static inline unsigned long IN32(struct cami2c *cam, int reg)
-{
-	return __raw_readl((unsigned long)cam->iobase + reg);
-}
-
-static irqreturn_t sh7760_i2c_irq(int irq, void *ptr)
-{
-	struct cami2c *id = ptr;
-	struct i2c_msg *msg = id->msg;
-	char *data = msg->buf;
-	unsigned long msr, fsr, fier, len;
-
-	msr = IN32(id, I2CMSR);
-	fsr = IN32(id, I2CFSR);
-
-	/* arbitration lost */
-	if (msr & MSR_MAL) {
-		OUT32(id, I2CMCR, 0);
-		OUT32(id, I2CSCR, 0);
-		OUT32(id, I2CSAR, 0);
-		id->status |= IDS_DONE | IDS_ARBLOST;
-		goto out;
-	}
-
-	if (msr & MSR_MNR) {
-		/* NACK handling is very screwed up.  After receiving a
-		 * NAK IRQ one has to wait a bit  before writing to any
-		 * registers, or the ctl will lock up. After that delay
-		 * do a normal i2c stop. Then wait at least 1 ms before
-		 * attempting another transfer or ctl will stop working
-		 */
-		udelay(100);	/* wait or risk ctl hang */
-		OUT32(id, I2CFCR, FCR_RFRST | FCR_TFRST);
-		OUT32(id, I2CMCR, MCR_MIE | MCR_FSB);
-		OUT32(id, I2CFIER, 0);
-		OUT32(id, I2CMIER, MIE_MSTE);
-		OUT32(id, I2CSCR, 0);
-		OUT32(id, I2CSAR, 0);
-		id->status |= IDS_NACK;
-		msr &= ~MSR_MAT;
-		fsr = 0;
-		/* In some cases the MST bit is also set. */
-	}
-
-	/* i2c-stop was sent */
-	if (msr & MSR_MST) {
-		id->status |= IDS_DONE;
-		goto out;
-	}
-
-	/* i2c slave addr was sent; set to "normal" operation */
-	if (msr & MSR_MAT)
-		OUT32(id, I2CMCR, MCR_MIE);
-
-	fier = IN32(id, I2CFIER);
-
-	if (fsr & FSR_RDF) {
-		len = IN32(id, I2CRFDR);
-		if (msg->len <= len) {
-			if (id->flags & IDF_STOP) {
-				OUT32(id, I2CMCR, MCR_MIE | MCR_FSB);
-				OUT32(id, I2CFIER, 0);
-				/* manual says: wait >= 0.5 SCL times */
-				udelay(5);
-				/* next int should be MST */
-			} else {
-				id->status |= IDS_DONE;
-				/* keep the RDF bit: ctrl holds SCL low
-				 * until the setup for the next i2c_msg
-				 * clears this bit.
-				 */
-				fsr &= ~FSR_RDF;
-			}
-		}
-		while (msg->len && len) {
-			*data++ = IN32(id, I2CRXTX);
-			msg->len--;
-			len--;
-		}
-
-		if (msg->len) {
-			len = (msg->len >= FIFO_SIZE) ? FIFO_SIZE - 1
-						      : msg->len - 1;
-
-			OUT32(id, I2CFCR, FCR_TFRST | ((len & 0xf) << 4));
-		}
-
-	} else if (id->flags & IDF_SEND) {
-		if ((fsr & FSR_TEND) && (msg->len < 1)) {
-			if (id->flags & IDF_STOP) {
-				OUT32(id, I2CMCR, MCR_MIE | MCR_FSB);
-			} else {
-				id->status |= IDS_DONE;
-				/* keep the TEND bit: ctl holds SCL low
-				 * until the setup for the next i2c_msg
-				 * clears this bit.
-				 */
-				fsr &= ~FSR_TEND;
-			}
-		}
-		if (fsr & FSR_TDFE) {
-			while (msg->len && (IN32(id, I2CTFDR) < FIFO_SIZE)) {
-				OUT32(id, I2CRXTX, *data++);
-				msg->len--;
-			}
-
-			if (msg->len < 1) {
-				fier &= ~FIER_TXIE;
-				OUT32(id, I2CFIER, fier);
-			} else {
-				len = (msg->len >= FIFO_SIZE) ? 2 : 0;
-				OUT32(id, I2CFCR,
-					  FCR_RFRST | ((len & 3) << 2));
-			}
-		}
-	}
-out:
-	if (id->status & IDS_DONE) {
-		OUT32(id, I2CMIER, 0);
-		OUT32(id, I2CFIER, 0);
-		id->msg = NULL;
-		complete(&id->xfer_done);
-	}
-	/* clear status flags and ctrl resumes work */
-	OUT32(id, I2CMSR, ~msr);
-	OUT32(id, I2CFSR, ~fsr);
-	OUT32(id, I2CSSR, 0);
-
-	return IRQ_HANDLED;
-}
-
-
-/* prepare and start a master receive operation */
-static void sh7760_i2c_mrecv(struct cami2c *id)
-{
-	int len;
-
-	id->flags |= IDF_RECV;
-
-	/* set the slave addr reg; otherwise rcv wont work! */
-	OUT32(id, I2CSAR, 0xfe);
-	OUT32(id, I2CMAR, (id->msg->addr << 1) | 1);
-
-	/* adjust rx fifo trigger */
-	if (id->msg->len >= FIFO_SIZE)
-		len = FIFO_SIZE - 1;	/* trigger at fifo full */
-	else
-		len = id->msg->len - 1;	/* trigger before all received */
-
-	OUT32(id, I2CFCR, FCR_RFRST | FCR_TFRST);
-	OUT32(id, I2CFCR, FCR_TFRST | ((len & 0xF) << 4));
-
-	OUT32(id, I2CMSR, 0);
-	OUT32(id, I2CMCR, MCR_MIE | MCR_ESG);
-	OUT32(id, I2CMIER, MIE_MNRE | MIE_MALE | MIE_MSTE | MIE_MATE);
-	OUT32(id, I2CFIER, FIER_RXIE);
-}
-
-/* prepare and start a master send operation */
-static void sh7760_i2c_msend(struct cami2c *id)
-{
-	int len;
-
-	id->flags |= IDF_SEND;
-
-	/* set the slave addr reg; otherwise xmit wont work! */
-	OUT32(id, I2CSAR, 0xfe);
-	OUT32(id, I2CMAR, (id->msg->addr << 1) | 0);
-
-	/* adjust tx fifo trigger */
-	if (id->msg->len >= FIFO_SIZE)
-		len = 2;	/* trig: 2 bytes left in TX fifo */
-	else
-		len = 0;	/* trig: 8 bytes left in TX fifo */
-
-	OUT32(id, I2CFCR, FCR_RFRST | FCR_TFRST);
-	OUT32(id, I2CFCR, FCR_RFRST | ((len & 3) << 2));
-
-	while (id->msg->len && IN32(id, I2CTFDR) < FIFO_SIZE) {
-		OUT32(id, I2CRXTX, *(id->msg->buf));
-		(id->msg->len)--;
-		(id->msg->buf)++;
-	}
-
-	OUT32(id, I2CMSR, 0);
-	OUT32(id, I2CMCR, MCR_MIE | MCR_ESG);
-	OUT32(id, I2CFSR, 0);
-	OUT32(id, I2CMIER, MIE_MNRE | MIE_MALE | MIE_MSTE | MIE_MATE);
-	OUT32(id, I2CFIER, FIER_TEIE | (id->msg->len ? FIER_TXIE : 0));
-}
-
-static inline int sh7760_i2c_busy_check(struct cami2c *id)
-{
-	return (IN32(id, I2CMCR) & MCR_FSDA);
-}
-
-static int sh7760_i2c_master_xfer(struct i2c_adapter *adap,
-				  struct i2c_msg *msgs,
-				  int num)
-{
-	struct cami2c *id = adap->algo_data;
-	int i, retr;
-
-	if (sh7760_i2c_busy_check(id)) {
-		dev_err(&adap->dev, "sh7760-i2c%d: bus busy!\n", adap->nr);
-		return -EBUSY;
-	}
-
-	i = 0;
-	while (i < num) {
-		retr = adap->retries;
-retry:
-		id->flags = ((i == (num-1)) ? IDF_STOP : 0);
-		id->status = 0;
-		id->msg = msgs;
-		init_completion(&id->xfer_done);
-
-		if (msgs->flags & I2C_M_RD)
-			sh7760_i2c_mrecv(id);
-		else
-			sh7760_i2c_msend(id);
-
-		wait_for_completion(&id->xfer_done);
-
-		if (id->status == 0) {
-			num = -EIO;
-			break;
-		}
-
-		if (id->status & IDS_NACK) {
-			/* wait a bit or i2c module stops working */
-			mdelay(1);
-			num = -EREMOTEIO;
-			break;
-		}
-
-		if (id->status & IDS_ARBLOST) {
-			if (retr--) {
-				mdelay(2);
-				goto retry;
-			}
-			num = -EREMOTEIO;
-			break;
-		}
-
-		msgs++;
-		i++;
-	}
-
-	id->msg = NULL;
-	id->flags = 0;
-	id->status = 0;
-
-	OUT32(id, I2CMCR, 0);
-	OUT32(id, I2CMSR, 0);
-	OUT32(id, I2CMIER, 0);
-	OUT32(id, I2CFIER, 0);
-
-	/* reset slave module registers too: master mode enables slave
-	 * module for receive ops (ack, data). Without this reset,
-	 * eternal bus activity might be reported after NACK / ARBLOST.
-	 */
-	OUT32(id, I2CSCR, 0);
-	OUT32(id, I2CSAR, 0);
-	OUT32(id, I2CSSR, 0);
-
-	return num;
-}
-
-static u32 sh7760_i2c_func(struct i2c_adapter *adap)
-{
-	return I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
-}
-
-static const struct i2c_algorithm sh7760_i2c_algo = {
-	.master_xfer	= sh7760_i2c_master_xfer,
-	.functionality	= sh7760_i2c_func,
-};
-
-/* calculate CCR register setting for a desired scl clock.  SCL clock is
- * derived from I2C module clock  (iclk)  which in turn is derived from
- * peripheral module clock (mclk, usually around 33MHz):
- * iclk = mclk/(CDF + 1).  iclk must be < 20MHz.
- * scl = iclk/(SCGD*8 + 20).
- */
-static int calc_CCR(unsigned long scl_hz)
-{
-	struct clk *mclk;
-	unsigned long mck, m1, dff, odff, iclk;
-	signed char cdf, cdfm;
-	int scgd, scgdm, scgds;
-
-	mclk = clk_get(NULL, "peripheral_clk");
-	if (IS_ERR(mclk)) {
-		return PTR_ERR(mclk);
-	} else {
-		mck = mclk->rate;
-		clk_put(mclk);
-	}
-
-	odff = scl_hz;
-	scgdm = cdfm = m1 = 0;
-	for (cdf = 3; cdf >= 0; cdf--) {
-		iclk = mck / (1 + cdf);
-		if (iclk >= 20000000)
-			continue;
-		scgds = ((iclk / scl_hz) - 20) >> 3;
-		for (scgd = scgds; (scgd < 63) && scgd <= scgds + 1; scgd++) {
-			m1 = iclk / (20 + (scgd << 3));
-			dff = abs(scl_hz - m1);
-			if (dff < odff) {
-				odff = dff;
-				cdfm = cdf;
-				scgdm = scgd;
-			}
-		}
-	}
-	/* fail if more than 25% off of requested SCL */
-	if (odff > (scl_hz >> 2))
-		return -EINVAL;
-
-	/* create a CCR register value */
-	return ((scgdm << 2) | cdfm);
-}
-
-static int sh7760_i2c_probe(struct platform_device *pdev)
-{
-	struct sh7760_i2c_platdata *pd;
-	struct resource *res;
-	struct cami2c *id;
-	int ret;
-
-	pd = dev_get_platdata(&pdev->dev);
-	if (!pd) {
-		dev_err(&pdev->dev, "no platform_data!\n");
-		ret = -ENODEV;
-		goto out0;
-	}
-
-	id = kzalloc(sizeof(struct cami2c), GFP_KERNEL);
-	if (!id) {
-		dev_err(&pdev->dev, "no mem for private data\n");
-		ret = -ENOMEM;
-		goto out0;
-	}
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "no mmio resources\n");
-		ret = -ENODEV;
-		goto out1;
-	}
-
-	id->ioarea = request_mem_region(res->start, REGSIZE, pdev->name);
-	if (!id->ioarea) {
-		dev_err(&pdev->dev, "mmio already reserved\n");
-		ret = -EBUSY;
-		goto out1;
-	}
-
-	id->iobase = ioremap(res->start, REGSIZE);
-	if (!id->iobase) {
-		dev_err(&pdev->dev, "cannot ioremap\n");
-		ret = -ENODEV;
-		goto out2;
-	}
-
-	ret = platform_get_irq(pdev, 0);
-	if (ret < 0)
-		goto out3;
-	id->irq = ret;
-
-	id->adap.nr = pdev->id;
-	id->adap.algo = &sh7760_i2c_algo;
-	id->adap.class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
-	id->adap.retries = 3;
-	id->adap.algo_data = id;
-	id->adap.dev.parent = &pdev->dev;
-	snprintf(id->adap.name, sizeof(id->adap.name),
-		"SH7760 I2C at %08lx", (unsigned long)res->start);
-
-	OUT32(id, I2CMCR, 0);
-	OUT32(id, I2CMSR, 0);
-	OUT32(id, I2CMIER, 0);
-	OUT32(id, I2CMAR, 0);
-	OUT32(id, I2CSIER, 0);
-	OUT32(id, I2CSAR, 0);
-	OUT32(id, I2CSCR, 0);
-	OUT32(id, I2CSSR, 0);
-	OUT32(id, I2CFIER, 0);
-	OUT32(id, I2CFCR, FCR_RFRST | FCR_TFRST);
-	OUT32(id, I2CFSR, 0);
-
-	ret = calc_CCR(pd->speed_khz * 1000);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "invalid SCL clock: %dkHz\n",
-			pd->speed_khz);
-		goto out3;
-	}
-	OUT32(id, I2CCCR, ret);
-
-	if (request_irq(id->irq, sh7760_i2c_irq, 0,
-			SH7760_I2C_DEVNAME, id)) {
-		dev_err(&pdev->dev, "cannot get irq %d\n", id->irq);
-		ret = -EBUSY;
-		goto out3;
-	}
-
-	ret = i2c_add_numbered_adapter(&id->adap);
-	if (ret < 0)
-		goto out4;
-
-	platform_set_drvdata(pdev, id);
-
-	dev_info(&pdev->dev, "%d kHz mmio %08x irq %d\n",
-		 pd->speed_khz, res->start, id->irq);
-
-	return 0;
-
-out4:
-	free_irq(id->irq, id);
-out3:
-	iounmap(id->iobase);
-out2:
-	release_resource(id->ioarea);
-	kfree(id->ioarea);
-out1:
-	kfree(id);
-out0:
-	return ret;
-}
-
-static int sh7760_i2c_remove(struct platform_device *pdev)
-{
-	struct cami2c *id = platform_get_drvdata(pdev);
-
-	i2c_del_adapter(&id->adap);
-	free_irq(id->irq, id);
-	iounmap(id->iobase);
-	release_resource(id->ioarea);
-	kfree(id->ioarea);
-	kfree(id);
-
-	return 0;
-}
-
-static struct platform_driver sh7760_i2c_drv = {
-	.driver	= {
-		.name	= SH7760_I2C_DEVNAME,
-	},
-	.probe		= sh7760_i2c_probe,
-	.remove		= sh7760_i2c_remove,
-};
-
-module_platform_driver(sh7760_i2c_drv);
-
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("SH7760 I2C bus driver");
-MODULE_AUTHOR("Manuel Lauss <mano@roarinelk.homelinux.net>");
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 10/22] input: remove sh_keysc
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
                   ` (7 preceding siblings ...)
  2023-01-13  6:23 ` [PATCH 09/22] i2c: remove i2c-sh7760 Christoph Hellwig
@ 2023-01-13  6:23 ` Christoph Hellwig
  2023-01-13  8:28   ` Geert Uytterhoeven
  2023-01-13  6:23 ` [PATCH 11/22] mtd/nand: remove sh_flctl Christoph Hellwig
                   ` (12 subsequent siblings)
  21 siblings, 1 reply; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Now that arch/sh is removed this driver is dead code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/input/keyboard/Kconfig    |  10 -
 drivers/input/keyboard/Makefile   |   1 -
 drivers/input/keyboard/sh_keysc.c | 334 ------------------------------
 3 files changed, 345 deletions(-)
 delete mode 100644 drivers/input/keyboard/sh_keysc.c

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 84490915ae4d5a..882ec5fef214ac 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -625,16 +625,6 @@ config KEYBOARD_SUNKBD
 	  To compile this driver as a module, choose M here: the
 	  module will be called sunkbd.
 
-config KEYBOARD_SH_KEYSC
-	tristate "SuperH KEYSC keypad support"
-	depends on ARCH_SHMOBILE || COMPILE_TEST
-	help
-	  Say Y here if you want to use a keypad attached to the KEYSC block
-	  on SuperH processors such as sh7722 and sh7343.
-
-	  To compile this driver as a module, choose M here: the
-	  module will be called sh_keysc.
-
 config KEYBOARD_STMPE
 	tristate "STMPE keypad support"
 	depends on MFD_STMPE
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index 5f67196bb2c1ea..8aba0b052b4504 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -60,7 +60,6 @@ obj-$(CONFIG_KEYBOARD_QT1050)           += qt1050.o
 obj-$(CONFIG_KEYBOARD_QT1070)           += qt1070.o
 obj-$(CONFIG_KEYBOARD_QT2160)		+= qt2160.o
 obj-$(CONFIG_KEYBOARD_SAMSUNG)		+= samsung-keypad.o
-obj-$(CONFIG_KEYBOARD_SH_KEYSC)		+= sh_keysc.o
 obj-$(CONFIG_KEYBOARD_SNVS_PWRKEY)	+= snvs_pwrkey.o
 obj-$(CONFIG_KEYBOARD_SPEAR)		+= spear-keyboard.o
 obj-$(CONFIG_KEYBOARD_STMPE)		+= stmpe-keypad.o
diff --git a/drivers/input/keyboard/sh_keysc.c b/drivers/input/keyboard/sh_keysc.c
deleted file mode 100644
index 2c00320f739fc1..00000000000000
--- a/drivers/input/keyboard/sh_keysc.c
+++ /dev/null
@@ -1,334 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * SuperH KEYSC Keypad Driver
- *
- * Copyright (C) 2008 Magnus Damm
- *
- * Based on gpio_keys.c, Copyright 2005 Phil Blundell
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/delay.h>
-#include <linux/platform_device.h>
-#include <linux/input.h>
-#include <linux/input/sh_keysc.h>
-#include <linux/bitmap.h>
-#include <linux/pm_runtime.h>
-#include <linux/io.h>
-#include <linux/slab.h>
-
-static const struct {
-	unsigned char kymd, keyout, keyin;
-} sh_keysc_mode[] = {
-	[SH_KEYSC_MODE_1] = { 0, 6, 5 },
-	[SH_KEYSC_MODE_2] = { 1, 5, 6 },
-	[SH_KEYSC_MODE_3] = { 2, 4, 7 },
-	[SH_KEYSC_MODE_4] = { 3, 6, 6 },
-	[SH_KEYSC_MODE_5] = { 4, 6, 7 },
-	[SH_KEYSC_MODE_6] = { 5, 8, 8 },
-};
-
-struct sh_keysc_priv {
-	void __iomem *iomem_base;
-	DECLARE_BITMAP(last_keys, SH_KEYSC_MAXKEYS);
-	struct input_dev *input;
-	struct sh_keysc_info pdata;
-};
-
-#define KYCR1 0
-#define KYCR2 1
-#define KYINDR 2
-#define KYOUTDR 3
-
-#define KYCR2_IRQ_LEVEL    0x10
-#define KYCR2_IRQ_DISABLED 0x00
-
-static unsigned long sh_keysc_read(struct sh_keysc_priv *p, int reg_nr)
-{
-	return ioread16(p->iomem_base + (reg_nr << 2));
-}
-
-static void sh_keysc_write(struct sh_keysc_priv *p, int reg_nr,
-			   unsigned long value)
-{
-	iowrite16(value, p->iomem_base + (reg_nr << 2));
-}
-
-static void sh_keysc_level_mode(struct sh_keysc_priv *p,
-				unsigned long keys_set)
-{
-	struct sh_keysc_info *pdata = &p->pdata;
-
-	sh_keysc_write(p, KYOUTDR, 0);
-	sh_keysc_write(p, KYCR2, KYCR2_IRQ_LEVEL | (keys_set << 8));
-
-	if (pdata->kycr2_delay)
-		udelay(pdata->kycr2_delay);
-}
-
-static void sh_keysc_map_dbg(struct device *dev, unsigned long *map,
-			     const char *str)
-{
-	int k;
-
-	for (k = 0; k < BITS_TO_LONGS(SH_KEYSC_MAXKEYS); k++)
-		dev_dbg(dev, "%s[%d] 0x%lx\n", str, k, map[k]);
-}
-
-static irqreturn_t sh_keysc_isr(int irq, void *dev_id)
-{
-	struct platform_device *pdev = dev_id;
-	struct sh_keysc_priv *priv = platform_get_drvdata(pdev);
-	struct sh_keysc_info *pdata = &priv->pdata;
-	int keyout_nr = sh_keysc_mode[pdata->mode].keyout;
-	int keyin_nr = sh_keysc_mode[pdata->mode].keyin;
-	DECLARE_BITMAP(keys, SH_KEYSC_MAXKEYS);
-	DECLARE_BITMAP(keys0, SH_KEYSC_MAXKEYS);
-	DECLARE_BITMAP(keys1, SH_KEYSC_MAXKEYS);
-	unsigned char keyin_set, tmp;
-	int i, k, n;
-
-	dev_dbg(&pdev->dev, "isr!\n");
-
-	bitmap_fill(keys1, SH_KEYSC_MAXKEYS);
-	bitmap_zero(keys0, SH_KEYSC_MAXKEYS);
-
-	do {
-		bitmap_zero(keys, SH_KEYSC_MAXKEYS);
-		keyin_set = 0;
-
-		sh_keysc_write(priv, KYCR2, KYCR2_IRQ_DISABLED);
-
-		for (i = 0; i < keyout_nr; i++) {
-			n = keyin_nr * i;
-
-			/* drive one KEYOUT pin low, read KEYIN pins */
-			sh_keysc_write(priv, KYOUTDR, 0xffff ^ (3 << (i * 2)));
-			udelay(pdata->delay);
-			tmp = sh_keysc_read(priv, KYINDR);
-
-			/* set bit if key press has been detected */
-			for (k = 0; k < keyin_nr; k++) {
-				if (tmp & (1 << k))
-					__set_bit(n + k, keys);
-			}
-
-			/* keep track of which KEYIN bits that have been set */
-			keyin_set |= tmp ^ ((1 << keyin_nr) - 1);
-		}
-
-		sh_keysc_level_mode(priv, keyin_set);
-
-		bitmap_complement(keys, keys, SH_KEYSC_MAXKEYS);
-		bitmap_and(keys1, keys1, keys, SH_KEYSC_MAXKEYS);
-		bitmap_or(keys0, keys0, keys, SH_KEYSC_MAXKEYS);
-
-		sh_keysc_map_dbg(&pdev->dev, keys, "keys");
-
-	} while (sh_keysc_read(priv, KYCR2) & 0x01);
-
-	sh_keysc_map_dbg(&pdev->dev, priv->last_keys, "last_keys");
-	sh_keysc_map_dbg(&pdev->dev, keys0, "keys0");
-	sh_keysc_map_dbg(&pdev->dev, keys1, "keys1");
-
-	for (i = 0; i < SH_KEYSC_MAXKEYS; i++) {
-		k = pdata->keycodes[i];
-		if (!k)
-			continue;
-
-		if (test_bit(i, keys0) == test_bit(i, priv->last_keys))
-			continue;
-
-		if (test_bit(i, keys1) || test_bit(i, keys0)) {
-			input_event(priv->input, EV_KEY, k, 1);
-			__set_bit(i, priv->last_keys);
-		}
-
-		if (!test_bit(i, keys1)) {
-			input_event(priv->input, EV_KEY, k, 0);
-			__clear_bit(i, priv->last_keys);
-		}
-
-	}
-	input_sync(priv->input);
-
-	return IRQ_HANDLED;
-}
-
-static int sh_keysc_probe(struct platform_device *pdev)
-{
-	struct sh_keysc_priv *priv;
-	struct sh_keysc_info *pdata;
-	struct resource *res;
-	struct input_dev *input;
-	int i;
-	int irq, error;
-
-	if (!dev_get_platdata(&pdev->dev)) {
-		dev_err(&pdev->dev, "no platform data defined\n");
-		error = -EINVAL;
-		goto err0;
-	}
-
-	error = -ENXIO;
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (res == NULL) {
-		dev_err(&pdev->dev, "failed to get I/O memory\n");
-		goto err0;
-	}
-
-	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
-		goto err0;
-
-	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
-	if (priv == NULL) {
-		dev_err(&pdev->dev, "failed to allocate driver data\n");
-		error = -ENOMEM;
-		goto err0;
-	}
-
-	platform_set_drvdata(pdev, priv);
-	memcpy(&priv->pdata, dev_get_platdata(&pdev->dev), sizeof(priv->pdata));
-	pdata = &priv->pdata;
-
-	priv->iomem_base = ioremap(res->start, resource_size(res));
-	if (priv->iomem_base == NULL) {
-		dev_err(&pdev->dev, "failed to remap I/O memory\n");
-		error = -ENXIO;
-		goto err1;
-	}
-
-	priv->input = input_allocate_device();
-	if (!priv->input) {
-		dev_err(&pdev->dev, "failed to allocate input device\n");
-		error = -ENOMEM;
-		goto err2;
-	}
-
-	input = priv->input;
-	input->evbit[0] = BIT_MASK(EV_KEY);
-
-	input->name = pdev->name;
-	input->phys = "sh-keysc-keys/input0";
-	input->dev.parent = &pdev->dev;
-
-	input->id.bustype = BUS_HOST;
-	input->id.vendor = 0x0001;
-	input->id.product = 0x0001;
-	input->id.version = 0x0100;
-
-	input->keycode = pdata->keycodes;
-	input->keycodesize = sizeof(pdata->keycodes[0]);
-	input->keycodemax = ARRAY_SIZE(pdata->keycodes);
-
-	error = request_threaded_irq(irq, NULL, sh_keysc_isr, IRQF_ONESHOT,
-				     dev_name(&pdev->dev), pdev);
-	if (error) {
-		dev_err(&pdev->dev, "failed to request IRQ\n");
-		goto err3;
-	}
-
-	for (i = 0; i < SH_KEYSC_MAXKEYS; i++)
-		__set_bit(pdata->keycodes[i], input->keybit);
-	__clear_bit(KEY_RESERVED, input->keybit);
-
-	error = input_register_device(input);
-	if (error) {
-		dev_err(&pdev->dev, "failed to register input device\n");
-		goto err4;
-	}
-
-	pm_runtime_enable(&pdev->dev);
-	pm_runtime_get_sync(&pdev->dev);
-
-	sh_keysc_write(priv, KYCR1, (sh_keysc_mode[pdata->mode].kymd << 8) |
-		       pdata->scan_timing);
-	sh_keysc_level_mode(priv, 0);
-
-	device_init_wakeup(&pdev->dev, 1);
-
-	return 0;
-
- err4:
-	free_irq(irq, pdev);
- err3:
-	input_free_device(input);
- err2:
-	iounmap(priv->iomem_base);
- err1:
-	kfree(priv);
- err0:
-	return error;
-}
-
-static int sh_keysc_remove(struct platform_device *pdev)
-{
-	struct sh_keysc_priv *priv = platform_get_drvdata(pdev);
-
-	sh_keysc_write(priv, KYCR2, KYCR2_IRQ_DISABLED);
-
-	input_unregister_device(priv->input);
-	free_irq(platform_get_irq(pdev, 0), pdev);
-	iounmap(priv->iomem_base);
-
-	pm_runtime_put_sync(&pdev->dev);
-	pm_runtime_disable(&pdev->dev);
-
-	kfree(priv);
-
-	return 0;
-}
-
-static int sh_keysc_suspend(struct device *dev)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-	struct sh_keysc_priv *priv = platform_get_drvdata(pdev);
-	int irq = platform_get_irq(pdev, 0);
-	unsigned short value;
-
-	value = sh_keysc_read(priv, KYCR1);
-
-	if (device_may_wakeup(dev)) {
-		sh_keysc_write(priv, KYCR1, value | 0x80);
-		enable_irq_wake(irq);
-	} else {
-		sh_keysc_write(priv, KYCR1, value & ~0x80);
-		pm_runtime_put_sync(dev);
-	}
-
-	return 0;
-}
-
-static int sh_keysc_resume(struct device *dev)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-	int irq = platform_get_irq(pdev, 0);
-
-	if (device_may_wakeup(dev))
-		disable_irq_wake(irq);
-	else
-		pm_runtime_get_sync(dev);
-
-	return 0;
-}
-
-static DEFINE_SIMPLE_DEV_PM_OPS(sh_keysc_dev_pm_ops,
-				sh_keysc_suspend, sh_keysc_resume);
-
-static struct platform_driver sh_keysc_device_driver = {
-	.probe		= sh_keysc_probe,
-	.remove		= sh_keysc_remove,
-	.driver		= {
-		.name	= "sh_keysc",
-		.pm	= pm_sleep_ptr(&sh_keysc_dev_pm_ops),
-	}
-};
-module_platform_driver(sh_keysc_device_driver);
-
-MODULE_AUTHOR("Magnus Damm");
-MODULE_DESCRIPTION("SuperH KEYSC Keypad Driver");
-MODULE_LICENSE("GPL");
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 11/22] mtd/nand: remove sh_flctl
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
                   ` (8 preceding siblings ...)
  2023-01-13  6:23 ` [PATCH 10/22] input: remove sh_keysc Christoph Hellwig
@ 2023-01-13  6:23 ` Christoph Hellwig
  2023-01-13  8:30   ` Geert Uytterhoeven
  2023-01-13  6:23 ` [PATCH 12/22] net/ethernet/8390: remove stnic Christoph Hellwig
                   ` (11 subsequent siblings)
  21 siblings, 1 reply; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Now that arch/sh is removed this driver is dead code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/mtd/nand/raw/Kconfig    |    8 -
 drivers/mtd/nand/raw/Makefile   |    1 -
 drivers/mtd/nand/raw/sh_flctl.c | 1234 -------------------------------
 include/linux/mtd/sh_flctl.h    |  180 -----
 4 files changed, 1423 deletions(-)
 delete mode 100644 drivers/mtd/nand/raw/sh_flctl.c
 delete mode 100644 include/linux/mtd/sh_flctl.h

diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index 98ea1c9e65c8ef..20a4988ea418d5 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -284,14 +284,6 @@ config MTD_NAND_MXC
 	  This enables the driver for the NAND flash controller on the
 	  MXC processors.
 
-config MTD_NAND_SH_FLCTL
-	tristate "Renesas SuperH FLCTL NAND controller"
-	depends on SUPERH || COMPILE_TEST
-	depends on HAS_IOMEM
-	help
-	  Several Renesas SuperH CPU has FLCTL. This option enables support
-	  for NAND Flash using FLCTL.
-
 config MTD_NAND_DAVINCI
 	tristate "DaVinci/Keystone NAND controller"
 	depends on ARCH_DAVINCI || (ARCH_KEYSTONE && TI_AEMIF) || COMPILE_TEST
diff --git a/drivers/mtd/nand/raw/Makefile b/drivers/mtd/nand/raw/Makefile
index fa1d0012031012..2c6eb25c9d0aae 100644
--- a/drivers/mtd/nand/raw/Makefile
+++ b/drivers/mtd/nand/raw/Makefile
@@ -33,7 +33,6 @@ obj-$(CONFIG_MTD_NAND_FSL_IFC)		+= fsl_ifc_nand.o
 obj-$(CONFIG_MTD_NAND_FSL_UPM)		+= fsl_upm.o
 obj-$(CONFIG_MTD_NAND_SLC_LPC32XX)      += lpc32xx_slc.o
 obj-$(CONFIG_MTD_NAND_MLC_LPC32XX)      += lpc32xx_mlc.o
-obj-$(CONFIG_MTD_NAND_SH_FLCTL)		+= sh_flctl.o
 obj-$(CONFIG_MTD_NAND_MXC)		+= mxc_nand.o
 obj-$(CONFIG_MTD_NAND_SOCRATES)		+= socrates_nand.o
 obj-$(CONFIG_MTD_NAND_TXX9NDFMC)	+= txx9ndfmc.o
diff --git a/drivers/mtd/nand/raw/sh_flctl.c b/drivers/mtd/nand/raw/sh_flctl.c
deleted file mode 100644
index a278829469d610..00000000000000
--- a/drivers/mtd/nand/raw/sh_flctl.c
+++ /dev/null
@@ -1,1234 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * SuperH FLCTL nand controller
- *
- * Copyright (c) 2008 Renesas Solutions Corp.
- * Copyright (c) 2008 Atom Create Engineering Co., Ltd.
- *
- * Based on fsl_elbc_nand.c, Copyright (c) 2006-2007 Freescale Semiconductor
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/completion.h>
-#include <linux/delay.h>
-#include <linux/dmaengine.h>
-#include <linux/dma-mapping.h>
-#include <linux/interrupt.h>
-#include <linux/io.h>
-#include <linux/of.h>
-#include <linux/of_device.h>
-#include <linux/platform_device.h>
-#include <linux/pm_runtime.h>
-#include <linux/sh_dma.h>
-#include <linux/slab.h>
-#include <linux/string.h>
-
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/rawnand.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/sh_flctl.h>
-
-static int flctl_4secc_ooblayout_sp_ecc(struct mtd_info *mtd, int section,
-					struct mtd_oob_region *oobregion)
-{
-	struct nand_chip *chip = mtd_to_nand(mtd);
-
-	if (section)
-		return -ERANGE;
-
-	oobregion->offset = 0;
-	oobregion->length = chip->ecc.bytes;
-
-	return 0;
-}
-
-static int flctl_4secc_ooblayout_sp_free(struct mtd_info *mtd, int section,
-					 struct mtd_oob_region *oobregion)
-{
-	if (section)
-		return -ERANGE;
-
-	oobregion->offset = 12;
-	oobregion->length = 4;
-
-	return 0;
-}
-
-static const struct mtd_ooblayout_ops flctl_4secc_oob_smallpage_ops = {
-	.ecc = flctl_4secc_ooblayout_sp_ecc,
-	.free = flctl_4secc_ooblayout_sp_free,
-};
-
-static int flctl_4secc_ooblayout_lp_ecc(struct mtd_info *mtd, int section,
-					struct mtd_oob_region *oobregion)
-{
-	struct nand_chip *chip = mtd_to_nand(mtd);
-
-	if (section >= chip->ecc.steps)
-		return -ERANGE;
-
-	oobregion->offset = (section * 16) + 6;
-	oobregion->length = chip->ecc.bytes;
-
-	return 0;
-}
-
-static int flctl_4secc_ooblayout_lp_free(struct mtd_info *mtd, int section,
-					 struct mtd_oob_region *oobregion)
-{
-	struct nand_chip *chip = mtd_to_nand(mtd);
-
-	if (section >= chip->ecc.steps)
-		return -ERANGE;
-
-	oobregion->offset = section * 16;
-	oobregion->length = 6;
-
-	if (!section) {
-		oobregion->offset += 2;
-		oobregion->length -= 2;
-	}
-
-	return 0;
-}
-
-static const struct mtd_ooblayout_ops flctl_4secc_oob_largepage_ops = {
-	.ecc = flctl_4secc_ooblayout_lp_ecc,
-	.free = flctl_4secc_ooblayout_lp_free,
-};
-
-static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
-
-static struct nand_bbt_descr flctl_4secc_smallpage = {
-	.offs = 11,
-	.len = 1,
-	.pattern = scan_ff_pattern,
-};
-
-static struct nand_bbt_descr flctl_4secc_largepage = {
-	.offs = 0,
-	.len = 2,
-	.pattern = scan_ff_pattern,
-};
-
-static void empty_fifo(struct sh_flctl *flctl)
-{
-	writel(flctl->flintdmacr_base | AC1CLR | AC0CLR, FLINTDMACR(flctl));
-	writel(flctl->flintdmacr_base, FLINTDMACR(flctl));
-}
-
-static void start_translation(struct sh_flctl *flctl)
-{
-	writeb(TRSTRT, FLTRCR(flctl));
-}
-
-static void timeout_error(struct sh_flctl *flctl, const char *str)
-{
-	dev_err(&flctl->pdev->dev, "Timeout occurred in %s\n", str);
-}
-
-static void wait_completion(struct sh_flctl *flctl)
-{
-	uint32_t timeout = LOOP_TIMEOUT_MAX;
-
-	while (timeout--) {
-		if (readb(FLTRCR(flctl)) & TREND) {
-			writeb(0x0, FLTRCR(flctl));
-			return;
-		}
-		udelay(1);
-	}
-
-	timeout_error(flctl, __func__);
-	writeb(0x0, FLTRCR(flctl));
-}
-
-static void flctl_dma_complete(void *param)
-{
-	struct sh_flctl *flctl = param;
-
-	complete(&flctl->dma_complete);
-}
-
-static void flctl_release_dma(struct sh_flctl *flctl)
-{
-	if (flctl->chan_fifo0_rx) {
-		dma_release_channel(flctl->chan_fifo0_rx);
-		flctl->chan_fifo0_rx = NULL;
-	}
-	if (flctl->chan_fifo0_tx) {
-		dma_release_channel(flctl->chan_fifo0_tx);
-		flctl->chan_fifo0_tx = NULL;
-	}
-}
-
-static void flctl_setup_dma(struct sh_flctl *flctl)
-{
-	dma_cap_mask_t mask;
-	struct dma_slave_config cfg;
-	struct platform_device *pdev = flctl->pdev;
-	struct sh_flctl_platform_data *pdata = dev_get_platdata(&pdev->dev);
-	int ret;
-
-	if (!pdata)
-		return;
-
-	if (pdata->slave_id_fifo0_tx <= 0 || pdata->slave_id_fifo0_rx <= 0)
-		return;
-
-	/* We can only either use DMA for both Tx and Rx or not use it at all */
-	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
-
-	flctl->chan_fifo0_tx = dma_request_channel(mask, shdma_chan_filter,
-				(void *)(uintptr_t)pdata->slave_id_fifo0_tx);
-	dev_dbg(&pdev->dev, "%s: TX: got channel %p\n", __func__,
-		flctl->chan_fifo0_tx);
-
-	if (!flctl->chan_fifo0_tx)
-		return;
-
-	memset(&cfg, 0, sizeof(cfg));
-	cfg.direction = DMA_MEM_TO_DEV;
-	cfg.dst_addr = flctl->fifo;
-	cfg.src_addr = 0;
-	ret = dmaengine_slave_config(flctl->chan_fifo0_tx, &cfg);
-	if (ret < 0)
-		goto err;
-
-	flctl->chan_fifo0_rx = dma_request_channel(mask, shdma_chan_filter,
-				(void *)(uintptr_t)pdata->slave_id_fifo0_rx);
-	dev_dbg(&pdev->dev, "%s: RX: got channel %p\n", __func__,
-		flctl->chan_fifo0_rx);
-
-	if (!flctl->chan_fifo0_rx)
-		goto err;
-
-	cfg.direction = DMA_DEV_TO_MEM;
-	cfg.dst_addr = 0;
-	cfg.src_addr = flctl->fifo;
-	ret = dmaengine_slave_config(flctl->chan_fifo0_rx, &cfg);
-	if (ret < 0)
-		goto err;
-
-	init_completion(&flctl->dma_complete);
-
-	return;
-
-err:
-	flctl_release_dma(flctl);
-}
-
-static void set_addr(struct mtd_info *mtd, int column, int page_addr)
-{
-	struct sh_flctl *flctl = mtd_to_flctl(mtd);
-	uint32_t addr = 0;
-
-	if (column == -1) {
-		addr = page_addr;	/* ERASE1 */
-	} else if (page_addr != -1) {
-		/* SEQIN, READ0, etc.. */
-		if (flctl->chip.options & NAND_BUSWIDTH_16)
-			column >>= 1;
-		if (flctl->page_size) {
-			addr = column & 0x0FFF;
-			addr |= (page_addr & 0xff) << 16;
-			addr |= ((page_addr >> 8) & 0xff) << 24;
-			/* big than 128MB */
-			if (flctl->rw_ADRCNT == ADRCNT2_E) {
-				uint32_t 	addr2;
-				addr2 = (page_addr >> 16) & 0xff;
-				writel(addr2, FLADR2(flctl));
-			}
-		} else {
-			addr = column;
-			addr |= (page_addr & 0xff) << 8;
-			addr |= ((page_addr >> 8) & 0xff) << 16;
-			addr |= ((page_addr >> 16) & 0xff) << 24;
-		}
-	}
-	writel(addr, FLADR(flctl));
-}
-
-static void wait_rfifo_ready(struct sh_flctl *flctl)
-{
-	uint32_t timeout = LOOP_TIMEOUT_MAX;
-
-	while (timeout--) {
-		uint32_t val;
-		/* check FIFO */
-		val = readl(FLDTCNTR(flctl)) >> 16;
-		if (val & 0xFF)
-			return;
-		udelay(1);
-	}
-	timeout_error(flctl, __func__);
-}
-
-static void wait_wfifo_ready(struct sh_flctl *flctl)
-{
-	uint32_t len, timeout = LOOP_TIMEOUT_MAX;
-
-	while (timeout--) {
-		/* check FIFO */
-		len = (readl(FLDTCNTR(flctl)) >> 16) & 0xFF;
-		if (len >= 4)
-			return;
-		udelay(1);
-	}
-	timeout_error(flctl, __func__);
-}
-
-static enum flctl_ecc_res_t wait_recfifo_ready
-		(struct sh_flctl *flctl, int sector_number)
-{
-	uint32_t timeout = LOOP_TIMEOUT_MAX;
-	void __iomem *ecc_reg[4];
-	int i;
-	int state = FL_SUCCESS;
-	uint32_t data, size;
-
-	/*
-	 * First this loops checks in FLDTCNTR if we are ready to read out the
-	 * oob data. This is the case if either all went fine without errors or
-	 * if the bottom part of the loop corrected the errors or marked them as
-	 * uncorrectable and the controller is given time to push the data into
-	 * the FIFO.
-	 */
-	while (timeout--) {
-		/* check if all is ok and we can read out the OOB */
-		size = readl(FLDTCNTR(flctl)) >> 24;
-		if ((size & 0xFF) == 4)
-			return state;
-
-		/* check if a correction code has been calculated */
-		if (!(readl(FL4ECCCR(flctl)) & _4ECCEND)) {
-			/*
-			 * either we wait for the fifo to be filled or a
-			 * correction pattern is being generated
-			 */
-			udelay(1);
-			continue;
-		}
-
-		/* check for an uncorrectable error */
-		if (readl(FL4ECCCR(flctl)) & _4ECCFA) {
-			/* check if we face a non-empty page */
-			for (i = 0; i < 512; i++) {
-				if (flctl->done_buff[i] != 0xff) {
-					state = FL_ERROR; /* can't correct */
-					break;
-				}
-			}
-
-			if (state == FL_SUCCESS)
-				dev_dbg(&flctl->pdev->dev,
-				"reading empty sector %d, ecc error ignored\n",
-				sector_number);
-
-			writel(0, FL4ECCCR(flctl));
-			continue;
-		}
-
-		/* start error correction */
-		ecc_reg[0] = FL4ECCRESULT0(flctl);
-		ecc_reg[1] = FL4ECCRESULT1(flctl);
-		ecc_reg[2] = FL4ECCRESULT2(flctl);
-		ecc_reg[3] = FL4ECCRESULT3(flctl);
-
-		for (i = 0; i < 3; i++) {
-			uint8_t org;
-			unsigned int index;
-
-			data = readl(ecc_reg[i]);
-
-			if (flctl->page_size)
-				index = (512 * sector_number) +
-					(data >> 16);
-			else
-				index = data >> 16;
-
-			org = flctl->done_buff[index];
-			flctl->done_buff[index] = org ^ (data & 0xFF);
-		}
-		state = FL_REPAIRABLE;
-		writel(0, FL4ECCCR(flctl));
-	}
-
-	timeout_error(flctl, __func__);
-	return FL_TIMEOUT;	/* timeout */
-}
-
-static void wait_wecfifo_ready(struct sh_flctl *flctl)
-{
-	uint32_t timeout = LOOP_TIMEOUT_MAX;
-	uint32_t len;
-
-	while (timeout--) {
-		/* check FLECFIFO */
-		len = (readl(FLDTCNTR(flctl)) >> 24) & 0xFF;
-		if (len >= 4)
-			return;
-		udelay(1);
-	}
-	timeout_error(flctl, __func__);
-}
-
-static int flctl_dma_fifo0_transfer(struct sh_flctl *flctl, unsigned long *buf,
-					int len, enum dma_data_direction dir)
-{
-	struct dma_async_tx_descriptor *desc = NULL;
-	struct dma_chan *chan;
-	enum dma_transfer_direction tr_dir;
-	dma_addr_t dma_addr;
-	dma_cookie_t cookie;
-	uint32_t reg;
-	int ret = 0;
-	unsigned long time_left;
-
-	if (dir == DMA_FROM_DEVICE) {
-		chan = flctl->chan_fifo0_rx;
-		tr_dir = DMA_DEV_TO_MEM;
-	} else {
-		chan = flctl->chan_fifo0_tx;
-		tr_dir = DMA_MEM_TO_DEV;
-	}
-
-	dma_addr = dma_map_single(chan->device->dev, buf, len, dir);
-
-	if (!dma_mapping_error(chan->device->dev, dma_addr))
-		desc = dmaengine_prep_slave_single(chan, dma_addr, len,
-			tr_dir, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
-
-	if (desc) {
-		reg = readl(FLINTDMACR(flctl));
-		reg |= DREQ0EN;
-		writel(reg, FLINTDMACR(flctl));
-
-		desc->callback = flctl_dma_complete;
-		desc->callback_param = flctl;
-		cookie = dmaengine_submit(desc);
-		if (dma_submit_error(cookie)) {
-			ret = dma_submit_error(cookie);
-			dev_warn(&flctl->pdev->dev,
-				 "DMA submit failed, falling back to PIO\n");
-			goto out;
-		}
-
-		dma_async_issue_pending(chan);
-	} else {
-		/* DMA failed, fall back to PIO */
-		flctl_release_dma(flctl);
-		dev_warn(&flctl->pdev->dev,
-			 "DMA failed, falling back to PIO\n");
-		ret = -EIO;
-		goto out;
-	}
-
-	time_left =
-	wait_for_completion_timeout(&flctl->dma_complete,
-				msecs_to_jiffies(3000));
-
-	if (time_left == 0) {
-		dmaengine_terminate_all(chan);
-		dev_err(&flctl->pdev->dev, "wait_for_completion_timeout\n");
-		ret = -ETIMEDOUT;
-	}
-
-out:
-	reg = readl(FLINTDMACR(flctl));
-	reg &= ~DREQ0EN;
-	writel(reg, FLINTDMACR(flctl));
-
-	dma_unmap_single(chan->device->dev, dma_addr, len, dir);
-
-	/* ret == 0 is success */
-	return ret;
-}
-
-static void read_datareg(struct sh_flctl *flctl, int offset)
-{
-	unsigned long data;
-	unsigned long *buf = (unsigned long *)&flctl->done_buff[offset];
-
-	wait_completion(flctl);
-
-	data = readl(FLDATAR(flctl));
-	*buf = le32_to_cpu(data);
-}
-
-static void read_fiforeg(struct sh_flctl *flctl, int rlen, int offset)
-{
-	int i, len_4align;
-	unsigned long *buf = (unsigned long *)&flctl->done_buff[offset];
-
-	len_4align = (rlen + 3) / 4;
-
-	/* initiate DMA transfer */
-	if (flctl->chan_fifo0_rx && rlen >= 32 &&
-		!flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_FROM_DEVICE))
-			goto convert;	/* DMA success */
-
-	/* do polling transfer */
-	for (i = 0; i < len_4align; i++) {
-		wait_rfifo_ready(flctl);
-		buf[i] = readl(FLDTFIFO(flctl));
-	}
-
-convert:
-	for (i = 0; i < len_4align; i++)
-		buf[i] = be32_to_cpu(buf[i]);
-}
-
-static enum flctl_ecc_res_t read_ecfiforeg
-		(struct sh_flctl *flctl, uint8_t *buff, int sector)
-{
-	int i;
-	enum flctl_ecc_res_t res;
-	unsigned long *ecc_buf = (unsigned long *)buff;
-
-	res = wait_recfifo_ready(flctl , sector);
-
-	if (res != FL_ERROR) {
-		for (i = 0; i < 4; i++) {
-			ecc_buf[i] = readl(FLECFIFO(flctl));
-			ecc_buf[i] = be32_to_cpu(ecc_buf[i]);
-		}
-	}
-
-	return res;
-}
-
-static void write_fiforeg(struct sh_flctl *flctl, int rlen,
-						unsigned int offset)
-{
-	int i, len_4align;
-	unsigned long *buf = (unsigned long *)&flctl->done_buff[offset];
-
-	len_4align = (rlen + 3) / 4;
-	for (i = 0; i < len_4align; i++) {
-		wait_wfifo_ready(flctl);
-		writel(cpu_to_be32(buf[i]), FLDTFIFO(flctl));
-	}
-}
-
-static void write_ec_fiforeg(struct sh_flctl *flctl, int rlen,
-						unsigned int offset)
-{
-	int i, len_4align;
-	unsigned long *buf = (unsigned long *)&flctl->done_buff[offset];
-
-	len_4align = (rlen + 3) / 4;
-
-	for (i = 0; i < len_4align; i++)
-		buf[i] = cpu_to_be32(buf[i]);
-
-	/* initiate DMA transfer */
-	if (flctl->chan_fifo0_tx && rlen >= 32 &&
-		!flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_TO_DEVICE))
-			return;	/* DMA success */
-
-	/* do polling transfer */
-	for (i = 0; i < len_4align; i++) {
-		wait_wecfifo_ready(flctl);
-		writel(buf[i], FLECFIFO(flctl));
-	}
-}
-
-static void set_cmd_regs(struct mtd_info *mtd, uint32_t cmd, uint32_t flcmcdr_val)
-{
-	struct sh_flctl *flctl = mtd_to_flctl(mtd);
-	uint32_t flcmncr_val = flctl->flcmncr_base & ~SEL_16BIT;
-	uint32_t flcmdcr_val, addr_len_bytes = 0;
-
-	/* Set SNAND bit if page size is 2048byte */
-	if (flctl->page_size)
-		flcmncr_val |= SNAND_E;
-	else
-		flcmncr_val &= ~SNAND_E;
-
-	/* default FLCMDCR val */
-	flcmdcr_val = DOCMD1_E | DOADR_E;
-
-	/* Set for FLCMDCR */
-	switch (cmd) {
-	case NAND_CMD_ERASE1:
-		addr_len_bytes = flctl->erase_ADRCNT;
-		flcmdcr_val |= DOCMD2_E;
-		break;
-	case NAND_CMD_READ0:
-	case NAND_CMD_READOOB:
-	case NAND_CMD_RNDOUT:
-		addr_len_bytes = flctl->rw_ADRCNT;
-		flcmdcr_val |= CDSRC_E;
-		if (flctl->chip.options & NAND_BUSWIDTH_16)
-			flcmncr_val |= SEL_16BIT;
-		break;
-	case NAND_CMD_SEQIN:
-		/* This case is that cmd is READ0 or READ1 or READ00 */
-		flcmdcr_val &= ~DOADR_E;	/* ONLY execute 1st cmd */
-		break;
-	case NAND_CMD_PAGEPROG:
-		addr_len_bytes = flctl->rw_ADRCNT;
-		flcmdcr_val |= DOCMD2_E | CDSRC_E | SELRW;
-		if (flctl->chip.options & NAND_BUSWIDTH_16)
-			flcmncr_val |= SEL_16BIT;
-		break;
-	case NAND_CMD_READID:
-		flcmncr_val &= ~SNAND_E;
-		flcmdcr_val |= CDSRC_E;
-		addr_len_bytes = ADRCNT_1;
-		break;
-	case NAND_CMD_STATUS:
-	case NAND_CMD_RESET:
-		flcmncr_val &= ~SNAND_E;
-		flcmdcr_val &= ~(DOADR_E | DOSR_E);
-		break;
-	default:
-		break;
-	}
-
-	/* Set address bytes parameter */
-	flcmdcr_val |= addr_len_bytes;
-
-	/* Now actually write */
-	writel(flcmncr_val, FLCMNCR(flctl));
-	writel(flcmdcr_val, FLCMDCR(flctl));
-	writel(flcmcdr_val, FLCMCDR(flctl));
-}
-
-static int flctl_read_page_hwecc(struct nand_chip *chip, uint8_t *buf,
-				 int oob_required, int page)
-{
-	struct mtd_info *mtd = nand_to_mtd(chip);
-
-	nand_read_page_op(chip, page, 0, buf, mtd->writesize);
-	if (oob_required)
-		chip->legacy.read_buf(chip, chip->oob_poi, mtd->oobsize);
-	return 0;
-}
-
-static int flctl_write_page_hwecc(struct nand_chip *chip, const uint8_t *buf,
-				  int oob_required, int page)
-{
-	struct mtd_info *mtd = nand_to_mtd(chip);
-
-	nand_prog_page_begin_op(chip, page, 0, buf, mtd->writesize);
-	chip->legacy.write_buf(chip, chip->oob_poi, mtd->oobsize);
-	return nand_prog_page_end_op(chip);
-}
-
-static void execmd_read_page_sector(struct mtd_info *mtd, int page_addr)
-{
-	struct sh_flctl *flctl = mtd_to_flctl(mtd);
-	int sector, page_sectors;
-	enum flctl_ecc_res_t ecc_result;
-
-	page_sectors = flctl->page_size ? 4 : 1;
-
-	set_cmd_regs(mtd, NAND_CMD_READ0,
-		(NAND_CMD_READSTART << 8) | NAND_CMD_READ0);
-
-	writel(readl(FLCMNCR(flctl)) | ACM_SACCES_MODE | _4ECCCORRECT,
-		 FLCMNCR(flctl));
-	writel(readl(FLCMDCR(flctl)) | page_sectors, FLCMDCR(flctl));
-	writel(page_addr << 2, FLADR(flctl));
-
-	empty_fifo(flctl);
-	start_translation(flctl);
-
-	for (sector = 0; sector < page_sectors; sector++) {
-		read_fiforeg(flctl, 512, 512 * sector);
-
-		ecc_result = read_ecfiforeg(flctl,
-			&flctl->done_buff[mtd->writesize + 16 * sector],
-			sector);
-
-		switch (ecc_result) {
-		case FL_REPAIRABLE:
-			dev_info(&flctl->pdev->dev,
-				"applied ecc on page 0x%x", page_addr);
-			mtd->ecc_stats.corrected++;
-			break;
-		case FL_ERROR:
-			dev_warn(&flctl->pdev->dev,
-				"page 0x%x contains corrupted data\n",
-				page_addr);
-			mtd->ecc_stats.failed++;
-			break;
-		default:
-			;
-		}
-	}
-
-	wait_completion(flctl);
-
-	writel(readl(FLCMNCR(flctl)) & ~(ACM_SACCES_MODE | _4ECCCORRECT),
-			FLCMNCR(flctl));
-}
-
-static void execmd_read_oob(struct mtd_info *mtd, int page_addr)
-{
-	struct sh_flctl *flctl = mtd_to_flctl(mtd);
-	int page_sectors = flctl->page_size ? 4 : 1;
-	int i;
-
-	set_cmd_regs(mtd, NAND_CMD_READ0,
-		(NAND_CMD_READSTART << 8) | NAND_CMD_READ0);
-
-	empty_fifo(flctl);
-
-	for (i = 0; i < page_sectors; i++) {
-		set_addr(mtd, (512 + 16) * i + 512 , page_addr);
-		writel(16, FLDTCNTR(flctl));
-
-		start_translation(flctl);
-		read_fiforeg(flctl, 16, 16 * i);
-		wait_completion(flctl);
-	}
-}
-
-static void execmd_write_page_sector(struct mtd_info *mtd)
-{
-	struct sh_flctl *flctl = mtd_to_flctl(mtd);
-	int page_addr = flctl->seqin_page_addr;
-	int sector, page_sectors;
-
-	page_sectors = flctl->page_size ? 4 : 1;
-
-	set_cmd_regs(mtd, NAND_CMD_PAGEPROG,
-			(NAND_CMD_PAGEPROG << 8) | NAND_CMD_SEQIN);
-
-	empty_fifo(flctl);
-	writel(readl(FLCMNCR(flctl)) | ACM_SACCES_MODE, FLCMNCR(flctl));
-	writel(readl(FLCMDCR(flctl)) | page_sectors, FLCMDCR(flctl));
-	writel(page_addr << 2, FLADR(flctl));
-	start_translation(flctl);
-
-	for (sector = 0; sector < page_sectors; sector++) {
-		write_fiforeg(flctl, 512, 512 * sector);
-		write_ec_fiforeg(flctl, 16, mtd->writesize + 16 * sector);
-	}
-
-	wait_completion(flctl);
-	writel(readl(FLCMNCR(flctl)) & ~ACM_SACCES_MODE, FLCMNCR(flctl));
-}
-
-static void execmd_write_oob(struct mtd_info *mtd)
-{
-	struct sh_flctl *flctl = mtd_to_flctl(mtd);
-	int page_addr = flctl->seqin_page_addr;
-	int sector, page_sectors;
-
-	page_sectors = flctl->page_size ? 4 : 1;
-
-	set_cmd_regs(mtd, NAND_CMD_PAGEPROG,
-			(NAND_CMD_PAGEPROG << 8) | NAND_CMD_SEQIN);
-
-	for (sector = 0; sector < page_sectors; sector++) {
-		empty_fifo(flctl);
-		set_addr(mtd, sector * 528 + 512, page_addr);
-		writel(16, FLDTCNTR(flctl));	/* set read size */
-
-		start_translation(flctl);
-		write_fiforeg(flctl, 16, 16 * sector);
-		wait_completion(flctl);
-	}
-}
-
-static void flctl_cmdfunc(struct nand_chip *chip, unsigned int command,
-			int column, int page_addr)
-{
-	struct mtd_info *mtd = nand_to_mtd(chip);
-	struct sh_flctl *flctl = mtd_to_flctl(mtd);
-	uint32_t read_cmd = 0;
-
-	pm_runtime_get_sync(&flctl->pdev->dev);
-
-	flctl->read_bytes = 0;
-	if (command != NAND_CMD_PAGEPROG)
-		flctl->index = 0;
-
-	switch (command) {
-	case NAND_CMD_READ1:
-	case NAND_CMD_READ0:
-		if (flctl->hwecc) {
-			/* read page with hwecc */
-			execmd_read_page_sector(mtd, page_addr);
-			break;
-		}
-		if (flctl->page_size)
-			set_cmd_regs(mtd, command, (NAND_CMD_READSTART << 8)
-				| command);
-		else
-			set_cmd_regs(mtd, command, command);
-
-		set_addr(mtd, 0, page_addr);
-
-		flctl->read_bytes = mtd->writesize + mtd->oobsize;
-		if (flctl->chip.options & NAND_BUSWIDTH_16)
-			column >>= 1;
-		flctl->index += column;
-		goto read_normal_exit;
-
-	case NAND_CMD_READOOB:
-		if (flctl->hwecc) {
-			/* read page with hwecc */
-			execmd_read_oob(mtd, page_addr);
-			break;
-		}
-
-		if (flctl->page_size) {
-			set_cmd_regs(mtd, command, (NAND_CMD_READSTART << 8)
-				| NAND_CMD_READ0);
-			set_addr(mtd, mtd->writesize, page_addr);
-		} else {
-			set_cmd_regs(mtd, command, command);
-			set_addr(mtd, 0, page_addr);
-		}
-		flctl->read_bytes = mtd->oobsize;
-		goto read_normal_exit;
-
-	case NAND_CMD_RNDOUT:
-		if (flctl->hwecc)
-			break;
-
-		if (flctl->page_size)
-			set_cmd_regs(mtd, command, (NAND_CMD_RNDOUTSTART << 8)
-				| command);
-		else
-			set_cmd_regs(mtd, command, command);
-
-		set_addr(mtd, column, 0);
-
-		flctl->read_bytes = mtd->writesize + mtd->oobsize - column;
-		goto read_normal_exit;
-
-	case NAND_CMD_READID:
-		set_cmd_regs(mtd, command, command);
-
-		/* READID is always performed using an 8-bit bus */
-		if (flctl->chip.options & NAND_BUSWIDTH_16)
-			column <<= 1;
-		set_addr(mtd, column, 0);
-
-		flctl->read_bytes = 8;
-		writel(flctl->read_bytes, FLDTCNTR(flctl)); /* set read size */
-		empty_fifo(flctl);
-		start_translation(flctl);
-		read_fiforeg(flctl, flctl->read_bytes, 0);
-		wait_completion(flctl);
-		break;
-
-	case NAND_CMD_ERASE1:
-		flctl->erase1_page_addr = page_addr;
-		break;
-
-	case NAND_CMD_ERASE2:
-		set_cmd_regs(mtd, NAND_CMD_ERASE1,
-			(command << 8) | NAND_CMD_ERASE1);
-		set_addr(mtd, -1, flctl->erase1_page_addr);
-		start_translation(flctl);
-		wait_completion(flctl);
-		break;
-
-	case NAND_CMD_SEQIN:
-		if (!flctl->page_size) {
-			/* output read command */
-			if (column >= mtd->writesize) {
-				column -= mtd->writesize;
-				read_cmd = NAND_CMD_READOOB;
-			} else if (column < 256) {
-				read_cmd = NAND_CMD_READ0;
-			} else {
-				column -= 256;
-				read_cmd = NAND_CMD_READ1;
-			}
-		}
-		flctl->seqin_column = column;
-		flctl->seqin_page_addr = page_addr;
-		flctl->seqin_read_cmd = read_cmd;
-		break;
-
-	case NAND_CMD_PAGEPROG:
-		empty_fifo(flctl);
-		if (!flctl->page_size) {
-			set_cmd_regs(mtd, NAND_CMD_SEQIN,
-					flctl->seqin_read_cmd);
-			set_addr(mtd, -1, -1);
-			writel(0, FLDTCNTR(flctl));	/* set 0 size */
-			start_translation(flctl);
-			wait_completion(flctl);
-		}
-		if (flctl->hwecc) {
-			/* write page with hwecc */
-			if (flctl->seqin_column == mtd->writesize)
-				execmd_write_oob(mtd);
-			else if (!flctl->seqin_column)
-				execmd_write_page_sector(mtd);
-			else
-				pr_err("Invalid address !?\n");
-			break;
-		}
-		set_cmd_regs(mtd, command, (command << 8) | NAND_CMD_SEQIN);
-		set_addr(mtd, flctl->seqin_column, flctl->seqin_page_addr);
-		writel(flctl->index, FLDTCNTR(flctl));	/* set write size */
-		start_translation(flctl);
-		write_fiforeg(flctl, flctl->index, 0);
-		wait_completion(flctl);
-		break;
-
-	case NAND_CMD_STATUS:
-		set_cmd_regs(mtd, command, command);
-		set_addr(mtd, -1, -1);
-
-		flctl->read_bytes = 1;
-		writel(flctl->read_bytes, FLDTCNTR(flctl)); /* set read size */
-		start_translation(flctl);
-		read_datareg(flctl, 0); /* read and end */
-		break;
-
-	case NAND_CMD_RESET:
-		set_cmd_regs(mtd, command, command);
-		set_addr(mtd, -1, -1);
-
-		writel(0, FLDTCNTR(flctl));	/* set 0 size */
-		start_translation(flctl);
-		wait_completion(flctl);
-		break;
-
-	default:
-		break;
-	}
-	goto runtime_exit;
-
-read_normal_exit:
-	writel(flctl->read_bytes, FLDTCNTR(flctl));	/* set read size */
-	empty_fifo(flctl);
-	start_translation(flctl);
-	read_fiforeg(flctl, flctl->read_bytes, 0);
-	wait_completion(flctl);
-runtime_exit:
-	pm_runtime_put_sync(&flctl->pdev->dev);
-	return;
-}
-
-static void flctl_select_chip(struct nand_chip *chip, int chipnr)
-{
-	struct sh_flctl *flctl = mtd_to_flctl(nand_to_mtd(chip));
-	int ret;
-
-	switch (chipnr) {
-	case -1:
-		flctl->flcmncr_base &= ~CE0_ENABLE;
-
-		pm_runtime_get_sync(&flctl->pdev->dev);
-		writel(flctl->flcmncr_base, FLCMNCR(flctl));
-
-		if (flctl->qos_request) {
-			dev_pm_qos_remove_request(&flctl->pm_qos);
-			flctl->qos_request = 0;
-		}
-
-		pm_runtime_put_sync(&flctl->pdev->dev);
-		break;
-	case 0:
-		flctl->flcmncr_base |= CE0_ENABLE;
-
-		if (!flctl->qos_request) {
-			ret = dev_pm_qos_add_request(&flctl->pdev->dev,
-							&flctl->pm_qos,
-							DEV_PM_QOS_RESUME_LATENCY,
-							100);
-			if (ret < 0)
-				dev_err(&flctl->pdev->dev,
-					"PM QoS request failed: %d\n", ret);
-			flctl->qos_request = 1;
-		}
-
-		if (flctl->holden) {
-			pm_runtime_get_sync(&flctl->pdev->dev);
-			writel(HOLDEN, FLHOLDCR(flctl));
-			pm_runtime_put_sync(&flctl->pdev->dev);
-		}
-		break;
-	default:
-		BUG();
-	}
-}
-
-static void flctl_write_buf(struct nand_chip *chip, const uint8_t *buf, int len)
-{
-	struct sh_flctl *flctl = mtd_to_flctl(nand_to_mtd(chip));
-
-	memcpy(&flctl->done_buff[flctl->index], buf, len);
-	flctl->index += len;
-}
-
-static uint8_t flctl_read_byte(struct nand_chip *chip)
-{
-	struct sh_flctl *flctl = mtd_to_flctl(nand_to_mtd(chip));
-	uint8_t data;
-
-	data = flctl->done_buff[flctl->index];
-	flctl->index++;
-	return data;
-}
-
-static void flctl_read_buf(struct nand_chip *chip, uint8_t *buf, int len)
-{
-	struct sh_flctl *flctl = mtd_to_flctl(nand_to_mtd(chip));
-
-	memcpy(buf, &flctl->done_buff[flctl->index], len);
-	flctl->index += len;
-}
-
-static int flctl_chip_attach_chip(struct nand_chip *chip)
-{
-	u64 targetsize = nanddev_target_size(&chip->base);
-	struct mtd_info *mtd = nand_to_mtd(chip);
-	struct sh_flctl *flctl = mtd_to_flctl(mtd);
-
-	/*
-	 * NAND_BUSWIDTH_16 may have been set by nand_scan_ident().
-	 * Add the SEL_16BIT flag in flctl->flcmncr_base.
-	 */
-	if (chip->options & NAND_BUSWIDTH_16)
-		flctl->flcmncr_base |= SEL_16BIT;
-
-	if (mtd->writesize == 512) {
-		flctl->page_size = 0;
-		if (targetsize > (32 << 20)) {
-			/* big than 32MB */
-			flctl->rw_ADRCNT = ADRCNT_4;
-			flctl->erase_ADRCNT = ADRCNT_3;
-		} else if (targetsize > (2 << 16)) {
-			/* big than 128KB */
-			flctl->rw_ADRCNT = ADRCNT_3;
-			flctl->erase_ADRCNT = ADRCNT_2;
-		} else {
-			flctl->rw_ADRCNT = ADRCNT_2;
-			flctl->erase_ADRCNT = ADRCNT_1;
-		}
-	} else {
-		flctl->page_size = 1;
-		if (targetsize > (128 << 20)) {
-			/* big than 128MB */
-			flctl->rw_ADRCNT = ADRCNT2_E;
-			flctl->erase_ADRCNT = ADRCNT_3;
-		} else if (targetsize > (8 << 16)) {
-			/* big than 512KB */
-			flctl->rw_ADRCNT = ADRCNT_4;
-			flctl->erase_ADRCNT = ADRCNT_2;
-		} else {
-			flctl->rw_ADRCNT = ADRCNT_3;
-			flctl->erase_ADRCNT = ADRCNT_1;
-		}
-	}
-
-	if (flctl->hwecc) {
-		if (mtd->writesize == 512) {
-			mtd_set_ooblayout(mtd, &flctl_4secc_oob_smallpage_ops);
-			chip->badblock_pattern = &flctl_4secc_smallpage;
-		} else {
-			mtd_set_ooblayout(mtd, &flctl_4secc_oob_largepage_ops);
-			chip->badblock_pattern = &flctl_4secc_largepage;
-		}
-
-		chip->ecc.size = 512;
-		chip->ecc.bytes = 10;
-		chip->ecc.strength = 4;
-		chip->ecc.read_page = flctl_read_page_hwecc;
-		chip->ecc.write_page = flctl_write_page_hwecc;
-		chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
-
-		/* 4 symbols ECC enabled */
-		flctl->flcmncr_base |= _4ECCEN;
-	} else {
-		chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
-		chip->ecc.algo = NAND_ECC_ALGO_HAMMING;
-	}
-
-	return 0;
-}
-
-static const struct nand_controller_ops flctl_nand_controller_ops = {
-	.attach_chip = flctl_chip_attach_chip,
-};
-
-static irqreturn_t flctl_handle_flste(int irq, void *dev_id)
-{
-	struct sh_flctl *flctl = dev_id;
-
-	dev_err(&flctl->pdev->dev, "flste irq: %x\n", readl(FLINTDMACR(flctl)));
-	writel(flctl->flintdmacr_base, FLINTDMACR(flctl));
-
-	return IRQ_HANDLED;
-}
-
-struct flctl_soc_config {
-	unsigned long flcmncr_val;
-	unsigned has_hwecc:1;
-	unsigned use_holden:1;
-};
-
-static struct flctl_soc_config flctl_sh7372_config = {
-	.flcmncr_val = CLK_16B_12L_4H | TYPESEL_SET | SHBUSSEL,
-	.has_hwecc = 1,
-	.use_holden = 1,
-};
-
-static const struct of_device_id of_flctl_match[] = {
-	{ .compatible = "renesas,shmobile-flctl-sh7372",
-				.data = &flctl_sh7372_config },
-	{},
-};
-MODULE_DEVICE_TABLE(of, of_flctl_match);
-
-static struct sh_flctl_platform_data *flctl_parse_dt(struct device *dev)
-{
-	const struct flctl_soc_config *config;
-	struct sh_flctl_platform_data *pdata;
-
-	config = of_device_get_match_data(dev);
-	if (!config) {
-		dev_err(dev, "%s: no OF configuration attached\n", __func__);
-		return NULL;
-	}
-
-	pdata = devm_kzalloc(dev, sizeof(struct sh_flctl_platform_data),
-								GFP_KERNEL);
-	if (!pdata)
-		return NULL;
-
-	/* set SoC specific options */
-	pdata->flcmncr_val = config->flcmncr_val;
-	pdata->has_hwecc = config->has_hwecc;
-	pdata->use_holden = config->use_holden;
-
-	return pdata;
-}
-
-static int flctl_probe(struct platform_device *pdev)
-{
-	struct resource *res;
-	struct sh_flctl *flctl;
-	struct mtd_info *flctl_mtd;
-	struct nand_chip *nand;
-	struct sh_flctl_platform_data *pdata;
-	int ret;
-	int irq;
-
-	flctl = devm_kzalloc(&pdev->dev, sizeof(struct sh_flctl), GFP_KERNEL);
-	if (!flctl)
-		return -ENOMEM;
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	flctl->reg = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(flctl->reg))
-		return PTR_ERR(flctl->reg);
-	flctl->fifo = res->start + 0x24; /* FLDTFIFO */
-
-	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
-		return irq;
-
-	ret = devm_request_irq(&pdev->dev, irq, flctl_handle_flste, IRQF_SHARED,
-			       "flste", flctl);
-	if (ret) {
-		dev_err(&pdev->dev, "request interrupt failed.\n");
-		return ret;
-	}
-
-	if (pdev->dev.of_node)
-		pdata = flctl_parse_dt(&pdev->dev);
-	else
-		pdata = dev_get_platdata(&pdev->dev);
-
-	if (!pdata) {
-		dev_err(&pdev->dev, "no setup data defined\n");
-		return -EINVAL;
-	}
-
-	platform_set_drvdata(pdev, flctl);
-	nand = &flctl->chip;
-	flctl_mtd = nand_to_mtd(nand);
-	nand_set_flash_node(nand, pdev->dev.of_node);
-	flctl_mtd->dev.parent = &pdev->dev;
-	flctl->pdev = pdev;
-	flctl->hwecc = pdata->has_hwecc;
-	flctl->holden = pdata->use_holden;
-	flctl->flcmncr_base = pdata->flcmncr_val;
-	flctl->flintdmacr_base = flctl->hwecc ? (STERINTE | ECERB) : STERINTE;
-
-	/* Set address of hardware control function */
-	/* 20 us command delay time */
-	nand->legacy.chip_delay = 20;
-
-	nand->legacy.read_byte = flctl_read_byte;
-	nand->legacy.write_buf = flctl_write_buf;
-	nand->legacy.read_buf = flctl_read_buf;
-	nand->legacy.select_chip = flctl_select_chip;
-	nand->legacy.cmdfunc = flctl_cmdfunc;
-	nand->legacy.set_features = nand_get_set_features_notsupp;
-	nand->legacy.get_features = nand_get_set_features_notsupp;
-
-	if (pdata->flcmncr_val & SEL_16BIT)
-		nand->options |= NAND_BUSWIDTH_16;
-
-	nand->options |= NAND_BBM_FIRSTPAGE | NAND_BBM_SECONDPAGE;
-
-	pm_runtime_enable(&pdev->dev);
-	pm_runtime_resume(&pdev->dev);
-
-	flctl_setup_dma(flctl);
-
-	nand->legacy.dummy_controller.ops = &flctl_nand_controller_ops;
-	ret = nand_scan(nand, 1);
-	if (ret)
-		goto err_chip;
-
-	ret = mtd_device_register(flctl_mtd, pdata->parts, pdata->nr_parts);
-	if (ret)
-		goto cleanup_nand;
-
-	return 0;
-
-cleanup_nand:
-	nand_cleanup(nand);
-err_chip:
-	flctl_release_dma(flctl);
-	pm_runtime_disable(&pdev->dev);
-	return ret;
-}
-
-static int flctl_remove(struct platform_device *pdev)
-{
-	struct sh_flctl *flctl = platform_get_drvdata(pdev);
-	struct nand_chip *chip = &flctl->chip;
-	int ret;
-
-	flctl_release_dma(flctl);
-	ret = mtd_device_unregister(nand_to_mtd(chip));
-	WARN_ON(ret);
-	nand_cleanup(chip);
-	pm_runtime_disable(&pdev->dev);
-
-	return 0;
-}
-
-static struct platform_driver flctl_driver = {
-	.remove		= flctl_remove,
-	.driver = {
-		.name	= "sh_flctl",
-		.of_match_table = of_flctl_match,
-	},
-};
-
-module_platform_driver_probe(flctl_driver, flctl_probe);
-
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("Yoshihiro Shimoda");
-MODULE_DESCRIPTION("SuperH FLCTL driver");
-MODULE_ALIAS("platform:sh_flctl");
diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h
deleted file mode 100644
index 78fc2d4218c808..00000000000000
--- a/include/linux/mtd/sh_flctl.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0
- *
- * SuperH FLCTL nand controller
- *
- * Copyright © 2008 Renesas Solutions Corp.
- */
-
-#ifndef __SH_FLCTL_H__
-#define __SH_FLCTL_H__
-
-#include <linux/completion.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/rawnand.h>
-#include <linux/mtd/partitions.h>
-#include <linux/pm_qos.h>
-
-/* FLCTL registers */
-#define FLCMNCR(f)		(f->reg + 0x0)
-#define FLCMDCR(f)		(f->reg + 0x4)
-#define FLCMCDR(f)		(f->reg + 0x8)
-#define FLADR(f)		(f->reg + 0xC)
-#define FLADR2(f)		(f->reg + 0x3C)
-#define FLDATAR(f)		(f->reg + 0x10)
-#define FLDTCNTR(f)		(f->reg + 0x14)
-#define FLINTDMACR(f)		(f->reg + 0x18)
-#define FLBSYTMR(f)		(f->reg + 0x1C)
-#define FLBSYCNT(f)		(f->reg + 0x20)
-#define FLDTFIFO(f)		(f->reg + 0x24)
-#define FLECFIFO(f)		(f->reg + 0x28)
-#define FLTRCR(f)		(f->reg + 0x2C)
-#define FLHOLDCR(f)		(f->reg + 0x38)
-#define	FL4ECCRESULT0(f)	(f->reg + 0x80)
-#define	FL4ECCRESULT1(f)	(f->reg + 0x84)
-#define	FL4ECCRESULT2(f)	(f->reg + 0x88)
-#define	FL4ECCRESULT3(f)	(f->reg + 0x8C)
-#define	FL4ECCCR(f)		(f->reg + 0x90)
-#define	FL4ECCCNT(f)		(f->reg + 0x94)
-#define	FLERRADR(f)		(f->reg + 0x98)
-
-/* FLCMNCR control bits */
-#define _4ECCCNTEN	(0x1 << 24)
-#define _4ECCEN		(0x1 << 23)
-#define _4ECCCORRECT	(0x1 << 22)
-#define SHBUSSEL	(0x1 << 20)
-#define SEL_16BIT	(0x1 << 19)
-#define SNAND_E		(0x1 << 18)	/* SNAND (0=512 1=2048)*/
-#define QTSEL_E		(0x1 << 17)
-#define ENDIAN		(0x1 << 16)	/* 1 = little endian */
-#define FCKSEL_E	(0x1 << 15)
-#define ACM_SACCES_MODE	(0x01 << 10)
-#define NANWF_E		(0x1 << 9)
-#define SE_D		(0x1 << 8)	/* Spare area disable */
-#define	CE1_ENABLE	(0x1 << 4)	/* Chip Enable 1 */
-#define	CE0_ENABLE	(0x1 << 3)	/* Chip Enable 0 */
-#define	TYPESEL_SET	(0x1 << 0)
-
-/*
- * Clock settings using the PULSEx registers from FLCMNCR
- *
- * Some hardware uses bits called PULSEx instead of FCKSEL_E and QTSEL_E
- * to control the clock divider used between the High-Speed Peripheral Clock
- * and the FLCTL internal clock. If so, use CLK_8_BIT_xxx for connecting 8 bit
- * and CLK_16_BIT_xxx for connecting 16 bit bus bandwith NAND chips. For the 16
- * bit version the divider is seperate for the pulse width of high and low
- * signals.
- */
-#define PULSE3	(0x1 << 27)
-#define PULSE2	(0x1 << 17)
-#define PULSE1	(0x1 << 15)
-#define PULSE0	(0x1 << 9)
-#define CLK_8B_0_5			PULSE1
-#define CLK_8B_1			0x0
-#define CLK_8B_1_5			(PULSE1 | PULSE2)
-#define CLK_8B_2			PULSE0
-#define CLK_8B_3			(PULSE0 | PULSE1 | PULSE2)
-#define CLK_8B_4			(PULSE0 | PULSE2)
-#define CLK_16B_6L_2H			PULSE0
-#define CLK_16B_9L_3H			(PULSE0 | PULSE1 | PULSE2)
-#define CLK_16B_12L_4H			(PULSE0 | PULSE2)
-
-/* FLCMDCR control bits */
-#define ADRCNT2_E	(0x1 << 31)	/* 5byte address enable */
-#define ADRMD_E		(0x1 << 26)	/* Sector address access */
-#define CDSRC_E		(0x1 << 25)	/* Data buffer selection */
-#define DOSR_E		(0x1 << 24)	/* Status read check */
-#define SELRW		(0x1 << 21)	/*  0:read 1:write */
-#define DOADR_E		(0x1 << 20)	/* Address stage execute */
-#define ADRCNT_1	(0x00 << 18)	/* Address data bytes: 1byte */
-#define ADRCNT_2	(0x01 << 18)	/* Address data bytes: 2byte */
-#define ADRCNT_3	(0x02 << 18)	/* Address data bytes: 3byte */
-#define ADRCNT_4	(0x03 << 18)	/* Address data bytes: 4byte */
-#define DOCMD2_E	(0x1 << 17)	/* 2nd cmd stage execute */
-#define DOCMD1_E	(0x1 << 16)	/* 1st cmd stage execute */
-
-/* FLINTDMACR control bits */
-#define ESTERINTE	(0x1 << 24)	/* ECC error interrupt enable */
-#define AC1CLR		(0x1 << 19)	/* ECC FIFO clear */
-#define AC0CLR		(0x1 << 18)	/* Data FIFO clear */
-#define DREQ0EN		(0x1 << 16)	/* FLDTFIFODMA Request Enable */
-#define ECERB		(0x1 << 9)	/* ECC error */
-#define STERB		(0x1 << 8)	/* Status error */
-#define STERINTE	(0x1 << 4)	/* Status error enable */
-
-/* FLTRCR control bits */
-#define TRSTRT		(0x1 << 0)	/* translation start */
-#define TREND		(0x1 << 1)	/* translation end */
-
-/*
- * FLHOLDCR control bits
- *
- * HOLDEN: Bus Occupancy Enable (inverted)
- * Enable this bit when the external bus might be used in between transfers.
- * If not set and the bus gets used by other modules, a deadlock occurs.
- */
-#define HOLDEN		(0x1 << 0)
-
-/* FL4ECCCR control bits */
-#define	_4ECCFA		(0x1 << 2)	/* 4 symbols correct fault */
-#define	_4ECCEND	(0x1 << 1)	/* 4 symbols end */
-#define	_4ECCEXST	(0x1 << 0)	/* 4 symbols exist */
-
-#define LOOP_TIMEOUT_MAX	0x00010000
-
-enum flctl_ecc_res_t {
-	FL_SUCCESS,
-	FL_REPAIRABLE,
-	FL_ERROR,
-	FL_TIMEOUT
-};
-
-struct dma_chan;
-
-struct sh_flctl {
-	struct nand_chip	chip;
-	struct platform_device	*pdev;
-	struct dev_pm_qos_request pm_qos;
-	void __iomem		*reg;
-	resource_size_t		fifo;
-
-	uint8_t	done_buff[2048 + 64];	/* max size 2048 + 64 */
-	int	read_bytes;
-	unsigned int index;
-	int	seqin_column;		/* column in SEQIN cmd */
-	int	seqin_page_addr;	/* page_addr in SEQIN cmd */
-	uint32_t seqin_read_cmd;		/* read cmd in SEQIN cmd */
-	int	erase1_page_addr;	/* page_addr in ERASE1 cmd */
-	uint32_t erase_ADRCNT;		/* bits of FLCMDCR in ERASE1 cmd */
-	uint32_t rw_ADRCNT;	/* bits of FLCMDCR in READ WRITE cmd */
-	uint32_t flcmncr_base;	/* base value of FLCMNCR */
-	uint32_t flintdmacr_base;	/* irq enable bits */
-
-	unsigned page_size:1;	/* NAND page size (0 = 512, 1 = 2048) */
-	unsigned hwecc:1;	/* Hardware ECC (0 = disabled, 1 = enabled) */
-	unsigned holden:1;	/* Hardware has FLHOLDCR and HOLDEN is set */
-	unsigned qos_request:1;	/* QoS request to prevent deep power shutdown */
-
-	/* DMA related objects */
-	struct dma_chan		*chan_fifo0_rx;
-	struct dma_chan		*chan_fifo0_tx;
-	struct completion	dma_complete;
-};
-
-struct sh_flctl_platform_data {
-	struct mtd_partition	*parts;
-	int			nr_parts;
-	unsigned long		flcmncr_val;
-
-	unsigned has_hwecc:1;
-	unsigned use_holden:1;
-
-	unsigned int            slave_id_fifo0_tx;
-	unsigned int            slave_id_fifo0_rx;
-};
-
-static inline struct sh_flctl *mtd_to_flctl(struct mtd_info *mtdinfo)
-{
-	return container_of(mtd_to_nand(mtdinfo), struct sh_flctl, chip);
-}
-
-#endif	/* __SH_FLCTL_H__ */
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 12/22] net/ethernet/8390: remove stnic
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
                   ` (9 preceding siblings ...)
  2023-01-13  6:23 ` [PATCH 11/22] mtd/nand: remove sh_flctl Christoph Hellwig
@ 2023-01-13  6:23 ` Christoph Hellwig
  2023-01-13  6:23 ` [PATCH 15/22] spi: remove spi-sh Christoph Hellwig
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Now that arch/sh is removed this driver is dead code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/net/ethernet/8390/Kconfig  |  12 --
 drivers/net/ethernet/8390/Makefile |   1 -
 drivers/net/ethernet/8390/stnic.c  | 302 -----------------------------
 3 files changed, 315 deletions(-)
 delete mode 100644 drivers/net/ethernet/8390/stnic.c

diff --git a/drivers/net/ethernet/8390/Kconfig b/drivers/net/ethernet/8390/Kconfig
index eb90de04c88419..a7976743be9ee3 100644
--- a/drivers/net/ethernet/8390/Kconfig
+++ b/drivers/net/ethernet/8390/Kconfig
@@ -155,18 +155,6 @@ config PCMCIA_PCNET
 	  To compile this driver as a module, choose M here: the module will be
 	  called pcnet_cs.  If unsure, say N.
 
-config STNIC
-	tristate "National DP83902AV  support"
-	depends on SUPERH
-	select CRC32
-	help
-	  Support for cards based on the National Semiconductor DP83902AV
-	  ST-NIC Serial Network Interface Controller for Twisted Pair.  This
-	  is a 10Mbit/sec Ethernet controller.  Product overview and specs at
-	  <http://www.national.com/pf/DP/DP83902A.html>.
-
-	  If unsure, say N.
-
 config ULTRA
 	tristate "SMC Ultra support"
 	depends on ISA
diff --git a/drivers/net/ethernet/8390/Makefile b/drivers/net/ethernet/8390/Makefile
index 85c83c566ec663..3819a3bb75a1c9 100644
--- a/drivers/net/ethernet/8390/Makefile
+++ b/drivers/net/ethernet/8390/Makefile
@@ -13,7 +13,6 @@ obj-$(CONFIG_NE2000) += ne.o 8390p.o
 obj-$(CONFIG_NE2K_PCI) += ne2k-pci.o 8390.o
 obj-$(CONFIG_PCMCIA_AXNET) += axnet_cs.o 8390.o
 obj-$(CONFIG_PCMCIA_PCNET) += pcnet_cs.o 8390.o
-obj-$(CONFIG_STNIC) += stnic.o 8390.o
 obj-$(CONFIG_ULTRA) += smc-ultra.o 8390.o
 obj-$(CONFIG_WD80x3) += wd.o 8390.o
 obj-$(CONFIG_XSURF100) += xsurf100.o
diff --git a/drivers/net/ethernet/8390/stnic.c b/drivers/net/ethernet/8390/stnic.c
deleted file mode 100644
index bd89ca8a92dfbc..00000000000000
--- a/drivers/net/ethernet/8390/stnic.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/* stnic.c : A SH7750 specific part of driver for NS DP83902A ST-NIC.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1999 kaz Kojima
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/interrupt.h>
-#include <linux/ioport.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-
-#include <asm/io.h>
-#include <mach-se/mach/se.h>
-#include <asm/machvec.h>
-#ifdef CONFIG_SH_STANDARD_BIOS
-#include <asm/sh_bios.h>
-#endif
-
-#include "8390.h"
-
-#define DRV_NAME "stnic"
-
-#define byte	unsigned char
-#define half	unsigned short
-#define word	unsigned int
-#define vbyte	volatile unsigned char
-#define vhalf	volatile unsigned short
-#define vword	volatile unsigned int
-
-#define STNIC_RUN	0x01	/* 1 == Run, 0 == reset. */
-
-#define START_PG	0	/* First page of TX buffer */
-#define STOP_PG		128	/* Last page +1 of RX ring */
-
-/* Alias */
-#define STNIC_CR	E8390_CMD
-#define PG0_RSAR0	EN0_RSARLO
-#define PG0_RSAR1	EN0_RSARHI
-#define PG0_RBCR0	EN0_RCNTLO
-#define PG0_RBCR1	EN0_RCNTHI
-
-#define CR_RRD		E8390_RREAD
-#define CR_RWR		E8390_RWRITE
-#define CR_PG0		E8390_PAGE0
-#define CR_STA		E8390_START
-#define CR_RDMA		E8390_NODMA
-
-/* FIXME! YOU MUST SET YOUR OWN ETHER ADDRESS.  */
-static byte stnic_eadr[6] =
-{0x00, 0xc0, 0x6e, 0x00, 0x00, 0x07};
-
-static struct net_device *stnic_dev;
-
-static void stnic_reset (struct net_device *dev);
-static void stnic_get_hdr (struct net_device *dev, struct e8390_pkt_hdr *hdr,
-			   int ring_page);
-static void stnic_block_input (struct net_device *dev, int count,
-			       struct sk_buff *skb , int ring_offset);
-static void stnic_block_output (struct net_device *dev, int count,
-				const unsigned char *buf, int start_page);
-
-static void stnic_init (struct net_device *dev);
-
-static u32 stnic_msg_enable;
-
-module_param_named(msg_enable, stnic_msg_enable, uint, 0444);
-MODULE_PARM_DESC(msg_enable, "Debug message level (see linux/netdevice.h for bitmap)");
-
-/* SH7750 specific read/write io. */
-static inline void
-STNIC_DELAY (void)
-{
-  vword trash;
-  trash = *(vword *) 0xa0000000;
-  trash = *(vword *) 0xa0000000;
-  trash = *(vword *) 0xa0000000;
-}
-
-static inline byte
-STNIC_READ (int reg)
-{
-  byte val;
-
-  val = (*(vhalf *) (PA_83902 + ((reg) << 1)) >> 8) & 0xff;
-  STNIC_DELAY ();
-  return val;
-}
-
-static inline void
-STNIC_WRITE (int reg, byte val)
-{
-  *(vhalf *) (PA_83902 + ((reg) << 1)) = ((half) (val) << 8);
-  STNIC_DELAY ();
-}
-
-static int __init stnic_probe(void)
-{
-  struct net_device *dev;
-  struct ei_device *ei_local;
-  int err;
-
-  /* If we are not running on a SolutionEngine, give up now */
-  if (! MACH_SE)
-    return -ENODEV;
-
-  /* New style probing API */
-  dev = alloc_ei_netdev();
-  if (!dev)
-	return -ENOMEM;
-
-#ifdef CONFIG_SH_STANDARD_BIOS
-  sh_bios_get_node_addr (stnic_eadr);
-#endif
-  eth_hw_addr_set(dev, stnic_eadr);
-
-  /* Set the base address to point to the NIC, not the "real" base! */
-  dev->base_addr = 0x1000;
-  dev->irq = IRQ_STNIC;
-  dev->netdev_ops = &ei_netdev_ops;
-
-  /* Snarf the interrupt now.  There's no point in waiting since we cannot
-     share and the board will usually be enabled. */
-  err = request_irq (dev->irq, ei_interrupt, 0, DRV_NAME, dev);
-  if (err)  {
-	netdev_emerg(dev, " unable to get IRQ %d.\n", dev->irq);
-	free_netdev(dev);
-	return err;
-  }
-
-  ei_status.name = dev->name;
-  ei_status.word16 = 1;
-#ifdef __LITTLE_ENDIAN__
-  ei_status.bigendian = 0;
-#else
-  ei_status.bigendian = 1;
-#endif
-  ei_status.tx_start_page = START_PG;
-  ei_status.rx_start_page = START_PG + TX_PAGES;
-  ei_status.stop_page = STOP_PG;
-
-  ei_status.reset_8390 = &stnic_reset;
-  ei_status.get_8390_hdr = &stnic_get_hdr;
-  ei_status.block_input = &stnic_block_input;
-  ei_status.block_output = &stnic_block_output;
-
-  stnic_init (dev);
-  ei_local = netdev_priv(dev);
-  ei_local->msg_enable = stnic_msg_enable;
-
-  err = register_netdev(dev);
-  if (err) {
-    free_irq(dev->irq, dev);
-    free_netdev(dev);
-    return err;
-  }
-  stnic_dev = dev;
-
-  netdev_info(dev, "NS ST-NIC 83902A\n");
-
-  return 0;
-}
-
-static void
-stnic_reset (struct net_device *dev)
-{
-  struct ei_device *ei_local = netdev_priv(dev);
-
-  *(vhalf *) PA_83902_RST = 0;
-  udelay (5);
-  netif_warn(ei_local, hw, dev, "8390 reset done (%ld).\n", jiffies);
-  *(vhalf *) PA_83902_RST = ~0;
-  udelay (5);
-}
-
-static void
-stnic_get_hdr (struct net_device *dev, struct e8390_pkt_hdr *hdr,
-	       int ring_page)
-{
-  struct ei_device *ei_local = netdev_priv(dev);
-
-  half buf[2];
-
-  STNIC_WRITE (PG0_RSAR0, 0);
-  STNIC_WRITE (PG0_RSAR1, ring_page);
-  STNIC_WRITE (PG0_RBCR0, 4);
-  STNIC_WRITE (PG0_RBCR1, 0);
-  STNIC_WRITE (STNIC_CR, CR_RRD | CR_PG0 | CR_STA);
-
-  buf[0] = *(vhalf *) PA_83902_IF;
-  STNIC_DELAY ();
-  buf[1] = *(vhalf *) PA_83902_IF;
-  STNIC_DELAY ();
-  hdr->next = buf[0] >> 8;
-  hdr->status = buf[0] & 0xff;
-#ifdef __LITTLE_ENDIAN__
-  hdr->count = buf[1];
-#else
-  hdr->count = ((buf[1] >> 8) & 0xff) | (buf[1] << 8);
-#endif
-
-  netif_dbg(ei_local, probe, dev, "ring %x status %02x next %02x count %04x.\n",
-	    ring_page, hdr->status, hdr->next, hdr->count);
-
-  STNIC_WRITE (STNIC_CR, CR_RDMA | CR_PG0 | CR_STA);
-}
-
-/* Block input and output, similar to the Crynwr packet driver. If you are
-   porting to a new ethercard look at the packet driver source for hints.
-   The HP LAN doesn't use shared memory -- we put the packet
-   out through the "remote DMA" dataport. */
-
-static void
-stnic_block_input (struct net_device *dev, int length, struct sk_buff *skb,
-		   int offset)
-{
-  char *buf = skb->data;
-  half val;
-
-  STNIC_WRITE (PG0_RSAR0, offset & 0xff);
-  STNIC_WRITE (PG0_RSAR1, offset >> 8);
-  STNIC_WRITE (PG0_RBCR0, length & 0xff);
-  STNIC_WRITE (PG0_RBCR1, length >> 8);
-  STNIC_WRITE (STNIC_CR, CR_RRD | CR_PG0 | CR_STA);
-
-  if (length & 1)
-    length++;
-
-  while (length > 0)
-    {
-      val = *(vhalf *) PA_83902_IF;
-#ifdef __LITTLE_ENDIAN__
-      *buf++ = val & 0xff;
-      *buf++ = val >> 8;
-#else
-      *buf++ = val >> 8;
-      *buf++ = val & 0xff;
-#endif
-      STNIC_DELAY ();
-      length -= sizeof (half);
-    }
-
-  STNIC_WRITE (STNIC_CR, CR_RDMA | CR_PG0 | CR_STA);
-}
-
-static void
-stnic_block_output (struct net_device *dev, int length,
-		    const unsigned char *buf, int output_page)
-{
-  STNIC_WRITE (PG0_RBCR0, 1);	/* Write non-zero value */
-  STNIC_WRITE (STNIC_CR, CR_RRD | CR_PG0 | CR_STA);
-  STNIC_DELAY ();
-
-  STNIC_WRITE (PG0_RBCR0, length & 0xff);
-  STNIC_WRITE (PG0_RBCR1, length >> 8);
-  STNIC_WRITE (PG0_RSAR0, 0);
-  STNIC_WRITE (PG0_RSAR1, output_page);
-  STNIC_WRITE (STNIC_CR, CR_RWR | CR_PG0 | CR_STA);
-
-  if (length & 1)
-    length++;
-
-  while (length > 0)
-    {
-#ifdef __LITTLE_ENDIAN__
-      *(vhalf *) PA_83902_IF = ((half) buf[1] << 8) | buf[0];
-#else
-      *(vhalf *) PA_83902_IF = ((half) buf[0] << 8) | buf[1];
-#endif
-      STNIC_DELAY ();
-      buf += sizeof (half);
-      length -= sizeof (half);
-    }
-
-  STNIC_WRITE (STNIC_CR, CR_RDMA | CR_PG0 | CR_STA);
-}
-
-/* This function resets the STNIC if something screws up.  */
-static void
-stnic_init (struct net_device *dev)
-{
-  stnic_reset (dev);
-  NS8390_init (dev, 0);
-}
-
-static void __exit stnic_cleanup(void)
-{
-	unregister_netdev(stnic_dev);
-	free_irq(stnic_dev->irq, stnic_dev);
-	free_netdev(stnic_dev);
-}
-
-module_init(stnic_probe);
-module_exit(stnic_cleanup);
-MODULE_LICENSE("GPL");
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 15/22] spi: remove spi-sh
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
                   ` (10 preceding siblings ...)
  2023-01-13  6:23 ` [PATCH 12/22] net/ethernet/8390: remove stnic Christoph Hellwig
@ 2023-01-13  6:23 ` Christoph Hellwig
  2023-01-13  6:23 ` [PATCH 16/22] spi: remove spi-sh-sci Christoph Hellwig
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Now that arch/sh is removed this driver is dead code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/spi/Kconfig  |   6 -
 drivers/spi/Makefile |   1 -
 drivers/spi/spi-sh.c | 474 -------------------------------------------
 3 files changed, 481 deletions(-)
 delete mode 100644 drivers/spi/spi-sh.c

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 2c5226adf5e1d3..7508dcef909c78 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -882,12 +882,6 @@ config SPI_SH_MSIOF
 	help
 	  SPI driver for SuperH and SH Mobile MSIOF blocks.
 
-config SPI_SH
-	tristate "SuperH SPI controller"
-	depends on SUPERH || COMPILE_TEST
-	help
-	  SPI driver for SuperH SPI blocks.
-
 config SPI_SH_SCI
 	tristate "SuperH SCI SPI controller"
 	depends on SUPERH
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index be9ba40ef8d03d..342a7eb5181c9b 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -116,7 +116,6 @@ obj-$(CONFIG_SPI_S3C24XX)		+= spi-s3c24xx-hw.o
 spi-s3c24xx-hw-y			:= spi-s3c24xx.o
 obj-$(CONFIG_SPI_S3C64XX)		+= spi-s3c64xx.o
 obj-$(CONFIG_SPI_SC18IS602)		+= spi-sc18is602.o
-obj-$(CONFIG_SPI_SH)			+= spi-sh.o
 obj-$(CONFIG_SPI_SH_HSPI)		+= spi-sh-hspi.o
 obj-$(CONFIG_SPI_SH_MSIOF)		+= spi-sh-msiof.o
 obj-$(CONFIG_SPI_SH_SCI)		+= spi-sh-sci.o
diff --git a/drivers/spi/spi-sh.c b/drivers/spi/spi-sh.c
deleted file mode 100644
index 3e72fad99adfd4..00000000000000
--- a/drivers/spi/spi-sh.c
+++ /dev/null
@@ -1,474 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * SH SPI bus driver
- *
- * Copyright (C) 2011  Renesas Solutions Corp.
- *
- * Based on pxa2xx_spi.c:
- * Copyright (C) 2005 Stephen Street / StreetFire Sound Labs
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/errno.h>
-#include <linux/timer.h>
-#include <linux/delay.h>
-#include <linux/list.h>
-#include <linux/workqueue.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/spi/spi.h>
-
-#define SPI_SH_TBR		0x00
-#define SPI_SH_RBR		0x00
-#define SPI_SH_CR1		0x08
-#define SPI_SH_CR2		0x10
-#define SPI_SH_CR3		0x18
-#define SPI_SH_CR4		0x20
-#define SPI_SH_CR5		0x28
-
-/* CR1 */
-#define SPI_SH_TBE		0x80
-#define SPI_SH_TBF		0x40
-#define SPI_SH_RBE		0x20
-#define SPI_SH_RBF		0x10
-#define SPI_SH_PFONRD		0x08
-#define SPI_SH_SSDB		0x04
-#define SPI_SH_SSD		0x02
-#define SPI_SH_SSA		0x01
-
-/* CR2 */
-#define SPI_SH_RSTF		0x80
-#define SPI_SH_LOOPBK		0x40
-#define SPI_SH_CPOL		0x20
-#define SPI_SH_CPHA		0x10
-#define SPI_SH_L1M0		0x08
-
-/* CR3 */
-#define SPI_SH_MAX_BYTE		0xFF
-
-/* CR4 */
-#define SPI_SH_TBEI		0x80
-#define SPI_SH_TBFI		0x40
-#define SPI_SH_RBEI		0x20
-#define SPI_SH_RBFI		0x10
-#define SPI_SH_WPABRT		0x04
-#define SPI_SH_SSS		0x01
-
-/* CR8 */
-#define SPI_SH_P1L0		0x80
-#define SPI_SH_PP1L0		0x40
-#define SPI_SH_MUXI		0x20
-#define SPI_SH_MUXIRQ		0x10
-
-#define SPI_SH_FIFO_SIZE	32
-#define SPI_SH_SEND_TIMEOUT	(3 * HZ)
-#define SPI_SH_RECEIVE_TIMEOUT	(HZ >> 3)
-
-#undef DEBUG
-
-struct spi_sh_data {
-	void __iomem *addr;
-	int irq;
-	struct spi_master *master;
-	unsigned long cr1;
-	wait_queue_head_t wait;
-	int width;
-};
-
-static void spi_sh_write(struct spi_sh_data *ss, unsigned long data,
-			     unsigned long offset)
-{
-	if (ss->width == 8)
-		iowrite8(data, ss->addr + (offset >> 2));
-	else if (ss->width == 32)
-		iowrite32(data, ss->addr + offset);
-}
-
-static unsigned long spi_sh_read(struct spi_sh_data *ss, unsigned long offset)
-{
-	if (ss->width == 8)
-		return ioread8(ss->addr + (offset >> 2));
-	else if (ss->width == 32)
-		return ioread32(ss->addr + offset);
-	else
-		return 0;
-}
-
-static void spi_sh_set_bit(struct spi_sh_data *ss, unsigned long val,
-				unsigned long offset)
-{
-	unsigned long tmp;
-
-	tmp = spi_sh_read(ss, offset);
-	tmp |= val;
-	spi_sh_write(ss, tmp, offset);
-}
-
-static void spi_sh_clear_bit(struct spi_sh_data *ss, unsigned long val,
-				unsigned long offset)
-{
-	unsigned long tmp;
-
-	tmp = spi_sh_read(ss, offset);
-	tmp &= ~val;
-	spi_sh_write(ss, tmp, offset);
-}
-
-static void clear_fifo(struct spi_sh_data *ss)
-{
-	spi_sh_set_bit(ss, SPI_SH_RSTF, SPI_SH_CR2);
-	spi_sh_clear_bit(ss, SPI_SH_RSTF, SPI_SH_CR2);
-}
-
-static int spi_sh_wait_receive_buffer(struct spi_sh_data *ss)
-{
-	int timeout = 100000;
-
-	while (spi_sh_read(ss, SPI_SH_CR1) & SPI_SH_RBE) {
-		udelay(10);
-		if (timeout-- < 0)
-			return -ETIMEDOUT;
-	}
-	return 0;
-}
-
-static int spi_sh_wait_write_buffer_empty(struct spi_sh_data *ss)
-{
-	int timeout = 100000;
-
-	while (!(spi_sh_read(ss, SPI_SH_CR1) & SPI_SH_TBE)) {
-		udelay(10);
-		if (timeout-- < 0)
-			return -ETIMEDOUT;
-	}
-	return 0;
-}
-
-static int spi_sh_send(struct spi_sh_data *ss, struct spi_message *mesg,
-			struct spi_transfer *t)
-{
-	int i, retval = 0;
-	int remain = t->len;
-	int cur_len;
-	unsigned char *data;
-	long ret;
-
-	if (t->len)
-		spi_sh_set_bit(ss, SPI_SH_SSA, SPI_SH_CR1);
-
-	data = (unsigned char *)t->tx_buf;
-	while (remain > 0) {
-		cur_len = min(SPI_SH_FIFO_SIZE, remain);
-		for (i = 0; i < cur_len &&
-				!(spi_sh_read(ss, SPI_SH_CR4) &
-							SPI_SH_WPABRT) &&
-				!(spi_sh_read(ss, SPI_SH_CR1) & SPI_SH_TBF);
-				i++)
-			spi_sh_write(ss, (unsigned long)data[i], SPI_SH_TBR);
-
-		if (spi_sh_read(ss, SPI_SH_CR4) & SPI_SH_WPABRT) {
-			/* Abort SPI operation */
-			spi_sh_set_bit(ss, SPI_SH_WPABRT, SPI_SH_CR4);
-			retval = -EIO;
-			break;
-		}
-
-		cur_len = i;
-
-		remain -= cur_len;
-		data += cur_len;
-
-		if (remain > 0) {
-			ss->cr1 &= ~SPI_SH_TBE;
-			spi_sh_set_bit(ss, SPI_SH_TBE, SPI_SH_CR4);
-			ret = wait_event_interruptible_timeout(ss->wait,
-						 ss->cr1 & SPI_SH_TBE,
-						 SPI_SH_SEND_TIMEOUT);
-			if (ret == 0 && !(ss->cr1 & SPI_SH_TBE)) {
-				printk(KERN_ERR "%s: timeout\n", __func__);
-				return -ETIMEDOUT;
-			}
-		}
-	}
-
-	if (list_is_last(&t->transfer_list, &mesg->transfers)) {
-		spi_sh_clear_bit(ss, SPI_SH_SSD | SPI_SH_SSDB, SPI_SH_CR1);
-		spi_sh_set_bit(ss, SPI_SH_SSA, SPI_SH_CR1);
-
-		ss->cr1 &= ~SPI_SH_TBE;
-		spi_sh_set_bit(ss, SPI_SH_TBE, SPI_SH_CR4);
-		ret = wait_event_interruptible_timeout(ss->wait,
-					 ss->cr1 & SPI_SH_TBE,
-					 SPI_SH_SEND_TIMEOUT);
-		if (ret == 0 && (ss->cr1 & SPI_SH_TBE)) {
-			printk(KERN_ERR "%s: timeout\n", __func__);
-			return -ETIMEDOUT;
-		}
-	}
-
-	return retval;
-}
-
-static int spi_sh_receive(struct spi_sh_data *ss, struct spi_message *mesg,
-			  struct spi_transfer *t)
-{
-	int i;
-	int remain = t->len;
-	int cur_len;
-	unsigned char *data;
-	long ret;
-
-	if (t->len > SPI_SH_MAX_BYTE)
-		spi_sh_write(ss, SPI_SH_MAX_BYTE, SPI_SH_CR3);
-	else
-		spi_sh_write(ss, t->len, SPI_SH_CR3);
-
-	spi_sh_clear_bit(ss, SPI_SH_SSD | SPI_SH_SSDB, SPI_SH_CR1);
-	spi_sh_set_bit(ss, SPI_SH_SSA, SPI_SH_CR1);
-
-	spi_sh_wait_write_buffer_empty(ss);
-
-	data = (unsigned char *)t->rx_buf;
-	while (remain > 0) {
-		if (remain >= SPI_SH_FIFO_SIZE) {
-			ss->cr1 &= ~SPI_SH_RBF;
-			spi_sh_set_bit(ss, SPI_SH_RBF, SPI_SH_CR4);
-			ret = wait_event_interruptible_timeout(ss->wait,
-						 ss->cr1 & SPI_SH_RBF,
-						 SPI_SH_RECEIVE_TIMEOUT);
-			if (ret == 0 &&
-			    spi_sh_read(ss, SPI_SH_CR1) & SPI_SH_RBE) {
-				printk(KERN_ERR "%s: timeout\n", __func__);
-				return -ETIMEDOUT;
-			}
-		}
-
-		cur_len = min(SPI_SH_FIFO_SIZE, remain);
-		for (i = 0; i < cur_len; i++) {
-			if (spi_sh_wait_receive_buffer(ss))
-				break;
-			data[i] = (unsigned char)spi_sh_read(ss, SPI_SH_RBR);
-		}
-
-		remain -= cur_len;
-		data += cur_len;
-	}
-
-	/* deassert CS when SPI is receiving. */
-	if (t->len > SPI_SH_MAX_BYTE) {
-		clear_fifo(ss);
-		spi_sh_write(ss, 1, SPI_SH_CR3);
-	} else {
-		spi_sh_write(ss, 0, SPI_SH_CR3);
-	}
-
-	return 0;
-}
-
-static int spi_sh_transfer_one_message(struct spi_controller *ctlr,
-					struct spi_message *mesg)
-{
-	struct spi_sh_data *ss = spi_controller_get_devdata(ctlr);
-	struct spi_transfer *t;
-	int ret;
-
-	pr_debug("%s: enter\n", __func__);
-
-	spi_sh_clear_bit(ss, SPI_SH_SSA, SPI_SH_CR1);
-
-	list_for_each_entry(t, &mesg->transfers, transfer_list) {
-		pr_debug("tx_buf = %p, rx_buf = %p\n",
-			 t->tx_buf, t->rx_buf);
-		pr_debug("len = %d, delay.value = %d\n",
-			 t->len, t->delay.value);
-
-		if (t->tx_buf) {
-			ret = spi_sh_send(ss, mesg, t);
-			if (ret < 0)
-				goto error;
-		}
-		if (t->rx_buf) {
-			ret = spi_sh_receive(ss, mesg, t);
-			if (ret < 0)
-				goto error;
-		}
-		mesg->actual_length += t->len;
-	}
-
-	mesg->status = 0;
-	spi_finalize_current_message(ctlr);
-
-	clear_fifo(ss);
-	spi_sh_set_bit(ss, SPI_SH_SSD, SPI_SH_CR1);
-	udelay(100);
-
-	spi_sh_clear_bit(ss, SPI_SH_SSA | SPI_SH_SSDB | SPI_SH_SSD,
-			 SPI_SH_CR1);
-
-	clear_fifo(ss);
-
-	return 0;
-
- error:
-	mesg->status = ret;
-	spi_finalize_current_message(ctlr);
-	if (mesg->complete)
-		mesg->complete(mesg->context);
-
-	spi_sh_clear_bit(ss, SPI_SH_SSA | SPI_SH_SSDB | SPI_SH_SSD,
-			 SPI_SH_CR1);
-	clear_fifo(ss);
-
-	return ret;
-}
-
-static int spi_sh_setup(struct spi_device *spi)
-{
-	struct spi_sh_data *ss = spi_master_get_devdata(spi->master);
-
-	pr_debug("%s: enter\n", __func__);
-
-	spi_sh_write(ss, 0xfe, SPI_SH_CR1);	/* SPI sycle stop */
-	spi_sh_write(ss, 0x00, SPI_SH_CR1);	/* CR1 init */
-	spi_sh_write(ss, 0x00, SPI_SH_CR3);	/* CR3 init */
-
-	clear_fifo(ss);
-
-	/* 1/8 clock */
-	spi_sh_write(ss, spi_sh_read(ss, SPI_SH_CR2) | 0x07, SPI_SH_CR2);
-	udelay(10);
-
-	return 0;
-}
-
-static void spi_sh_cleanup(struct spi_device *spi)
-{
-	struct spi_sh_data *ss = spi_master_get_devdata(spi->master);
-
-	pr_debug("%s: enter\n", __func__);
-
-	spi_sh_clear_bit(ss, SPI_SH_SSA | SPI_SH_SSDB | SPI_SH_SSD,
-			 SPI_SH_CR1);
-}
-
-static irqreturn_t spi_sh_irq(int irq, void *_ss)
-{
-	struct spi_sh_data *ss = (struct spi_sh_data *)_ss;
-	unsigned long cr1;
-
-	cr1 = spi_sh_read(ss, SPI_SH_CR1);
-	if (cr1 & SPI_SH_TBE)
-		ss->cr1 |= SPI_SH_TBE;
-	if (cr1 & SPI_SH_TBF)
-		ss->cr1 |= SPI_SH_TBF;
-	if (cr1 & SPI_SH_RBE)
-		ss->cr1 |= SPI_SH_RBE;
-	if (cr1 & SPI_SH_RBF)
-		ss->cr1 |= SPI_SH_RBF;
-
-	if (ss->cr1) {
-		spi_sh_clear_bit(ss, ss->cr1, SPI_SH_CR4);
-		wake_up(&ss->wait);
-	}
-
-	return IRQ_HANDLED;
-}
-
-static int spi_sh_remove(struct platform_device *pdev)
-{
-	struct spi_sh_data *ss = platform_get_drvdata(pdev);
-
-	spi_unregister_master(ss->master);
-	free_irq(ss->irq, ss);
-
-	return 0;
-}
-
-static int spi_sh_probe(struct platform_device *pdev)
-{
-	struct resource *res;
-	struct spi_master *master;
-	struct spi_sh_data *ss;
-	int ret, irq;
-
-	/* get base addr */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (unlikely(res == NULL)) {
-		dev_err(&pdev->dev, "invalid resource\n");
-		return -EINVAL;
-	}
-
-	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
-		return irq;
-
-	master = devm_spi_alloc_master(&pdev->dev, sizeof(struct spi_sh_data));
-	if (master == NULL) {
-		dev_err(&pdev->dev, "spi_alloc_master error.\n");
-		return -ENOMEM;
-	}
-
-	ss = spi_master_get_devdata(master);
-	platform_set_drvdata(pdev, ss);
-
-	switch (res->flags & IORESOURCE_MEM_TYPE_MASK) {
-	case IORESOURCE_MEM_8BIT:
-		ss->width = 8;
-		break;
-	case IORESOURCE_MEM_32BIT:
-		ss->width = 32;
-		break;
-	default:
-		dev_err(&pdev->dev, "No support width\n");
-		return -ENODEV;
-	}
-	ss->irq = irq;
-	ss->master = master;
-	ss->addr = devm_ioremap(&pdev->dev, res->start, resource_size(res));
-	if (ss->addr == NULL) {
-		dev_err(&pdev->dev, "ioremap error.\n");
-		return -ENOMEM;
-	}
-	init_waitqueue_head(&ss->wait);
-
-	ret = request_irq(irq, spi_sh_irq, 0, "spi_sh", ss);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "request_irq error\n");
-		return ret;
-	}
-
-	master->num_chipselect = 2;
-	master->bus_num = pdev->id;
-	master->setup = spi_sh_setup;
-	master->transfer_one_message = spi_sh_transfer_one_message;
-	master->cleanup = spi_sh_cleanup;
-
-	ret = spi_register_master(master);
-	if (ret < 0) {
-		printk(KERN_ERR "spi_register_master error.\n");
-		goto error3;
-	}
-
-	return 0;
-
- error3:
-	free_irq(irq, ss);
-	return ret;
-}
-
-static struct platform_driver spi_sh_driver = {
-	.probe = spi_sh_probe,
-	.remove = spi_sh_remove,
-	.driver = {
-		.name = "sh_spi",
-	},
-};
-module_platform_driver(spi_sh_driver);
-
-MODULE_DESCRIPTION("SH SPI bus driver");
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("Yoshihiro Shimoda");
-MODULE_ALIAS("platform:sh_spi");
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 16/22] spi: remove spi-sh-sci
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
                   ` (11 preceding siblings ...)
  2023-01-13  6:23 ` [PATCH 15/22] spi: remove spi-sh Christoph Hellwig
@ 2023-01-13  6:23 ` Christoph Hellwig
  2023-01-13  8:50   ` Geert Uytterhoeven
  2023-01-13  6:23 ` [PATCH 17/22] spi: remove spi-jcore Christoph Hellwig
                   ` (8 subsequent siblings)
  21 siblings, 1 reply; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Now that arch/sh is removed this driver is dead code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/spi/Kconfig      |   7 --
 drivers/spi/Makefile     |   1 -
 drivers/spi/spi-sh-sci.c | 197 ---------------------------------------
 3 files changed, 205 deletions(-)
 delete mode 100644 drivers/spi/spi-sh-sci.c

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 7508dcef909c78..76f3bc6f8c81fc 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -882,13 +882,6 @@ config SPI_SH_MSIOF
 	help
 	  SPI driver for SuperH and SH Mobile MSIOF blocks.
 
-config SPI_SH_SCI
-	tristate "SuperH SCI SPI controller"
-	depends on SUPERH
-	select SPI_BITBANG
-	help
-	  SPI driver for SuperH SCI blocks.
-
 config SPI_SH_HSPI
 	tristate "SuperH HSPI controller"
 	depends on ARCH_RENESAS || COMPILE_TEST
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 342a7eb5181c9b..27d877440c6539 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -118,7 +118,6 @@ obj-$(CONFIG_SPI_S3C64XX)		+= spi-s3c64xx.o
 obj-$(CONFIG_SPI_SC18IS602)		+= spi-sc18is602.o
 obj-$(CONFIG_SPI_SH_HSPI)		+= spi-sh-hspi.o
 obj-$(CONFIG_SPI_SH_MSIOF)		+= spi-sh-msiof.o
-obj-$(CONFIG_SPI_SH_SCI)		+= spi-sh-sci.o
 obj-$(CONFIG_SPI_SIFIVE)		+= spi-sifive.o
 obj-$(CONFIG_SPI_SLAVE_MT27XX)          += spi-slave-mt27xx.o
 obj-$(CONFIG_SPI_SN_F_OSPI)		+= spi-sn-f-ospi.o
diff --git a/drivers/spi/spi-sh-sci.c b/drivers/spi/spi-sh-sci.c
deleted file mode 100644
index 8f30531e141867..00000000000000
--- a/drivers/spi/spi-sh-sci.c
+++ /dev/null
@@ -1,197 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * SH SCI SPI interface
- *
- * Copyright (c) 2008 Magnus Damm
- *
- * Based on S3C24XX GPIO based SPI driver, which is:
- *   Copyright (c) 2006 Ben Dooks
- *   Copyright (c) 2006 Simtec Electronics
- */
-
-#include <linux/kernel.h>
-#include <linux/delay.h>
-#include <linux/spinlock.h>
-#include <linux/platform_device.h>
-
-#include <linux/spi/spi.h>
-#include <linux/spi/spi_bitbang.h>
-#include <linux/module.h>
-
-#include <asm/spi.h>
-#include <asm/io.h>
-
-struct sh_sci_spi {
-	struct spi_bitbang bitbang;
-
-	void __iomem *membase;
-	unsigned char val;
-	struct sh_spi_info *info;
-	struct platform_device *dev;
-};
-
-#define SCSPTR(sp)	(sp->membase + 0x1c)
-#define PIN_SCK		(1 << 2)
-#define PIN_TXD		(1 << 0)
-#define PIN_RXD		PIN_TXD
-#define PIN_INIT	((1 << 1) | (1 << 3) | PIN_SCK | PIN_TXD)
-
-static inline void setbits(struct sh_sci_spi *sp, int bits, int on)
-{
-	/*
-	 * We are the only user of SCSPTR so no locking is required.
-	 * Reading bit 2 and 0 in SCSPTR gives pin state as input.
-	 * Writing the same bits sets the output value.
-	 * This makes regular read-modify-write difficult so we
-	 * use sp->val to keep track of the latest register value.
-	 */
-
-	if (on)
-		sp->val |= bits;
-	else
-		sp->val &= ~bits;
-
-	iowrite8(sp->val, SCSPTR(sp));
-}
-
-static inline void setsck(struct spi_device *dev, int on)
-{
-	setbits(spi_master_get_devdata(dev->master), PIN_SCK, on);
-}
-
-static inline void setmosi(struct spi_device *dev, int on)
-{
-	setbits(spi_master_get_devdata(dev->master), PIN_TXD, on);
-}
-
-static inline u32 getmiso(struct spi_device *dev)
-{
-	struct sh_sci_spi *sp = spi_master_get_devdata(dev->master);
-
-	return (ioread8(SCSPTR(sp)) & PIN_RXD) ? 1 : 0;
-}
-
-#define spidelay(x) ndelay(x)
-
-#include "spi-bitbang-txrx.h"
-
-static u32 sh_sci_spi_txrx_mode0(struct spi_device *spi,
-				 unsigned nsecs, u32 word, u8 bits,
-				 unsigned flags)
-{
-	return bitbang_txrx_be_cpha0(spi, nsecs, 0, flags, word, bits);
-}
-
-static u32 sh_sci_spi_txrx_mode1(struct spi_device *spi,
-				 unsigned nsecs, u32 word, u8 bits,
-				 unsigned flags)
-{
-	return bitbang_txrx_be_cpha1(spi, nsecs, 0, flags, word, bits);
-}
-
-static u32 sh_sci_spi_txrx_mode2(struct spi_device *spi,
-				 unsigned nsecs, u32 word, u8 bits,
-				 unsigned flags)
-{
-	return bitbang_txrx_be_cpha0(spi, nsecs, 1, flags, word, bits);
-}
-
-static u32 sh_sci_spi_txrx_mode3(struct spi_device *spi,
-				 unsigned nsecs, u32 word, u8 bits,
-				 unsigned flags)
-{
-	return bitbang_txrx_be_cpha1(spi, nsecs, 1, flags, word, bits);
-}
-
-static void sh_sci_spi_chipselect(struct spi_device *dev, int value)
-{
-	struct sh_sci_spi *sp = spi_master_get_devdata(dev->master);
-
-	if (sp->info->chip_select)
-		(sp->info->chip_select)(sp->info, dev->chip_select, value);
-}
-
-static int sh_sci_spi_probe(struct platform_device *dev)
-{
-	struct resource	*r;
-	struct spi_master *master;
-	struct sh_sci_spi *sp;
-	int ret;
-
-	master = spi_alloc_master(&dev->dev, sizeof(struct sh_sci_spi));
-	if (master == NULL) {
-		dev_err(&dev->dev, "failed to allocate spi master\n");
-		ret = -ENOMEM;
-		goto err0;
-	}
-
-	sp = spi_master_get_devdata(master);
-
-	platform_set_drvdata(dev, sp);
-	sp->info = dev_get_platdata(&dev->dev);
-	if (!sp->info) {
-		dev_err(&dev->dev, "platform data is missing\n");
-		ret = -ENOENT;
-		goto err1;
-	}
-
-	/* setup spi bitbang adaptor */
-	sp->bitbang.master = master;
-	sp->bitbang.master->bus_num = sp->info->bus_num;
-	sp->bitbang.master->num_chipselect = sp->info->num_chipselect;
-	sp->bitbang.chipselect = sh_sci_spi_chipselect;
-
-	sp->bitbang.txrx_word[SPI_MODE_0] = sh_sci_spi_txrx_mode0;
-	sp->bitbang.txrx_word[SPI_MODE_1] = sh_sci_spi_txrx_mode1;
-	sp->bitbang.txrx_word[SPI_MODE_2] = sh_sci_spi_txrx_mode2;
-	sp->bitbang.txrx_word[SPI_MODE_3] = sh_sci_spi_txrx_mode3;
-
-	r = platform_get_resource(dev, IORESOURCE_MEM, 0);
-	if (r == NULL) {
-		ret = -ENOENT;
-		goto err1;
-	}
-	sp->membase = ioremap(r->start, resource_size(r));
-	if (!sp->membase) {
-		ret = -ENXIO;
-		goto err1;
-	}
-	sp->val = ioread8(SCSPTR(sp));
-	setbits(sp, PIN_INIT, 1);
-
-	ret = spi_bitbang_start(&sp->bitbang);
-	if (!ret)
-		return 0;
-
-	setbits(sp, PIN_INIT, 0);
-	iounmap(sp->membase);
- err1:
-	spi_master_put(sp->bitbang.master);
- err0:
-	return ret;
-}
-
-static int sh_sci_spi_remove(struct platform_device *dev)
-{
-	struct sh_sci_spi *sp = platform_get_drvdata(dev);
-
-	spi_bitbang_stop(&sp->bitbang);
-	setbits(sp, PIN_INIT, 0);
-	iounmap(sp->membase);
-	spi_master_put(sp->bitbang.master);
-	return 0;
-}
-
-static struct platform_driver sh_sci_spi_drv = {
-	.probe		= sh_sci_spi_probe,
-	.remove		= sh_sci_spi_remove,
-	.driver		= {
-		.name	= "spi_sh_sci",
-	},
-};
-module_platform_driver(sh_sci_spi_drv);
-
-MODULE_DESCRIPTION("SH SCI SPI Driver");
-MODULE_AUTHOR("Magnus Damm <damm@opensource.se>");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:spi_sh_sci");
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 17/22] spi: remove spi-jcore
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
                   ` (12 preceding siblings ...)
  2023-01-13  6:23 ` [PATCH 16/22] spi: remove spi-sh-sci Christoph Hellwig
@ 2023-01-13  6:23 ` Christoph Hellwig
  2023-01-13  6:23 ` [PATCH 18/22] usb: remove ehci-sh Christoph Hellwig
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Now that arch/sh is removed this driver is dead code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/spi/Kconfig     |   7 --
 drivers/spi/Makefile    |   1 -
 drivers/spi/spi-jcore.c | 235 ----------------------------------------
 3 files changed, 243 deletions(-)
 delete mode 100644 drivers/spi/spi-jcore.c

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 76f3bc6f8c81fc..17c75f5c19be75 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -483,13 +483,6 @@ config SPI_INTEL_PLATFORM
 	  To compile this driver as a module, choose M here: the module
 	  will be called spi-intel-platform.
 
-config SPI_JCORE
-	tristate "J-Core SPI Master"
-	depends on OF && (SUPERH || COMPILE_TEST)
-	help
-	  This enables support for the SPI master controller in the J-Core
-	  synthesizable, open source SoC.
-
 config SPI_LM70_LLP
 	tristate "Parallel port adapter for LM70 eval board (DEVELOPMENT)"
 	depends on PARPORT
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 27d877440c6539..2d03fcefc11ea2 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -67,7 +67,6 @@ obj-$(CONFIG_SPI_INTEL)			+= spi-intel.o
 obj-$(CONFIG_SPI_INTEL_PCI)		+= spi-intel-pci.o
 obj-$(CONFIG_SPI_INTEL_PLATFORM)	+= spi-intel-platform.o
 obj-$(CONFIG_SPI_LANTIQ_SSC)		+= spi-lantiq-ssc.o
-obj-$(CONFIG_SPI_JCORE)			+= spi-jcore.o
 obj-$(CONFIG_SPI_LM70_LLP)		+= spi-lm70llp.o
 obj-$(CONFIG_SPI_LP8841_RTC)		+= spi-lp8841-rtc.o
 obj-$(CONFIG_SPI_MESON_SPICC)		+= spi-meson-spicc.o
diff --git a/drivers/spi/spi-jcore.c b/drivers/spi/spi-jcore.c
deleted file mode 100644
index 74c8319c29f170..00000000000000
--- a/drivers/spi/spi-jcore.c
+++ /dev/null
@@ -1,235 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * J-Core SPI controller driver
- *
- * Copyright (C) 2012-2016 Smart Energy Instruments, Inc.
- *
- * Current version by Rich Felker
- * Based loosely on initial version by Oleksandr G Zhadan
- *
- */
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/errno.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/spi/spi.h>
-#include <linux/clk.h>
-#include <linux/err.h>
-#include <linux/io.h>
-#include <linux/of.h>
-#include <linux/delay.h>
-
-#define DRV_NAME	"jcore_spi"
-
-#define CTRL_REG	0x0
-#define DATA_REG	0x4
-
-#define JCORE_SPI_CTRL_XMIT		0x02
-#define JCORE_SPI_STAT_BUSY		0x02
-#define JCORE_SPI_CTRL_LOOP		0x08
-#define JCORE_SPI_CTRL_CS_BITS		0x15
-
-#define JCORE_SPI_WAIT_RDY_MAX_LOOP	2000000
-
-struct jcore_spi {
-	struct spi_master *master;
-	void __iomem *base;
-	unsigned int cs_reg;
-	unsigned int speed_reg;
-	unsigned int speed_hz;
-	unsigned int clock_freq;
-};
-
-static int jcore_spi_wait(void __iomem *ctrl_reg)
-{
-	unsigned timeout = JCORE_SPI_WAIT_RDY_MAX_LOOP;
-
-	do {
-		if (!(readl(ctrl_reg) & JCORE_SPI_STAT_BUSY))
-			return 0;
-		cpu_relax();
-	} while (--timeout);
-
-	return -EBUSY;
-}
-
-static void jcore_spi_program(struct jcore_spi *hw)
-{
-	void __iomem *ctrl_reg = hw->base + CTRL_REG;
-
-	if (jcore_spi_wait(ctrl_reg))
-		dev_err(hw->master->dev.parent,
-			"timeout waiting to program ctrl reg.\n");
-
-	writel(hw->cs_reg | hw->speed_reg, ctrl_reg);
-}
-
-static void jcore_spi_chipsel(struct spi_device *spi, bool value)
-{
-	struct jcore_spi *hw = spi_master_get_devdata(spi->master);
-	u32 csbit = 1U << (2 * spi->chip_select);
-
-	dev_dbg(hw->master->dev.parent, "chipselect %d\n", spi->chip_select);
-
-	if (value)
-		hw->cs_reg |= csbit;
-	else
-		hw->cs_reg &= ~csbit;
-
-	jcore_spi_program(hw);
-}
-
-static void jcore_spi_baudrate(struct jcore_spi *hw, int speed)
-{
-	if (speed == hw->speed_hz)
-		return;
-	hw->speed_hz = speed;
-	if (speed >= hw->clock_freq / 2)
-		hw->speed_reg = 0;
-	else
-		hw->speed_reg = ((hw->clock_freq / 2 / speed) - 1) << 27;
-	jcore_spi_program(hw);
-	dev_dbg(hw->master->dev.parent, "speed=%d reg=0x%x\n",
-		speed, hw->speed_reg);
-}
-
-static int jcore_spi_txrx(struct spi_master *master, struct spi_device *spi,
-			  struct spi_transfer *t)
-{
-	struct jcore_spi *hw = spi_master_get_devdata(master);
-
-	void __iomem *ctrl_reg = hw->base + CTRL_REG;
-	void __iomem *data_reg = hw->base + DATA_REG;
-	u32 xmit;
-
-	/* data buffers */
-	const unsigned char *tx;
-	unsigned char *rx;
-	unsigned int len;
-	unsigned int count;
-
-	jcore_spi_baudrate(hw, t->speed_hz);
-
-	xmit = hw->cs_reg | hw->speed_reg | JCORE_SPI_CTRL_XMIT;
-	tx = t->tx_buf;
-	rx = t->rx_buf;
-	len = t->len;
-
-	for (count = 0; count < len; count++) {
-		if (jcore_spi_wait(ctrl_reg))
-			break;
-
-		writel(tx ? *tx++ : 0, data_reg);
-		writel(xmit, ctrl_reg);
-
-		if (jcore_spi_wait(ctrl_reg))
-			break;
-
-		if (rx)
-			*rx++ = readl(data_reg);
-	}
-
-	spi_finalize_current_transfer(master);
-
-	if (count < len)
-		return -EREMOTEIO;
-
-	return 0;
-}
-
-static int jcore_spi_probe(struct platform_device *pdev)
-{
-	struct device_node *node = pdev->dev.of_node;
-	struct jcore_spi *hw;
-	struct spi_master *master;
-	struct resource *res;
-	u32 clock_freq;
-	struct clk *clk;
-	int err = -ENODEV;
-
-	master = spi_alloc_master(&pdev->dev, sizeof(struct jcore_spi));
-	if (!master)
-		return err;
-
-	/* Setup the master state. */
-	master->num_chipselect = 3;
-	master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
-	master->transfer_one = jcore_spi_txrx;
-	master->set_cs = jcore_spi_chipsel;
-	master->dev.of_node = node;
-	master->bus_num = pdev->id;
-
-	hw = spi_master_get_devdata(master);
-	hw->master = master;
-	platform_set_drvdata(pdev, hw);
-
-	/* Find and map our resources */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		goto exit_busy;
-	if (!devm_request_mem_region(&pdev->dev, res->start,
-				     resource_size(res), pdev->name))
-		goto exit_busy;
-	hw->base = devm_ioremap(&pdev->dev, res->start,
-					resource_size(res));
-	if (!hw->base)
-		goto exit_busy;
-
-	/*
-	 * The SPI clock rate controlled via a configurable clock divider
-	 * which is applied to the reference clock. A 50 MHz reference is
-	 * most suitable for obtaining standard SPI clock rates, but some
-	 * designs may have a different reference clock, and the DT must
-	 * make the driver aware so that it can properly program the
-	 * requested rate. If the clock is omitted, 50 MHz is assumed.
-	 */
-	clock_freq = 50000000;
-	clk = devm_clk_get(&pdev->dev, "ref_clk");
-	if (!IS_ERR(clk)) {
-		if (clk_prepare_enable(clk) == 0) {
-			clock_freq = clk_get_rate(clk);
-			clk_disable_unprepare(clk);
-		} else
-			dev_warn(&pdev->dev, "could not enable ref_clk\n");
-	}
-	hw->clock_freq = clock_freq;
-
-	/* Initialize all CS bits to high. */
-	hw->cs_reg = JCORE_SPI_CTRL_CS_BITS;
-	jcore_spi_baudrate(hw, 400000);
-
-	/* Register our spi controller */
-	err = devm_spi_register_master(&pdev->dev, master);
-	if (err)
-		goto exit;
-
-	return 0;
-
-exit_busy:
-	err = -EBUSY;
-exit:
-	spi_master_put(master);
-	return err;
-}
-
-static const struct of_device_id jcore_spi_of_match[] = {
-	{ .compatible = "jcore,spi2" },
-	{},
-};
-MODULE_DEVICE_TABLE(of, jcore_spi_of_match);
-
-static struct platform_driver jcore_spi_driver = {
-	.probe = jcore_spi_probe,
-	.driver = {
-		.name = DRV_NAME,
-		.of_match_table = jcore_spi_of_match,
-	},
-};
-
-module_platform_driver(jcore_spi_driver);
-
-MODULE_DESCRIPTION("J-Core SPI driver");
-MODULE_AUTHOR("Rich Felker <dalias@libc.org>");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:" DRV_NAME);
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 18/22] usb: remove ehci-sh
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
                   ` (13 preceding siblings ...)
  2023-01-13  6:23 ` [PATCH 17/22] spi: remove spi-jcore Christoph Hellwig
@ 2023-01-13  6:23 ` Christoph Hellwig
  2023-01-13  6:23 ` [PATCH 19/22] fbdev: remove sh7760fb Christoph Hellwig
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Now that arch/sh is removed this driver is dead code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/usb/host/Kconfig    |   7 --
 drivers/usb/host/ehci-hcd.c |   7 --
 drivers/usb/host/ehci-sh.c  | 182 ------------------------------------
 3 files changed, 196 deletions(-)
 delete mode 100644 drivers/usb/host/ehci-sh.c

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index ca5f657c092cf4..ddd8b798626caf 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -279,13 +279,6 @@ config USB_EHCI_HCD_PPC_OF
 	  Enables support for the USB controller present on the PowerPC
 	  OpenFirmware platform bus.
 
-config USB_EHCI_SH
-	bool "EHCI support for SuperH USB controller"
-	depends on SUPERH || COMPILE_TEST
-	help
-	  Enables support for the on-chip EHCI controller on the SuperH.
-	  If you use the PCI EHCI controller, this option is not necessary.
-
 config USB_EHCI_EXYNOS
 	tristate "EHCI support for Samsung S5P/Exynos SoC Series"
 	depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index a1930db0da1c3c..e6dfef3492aabe 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1309,10 +1309,6 @@ MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_AUTHOR (DRIVER_AUTHOR);
 MODULE_LICENSE ("GPL");
 
-#ifdef CONFIG_USB_EHCI_SH
-#include "ehci-sh.c"
-#endif
-
 #ifdef CONFIG_PPC_PS3
 #include "ehci-ps3.c"
 #endif
@@ -1330,9 +1326,6 @@ MODULE_LICENSE ("GPL");
 #endif
 
 static struct platform_driver * const platform_drivers[] = {
-#ifdef CONFIG_USB_EHCI_SH
-	&ehci_hcd_sh_driver,
-#endif
 #ifdef CONFIG_USB_EHCI_HCD_PPC_OF
 	&ehci_hcd_ppc_of_driver,
 #endif
diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c
deleted file mode 100644
index c25c51d26f2603..00000000000000
--- a/drivers/usb/host/ehci-sh.c
+++ /dev/null
@@ -1,182 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * SuperH EHCI host controller driver
- *
- * Copyright (C) 2010  Paul Mundt
- *
- * Based on ohci-sh.c and ehci-atmel.c.
- */
-#include <linux/platform_device.h>
-#include <linux/clk.h>
-
-struct ehci_sh_priv {
-	struct clk *iclk, *fclk;
-	struct usb_hcd *hcd;
-};
-
-static int ehci_sh_reset(struct usb_hcd *hcd)
-{
-	struct ehci_hcd	*ehci = hcd_to_ehci(hcd);
-
-	ehci->caps = hcd->regs;
-
-	return ehci_setup(hcd);
-}
-
-static const struct hc_driver ehci_sh_hc_driver = {
-	.description			= hcd_name,
-	.product_desc			= "SuperH EHCI",
-	.hcd_priv_size			= sizeof(struct ehci_hcd),
-
-	/*
-	 * generic hardware linkage
-	 */
-	.irq				= ehci_irq,
-	.flags				= HCD_USB2 | HCD_DMA | HCD_MEMORY | HCD_BH,
-
-	/*
-	 * basic lifecycle operations
-	 */
-	.reset				= ehci_sh_reset,
-	.start				= ehci_run,
-	.stop				= ehci_stop,
-	.shutdown			= ehci_shutdown,
-
-	/*
-	 * managing i/o requests and associated device resources
-	 */
-	.urb_enqueue			= ehci_urb_enqueue,
-	.urb_dequeue			= ehci_urb_dequeue,
-	.endpoint_disable		= ehci_endpoint_disable,
-	.endpoint_reset			= ehci_endpoint_reset,
-
-	/*
-	 * scheduling support
-	 */
-	.get_frame_number		= ehci_get_frame,
-
-	/*
-	 * root hub support
-	 */
-	.hub_status_data		= ehci_hub_status_data,
-	.hub_control			= ehci_hub_control,
-
-#ifdef CONFIG_PM
-	.bus_suspend			= ehci_bus_suspend,
-	.bus_resume			= ehci_bus_resume,
-#endif
-
-	.relinquish_port		= ehci_relinquish_port,
-	.port_handed_over		= ehci_port_handed_over,
-	.clear_tt_buffer_complete	= ehci_clear_tt_buffer_complete,
-};
-
-static int ehci_hcd_sh_probe(struct platform_device *pdev)
-{
-	struct resource *res;
-	struct ehci_sh_priv *priv;
-	struct usb_hcd *hcd;
-	int irq, ret;
-
-	if (usb_disabled())
-		return -ENODEV;
-
-	irq = platform_get_irq(pdev, 0);
-	if (irq <= 0) {
-		ret = -ENODEV;
-		goto fail_create_hcd;
-	}
-
-	/* initialize hcd */
-	hcd = usb_create_hcd(&ehci_sh_hc_driver, &pdev->dev,
-			     dev_name(&pdev->dev));
-	if (!hcd) {
-		ret = -ENOMEM;
-		goto fail_create_hcd;
-	}
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	hcd->regs = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(hcd->regs)) {
-		ret = PTR_ERR(hcd->regs);
-		goto fail_request_resource;
-	}
-	hcd->rsrc_start = res->start;
-	hcd->rsrc_len = resource_size(res);
-
-	priv = devm_kzalloc(&pdev->dev, sizeof(struct ehci_sh_priv),
-			    GFP_KERNEL);
-	if (!priv) {
-		ret = -ENOMEM;
-		goto fail_request_resource;
-	}
-
-	/* These are optional, we don't care if they fail */
-	priv->fclk = devm_clk_get(&pdev->dev, "usb_fck");
-	if (IS_ERR(priv->fclk))
-		priv->fclk = NULL;
-
-	priv->iclk = devm_clk_get(&pdev->dev, "usb_ick");
-	if (IS_ERR(priv->iclk))
-		priv->iclk = NULL;
-
-	clk_enable(priv->fclk);
-	clk_enable(priv->iclk);
-
-	ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
-	if (ret != 0) {
-		dev_err(&pdev->dev, "Failed to add hcd");
-		goto fail_add_hcd;
-	}
-	device_wakeup_enable(hcd->self.controller);
-
-	priv->hcd = hcd;
-	platform_set_drvdata(pdev, priv);
-
-	return ret;
-
-fail_add_hcd:
-	clk_disable(priv->iclk);
-	clk_disable(priv->fclk);
-
-fail_request_resource:
-	usb_put_hcd(hcd);
-fail_create_hcd:
-	dev_err(&pdev->dev, "init %s fail, %d\n", dev_name(&pdev->dev), ret);
-
-	return ret;
-}
-
-static int ehci_hcd_sh_remove(struct platform_device *pdev)
-{
-	struct ehci_sh_priv *priv = platform_get_drvdata(pdev);
-	struct usb_hcd *hcd = priv->hcd;
-
-	usb_remove_hcd(hcd);
-	usb_put_hcd(hcd);
-
-	clk_disable(priv->fclk);
-	clk_disable(priv->iclk);
-
-	return 0;
-}
-
-static void ehci_hcd_sh_shutdown(struct platform_device *pdev)
-{
-	struct ehci_sh_priv *priv = platform_get_drvdata(pdev);
-	struct usb_hcd *hcd = priv->hcd;
-
-	if (hcd->driver->shutdown)
-		hcd->driver->shutdown(hcd);
-}
-
-static struct platform_driver ehci_hcd_sh_driver = {
-	.probe		= ehci_hcd_sh_probe,
-	.remove		= ehci_hcd_sh_remove,
-	.shutdown	= ehci_hcd_sh_shutdown,
-	.driver		= {
-		.name	= "sh_ehci",
-	},
-};
-
-MODULE_ALIAS("platform:sh_ehci");
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 19/22] fbdev: remove sh7760fb
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
                   ` (14 preceding siblings ...)
  2023-01-13  6:23 ` [PATCH 18/22] usb: remove ehci-sh Christoph Hellwig
@ 2023-01-13  6:23 ` Christoph Hellwig
  2023-01-13  8:53   ` Geert Uytterhoeven
  2023-01-13  6:23 ` [PATCH 20/22] media: remove sh_vou Christoph Hellwig
                   ` (5 subsequent siblings)
  21 siblings, 1 reply; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Now that arch/sh is removed this driver is dead code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/video/fbdev/Kconfig    |  17 +-
 drivers/video/fbdev/Makefile   |   1 -
 drivers/video/fbdev/sh7760fb.c | 587 ---------------------------------
 3 files changed, 1 insertion(+), 604 deletions(-)
 delete mode 100644 drivers/video/fbdev/sh7760fb.c

diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index b2bed599e6c6ea..cba0ba512a6ddb 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -1861,7 +1861,7 @@ config FB_W100
 config FB_SH_MOBILE_LCDC
 	tristate "SuperH Mobile LCDC framebuffer support"
 	depends on FB && HAVE_CLK && HAS_IOMEM
-	depends on SUPERH || ARCH_RENESAS || COMPILE_TEST
+	depends on ARCH_RENESAS || COMPILE_TEST
 	select FB_SYS_FILLRECT
 	select FB_SYS_COPYAREA
 	select FB_SYS_IMAGEBLIT
@@ -2048,21 +2048,6 @@ config FB_COBALT
 	tristate "Cobalt server LCD frame buffer support"
 	depends on FB && MIPS_COBALT
 
-config FB_SH7760
-	bool "SH7760/SH7763/SH7720/SH7721 LCDC support"
-	depends on FB && (CPU_SUBTYPE_SH7760 || CPU_SUBTYPE_SH7763 \
-		|| CPU_SUBTYPE_SH7720 || CPU_SUBTYPE_SH7721)
-	select FB_CFB_FILLRECT
-	select FB_CFB_COPYAREA
-	select FB_CFB_IMAGEBLIT
-	help
-	  Support for the SH7760/SH7763/SH7720/SH7721 integrated
-	  (D)STN/TFT LCD Controller.
-	  Supports display resolutions up to 1024x1024 pixel, grayscale and
-	  color operation, with depths ranging from 1 bpp to 8 bpp monochrome
-	  and 8, 15 or 16 bpp color; 90 degrees clockwise display rotation for
-	  panels <= 320 pixel horizontal resolution.
-
 config FB_DA8XX
 	tristate "DA8xx/OMAP-L1xx/AM335x Framebuffer support"
 	depends on FB && HAVE_CLK && HAS_IOMEM
diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile
index 7795c4126706fd..9941a30522b4b3 100644
--- a/drivers/video/fbdev/Makefile
+++ b/drivers/video/fbdev/Makefile
@@ -97,7 +97,6 @@ obj-$(CONFIG_FB_MAXINE)		  += maxinefb.o
 obj-$(CONFIG_FB_METRONOME)        += metronomefb.o
 obj-$(CONFIG_FB_BROADSHEET)       += broadsheetfb.o
 obj-$(CONFIG_FB_S1D13XXX)	  += s1d13xxxfb.o
-obj-$(CONFIG_FB_SH7760)		  += sh7760fb.o
 obj-$(CONFIG_FB_IMX)              += imxfb.o
 obj-$(CONFIG_FB_S3C)		  += s3c-fb.o
 obj-$(CONFIG_FB_S3C2410)	  += s3c2410fb.o
diff --git a/drivers/video/fbdev/sh7760fb.c b/drivers/video/fbdev/sh7760fb.c
deleted file mode 100644
index 5978a892123226..00000000000000
--- a/drivers/video/fbdev/sh7760fb.c
+++ /dev/null
@@ -1,587 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * SH7760/SH7763 LCDC Framebuffer driver.
- *
- * (c) 2006-2008 MSC Vertriebsges.m.b.H.,
- *             Manuel Lauss <mano@roarinelk.homelinux.net>
- * (c) 2008 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
- *
- * PLEASE HAVE A LOOK AT Documentation/fb/sh7760fb.rst!
- *
- * Thanks to Siegfried Schaefer <s.schaefer at schaefer-edv.de>
- *     for his original source and testing!
- *
- * sh7760_setcolreg get from drivers/video/sh_mobile_lcdcfb.c
- */
-
-#include <linux/completion.h>
-#include <linux/delay.h>
-#include <linux/dma-mapping.h>
-#include <linux/fb.h>
-#include <linux/interrupt.h>
-#include <linux/io.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-
-#include <asm/sh7760fb.h>
-
-struct sh7760fb_par {
-	void __iomem *base;
-	int irq;
-
-	struct sh7760fb_platdata *pd;	/* display information */
-
-	dma_addr_t fbdma;	/* physical address */
-
-	int rot;		/* rotation enabled? */
-
-	u32 pseudo_palette[16];
-
-	struct platform_device *dev;
-	struct resource *ioarea;
-	struct completion vsync;	/* vsync irq event */
-};
-
-static irqreturn_t sh7760fb_irq(int irq, void *data)
-{
-	struct completion *c = data;
-
-	complete(c);
-
-	return IRQ_HANDLED;
-}
-
-/* wait_for_lps - wait until power supply has reached a certain state. */
-static int wait_for_lps(struct sh7760fb_par *par, int val)
-{
-	int i = 100;
-	while (--i && ((ioread16(par->base + LDPMMR) & 3) != val))
-		msleep(1);
-
-	if (i <= 0)
-		return -ETIMEDOUT;
-
-	return 0;
-}
-
-/* en/disable the LCDC */
-static int sh7760fb_blank(int blank, struct fb_info *info)
-{
-	struct sh7760fb_par *par = info->par;
-	struct sh7760fb_platdata *pd = par->pd;
-	unsigned short cntr = ioread16(par->base + LDCNTR);
-	unsigned short intr = ioread16(par->base + LDINTR);
-	int lps;
-
-	if (blank == FB_BLANK_UNBLANK) {
-		intr |= VINT_START;
-		cntr = LDCNTR_DON2 | LDCNTR_DON;
-		lps = 3;
-	} else {
-		intr &= ~VINT_START;
-		cntr = LDCNTR_DON2;
-		lps = 0;
-	}
-
-	if (pd->blank)
-		pd->blank(blank);
-
-	iowrite16(intr, par->base + LDINTR);
-	iowrite16(cntr, par->base + LDCNTR);
-
-	return wait_for_lps(par, lps);
-}
-
-static int sh7760_setcolreg (u_int regno,
-	u_int red, u_int green, u_int blue,
-	u_int transp, struct fb_info *info)
-{
-	u32 *palette = info->pseudo_palette;
-
-	if (regno >= 16)
-		return -EINVAL;
-
-	/* only FB_VISUAL_TRUECOLOR supported */
-
-	red >>= 16 - info->var.red.length;
-	green >>= 16 - info->var.green.length;
-	blue >>= 16 - info->var.blue.length;
-	transp >>= 16 - info->var.transp.length;
-
-	palette[regno] = (red << info->var.red.offset) |
-		(green << info->var.green.offset) |
-		(blue << info->var.blue.offset) |
-		(transp << info->var.transp.offset);
-
-	return 0;
-}
-
-static int sh7760fb_get_color_info(struct device *dev,
-				   u16 lddfr, int *bpp, int *gray)
-{
-	int lbpp, lgray;
-
-	lgray = lbpp = 0;
-
-	switch (lddfr & LDDFR_COLOR_MASK) {
-	case LDDFR_1BPP_MONO:
-		lgray = 1;
-		lbpp = 1;
-		break;
-	case LDDFR_2BPP_MONO:
-		lgray = 1;
-		lbpp = 2;
-		break;
-	case LDDFR_4BPP_MONO:
-		lgray = 1;
-	case LDDFR_4BPP:
-		lbpp = 4;
-		break;
-	case LDDFR_6BPP_MONO:
-		lgray = 1;
-	case LDDFR_8BPP:
-		lbpp = 8;
-		break;
-	case LDDFR_16BPP_RGB555:
-	case LDDFR_16BPP_RGB565:
-		lbpp = 16;
-		lgray = 0;
-		break;
-	default:
-		dev_dbg(dev, "unsupported LDDFR bit depth.\n");
-		return -EINVAL;
-	}
-
-	if (bpp)
-		*bpp = lbpp;
-	if (gray)
-		*gray = lgray;
-
-	return 0;
-}
-
-static int sh7760fb_check_var(struct fb_var_screeninfo *var,
-			      struct fb_info *info)
-{
-	struct fb_fix_screeninfo *fix = &info->fix;
-	struct sh7760fb_par *par = info->par;
-	int ret, bpp;
-
-	/* get color info from register value */
-	ret = sh7760fb_get_color_info(info->dev, par->pd->lddfr, &bpp, NULL);
-	if (ret)
-		return ret;
-
-	var->bits_per_pixel = bpp;
-
-	if ((var->grayscale) && (var->bits_per_pixel == 1))
-		fix->visual = FB_VISUAL_MONO10;
-	else if (var->bits_per_pixel >= 15)
-		fix->visual = FB_VISUAL_TRUECOLOR;
-	else
-		fix->visual = FB_VISUAL_PSEUDOCOLOR;
-
-	/* TODO: add some more validation here */
-	return 0;
-}
-
-/*
- * sh7760fb_set_par - set videomode.
- *
- * NOTE: The rotation, grayscale and DSTN codepaths are
- *     totally untested!
- */
-static int sh7760fb_set_par(struct fb_info *info)
-{
-	struct sh7760fb_par *par = info->par;
-	struct fb_videomode *vm = par->pd->def_mode;
-	unsigned long sbase, dstn_off, ldsarl, stride;
-	unsigned short hsynp, hsynw, htcn, hdcn;
-	unsigned short vsynp, vsynw, vtln, vdln;
-	unsigned short lddfr, ldmtr;
-	int ret, bpp, gray;
-
-	par->rot = par->pd->rotate;
-
-	/* rotate only works with xres <= 320 */
-	if (par->rot && (vm->xres > 320)) {
-		dev_dbg(info->dev, "rotation disabled due to display size\n");
-		par->rot = 0;
-	}
-
-	/* calculate LCDC reg vals from display parameters */
-	hsynp = vm->right_margin + vm->xres;
-	hsynw = vm->hsync_len;
-	htcn = vm->left_margin + hsynp + hsynw;
-	hdcn = vm->xres;
-	vsynp = vm->lower_margin + vm->yres;
-	vsynw = vm->vsync_len;
-	vtln = vm->upper_margin + vsynp + vsynw;
-	vdln = vm->yres;
-
-	/* get color info from register value */
-	ret = sh7760fb_get_color_info(info->dev, par->pd->lddfr, &bpp, &gray);
-	if (ret)
-		return ret;
-
-	dev_dbg(info->dev, "%dx%d %dbpp %s (orientation %s)\n", hdcn,
-		vdln, bpp, gray ? "grayscale" : "color",
-		par->rot ? "rotated" : "normal");
-
-#ifdef CONFIG_CPU_LITTLE_ENDIAN
-	lddfr = par->pd->lddfr | (1 << 8);
-#else
-	lddfr = par->pd->lddfr & ~(1 << 8);
-#endif
-
-	ldmtr = par->pd->ldmtr;
-
-	if (!(vm->sync & FB_SYNC_HOR_HIGH_ACT))
-		ldmtr |= LDMTR_CL1POL;
-	if (!(vm->sync & FB_SYNC_VERT_HIGH_ACT))
-		ldmtr |= LDMTR_FLMPOL;
-
-	/* shut down LCDC before changing display parameters */
-	sh7760fb_blank(FB_BLANK_POWERDOWN, info);
-
-	iowrite16(par->pd->ldickr, par->base + LDICKR);	/* pixclock */
-	iowrite16(ldmtr, par->base + LDMTR);	/* polarities */
-	iowrite16(lddfr, par->base + LDDFR);	/* color/depth */
-	iowrite16((par->rot ? 1 << 13 : 0), par->base + LDSMR);	/* rotate */
-	iowrite16(par->pd->ldpmmr, par->base + LDPMMR);	/* Power Management */
-	iowrite16(par->pd->ldpspr, par->base + LDPSPR);	/* Power Supply Ctrl */
-
-	/* display resolution */
-	iowrite16(((htcn >> 3) - 1) | (((hdcn >> 3) - 1) << 8),
-		  par->base + LDHCNR);
-	iowrite16(vdln - 1, par->base + LDVDLNR);
-	iowrite16(vtln - 1, par->base + LDVTLNR);
-	/* h/v sync signals */
-	iowrite16((vsynp - 1) | ((vsynw - 1) << 12), par->base + LDVSYNR);
-	iowrite16(((hsynp >> 3) - 1) | (((hsynw >> 3) - 1) << 12),
-		  par->base + LDHSYNR);
-	/* AC modulation sig */
-	iowrite16(par->pd->ldaclnr, par->base + LDACLNR);
-
-	stride = (par->rot) ? vtln : hdcn;
-	if (!gray)
-		stride *= (bpp + 7) >> 3;
-	else {
-		if (bpp == 1)
-			stride >>= 3;
-		else if (bpp == 2)
-			stride >>= 2;
-		else if (bpp == 4)
-			stride >>= 1;
-		/* 6 bpp == 8 bpp */
-	}
-
-	/* if rotated, stride must be power of 2 */
-	if (par->rot) {
-		unsigned long bit = 1 << 31;
-		while (bit) {
-			if (stride & bit)
-				break;
-			bit >>= 1;
-		}
-		if (stride & ~bit)
-			stride = bit << 1;	/* not P-o-2, round up */
-	}
-	iowrite16(stride, par->base + LDLAOR);
-
-	/* set display mem start address */
-	sbase = (unsigned long)par->fbdma;
-	if (par->rot)
-		sbase += (hdcn - 1) * stride;
-
-	iowrite32(sbase, par->base + LDSARU);
-
-	/*
-	 * for DSTN need to set address for lower half.
-	 * I (mlau) don't know which address to set it to,
-	 * so I guessed at (stride * yres/2).
-	 */
-	if (((ldmtr & 0x003f) >= LDMTR_DSTN_MONO_8) &&
-	    ((ldmtr & 0x003f) <= LDMTR_DSTN_COLOR_16)) {
-
-		dev_dbg(info->dev, " ***** DSTN untested! *****\n");
-
-		dstn_off = stride;
-		if (par->rot)
-			dstn_off *= hdcn >> 1;
-		else
-			dstn_off *= vdln >> 1;
-
-		ldsarl = sbase + dstn_off;
-	} else
-		ldsarl = 0;
-
-	iowrite32(ldsarl, par->base + LDSARL);	/* mem for lower half of DSTN */
-
-	info->fix.line_length = stride;
-
-	sh7760fb_check_var(&info->var, info);
-
-	sh7760fb_blank(FB_BLANK_UNBLANK, info);	/* panel on! */
-
-	dev_dbg(info->dev, "hdcn  : %6d htcn  : %6d\n", hdcn, htcn);
-	dev_dbg(info->dev, "hsynw : %6d hsynp : %6d\n", hsynw, hsynp);
-	dev_dbg(info->dev, "vdln  : %6d vtln  : %6d\n", vdln, vtln);
-	dev_dbg(info->dev, "vsynw : %6d vsynp : %6d\n", vsynw, vsynp);
-	dev_dbg(info->dev, "clksrc: %6d clkdiv: %6d\n",
-		(par->pd->ldickr >> 12) & 3, par->pd->ldickr & 0x1f);
-	dev_dbg(info->dev, "ldpmmr: 0x%04x ldpspr: 0x%04x\n", par->pd->ldpmmr,
-		par->pd->ldpspr);
-	dev_dbg(info->dev, "ldmtr : 0x%04x lddfr : 0x%04x\n", ldmtr, lddfr);
-	dev_dbg(info->dev, "ldlaor: %ld\n", stride);
-	dev_dbg(info->dev, "ldsaru: 0x%08lx ldsarl: 0x%08lx\n", sbase, ldsarl);
-
-	return 0;
-}
-
-static const struct fb_ops sh7760fb_ops = {
-	.owner = THIS_MODULE,
-	.fb_blank = sh7760fb_blank,
-	.fb_check_var = sh7760fb_check_var,
-	.fb_setcolreg = sh7760_setcolreg,
-	.fb_set_par = sh7760fb_set_par,
-	.fb_fillrect = cfb_fillrect,
-	.fb_copyarea = cfb_copyarea,
-	.fb_imageblit = cfb_imageblit,
-};
-
-static void sh7760fb_free_mem(struct fb_info *info)
-{
-	struct sh7760fb_par *par = info->par;
-
-	if (!info->screen_base)
-		return;
-
-	dma_free_coherent(info->dev, info->screen_size,
-			  info->screen_base, par->fbdma);
-
-	par->fbdma = 0;
-	info->screen_base = NULL;
-	info->screen_size = 0;
-}
-
-/* allocate the framebuffer memory. This memory must be in Area3,
- * (dictated by the DMA engine) and contiguous, at a 512 byte boundary.
- */
-static int sh7760fb_alloc_mem(struct fb_info *info)
-{
-	struct sh7760fb_par *par = info->par;
-	void *fbmem;
-	unsigned long vram;
-	int ret, bpp;
-
-	if (info->screen_base)
-		return 0;
-
-	/* get color info from register value */
-	ret = sh7760fb_get_color_info(info->dev, par->pd->lddfr, &bpp, NULL);
-	if (ret) {
-		printk(KERN_ERR "colinfo\n");
-		return ret;
-	}
-
-	/* min VRAM: xres_min = 16, yres_min = 1, bpp = 1: 2byte -> 1 page
-	   max VRAM: xres_max = 1024, yres_max = 1024, bpp = 16: 2MB */
-
-	vram = info->var.xres * info->var.yres;
-	if (info->var.grayscale) {
-		if (bpp == 1)
-			vram >>= 3;
-		else if (bpp == 2)
-			vram >>= 2;
-		else if (bpp == 4)
-			vram >>= 1;
-	} else if (bpp > 8)
-		vram *= 2;
-	if ((vram < 1) || (vram > 1024 * 2048)) {
-		dev_dbg(info->dev, "too much VRAM required. Check settings\n");
-		return -ENODEV;
-	}
-
-	if (vram < PAGE_SIZE)
-		vram = PAGE_SIZE;
-
-	fbmem = dma_alloc_coherent(info->dev, vram, &par->fbdma, GFP_KERNEL);
-
-	if (!fbmem)
-		return -ENOMEM;
-
-	if ((par->fbdma & SH7760FB_DMA_MASK) != SH7760FB_DMA_MASK) {
-		sh7760fb_free_mem(info);
-		dev_err(info->dev, "kernel gave me memory at 0x%08lx, which is"
-			"unusable for the LCDC\n", (unsigned long)par->fbdma);
-		return -ENOMEM;
-	}
-
-	info->screen_base = fbmem;
-	info->screen_size = vram;
-	info->fix.smem_start = (unsigned long)info->screen_base;
-	info->fix.smem_len = info->screen_size;
-
-	return 0;
-}
-
-static int sh7760fb_probe(struct platform_device *pdev)
-{
-	struct fb_info *info;
-	struct resource *res;
-	struct sh7760fb_par *par;
-	int ret;
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (unlikely(res == NULL)) {
-		dev_err(&pdev->dev, "invalid resource\n");
-		return -EINVAL;
-	}
-
-	info = framebuffer_alloc(sizeof(struct sh7760fb_par), &pdev->dev);
-	if (!info)
-		return -ENOMEM;
-
-	par = info->par;
-	par->dev = pdev;
-
-	par->pd = pdev->dev.platform_data;
-	if (!par->pd) {
-		dev_dbg(info->dev, "no display setup data!\n");
-		ret = -ENODEV;
-		goto out_fb;
-	}
-
-	par->ioarea = request_mem_region(res->start,
-					 resource_size(res), pdev->name);
-	if (!par->ioarea) {
-		dev_err(&pdev->dev, "mmio area busy\n");
-		ret = -EBUSY;
-		goto out_fb;
-	}
-
-	par->base = ioremap(res->start, resource_size(res));
-	if (!par->base) {
-		dev_err(&pdev->dev, "cannot remap\n");
-		ret = -ENODEV;
-		goto out_res;
-	}
-
-	iowrite16(0, par->base + LDINTR);	/* disable vsync irq */
-	par->irq = platform_get_irq(pdev, 0);
-	if (par->irq >= 0) {
-		ret = request_irq(par->irq, sh7760fb_irq, 0,
-				  "sh7760-lcdc", &par->vsync);
-		if (ret) {
-			dev_err(&pdev->dev, "cannot grab IRQ\n");
-			par->irq = -ENXIO;
-		} else
-			disable_irq_nosync(par->irq);
-	}
-
-	fb_videomode_to_var(&info->var, par->pd->def_mode);
-
-	ret = sh7760fb_alloc_mem(info);
-	if (ret) {
-		dev_dbg(info->dev, "framebuffer memory allocation failed!\n");
-		goto out_unmap;
-	}
-
-	info->pseudo_palette = par->pseudo_palette;
-
-	/* fixup color register bitpositions. These are fixed by hardware */
-	info->var.red.offset = 11;
-	info->var.red.length = 5;
-	info->var.red.msb_right = 0;
-
-	info->var.green.offset = 5;
-	info->var.green.length = 6;
-	info->var.green.msb_right = 0;
-
-	info->var.blue.offset = 0;
-	info->var.blue.length = 5;
-	info->var.blue.msb_right = 0;
-
-	info->var.transp.offset = 0;
-	info->var.transp.length = 0;
-	info->var.transp.msb_right = 0;
-
-	strcpy(info->fix.id, "sh7760-lcdc");
-
-	/* set the DON2 bit now, before cmap allocation, as it will randomize
-	 * palette memory.
-	 */
-	iowrite16(LDCNTR_DON2, par->base + LDCNTR);
-	info->fbops = &sh7760fb_ops;
-
-	ret = fb_alloc_cmap(&info->cmap, 256, 0);
-	if (ret) {
-		dev_dbg(info->dev, "Unable to allocate cmap memory\n");
-		goto out_mem;
-	}
-
-	ret = register_framebuffer(info);
-	if (ret < 0) {
-		dev_dbg(info->dev, "cannot register fb!\n");
-		goto out_cmap;
-	}
-	platform_set_drvdata(pdev, info);
-
-	printk(KERN_INFO "%s: memory at phys 0x%08lx-0x%08lx, size %ld KiB\n",
-	       pdev->name,
-	       (unsigned long)par->fbdma,
-	       (unsigned long)(par->fbdma + info->screen_size - 1),
-	       info->screen_size >> 10);
-
-	return 0;
-
-out_cmap:
-	sh7760fb_blank(FB_BLANK_POWERDOWN, info);
-	fb_dealloc_cmap(&info->cmap);
-out_mem:
-	sh7760fb_free_mem(info);
-out_unmap:
-	if (par->irq >= 0)
-		free_irq(par->irq, &par->vsync);
-	iounmap(par->base);
-out_res:
-	release_mem_region(res->start, resource_size(res));
-out_fb:
-	framebuffer_release(info);
-	return ret;
-}
-
-static int sh7760fb_remove(struct platform_device *dev)
-{
-	struct fb_info *info = platform_get_drvdata(dev);
-	struct sh7760fb_par *par = info->par;
-
-	sh7760fb_blank(FB_BLANK_POWERDOWN, info);
-	unregister_framebuffer(info);
-	fb_dealloc_cmap(&info->cmap);
-	sh7760fb_free_mem(info);
-	if (par->irq >= 0)
-		free_irq(par->irq, &par->vsync);
-	iounmap(par->base);
-	release_mem_region(par->ioarea->start, resource_size(par->ioarea));
-	framebuffer_release(info);
-
-	return 0;
-}
-
-static struct platform_driver sh7760_lcdc_driver = {
-	.driver = {
-		   .name = "sh7760-lcdc",
-		   },
-	.probe = sh7760fb_probe,
-	.remove = sh7760fb_remove,
-};
-
-module_platform_driver(sh7760_lcdc_driver);
-
-MODULE_AUTHOR("Nobuhiro Iwamatsu, Manuel Lauss");
-MODULE_DESCRIPTION("FBdev for SH7760/63 integrated LCD Controller");
-MODULE_LICENSE("GPL v2");
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 20/22] media: remove sh_vou
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
                   ` (15 preceding siblings ...)
  2023-01-13  6:23 ` [PATCH 19/22] fbdev: remove sh7760fb Christoph Hellwig
@ 2023-01-13  6:23 ` Christoph Hellwig
  2023-01-13  8:01   ` Laurent Pinchart
  2023-01-13  6:23 ` [PATCH 21/22] drivers: platform: remove is_sh_early_platform_device Christoph Hellwig
                   ` (4 subsequent siblings)
  21 siblings, 1 reply; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Now that arch/sh is removed this driver is dead code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/media/platform/renesas/Kconfig  |    9 -
 drivers/media/platform/renesas/Makefile |    1 -
 drivers/media/platform/renesas/sh_vou.c | 1375 -----------------------
 3 files changed, 1385 deletions(-)
 delete mode 100644 drivers/media/platform/renesas/sh_vou.c

diff --git a/drivers/media/platform/renesas/Kconfig b/drivers/media/platform/renesas/Kconfig
index 0231672a7e1c32..935b24b864380e 100644
--- a/drivers/media/platform/renesas/Kconfig
+++ b/drivers/media/platform/renesas/Kconfig
@@ -31,15 +31,6 @@ config VIDEO_RCAR_ISP
 	  To compile this driver as a module, choose M here: the
 	  module will be called rcar-isp.
 
-config VIDEO_SH_VOU
-	tristate "SuperH VOU video output driver"
-	depends on V4L_PLATFORM_DRIVERS
-	depends on VIDEO_DEV && I2C
-	depends on ARCH_SHMOBILE || COMPILE_TEST
-	select VIDEOBUF2_DMA_CONTIG
-	help
-	  Support for the Video Output Unit (VOU) on SuperH SoCs.
-
 source "drivers/media/platform/renesas/rcar-vin/Kconfig"
 source "drivers/media/platform/renesas/rzg2l-cru/Kconfig"
 
diff --git a/drivers/media/platform/renesas/Makefile b/drivers/media/platform/renesas/Makefile
index 55854e8688870f..1ae7d825073df3 100644
--- a/drivers/media/platform/renesas/Makefile
+++ b/drivers/media/platform/renesas/Makefile
@@ -13,4 +13,3 @@ obj-$(CONFIG_VIDEO_RENESAS_CEU) += renesas-ceu.o
 obj-$(CONFIG_VIDEO_RENESAS_FCP) += rcar-fcp.o
 obj-$(CONFIG_VIDEO_RENESAS_FDP1) += rcar_fdp1.o
 obj-$(CONFIG_VIDEO_RENESAS_JPU) += rcar_jpu.o
-obj-$(CONFIG_VIDEO_SH_VOU) += sh_vou.o
diff --git a/drivers/media/platform/renesas/sh_vou.c b/drivers/media/platform/renesas/sh_vou.c
deleted file mode 100644
index ca4310e26c49ee..00000000000000
--- a/drivers/media/platform/renesas/sh_vou.c
+++ /dev/null
@@ -1,1375 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * SuperH Video Output Unit (VOU) driver
- *
- * Copyright (C) 2010, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
- */
-
-#include <linux/dma-mapping.h>
-#include <linux/delay.h>
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/i2c.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <linux/pm_runtime.h>
-#include <linux/slab.h>
-#include <linux/videodev2.h>
-#include <linux/module.h>
-
-#include <media/drv-intf/sh_vou.h>
-#include <media/v4l2-common.h>
-#include <media/v4l2-device.h>
-#include <media/v4l2-ioctl.h>
-#include <media/v4l2-mediabus.h>
-#include <media/videobuf2-v4l2.h>
-#include <media/videobuf2-dma-contig.h>
-
-/* Mirror addresses are not available for all registers */
-#define VOUER	0
-#define VOUCR	4
-#define VOUSTR	8
-#define VOUVCR	0xc
-#define VOUISR	0x10
-#define VOUBCR	0x14
-#define VOUDPR	0x18
-#define VOUDSR	0x1c
-#define VOUVPR	0x20
-#define VOUIR	0x24
-#define VOUSRR	0x28
-#define VOUMSR	0x2c
-#define VOUHIR	0x30
-#define VOUDFR	0x34
-#define VOUAD1R	0x38
-#define VOUAD2R	0x3c
-#define VOUAIR	0x40
-#define VOUSWR	0x44
-#define VOURCR	0x48
-#define VOURPR	0x50
-
-enum sh_vou_status {
-	SH_VOU_IDLE,
-	SH_VOU_INITIALISING,
-	SH_VOU_RUNNING,
-};
-
-#define VOU_MIN_IMAGE_WIDTH	16
-#define VOU_MAX_IMAGE_WIDTH	720
-#define VOU_MIN_IMAGE_HEIGHT	16
-
-struct sh_vou_buffer {
-	struct vb2_v4l2_buffer vb;
-	struct list_head list;
-};
-
-static inline struct
-sh_vou_buffer *to_sh_vou_buffer(struct vb2_v4l2_buffer *vb2)
-{
-	return container_of(vb2, struct sh_vou_buffer, vb);
-}
-
-struct sh_vou_device {
-	struct v4l2_device v4l2_dev;
-	struct video_device vdev;
-	struct sh_vou_pdata *pdata;
-	spinlock_t lock;
-	void __iomem *base;
-	/* State information */
-	struct v4l2_pix_format pix;
-	struct v4l2_rect rect;
-	struct list_head buf_list;
-	v4l2_std_id std;
-	int pix_idx;
-	struct vb2_queue queue;
-	struct sh_vou_buffer *active;
-	enum sh_vou_status status;
-	unsigned sequence;
-	struct mutex fop_lock;
-};
-
-/* Register access routines for sides A, B and mirror addresses */
-static void sh_vou_reg_a_write(struct sh_vou_device *vou_dev, unsigned int reg,
-			       u32 value)
-{
-	__raw_writel(value, vou_dev->base + reg);
-}
-
-static void sh_vou_reg_ab_write(struct sh_vou_device *vou_dev, unsigned int reg,
-				u32 value)
-{
-	__raw_writel(value, vou_dev->base + reg);
-	__raw_writel(value, vou_dev->base + reg + 0x1000);
-}
-
-static void sh_vou_reg_m_write(struct sh_vou_device *vou_dev, unsigned int reg,
-			       u32 value)
-{
-	__raw_writel(value, vou_dev->base + reg + 0x2000);
-}
-
-static u32 sh_vou_reg_a_read(struct sh_vou_device *vou_dev, unsigned int reg)
-{
-	return __raw_readl(vou_dev->base + reg);
-}
-
-static void sh_vou_reg_a_set(struct sh_vou_device *vou_dev, unsigned int reg,
-			     u32 value, u32 mask)
-{
-	u32 old = __raw_readl(vou_dev->base + reg);
-
-	value = (value & mask) | (old & ~mask);
-	__raw_writel(value, vou_dev->base + reg);
-}
-
-static void sh_vou_reg_b_set(struct sh_vou_device *vou_dev, unsigned int reg,
-			     u32 value, u32 mask)
-{
-	sh_vou_reg_a_set(vou_dev, reg + 0x1000, value, mask);
-}
-
-static void sh_vou_reg_ab_set(struct sh_vou_device *vou_dev, unsigned int reg,
-			      u32 value, u32 mask)
-{
-	sh_vou_reg_a_set(vou_dev, reg, value, mask);
-	sh_vou_reg_b_set(vou_dev, reg, value, mask);
-}
-
-struct sh_vou_fmt {
-	u32		pfmt;
-	unsigned char	bpp;
-	unsigned char	bpl;
-	unsigned char	rgb;
-	unsigned char	yf;
-	unsigned char	pkf;
-};
-
-/* Further pixel formats can be added */
-static struct sh_vou_fmt vou_fmt[] = {
-	{
-		.pfmt	= V4L2_PIX_FMT_NV12,
-		.bpp	= 12,
-		.bpl	= 1,
-		.yf	= 0,
-		.rgb	= 0,
-	},
-	{
-		.pfmt	= V4L2_PIX_FMT_NV16,
-		.bpp	= 16,
-		.bpl	= 1,
-		.yf	= 1,
-		.rgb	= 0,
-	},
-	{
-		.pfmt	= V4L2_PIX_FMT_RGB24,
-		.bpp	= 24,
-		.bpl	= 3,
-		.pkf	= 2,
-		.rgb	= 1,
-	},
-	{
-		.pfmt	= V4L2_PIX_FMT_RGB565,
-		.bpp	= 16,
-		.bpl	= 2,
-		.pkf	= 3,
-		.rgb	= 1,
-	},
-	{
-		.pfmt	= V4L2_PIX_FMT_RGB565X,
-		.bpp	= 16,
-		.bpl	= 2,
-		.pkf	= 3,
-		.rgb	= 1,
-	},
-};
-
-static void sh_vou_schedule_next(struct sh_vou_device *vou_dev,
-				 struct vb2_v4l2_buffer *vbuf)
-{
-	dma_addr_t addr1, addr2;
-
-	addr1 = vb2_dma_contig_plane_dma_addr(&vbuf->vb2_buf, 0);
-	switch (vou_dev->pix.pixelformat) {
-	case V4L2_PIX_FMT_NV12:
-	case V4L2_PIX_FMT_NV16:
-		addr2 = addr1 + vou_dev->pix.width * vou_dev->pix.height;
-		break;
-	default:
-		addr2 = 0;
-	}
-
-	sh_vou_reg_m_write(vou_dev, VOUAD1R, addr1);
-	sh_vou_reg_m_write(vou_dev, VOUAD2R, addr2);
-}
-
-static void sh_vou_stream_config(struct sh_vou_device *vou_dev)
-{
-	unsigned int row_coeff;
-#ifdef __LITTLE_ENDIAN
-	u32 dataswap = 7;
-#else
-	u32 dataswap = 0;
-#endif
-
-	switch (vou_dev->pix.pixelformat) {
-	default:
-	case V4L2_PIX_FMT_NV12:
-	case V4L2_PIX_FMT_NV16:
-		row_coeff = 1;
-		break;
-	case V4L2_PIX_FMT_RGB565:
-		dataswap ^= 1;
-		fallthrough;
-	case V4L2_PIX_FMT_RGB565X:
-		row_coeff = 2;
-		break;
-	case V4L2_PIX_FMT_RGB24:
-		row_coeff = 3;
-		break;
-	}
-
-	sh_vou_reg_a_write(vou_dev, VOUSWR, dataswap);
-	sh_vou_reg_ab_write(vou_dev, VOUAIR, vou_dev->pix.width * row_coeff);
-}
-
-/* Locking: caller holds fop_lock mutex */
-static int sh_vou_queue_setup(struct vb2_queue *vq,
-		       unsigned int *nbuffers, unsigned int *nplanes,
-		       unsigned int sizes[], struct device *alloc_devs[])
-{
-	struct sh_vou_device *vou_dev = vb2_get_drv_priv(vq);
-	struct v4l2_pix_format *pix = &vou_dev->pix;
-	int bytes_per_line = vou_fmt[vou_dev->pix_idx].bpp * pix->width / 8;
-
-	dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
-
-	if (*nplanes)
-		return sizes[0] < pix->height * bytes_per_line ? -EINVAL : 0;
-	*nplanes = 1;
-	sizes[0] = pix->height * bytes_per_line;
-	return 0;
-}
-
-static int sh_vou_buf_prepare(struct vb2_buffer *vb)
-{
-	struct sh_vou_device *vou_dev = vb2_get_drv_priv(vb->vb2_queue);
-	struct v4l2_pix_format *pix = &vou_dev->pix;
-	unsigned bytes_per_line = vou_fmt[vou_dev->pix_idx].bpp * pix->width / 8;
-	unsigned size = pix->height * bytes_per_line;
-
-	dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
-
-	if (vb2_plane_size(vb, 0) < size) {
-		/* User buffer too small */
-		dev_warn(vou_dev->v4l2_dev.dev, "buffer too small (%lu < %u)\n",
-			 vb2_plane_size(vb, 0), size);
-		return -EINVAL;
-	}
-
-	vb2_set_plane_payload(vb, 0, size);
-	return 0;
-}
-
-/* Locking: caller holds fop_lock mutex and vq->irqlock spinlock */
-static void sh_vou_buf_queue(struct vb2_buffer *vb)
-{
-	struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
-	struct sh_vou_device *vou_dev = vb2_get_drv_priv(vb->vb2_queue);
-	struct sh_vou_buffer *shbuf = to_sh_vou_buffer(vbuf);
-	unsigned long flags;
-
-	spin_lock_irqsave(&vou_dev->lock, flags);
-	list_add_tail(&shbuf->list, &vou_dev->buf_list);
-	spin_unlock_irqrestore(&vou_dev->lock, flags);
-}
-
-static int sh_vou_start_streaming(struct vb2_queue *vq, unsigned int count)
-{
-	struct sh_vou_device *vou_dev = vb2_get_drv_priv(vq);
-	struct sh_vou_buffer *buf, *node;
-	int ret;
-
-	vou_dev->sequence = 0;
-	ret = v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0,
-					 video, s_stream, 1);
-	if (ret < 0 && ret != -ENOIOCTLCMD) {
-		list_for_each_entry_safe(buf, node, &vou_dev->buf_list, list) {
-			vb2_buffer_done(&buf->vb.vb2_buf,
-					VB2_BUF_STATE_QUEUED);
-			list_del(&buf->list);
-		}
-		vou_dev->active = NULL;
-		return ret;
-	}
-
-	buf = list_entry(vou_dev->buf_list.next, struct sh_vou_buffer, list);
-
-	vou_dev->active = buf;
-
-	/* Start from side A: we use mirror addresses, so, set B */
-	sh_vou_reg_a_write(vou_dev, VOURPR, 1);
-	dev_dbg(vou_dev->v4l2_dev.dev, "%s: first buffer status 0x%x\n",
-		__func__, sh_vou_reg_a_read(vou_dev, VOUSTR));
-	sh_vou_schedule_next(vou_dev, &buf->vb);
-
-	buf = list_entry(buf->list.next, struct sh_vou_buffer, list);
-
-	/* Second buffer - initialise register side B */
-	sh_vou_reg_a_write(vou_dev, VOURPR, 0);
-	sh_vou_schedule_next(vou_dev, &buf->vb);
-
-	/* Register side switching with frame VSYNC */
-	sh_vou_reg_a_write(vou_dev, VOURCR, 5);
-
-	sh_vou_stream_config(vou_dev);
-	/* Enable End-of-Frame (VSYNC) interrupts */
-	sh_vou_reg_a_write(vou_dev, VOUIR, 0x10004);
-
-	/* Two buffers on the queue - activate the hardware */
-	vou_dev->status = SH_VOU_RUNNING;
-	sh_vou_reg_a_write(vou_dev, VOUER, 0x107);
-	return 0;
-}
-
-static void sh_vou_stop_streaming(struct vb2_queue *vq)
-{
-	struct sh_vou_device *vou_dev = vb2_get_drv_priv(vq);
-	struct sh_vou_buffer *buf, *node;
-	unsigned long flags;
-
-	v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0,
-					 video, s_stream, 0);
-	/* disable output */
-	sh_vou_reg_a_set(vou_dev, VOUER, 0, 1);
-	/* ...but the current frame will complete */
-	sh_vou_reg_a_set(vou_dev, VOUIR, 0, 0x30000);
-	msleep(50);
-	spin_lock_irqsave(&vou_dev->lock, flags);
-	list_for_each_entry_safe(buf, node, &vou_dev->buf_list, list) {
-		vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
-		list_del(&buf->list);
-	}
-	vou_dev->active = NULL;
-	spin_unlock_irqrestore(&vou_dev->lock, flags);
-}
-
-static const struct vb2_ops sh_vou_qops = {
-	.queue_setup		= sh_vou_queue_setup,
-	.buf_prepare		= sh_vou_buf_prepare,
-	.buf_queue		= sh_vou_buf_queue,
-	.start_streaming	= sh_vou_start_streaming,
-	.stop_streaming		= sh_vou_stop_streaming,
-	.wait_prepare		= vb2_ops_wait_prepare,
-	.wait_finish		= vb2_ops_wait_finish,
-};
-
-/* Video IOCTLs */
-static int sh_vou_querycap(struct file *file, void  *priv,
-			   struct v4l2_capability *cap)
-{
-	struct sh_vou_device *vou_dev = video_drvdata(file);
-
-	dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
-
-	strscpy(cap->card, "SuperH VOU", sizeof(cap->card));
-	strscpy(cap->driver, "sh-vou", sizeof(cap->driver));
-	strscpy(cap->bus_info, "platform:sh-vou", sizeof(cap->bus_info));
-	return 0;
-}
-
-/* Enumerate formats, that the device can accept from the user */
-static int sh_vou_enum_fmt_vid_out(struct file *file, void  *priv,
-				   struct v4l2_fmtdesc *fmt)
-{
-	struct sh_vou_device *vou_dev = video_drvdata(file);
-
-	if (fmt->index >= ARRAY_SIZE(vou_fmt))
-		return -EINVAL;
-
-	dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
-
-	fmt->pixelformat = vou_fmt[fmt->index].pfmt;
-
-	return 0;
-}
-
-static int sh_vou_g_fmt_vid_out(struct file *file, void *priv,
-				struct v4l2_format *fmt)
-{
-	struct sh_vou_device *vou_dev = video_drvdata(file);
-
-	dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
-
-	fmt->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-	fmt->fmt.pix = vou_dev->pix;
-
-	return 0;
-}
-
-static const unsigned char vou_scale_h_num[] = {1, 9, 2, 9, 4};
-static const unsigned char vou_scale_h_den[] = {1, 8, 1, 4, 1};
-static const unsigned char vou_scale_h_fld[] = {0, 2, 1, 3};
-static const unsigned char vou_scale_v_num[] = {1, 2, 4};
-static const unsigned char vou_scale_v_den[] = {1, 1, 1};
-static const unsigned char vou_scale_v_fld[] = {0, 1};
-
-static void sh_vou_configure_geometry(struct sh_vou_device *vou_dev,
-				      int pix_idx, int w_idx, int h_idx)
-{
-	struct sh_vou_fmt *fmt = vou_fmt + pix_idx;
-	unsigned int black_left, black_top, width_max,
-		frame_in_height, frame_out_height, frame_out_top;
-	struct v4l2_rect *rect = &vou_dev->rect;
-	struct v4l2_pix_format *pix = &vou_dev->pix;
-	u32 vouvcr = 0, dsr_h, dsr_v;
-
-	if (vou_dev->std & V4L2_STD_525_60) {
-		width_max = 858;
-		/* height_max = 262; */
-	} else {
-		width_max = 864;
-		/* height_max = 312; */
-	}
-
-	frame_in_height = pix->height / 2;
-	frame_out_height = rect->height / 2;
-	frame_out_top = rect->top / 2;
-
-	/*
-	 * Cropping scheme: max useful image is 720x480, and the total video
-	 * area is 858x525 (NTSC) or 864x625 (PAL). AK8813 / 8814 starts
-	 * sampling data beginning with fixed 276th (NTSC) / 288th (PAL) clock,
-	 * of which the first 33 / 25 clocks HSYNC must be held active. This
-	 * has to be configured in CR[HW]. 1 pixel equals 2 clock periods.
-	 * This gives CR[HW] = 16 / 12, VPR[HVP] = 138 / 144, which gives
-	 * exactly 858 - 138 = 864 - 144 = 720! We call the out-of-display area,
-	 * beyond DSR, specified on the left and top by the VPR register "black
-	 * pixels" and out-of-image area (DPR) "background pixels." We fix VPR
-	 * at 138 / 144 : 20, because that's the HSYNC timing, that our first
-	 * client requires, and that's exactly what leaves us 720 pixels for the
-	 * image; we leave VPR[VVP] at default 20 for now, because the client
-	 * doesn't seem to have any special requirements for it. Otherwise we
-	 * could also set it to max - 240 = 22 / 72. Thus VPR depends only on
-	 * the selected standard, and DPR and DSR are selected according to
-	 * cropping. Q: how does the client detect the first valid line? Does
-	 * HSYNC stay inactive during invalid (black) lines?
-	 */
-	black_left = width_max - VOU_MAX_IMAGE_WIDTH;
-	black_top = 20;
-
-	dsr_h = rect->width + rect->left;
-	dsr_v = frame_out_height + frame_out_top;
-
-	dev_dbg(vou_dev->v4l2_dev.dev,
-		"image %ux%u, black %u:%u, offset %u:%u, display %ux%u\n",
-		pix->width, frame_in_height, black_left, black_top,
-		rect->left, frame_out_top, dsr_h, dsr_v);
-
-	/* VOUISR height - half of a frame height in frame mode */
-	sh_vou_reg_ab_write(vou_dev, VOUISR, (pix->width << 16) | frame_in_height);
-	sh_vou_reg_ab_write(vou_dev, VOUVPR, (black_left << 16) | black_top);
-	sh_vou_reg_ab_write(vou_dev, VOUDPR, (rect->left << 16) | frame_out_top);
-	sh_vou_reg_ab_write(vou_dev, VOUDSR, (dsr_h << 16) | dsr_v);
-
-	/*
-	 * if necessary, we could set VOUHIR to
-	 * max(black_left + dsr_h, width_max) here
-	 */
-
-	if (w_idx)
-		vouvcr |= (1 << 15) | (vou_scale_h_fld[w_idx - 1] << 4);
-	if (h_idx)
-		vouvcr |= (1 << 14) | vou_scale_v_fld[h_idx - 1];
-
-	dev_dbg(vou_dev->v4l2_dev.dev, "0x%08x: scaling 0x%x\n",
-		fmt->pfmt, vouvcr);
-
-	/* To produce a colour bar for testing set bit 23 of VOUVCR */
-	sh_vou_reg_ab_write(vou_dev, VOUVCR, vouvcr);
-	sh_vou_reg_ab_write(vou_dev, VOUDFR,
-			    fmt->pkf | (fmt->yf << 8) | (fmt->rgb << 16));
-}
-
-struct sh_vou_geometry {
-	struct v4l2_rect output;
-	unsigned int in_width;
-	unsigned int in_height;
-	int scale_idx_h;
-	int scale_idx_v;
-};
-
-/*
- * Find input geometry, that we can use to produce output, closest to the
- * requested rectangle, using VOU scaling
- */
-static void vou_adjust_input(struct sh_vou_geometry *geo, v4l2_std_id std)
-{
-	/* The compiler cannot know, that best and idx will indeed be set */
-	unsigned int best_err = UINT_MAX, best = 0, img_height_max;
-	int i, idx = 0;
-
-	if (std & V4L2_STD_525_60)
-		img_height_max = 480;
-	else
-		img_height_max = 576;
-
-	/* Image width must be a multiple of 4 */
-	v4l_bound_align_image(&geo->in_width,
-			      VOU_MIN_IMAGE_WIDTH, VOU_MAX_IMAGE_WIDTH, 2,
-			      &geo->in_height,
-			      VOU_MIN_IMAGE_HEIGHT, img_height_max, 1, 0);
-
-	/* Select scales to come as close as possible to the output image */
-	for (i = ARRAY_SIZE(vou_scale_h_num) - 1; i >= 0; i--) {
-		unsigned int err;
-		unsigned int found = geo->output.width * vou_scale_h_den[i] /
-			vou_scale_h_num[i];
-
-		if (found > VOU_MAX_IMAGE_WIDTH)
-			/* scales increase */
-			break;
-
-		err = abs(found - geo->in_width);
-		if (err < best_err) {
-			best_err = err;
-			idx = i;
-			best = found;
-		}
-		if (!err)
-			break;
-	}
-
-	geo->in_width = best;
-	geo->scale_idx_h = idx;
-
-	best_err = UINT_MAX;
-
-	/* This loop can be replaced with one division */
-	for (i = ARRAY_SIZE(vou_scale_v_num) - 1; i >= 0; i--) {
-		unsigned int err;
-		unsigned int found = geo->output.height * vou_scale_v_den[i] /
-			vou_scale_v_num[i];
-
-		if (found > img_height_max)
-			/* scales increase */
-			break;
-
-		err = abs(found - geo->in_height);
-		if (err < best_err) {
-			best_err = err;
-			idx = i;
-			best = found;
-		}
-		if (!err)
-			break;
-	}
-
-	geo->in_height = best;
-	geo->scale_idx_v = idx;
-}
-
-/*
- * Find output geometry, that we can produce, using VOU scaling, closest to
- * the requested rectangle
- */
-static void vou_adjust_output(struct sh_vou_geometry *geo, v4l2_std_id std)
-{
-	unsigned int best_err = UINT_MAX, best = geo->in_width,
-		width_max, height_max, img_height_max;
-	int i, idx_h = 0, idx_v = 0;
-
-	if (std & V4L2_STD_525_60) {
-		width_max = 858;
-		height_max = 262 * 2;
-		img_height_max = 480;
-	} else {
-		width_max = 864;
-		height_max = 312 * 2;
-		img_height_max = 576;
-	}
-
-	/* Select scales to come as close as possible to the output image */
-	for (i = 0; i < ARRAY_SIZE(vou_scale_h_num); i++) {
-		unsigned int err;
-		unsigned int found = geo->in_width * vou_scale_h_num[i] /
-			vou_scale_h_den[i];
-
-		if (found > VOU_MAX_IMAGE_WIDTH)
-			/* scales increase */
-			break;
-
-		err = abs(found - geo->output.width);
-		if (err < best_err) {
-			best_err = err;
-			idx_h = i;
-			best = found;
-		}
-		if (!err)
-			break;
-	}
-
-	geo->output.width = best;
-	geo->scale_idx_h = idx_h;
-	if (geo->output.left + best > width_max)
-		geo->output.left = width_max - best;
-
-	pr_debug("%s(): W %u * %u/%u = %u\n", __func__, geo->in_width,
-		 vou_scale_h_num[idx_h], vou_scale_h_den[idx_h], best);
-
-	best_err = UINT_MAX;
-
-	/* This loop can be replaced with one division */
-	for (i = 0; i < ARRAY_SIZE(vou_scale_v_num); i++) {
-		unsigned int err;
-		unsigned int found = geo->in_height * vou_scale_v_num[i] /
-			vou_scale_v_den[i];
-
-		if (found > img_height_max)
-			/* scales increase */
-			break;
-
-		err = abs(found - geo->output.height);
-		if (err < best_err) {
-			best_err = err;
-			idx_v = i;
-			best = found;
-		}
-		if (!err)
-			break;
-	}
-
-	geo->output.height = best;
-	geo->scale_idx_v = idx_v;
-	if (geo->output.top + best > height_max)
-		geo->output.top = height_max - best;
-
-	pr_debug("%s(): H %u * %u/%u = %u\n", __func__, geo->in_height,
-		 vou_scale_v_num[idx_v], vou_scale_v_den[idx_v], best);
-}
-
-static int sh_vou_try_fmt_vid_out(struct file *file, void *priv,
-				  struct v4l2_format *fmt)
-{
-	struct sh_vou_device *vou_dev = video_drvdata(file);
-	struct v4l2_pix_format *pix = &fmt->fmt.pix;
-	unsigned int img_height_max;
-	int pix_idx;
-
-	dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
-
-	pix->field = V4L2_FIELD_INTERLACED;
-	pix->colorspace = V4L2_COLORSPACE_SMPTE170M;
-	pix->ycbcr_enc = pix->quantization = 0;
-
-	for (pix_idx = 0; pix_idx < ARRAY_SIZE(vou_fmt); pix_idx++)
-		if (vou_fmt[pix_idx].pfmt == pix->pixelformat)
-			break;
-
-	if (pix_idx == ARRAY_SIZE(vou_fmt))
-		return -EINVAL;
-
-	if (vou_dev->std & V4L2_STD_525_60)
-		img_height_max = 480;
-	else
-		img_height_max = 576;
-
-	v4l_bound_align_image(&pix->width,
-			      VOU_MIN_IMAGE_WIDTH, VOU_MAX_IMAGE_WIDTH, 2,
-			      &pix->height,
-			      VOU_MIN_IMAGE_HEIGHT, img_height_max, 1, 0);
-	pix->bytesperline = pix->width * vou_fmt[pix_idx].bpl;
-	pix->sizeimage = pix->height * ((pix->width * vou_fmt[pix_idx].bpp) >> 3);
-
-	return 0;
-}
-
-static int sh_vou_set_fmt_vid_out(struct sh_vou_device *vou_dev,
-				struct v4l2_pix_format *pix)
-{
-	unsigned int img_height_max;
-	struct sh_vou_geometry geo;
-	struct v4l2_subdev_format format = {
-		.which = V4L2_SUBDEV_FORMAT_ACTIVE,
-		/* Revisit: is this the correct code? */
-		.format.code = MEDIA_BUS_FMT_YUYV8_2X8,
-		.format.field = V4L2_FIELD_INTERLACED,
-		.format.colorspace = V4L2_COLORSPACE_SMPTE170M,
-	};
-	struct v4l2_mbus_framefmt *mbfmt = &format.format;
-	int pix_idx;
-	int ret;
-
-	if (vb2_is_busy(&vou_dev->queue))
-		return -EBUSY;
-
-	for (pix_idx = 0; pix_idx < ARRAY_SIZE(vou_fmt); pix_idx++)
-		if (vou_fmt[pix_idx].pfmt == pix->pixelformat)
-			break;
-
-	geo.in_width = pix->width;
-	geo.in_height = pix->height;
-	geo.output = vou_dev->rect;
-
-	vou_adjust_output(&geo, vou_dev->std);
-
-	mbfmt->width = geo.output.width;
-	mbfmt->height = geo.output.height;
-	ret = v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0, pad,
-					 set_fmt, NULL, &format);
-	/* Must be implemented, so, don't check for -ENOIOCTLCMD */
-	if (ret < 0)
-		return ret;
-
-	dev_dbg(vou_dev->v4l2_dev.dev, "%s(): %ux%u -> %ux%u\n", __func__,
-		geo.output.width, geo.output.height, mbfmt->width, mbfmt->height);
-
-	if (vou_dev->std & V4L2_STD_525_60)
-		img_height_max = 480;
-	else
-		img_height_max = 576;
-
-	/* Sanity checks */
-	if ((unsigned)mbfmt->width > VOU_MAX_IMAGE_WIDTH ||
-	    (unsigned)mbfmt->height > img_height_max ||
-	    mbfmt->code != MEDIA_BUS_FMT_YUYV8_2X8)
-		return -EIO;
-
-	if (mbfmt->width != geo.output.width ||
-	    mbfmt->height != geo.output.height) {
-		geo.output.width = mbfmt->width;
-		geo.output.height = mbfmt->height;
-
-		vou_adjust_input(&geo, vou_dev->std);
-	}
-
-	/* We tried to preserve output rectangle, but it could have changed */
-	vou_dev->rect = geo.output;
-	pix->width = geo.in_width;
-	pix->height = geo.in_height;
-
-	dev_dbg(vou_dev->v4l2_dev.dev, "%s(): %ux%u\n", __func__,
-		pix->width, pix->height);
-
-	vou_dev->pix_idx = pix_idx;
-
-	vou_dev->pix = *pix;
-
-	sh_vou_configure_geometry(vou_dev, pix_idx,
-				  geo.scale_idx_h, geo.scale_idx_v);
-
-	return 0;
-}
-
-static int sh_vou_s_fmt_vid_out(struct file *file, void *priv,
-				struct v4l2_format *fmt)
-{
-	struct sh_vou_device *vou_dev = video_drvdata(file);
-	int ret = sh_vou_try_fmt_vid_out(file, priv, fmt);
-
-	if (ret)
-		return ret;
-	return sh_vou_set_fmt_vid_out(vou_dev, &fmt->fmt.pix);
-}
-
-static int sh_vou_enum_output(struct file *file, void *fh,
-			      struct v4l2_output *a)
-{
-	struct sh_vou_device *vou_dev = video_drvdata(file);
-
-	if (a->index)
-		return -EINVAL;
-	strscpy(a->name, "Video Out", sizeof(a->name));
-	a->type = V4L2_OUTPUT_TYPE_ANALOG;
-	a->std = vou_dev->vdev.tvnorms;
-	return 0;
-}
-
-static int sh_vou_g_output(struct file *file, void *fh, unsigned int *i)
-{
-	*i = 0;
-	return 0;
-}
-
-static int sh_vou_s_output(struct file *file, void *fh, unsigned int i)
-{
-	return i ? -EINVAL : 0;
-}
-
-static u32 sh_vou_ntsc_mode(enum sh_vou_bus_fmt bus_fmt)
-{
-	switch (bus_fmt) {
-	default:
-		pr_warn("%s(): Invalid bus-format code %d, using default 8-bit\n",
-			__func__, bus_fmt);
-		fallthrough;
-	case SH_VOU_BUS_8BIT:
-		return 1;
-	case SH_VOU_BUS_16BIT:
-		return 0;
-	case SH_VOU_BUS_BT656:
-		return 3;
-	}
-}
-
-static int sh_vou_s_std(struct file *file, void *priv, v4l2_std_id std_id)
-{
-	struct sh_vou_device *vou_dev = video_drvdata(file);
-	int ret;
-
-	dev_dbg(vou_dev->v4l2_dev.dev, "%s(): 0x%llx\n", __func__, std_id);
-
-	if (std_id == vou_dev->std)
-		return 0;
-
-	if (vb2_is_busy(&vou_dev->queue))
-		return -EBUSY;
-
-	ret = v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0, video,
-					 s_std_output, std_id);
-	/* Shall we continue, if the subdev doesn't support .s_std_output()? */
-	if (ret < 0 && ret != -ENOIOCTLCMD)
-		return ret;
-
-	vou_dev->rect.top = vou_dev->rect.left = 0;
-	vou_dev->rect.width = VOU_MAX_IMAGE_WIDTH;
-	if (std_id & V4L2_STD_525_60) {
-		sh_vou_reg_ab_set(vou_dev, VOUCR,
-			sh_vou_ntsc_mode(vou_dev->pdata->bus_fmt) << 29, 7 << 29);
-		vou_dev->rect.height = 480;
-	} else {
-		sh_vou_reg_ab_set(vou_dev, VOUCR, 5 << 29, 7 << 29);
-		vou_dev->rect.height = 576;
-	}
-
-	vou_dev->pix.width = vou_dev->rect.width;
-	vou_dev->pix.height = vou_dev->rect.height;
-	vou_dev->pix.bytesperline =
-		vou_dev->pix.width * vou_fmt[vou_dev->pix_idx].bpl;
-	vou_dev->pix.sizeimage = vou_dev->pix.height *
-		((vou_dev->pix.width * vou_fmt[vou_dev->pix_idx].bpp) >> 3);
-	vou_dev->std = std_id;
-	sh_vou_set_fmt_vid_out(vou_dev, &vou_dev->pix);
-
-	return 0;
-}
-
-static int sh_vou_g_std(struct file *file, void *priv, v4l2_std_id *std)
-{
-	struct sh_vou_device *vou_dev = video_drvdata(file);
-
-	dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
-
-	*std = vou_dev->std;
-
-	return 0;
-}
-
-static int sh_vou_log_status(struct file *file, void *priv)
-{
-	struct sh_vou_device *vou_dev = video_drvdata(file);
-
-	pr_info("VOUER:   0x%08x\n", sh_vou_reg_a_read(vou_dev, VOUER));
-	pr_info("VOUCR:   0x%08x\n", sh_vou_reg_a_read(vou_dev, VOUCR));
-	pr_info("VOUSTR:  0x%08x\n", sh_vou_reg_a_read(vou_dev, VOUSTR));
-	pr_info("VOUVCR:  0x%08x\n", sh_vou_reg_a_read(vou_dev, VOUVCR));
-	pr_info("VOUISR:  0x%08x\n", sh_vou_reg_a_read(vou_dev, VOUISR));
-	pr_info("VOUBCR:  0x%08x\n", sh_vou_reg_a_read(vou_dev, VOUBCR));
-	pr_info("VOUDPR:  0x%08x\n", sh_vou_reg_a_read(vou_dev, VOUDPR));
-	pr_info("VOUDSR:  0x%08x\n", sh_vou_reg_a_read(vou_dev, VOUDSR));
-	pr_info("VOUVPR:  0x%08x\n", sh_vou_reg_a_read(vou_dev, VOUVPR));
-	pr_info("VOUIR:   0x%08x\n", sh_vou_reg_a_read(vou_dev, VOUIR));
-	pr_info("VOUSRR:  0x%08x\n", sh_vou_reg_a_read(vou_dev, VOUSRR));
-	pr_info("VOUMSR:  0x%08x\n", sh_vou_reg_a_read(vou_dev, VOUMSR));
-	pr_info("VOUHIR:  0x%08x\n", sh_vou_reg_a_read(vou_dev, VOUHIR));
-	pr_info("VOUDFR:  0x%08x\n", sh_vou_reg_a_read(vou_dev, VOUDFR));
-	pr_info("VOUAD1R: 0x%08x\n", sh_vou_reg_a_read(vou_dev, VOUAD1R));
-	pr_info("VOUAD2R: 0x%08x\n", sh_vou_reg_a_read(vou_dev, VOUAD2R));
-	pr_info("VOUAIR:  0x%08x\n", sh_vou_reg_a_read(vou_dev, VOUAIR));
-	pr_info("VOUSWR:  0x%08x\n", sh_vou_reg_a_read(vou_dev, VOUSWR));
-	pr_info("VOURCR:  0x%08x\n", sh_vou_reg_a_read(vou_dev, VOURCR));
-	pr_info("VOURPR:  0x%08x\n", sh_vou_reg_a_read(vou_dev, VOURPR));
-	return 0;
-}
-
-static int sh_vou_g_selection(struct file *file, void *fh,
-			      struct v4l2_selection *sel)
-{
-	struct sh_vou_device *vou_dev = video_drvdata(file);
-
-	if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
-		return -EINVAL;
-	switch (sel->target) {
-	case V4L2_SEL_TGT_COMPOSE:
-		sel->r = vou_dev->rect;
-		break;
-	case V4L2_SEL_TGT_COMPOSE_DEFAULT:
-	case V4L2_SEL_TGT_COMPOSE_BOUNDS:
-		sel->r.left = 0;
-		sel->r.top = 0;
-		sel->r.width = VOU_MAX_IMAGE_WIDTH;
-		if (vou_dev->std & V4L2_STD_525_60)
-			sel->r.height = 480;
-		else
-			sel->r.height = 576;
-		break;
-	default:
-		return -EINVAL;
-	}
-	return 0;
-}
-
-/* Assume a dull encoder, do all the work ourselves. */
-static int sh_vou_s_selection(struct file *file, void *fh,
-			      struct v4l2_selection *sel)
-{
-	struct v4l2_rect *rect = &sel->r;
-	struct sh_vou_device *vou_dev = video_drvdata(file);
-	struct v4l2_subdev_selection sd_sel = {
-		.which = V4L2_SUBDEV_FORMAT_ACTIVE,
-		.target = V4L2_SEL_TGT_COMPOSE,
-	};
-	struct v4l2_pix_format *pix = &vou_dev->pix;
-	struct sh_vou_geometry geo;
-	struct v4l2_subdev_format format = {
-		.which = V4L2_SUBDEV_FORMAT_ACTIVE,
-		/* Revisit: is this the correct code? */
-		.format.code = MEDIA_BUS_FMT_YUYV8_2X8,
-		.format.field = V4L2_FIELD_INTERLACED,
-		.format.colorspace = V4L2_COLORSPACE_SMPTE170M,
-	};
-	unsigned int img_height_max;
-	int ret;
-
-	if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT ||
-	    sel->target != V4L2_SEL_TGT_COMPOSE)
-		return -EINVAL;
-
-	if (vb2_is_busy(&vou_dev->queue))
-		return -EBUSY;
-
-	if (vou_dev->std & V4L2_STD_525_60)
-		img_height_max = 480;
-	else
-		img_height_max = 576;
-
-	v4l_bound_align_image(&rect->width,
-			      VOU_MIN_IMAGE_WIDTH, VOU_MAX_IMAGE_WIDTH, 1,
-			      &rect->height,
-			      VOU_MIN_IMAGE_HEIGHT, img_height_max, 1, 0);
-
-	if (rect->width + rect->left > VOU_MAX_IMAGE_WIDTH)
-		rect->left = VOU_MAX_IMAGE_WIDTH - rect->width;
-
-	if (rect->height + rect->top > img_height_max)
-		rect->top = img_height_max - rect->height;
-
-	geo.output = *rect;
-	geo.in_width = pix->width;
-	geo.in_height = pix->height;
-
-	/* Configure the encoder one-to-one, position at 0, ignore errors */
-	sd_sel.r.width = geo.output.width;
-	sd_sel.r.height = geo.output.height;
-	/*
-	 * We first issue a S_SELECTION, so that the subsequent S_FMT delivers the
-	 * final encoder configuration.
-	 */
-	v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0, pad,
-				   set_selection, NULL, &sd_sel);
-	format.format.width = geo.output.width;
-	format.format.height = geo.output.height;
-	ret = v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0, pad,
-					 set_fmt, NULL, &format);
-	/* Must be implemented, so, don't check for -ENOIOCTLCMD */
-	if (ret < 0)
-		return ret;
-
-	/* Sanity checks */
-	if ((unsigned)format.format.width > VOU_MAX_IMAGE_WIDTH ||
-	    (unsigned)format.format.height > img_height_max ||
-	    format.format.code != MEDIA_BUS_FMT_YUYV8_2X8)
-		return -EIO;
-
-	geo.output.width = format.format.width;
-	geo.output.height = format.format.height;
-
-	/*
-	 * No down-scaling. According to the API, current call has precedence:
-	 * https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/crop.html#cropping-structures
-	 */
-	vou_adjust_input(&geo, vou_dev->std);
-
-	/* We tried to preserve output rectangle, but it could have changed */
-	vou_dev->rect = geo.output;
-	pix->width = geo.in_width;
-	pix->height = geo.in_height;
-
-	sh_vou_configure_geometry(vou_dev, vou_dev->pix_idx,
-				  geo.scale_idx_h, geo.scale_idx_v);
-
-	return 0;
-}
-
-static irqreturn_t sh_vou_isr(int irq, void *dev_id)
-{
-	struct sh_vou_device *vou_dev = dev_id;
-	static unsigned long j;
-	struct sh_vou_buffer *vb;
-	static int cnt;
-	u32 irq_status = sh_vou_reg_a_read(vou_dev, VOUIR), masked;
-	u32 vou_status = sh_vou_reg_a_read(vou_dev, VOUSTR);
-
-	if (!(irq_status & 0x300)) {
-		if (printk_timed_ratelimit(&j, 500))
-			dev_warn(vou_dev->v4l2_dev.dev, "IRQ status 0x%x!\n",
-				 irq_status);
-		return IRQ_NONE;
-	}
-
-	spin_lock(&vou_dev->lock);
-	if (!vou_dev->active || list_empty(&vou_dev->buf_list)) {
-		if (printk_timed_ratelimit(&j, 500))
-			dev_warn(vou_dev->v4l2_dev.dev,
-				 "IRQ without active buffer: %x!\n", irq_status);
-		/* Just ack: buf_release will disable further interrupts */
-		sh_vou_reg_a_set(vou_dev, VOUIR, 0, 0x300);
-		spin_unlock(&vou_dev->lock);
-		return IRQ_HANDLED;
-	}
-
-	masked = ~(0x300 & irq_status) & irq_status & 0x30304;
-	dev_dbg(vou_dev->v4l2_dev.dev,
-		"IRQ status 0x%x -> 0x%x, VOU status 0x%x, cnt %d\n",
-		irq_status, masked, vou_status, cnt);
-
-	cnt++;
-	/* side = vou_status & 0x10000; */
-
-	/* Clear only set interrupts */
-	sh_vou_reg_a_write(vou_dev, VOUIR, masked);
-
-	vb = vou_dev->active;
-	if (list_is_singular(&vb->list)) {
-		/* Keep cycling while no next buffer is available */
-		sh_vou_schedule_next(vou_dev, &vb->vb);
-		spin_unlock(&vou_dev->lock);
-		return IRQ_HANDLED;
-	}
-
-	list_del(&vb->list);
-
-	vb->vb.vb2_buf.timestamp = ktime_get_ns();
-	vb->vb.sequence = vou_dev->sequence++;
-	vb->vb.field = V4L2_FIELD_INTERLACED;
-	vb2_buffer_done(&vb->vb.vb2_buf, VB2_BUF_STATE_DONE);
-
-	vou_dev->active = list_entry(vou_dev->buf_list.next,
-				     struct sh_vou_buffer, list);
-
-	if (list_is_singular(&vou_dev->buf_list)) {
-		/* Keep cycling while no next buffer is available */
-		sh_vou_schedule_next(vou_dev, &vou_dev->active->vb);
-	} else {
-		struct sh_vou_buffer *new = list_entry(vou_dev->active->list.next,
-						struct sh_vou_buffer, list);
-		sh_vou_schedule_next(vou_dev, &new->vb);
-	}
-
-	spin_unlock(&vou_dev->lock);
-
-	return IRQ_HANDLED;
-}
-
-static int sh_vou_hw_init(struct sh_vou_device *vou_dev)
-{
-	struct sh_vou_pdata *pdata = vou_dev->pdata;
-	u32 voucr = sh_vou_ntsc_mode(pdata->bus_fmt) << 29;
-	int i = 100;
-
-	/* Disable all IRQs */
-	sh_vou_reg_a_write(vou_dev, VOUIR, 0);
-
-	/* Reset VOU interfaces - registers unaffected */
-	sh_vou_reg_a_write(vou_dev, VOUSRR, 0x101);
-	while (--i && (sh_vou_reg_a_read(vou_dev, VOUSRR) & 0x101))
-		udelay(1);
-
-	if (!i)
-		return -ETIMEDOUT;
-
-	dev_dbg(vou_dev->v4l2_dev.dev, "Reset took %dus\n", 100 - i);
-
-	if (pdata->flags & SH_VOU_PCLK_FALLING)
-		voucr |= 1 << 28;
-	if (pdata->flags & SH_VOU_HSYNC_LOW)
-		voucr |= 1 << 27;
-	if (pdata->flags & SH_VOU_VSYNC_LOW)
-		voucr |= 1 << 26;
-	sh_vou_reg_ab_set(vou_dev, VOUCR, voucr, 0xfc000000);
-
-	/* Manual register side switching at first */
-	sh_vou_reg_a_write(vou_dev, VOURCR, 4);
-	/* Default - fixed HSYNC length, can be made configurable is required */
-	sh_vou_reg_ab_write(vou_dev, VOUMSR, 0x800000);
-
-	sh_vou_set_fmt_vid_out(vou_dev, &vou_dev->pix);
-
-	return 0;
-}
-
-/* File operations */
-static int sh_vou_open(struct file *file)
-{
-	struct sh_vou_device *vou_dev = video_drvdata(file);
-	int err;
-
-	if (mutex_lock_interruptible(&vou_dev->fop_lock))
-		return -ERESTARTSYS;
-
-	err = v4l2_fh_open(file);
-	if (err)
-		goto done_open;
-	if (v4l2_fh_is_singular_file(file) &&
-	    vou_dev->status == SH_VOU_INITIALISING) {
-		/* First open */
-		err = pm_runtime_resume_and_get(vou_dev->v4l2_dev.dev);
-		if (err < 0) {
-			v4l2_fh_release(file);
-			goto done_open;
-		}
-		err = sh_vou_hw_init(vou_dev);
-		if (err < 0) {
-			pm_runtime_put(vou_dev->v4l2_dev.dev);
-			v4l2_fh_release(file);
-		} else {
-			vou_dev->status = SH_VOU_IDLE;
-		}
-	}
-done_open:
-	mutex_unlock(&vou_dev->fop_lock);
-	return err;
-}
-
-static int sh_vou_release(struct file *file)
-{
-	struct sh_vou_device *vou_dev = video_drvdata(file);
-	bool is_last;
-
-	mutex_lock(&vou_dev->fop_lock);
-	is_last = v4l2_fh_is_singular_file(file);
-	_vb2_fop_release(file, NULL);
-	if (is_last) {
-		/* Last close */
-		vou_dev->status = SH_VOU_INITIALISING;
-		sh_vou_reg_a_set(vou_dev, VOUER, 0, 0x101);
-		pm_runtime_put(vou_dev->v4l2_dev.dev);
-	}
-	mutex_unlock(&vou_dev->fop_lock);
-	return 0;
-}
-
-/* sh_vou display ioctl operations */
-static const struct v4l2_ioctl_ops sh_vou_ioctl_ops = {
-	.vidioc_querycap		= sh_vou_querycap,
-	.vidioc_enum_fmt_vid_out	= sh_vou_enum_fmt_vid_out,
-	.vidioc_g_fmt_vid_out		= sh_vou_g_fmt_vid_out,
-	.vidioc_s_fmt_vid_out		= sh_vou_s_fmt_vid_out,
-	.vidioc_try_fmt_vid_out		= sh_vou_try_fmt_vid_out,
-	.vidioc_reqbufs			= vb2_ioctl_reqbufs,
-	.vidioc_create_bufs		= vb2_ioctl_create_bufs,
-	.vidioc_querybuf		= vb2_ioctl_querybuf,
-	.vidioc_qbuf			= vb2_ioctl_qbuf,
-	.vidioc_dqbuf			= vb2_ioctl_dqbuf,
-	.vidioc_prepare_buf		= vb2_ioctl_prepare_buf,
-	.vidioc_streamon		= vb2_ioctl_streamon,
-	.vidioc_streamoff		= vb2_ioctl_streamoff,
-	.vidioc_expbuf			= vb2_ioctl_expbuf,
-	.vidioc_g_output		= sh_vou_g_output,
-	.vidioc_s_output		= sh_vou_s_output,
-	.vidioc_enum_output		= sh_vou_enum_output,
-	.vidioc_s_std			= sh_vou_s_std,
-	.vidioc_g_std			= sh_vou_g_std,
-	.vidioc_g_selection		= sh_vou_g_selection,
-	.vidioc_s_selection		= sh_vou_s_selection,
-	.vidioc_log_status		= sh_vou_log_status,
-};
-
-static const struct v4l2_file_operations sh_vou_fops = {
-	.owner		= THIS_MODULE,
-	.open		= sh_vou_open,
-	.release	= sh_vou_release,
-	.unlocked_ioctl	= video_ioctl2,
-	.mmap		= vb2_fop_mmap,
-	.poll		= vb2_fop_poll,
-	.write		= vb2_fop_write,
-};
-
-static const struct video_device sh_vou_video_template = {
-	.name		= "sh_vou",
-	.fops		= &sh_vou_fops,
-	.ioctl_ops	= &sh_vou_ioctl_ops,
-	.tvnorms	= V4L2_STD_525_60, /* PAL only supported in 8-bit non-bt656 mode */
-	.vfl_dir	= VFL_DIR_TX,
-	.device_caps	= V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_READWRITE |
-			  V4L2_CAP_STREAMING,
-};
-
-static int sh_vou_probe(struct platform_device *pdev)
-{
-	struct sh_vou_pdata *vou_pdata = pdev->dev.platform_data;
-	struct v4l2_rect *rect;
-	struct v4l2_pix_format *pix;
-	struct i2c_adapter *i2c_adap;
-	struct video_device *vdev;
-	struct sh_vou_device *vou_dev;
-	struct resource *reg_res;
-	struct v4l2_subdev *subdev;
-	struct vb2_queue *q;
-	int irq, ret;
-
-	reg_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	irq = platform_get_irq(pdev, 0);
-
-	if (!vou_pdata || !reg_res || irq <= 0) {
-		dev_err(&pdev->dev, "Insufficient VOU platform information.\n");
-		return -ENODEV;
-	}
-
-	vou_dev = devm_kzalloc(&pdev->dev, sizeof(*vou_dev), GFP_KERNEL);
-	if (!vou_dev)
-		return -ENOMEM;
-
-	INIT_LIST_HEAD(&vou_dev->buf_list);
-	spin_lock_init(&vou_dev->lock);
-	mutex_init(&vou_dev->fop_lock);
-	vou_dev->pdata = vou_pdata;
-	vou_dev->status = SH_VOU_INITIALISING;
-	vou_dev->pix_idx = 1;
-
-	rect = &vou_dev->rect;
-	pix = &vou_dev->pix;
-
-	/* Fill in defaults */
-	vou_dev->std		= V4L2_STD_NTSC_M;
-	rect->left		= 0;
-	rect->top		= 0;
-	rect->width		= VOU_MAX_IMAGE_WIDTH;
-	rect->height		= 480;
-	pix->width		= VOU_MAX_IMAGE_WIDTH;
-	pix->height		= 480;
-	pix->pixelformat	= V4L2_PIX_FMT_NV16;
-	pix->field		= V4L2_FIELD_INTERLACED;
-	pix->bytesperline	= VOU_MAX_IMAGE_WIDTH;
-	pix->sizeimage		= VOU_MAX_IMAGE_WIDTH * 2 * 480;
-	pix->colorspace		= V4L2_COLORSPACE_SMPTE170M;
-
-	vou_dev->base = devm_ioremap_resource(&pdev->dev, reg_res);
-	if (IS_ERR(vou_dev->base))
-		return PTR_ERR(vou_dev->base);
-
-	ret = devm_request_irq(&pdev->dev, irq, sh_vou_isr, 0, "vou", vou_dev);
-	if (ret < 0)
-		return ret;
-
-	ret = v4l2_device_register(&pdev->dev, &vou_dev->v4l2_dev);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "Error registering v4l2 device\n");
-		return ret;
-	}
-
-	vdev = &vou_dev->vdev;
-	*vdev = sh_vou_video_template;
-	if (vou_pdata->bus_fmt == SH_VOU_BUS_8BIT)
-		vdev->tvnorms |= V4L2_STD_PAL;
-	vdev->v4l2_dev = &vou_dev->v4l2_dev;
-	vdev->release = video_device_release_empty;
-	vdev->lock = &vou_dev->fop_lock;
-
-	video_set_drvdata(vdev, vou_dev);
-
-	/* Initialize the vb2 queue */
-	q = &vou_dev->queue;
-	q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-	q->io_modes = VB2_MMAP | VB2_DMABUF | VB2_WRITE;
-	q->drv_priv = vou_dev;
-	q->buf_struct_size = sizeof(struct sh_vou_buffer);
-	q->ops = &sh_vou_qops;
-	q->mem_ops = &vb2_dma_contig_memops;
-	q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
-	q->min_buffers_needed = 2;
-	q->lock = &vou_dev->fop_lock;
-	q->dev = &pdev->dev;
-	ret = vb2_queue_init(q);
-	if (ret)
-		goto ei2cgadap;
-
-	vdev->queue = q;
-	INIT_LIST_HEAD(&vou_dev->buf_list);
-
-	pm_runtime_enable(&pdev->dev);
-	pm_runtime_resume(&pdev->dev);
-
-	i2c_adap = i2c_get_adapter(vou_pdata->i2c_adap);
-	if (!i2c_adap) {
-		ret = -ENODEV;
-		goto ei2cgadap;
-	}
-
-	ret = sh_vou_hw_init(vou_dev);
-	if (ret < 0)
-		goto ereset;
-
-	subdev = v4l2_i2c_new_subdev_board(&vou_dev->v4l2_dev, i2c_adap,
-			vou_pdata->board_info, NULL);
-	if (!subdev) {
-		ret = -ENOMEM;
-		goto ei2cnd;
-	}
-
-	ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
-	if (ret < 0)
-		goto evregdev;
-
-	return 0;
-
-evregdev:
-ei2cnd:
-ereset:
-	i2c_put_adapter(i2c_adap);
-ei2cgadap:
-	pm_runtime_disable(&pdev->dev);
-	v4l2_device_unregister(&vou_dev->v4l2_dev);
-	return ret;
-}
-
-static int sh_vou_remove(struct platform_device *pdev)
-{
-	struct v4l2_device *v4l2_dev = platform_get_drvdata(pdev);
-	struct sh_vou_device *vou_dev = container_of(v4l2_dev,
-						struct sh_vou_device, v4l2_dev);
-	struct v4l2_subdev *sd = list_entry(v4l2_dev->subdevs.next,
-					    struct v4l2_subdev, list);
-	struct i2c_client *client = v4l2_get_subdevdata(sd);
-
-	pm_runtime_disable(&pdev->dev);
-	video_unregister_device(&vou_dev->vdev);
-	i2c_put_adapter(client->adapter);
-	v4l2_device_unregister(&vou_dev->v4l2_dev);
-	return 0;
-}
-
-static struct platform_driver sh_vou = {
-	.remove  = sh_vou_remove,
-	.driver  = {
-		.name	= "sh-vou",
-	},
-};
-
-module_platform_driver_probe(sh_vou, sh_vou_probe);
-
-MODULE_DESCRIPTION("SuperH VOU driver");
-MODULE_AUTHOR("Guennadi Liakhovetski <g.liakhovetski@gmx.de>");
-MODULE_LICENSE("GPL v2");
-MODULE_VERSION("0.1.0");
-MODULE_ALIAS("platform:sh-vou");
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 21/22] drivers: platform: remove is_sh_early_platform_device
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
                   ` (16 preceding siblings ...)
  2023-01-13  6:23 ` [PATCH 20/22] media: remove sh_vou Christoph Hellwig
@ 2023-01-13  6:23 ` Christoph Hellwig
  2023-01-13  6:23 ` [PATCH 22/22] drivers: platform: remove early_platform_cleanup Christoph Hellwig
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

This was used as a hack for sh-architecture device initialization, and
with sh gone now, only the stub that always returns 0 is left.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/clocksource/sh_cmt.c    |  8 ++------
 drivers/clocksource/sh_mtu2.c   |  8 ++------
 drivers/clocksource/sh_tmu.c    |  9 ++-------
 include/linux/platform_device.h | 12 ------------
 4 files changed, 6 insertions(+), 31 deletions(-)

diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index 7fed3529bbaf82..4f6d7d40c9fcb1 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -1109,10 +1109,8 @@ static int sh_cmt_probe(struct platform_device *pdev)
 	struct sh_cmt_device *cmt = platform_get_drvdata(pdev);
 	int ret;
 
-	if (!is_sh_early_platform_device(pdev)) {
-		pm_runtime_set_active(&pdev->dev);
-		pm_runtime_enable(&pdev->dev);
-	}
+	pm_runtime_set_active(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
 
 	if (cmt) {
 		dev_info(&pdev->dev, "kept as earlytimer\n");
@@ -1129,8 +1127,6 @@ static int sh_cmt_probe(struct platform_device *pdev)
 		pm_runtime_idle(&pdev->dev);
 		return ret;
 	}
-	if (is_sh_early_platform_device(pdev))
-		return 0;
 
  out:
 	if (cmt->has_clockevent || cmt->has_clocksource)
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
index e81e978513f80e..97ac2929e424be 100644
--- a/drivers/clocksource/sh_mtu2.c
+++ b/drivers/clocksource/sh_mtu2.c
@@ -448,10 +448,8 @@ static int sh_mtu2_probe(struct platform_device *pdev)
 	struct sh_mtu2_device *mtu = platform_get_drvdata(pdev);
 	int ret;
 
-	if (!is_sh_early_platform_device(pdev)) {
-		pm_runtime_set_active(&pdev->dev);
-		pm_runtime_enable(&pdev->dev);
-	}
+	pm_runtime_set_active(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
 
 	if (mtu) {
 		dev_info(&pdev->dev, "kept as earlytimer\n");
@@ -468,8 +466,6 @@ static int sh_mtu2_probe(struct platform_device *pdev)
 		pm_runtime_idle(&pdev->dev);
 		return ret;
 	}
-	if (is_sh_early_platform_device(pdev))
-		return 0;
 
  out:
 	if (mtu->has_clockevent)
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
index 596e9146ad54e9..940378d38dd523 100644
--- a/drivers/clocksource/sh_tmu.c
+++ b/drivers/clocksource/sh_tmu.c
@@ -595,10 +595,8 @@ static int sh_tmu_probe(struct platform_device *pdev)
 	struct sh_tmu_device *tmu = platform_get_drvdata(pdev);
 	int ret;
 
-	if (!is_sh_early_platform_device(pdev)) {
-		pm_runtime_set_active(&pdev->dev);
-		pm_runtime_enable(&pdev->dev);
-	}
+	pm_runtime_set_active(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
 
 	if (tmu) {
 		dev_info(&pdev->dev, "kept as earlytimer\n");
@@ -616,9 +614,6 @@ static int sh_tmu_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	if (is_sh_early_platform_device(pdev))
-		return 0;
-
  out:
 	if (tmu->has_clockevent || tmu->has_clocksource)
 		pm_runtime_irq_safe(&pdev->dev);
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index b0d5a253156ece..894939a74dd20f 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -352,18 +352,6 @@ extern int platform_pm_restore(struct device *dev);
 #define USE_PLATFORM_PM_SLEEP_OPS
 #endif
 
-#ifndef CONFIG_SUPERH
-/*
- * REVISIT: This stub is needed for all non-SuperH users of early platform
- * drivers. It should go away once we introduce the new platform_device-based
- * early driver framework.
- */
-static inline int is_sh_early_platform_device(struct platform_device *pdev)
-{
-	return 0;
-}
-#endif /* CONFIG_SUPERH */
-
 /* For now only SuperH uses it */
 void early_platform_cleanup(void);
 
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 22/22] drivers: platform: remove early_platform_cleanup
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
                   ` (17 preceding siblings ...)
  2023-01-13  6:23 ` [PATCH 21/22] drivers: platform: remove is_sh_early_platform_device Christoph Hellwig
@ 2023-01-13  6:23 ` Christoph Hellwig
  2023-01-13  8:09 ` remove arch/sh John Paul Adrian Glaubitz
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  6:23 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

This weak stub was only overriden by the now remove sh architecture.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/base/platform.c         | 4 ----
 include/linux/platform_device.h | 3 ---
 2 files changed, 7 deletions(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 968f3d71eeab2e..eb3feabf6c2f53 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -1506,14 +1506,10 @@ struct device *platform_find_device_by_driver(struct device *start,
 }
 EXPORT_SYMBOL_GPL(platform_find_device_by_driver);
 
-void __weak __init early_platform_cleanup(void) { }
-
 int __init platform_bus_init(void)
 {
 	int error;
 
-	early_platform_cleanup();
-
 	error = device_register(&platform_bus);
 	if (error) {
 		put_device(&platform_bus);
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 894939a74dd20f..86692f730e3a12 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -352,7 +352,4 @@ extern int platform_pm_restore(struct device *dev);
 #define USE_PLATFORM_PM_SLEEP_OPS
 #endif
 
-/* For now only SuperH uses it */
-void early_platform_cleanup(void);
-
 #endif /* _PLATFORM_DEVICE_H_ */
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* Re: [PATCH 02/22] usb: remove the dead USB_OHCI_SH option
  2023-01-13  6:23 ` [PATCH 02/22] usb: remove the dead USB_OHCI_SH option Christoph Hellwig
@ 2023-01-13  7:12   ` Greg Kroah-Hartman
  2023-01-13  7:14     ` Christoph Hellwig
                       ` (2 more replies)
  2023-01-13  8:59   ` Geert Uytterhoeven
  1 sibling, 3 replies; 80+ messages in thread
From: Greg Kroah-Hartman @ 2023-01-13  7:12 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Laurent Pinchart,
	Kieran Bingham, Geert Uytterhoeven, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

On Fri, Jan 13, 2023 at 07:23:19AM +0100, Christoph Hellwig wrote:
> USB_OHCI_SH is a dummy option that never builds any code, remove it.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/usb/host/Kconfig | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
> index 8d799d23c476e1..ca5f657c092cf4 100644
> --- a/drivers/usb/host/Kconfig
> +++ b/drivers/usb/host/Kconfig
> @@ -548,17 +548,6 @@ config USB_OHCI_HCD_SSB
>  
>  	  If unsure, say N.
>  
> -config USB_OHCI_SH
> -	bool "OHCI support for SuperH USB controller (DEPRECATED)"
> -	depends on SUPERH || COMPILE_TEST
> -	select USB_OHCI_HCD_PLATFORM
> -	help
> -	  This option is deprecated now and the driver was removed, use
> -	  USB_OHCI_HCD_PLATFORM instead.
> -
> -	  Enables support for the on-chip OHCI controller on the SuperH.
> -	  If you use the PCI OHCI controller, this option is not necessary.
> -
>  config USB_OHCI_EXYNOS
>  	tristate "OHCI support for Samsung S5P/Exynos SoC Series"
>  	depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
> -- 
> 2.39.0
> 

Do you want all of these to go through a single tree, or can they go
through the different driver subsystem trees?

If single:

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

If not, I'll be glad to take this.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 02/22] usb: remove the dead USB_OHCI_SH option
  2023-01-13  7:12   ` Greg Kroah-Hartman
@ 2023-01-13  7:14     ` Christoph Hellwig
  2023-01-15  0:55     ` Rob Landley
  2023-02-03  7:15     ` Christoph Hellwig
  2 siblings, 0 replies; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-13  7:14 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

On Fri, Jan 13, 2023 at 08:12:44AM +0100, Greg Kroah-Hartman wrote:
> Do you want all of these to go through a single tree, or can they go
> through the different driver subsystem trees?
> 
> If single:
> 
> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> If not, I'll be glad to take this.

I think taking all the patches together would make most sense.

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 01/22] gpu/drm: remove the shmobile drm driver
  2023-01-13  6:23 ` [PATCH 01/22] gpu/drm: remove the shmobile drm driver Christoph Hellwig
@ 2023-01-13  7:46   ` Laurent Pinchart
  2023-01-13  7:55     ` Laurent Pinchart
  2023-02-03  7:15     ` Christoph Hellwig
  0 siblings, 2 replies; 80+ messages in thread
From: Laurent Pinchart @ 2023-01-13  7:46 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Kieran Bingham, Geert Uytterhoeven, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

Hi Christoph,

Thank you for the patch.

On Fri, Jan 13, 2023 at 07:23:18AM +0100, Christoph Hellwig wrote:
> This driver depends on ARM && ARCH_SHMOBILE, but ARCH_SHMOBILE can only be
> set for each/sh, making the driver dead code except for the COMPILE_TEST
> case.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

No objection from me.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/Kconfig                       |   2 -
>  drivers/gpu/drm/Makefile                      |   1 -
>  drivers/gpu/drm/shmobile/Kconfig              |  12 -
>  drivers/gpu/drm/shmobile/Makefile             |   8 -
>  .../gpu/drm/shmobile/shmob_drm_backlight.c    |  82 ---
>  .../gpu/drm/shmobile/shmob_drm_backlight.h    |  19 -
>  drivers/gpu/drm/shmobile/shmob_drm_crtc.c     | 683 ------------------
>  drivers/gpu/drm/shmobile/shmob_drm_crtc.h     |  55 --
>  drivers/gpu/drm/shmobile/shmob_drm_drv.c      | 303 --------
>  drivers/gpu/drm/shmobile/shmob_drm_drv.h      |  42 --
>  drivers/gpu/drm/shmobile/shmob_drm_kms.c      | 150 ----
>  drivers/gpu/drm/shmobile/shmob_drm_kms.h      |  29 -
>  drivers/gpu/drm/shmobile/shmob_drm_plane.c    | 261 -------
>  drivers/gpu/drm/shmobile/shmob_drm_plane.h    |  19 -
>  drivers/gpu/drm/shmobile/shmob_drm_regs.h     | 310 --------
>  15 files changed, 1976 deletions(-)
>  delete mode 100644 drivers/gpu/drm/shmobile/Kconfig
>  delete mode 100644 drivers/gpu/drm/shmobile/Makefile
>  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_backlight.c
>  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_backlight.h
>  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_crtc.c
>  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_crtc.h
>  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_drv.c
>  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_drv.h
>  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_kms.c
>  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_kms.h
>  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_plane.c
>  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_plane.h
>  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_regs.h

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 01/22] gpu/drm: remove the shmobile drm driver
  2023-01-13  7:46   ` Laurent Pinchart
@ 2023-01-13  7:55     ` Laurent Pinchart
  2023-01-13  8:19       ` Geert Uytterhoeven
  2023-02-03  7:15     ` Christoph Hellwig
  1 sibling, 1 reply; 80+ messages in thread
From: Laurent Pinchart @ 2023-01-13  7:55 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Kieran Bingham, Geert Uytterhoeven, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

On Fri, Jan 13, 2023 at 09:46:49AM +0200, Laurent Pinchart wrote:
> Hi Christoph,
> 
> Thank you for the patch.
> 
> On Fri, Jan 13, 2023 at 07:23:18AM +0100, Christoph Hellwig wrote:
> > This driver depends on ARM && ARCH_SHMOBILE, but ARCH_SHMOBILE can only be
> > set for each/sh, making the driver dead code except for the COMPILE_TEST
> > case.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> No objection from me.
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

To expand a little bit on this, ARCH_SHMOBILE used to be set for the
ARM-based shmobile SoCs too, until

commit 08e735233ea29b17bfec8e4cb302e799d9f920b8
Author: Geert Uytterhoeven <geert+renesas@glider.be>
Date:   Tue Aug 28 17:10:10 2018 +0200

    ARM: shmobile: Remove the ARCH_SHMOBILE Kconfig symbol

    All drivers for Renesas ARM SoCs have gained proper ARCH_RENESAS
    platform dependencies.  Hence finish the conversion from ARCH_SHMOBILE
    to ARCH_RENESAS for Renesas 32-bit ARM SoCs, as started by commit
    9b5ba0df4ea4f940 ("ARM: shmobile: Introduce ARCH_RENESAS").

    Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Acked-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

merged in v4.20. The DRM shmobile driver's Kconfig entry wasn't updated,
making it dead code indeed.

I haven't tested this driver in ages, hence my lack of objection, but
someone may want to keep it for the pre-R-Car ARM SoCs.

Also, I just noticed that you forgot to update the MAINTAINERS file in
this patch to drop the drivers/gpu/drm/shmobile/ entry.

> > ---
> >  drivers/gpu/drm/Kconfig                       |   2 -
> >  drivers/gpu/drm/Makefile                      |   1 -
> >  drivers/gpu/drm/shmobile/Kconfig              |  12 -
> >  drivers/gpu/drm/shmobile/Makefile             |   8 -
> >  .../gpu/drm/shmobile/shmob_drm_backlight.c    |  82 ---
> >  .../gpu/drm/shmobile/shmob_drm_backlight.h    |  19 -
> >  drivers/gpu/drm/shmobile/shmob_drm_crtc.c     | 683 ------------------
> >  drivers/gpu/drm/shmobile/shmob_drm_crtc.h     |  55 --
> >  drivers/gpu/drm/shmobile/shmob_drm_drv.c      | 303 --------
> >  drivers/gpu/drm/shmobile/shmob_drm_drv.h      |  42 --
> >  drivers/gpu/drm/shmobile/shmob_drm_kms.c      | 150 ----
> >  drivers/gpu/drm/shmobile/shmob_drm_kms.h      |  29 -
> >  drivers/gpu/drm/shmobile/shmob_drm_plane.c    | 261 -------
> >  drivers/gpu/drm/shmobile/shmob_drm_plane.h    |  19 -
> >  drivers/gpu/drm/shmobile/shmob_drm_regs.h     | 310 --------
> >  15 files changed, 1976 deletions(-)
> >  delete mode 100644 drivers/gpu/drm/shmobile/Kconfig
> >  delete mode 100644 drivers/gpu/drm/shmobile/Makefile
> >  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_backlight.c
> >  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_backlight.h
> >  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> >  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_crtc.h
> >  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_drv.c
> >  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_drv.h
> >  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_kms.c
> >  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_kms.h
> >  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_plane.c
> >  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_plane.h
> >  delete mode 100644 drivers/gpu/drm/shmobile/shmob_drm_regs.h

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 20/22] media: remove sh_vou
  2023-01-13  6:23 ` [PATCH 20/22] media: remove sh_vou Christoph Hellwig
@ 2023-01-13  8:01   ` Laurent Pinchart
  2023-01-13  9:05     ` Hans Verkuil
  0 siblings, 1 reply; 80+ messages in thread
From: Laurent Pinchart @ 2023-01-13  8:01 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Kieran Bingham, Geert Uytterhoeven, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

Hi Christoph,

Thank you for the patch.

On Fri, Jan 13, 2023 at 07:23:37AM +0100, Christoph Hellwig wrote:
> Now that arch/sh is removed this driver is dead code.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/media/platform/renesas/Kconfig  |    9 -
>  drivers/media/platform/renesas/Makefile |    1 -
>  drivers/media/platform/renesas/sh_vou.c | 1375 -----------------------

You can also emove include/media/drv-intf/sh_vou.sh. With that, and the
corresponding MAINTAINERS entry dropped,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  3 files changed, 1385 deletions(-)
>  delete mode 100644 drivers/media/platform/renesas/sh_vou.c

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
                   ` (18 preceding siblings ...)
  2023-01-13  6:23 ` [PATCH 22/22] drivers: platform: remove early_platform_cleanup Christoph Hellwig
@ 2023-01-13  8:09 ` John Paul Adrian Glaubitz
  2023-01-13  8:26   ` Geert Uytterhoeven
  2023-01-16  7:13   ` Christoph Hellwig
       [not found] ` <20230113062339.1909087-14-hch@lst.de>
  2023-01-13 15:18 ` remove arch/sh Rob Herring
  21 siblings, 2 replies; 80+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-01-13  8:09 UTC (permalink / raw)
  To: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Hello!

On 1/13/23 07:23, Christoph Hellwig wrote:
> arch/sh has been a long drag because it supports a lot of SOCs, and most
> of them haven't even been converted to device tree infrastructure.  These
> SOCs are generally obsolete as well, and all of the support has been barely
> maintained for almost 10 years, and not at all for more than 1 year.
> 
> Drop arch/sh and everything that depends on it.

I'm still maintaining and using this port in Debian.

It's a bit disappointing that people keep hammering on it. It works fine for me.

Adrian

-- 
  .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
   `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 01/22] gpu/drm: remove the shmobile drm driver
  2023-01-13  7:55     ` Laurent Pinchart
@ 2023-01-13  8:19       ` Geert Uytterhoeven
  0 siblings, 0 replies; 80+ messages in thread
From: Geert Uytterhoeven @ 2023-01-13  8:19 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, Kieran Bingham, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

On Fri, Jan 13, 2023 at 8:55 AM Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> On Fri, Jan 13, 2023 at 09:46:49AM +0200, Laurent Pinchart wrote:
> > On Fri, Jan 13, 2023 at 07:23:18AM +0100, Christoph Hellwig wrote:
> > > This driver depends on ARM && ARCH_SHMOBILE, but ARCH_SHMOBILE can only be
> > > set for each/sh, making the driver dead code except for the COMPILE_TEST
> > > case.
> > >
> > > Signed-off-by: Christoph Hellwig <hch@lst.de>
> >
> > No objection from me.
> >
> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> To expand a little bit on this, ARCH_SHMOBILE used to be set for the
> ARM-based shmobile SoCs too, until
>
> commit 08e735233ea29b17bfec8e4cb302e799d9f920b8
> Author: Geert Uytterhoeven <geert+renesas@glider.be>
> Date:   Tue Aug 28 17:10:10 2018 +0200
>
>     ARM: shmobile: Remove the ARCH_SHMOBILE Kconfig symbol
>
>     All drivers for Renesas ARM SoCs have gained proper ARCH_RENESAS
>     platform dependencies.  Hence finish the conversion from ARCH_SHMOBILE
>     to ARCH_RENESAS for Renesas 32-bit ARM SoCs, as started by commit
>     9b5ba0df4ea4f940 ("ARM: shmobile: Introduce ARCH_RENESAS").
>
>     Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>     Acked-by: Arnd Bergmann <arnd@arndb.de>
>     Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
>
> merged in v4.20. The DRM shmobile driver's Kconfig entry wasn't updated,
> making it dead code indeed.

Note that it wasn't updated because this driver was not used on Renesas
ARM platforms, due to the lack of DT bindings and DT support, so it
didn't make sense to make it selectable.

> I haven't tested this driver in ages, hence my lack of objection, but
> someone may want to keep it for the pre-R-Car ARM SoCs.

Indeed, this driver should work with the R-Mobile A1 (which made it
into orbit, so we could call it the first member of R-Space ;-) and
SH-Mobile AG5 SoCs.  The major blocker is the lack of DT bindings.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-01-13  8:09 ` remove arch/sh John Paul Adrian Glaubitz
@ 2023-01-13  8:26   ` Geert Uytterhoeven
  2023-01-13  8:52     ` John Paul Adrian Glaubitz
  2023-01-16  7:14     ` Christoph Hellwig
  2023-01-16  7:13   ` Christoph Hellwig
  1 sibling, 2 replies; 80+ messages in thread
From: Geert Uytterhoeven @ 2023-01-13  8:26 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, Laurent Pinchart, Kieran Bingham,
	Geert Uytterhoeven, linux-kernel, linux-watchdog, devicetree,
	linux-arch, dmaengine, dri-devel, linux-renesas-soc, linux-i2c,
	linux-input, linux-media, linux-mmc, linux-mtd, netdev,
	linux-gpio, linux-rtc, linux-spi, linux-serial, linux-usb,
	linux-fbdev, alsa-devel, linux-sh

On Fri, Jan 13, 2023 at 9:10 AM John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
> On 1/13/23 07:23, Christoph Hellwig wrote:
> > arch/sh has been a long drag because it supports a lot of SOCs, and most
> > of them haven't even been converted to device tree infrastructure.  These
> > SOCs are generally obsolete as well, and all of the support has been barely
> > maintained for almost 10 years, and not at all for more than 1 year.
> >
> > Drop arch/sh and everything that depends on it.
>
> I'm still maintaining and using this port in Debian.
>
> It's a bit disappointing that people keep hammering on it. It works fine for me.

Indeed.  The main issue is not the lack of people sending patches and
fixes, but those patches never being applied by the maintainers.
Perhaps someone is willing to stand up to take over maintainership?

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 10/22] input: remove sh_keysc
  2023-01-13  6:23 ` [PATCH 10/22] input: remove sh_keysc Christoph Hellwig
@ 2023-01-13  8:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 80+ messages in thread
From: Geert Uytterhoeven @ 2023-01-13  8:28 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Laurent Pinchart, Kieran Bingham, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

On Fri, Jan 13, 2023 at 7:24 AM Christoph Hellwig <hch@lst.de> wrote:
> Now that arch/sh is removed this driver is dead code.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/input/keyboard/Kconfig    |  10 -
>  drivers/input/keyboard/Makefile   |   1 -
>  drivers/input/keyboard/sh_keysc.c | 334 ------------------------------
>  3 files changed, 345 deletions(-)
>  delete mode 100644 drivers/input/keyboard/sh_keysc.c
>
> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> index 84490915ae4d5a..882ec5fef214ac 100644
> --- a/drivers/input/keyboard/Kconfig
> +++ b/drivers/input/keyboard/Kconfig
> @@ -625,16 +625,6 @@ config KEYBOARD_SUNKBD
>           To compile this driver as a module, choose M here: the
>           module will be called sunkbd.
>
> -config KEYBOARD_SH_KEYSC
> -       tristate "SuperH KEYSC keypad support"
> -       depends on ARCH_SHMOBILE || COMPILE_TEST
> -       help
> -         Say Y here if you want to use a keypad attached to the KEYSC block
> -         on SuperH processors such as sh7722 and sh7343.

FTR, this hardware block is also present on the ARM-based
SH-Mobile AG5, and R-Mobile A1 and APE6 SoCs.
Again, no DT support.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 11/22] mtd/nand: remove sh_flctl
  2023-01-13  6:23 ` [PATCH 11/22] mtd/nand: remove sh_flctl Christoph Hellwig
@ 2023-01-13  8:30   ` Geert Uytterhoeven
  2023-01-13 10:06     ` Arnd Bergmann
  0 siblings, 1 reply; 80+ messages in thread
From: Geert Uytterhoeven @ 2023-01-13  8:30 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

On Fri, Jan 13, 2023 at 7:24 AM Christoph Hellwig <hch@lst.de> wrote:
> Now that arch/sh is removed this driver is dead code.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/mtd/nand/raw/Kconfig    |    8 -
>  drivers/mtd/nand/raw/Makefile   |    1 -
>  drivers/mtd/nand/raw/sh_flctl.c | 1234 -------------------------------
>  include/linux/mtd/sh_flctl.h    |  180 -----
>  4 files changed, 1423 deletions(-)
>  delete mode 100644 drivers/mtd/nand/raw/sh_flctl.c
>  delete mode 100644 include/linux/mtd/sh_flctl.h
>
> diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
> index 98ea1c9e65c8ef..20a4988ea418d5 100644
> --- a/drivers/mtd/nand/raw/Kconfig
> +++ b/drivers/mtd/nand/raw/Kconfig
> @@ -284,14 +284,6 @@ config MTD_NAND_MXC
>           This enables the driver for the NAND flash controller on the
>           MXC processors.
>
> -config MTD_NAND_SH_FLCTL
> -       tristate "Renesas SuperH FLCTL NAND controller"
> -       depends on SUPERH || COMPILE_TEST
> -       depends on HAS_IOMEM
> -       help
> -         Several Renesas SuperH CPU has FLCTL. This option enables support
> -         for NAND Flash using FLCTL.

FTR, this hardware block is also present on the ARM-based
SH-Mobile AG5 and R-Mobile A1 SoCs.
Again, no DT support.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 13/22] pinctrl: remove renesas sh controllers
       [not found] ` <20230113062339.1909087-14-hch@lst.de>
@ 2023-01-13  8:45   ` Geert Uytterhoeven
  0 siblings, 0 replies; 80+ messages in thread
From: Geert Uytterhoeven @ 2023-01-13  8:45 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

 	Hi Christoph,

On Fri, 13 Jan 2023, Christoph Hellwig wrote:
> Now that arch/sh is removed these drivers are dead code.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Thanks for your patch!

> --- a/drivers/pinctrl/renesas/Kconfig
> +++ b/drivers/pinctrl/renesas/Kconfig
> @@ -255,57 +243,10 @@ config PINCTRL_RZV2M
> 	  This selects GPIO and pinctrl driver for Renesas RZ/V2M
> 	  platforms.
>
> -config PINCTRL_PFC_SH7203
> -	bool "pin control support for SH7203" if COMPILE_TEST
> -	select PINCTRL_SH_FUNC_GPIO

(If this is to be continued) the PINCTRL_SH_FUNC_GPIO symbol itself, and
all its users, can be removed, too.

> --- a/drivers/pinctrl/renesas/core.c
> +++ b/drivers/pinctrl/renesas/core.c
> @@ -753,562 +753,6 @@ static int sh_pfc_suspend_init(struct sh_pfc *pfc) { return 0; }
> #define DEV_PM_OPS	NULL
> #endif /* CONFIG_PM_SLEEP && CONFIG_ARM_PSCI_FW */
>
> -#ifdef DEBUG
> -#define SH_PFC_MAX_REGS		300
> -#define SH_PFC_MAX_ENUMS	5000
> -

This whole hunk should stay (except for the part protected by #ifdef
CONFIG_PINCTRL_SH_FUNC_GPIO), as it is used for validating pin control
tables on ARM SoCs, too.

Gr{oetje,eeting}s,

 						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
 							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 16/22] spi: remove spi-sh-sci
  2023-01-13  6:23 ` [PATCH 16/22] spi: remove spi-sh-sci Christoph Hellwig
@ 2023-01-13  8:50   ` Geert Uytterhoeven
  0 siblings, 0 replies; 80+ messages in thread
From: Geert Uytterhoeven @ 2023-01-13  8:50 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

On Fri, Jan 13, 2023 at 7:24 AM Christoph Hellwig <hch@lst.de> wrote:
> Now that arch/sh is removed this driver is dead code.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/spi/Kconfig      |   7 --
>  drivers/spi/Makefile     |   1 -
>  drivers/spi/spi-sh-sci.c | 197 ---------------------------------------
>  3 files changed, 205 deletions(-)
>  delete mode 100644 drivers/spi/spi-sh-sci.c
>
> diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
> index 7508dcef909c78..76f3bc6f8c81fc 100644
> --- a/drivers/spi/Kconfig
> +++ b/drivers/spi/Kconfig
> @@ -882,13 +882,6 @@ config SPI_SH_MSIOF
>         help
>           SPI driver for SuperH and SH Mobile MSIOF blocks.
>
> -config SPI_SH_SCI
> -       tristate "SuperH SCI SPI controller"
> -       depends on SUPERH
> -       select SPI_BITBANG
> -       help
> -         SPI driver for SuperH SCI blocks.

This driver uses the Serial Communications Interface (SCI, cfr.
drivers/tty/serial/sh-sci.c) in SPI mode. Hence in theory it could be
used on a variety of Renesas ARM SoCs, and even on RZ/Five.
Again, no DT support.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-01-13  8:26   ` Geert Uytterhoeven
@ 2023-01-13  8:52     ` John Paul Adrian Glaubitz
  2023-01-13 19:11       ` Rob Landley
  2023-01-16  7:14     ` Christoph Hellwig
  1 sibling, 1 reply; 80+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-01-13  8:52 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, Laurent Pinchart, Kieran Bingham,
	Geert Uytterhoeven, linux-kernel, linux-watchdog, devicetree,
	linux-arch, dmaengine, dri-devel, linux-renesas-soc, linux-i2c,
	linux-input, linux-media, linux-mmc, linux-mtd, netdev,
	linux-gpio, linux-rtc, linux-spi, linux-serial, linux-usb,
	linux-fbdev, alsa-devel, linux-sh

Hi Geert!

On 1/13/23 09:26, Geert Uytterhoeven wrote:
> Indeed.  The main issue is not the lack of people sending patches and
> fixes, but those patches never being applied by the maintainers.
> Perhaps someone is willing to stand up to take over maintainership?

I actually would be willing to do it but I'm a bit hesitant as I'm not 100%
sure my skills are sufficient. Maybe if someone can assist me?

Adrian

-- 
  .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
   `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 19/22] fbdev: remove sh7760fb
  2023-01-13  6:23 ` [PATCH 19/22] fbdev: remove sh7760fb Christoph Hellwig
@ 2023-01-13  8:53   ` Geert Uytterhoeven
  0 siblings, 0 replies; 80+ messages in thread
From: Geert Uytterhoeven @ 2023-01-13  8:53 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Hi Christoph,

On Fri, Jan 13, 2023 at 7:25 AM Christoph Hellwig <hch@lst.de> wrote:
> Now that arch/sh is removed this driver is dead code.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Thanks for your patch!

> --- a/drivers/video/fbdev/Kconfig
> +++ b/drivers/video/fbdev/Kconfig
> @@ -1861,7 +1861,7 @@ config FB_W100
>  config FB_SH_MOBILE_LCDC
>         tristate "SuperH Mobile LCDC framebuffer support"
>         depends on FB && HAVE_CLK && HAS_IOMEM
> -       depends on SUPERH || ARCH_RENESAS || COMPILE_TEST
> +       depends on ARCH_RENESAS || COMPILE_TEST

Nit: this part should be a separate patch.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 02/22] usb: remove the dead USB_OHCI_SH option
  2023-01-13  6:23 ` [PATCH 02/22] usb: remove the dead USB_OHCI_SH option Christoph Hellwig
  2023-01-13  7:12   ` Greg Kroah-Hartman
@ 2023-01-13  8:59   ` Geert Uytterhoeven
  1 sibling, 0 replies; 80+ messages in thread
From: Geert Uytterhoeven @ 2023-01-13  8:59 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Hi Christoph,

On Fri, Jan 13, 2023 at 7:23 AM Christoph Hellwig <hch@lst.de> wrote:
> USB_OHCI_SH is a dummy option that never builds any code, remove it.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Thanks for your patch!
Nice catch!

> --- a/drivers/usb/host/Kconfig
> +++ b/drivers/usb/host/Kconfig
> @@ -548,17 +548,6 @@ config USB_OHCI_HCD_SSB
>
>           If unsure, say N.
>
> -config USB_OHCI_SH
> -       bool "OHCI support for SuperH USB controller (DEPRECATED)"
> -       depends on SUPERH || COMPILE_TEST
> -       select USB_OHCI_HCD_PLATFORM
> -       help
> -         This option is deprecated now and the driver was removed, use
> -         USB_OHCI_HCD_PLATFORM instead.
> -
> -         Enables support for the on-chip OHCI controller on the SuperH.
> -         If you use the PCI OHCI controller, this option is not necessary.
> -

At this point in the series, there are still selects and enablements of
USB_OHCI_SH in arch/sh/Kconfig and arch/sh/configs/sh7757lcr_defconfig.
I think it would be good to replace them by USB_OHCI_HCD_PLATFORM first,
to decouple the fate of this patch from the rest of the series.

>  config USB_OHCI_EXYNOS
>         tristate "OHCI support for Samsung S5P/Exynos SoC Series"
>         depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 20/22] media: remove sh_vou
  2023-01-13  8:01   ` Laurent Pinchart
@ 2023-01-13  9:05     ` Hans Verkuil
  0 siblings, 0 replies; 80+ messages in thread
From: Hans Verkuil @ 2023-01-13  9:05 UTC (permalink / raw)
  To: Laurent Pinchart, Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Kieran Bingham, Geert Uytterhoeven, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

On 13/01/2023 09:01, Laurent Pinchart wrote:
> Hi Christoph,
> 
> Thank you for the patch.
> 
> On Fri, Jan 13, 2023 at 07:23:37AM +0100, Christoph Hellwig wrote:
>> Now that arch/sh is removed this driver is dead code.
>>
>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>> ---
>>  drivers/media/platform/renesas/Kconfig  |    9 -
>>  drivers/media/platform/renesas/Makefile |    1 -
>>  drivers/media/platform/renesas/sh_vou.c | 1375 -----------------------
> 
> You can also emove include/media/drv-intf/sh_vou.sh. With that, and the
> corresponding MAINTAINERS entry dropped,
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

And with that you can also add my Ack:

Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

Regards,

	Hans

> 
>>  3 files changed, 1385 deletions(-)
>>  delete mode 100644 drivers/media/platform/renesas/sh_vou.c
> 


^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 11/22] mtd/nand: remove sh_flctl
  2023-01-13  8:30   ` Geert Uytterhoeven
@ 2023-01-13 10:06     ` Arnd Bergmann
  0 siblings, 0 replies; 80+ messages in thread
From: Arnd Bergmann @ 2023-01-13 10:06 UTC (permalink / raw)
  To: Geert Uytterhoeven, Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Greg Kroah-Hartman,
	laurent.pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, Linux-Arch, dmaengine,
	dri-devel, Linux-Renesas, linux-i2c, linux-input, linux-media,
	linux-mmc @ vger . kernel . org, linux-mtd, Netdev,
	open list:GPIO SUBSYSTEM, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

On Fri, Jan 13, 2023, at 09:30, Geert Uytterhoeven wrote:
> On Fri, Jan 13, 2023 at 7:24 AM Christoph Hellwig <hch@lst.de> wrote:
>> Now that arch/sh is removed this driver is dead code.
>
> FTR, this hardware block is also present on the ARM-based
> SH-Mobile AG5 and R-Mobile A1 SoCs.
> Again, no DT support.

I would generally consider drivers dead when they have no DT support
and no platform in the upstream kernel registering the corresponding
device.

If anyone still uses this driver on SH-Mobile or R-Mobile, they
have clearly given up on upstreaming their patches by now, and
they can carry the burden of maintaining the driver out of tree,
or re-submit a working version.

    Arnd

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 06/22] watchdog: remove the shwdt driver
  2023-01-13  6:23 ` [PATCH 06/22] watchdog: remove the shwdt driver Christoph Hellwig
@ 2023-01-13 14:00   ` Guenter Roeck
  0 siblings, 0 replies; 80+ messages in thread
From: Guenter Roeck @ 2023-01-13 14:00 UTC (permalink / raw)
  To: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman
  Cc: Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

On 1/12/23 22:23, Christoph Hellwig wrote:
> Now that arch/sh is removed this driver is dead code.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   .../watchdog/watchdog-parameters.rst          |  12 -
>   drivers/watchdog/Kconfig                      |  20 -
>   drivers/watchdog/Makefile                     |   3 -
>   drivers/watchdog/shwdt.c                      | 344 ------------------
>   4 files changed, 379 deletions(-)
>   delete mode 100644 drivers/watchdog/shwdt.c
> 
> diff --git a/Documentation/watchdog/watchdog-parameters.rst b/Documentation/watchdog/watchdog-parameters.rst
> index 29153eed668900..553ac2f8ae23f7 100644
> --- a/Documentation/watchdog/watchdog-parameters.rst
> +++ b/Documentation/watchdog/watchdog-parameters.rst
> @@ -579,18 +579,6 @@ scx200_wdt:
>   
>   -------------------------------------------------
>   
> -shwdt:
> -    clock_division_ratio:
> -	Clock division ratio. Valid ranges are from 0x5 (1.31ms)
> -	to 0x7 (5.25ms). (default=7)
> -    heartbeat:
> -	Watchdog heartbeat in seconds. (1 <= heartbeat <= 3600, default=30
> -    nowayout:
> -	Watchdog cannot be stopped once started
> -	(default=kernel config parameter)
> -
> --------------------------------------------------
> -
>   smsc37b787_wdt:
>       timeout:
>   	range is 1-255 units, default is 60
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index 0bc40b763b0652..7db0a5e636cf65 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -2015,26 +2015,6 @@ config DIAG288_WATCHDOG
>   	  To compile this driver as a module, choose M here. The module
>   	  will be called diag288_wdt.
>   
> -# SUPERH (sh + sh64) Architecture
> -
> -config SH_WDT
> -	tristate "SuperH Watchdog"
> -	depends on SUPERH && (CPU_SH3 || CPU_SH4 || COMPILE_TEST)
> -	select WATCHDOG_CORE
> -	help
> -	  This driver adds watchdog support for the integrated watchdog in the
> -	  SuperH processors. If you have one of these processors and wish
> -	  to have watchdog support enabled, say Y, otherwise say N.
> -
> -	  As a side note, saying Y here will automatically boost HZ to 1000
> -	  so that the timer has a chance to clear the overflow counter. On
> -	  slower systems (such as the SH-2 and SH-3) this will likely yield
> -	  some performance issues. As such, the WDT should be avoided here
> -	  unless it is absolutely necessary.
> -
> -	  To compile this driver as a module, choose M here: the
> -	  module will be called shwdt.
> -
>   # SPARC Architecture
>   
>   # SPARC64 Architecture
> diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
> index 9cbf6580f16c9f..a852ab4d7176ac 100644
> --- a/drivers/watchdog/Makefile
> +++ b/drivers/watchdog/Makefile
> @@ -195,9 +195,6 @@ obj-$(CONFIG_WATCHDOG_RTAS) += wdrtas.o
>   # S390 Architecture
>   obj-$(CONFIG_DIAG288_WATCHDOG) += diag288_wdt.o
>   
> -# SUPERH (sh + sh64) Architecture
> -obj-$(CONFIG_SH_WDT) += shwdt.o
> -
>   # SPARC Architecture
>   
>   # SPARC64 Architecture
> diff --git a/drivers/watchdog/shwdt.c b/drivers/watchdog/shwdt.c
> deleted file mode 100644
> index f55533e0e0454e..00000000000000
> --- a/drivers/watchdog/shwdt.c
> +++ /dev/null
> @@ -1,344 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> -/*
> - * drivers/watchdog/shwdt.c
> - *
> - * Watchdog driver for integrated watchdog in the SuperH processors.
> - *
> - * Copyright (C) 2001 - 2012  Paul Mundt <lethal@linux-sh.org>
> - *
> - * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com>
> - *     Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
> - *
> - * 19-Apr-2002 Rob Radez <rob@osinvestor.com>
> - *     Added expect close support, made emulated timeout runtime changeable
> - *     general cleanups, add some ioctls
> - */
> -
> -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> -
> -#include <linux/module.h>
> -#include <linux/moduleparam.h>
> -#include <linux/platform_device.h>
> -#include <linux/init.h>
> -#include <linux/types.h>
> -#include <linux/spinlock.h>
> -#include <linux/watchdog.h>
> -#include <linux/pm_runtime.h>
> -#include <linux/fs.h>
> -#include <linux/mm.h>
> -#include <linux/slab.h>
> -#include <linux/io.h>
> -#include <linux/clk.h>
> -#include <linux/err.h>
> -#include <asm/watchdog.h>
> -
> -#define DRV_NAME "sh-wdt"
> -
> -/*
> - * Default clock division ratio is 5.25 msecs. For an additional table of
> - * values, consult the asm-sh/watchdog.h. Overload this at module load
> - * time.
> - *
> - * In order for this to work reliably we need to have HZ set to 1000 or
> - * something quite higher than 100 (or we need a proper high-res timer
> - * implementation that will deal with this properly), otherwise the 10ms
> - * resolution of a jiffy is enough to trigger the overflow. For things like
> - * the SH-4 and SH-5, this isn't necessarily that big of a problem, though
> - * for the SH-2 and SH-3, this isn't recommended unless the WDT is absolutely
> - * necssary.
> - *
> - * As a result of this timing problem, the only modes that are particularly
> - * feasible are the 4096 and the 2048 divisors, which yield 5.25 and 2.62ms
> - * overflow periods respectively.
> - *
> - * Also, since we can't really expect userspace to be responsive enough
> - * before the overflow happens, we maintain two separate timers .. One in
> - * the kernel for clearing out WOVF every 2ms or so (again, this depends on
> - * HZ == 1000), and another for monitoring userspace writes to the WDT device.
> - *
> - * As such, we currently use a configurable heartbeat interval which defaults
> - * to 30s. In this case, the userspace daemon is only responsible for periodic
> - * writes to the device before the next heartbeat is scheduled. If the daemon
> - * misses its deadline, the kernel timer will allow the WDT to overflow.
> - */
> -static int clock_division_ratio = WTCSR_CKS_4096;
> -#define next_ping_period(cks)	(jiffies + msecs_to_jiffies(cks - 4))
> -
> -#define WATCHDOG_HEARTBEAT 30			/* 30 sec default heartbeat */
> -static int heartbeat = WATCHDOG_HEARTBEAT;	/* in seconds */
> -static bool nowayout = WATCHDOG_NOWAYOUT;
> -static unsigned long next_heartbeat;
> -
> -struct sh_wdt {
> -	void __iomem		*base;
> -	struct device		*dev;
> -	struct clk		*clk;
> -	spinlock_t		lock;
> -
> -	struct timer_list	timer;
> -};
> -
> -static int sh_wdt_start(struct watchdog_device *wdt_dev)
> -{
> -	struct sh_wdt *wdt = watchdog_get_drvdata(wdt_dev);
> -	unsigned long flags;
> -	u8 csr;
> -
> -	pm_runtime_get_sync(wdt->dev);
> -	clk_enable(wdt->clk);
> -
> -	spin_lock_irqsave(&wdt->lock, flags);
> -
> -	next_heartbeat = jiffies + (heartbeat * HZ);
> -	mod_timer(&wdt->timer, next_ping_period(clock_division_ratio));
> -
> -	csr = sh_wdt_read_csr();
> -	csr |= WTCSR_WT | clock_division_ratio;
> -	sh_wdt_write_csr(csr);
> -
> -	sh_wdt_write_cnt(0);
> -
> -	/*
> -	 * These processors have a bit of an inconsistent initialization
> -	 * process.. starting with SH-3, RSTS was moved to WTCSR, and the
> -	 * RSTCSR register was removed.
> -	 *
> -	 * On the SH-2 however, in addition with bits being in different
> -	 * locations, we must deal with RSTCSR outright..
> -	 */
> -	csr = sh_wdt_read_csr();
> -	csr |= WTCSR_TME;
> -	csr &= ~WTCSR_RSTS;
> -	sh_wdt_write_csr(csr);
> -
> -#ifdef CONFIG_CPU_SH2
> -	csr = sh_wdt_read_rstcsr();
> -	csr &= ~RSTCSR_RSTS;
> -	sh_wdt_write_rstcsr(csr);
> -#endif
> -	spin_unlock_irqrestore(&wdt->lock, flags);
> -
> -	return 0;
> -}
> -
> -static int sh_wdt_stop(struct watchdog_device *wdt_dev)
> -{
> -	struct sh_wdt *wdt = watchdog_get_drvdata(wdt_dev);
> -	unsigned long flags;
> -	u8 csr;
> -
> -	spin_lock_irqsave(&wdt->lock, flags);
> -
> -	del_timer(&wdt->timer);
> -
> -	csr = sh_wdt_read_csr();
> -	csr &= ~WTCSR_TME;
> -	sh_wdt_write_csr(csr);
> -
> -	spin_unlock_irqrestore(&wdt->lock, flags);
> -
> -	clk_disable(wdt->clk);
> -	pm_runtime_put_sync(wdt->dev);
> -
> -	return 0;
> -}
> -
> -static int sh_wdt_keepalive(struct watchdog_device *wdt_dev)
> -{
> -	struct sh_wdt *wdt = watchdog_get_drvdata(wdt_dev);
> -	unsigned long flags;
> -
> -	spin_lock_irqsave(&wdt->lock, flags);
> -	next_heartbeat = jiffies + (heartbeat * HZ);
> -	spin_unlock_irqrestore(&wdt->lock, flags);
> -
> -	return 0;
> -}
> -
> -static int sh_wdt_set_heartbeat(struct watchdog_device *wdt_dev, unsigned t)
> -{
> -	struct sh_wdt *wdt = watchdog_get_drvdata(wdt_dev);
> -	unsigned long flags;
> -
> -	if (unlikely(t < 1 || t > 3600)) /* arbitrary upper limit */
> -		return -EINVAL;
> -
> -	spin_lock_irqsave(&wdt->lock, flags);
> -	heartbeat = t;
> -	wdt_dev->timeout = t;
> -	spin_unlock_irqrestore(&wdt->lock, flags);
> -
> -	return 0;
> -}
> -
> -static void sh_wdt_ping(struct timer_list *t)
> -{
> -	struct sh_wdt *wdt = from_timer(wdt, t, timer);
> -	unsigned long flags;
> -
> -	spin_lock_irqsave(&wdt->lock, flags);
> -	if (time_before(jiffies, next_heartbeat)) {
> -		u8 csr;
> -
> -		csr = sh_wdt_read_csr();
> -		csr &= ~WTCSR_IOVF;
> -		sh_wdt_write_csr(csr);
> -
> -		sh_wdt_write_cnt(0);
> -
> -		mod_timer(&wdt->timer, next_ping_period(clock_division_ratio));
> -	} else
> -		dev_warn(wdt->dev, "Heartbeat lost! Will not ping "
> -		         "the watchdog\n");
> -	spin_unlock_irqrestore(&wdt->lock, flags);
> -}
> -
> -static const struct watchdog_info sh_wdt_info = {
> -	.options		= WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
> -				  WDIOF_MAGICCLOSE,
> -	.firmware_version	= 1,
> -	.identity		= "SH WDT",
> -};
> -
> -static const struct watchdog_ops sh_wdt_ops = {
> -	.owner		= THIS_MODULE,
> -	.start		= sh_wdt_start,
> -	.stop		= sh_wdt_stop,
> -	.ping		= sh_wdt_keepalive,
> -	.set_timeout	= sh_wdt_set_heartbeat,
> -};
> -
> -static struct watchdog_device sh_wdt_dev = {
> -	.info	= &sh_wdt_info,
> -	.ops	= &sh_wdt_ops,
> -};
> -
> -static int sh_wdt_probe(struct platform_device *pdev)
> -{
> -	struct sh_wdt *wdt;
> -	int rc;
> -
> -	/*
> -	 * As this driver only covers the global watchdog case, reject
> -	 * any attempts to register per-CPU watchdogs.
> -	 */
> -	if (pdev->id != -1)
> -		return -EINVAL;
> -
> -	wdt = devm_kzalloc(&pdev->dev, sizeof(struct sh_wdt), GFP_KERNEL);
> -	if (unlikely(!wdt))
> -		return -ENOMEM;
> -
> -	wdt->dev = &pdev->dev;
> -
> -	wdt->clk = devm_clk_get(&pdev->dev, NULL);
> -	if (IS_ERR(wdt->clk)) {
> -		/*
> -		 * Clock framework support is optional, continue on
> -		 * anyways if we don't find a matching clock.
> -		 */
> -		wdt->clk = NULL;
> -	}
> -
> -	wdt->base = devm_platform_ioremap_resource(pdev, 0);
> -	if (IS_ERR(wdt->base))
> -		return PTR_ERR(wdt->base);
> -
> -	watchdog_set_nowayout(&sh_wdt_dev, nowayout);
> -	watchdog_set_drvdata(&sh_wdt_dev, wdt);
> -	sh_wdt_dev.parent = &pdev->dev;
> -
> -	spin_lock_init(&wdt->lock);
> -
> -	rc = sh_wdt_set_heartbeat(&sh_wdt_dev, heartbeat);
> -	if (unlikely(rc)) {
> -		/* Default timeout if invalid */
> -		sh_wdt_set_heartbeat(&sh_wdt_dev, WATCHDOG_HEARTBEAT);
> -
> -		dev_warn(&pdev->dev,
> -			 "heartbeat value must be 1<=x<=3600, using %d\n",
> -			 sh_wdt_dev.timeout);
> -	}
> -
> -	dev_info(&pdev->dev, "configured with heartbeat=%d sec (nowayout=%d)\n",
> -		 sh_wdt_dev.timeout, nowayout);
> -
> -	rc = watchdog_register_device(&sh_wdt_dev);
> -	if (unlikely(rc)) {
> -		dev_err(&pdev->dev, "Can't register watchdog (err=%d)\n", rc);
> -		return rc;
> -	}
> -
> -	timer_setup(&wdt->timer, sh_wdt_ping, 0);
> -	wdt->timer.expires	= next_ping_period(clock_division_ratio);
> -
> -	dev_info(&pdev->dev, "initialized.\n");
> -
> -	pm_runtime_enable(&pdev->dev);
> -
> -	return 0;
> -}
> -
> -static int sh_wdt_remove(struct platform_device *pdev)
> -{
> -	watchdog_unregister_device(&sh_wdt_dev);
> -
> -	pm_runtime_disable(&pdev->dev);
> -
> -	return 0;
> -}
> -
> -static void sh_wdt_shutdown(struct platform_device *pdev)
> -{
> -	sh_wdt_stop(&sh_wdt_dev);
> -}
> -
> -static struct platform_driver sh_wdt_driver = {
> -	.driver		= {
> -		.name	= DRV_NAME,
> -	},
> -
> -	.probe		= sh_wdt_probe,
> -	.remove		= sh_wdt_remove,
> -	.shutdown	= sh_wdt_shutdown,
> -};
> -
> -static int __init sh_wdt_init(void)
> -{
> -	if (unlikely(clock_division_ratio < 0x5 ||
> -		     clock_division_ratio > 0x7)) {
> -		clock_division_ratio = WTCSR_CKS_4096;
> -
> -		pr_info("divisor must be 0x5<=x<=0x7, using %d\n",
> -			clock_division_ratio);
> -	}
> -
> -	return platform_driver_register(&sh_wdt_driver);
> -}
> -
> -static void __exit sh_wdt_exit(void)
> -{
> -	platform_driver_unregister(&sh_wdt_driver);
> -}
> -module_init(sh_wdt_init);
> -module_exit(sh_wdt_exit);
> -
> -MODULE_AUTHOR("Paul Mundt <lethal@linux-sh.org>");
> -MODULE_DESCRIPTION("SuperH watchdog driver");
> -MODULE_LICENSE("GPL");
> -MODULE_ALIAS("platform:" DRV_NAME);
> -
> -module_param(clock_division_ratio, int, 0);
> -MODULE_PARM_DESC(clock_division_ratio,
> -	"Clock division ratio. Valid ranges are from 0x5 (1.31ms) "
> -	"to 0x7 (5.25ms). (default=" __MODULE_STRING(WTCSR_CKS_4096) ")");
> -
> -module_param(heartbeat, int, 0);
> -MODULE_PARM_DESC(heartbeat,
> -	"Watchdog heartbeat in seconds. (1 <= heartbeat <= 3600, default="
> -				__MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
> -
> -module_param(nowayout, bool, 0);
> -MODULE_PARM_DESC(nowayout,
> -	"Watchdog cannot be stopped once started (default="
> -				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");


^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-01-13  6:23 remove arch/sh Christoph Hellwig
                   ` (20 preceding siblings ...)
       [not found] ` <20230113062339.1909087-14-hch@lst.de>
@ 2023-01-13 15:18 ` Rob Herring
  21 siblings, 0 replies; 80+ messages in thread
From: Rob Herring @ 2023-01-13 15:18 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

On Fri, Jan 13, 2023 at 07:23:17AM +0100, Christoph Hellwig wrote:
> Hi all,
> 
> arch/sh has been a long drag because it supports a lot of SOCs, and most
> of them haven't even been converted to device tree infrastructure.  These
> SOCs are generally obsolete as well, and all of the support has been barely
> maintained for almost 10 years, and not at all for more than 1 year.
> 
> Drop arch/sh and everything that depends on it.
> 
> Diffstat:
>  Documentation/sh/booting.rst                             |   12 
>  Documentation/sh/features.rst                            |    3 
>  Documentation/sh/index.rst                               |   56 
>  Documentation/sh/new-machine.rst                         |  277 -
>  Documentation/sh/register-banks.rst                      |   40 

Can you please also remove:

Documentation/devicetree/bindings/mtd/flctl-nand.txt
Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt
Documentation/devicetree/bindings/spi/jcore,spi.txt
Documentation/devicetree/bindings/timer/jcore,pit.txt

Rob

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 04/22] sound: remove sound/sh
  2023-01-13  6:23 ` [PATCH 04/22] sound: remove sound/sh Christoph Hellwig
@ 2023-01-13 16:18   ` Takashi Iwai
  0 siblings, 0 replies; 80+ messages in thread
From: Takashi Iwai @ 2023-01-13 16:18 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	linux-fbdev, Geert Uytterhoeven, linux-sh, alsa-devel, dri-devel,
	linux-mtd, Laurent Pinchart, linux-arch, linux-serial,
	linux-input, linux-media, devicetree, linux-watchdog, linux-gpio,
	netdev, linux-usb, linux-mmc, linux-kernel, linux-spi,
	linux-renesas-soc, Kieran Bingham, linux-i2c, dmaengine,
	linux-rtc

On Fri, 13 Jan 2023 07:23:21 +0100,
Christoph Hellwig wrote:
> 
> Now that arch/sh is removed these drivers are dead code.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Supposed you take in your tree:

Acked-by: Takashi Iwai <tiwai@suse.de>


thanks,

Takashi

> ---
>  sound/Kconfig           |   2 -
>  sound/Makefile          |   2 +-
>  sound/sh/Kconfig        |  32 --
>  sound/sh/Makefile       |  11 -
>  sound/sh/aica.c         | 628 ----------------------------------------
>  sound/sh/aica.h         |  68 -----
>  sound/sh/sh_dac_audio.c | 412 --------------------------
>  7 files changed, 1 insertion(+), 1154 deletions(-)
>  delete mode 100644 sound/sh/Kconfig
>  delete mode 100644 sound/sh/Makefile
>  delete mode 100644 sound/sh/aica.c
>  delete mode 100644 sound/sh/aica.h
>  delete mode 100644 sound/sh/sh_dac_audio.c
> 
> diff --git a/sound/Kconfig b/sound/Kconfig
> index e56d96d2b11cae..14361bb428baa1 100644
> --- a/sound/Kconfig
> +++ b/sound/Kconfig
> @@ -75,8 +75,6 @@ source "sound/spi/Kconfig"
>  
>  source "sound/mips/Kconfig"
>  
> -source "sound/sh/Kconfig"
> -
>  # the following will depend on the order of config.
>  # here assuming USB is defined before ALSA
>  source "sound/usb/Kconfig"
> diff --git a/sound/Makefile b/sound/Makefile
> index 04ef04b1168f39..bb4b8806321c67 100644
> --- a/sound/Makefile
> +++ b/sound/Makefile
> @@ -4,7 +4,7 @@
>  
>  obj-$(CONFIG_SOUND) += soundcore.o
>  obj-$(CONFIG_DMASOUND) += oss/dmasound/
> -obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ synth/ usb/ \
> +obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ synth/ usb/ \
>  	firewire/ sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ hda/ x86/ xen/ \
>  	virtio/
>  obj-$(CONFIG_SND_AOA) += aoa/
> diff --git a/sound/sh/Kconfig b/sound/sh/Kconfig
> deleted file mode 100644
> index b75fbb3236a7b9..00000000000000
> --- a/sound/sh/Kconfig
> +++ /dev/null
> @@ -1,32 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0-only
> -# ALSA SH drivers
> -
> -menuconfig SND_SUPERH
> -	bool "SUPERH sound devices"
> -	depends on SUPERH
> -	default y
> -	help
> -	  Support for sound devices specific to SUPERH architectures.
> -	  Drivers that are implemented on ASoC can be found in
> -	  "ALSA for SoC audio support" section.
> -
> -if SND_SUPERH
> -
> -config SND_AICA
> -	tristate "Dreamcast Yamaha AICA sound"
> -	depends on SH_DREAMCAST
> -	select SND_PCM
> -	select G2_DMA
> -	help
> -	  ALSA Sound driver for the SEGA Dreamcast console.
> -
> -config SND_SH_DAC_AUDIO
> -	tristate "SuperH DAC audio support"
> -	depends on SND
> -	depends on CPU_SH3 && HIGH_RES_TIMERS
> -	select SND_PCM
> -	help
> -	  Say Y here to include support for the on-chip DAC.
> -
> -endif	# SND_SUPERH
> -
> diff --git a/sound/sh/Makefile b/sound/sh/Makefile
> deleted file mode 100644
> index c0bbc500c17c73..00000000000000
> --- a/sound/sh/Makefile
> +++ /dev/null
> @@ -1,11 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0-only
> -#
> -# Makefile for ALSA
> -#
> -
> -snd-aica-objs := aica.o
> -snd-sh_dac_audio-objs := sh_dac_audio.o
> -
> -# Toplevel Module Dependency
> -obj-$(CONFIG_SND_AICA) += snd-aica.o
> -obj-$(CONFIG_SND_SH_DAC_AUDIO) += snd-sh_dac_audio.o
> diff --git a/sound/sh/aica.c b/sound/sh/aica.c
> deleted file mode 100644
> index 6e9d6bd67369af..00000000000000
> --- a/sound/sh/aica.c
> +++ /dev/null
> @@ -1,628 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-only
> -/*
> -*
> -* Copyright Adrian McMenamin 2005, 2006, 2007
> -* <adrian@mcmen.demon.co.uk>
> -* Requires firmware (BSD licenced) available from:
> -* http://linuxdc.cvs.sourceforge.net/linuxdc/linux-sh-dc/sound/oss/aica/firmware/
> -* or the maintainer
> -*/
> -
> -#include <linux/init.h>
> -#include <linux/jiffies.h>
> -#include <linux/slab.h>
> -#include <linux/time.h>
> -#include <linux/wait.h>
> -#include <linux/module.h>
> -#include <linux/platform_device.h>
> -#include <linux/firmware.h>
> -#include <linux/timer.h>
> -#include <linux/delay.h>
> -#include <linux/workqueue.h>
> -#include <linux/io.h>
> -#include <sound/core.h>
> -#include <sound/control.h>
> -#include <sound/pcm.h>
> -#include <sound/initval.h>
> -#include <sound/info.h>
> -#include <asm/dma.h>
> -#include <mach/sysasic.h>
> -#include "aica.h"
> -
> -MODULE_AUTHOR("Adrian McMenamin <adrian@mcmen.demon.co.uk>");
> -MODULE_DESCRIPTION("Dreamcast AICA sound (pcm) driver");
> -MODULE_LICENSE("GPL");
> -MODULE_FIRMWARE("aica_firmware.bin");
> -
> -/* module parameters */
> -#define CARD_NAME "AICA"
> -static int index = -1;
> -static char *id;
> -static bool enable = 1;
> -module_param(index, int, 0444);
> -MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard.");
> -module_param(id, charp, 0444);
> -MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard.");
> -module_param(enable, bool, 0644);
> -MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard.");
> -
> -/* Simple platform device */
> -static struct platform_device *pd;
> -static struct resource aica_memory_space[2] = {
> -	{
> -	 .name = "AICA ARM CONTROL",
> -	 .start = ARM_RESET_REGISTER,
> -	 .flags = IORESOURCE_MEM,
> -	 .end = ARM_RESET_REGISTER + 3,
> -	 },
> -	{
> -	 .name = "AICA Sound RAM",
> -	 .start = SPU_MEMORY_BASE,
> -	 .flags = IORESOURCE_MEM,
> -	 .end = SPU_MEMORY_BASE + 0x200000 - 1,
> -	 },
> -};
> -
> -/* SPU specific functions */
> -/* spu_write_wait - wait for G2-SH FIFO to clear */
> -static void spu_write_wait(void)
> -{
> -	int time_count;
> -	time_count = 0;
> -	while (1) {
> -		if (!(readl(G2_FIFO) & 0x11))
> -			break;
> -		/* To ensure hardware failure doesn't wedge kernel */
> -		time_count++;
> -		if (time_count > 0x10000) {
> -			snd_printk
> -			    ("WARNING: G2 FIFO appears to be blocked.\n");
> -			break;
> -		}
> -	}
> -}
> -
> -/* spu_memset - write to memory in SPU address space */
> -static void spu_memset(u32 toi, u32 what, int length)
> -{
> -	int i;
> -	unsigned long flags;
> -	if (snd_BUG_ON(length % 4))
> -		return;
> -	for (i = 0; i < length; i++) {
> -		if (!(i % 8))
> -			spu_write_wait();
> -		local_irq_save(flags);
> -		writel(what, toi + SPU_MEMORY_BASE);
> -		local_irq_restore(flags);
> -		toi++;
> -	}
> -}
> -
> -/* spu_memload - write to SPU address space */
> -static void spu_memload(u32 toi, const void *from, int length)
> -{
> -	unsigned long flags;
> -	const u32 *froml = from;
> -	u32 __iomem *to = (u32 __iomem *) (SPU_MEMORY_BASE + toi);
> -	int i;
> -	u32 val;
> -	length = DIV_ROUND_UP(length, 4);
> -	spu_write_wait();
> -	for (i = 0; i < length; i++) {
> -		if (!(i % 8))
> -			spu_write_wait();
> -		val = *froml;
> -		local_irq_save(flags);
> -		writel(val, to);
> -		local_irq_restore(flags);
> -		froml++;
> -		to++;
> -	}
> -}
> -
> -/* spu_disable - set spu registers to stop sound output */
> -static void spu_disable(void)
> -{
> -	int i;
> -	unsigned long flags;
> -	u32 regval;
> -	spu_write_wait();
> -	regval = readl(ARM_RESET_REGISTER);
> -	regval |= 1;
> -	spu_write_wait();
> -	local_irq_save(flags);
> -	writel(regval, ARM_RESET_REGISTER);
> -	local_irq_restore(flags);
> -	for (i = 0; i < 64; i++) {
> -		spu_write_wait();
> -		regval = readl(SPU_REGISTER_BASE + (i * 0x80));
> -		regval = (regval & ~0x4000) | 0x8000;
> -		spu_write_wait();
> -		local_irq_save(flags);
> -		writel(regval, SPU_REGISTER_BASE + (i * 0x80));
> -		local_irq_restore(flags);
> -	}
> -}
> -
> -/* spu_enable - set spu registers to enable sound output */
> -static void spu_enable(void)
> -{
> -	unsigned long flags;
> -	u32 regval = readl(ARM_RESET_REGISTER);
> -	regval &= ~1;
> -	spu_write_wait();
> -	local_irq_save(flags);
> -	writel(regval, ARM_RESET_REGISTER);
> -	local_irq_restore(flags);
> -}
> -
> -/* 
> - * Halt the sound processor, clear the memory,
> - * load some default ARM7 code, and then restart ARM7
> -*/
> -static void spu_reset(void)
> -{
> -	unsigned long flags;
> -	spu_disable();
> -	spu_memset(0, 0, 0x200000 / 4);
> -	/* Put ARM7 in endless loop */
> -	local_irq_save(flags);
> -	__raw_writel(0xea000002, SPU_MEMORY_BASE);
> -	local_irq_restore(flags);
> -	spu_enable();
> -}
> -
> -/* aica_chn_start - write to spu to start playback */
> -static void aica_chn_start(void)
> -{
> -	unsigned long flags;
> -	spu_write_wait();
> -	local_irq_save(flags);
> -	writel(AICA_CMD_KICK | AICA_CMD_START, (u32 *) AICA_CONTROL_POINT);
> -	local_irq_restore(flags);
> -}
> -
> -/* aica_chn_halt - write to spu to halt playback */
> -static void aica_chn_halt(void)
> -{
> -	unsigned long flags;
> -	spu_write_wait();
> -	local_irq_save(flags);
> -	writel(AICA_CMD_KICK | AICA_CMD_STOP, (u32 *) AICA_CONTROL_POINT);
> -	local_irq_restore(flags);
> -}
> -
> -/* ALSA code below */
> -static const struct snd_pcm_hardware snd_pcm_aica_playback_hw = {
> -	.info = (SNDRV_PCM_INFO_NONINTERLEAVED),
> -	.formats =
> -	    (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE |
> -	     SNDRV_PCM_FMTBIT_IMA_ADPCM),
> -	.rates = SNDRV_PCM_RATE_8000_48000,
> -	.rate_min = 8000,
> -	.rate_max = 48000,
> -	.channels_min = 1,
> -	.channels_max = 2,
> -	.buffer_bytes_max = AICA_BUFFER_SIZE,
> -	.period_bytes_min = AICA_PERIOD_SIZE,
> -	.period_bytes_max = AICA_PERIOD_SIZE,
> -	.periods_min = AICA_PERIOD_NUMBER,
> -	.periods_max = AICA_PERIOD_NUMBER,
> -};
> -
> -static int aica_dma_transfer(int channels, int buffer_size,
> -			     struct snd_pcm_substream *substream)
> -{
> -	int q, err, period_offset;
> -	struct snd_card_aica *dreamcastcard;
> -	struct snd_pcm_runtime *runtime;
> -	unsigned long flags;
> -	err = 0;
> -	dreamcastcard = substream->pcm->private_data;
> -	period_offset = dreamcastcard->clicks;
> -	period_offset %= (AICA_PERIOD_NUMBER / channels);
> -	runtime = substream->runtime;
> -	for (q = 0; q < channels; q++) {
> -		local_irq_save(flags);
> -		err = dma_xfer(AICA_DMA_CHANNEL,
> -			       (unsigned long) (runtime->dma_area +
> -						(AICA_BUFFER_SIZE * q) /
> -						channels +
> -						AICA_PERIOD_SIZE *
> -						period_offset),
> -			       AICA_CHANNEL0_OFFSET + q * CHANNEL_OFFSET +
> -			       AICA_PERIOD_SIZE * period_offset,
> -			       buffer_size / channels, AICA_DMA_MODE);
> -		if (unlikely(err < 0)) {
> -			local_irq_restore(flags);
> -			break;
> -		}
> -		dma_wait_for_completion(AICA_DMA_CHANNEL);
> -		local_irq_restore(flags);
> -	}
> -	return err;
> -}
> -
> -static void startup_aica(struct snd_card_aica *dreamcastcard)
> -{
> -	spu_memload(AICA_CHANNEL0_CONTROL_OFFSET,
> -		    dreamcastcard->channel, sizeof(struct aica_channel));
> -	aica_chn_start();
> -}
> -
> -static void run_spu_dma(struct work_struct *work)
> -{
> -	int buffer_size;
> -	struct snd_pcm_runtime *runtime;
> -	struct snd_card_aica *dreamcastcard;
> -	dreamcastcard =
> -	    container_of(work, struct snd_card_aica, spu_dma_work);
> -	runtime = dreamcastcard->substream->runtime;
> -	if (unlikely(dreamcastcard->dma_check == 0)) {
> -		buffer_size =
> -		    frames_to_bytes(runtime, runtime->buffer_size);
> -		if (runtime->channels > 1)
> -			dreamcastcard->channel->flags |= 0x01;
> -		aica_dma_transfer(runtime->channels, buffer_size,
> -				  dreamcastcard->substream);
> -		startup_aica(dreamcastcard);
> -		dreamcastcard->clicks =
> -		    buffer_size / (AICA_PERIOD_SIZE * runtime->channels);
> -		return;
> -	} else {
> -		aica_dma_transfer(runtime->channels,
> -				  AICA_PERIOD_SIZE * runtime->channels,
> -				  dreamcastcard->substream);
> -		snd_pcm_period_elapsed(dreamcastcard->substream);
> -		dreamcastcard->clicks++;
> -		if (unlikely(dreamcastcard->clicks >= AICA_PERIOD_NUMBER))
> -			dreamcastcard->clicks %= AICA_PERIOD_NUMBER;
> -		mod_timer(&dreamcastcard->timer, jiffies + 1);
> -	}
> -}
> -
> -static void aica_period_elapsed(struct timer_list *t)
> -{
> -	struct snd_card_aica *dreamcastcard = from_timer(dreamcastcard,
> -							      t, timer);
> -	struct snd_pcm_substream *substream = dreamcastcard->substream;
> -	/*timer function - so cannot sleep */
> -	int play_period;
> -	struct snd_pcm_runtime *runtime;
> -	runtime = substream->runtime;
> -	dreamcastcard = substream->pcm->private_data;
> -	/* Have we played out an additional period? */
> -	play_period =
> -	    frames_to_bytes(runtime,
> -			    readl
> -			    (AICA_CONTROL_CHANNEL_SAMPLE_NUMBER)) /
> -	    AICA_PERIOD_SIZE;
> -	if (play_period == dreamcastcard->current_period) {
> -		/* reschedule the timer */
> -		mod_timer(&(dreamcastcard->timer), jiffies + 1);
> -		return;
> -	}
> -	if (runtime->channels > 1)
> -		dreamcastcard->current_period = play_period;
> -	if (unlikely(dreamcastcard->dma_check == 0))
> -		dreamcastcard->dma_check = 1;
> -	schedule_work(&(dreamcastcard->spu_dma_work));
> -}
> -
> -static void spu_begin_dma(struct snd_pcm_substream *substream)
> -{
> -	struct snd_card_aica *dreamcastcard;
> -	struct snd_pcm_runtime *runtime;
> -	runtime = substream->runtime;
> -	dreamcastcard = substream->pcm->private_data;
> -	/*get the queue to do the work */
> -	schedule_work(&(dreamcastcard->spu_dma_work));
> -	mod_timer(&dreamcastcard->timer, jiffies + 4);
> -}
> -
> -static int snd_aicapcm_pcm_open(struct snd_pcm_substream
> -				*substream)
> -{
> -	struct snd_pcm_runtime *runtime;
> -	struct aica_channel *channel;
> -	struct snd_card_aica *dreamcastcard;
> -	if (!enable)
> -		return -ENOENT;
> -	dreamcastcard = substream->pcm->private_data;
> -	channel = kmalloc(sizeof(struct aica_channel), GFP_KERNEL);
> -	if (!channel)
> -		return -ENOMEM;
> -	/* set defaults for channel */
> -	channel->sfmt = SM_8BIT;
> -	channel->cmd = AICA_CMD_START;
> -	channel->vol = dreamcastcard->master_volume;
> -	channel->pan = 0x80;
> -	channel->pos = 0;
> -	channel->flags = 0;	/* default to mono */
> -	dreamcastcard->channel = channel;
> -	runtime = substream->runtime;
> -	runtime->hw = snd_pcm_aica_playback_hw;
> -	spu_enable();
> -	dreamcastcard->clicks = 0;
> -	dreamcastcard->current_period = 0;
> -	dreamcastcard->dma_check = 0;
> -	return 0;
> -}
> -
> -static int snd_aicapcm_pcm_close(struct snd_pcm_substream
> -				 *substream)
> -{
> -	struct snd_card_aica *dreamcastcard = substream->pcm->private_data;
> -	flush_work(&(dreamcastcard->spu_dma_work));
> -	del_timer(&dreamcastcard->timer);
> -	dreamcastcard->substream = NULL;
> -	kfree(dreamcastcard->channel);
> -	spu_disable();
> -	return 0;
> -}
> -
> -static int snd_aicapcm_pcm_prepare(struct snd_pcm_substream
> -				   *substream)
> -{
> -	struct snd_card_aica *dreamcastcard = substream->pcm->private_data;
> -	if ((substream->runtime)->format == SNDRV_PCM_FORMAT_S16_LE)
> -		dreamcastcard->channel->sfmt = SM_16BIT;
> -	dreamcastcard->channel->freq = substream->runtime->rate;
> -	dreamcastcard->substream = substream;
> -	return 0;
> -}
> -
> -static int snd_aicapcm_pcm_trigger(struct snd_pcm_substream
> -				   *substream, int cmd)
> -{
> -	switch (cmd) {
> -	case SNDRV_PCM_TRIGGER_START:
> -		spu_begin_dma(substream);
> -		break;
> -	case SNDRV_PCM_TRIGGER_STOP:
> -		aica_chn_halt();
> -		break;
> -	default:
> -		return -EINVAL;
> -	}
> -	return 0;
> -}
> -
> -static unsigned long snd_aicapcm_pcm_pointer(struct snd_pcm_substream
> -					     *substream)
> -{
> -	return readl(AICA_CONTROL_CHANNEL_SAMPLE_NUMBER);
> -}
> -
> -static const struct snd_pcm_ops snd_aicapcm_playback_ops = {
> -	.open = snd_aicapcm_pcm_open,
> -	.close = snd_aicapcm_pcm_close,
> -	.prepare = snd_aicapcm_pcm_prepare,
> -	.trigger = snd_aicapcm_pcm_trigger,
> -	.pointer = snd_aicapcm_pcm_pointer,
> -};
> -
> -/* TO DO: set up to handle more than one pcm instance */
> -static int __init snd_aicapcmchip(struct snd_card_aica
> -				  *dreamcastcard, int pcm_index)
> -{
> -	struct snd_pcm *pcm;
> -	int err;
> -	/* AICA has no capture ability */
> -	err =
> -	    snd_pcm_new(dreamcastcard->card, "AICA PCM", pcm_index, 1, 0,
> -			&pcm);
> -	if (unlikely(err < 0))
> -		return err;
> -	pcm->private_data = dreamcastcard;
> -	strcpy(pcm->name, "AICA PCM");
> -	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
> -			&snd_aicapcm_playback_ops);
> -	/* Allocate the DMA buffers */
> -	snd_pcm_set_managed_buffer_all(pcm,
> -				       SNDRV_DMA_TYPE_CONTINUOUS,
> -				       NULL,
> -				       AICA_BUFFER_SIZE,
> -				       AICA_BUFFER_SIZE);
> -	return 0;
> -}
> -
> -/* Mixer controls */
> -#define aica_pcmswitch_info		snd_ctl_boolean_mono_info
> -
> -static int aica_pcmswitch_get(struct snd_kcontrol *kcontrol,
> -			      struct snd_ctl_elem_value *ucontrol)
> -{
> -	ucontrol->value.integer.value[0] = 1;	/* TO DO: Fix me */
> -	return 0;
> -}
> -
> -static int aica_pcmswitch_put(struct snd_kcontrol *kcontrol,
> -			      struct snd_ctl_elem_value *ucontrol)
> -{
> -	if (ucontrol->value.integer.value[0] == 1)
> -		return 0;	/* TO DO: Fix me */
> -	else
> -		aica_chn_halt();
> -	return 0;
> -}
> -
> -static int aica_pcmvolume_info(struct snd_kcontrol *kcontrol,
> -			       struct snd_ctl_elem_info *uinfo)
> -{
> -	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
> -	uinfo->count = 1;
> -	uinfo->value.integer.min = 0;
> -	uinfo->value.integer.max = 0xFF;
> -	return 0;
> -}
> -
> -static int aica_pcmvolume_get(struct snd_kcontrol *kcontrol,
> -			      struct snd_ctl_elem_value *ucontrol)
> -{
> -	struct snd_card_aica *dreamcastcard;
> -	dreamcastcard = kcontrol->private_data;
> -	if (unlikely(!dreamcastcard->channel))
> -		return -ETXTBSY;	/* we've not yet been set up */
> -	ucontrol->value.integer.value[0] = dreamcastcard->channel->vol;
> -	return 0;
> -}
> -
> -static int aica_pcmvolume_put(struct snd_kcontrol *kcontrol,
> -			      struct snd_ctl_elem_value *ucontrol)
> -{
> -	struct snd_card_aica *dreamcastcard;
> -	unsigned int vol;
> -	dreamcastcard = kcontrol->private_data;
> -	if (unlikely(!dreamcastcard->channel))
> -		return -ETXTBSY;
> -	vol = ucontrol->value.integer.value[0];
> -	if (vol > 0xff)
> -		return -EINVAL;
> -	if (unlikely(dreamcastcard->channel->vol == vol))
> -		return 0;
> -	dreamcastcard->channel->vol = ucontrol->value.integer.value[0];
> -	dreamcastcard->master_volume = ucontrol->value.integer.value[0];
> -	spu_memload(AICA_CHANNEL0_CONTROL_OFFSET,
> -		    dreamcastcard->channel, sizeof(struct aica_channel));
> -	return 1;
> -}
> -
> -static const struct snd_kcontrol_new snd_aica_pcmswitch_control = {
> -	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
> -	.name = "PCM Playback Switch",
> -	.index = 0,
> -	.info = aica_pcmswitch_info,
> -	.get = aica_pcmswitch_get,
> -	.put = aica_pcmswitch_put
> -};
> -
> -static const struct snd_kcontrol_new snd_aica_pcmvolume_control = {
> -	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
> -	.name = "PCM Playback Volume",
> -	.index = 0,
> -	.info = aica_pcmvolume_info,
> -	.get = aica_pcmvolume_get,
> -	.put = aica_pcmvolume_put
> -};
> -
> -static int load_aica_firmware(void)
> -{
> -	int err;
> -	const struct firmware *fw_entry;
> -	spu_reset();
> -	err = request_firmware(&fw_entry, "aica_firmware.bin", &pd->dev);
> -	if (unlikely(err))
> -		return err;
> -	/* write firmware into memory */
> -	spu_disable();
> -	spu_memload(0, fw_entry->data, fw_entry->size);
> -	spu_enable();
> -	release_firmware(fw_entry);
> -	return err;
> -}
> -
> -static int add_aicamixer_controls(struct snd_card_aica *dreamcastcard)
> -{
> -	int err;
> -	err = snd_ctl_add
> -	    (dreamcastcard->card,
> -	     snd_ctl_new1(&snd_aica_pcmvolume_control, dreamcastcard));
> -	if (unlikely(err < 0))
> -		return err;
> -	err = snd_ctl_add
> -	    (dreamcastcard->card,
> -	     snd_ctl_new1(&snd_aica_pcmswitch_control, dreamcastcard));
> -	if (unlikely(err < 0))
> -		return err;
> -	return 0;
> -}
> -
> -static int snd_aica_remove(struct platform_device *devptr)
> -{
> -	struct snd_card_aica *dreamcastcard;
> -	dreamcastcard = platform_get_drvdata(devptr);
> -	if (unlikely(!dreamcastcard))
> -		return -ENODEV;
> -	snd_card_free(dreamcastcard->card);
> -	kfree(dreamcastcard);
> -	return 0;
> -}
> -
> -static int snd_aica_probe(struct platform_device *devptr)
> -{
> -	int err;
> -	struct snd_card_aica *dreamcastcard;
> -	dreamcastcard = kzalloc(sizeof(struct snd_card_aica), GFP_KERNEL);
> -	if (unlikely(!dreamcastcard))
> -		return -ENOMEM;
> -	err = snd_card_new(&devptr->dev, index, SND_AICA_DRIVER,
> -			   THIS_MODULE, 0, &dreamcastcard->card);
> -	if (unlikely(err < 0)) {
> -		kfree(dreamcastcard);
> -		return err;
> -	}
> -	strcpy(dreamcastcard->card->driver, "snd_aica");
> -	strcpy(dreamcastcard->card->shortname, SND_AICA_DRIVER);
> -	strcpy(dreamcastcard->card->longname,
> -	       "Yamaha AICA Super Intelligent Sound Processor for SEGA Dreamcast");
> -	/* Prepare to use the queue */
> -	INIT_WORK(&(dreamcastcard->spu_dma_work), run_spu_dma);
> -	timer_setup(&dreamcastcard->timer, aica_period_elapsed, 0);
> -	/* Load the PCM 'chip' */
> -	err = snd_aicapcmchip(dreamcastcard, 0);
> -	if (unlikely(err < 0))
> -		goto freedreamcast;
> -	/* Add basic controls */
> -	err = add_aicamixer_controls(dreamcastcard);
> -	if (unlikely(err < 0))
> -		goto freedreamcast;
> -	/* Register the card with ALSA subsystem */
> -	err = snd_card_register(dreamcastcard->card);
> -	if (unlikely(err < 0))
> -		goto freedreamcast;
> -	platform_set_drvdata(devptr, dreamcastcard);
> -	snd_printk
> -	    ("ALSA Driver for Yamaha AICA Super Intelligent Sound Processor\n");
> -	return 0;
> -      freedreamcast:
> -	snd_card_free(dreamcastcard->card);
> -	kfree(dreamcastcard);
> -	return err;
> -}
> -
> -static struct platform_driver snd_aica_driver = {
> -	.probe = snd_aica_probe,
> -	.remove = snd_aica_remove,
> -	.driver = {
> -		.name = SND_AICA_DRIVER,
> -	},
> -};
> -
> -static int __init aica_init(void)
> -{
> -	int err;
> -	err = platform_driver_register(&snd_aica_driver);
> -	if (unlikely(err < 0))
> -		return err;
> -	pd = platform_device_register_simple(SND_AICA_DRIVER, -1,
> -					     aica_memory_space, 2);
> -	if (IS_ERR(pd)) {
> -		platform_driver_unregister(&snd_aica_driver);
> -		return PTR_ERR(pd);
> -	}
> -	/* Load the firmware */
> -	return load_aica_firmware();
> -}
> -
> -static void __exit aica_exit(void)
> -{
> -	platform_device_unregister(pd);
> -	platform_driver_unregister(&snd_aica_driver);
> -	/* Kill any sound still playing and reset ARM7 to safe state */
> -	spu_reset();
> -}
> -
> -module_init(aica_init);
> -module_exit(aica_exit);
> diff --git a/sound/sh/aica.h b/sound/sh/aica.h
> deleted file mode 100644
> index 021b132e088e82..00000000000000
> --- a/sound/sh/aica.h
> +++ /dev/null
> @@ -1,68 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0-only */
> -/* aica.h
> - * Header file for ALSA driver for
> - * Sega Dreamcast Yamaha AICA sound
> - * Copyright Adrian McMenamin
> - * <adrian@mcmen.demon.co.uk>
> - * 2006
> - */
> -
> -/* SPU memory and register constants etc */
> -#define G2_FIFO 0xa05f688c
> -#define SPU_MEMORY_BASE 0xA0800000
> -#define ARM_RESET_REGISTER 0xA0702C00
> -#define SPU_REGISTER_BASE 0xA0700000
> -
> -/* AICA channels stuff */
> -#define AICA_CONTROL_POINT 0xA0810000
> -#define AICA_CONTROL_CHANNEL_SAMPLE_NUMBER 0xA0810008
> -#define AICA_CHANNEL0_CONTROL_OFFSET 0x10004
> -
> -/* Command values */
> -#define AICA_CMD_KICK 0x80000000
> -#define AICA_CMD_NONE 0
> -#define AICA_CMD_START 1
> -#define AICA_CMD_STOP 2
> -#define AICA_CMD_VOL 3
> -
> -/* Sound modes */
> -#define SM_8BIT		1
> -#define SM_16BIT	0
> -#define SM_ADPCM	2
> -
> -/* Buffer and period size */
> -#define AICA_BUFFER_SIZE 0x8000
> -#define AICA_PERIOD_SIZE 0x800
> -#define AICA_PERIOD_NUMBER 16
> -
> -#define AICA_CHANNEL0_OFFSET 0x11000
> -#define AICA_CHANNEL1_OFFSET 0x21000
> -#define CHANNEL_OFFSET 0x10000
> -
> -#define AICA_DMA_CHANNEL 5
> -#define AICA_DMA_MODE 5
> -
> -#define SND_AICA_DRIVER "AICA"
> -
> -struct aica_channel {
> -	uint32_t cmd;		/* Command ID           */
> -	uint32_t pos;		/* Sample position      */
> -	uint32_t length;	/* Sample length        */
> -	uint32_t freq;		/* Frequency            */
> -	uint32_t vol;		/* Volume 0-255         */
> -	uint32_t pan;		/* Pan 0-255            */
> -	uint32_t sfmt;		/* Sound format         */
> -	uint32_t flags;		/* Bit flags            */
> -};
> -
> -struct snd_card_aica {
> -	struct work_struct spu_dma_work;
> -	struct snd_card *card;
> -	struct aica_channel *channel;
> -	struct snd_pcm_substream *substream;
> -	int clicks;
> -	int current_period;
> -	struct timer_list timer;
> -	int master_volume;
> -	int dma_check;
> -};
> diff --git a/sound/sh/sh_dac_audio.c b/sound/sh/sh_dac_audio.c
> deleted file mode 100644
> index 8ebd972846acb5..00000000000000
> --- a/sound/sh/sh_dac_audio.c
> +++ /dev/null
> @@ -1,412 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> -/*
> - * sh_dac_audio.c - SuperH DAC audio driver for ALSA
> - *
> - * Copyright (c) 2009 by Rafael Ignacio Zurita <rizurita@yahoo.com>
> - *
> - * Based on sh_dac_audio.c (Copyright (C) 2004, 2005 by Andriy Skulysh)
> - */
> -
> -#include <linux/hrtimer.h>
> -#include <linux/interrupt.h>
> -#include <linux/io.h>
> -#include <linux/platform_device.h>
> -#include <linux/slab.h>
> -#include <linux/module.h>
> -#include <sound/core.h>
> -#include <sound/initval.h>
> -#include <sound/pcm.h>
> -#include <sound/sh_dac_audio.h>
> -#include <asm/clock.h>
> -#include <asm/hd64461.h>
> -#include <mach/hp6xx.h>
> -#include <cpu/dac.h>
> -
> -MODULE_AUTHOR("Rafael Ignacio Zurita <rizurita@yahoo.com>");
> -MODULE_DESCRIPTION("SuperH DAC audio driver");
> -MODULE_LICENSE("GPL");
> -
> -/* Module Parameters */
> -static int index = SNDRV_DEFAULT_IDX1;
> -static char *id = SNDRV_DEFAULT_STR1;
> -module_param(index, int, 0444);
> -MODULE_PARM_DESC(index, "Index value for SuperH DAC audio.");
> -module_param(id, charp, 0444);
> -MODULE_PARM_DESC(id, "ID string for SuperH DAC audio.");
> -
> -/* main struct */
> -struct snd_sh_dac {
> -	struct snd_card *card;
> -	struct snd_pcm_substream *substream;
> -	struct hrtimer hrtimer;
> -	ktime_t wakeups_per_second;
> -
> -	int rate;
> -	int empty;
> -	char *data_buffer, *buffer_begin, *buffer_end;
> -	int processed; /* bytes proccesed, to compare with period_size */
> -	int buffer_size;
> -	struct dac_audio_pdata *pdata;
> -};
> -
> -
> -static void dac_audio_start_timer(struct snd_sh_dac *chip)
> -{
> -	hrtimer_start(&chip->hrtimer, chip->wakeups_per_second,
> -		      HRTIMER_MODE_REL);
> -}
> -
> -static void dac_audio_stop_timer(struct snd_sh_dac *chip)
> -{
> -	hrtimer_cancel(&chip->hrtimer);
> -}
> -
> -static void dac_audio_reset(struct snd_sh_dac *chip)
> -{
> -	dac_audio_stop_timer(chip);
> -	chip->buffer_begin = chip->buffer_end = chip->data_buffer;
> -	chip->processed = 0;
> -	chip->empty = 1;
> -}
> -
> -static void dac_audio_set_rate(struct snd_sh_dac *chip)
> -{
> -	chip->wakeups_per_second = 1000000000 / chip->rate;
> -}
> -
> -
> -/* PCM INTERFACE */
> -
> -static const struct snd_pcm_hardware snd_sh_dac_pcm_hw = {
> -	.info			= (SNDRV_PCM_INFO_MMAP |
> -					SNDRV_PCM_INFO_MMAP_VALID |
> -					SNDRV_PCM_INFO_INTERLEAVED |
> -					SNDRV_PCM_INFO_HALF_DUPLEX),
> -	.formats		= SNDRV_PCM_FMTBIT_U8,
> -	.rates			= SNDRV_PCM_RATE_8000,
> -	.rate_min		= 8000,
> -	.rate_max		= 8000,
> -	.channels_min		= 1,
> -	.channels_max		= 1,
> -	.buffer_bytes_max	= (48*1024),
> -	.period_bytes_min	= 1,
> -	.period_bytes_max	= (48*1024),
> -	.periods_min		= 1,
> -	.periods_max		= 1024,
> -};
> -
> -static int snd_sh_dac_pcm_open(struct snd_pcm_substream *substream)
> -{
> -	struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
> -	struct snd_pcm_runtime *runtime = substream->runtime;
> -
> -	runtime->hw = snd_sh_dac_pcm_hw;
> -
> -	chip->substream = substream;
> -	chip->buffer_begin = chip->buffer_end = chip->data_buffer;
> -	chip->processed = 0;
> -	chip->empty = 1;
> -
> -	chip->pdata->start(chip->pdata);
> -
> -	return 0;
> -}
> -
> -static int snd_sh_dac_pcm_close(struct snd_pcm_substream *substream)
> -{
> -	struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
> -
> -	chip->substream = NULL;
> -
> -	dac_audio_stop_timer(chip);
> -	chip->pdata->stop(chip->pdata);
> -
> -	return 0;
> -}
> -
> -static int snd_sh_dac_pcm_prepare(struct snd_pcm_substream *substream)
> -{
> -	struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
> -	struct snd_pcm_runtime *runtime = chip->substream->runtime;
> -
> -	chip->buffer_size = runtime->buffer_size;
> -	memset(chip->data_buffer, 0, chip->pdata->buffer_size);
> -
> -	return 0;
> -}
> -
> -static int snd_sh_dac_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
> -{
> -	struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
> -
> -	switch (cmd) {
> -	case SNDRV_PCM_TRIGGER_START:
> -		dac_audio_start_timer(chip);
> -		break;
> -	case SNDRV_PCM_TRIGGER_STOP:
> -		chip->buffer_begin = chip->buffer_end = chip->data_buffer;
> -		chip->processed = 0;
> -		chip->empty = 1;
> -		dac_audio_stop_timer(chip);
> -		break;
> -	default:
> -		 return -EINVAL;
> -	}
> -
> -	return 0;
> -}
> -
> -static int snd_sh_dac_pcm_copy(struct snd_pcm_substream *substream,
> -			       int channel, unsigned long pos,
> -			       void __user *src, unsigned long count)
> -{
> -	/* channel is not used (interleaved data) */
> -	struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
> -
> -	if (copy_from_user_toio(chip->data_buffer + pos, src, count))
> -		return -EFAULT;
> -	chip->buffer_end = chip->data_buffer + pos + count;
> -
> -	if (chip->empty) {
> -		chip->empty = 0;
> -		dac_audio_start_timer(chip);
> -	}
> -
> -	return 0;
> -}
> -
> -static int snd_sh_dac_pcm_copy_kernel(struct snd_pcm_substream *substream,
> -				      int channel, unsigned long pos,
> -				      void *src, unsigned long count)
> -{
> -	/* channel is not used (interleaved data) */
> -	struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
> -
> -	memcpy_toio(chip->data_buffer + pos, src, count);
> -	chip->buffer_end = chip->data_buffer + pos + count;
> -
> -	if (chip->empty) {
> -		chip->empty = 0;
> -		dac_audio_start_timer(chip);
> -	}
> -
> -	return 0;
> -}
> -
> -static int snd_sh_dac_pcm_silence(struct snd_pcm_substream *substream,
> -				  int channel, unsigned long pos,
> -				  unsigned long count)
> -{
> -	/* channel is not used (interleaved data) */
> -	struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
> -
> -	memset_io(chip->data_buffer + pos, 0, count);
> -	chip->buffer_end = chip->data_buffer + pos + count;
> -
> -	if (chip->empty) {
> -		chip->empty = 0;
> -		dac_audio_start_timer(chip);
> -	}
> -
> -	return 0;
> -}
> -
> -static
> -snd_pcm_uframes_t snd_sh_dac_pcm_pointer(struct snd_pcm_substream *substream)
> -{
> -	struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
> -	int pointer = chip->buffer_begin - chip->data_buffer;
> -
> -	return pointer;
> -}
> -
> -/* pcm ops */
> -static const struct snd_pcm_ops snd_sh_dac_pcm_ops = {
> -	.open		= snd_sh_dac_pcm_open,
> -	.close		= snd_sh_dac_pcm_close,
> -	.prepare	= snd_sh_dac_pcm_prepare,
> -	.trigger	= snd_sh_dac_pcm_trigger,
> -	.pointer	= snd_sh_dac_pcm_pointer,
> -	.copy_user	= snd_sh_dac_pcm_copy,
> -	.copy_kernel	= snd_sh_dac_pcm_copy_kernel,
> -	.fill_silence	= snd_sh_dac_pcm_silence,
> -	.mmap		= snd_pcm_lib_mmap_iomem,
> -};
> -
> -static int snd_sh_dac_pcm(struct snd_sh_dac *chip, int device)
> -{
> -	int err;
> -	struct snd_pcm *pcm;
> -
> -	/* device should be always 0 for us */
> -	err = snd_pcm_new(chip->card, "SH_DAC PCM", device, 1, 0, &pcm);
> -	if (err < 0)
> -		return err;
> -
> -	pcm->private_data = chip;
> -	strcpy(pcm->name, "SH_DAC PCM");
> -	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sh_dac_pcm_ops);
> -
> -	/* buffer size=48K */
> -	snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
> -				       NULL, 48 * 1024, 48 * 1024);
> -
> -	return 0;
> -}
> -/* END OF PCM INTERFACE */
> -
> -
> -/* driver .remove  --  destructor */
> -static int snd_sh_dac_remove(struct platform_device *devptr)
> -{
> -	snd_card_free(platform_get_drvdata(devptr));
> -	return 0;
> -}
> -
> -/* free -- it has been defined by create */
> -static int snd_sh_dac_free(struct snd_sh_dac *chip)
> -{
> -	/* release the data */
> -	kfree(chip->data_buffer);
> -	kfree(chip);
> -
> -	return 0;
> -}
> -
> -static int snd_sh_dac_dev_free(struct snd_device *device)
> -{
> -	struct snd_sh_dac *chip = device->device_data;
> -
> -	return snd_sh_dac_free(chip);
> -}
> -
> -static enum hrtimer_restart sh_dac_audio_timer(struct hrtimer *handle)
> -{
> -	struct snd_sh_dac *chip = container_of(handle, struct snd_sh_dac,
> -					       hrtimer);
> -	struct snd_pcm_runtime *runtime = chip->substream->runtime;
> -	ssize_t b_ps = frames_to_bytes(runtime, runtime->period_size);
> -
> -	if (!chip->empty) {
> -		sh_dac_output(*chip->buffer_begin, chip->pdata->channel);
> -		chip->buffer_begin++;
> -
> -		chip->processed++;
> -		if (chip->processed >= b_ps) {
> -			chip->processed -= b_ps;
> -			snd_pcm_period_elapsed(chip->substream);
> -		}
> -
> -		if (chip->buffer_begin == (chip->data_buffer +
> -					   chip->buffer_size - 1))
> -			chip->buffer_begin = chip->data_buffer;
> -
> -		if (chip->buffer_begin == chip->buffer_end)
> -			chip->empty = 1;
> -
> -	}
> -
> -	if (!chip->empty)
> -		hrtimer_start(&chip->hrtimer, chip->wakeups_per_second,
> -			      HRTIMER_MODE_REL);
> -
> -	return HRTIMER_NORESTART;
> -}
> -
> -/* create  --  chip-specific constructor for the cards components */
> -static int snd_sh_dac_create(struct snd_card *card,
> -			     struct platform_device *devptr,
> -			     struct snd_sh_dac **rchip)
> -{
> -	struct snd_sh_dac *chip;
> -	int err;
> -
> -	static const struct snd_device_ops ops = {
> -		   .dev_free = snd_sh_dac_dev_free,
> -	};
> -
> -	*rchip = NULL;
> -
> -	chip = kzalloc(sizeof(*chip), GFP_KERNEL);
> -	if (chip == NULL)
> -		return -ENOMEM;
> -
> -	chip->card = card;
> -
> -	hrtimer_init(&chip->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
> -	chip->hrtimer.function = sh_dac_audio_timer;
> -
> -	dac_audio_reset(chip);
> -	chip->rate = 8000;
> -	dac_audio_set_rate(chip);
> -
> -	chip->pdata = devptr->dev.platform_data;
> -
> -	chip->data_buffer = kmalloc(chip->pdata->buffer_size, GFP_KERNEL);
> -	if (chip->data_buffer == NULL) {
> -		kfree(chip);
> -		return -ENOMEM;
> -	}
> -
> -	err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
> -	if (err < 0) {
> -		snd_sh_dac_free(chip);
> -		return err;
> -	}
> -
> -	*rchip = chip;
> -
> -	return 0;
> -}
> -
> -/* driver .probe  --  constructor */
> -static int snd_sh_dac_probe(struct platform_device *devptr)
> -{
> -	struct snd_sh_dac *chip;
> -	struct snd_card *card;
> -	int err;
> -
> -	err = snd_card_new(&devptr->dev, index, id, THIS_MODULE, 0, &card);
> -	if (err < 0) {
> -			snd_printk(KERN_ERR "cannot allocate the card\n");
> -			return err;
> -	}
> -
> -	err = snd_sh_dac_create(card, devptr, &chip);
> -	if (err < 0)
> -		goto probe_error;
> -
> -	err = snd_sh_dac_pcm(chip, 0);
> -	if (err < 0)
> -		goto probe_error;
> -
> -	strcpy(card->driver, "snd_sh_dac");
> -	strcpy(card->shortname, "SuperH DAC audio driver");
> -	printk(KERN_INFO "%s %s", card->longname, card->shortname);
> -
> -	err = snd_card_register(card);
> -	if (err < 0)
> -		goto probe_error;
> -
> -	snd_printk(KERN_INFO "ALSA driver for SuperH DAC audio");
> -
> -	platform_set_drvdata(devptr, card);
> -	return 0;
> -
> -probe_error:
> -	snd_card_free(card);
> -	return err;
> -}
> -
> -/*
> - * "driver" definition
> - */
> -static struct platform_driver sh_dac_driver = {
> -	.probe	= snd_sh_dac_probe,
> -	.remove = snd_sh_dac_remove,
> -	.driver = {
> -		.name = "dac_audio",
> -	},
> -};
> -
> -module_platform_driver(sh_dac_driver);
> -- 
> 2.39.0
> 

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-01-13 19:11       ` Rob Landley
@ 2023-01-13 19:05         ` John Paul Adrian Glaubitz
  2023-01-13 23:32           ` Rob Landley
  0 siblings, 1 reply; 80+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-01-13 19:05 UTC (permalink / raw)
  To: Rob Landley, Geert Uytterhoeven
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, Laurent Pinchart, Kieran Bingham,
	Geert Uytterhoeven, linux-kernel, linux-watchdog, devicetree,
	linux-arch, dmaengine, dri-devel, linux-renesas-soc, linux-i2c,
	linux-input, linux-media, linux-mmc, linux-mtd, netdev,
	linux-gpio, linux-rtc, linux-spi, linux-serial, linux-usb,
	linux-fbdev, alsa-devel, linux-sh

Hi Rob!

On 1/13/23 20:11, Rob Landley wrote:
>> I actually would be willing to do it but I'm a bit hesitant as I'm not 100%
>> sure my skills are sufficient. Maybe if someone can assist me?
> 
> My skills aren't sufficient and I dunno how much time I have, but I can
> certainly assist. I test sh4 regularlyish and it's in the list of architectures
> I ship binaries and tiny VM images for, just refreshed tuesday:
> 
> https://landley.net/toybox/downloads/binaries/0.8.9/
> https://landley.net/toybox/downloads/binaries/mkroot/0.8.9/
> 
> (The sh2eb isn't a VM, it's a physical board I have here...)
> 
> There is definitely interest in this architecture. I'm aware Rich hasn't been
> the most responsive maintainer. (I'm told he's on vacation with his family at
> the moment, according to the text I got about this issue from the J-core
> hardware guys in Japan.)

Well, maybe we can just give it a try together ...

> The main reason we haven't converted everything to device tree is we only have
> access to test hardware for a subset of the boards. Pruning the list of
> supported boards and converting the rest to device tree might make sense. We can
> always add/convert boards back later...

There is a patch by Yoshinori Sato which adds device tree support to SH. Maybe we
can revive it.

Adrian

-- 
  .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
   `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-01-13  8:52     ` John Paul Adrian Glaubitz
@ 2023-01-13 19:11       ` Rob Landley
  2023-01-13 19:05         ` John Paul Adrian Glaubitz
  0 siblings, 1 reply; 80+ messages in thread
From: Rob Landley @ 2023-01-13 19:11 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz, Geert Uytterhoeven
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, Laurent Pinchart, Kieran Bingham,
	Geert Uytterhoeven, linux-kernel, linux-watchdog, devicetree,
	linux-arch, dmaengine, dri-devel, linux-renesas-soc, linux-i2c,
	linux-input, linux-media, linux-mmc, linux-mtd, netdev,
	linux-gpio, linux-rtc, linux-spi, linux-serial, linux-usb,
	linux-fbdev, alsa-devel, linux-sh

On 1/13/23 02:52, John Paul Adrian Glaubitz wrote:
> Hi Geert!
> 
> On 1/13/23 09:26, Geert Uytterhoeven wrote:
>> Indeed.  The main issue is not the lack of people sending patches and
>> fixes, but those patches never being applied by the maintainers.
>> Perhaps someone is willing to stand up to take over maintainership?
> 
> I actually would be willing to do it but I'm a bit hesitant as I'm not 100%
> sure my skills are sufficient. Maybe if someone can assist me?

My skills aren't sufficient and I dunno how much time I have, but I can
certainly assist. I test sh4 regularlyish and it's in the list of architectures
I ship binaries and tiny VM images for, just refreshed tuesday:

https://landley.net/toybox/downloads/binaries/0.8.9/
https://landley.net/toybox/downloads/binaries/mkroot/0.8.9/

(The sh2eb isn't a VM, it's a physical board I have here...)

There is definitely interest in this architecture. I'm aware Rich hasn't been
the most responsive maintainer. (I'm told he's on vacation with his family at
the moment, according to the text I got about this issue from the J-core
hardware guys in Japan.)

The main reason we haven't converted everything to device tree is we only have
access to test hardware for a subset of the boards. Pruning the list of
supported boards and converting the rest to device tree might make sense. We can
always add/convert boards back later...

Rob

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-01-13 19:05         ` John Paul Adrian Glaubitz
@ 2023-01-13 23:32           ` Rob Landley
  0 siblings, 0 replies; 80+ messages in thread
From: Rob Landley @ 2023-01-13 23:32 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz, Geert Uytterhoeven
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, Laurent Pinchart, Kieran Bingham,
	Geert Uytterhoeven, linux-kernel, linux-watchdog, devicetree,
	linux-arch, dmaengine, dri-devel, linux-renesas-soc, linux-i2c,
	linux-input, linux-media, linux-mmc, linux-mtd, netdev,
	linux-gpio, linux-rtc, linux-spi, linux-serial, linux-usb,
	linux-fbdev, alsa-devel, linux-sh

On 1/13/23 13:05, John Paul Adrian Glaubitz wrote:
> Hi Rob!
> 
> On 1/13/23 20:11, Rob Landley wrote:
>> There is definitely interest in this architecture. I'm aware Rich hasn't been
>> the most responsive maintainer. (I'm told he's on vacation with his family at
>> the moment, according to the text I got about this issue from the J-core
>> hardware guys in Japan.)
> 
> Well, maybe we can just give it a try together ...

Jeff Dionne said he'd make himself available to answer hardware questions. (He
said he maintained some Linux ports 20 years ago, but isn't current with Linux
plumbing. Last month he was digging through the guts of vxworks, and the project
before that was some sort of BSD I think?)

I _do_ maintain Linux patches, I just generally don't bother to repost them
endlessly. Here's my "on top of 6.1" stack for example, each of which links to
at least one time it was posted to linux-kernel:

https://landley.net/toybox/downloads/binaries/mkroot/0.8.9/linux-patches/

>> The main reason we haven't converted everything to device tree is we only have
>> access to test hardware for a subset of the boards. Pruning the list of
>> supported boards and converting the rest to device tree might make sense. We can
>> always add/convert boards back later...
> 
> There is a patch by Yoshinori Sato which adds device tree support to SH. Maybe we
> can revive it.

The turtle board is device tree and has been since it was merged. The
infrastructure is there, the question is converting over boards and testing
them, or deciding to prune them. Did Sato-san convert many boards? (I'm not
finding his patch via google...)

> Adrian

Rob

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 02/22] usb: remove the dead USB_OHCI_SH option
  2023-01-13  7:12   ` Greg Kroah-Hartman
  2023-01-13  7:14     ` Christoph Hellwig
@ 2023-01-15  0:55     ` Rob Landley
  2023-02-03  7:15     ` Christoph Hellwig
  2 siblings, 0 replies; 80+ messages in thread
From: Rob Landley @ 2023-01-15  0:55 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Laurent Pinchart,
	Kieran Bingham, Geert Uytterhoeven, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh



On 1/13/23 01:12, Greg Kroah-Hartman wrote:
> On Fri, Jan 13, 2023 at 07:23:19AM +0100, Christoph Hellwig wrote:
>> USB_OHCI_SH is a dummy option that never builds any code, remove it.
>> 
>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>> ---
>>  drivers/usb/host/Kconfig | 11 -----------
>>  1 file changed, 11 deletions(-)
>> 
>> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
>> index 8d799d23c476e1..ca5f657c092cf4 100644
>> --- a/drivers/usb/host/Kconfig
>> +++ b/drivers/usb/host/Kconfig
>> @@ -548,17 +548,6 @@ config USB_OHCI_HCD_SSB
>>  
>>  	  If unsure, say N.
>>  
>> -config USB_OHCI_SH
>> -	bool "OHCI support for SuperH USB controller (DEPRECATED)"
>> -	depends on SUPERH || COMPILE_TEST
>> -	select USB_OHCI_HCD_PLATFORM
>> -	help
>> -	  This option is deprecated now and the driver was removed, use
>> -	  USB_OHCI_HCD_PLATFORM instead.
>> -
>> -	  Enables support for the on-chip OHCI controller on the SuperH.
>> -	  If you use the PCI OHCI controller, this option is not necessary.
>> -
>>  config USB_OHCI_EXYNOS
>>  	tristate "OHCI support for Samsung S5P/Exynos SoC Series"
>>  	depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
>> -- 
>> 2.39.0
>> 
> 
> Do you want all of these to go through a single tree, or can they go
> through the different driver subsystem trees?

Neither please. Multiple people are objecting.

Rob

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-01-13  8:09 ` remove arch/sh John Paul Adrian Glaubitz
  2023-01-13  8:26   ` Geert Uytterhoeven
@ 2023-01-16  7:13   ` Christoph Hellwig
  2023-01-16  8:52     ` John Paul Adrian Glaubitz
  2023-01-17 19:13     ` Rob Landley
  1 sibling, 2 replies; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-16  7:13 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, Laurent Pinchart, Kieran Bingham,
	Geert Uytterhoeven, linux-kernel, linux-watchdog, devicetree,
	linux-arch, dmaengine, dri-devel, linux-renesas-soc, linux-i2c,
	linux-input, linux-media, linux-mmc, linux-mtd, netdev,
	linux-gpio, linux-rtc, linux-spi, linux-serial, linux-usb,
	linux-fbdev, alsa-devel, linux-sh

On Fri, Jan 13, 2023 at 09:09:52AM +0100, John Paul Adrian Glaubitz wrote:
> I'm still maintaining and using this port in Debian.
>
> It's a bit disappointing that people keep hammering on it. It works fine for me.

What platforms do you (or your users) use it on?

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-01-13  8:26   ` Geert Uytterhoeven
  2023-01-13  8:52     ` John Paul Adrian Glaubitz
@ 2023-01-16  7:14     ` Christoph Hellwig
  1 sibling, 0 replies; 80+ messages in thread
From: Christoph Hellwig @ 2023-01-16  7:14 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: John Paul Adrian Glaubitz, Christoph Hellwig, Yoshinori Sato,
	Rich Felker, Arnd Bergmann, Greg Kroah-Hartman, Laurent Pinchart,
	Kieran Bingham, Geert Uytterhoeven, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

On Fri, Jan 13, 2023 at 09:26:23AM +0100, Geert Uytterhoeven wrote:
> Indeed.  The main issue is not the lack of people sending patches and
> fixes, but those patches never being applied by the maintainers.
> Perhaps someone is willing to stand up to take over maintainership?

The other problem is that it hasn't a DT conversion, and there are
lot of crufty platforms, and crufty hooks in various drivers and
core code.

It's been mentioned a few times that it might be time to go to a minimal
DT only port and then regrow what people are actually using, but for
that we need indiciations of what people are actually using.

And yes, it does need a proper maintainer, and some actual maintainer
option like cutting down unused machine support.

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-01-16  7:13   ` Christoph Hellwig
@ 2023-01-16  8:52     ` John Paul Adrian Glaubitz
  2023-02-03  7:14       ` Christoph Hellwig
  2023-01-17 19:13     ` Rob Landley
  1 sibling, 1 reply; 80+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-01-16  8:52 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Hello Christoph!

On 1/16/23 08:13, Christoph Hellwig wrote:
> On Fri, Jan 13, 2023 at 09:09:52AM +0100, John Paul Adrian Glaubitz wrote:
>> I'm still maintaining and using this port in Debian.
>>
>> It's a bit disappointing that people keep hammering on it. It works fine for me.
> 
> What platforms do you (or your users) use it on?

We have had a discussion between multiple people invested in the SuperH port and
I have decided to volunteer as a co-maintainer of the port to support Rich Felker
when he isn't available.

Adrian

-- 
  .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
   `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-01-16  7:13   ` Christoph Hellwig
  2023-01-16  8:52     ` John Paul Adrian Glaubitz
@ 2023-01-17 19:13     ` Rob Landley
  2023-01-17 20:26       ` Geert Uytterhoeven
  1 sibling, 1 reply; 80+ messages in thread
From: Rob Landley @ 2023-01-17 19:13 UTC (permalink / raw)
  To: Christoph Hellwig, John Paul Adrian Glaubitz
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

On 1/16/23 01:13, Christoph Hellwig wrote:
> On Fri, Jan 13, 2023 at 09:09:52AM +0100, John Paul Adrian Glaubitz wrote:
>> I'm still maintaining and using this port in Debian.
>>
>> It's a bit disappointing that people keep hammering on it. It works fine for me.
> 
> What platforms do you (or your users) use it on?

3 j-core boards, two sh4 boards (the sh7760 one I patched the kernel of), and an
sh4 emulator.

I have multiple j-core systems (sh2 compatible with extensions, nommu, 3
different kinds of boards running it here). There's an existing mmu version of
j-core that's sh3 flavored but they want to redo it so it hasn't been publicly
released yet, I have yet to get that to run Linux because the mmu code would
need adapting, but the most recent customer projects were on the existing nommu
SOC, as was last year's ASIC work via sky130.

My physical sh4 boards are a Johnson Controls N40 (sh7760 chipset) and the
little blue one is... sh4a I think? (It can run the same userspace, I haven't
replaced that board's kernel since I got it, I think it's the type Glaubitz is
using? It's mostly in case he had an issue I couldn't reproduce on different
hardware, or if I spill something on my N40.)

I also have a physical sh2 board on the shelf which I haven't touched in years
(used to comparison test during j2 development, and then the j2 boards replaced it).

I'm lazy and mostly test each new sh4 build under qemu -M r2d because it's
really convenient: neither of my physical boards boot from SD card so replacing
the kernel requires reflashing soldered in flash. (They'll net mount userspace
but I haven't gotten either bootloader to net-boot a kernel.)

I include sh4 in the my mkroot builds each toybox release, I have a ~300 line
bash script that builds bootable toybox systems for a dozen-ish architectures,
including building a kernel configured to run under qemu:

  https://github.com/landley/toybox/blob/master/scripts/mkroot.sh

And I ship the resulting bootable system images, most recent release is at:

  https://landley.net/toybox/downloads/binaries/mkroot/0.8.9/

As described at:

  http://landley.net/toybox/faq.html#mkroot

Various people in Japan have more hardware, but I haven't made it physically
back there since 2020. (My residency card expired during the pandemic.)

Rob

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-01-17 19:13     ` Rob Landley
@ 2023-01-17 20:26       ` Geert Uytterhoeven
  2023-01-17 23:05         ` Guenter Roeck
  2023-01-18  5:03         ` Rob Landley
  0 siblings, 2 replies; 80+ messages in thread
From: Geert Uytterhoeven @ 2023-01-17 20:26 UTC (permalink / raw)
  To: Rob Landley
  Cc: Christoph Hellwig, John Paul Adrian Glaubitz, Yoshinori Sato,
	Rich Felker, Arnd Bergmann, Greg Kroah-Hartman, Laurent Pinchart,
	Kieran Bingham, Geert Uytterhoeven, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

Hi Rob,

On Tue, Jan 17, 2023 at 8:01 PM Rob Landley <rob@landley.net> wrote:
> On 1/16/23 01:13, Christoph Hellwig wrote:
> > On Fri, Jan 13, 2023 at 09:09:52AM +0100, John Paul Adrian Glaubitz wrote:
> >> I'm still maintaining and using this port in Debian.
> >>
> >> It's a bit disappointing that people keep hammering on it. It works fine for me.
> >
> > What platforms do you (or your users) use it on?
>
> 3 j-core boards, two sh4 boards (the sh7760 one I patched the kernel of), and an
> sh4 emulator.
>
> I have multiple j-core systems (sh2 compatible with extensions, nommu, 3
> different kinds of boards running it here). There's an existing mmu version of
> j-core that's sh3 flavored but they want to redo it so it hasn't been publicly
> released yet, I have yet to get that to run Linux because the mmu code would
> need adapting, but the most recent customer projects were on the existing nommu
> SOC, as was last year's ASIC work via sky130.

J4 still vaporware?

> My physical sh4 boards are a Johnson Controls N40 (sh7760 chipset) and the
> little blue one is... sh4a I think? (It can run the same userspace, I haven't
> replaced that board's kernel since I got it, I think it's the type Glaubitz is
> using? It's mostly in case he had an issue I couldn't reproduce on different
> hardware, or if I spill something on my N40.)
>
> I also have a physical sh2 board on the shelf which I haven't touched in years
> (used to comparison test during j2 development, and then the j2 boards replaced it).
>
> I'm lazy and mostly test each new sh4 build under qemu -M r2d because it's
> really convenient: neither of my physical boards boot from SD card so replacing
> the kernel requires reflashing soldered in flash. (They'll net mount userspace
> but I haven't gotten either bootloader to net-boot a kernel.)

On my landisk (with boots from CompactFLASH), I boot the original 2.6.22
kernel, and use kexec to boot-test each and every renesas-drivers
release.  Note that this requires both the original 2.6.22 kernel
and matching kexec-tools.  Apparently both upstreamed kernel and
kexec-tools support for SH are different, and incompatible with each
other, so you cannot kexec from a contemporary kernel.
I tried working my way up from 2.6.22, but gave up around 2.6.29.
Probably I should do this with r2d and qemu instead ;-)

Both r2d and landisk are SH7751.

Probably SH7722/'23'24 (e.g. Migo-R and Ecovec boards) are also
worth keeping.  Most on-SoC blocks have drivers with DT support,
as they are shared with ARM.  So the hardest part is clock and
interrupt-controller support.
Unfortunately I no longer have access to the (remote) Migo-R.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 05/22] sound: remove sh-specific sounds/soc/sh drivers
  2023-01-13  6:23 ` [PATCH 05/22] sound: remove sh-specific sounds/soc/sh drivers Christoph Hellwig
@ 2023-01-17 22:52   ` Kuninori Morimoto
  0 siblings, 0 replies; 80+ messages in thread
From: Kuninori Morimoto @ 2023-01-17 22:52 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh


Hi Christoph
> 
> Now that arch/sh is removed these drivers are dead code.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
(snip)
>  sound/soc/sh/fsi.c         |   9 -
(snip)
>  config SND_SOC_SH4_FSI
>  	tristate "SH4 FSI support"
>  	depends on COMMON_CLK

You can remove sound/soc/sh/fsi.c
It is for SH SoC.

Thank you for your help !!

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-01-17 20:26       ` Geert Uytterhoeven
@ 2023-01-17 23:05         ` Guenter Roeck
  2023-01-18  0:10           ` D. Jeff Dionne
  2023-01-18  5:03         ` Rob Landley
  1 sibling, 1 reply; 80+ messages in thread
From: Guenter Roeck @ 2023-01-17 23:05 UTC (permalink / raw)
  To: Geert Uytterhoeven, Rob Landley
  Cc: Christoph Hellwig, John Paul Adrian Glaubitz, Yoshinori Sato,
	Rich Felker, Arnd Bergmann, Greg Kroah-Hartman, Laurent Pinchart,
	Kieran Bingham, Geert Uytterhoeven, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

On 1/17/23 12:26, Geert Uytterhoeven wrote:
> Hi Rob,
> 
> On Tue, Jan 17, 2023 at 8:01 PM Rob Landley <rob@landley.net> wrote:
>> On 1/16/23 01:13, Christoph Hellwig wrote:
>>> On Fri, Jan 13, 2023 at 09:09:52AM +0100, John Paul Adrian Glaubitz wrote:
>>>> I'm still maintaining and using this port in Debian.
>>>>
>>>> It's a bit disappointing that people keep hammering on it. It works fine for me.
>>>
>>> What platforms do you (or your users) use it on?
>>
>> 3 j-core boards, two sh4 boards (the sh7760 one I patched the kernel of), and an
>> sh4 emulator.
>>
>> I have multiple j-core systems (sh2 compatible with extensions, nommu, 3
>> different kinds of boards running it here). There's an existing mmu version of
>> j-core that's sh3 flavored but they want to redo it so it hasn't been publicly
>> released yet, I have yet to get that to run Linux because the mmu code would
>> need adapting, but the most recent customer projects were on the existing nommu
>> SOC, as was last year's ASIC work via sky130.
> 
> J4 still vaporware?
> 
>> My physical sh4 boards are a Johnson Controls N40 (sh7760 chipset) and the
>> little blue one is... sh4a I think? (It can run the same userspace, I haven't
>> replaced that board's kernel since I got it, I think it's the type Glaubitz is
>> using? It's mostly in case he had an issue I couldn't reproduce on different
>> hardware, or if I spill something on my N40.)
>>
>> I also have a physical sh2 board on the shelf which I haven't touched in years
>> (used to comparison test during j2 development, and then the j2 boards replaced it).
>>
>> I'm lazy and mostly test each new sh4 build under qemu -M r2d because it's
>> really convenient: neither of my physical boards boot from SD card so replacing
>> the kernel requires reflashing soldered in flash. (They'll net mount userspace
>> but I haven't gotten either bootloader to net-boot a kernel.)
> 
> On my landisk (with boots from CompactFLASH), I boot the original 2.6.22
> kernel, and use kexec to boot-test each and every renesas-drivers
> release.  Note that this requires both the original 2.6.22 kernel
> and matching kexec-tools.  Apparently both upstreamed kernel and
> kexec-tools support for SH are different, and incompatible with each
> other, so you cannot kexec from a contemporary kernel.
> I tried working my way up from 2.6.22, but gave up around 2.6.29.
> Probably I should do this with r2d and qemu instead ;-)
> 
> Both r2d and landisk are SH7751.
> 
> Probably SH7722/'23'24 (e.g. Migo-R and Ecovec boards) are also
> worth keeping.  Most on-SoC blocks have drivers with DT support,
> as they are shared with ARM.  So the hardest part is clock and
> interrupt-controller support.
> Unfortunately I no longer have access to the (remote) Migo-R.
> 

Since there are people around with real hardware .... is sh in big endian mode
(sheb) real ? Its qemu support is quite limited; most PCI devices don't work
due to endianness issues. It would be interesting to know if this works better
with real hardware.

Thanks,
Guenter


^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-01-17 23:05         ` Guenter Roeck
@ 2023-01-18  0:10           ` D. Jeff Dionne
  0 siblings, 0 replies; 80+ messages in thread
From: D. Jeff Dionne @ 2023-01-18  0:10 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Geert Uytterhoeven, Rob Landley, Christoph Hellwig,
	John Paul Adrian Glaubitz, Yoshinori Sato, Rich Felker,
	Arnd Bergmann, Greg Kroah-Hartman, Laurent Pinchart,
	Kieran Bingham, Geert Uytterhoeven, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh


> Since there are people around with real hardware .... is sh in big endian mode
> (sheb) real ? Its qemu support is quite limited; most PCI devices don't work
> due to endianness issues. It would be interesting to know if this works better
> with real hardware.

Hi Guenter,

SH big endian works very well, and is in use on J-Core J2 SMP (hardware w/FPGA, simulation and ASIC this year) as well as some of the Hitachi / Renesas IoT chips e.g. SH7619.

It’s the base of the real new line of development (as opposed to backward looking support of older SH chips).  New chipsets will be based on the same RTL.

But does it actually work?  Yes, we have (new) devices such as a USB Wireguard based VPN hardware dongle, that are J2 (SH2 2 core SMP) that are in use with Linux sheb, nommu and fdpic.  MMU chips will be little endian.

Cheers,
J.

> Thanks,
> Guenter
> 


^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-01-17 20:26       ` Geert Uytterhoeven
  2023-01-17 23:05         ` Guenter Roeck
@ 2023-01-18  5:03         ` Rob Landley
  2023-01-18  7:46           ` Geert Uytterhoeven
  1 sibling, 1 reply; 80+ messages in thread
From: Rob Landley @ 2023-01-18  5:03 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Christoph Hellwig, John Paul Adrian Glaubitz, Yoshinori Sato,
	Rich Felker, Arnd Bergmann, Greg Kroah-Hartman, Laurent Pinchart,
	Kieran Bingham, Geert Uytterhoeven, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

[-- Attachment #1: Type: text/plain, Size: 7466 bytes --]



On 1/17/23 14:26, Geert Uytterhoeven wrote:
> Hi Rob,
> 
> On Tue, Jan 17, 2023 at 8:01 PM Rob Landley <rob@landley.net> wrote:
>> On 1/16/23 01:13, Christoph Hellwig wrote:
>> > On Fri, Jan 13, 2023 at 09:09:52AM +0100, John Paul Adrian Glaubitz wrote:
>> >> I'm still maintaining and using this port in Debian.
>> >>
>> >> It's a bit disappointing that people keep hammering on it. It works fine for me.
>> >
>> > What platforms do you (or your users) use it on?
>>
>> 3 j-core boards, two sh4 boards (the sh7760 one I patched the kernel of), and an
>> sh4 emulator.
>>
>> I have multiple j-core systems (sh2 compatible with extensions, nommu, 3
>> different kinds of boards running it here). There's an existing mmu version of
>> j-core that's sh3 flavored but they want to redo it so it hasn't been publicly
>> released yet, I have yet to get that to run Linux because the mmu code would
>> need adapting, but the most recent customer projects were on the existing nommu
>> SOC, as was last year's ASIC work via sky130.
> 
> J4 still vaporware?

The 'existing mmu version' is the theoretical basis for J4 (the move from J3 to
J4 is tiny from an instruction set perspective, it was more about internal chip
architecture, primarily multi-issue with tomasulo). It exists, but we haven't
had a product that uses it and the engineer who was tasked to work on it got
reassigned during the pandemic.

The real problem is the existing implementation is a branch off of an older SOC
version so repotting it to the current tree (which among other things builds
under a different VHDL toolchain) is some work. The "conflict requiring actual
staring at" isn't the MMU, it's the instruction cancellation logic that backs
out half-finished instructions when the MMU complains partway through an
instruction that's multiple steps of microcode, so we have to back _out_ what
it's already done so it can be cleanly restarted after handling the fault.
That's got merge conflicts all over the place with the current stuff...

Not actually _hard_, but not something we've sat down and done. We spent those
cycles last year working on an ASIC implementation through Google's Sky130
OpenLane/OpenRoad stuff (see https://github.com/j-core/openlane-vhdl-build for
our in-house toolchain build for that; Google passes around a magic docker that
most people use, we trimmed off most of the dependencies and build it in a clean
debootstrap). And that was trying to make an ASIC out of the small simple
version, because Google's entire asic/skywater partnership was... fraught?

We also tried to get the previous generation of ASIC tools to work before giving
up and trying to get what Google was working on to work:

  https://landley.net/notes-2022.html#26-01-2022
  https://landley.net/notes-2022.html#28-01-2022

We targeted "known working SOC that we've been using a long time" to try to make
a physical silicon chip out of (and the first version isn't even the J2 2xSMP
SOC with all the cache and peripherals, it was a derivative of the ICE40 port
that's single processor running straight from SRAM with no DRAM controller), on
the theory we can always do a more complicated one later an what we were really
trying to establish here is that Google's ASIC development tools and process
could be made to work. (Which is kind of a heavy lift, they burned two shuttles
full of mostly dead chips that we know of before admitting "those timing
annotations we were talking about actually DO need to go all the way through"...
Jeff has the URLs to the bug reports in OpenLane/Road's github...)

(Sorry, one of OpenLane/OpenRoad is the DARPA project out of Sandia National
Laboratory, and the other is Google doing a large extremely complicated thing
analogous to the AOSP build on top of Darpa's work using a lot different
programming languages and FOREST of build and runtime package dependencies, and
I can never remember which is which. The Google thing is the one distributed in
a docker because it's considered impossible to build rom source by everybody
except us, because we're funny that way. And added VHDL support instead of just
Verilog so needed to rebuild from source anyway to do that.)

>> My physical sh4 boards are a Johnson Controls N40 (sh7760 chipset) and the
>> little blue one is... sh4a I think? (It can run the same userspace, I haven't
>> replaced that board's kernel since I got it, I think it's the type Glaubitz is
>> using? It's mostly in case he had an issue I couldn't reproduce on different
>> hardware, or if I spill something on my N40.)
>>
>> I also have a physical sh2 board on the shelf which I haven't touched in years
>> (used to comparison test during j2 development, and then the j2 boards replaced it).
>>
>> I'm lazy and mostly test each new sh4 build under qemu -M r2d because it's
>> really convenient: neither of my physical boards boot from SD card so replacing
>> the kernel requires reflashing soldered in flash. (They'll net mount userspace
>> but I haven't gotten either bootloader to net-boot a kernel.)
> 
> On my landisk (with boots from CompactFLASH), I boot the original 2.6.22
> kernel, and use kexec to boot-test each and every renesas-drivers
> release.  Note that this requires both the original 2.6.22 kernel
> and matching kexec-tools.

I make it a point to run _current_ kernels in all my mkroot systems, including
sh4. What I shipped was 6.1 is:

# cat /proc/version
Linux version 6.1.0 (landley@driftwood) (sh4-linux-musl-cc (GCC) 9.4.0, GNU ld
(GNU Binutils) 2.33.1) #1 Tue Jan 10 16:32:07 CST 2023

At the JCI contract where I got the N40 I forward ported the kernel version to a
release that was I think 2 back from the current release because there was a
race condition in the flash support I didn't have time to track down? (Only
showed up under sustained load so the test case took hours to run, and we had a
ship schedule...)

I've been meaning to get together with somebody to get the blue board updated,
but I've been busy with other things...


> Apparently both upstreamed kernel and
> kexec-tools support for SH are different, and incompatible with each
> other, so you cannot kexec from a contemporary kernel.

Sure you can. Using toybox's insmod and modprobe, anyway. (That's the target I
tested those on... :)

Haven't messed with signing or compression or anything yet, my insmod is just
doing syscall(SYS_finit_module) and then falling back to SYS_init_module if that
fails and either fd was 0 or errno was ENOSYS. (Don't ask me why
SYS_finit_module doesn't work on stdin...)

https://github.com/landley/toybox/blob/master/toys/other/insmod.c#L31

https://landley.net/toybox/downloads/binaries/0.8.9/toybox-sh4

> I tried working my way up from 2.6.22, but gave up around 2.6.29.
> Probably I should do this with r2d and qemu instead ;-)

I have current running there. I've had current running there for years. Config
attached...

> Both r2d and landisk are SH7751.

Cool. Shouldn't be hard to get landisk running current then.

> Probably SH7722/'23'24 (e.g. Migo-R and Ecovec boards) are also
> worth keeping.  Most on-SoC blocks have drivers with DT support,
> as they are shared with ARM.  So the hardest part is clock and
> interrupt-controller support.

J-core is using device tree already. Shouldn't be hard to do a device tree for
the qemu version, and then for landisk.

> Unfortunately I no longer have access to the (remote) Migo-R.

There's more stuff in Japan, but that's a Jeff question...

Rob

[-- Attachment #2: linux-fullconfig.gz --]
[-- Type: application/gzip, Size: 11830 bytes --]

[-- Attachment #3: linux-miniconfig --]
[-- Type: text/plain, Size: 1342 bytes --]

# make ARCH=sh allnoconfig KCONFIG_ALLCONFIG=linux-miniconfig
# make ARCH=sh -j $(nproc)
# boot arch/sh/boot/zImage


# architecture 0
CONFIG_BINFMT_ELF=y
CONFIG_BINFMT_SCRIPT=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_BLK_DEV=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_RD_GZIP=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_EXT4_FS=y
CONFIG_EXT4_USE_FOR_EXT2=y
CONFIG_VFAT_FS=y
CONFIG_FAT_DEFAULT_UTF8=y
CONFIG_MISC_FILESYSTEMS=y
CONFIG_SQUASHFS=y
CONFIG_SQUASHFS_XATTR=y
CONFIG_SQUASHFS_ZLIB=y
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_IPV6=y
CONFIG_NETDEVICES=y
CONFIG_NET_CORE=y
CONFIG_NETCONSOLE=y
CONFIG_ETHERNET=y
CONFIG_COMPAT_32BIT_TIME=y
CONFIG_EARLY_PRINTK=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y

# architecture specific
CONFIG_CPU_SUBTYPE_SH7751R=y
CONFIG_MMU=y
CONFIG_VSYSCALL=y
CONFIG_SH_FPU=y
CONFIG_SH_RTS7751R2D=y
CONFIG_RTS7751R2D_PLUS=y
CONFIG_SERIAL_SH_SCI=y
CONFIG_SERIAL_SH_SCI_CONSOLE=y
CONFIG_PCI=y
CONFIG_NET_VENDOR_REALTEK=y
CONFIG_8139CP=y
CONFIG_PCI=y
CONFIG_BLK_DEV_SD=y
CONFIG_ATA=y
CONFIG_ATA_SFF=y
CONFIG_ATA_BMDMA=y
CONFIG_PATA_PLATFORM=y
CONFIG_BINFMT_ELF_FDPIC=y
CONFIG_BINFMT_FLAT=y

# architecture specific
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y

CONFIG_FSCACHE=m
CONFIG_CACHEFILES=m

CONFIG_MEMORY_START=0x0c000000

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-01-18  5:03         ` Rob Landley
@ 2023-01-18  7:46           ` Geert Uytterhoeven
  2023-01-18 11:14             ` Rob Landley
  0 siblings, 1 reply; 80+ messages in thread
From: Geert Uytterhoeven @ 2023-01-18  7:46 UTC (permalink / raw)
  To: Rob Landley
  Cc: Christoph Hellwig, John Paul Adrian Glaubitz, Yoshinori Sato,
	Rich Felker, Arnd Bergmann, Greg Kroah-Hartman, Laurent Pinchart,
	Kieran Bingham, Geert Uytterhoeven, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

Hi Rob,

On Wed, Jan 18, 2023 at 5:50 AM Rob Landley <rob@landley.net> wrote:
> On 1/17/23 14:26, Geert Uytterhoeven wrote:
> > On Tue, Jan 17, 2023 at 8:01 PM Rob Landley <rob@landley.net> wrote:
> >> I'm lazy and mostly test each new sh4 build under qemu -M r2d because it's
> >> really convenient: neither of my physical boards boot from SD card so replacing
> >> the kernel requires reflashing soldered in flash. (They'll net mount userspace
> >> but I haven't gotten either bootloader to net-boot a kernel.)
> >
> > On my landisk (with boots from CompactFLASH), I boot the original 2.6.22
> > kernel, and use kexec to boot-test each and every renesas-drivers
> > release.  Note that this requires both the original 2.6.22 kernel
> > and matching kexec-tools.
>
> I make it a point to run _current_ kernels in all my mkroot systems, including
> sh4. What I shipped was 6.1 is:
>
> # cat /proc/version
> Linux version 6.1.0 (landley@driftwood) (sh4-linux-musl-cc (GCC) 9.4.0, GNU ld
> (GNU Binutils) 2.33.1) #1 Tue Jan 10 16:32:07 CST 2023

I think you misunderstood: renesas-drivers releases[1] are current
kernels.

   Linux version 6.2.0-rc3-landisk-01864-g0c6453b3e5f6 (geert@rox)
(sh4-linux-gnu-gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0, GNU ld (GNU
Binutils for Ubuntu) 2.38) #125 Tue Jan 10 14:29:01 CET 2023

I use 2.6.22 and kexec as a boot loader for newer kernels, to avoid
juggling CF cards.  I cannot install a newer base kernel on the CF,
as kexec is broken upstream.

> > Apparently both upstreamed kernel and
> > kexec-tools support for SH are different, and incompatible with each
> > other, so you cannot kexec from a contemporary kernel.
>
> Sure you can. Using toybox's insmod and modprobe, anyway. (That's the target I
> tested those on... :)
>
> Haven't messed with signing or compression or anything yet, my insmod is just
> doing syscall(SYS_finit_module) and then falling back to SYS_init_module if that
> fails and either fd was 0 or errno was ENOSYS. (Don't ask me why
> SYS_finit_module doesn't work on stdin...)
>
> https://github.com/landley/toybox/blob/master/toys/other/insmod.c#L31
>
> https://landley.net/toybox/downloads/binaries/0.8.9/toybox-sh4

Again, I think you're talking about something different.
Does kexec work for you?

> > I tried working my way up from 2.6.22, but gave up around 2.6.29.
> > Probably I should do this with r2d and qemu instead ;-)
>
> I have current running there. I've had current running there for years. Config
> attached...
>
> > Both r2d and landisk are SH7751.
>
> Cool. Shouldn't be hard to get landisk running current then.

Current kernels work fine on landisk with an old Debian userspace
on CF.  The 8139cp driver is a bit flaky: last time I tried nfsroot,
that didn't work well.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-01-18  7:46           ` Geert Uytterhoeven
@ 2023-01-18 11:14             ` Rob Landley
  0 siblings, 0 replies; 80+ messages in thread
From: Rob Landley @ 2023-01-18 11:14 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Christoph Hellwig, John Paul Adrian Glaubitz, Yoshinori Sato,
	Rich Felker, Arnd Bergmann, Greg Kroah-Hartman, Laurent Pinchart,
	Kieran Bingham, Geert Uytterhoeven, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

On 1/18/23 01:46, Geert Uytterhoeven wrote:
> Again, I think you're talking about something different.
> Does kexec work for you?

Sorry, got woken up several hours early by sirens and flashy lights this morning
(duplex on the corner caught fire, Austin has a LOT of emergency vehicles), been
a bit underclocked all day.

No, I haven't tried kexec on sh4. I'll add it to the todo heap.

>> > I tried working my way up from 2.6.22, but gave up around 2.6.29.
>> > Probably I should do this with r2d and qemu instead ;-)
>>
>> I have current running there. I've had current running there for years. Config
>> attached...
>>
>> > Both r2d and landisk are SH7751.
>>
>> Cool. Shouldn't be hard to get landisk running current then.
> 
> Current kernels work fine on landisk with an old Debian userspace
> on CF.  The 8139cp driver is a bit flaky: last time I tried nfsroot,
> that didn't work well.

I've never had luck with NFS, I was using NBD. Hadn't noticed the flake but
haven't stress tested it too hard either?

Mostly new userspace is what I'm testing...

Rob

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-01-16  8:52     ` John Paul Adrian Glaubitz
@ 2023-02-03  7:14       ` Christoph Hellwig
  2023-02-03  8:24         ` John Paul Adrian Glaubitz
  2023-02-07  9:06         ` John Paul Adrian Glaubitz
  0 siblings, 2 replies; 80+ messages in thread
From: Christoph Hellwig @ 2023-02-03  7:14 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, Laurent Pinchart, Kieran Bingham,
	Geert Uytterhoeven, linux-kernel, linux-watchdog, devicetree,
	linux-arch, dmaengine, dri-devel, linux-renesas-soc, linux-i2c,
	linux-input, linux-media, linux-mmc, linux-mtd, netdev,
	linux-gpio, linux-rtc, linux-spi, linux-serial, linux-usb,
	linux-fbdev, alsa-devel, linux-sh

On Mon, Jan 16, 2023 at 09:52:10AM +0100, John Paul Adrian Glaubitz wrote:
> We have had a discussion between multiple people invested in the SuperH port and
> I have decided to volunteer as a co-maintainer of the port to support Rich Felker
> when he isn't available.

So, this still isn't reflected in MAINTAINERS in linux-next.  When
do you plan to take over?  What platforms will remain supported and
what can we start dropping due to being unused and unmaintained?

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 01/22] gpu/drm: remove the shmobile drm driver
  2023-01-13  7:46   ` Laurent Pinchart
  2023-01-13  7:55     ` Laurent Pinchart
@ 2023-02-03  7:15     ` Christoph Hellwig
  2023-02-03 13:49       ` Laurent Pinchart
  1 sibling, 1 reply; 80+ messages in thread
From: Christoph Hellwig @ 2023-02-03  7:15 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

So given that the big series doesn't go in, can we get this removal
picked up through the drm tree?

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 02/22] usb: remove the dead USB_OHCI_SH option
  2023-01-13  7:12   ` Greg Kroah-Hartman
  2023-01-13  7:14     ` Christoph Hellwig
  2023-01-15  0:55     ` Rob Landley
@ 2023-02-03  7:15     ` Christoph Hellwig
  2023-02-03  7:25       ` Greg Kroah-Hartman
  2 siblings, 1 reply; 80+ messages in thread
From: Christoph Hellwig @ 2023-02-03  7:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

On Fri, Jan 13, 2023 at 08:12:44AM +0100, Greg Kroah-Hartman wrote:
> Do you want all of these to go through a single tree, or can they go
> through the different driver subsystem trees?

Looks like the big removal isn't going in for this merge winodw,
so can you queue this patch up after all Greg?

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 02/22] usb: remove the dead USB_OHCI_SH option
  2023-02-03  7:15     ` Christoph Hellwig
@ 2023-02-03  7:25       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 80+ messages in thread
From: Greg Kroah-Hartman @ 2023-02-03  7:25 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Laurent Pinchart,
	Kieran Bingham, Geert Uytterhoeven, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

On Fri, Feb 03, 2023 at 08:15:42AM +0100, Christoph Hellwig wrote:
> On Fri, Jan 13, 2023 at 08:12:44AM +0100, Greg Kroah-Hartman wrote:
> > Do you want all of these to go through a single tree, or can they go
> > through the different driver subsystem trees?
> 
> Looks like the big removal isn't going in for this merge winodw,
> so can you queue this patch up after all Greg?

Sure, I'll go apply it right now, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-02-03  7:14       ` Christoph Hellwig
@ 2023-02-03  8:24         ` John Paul Adrian Glaubitz
  2023-02-03  8:30           ` Christoph Hellwig
  2023-02-07  9:06         ` John Paul Adrian Glaubitz
  1 sibling, 1 reply; 80+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-02-03  8:24 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Hello Christoph!

On Fri, 2023-02-03 at 08:14 +0100, Christoph Hellwig wrote:
> On Mon, Jan 16, 2023 at 09:52:10AM +0100, John Paul Adrian Glaubitz wrote:
> > We have had a discussion between multiple people invested in the SuperH port and
> > I have decided to volunteer as a co-maintainer of the port to support Rich Felker
> > when he isn't available.
> 
> So, this still isn't reflected in MAINTAINERS in linux-next.  When
> do you plan to take over?

Since this is my very first time stepping up as a kernel maintainer, I was hoping
to get some pointers on what to do to make this happen.

So far, we have set up a new kernel tree and I have set up a local development and
test environment for SH kernels using my SH7785LCR board as the target platform.

Do I just need to send a patch asking to change the corresponding entry in the
MAINTAINERS file?

> What platforms will remain supported and what can we start dropping due to
> being unused and unmaintained?

This has not been sorted out yet.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-02-03  8:24         ` John Paul Adrian Glaubitz
@ 2023-02-03  8:30           ` Christoph Hellwig
  2023-02-03 10:29             ` John Paul Adrian Glaubitz
  2023-02-05 23:08             ` Stephen Rothwell
  0 siblings, 2 replies; 80+ messages in thread
From: Christoph Hellwig @ 2023-02-03  8:30 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, Laurent Pinchart, Kieran Bingham,
	Geert Uytterhoeven, linux-kernel, linux-watchdog, devicetree,
	linux-arch, dmaengine, dri-devel, linux-renesas-soc, linux-i2c,
	linux-input, linux-media, linux-mmc, linux-mtd, netdev,
	linux-gpio, linux-rtc, linux-spi, linux-serial, linux-usb,
	linux-fbdev, alsa-devel, linux-sh

On Fri, Feb 03, 2023 at 09:24:46AM +0100, John Paul Adrian Glaubitz wrote:
> Since this is my very first time stepping up as a kernel maintainer, I was hoping
> to get some pointers on what to do to make this happen.
> 
> So far, we have set up a new kernel tree and I have set up a local development and
> test environment for SH kernels using my SH7785LCR board as the target platform.
> 
> Do I just need to send a patch asking to change the corresponding entry in the
> MAINTAINERS file?

I'm not sure a there is a document, but:

 - add the MAINTAINERS change to your tree
 - ask Stephen to get your tree included in linux-next

then eventually send a pull request to Linus with all of that.  Make
sure it's been in linux-next for a while.

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-02-03  8:30           ` Christoph Hellwig
@ 2023-02-03 10:29             ` John Paul Adrian Glaubitz
  2023-02-03 10:33               ` Geert Uytterhoeven
  2023-02-05 23:08             ` Stephen Rothwell
  1 sibling, 1 reply; 80+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-02-03 10:29 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Hi Christoph!

On Fri, 2023-02-03 at 09:30 +0100, Christoph Hellwig wrote:
> On Fri, Feb 03, 2023 at 09:24:46AM +0100, John Paul Adrian Glaubitz wrote:
> > Since this is my very first time stepping up as a kernel maintainer, I was hoping
> > to get some pointers on what to do to make this happen.
> > 
> > So far, we have set up a new kernel tree and I have set up a local development and
> > test environment for SH kernels using my SH7785LCR board as the target platform.
> > 
> > Do I just need to send a patch asking to change the corresponding entry in the
> > MAINTAINERS file?
> 
> I'm not sure a there is a document, but:
> 
>  - add the MAINTAINERS change to your tree
>  - ask Stephen to get your tree included in linux-next
> 
> then eventually send a pull request to Linus with all of that.  Make
> sure it's been in linux-next for a while.

OK, thanks for the pointers! Will try to get this done by next week.

We're still discussing among SuperH developer community whether there will be a second
maintainer, so please bear with us a few more days. I will collect patches in the
meantime.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-02-03 10:29             ` John Paul Adrian Glaubitz
@ 2023-02-03 10:33               ` Geert Uytterhoeven
  2023-02-03 10:36                 ` John Paul Adrian Glaubitz
  2023-02-03 15:57                 ` Randy Dunlap
  0 siblings, 2 replies; 80+ messages in thread
From: Geert Uytterhoeven @ 2023-02-03 10:33 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, Laurent Pinchart, Kieran Bingham,
	Geert Uytterhoeven, linux-kernel, linux-watchdog, devicetree,
	linux-arch, dmaengine, dri-devel, linux-renesas-soc, linux-i2c,
	linux-input, linux-media, linux-mmc, linux-mtd, netdev,
	linux-gpio, linux-rtc, linux-spi, linux-serial, linux-usb,
	linux-fbdev, alsa-devel, linux-sh

Hi Adrian,

On Fri, Feb 3, 2023 at 11:29 AM John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
> On Fri, 2023-02-03 at 09:30 +0100, Christoph Hellwig wrote:
> > On Fri, Feb 03, 2023 at 09:24:46AM +0100, John Paul Adrian Glaubitz wrote:
> > > Since this is my very first time stepping up as a kernel maintainer, I was hoping
> > > to get some pointers on what to do to make this happen.
> > >
> > > So far, we have set up a new kernel tree and I have set up a local development and
> > > test environment for SH kernels using my SH7785LCR board as the target platform.
> > >
> > > Do I just need to send a patch asking to change the corresponding entry in the
> > > MAINTAINERS file?
> >
> > I'm not sure a there is a document, but:
> >
> >  - add the MAINTAINERS change to your tree
> >  - ask Stephen to get your tree included in linux-next
> >
> > then eventually send a pull request to Linus with all of that.  Make
> > sure it's been in linux-next for a while.
>
> OK, thanks for the pointers! Will try to get this done by next week.
>
> We're still discussing among SuperH developer community whether there will be a second
> maintainer, so please bear with us a few more days. I will collect patches in the
> meantime.

Thanks a lot!

If you need any help with process, setup, ... don't hesitate to ask
(on e.g. #renesas-soc on Libera).

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-02-03 10:33               ` Geert Uytterhoeven
@ 2023-02-03 10:36                 ` John Paul Adrian Glaubitz
  2023-02-03 15:57                 ` Randy Dunlap
  1 sibling, 0 replies; 80+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-02-03 10:36 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, Laurent Pinchart, Kieran Bingham,
	Geert Uytterhoeven, linux-kernel, linux-watchdog, devicetree,
	linux-arch, dmaengine, dri-devel, linux-renesas-soc, linux-i2c,
	linux-input, linux-media, linux-mmc, linux-mtd, netdev,
	linux-gpio, linux-rtc, linux-spi, linux-serial, linux-usb,
	linux-fbdev, alsa-devel, linux-sh

Hi Geert!

On Fri, 2023-02-03 at 11:33 +0100, Geert Uytterhoeven wrote:
> Hi Adrian,
> 
> On Fri, Feb 3, 2023 at 11:29 AM John Paul Adrian Glaubitz
> <glaubitz@physik.fu-berlin.de> wrote:
> > On Fri, 2023-02-03 at 09:30 +0100, Christoph Hellwig wrote:
> > > On Fri, Feb 03, 2023 at 09:24:46AM +0100, John Paul Adrian Glaubitz wrote:
> > > > Since this is my very first time stepping up as a kernel maintainer, I was hoping
> > > > to get some pointers on what to do to make this happen.
> > > > 
> > > > So far, we have set up a new kernel tree and I have set up a local development and
> > > > test environment for SH kernels using my SH7785LCR board as the target platform.
> > > > 
> > > > Do I just need to send a patch asking to change the corresponding entry in the
> > > > MAINTAINERS file?
> > > 
> > > I'm not sure a there is a document, but:
> > > 
> > >  - add the MAINTAINERS change to your tree
> > >  - ask Stephen to get your tree included in linux-next
> > > 
> > > then eventually send a pull request to Linus with all of that.  Make
> > > sure it's been in linux-next for a while.
> > 
> > OK, thanks for the pointers! Will try to get this done by next week.
> > 
> > We're still discussing among SuperH developer community whether there will be a second
> > maintainer, so please bear with us a few more days. I will collect patches in the
> > meantime.
> 
> Thanks a lot!
> 
> If you need any help with process, setup, ... don't hesitate to ask
> (on e.g. #renesas-soc on Libera).

Thanks a lot! I've got some real-life tasks to do today, but I will join later today.

And I will ask questions ;-).

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 01/22] gpu/drm: remove the shmobile drm driver
  2023-02-03  7:15     ` Christoph Hellwig
@ 2023-02-03 13:49       ` Laurent Pinchart
  2023-02-03 13:53         ` Geert Uytterhoeven
  0 siblings, 1 reply; 80+ messages in thread
From: Laurent Pinchart @ 2023-02-03 13:49 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Kieran Bingham, Geert Uytterhoeven, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

On Fri, Feb 03, 2023 at 08:15:06AM +0100, Christoph Hellwig wrote:
> So given that the big series doesn't go in, can we get this removal
> picked up through the drm tree?

Geert has a board with an ARM-based SoC compatible with this driver, and
he expressed interest in taking over maintainership. Geert, could you
share your plans ? Should the shmobile_drm driver be dropped now, or
will you revive it in a relatively near future ?

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 01/22] gpu/drm: remove the shmobile drm driver
  2023-02-03 13:49       ` Laurent Pinchart
@ 2023-02-03 13:53         ` Geert Uytterhoeven
  0 siblings, 0 replies; 80+ messages in thread
From: Geert Uytterhoeven @ 2023-02-03 13:53 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Hi Laurent,

On Fri, Feb 3, 2023 at 2:49 PM Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> On Fri, Feb 03, 2023 at 08:15:06AM +0100, Christoph Hellwig wrote:
> > So given that the big series doesn't go in, can we get this removal
> > picked up through the drm tree?
>
> Geert has a board with an ARM-based SoC compatible with this driver, and
> he expressed interest in taking over maintainership. Geert, could you
> share your plans ? Should the shmobile_drm driver be dropped now, or
> will you revive it in a relatively near future ?

(Trying to) get it working on that board is on my list...

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-02-03 10:33               ` Geert Uytterhoeven
  2023-02-03 10:36                 ` John Paul Adrian Glaubitz
@ 2023-02-03 15:57                 ` Randy Dunlap
  2023-02-03 16:04                   ` Geert Uytterhoeven
  2023-02-09  3:06                   ` Rob Landley
  1 sibling, 2 replies; 80+ messages in thread
From: Randy Dunlap @ 2023-02-03 15:57 UTC (permalink / raw)
  To: Geert Uytterhoeven, John Paul Adrian Glaubitz
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, Laurent Pinchart, Kieran Bingham,
	Geert Uytterhoeven, linux-kernel, linux-watchdog, devicetree,
	linux-arch, dmaengine, dri-devel, linux-renesas-soc, linux-i2c,
	linux-input, linux-media, linux-mmc, linux-mtd, netdev,
	linux-gpio, linux-rtc, linux-spi, linux-serial, linux-usb,
	linux-fbdev, alsa-devel, linux-sh

Hi--

On 2/3/23 02:33, Geert Uytterhoeven wrote:
> Hi Adrian,
> 
> On Fri, Feb 3, 2023 at 11:29 AM John Paul Adrian Glaubitz
> <glaubitz@physik.fu-berlin.de> wrote:
>> On Fri, 2023-02-03 at 09:30 +0100, Christoph Hellwig wrote:
>>> On Fri, Feb 03, 2023 at 09:24:46AM +0100, John Paul Adrian Glaubitz wrote:
>>>> Since this is my very first time stepping up as a kernel maintainer, I was hoping
>>>> to get some pointers on what to do to make this happen.
>>>>
>>>> So far, we have set up a new kernel tree and I have set up a local development and
>>>> test environment for SH kernels using my SH7785LCR board as the target platform.
>>>>
>>>> Do I just need to send a patch asking to change the corresponding entry in the
>>>> MAINTAINERS file?
>>>
>>> I'm not sure a there is a document, but:
>>>
>>>  - add the MAINTAINERS change to your tree
>>>  - ask Stephen to get your tree included in linux-next
>>>
>>> then eventually send a pull request to Linus with all of that.  Make
>>> sure it's been in linux-next for a while.
>>
>> OK, thanks for the pointers! Will try to get this done by next week.
>>
>> We're still discussing among SuperH developer community whether there will be a second
>> maintainer, so please bear with us a few more days. I will collect patches in the
>> meantime.
> 
> Thanks a lot!
> 
> If you need any help with process, setup, ... don't hesitate to ask
> (on e.g. #renesas-soc on Libera).

While Adrian and Geert are reading this, I have a question:

Is this "sh64" still accurate and applicable? from Documentation/kbuild/kbuild.rst:

But some architectures such as x86 and sparc have aliases.

- x86: i386 for 32 bit, x86_64 for 64 bit
- sh: sh for 32 bit, sh64 for 64 bit <<<<<<<<<<<<<<<
- sparc: sparc32 for 32 bit, sparc64 for 64 bit



Thanks.
-- 
~Randy

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-02-03 15:57                 ` Randy Dunlap
@ 2023-02-03 16:04                   ` Geert Uytterhoeven
  2023-02-09  3:06                   ` Rob Landley
  1 sibling, 0 replies; 80+ messages in thread
From: Geert Uytterhoeven @ 2023-02-03 16:04 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: John Paul Adrian Glaubitz, Christoph Hellwig, Yoshinori Sato,
	Rich Felker, Arnd Bergmann, Greg Kroah-Hartman, Laurent Pinchart,
	Kieran Bingham, Geert Uytterhoeven, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

Hi Randy,

On Fri, Feb 3, 2023 at 4:57 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> Is this "sh64" still accurate and applicable? from Documentation/kbuild/kbuild.rst:
>
> But some architectures such as x86 and sparc have aliases.
>
> - x86: i386 for 32 bit, x86_64 for 64 bit
> - sh: sh for 32 bit, sh64 for 64 bit <<<<<<<<<<<<<<<
> - sparc: sparc32 for 32 bit, sparc64 for 64 bit

No, support for sh64 was removed in commit 37744feebc086908
("sh: remove sh5 support") in v5.8.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-02-03  8:30           ` Christoph Hellwig
  2023-02-03 10:29             ` John Paul Adrian Glaubitz
@ 2023-02-05 23:08             ` Stephen Rothwell
  2023-02-05 23:20               ` John Paul Adrian Glaubitz
  2023-02-13 16:30               ` John Paul Adrian Glaubitz
  1 sibling, 2 replies; 80+ messages in thread
From: Stephen Rothwell @ 2023-02-05 23:08 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, Laurent Pinchart, Kieran Bingham,
	Geert Uytterhoeven, linux-kernel, linux-watchdog, devicetree,
	linux-arch, dmaengine, dri-devel, linux-renesas-soc, linux-i2c,
	linux-input, linux-media, linux-mmc, linux-mtd, netdev,
	linux-gpio, linux-rtc, linux-spi, linux-serial, linux-usb,
	linux-fbdev, alsa-devel, linux-sh

[-- Attachment #1: Type: text/plain, Size: 1305 bytes --]

Hi,

On Fri, 3 Feb 2023 09:30:37 +0100 Christoph Hellwig <hch@lst.de> wrote:
>
> On Fri, Feb 03, 2023 at 09:24:46AM +0100, John Paul Adrian Glaubitz wrote:
> > Since this is my very first time stepping up as a kernel maintainer, I was hoping
> > to get some pointers on what to do to make this happen.
> > 
> > So far, we have set up a new kernel tree and I have set up a local development and
> > test environment for SH kernels using my SH7785LCR board as the target platform.
> > 
> > Do I just need to send a patch asking to change the corresponding entry in the
> > MAINTAINERS file?  
> 
> I'm not sure a there is a document, but:
> 
>  - add the MAINTAINERS change to your tree
>  - ask Stephen to get your tree included in linux-next

And by "Stephen", Christoph means me.  When you are ready, please send
me a request to include your tree/branch in linux-next (usually the
branch is called something like "for-next" or just "next") telling me
the git URL, and the contacts I should send email to if there are
conflicts/build issues with the branch.  I will then fetch the branch
every time I create a new linux-next release (most work days), so all
you need to do is update that branch each time you are ready to publish
more commits.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-02-05 23:08             ` Stephen Rothwell
@ 2023-02-05 23:20               ` John Paul Adrian Glaubitz
  2023-02-13 16:30               ` John Paul Adrian Glaubitz
  1 sibling, 0 replies; 80+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-02-05 23:20 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, Laurent Pinchart, Kieran Bingham,
	Geert Uytterhoeven, linux-kernel, linux-watchdog, devicetree,
	linux-arch, dmaengine, dri-devel, linux-renesas-soc, linux-i2c,
	linux-input, linux-media, linux-mmc, linux-mtd, netdev,
	linux-gpio, linux-rtc, linux-spi, linux-serial, linux-usb,
	linux-fbdev, alsa-devel, linux-sh

Hi Stephen!

On Mon, 2023-02-06 at 10:08 +1100, Stephen Rothwell wrote:
> Hi,
> 
> On Fri, 3 Feb 2023 09:30:37 +0100 Christoph Hellwig <hch@lst.de> wrote:
> > 
> > On Fri, Feb 03, 2023 at 09:24:46AM +0100, John Paul Adrian Glaubitz wrote:
> > > Since this is my very first time stepping up as a kernel maintainer, I was hoping
> > > to get some pointers on what to do to make this happen.
> > > 
> > > So far, we have set up a new kernel tree and I have set up a local development and
> > > test environment for SH kernels using my SH7785LCR board as the target platform.
> > > 
> > > Do I just need to send a patch asking to change the corresponding entry in the
> > > MAINTAINERS file?  
> > 
> > I'm not sure a there is a document, but:
> > 
> >  - add the MAINTAINERS change to your tree
> >  - ask Stephen to get your tree included in linux-next
> 
> And by "Stephen", Christoph means me.  When you are ready, please send
> me a request to include your tree/branch in linux-next (usually the
> branch is called something like "for-next" or just "next") telling me
> the git URL, and the contacts I should send email to if there are
> conflicts/build issues with the branch.  I will then fetch the branch
> every time I create a new linux-next release (most work days), so all
> you need to do is update that branch each time you are ready to publish
> more commits.

Thanks a lot! I will start with that tomorrow with Geert giving me some guidance.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-02-03  7:14       ` Christoph Hellwig
  2023-02-03  8:24         ` John Paul Adrian Glaubitz
@ 2023-02-07  9:06         ` John Paul Adrian Glaubitz
  2023-02-08  1:31           ` Randy Dunlap
  1 sibling, 1 reply; 80+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-02-07  9:06 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Hello Christoph!

On Fri, 2023-02-03 at 08:14 +0100, Christoph Hellwig wrote:
> On Mon, Jan 16, 2023 at 09:52:10AM +0100, John Paul Adrian Glaubitz wrote:
> > We have had a discussion between multiple people invested in the SuperH port and
> > I have decided to volunteer as a co-maintainer of the port to support Rich Felker
> > when he isn't available.
> 
> So, this still isn't reflected in MAINTAINERS in linux-next.  When
> do you plan to take over?  What platforms will remain supported and
> what can we start dropping due to being unused and unmaintained?

I'm getting everything ready now with Geert's help and I have a probably dumb
question regarding the MAINTAINERS file change: Shall I just add myself as an
additional maintainer first or shall I also drop Yoshinori Sato?

Also, is it desirable to add a "T:" entry for the kernel tree?

Thanks,
Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-02-07  9:06         ` John Paul Adrian Glaubitz
@ 2023-02-08  1:31           ` Randy Dunlap
  2023-02-08 12:13             ` John Paul Adrian Glaubitz
  0 siblings, 1 reply; 80+ messages in thread
From: Randy Dunlap @ 2023-02-08  1:31 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz, Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh



On 2/7/23 01:06, John Paul Adrian Glaubitz wrote:
> Hello Christoph!
> 
> On Fri, 2023-02-03 at 08:14 +0100, Christoph Hellwig wrote:
>> On Mon, Jan 16, 2023 at 09:52:10AM +0100, John Paul Adrian Glaubitz wrote:
>>> We have had a discussion between multiple people invested in the SuperH port and
>>> I have decided to volunteer as a co-maintainer of the port to support Rich Felker
>>> when he isn't available.
>>
>> So, this still isn't reflected in MAINTAINERS in linux-next.  When
>> do you plan to take over?  What platforms will remain supported and
>> what can we start dropping due to being unused and unmaintained?
> 
> I'm getting everything ready now with Geert's help and I have a probably dumb
> question regarding the MAINTAINERS file change: Shall I just add myself as an
> additional maintainer first or shall I also drop Yoshinori Sato?
> 
> Also, is it desirable to add a "T:" entry for the kernel tree?

Yes, definitely.

thanks.
-- 
~Randy

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-02-08  1:31           ` Randy Dunlap
@ 2023-02-08 12:13             ` John Paul Adrian Glaubitz
  2023-02-08 12:24               ` Huacai Chen
  2023-02-09  3:09               ` Rob Landley
  0 siblings, 2 replies; 80+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-02-08 12:13 UTC (permalink / raw)
  To: Randy Dunlap, Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

Hi Randy!

On Tue, 2023-02-07 at 17:31 -0800, Randy Dunlap wrote:
> 
> On 2/7/23 01:06, John Paul Adrian Glaubitz wrote:
> > Hello Christoph!
> > 
> > On Fri, 2023-02-03 at 08:14 +0100, Christoph Hellwig wrote:
> > > On Mon, Jan 16, 2023 at 09:52:10AM +0100, John Paul Adrian Glaubitz wrote:
> > > > We have had a discussion between multiple people invested in the SuperH port and
> > > > I have decided to volunteer as a co-maintainer of the port to support Rich Felker
> > > > when he isn't available.
> > > 
> > > So, this still isn't reflected in MAINTAINERS in linux-next.  When
> > > do you plan to take over?  What platforms will remain supported and
> > > what can we start dropping due to being unused and unmaintained?
> > 
> > I'm getting everything ready now with Geert's help and I have a probably dumb
> > question regarding the MAINTAINERS file change: Shall I just add myself as an
> > additional maintainer first or shall I also drop Yoshinori Sato?
> > 
> > Also, is it desirable to add a "T:" entry for the kernel tree?
> 
> Yes, definitely.

Geert has suggested to wait with adding a tree source to the entry until I get my
own kernel.org account. I have enough GPG signatures from multiple kernel developers
on my GPG key, so I think it shouldn't be too difficult to qualify for an account.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-02-08 12:13             ` John Paul Adrian Glaubitz
@ 2023-02-08 12:24               ` Huacai Chen
  2023-02-08 12:37                 ` John Paul Adrian Glaubitz
  2023-02-09  3:09               ` Rob Landley
  1 sibling, 1 reply; 80+ messages in thread
From: Huacai Chen @ 2023-02-08 12:24 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Randy Dunlap, Christoph Hellwig, Yoshinori Sato, Rich Felker,
	Arnd Bergmann, Greg Kroah-Hartman, Laurent Pinchart,
	Kieran Bingham, Geert Uytterhoeven, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

Emm, maybe this patch has its chance to be merged now. :)

https://lore.kernel.org/linux-sh/CAAhV-H6siOtVkZpkS4aABejgZCqTwp3TihA0+0HGZ1+mU3XAVA@mail.gmail.com/T/#u

Huacai

On Wed, Feb 8, 2023 at 8:14 PM John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
>
> Hi Randy!
>
> On Tue, 2023-02-07 at 17:31 -0800, Randy Dunlap wrote:
> >
> > On 2/7/23 01:06, John Paul Adrian Glaubitz wrote:
> > > Hello Christoph!
> > >
> > > On Fri, 2023-02-03 at 08:14 +0100, Christoph Hellwig wrote:
> > > > On Mon, Jan 16, 2023 at 09:52:10AM +0100, John Paul Adrian Glaubitz wrote:
> > > > > We have had a discussion between multiple people invested in the SuperH port and
> > > > > I have decided to volunteer as a co-maintainer of the port to support Rich Felker
> > > > > when he isn't available.
> > > >
> > > > So, this still isn't reflected in MAINTAINERS in linux-next.  When
> > > > do you plan to take over?  What platforms will remain supported and
> > > > what can we start dropping due to being unused and unmaintained?
> > >
> > > I'm getting everything ready now with Geert's help and I have a probably dumb
> > > question regarding the MAINTAINERS file change: Shall I just add myself as an
> > > additional maintainer first or shall I also drop Yoshinori Sato?
> > >
> > > Also, is it desirable to add a "T:" entry for the kernel tree?
> >
> > Yes, definitely.
>
> Geert has suggested to wait with adding a tree source to the entry until I get my
> own kernel.org account. I have enough GPG signatures from multiple kernel developers
> on my GPG key, so I think it shouldn't be too difficult to qualify for an account.
>
> Adrian
>
> --
>  .''`.  John Paul Adrian Glaubitz
> : :' :  Debian Developer
> `. `'   Physicist
>   `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-02-08 12:24               ` Huacai Chen
@ 2023-02-08 12:37                 ` John Paul Adrian Glaubitz
  2023-02-08 14:12                   ` Wolfram Sang
  0 siblings, 1 reply; 80+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-02-08 12:37 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Randy Dunlap, Christoph Hellwig, Yoshinori Sato, Rich Felker,
	Arnd Bergmann, Greg Kroah-Hartman, Laurent Pinchart,
	Kieran Bingham, Geert Uytterhoeven, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

Hi Huacei!

On Wed, 2023-02-08 at 20:24 +0800, Huacai Chen wrote:
> Emm, maybe this patch has its chance to be merged now. :)
> 
> https://lore.kernel.org/linux-sh/CAAhV-H6siOtVkZpkS4aABejgZCqTwp3TihA0+0HGZ1+mU3XAVA@mail.gmail.com/T/#u

Yes, that's the plan. We're collecting the various patches people have sent
in for arch/sh, review and test them and apply them.

My test board is running the latest kernel now, so I can test new patches, too.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-02-08 12:37                 ` John Paul Adrian Glaubitz
@ 2023-02-08 14:12                   ` Wolfram Sang
  0 siblings, 0 replies; 80+ messages in thread
From: Wolfram Sang @ 2023-02-08 14:12 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Huacai Chen, Randy Dunlap, Christoph Hellwig, Yoshinori Sato,
	Rich Felker, Arnd Bergmann, Greg Kroah-Hartman, Laurent Pinchart,
	Kieran Bingham, Geert Uytterhoeven, linux-kernel, linux-watchdog,
	devicetree, linux-arch, dmaengine, dri-devel, linux-renesas-soc,
	linux-i2c, linux-input, linux-media, linux-mmc, linux-mtd,
	netdev, linux-gpio, linux-rtc, linux-spi, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-sh

[-- Attachment #1: Type: text/plain, Size: 447 bytes --]


> Yes, that's the plan. We're collecting the various patches people have sent
> in for arch/sh, review and test them and apply them.
> 
> My test board is running the latest kernel now, so I can test new patches, too.

I am just witnessing this development, but I want to say thanks for your
effort and congrats on your progress. Looks like you do the right things
correctly, cool! Kudos also to Geert and others for their assistance.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-02-03 15:57                 ` Randy Dunlap
  2023-02-03 16:04                   ` Geert Uytterhoeven
@ 2023-02-09  3:06                   ` Rob Landley
  1 sibling, 0 replies; 80+ messages in thread
From: Rob Landley @ 2023-02-09  3:06 UTC (permalink / raw)
  To: Randy Dunlap, Geert Uytterhoeven, John Paul Adrian Glaubitz
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, Laurent Pinchart, Kieran Bingham,
	Geert Uytterhoeven, linux-kernel, linux-watchdog, devicetree,
	linux-arch, dmaengine, dri-devel, linux-renesas-soc, linux-i2c,
	linux-input, linux-media, linux-mmc, linux-mtd, netdev,
	linux-gpio, linux-rtc, linux-spi, linux-serial, linux-usb,
	linux-fbdev, alsa-devel, linux-sh

On 2/3/23 09:57, Randy Dunlap wrote:
> Hi--
> 
> On 2/3/23 02:33, Geert Uytterhoeven wrote:
>> Hi Adrian,
>> 
>> On Fri, Feb 3, 2023 at 11:29 AM John Paul Adrian Glaubitz
>> <glaubitz@physik.fu-berlin.de> wrote:
>>> On Fri, 2023-02-03 at 09:30 +0100, Christoph Hellwig wrote:
>>>> On Fri, Feb 03, 2023 at 09:24:46AM +0100, John Paul Adrian Glaubitz wrote:
>>>>> Since this is my very first time stepping up as a kernel maintainer, I was hoping
>>>>> to get some pointers on what to do to make this happen.
>>>>>
>>>>> So far, we have set up a new kernel tree and I have set up a local development and
>>>>> test environment for SH kernels using my SH7785LCR board as the target platform.
>>>>>
>>>>> Do I just need to send a patch asking to change the corresponding entry in the
>>>>> MAINTAINERS file?
>>>>
>>>> I'm not sure a there is a document, but:
>>>>
>>>>  - add the MAINTAINERS change to your tree
>>>>  - ask Stephen to get your tree included in linux-next
>>>>
>>>> then eventually send a pull request to Linus with all of that.  Make
>>>> sure it's been in linux-next for a while.
>>>
>>> OK, thanks for the pointers! Will try to get this done by next week.
>>>
>>> We're still discussing among SuperH developer community whether there will be a second
>>> maintainer, so please bear with us a few more days. I will collect patches in the
>>> meantime.
>> 
>> Thanks a lot!
>> 
>> If you need any help with process, setup, ... don't hesitate to ask
>> (on e.g. #renesas-soc on Libera).
> 
> While Adrian and Geert are reading this, I have a question:
> 
> Is this "sh64" still accurate and applicable?

I hadn't noticed it was there... Randy Dunlap added that in 2018 (commit
09b1565324cba). I wonder why?

> from Documentation/kbuild/kbuild.rst:

There isn't an active 64 bit superh architecture for the moment: sh5 was a
prototype that never shipped in volume, and support was removed in commit
37744feebc08. From the j-core side j64 hasn't shipped yet either (still planned
last I heard, but j-core went downmarket first instead due to customer demand,
and multi-issue is on the roadmap before 64 bit address space).

The general trend in linux kernel architectures has been to merge 32 and 64 bit
anyway, and just have the .config set CONFIG_64BIT to distinguish: arch/x86 was
created by merging arch/i386 and arch/x86_64 in 2007, arch/powerpc merged the 32
and 64 bit directories in 2005, arch/s390 and s390x are in the same dir,
arch/mips... (For some reason arm and arm64 are still split, but that might be
fallout from Arm Ltd trying to distinguish aarrcchh6644 from "arm" for some
reason? Dunno.)

I wonder why is this going the other way? I thought $ARCH mostly just specified
the subdirectory under arch/ with a few historical aliases in the top level
Makefile:

# Additional ARCH settings for x86
ifeq ($(ARCH),i386)
        SRCARCH := x86
endif
ifeq ($(ARCH),x86_64)
        SRCARCH := x86
endif

# Additional ARCH settings for sparc
ifeq ($(ARCH),sparc32)
       SRCARCH := sparc
endif
ifeq ($(ARCH),sparc64)
       SRCARCH := sparc
endif

# Additional ARCH settings for parisc
ifeq ($(ARCH),parisc64)
       SRCARCH := parisc
endif

But you could always just specify the correct ARCH directory directly and it
would work. (Always did when I tried it, although I haven't built sparc in years
because there's no musl-libc support, and never built parisc64 because I
couldn't get it to work with uClibc even before musl. I _am_ still building both
32 bit and 64 bit x86 with ARCH=x86 both times...)

> But some architectures such as x86 and sparc have aliases.
> 
> - x86: i386 for 32 bit, x86_64 for 64 bit
> - sh: sh for 32 bit, sh64 for 64 bit <<<<<<<<<<<<<<<
> - sparc: sparc32 for 32 bit, sparc64 for 64 bit

Randy also added the sparc alias in commit 5ba800962a80. That at least exists in
the top level Makefile.

Did he mean parisc64 and typoed sh64? Because that's the only other alias in the
top level Makefile...

In any case, these are historical aliases for old builds, which can probably get
yanked because it should be a trivial fix to use the right ARCH= value for
modern builds? (I'd think?)

You'd even be able to build a 64 bit version of ARCH=i386 just fine if it wasn't
for the ONE place in arch/x86/Kconfig that actually checks:

config 64BIT
        bool "64-bit kernel" if "$(ARCH)" = "x86"
        default "$(ARCH)" != "i386"

Same for arch/sparc/Kconfig:

config 64BIT
        bool "64-bit kernel" if "$(ARCH)" = "sparc"
        default "$(ARCH)" = "sparc64"

Nothing else anywhere seems to care...

> Thanks.

Rob

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-02-08 12:13             ` John Paul Adrian Glaubitz
  2023-02-08 12:24               ` Huacai Chen
@ 2023-02-09  3:09               ` Rob Landley
  2023-02-09  9:15                 ` John Paul Adrian Glaubitz
  1 sibling, 1 reply; 80+ messages in thread
From: Rob Landley @ 2023-02-09  3:09 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz, Randy Dunlap, Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

On 2/8/23 06:13, John Paul Adrian Glaubitz wrote:
> Hi Randy!
> 
> On Tue, 2023-02-07 at 17:31 -0800, Randy Dunlap wrote:
>> 
>> On 2/7/23 01:06, John Paul Adrian Glaubitz wrote:
>> > Hello Christoph!
>> > 
>> > On Fri, 2023-02-03 at 08:14 +0100, Christoph Hellwig wrote:
>> > > On Mon, Jan 16, 2023 at 09:52:10AM +0100, John Paul Adrian Glaubitz wrote:
>> > > > We have had a discussion between multiple people invested in the SuperH port and
>> > > > I have decided to volunteer as a co-maintainer of the port to support Rich Felker
>> > > > when he isn't available.
>> > > 
>> > > So, this still isn't reflected in MAINTAINERS in linux-next.  When
>> > > do you plan to take over?  What platforms will remain supported and
>> > > what can we start dropping due to being unused and unmaintained?
>> > 
>> > I'm getting everything ready now with Geert's help and I have a probably dumb
>> > question regarding the MAINTAINERS file change: Shall I just add myself as an
>> > additional maintainer first or shall I also drop Yoshinori Sato?
>> > 
>> > Also, is it desirable to add a "T:" entry for the kernel tree?
>> 
>> Yes, definitely.
> 
> Geert has suggested to wait with adding a tree source to the entry until I get my
> own kernel.org account. I have enough GPG signatures from multiple kernel developers
> on my GPG key, so I think it shouldn't be too difficult to qualify for an account.

So you're not planning to use https://lk.j-core.org/J-Core-Developers/sh-linux
but push to kernel.org and ask Linus to pull from there?

> Adrian

Rob

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-02-09  3:09               ` Rob Landley
@ 2023-02-09  9:15                 ` John Paul Adrian Glaubitz
  0 siblings, 0 replies; 80+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-02-09  9:15 UTC (permalink / raw)
  To: Rob Landley, Randy Dunlap, Christoph Hellwig
  Cc: Yoshinori Sato, Rich Felker, Arnd Bergmann, Greg Kroah-Hartman,
	Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven,
	linux-kernel, linux-watchdog, devicetree, linux-arch, dmaengine,
	dri-devel, linux-renesas-soc, linux-i2c, linux-input,
	linux-media, linux-mmc, linux-mtd, netdev, linux-gpio, linux-rtc,
	linux-spi, linux-serial, linux-usb, linux-fbdev, alsa-devel,
	linux-sh

On Wed, 2023-02-08 at 21:09 -0600, Rob Landley wrote:
> > Geert has suggested to wait with adding a tree source to the entry until I get my
> > own kernel.org account. I have enough GPG signatures from multiple kernel developers
> > on my GPG key, so I think it shouldn't be too difficult to qualify for an account.
> 
> So you're not planning to use https://lk.j-core.org/J-Core-Developers/sh-linux
> but push to kernel.org and ask Linus to pull from there?

Yes, that's what Geert recommended.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: remove arch/sh
  2023-02-05 23:08             ` Stephen Rothwell
  2023-02-05 23:20               ` John Paul Adrian Glaubitz
@ 2023-02-13 16:30               ` John Paul Adrian Glaubitz
  1 sibling, 0 replies; 80+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-02-13 16:30 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, Laurent Pinchart, Kieran Bingham,
	Geert Uytterhoeven, linux-kernel, linux-watchdog, devicetree,
	linux-arch, dmaengine, dri-devel, linux-renesas-soc, linux-i2c,
	linux-input, linux-media, linux-mmc, linux-mtd, netdev,
	linux-gpio, linux-rtc, linux-spi, linux-serial, linux-usb,
	linux-fbdev, alsa-devel, linux-sh

Hi Steve!

On Mon, 2023-02-06 at 10:08 +1100, Stephen Rothwell wrote:
> Hi,
> 
> On Fri, 3 Feb 2023 09:30:37 +0100 Christoph Hellwig <hch@lst.de> wrote:
> > 
> > On Fri, Feb 03, 2023 at 09:24:46AM +0100, John Paul Adrian Glaubitz wrote:
> > > Since this is my very first time stepping up as a kernel maintainer, I was hoping
> > > to get some pointers on what to do to make this happen.
> > > 
> > > So far, we have set up a new kernel tree and I have set up a local development and
> > > test environment for SH kernels using my SH7785LCR board as the target platform.
> > > 
> > > Do I just need to send a patch asking to change the corresponding entry in the
> > > MAINTAINERS file?  
> > 
> > I'm not sure a there is a document, but:
> > 
> >  - add the MAINTAINERS change to your tree
> >  - ask Stephen to get your tree included in linux-next
> 
> And by "Stephen", Christoph means me.  When you are ready, please send
> me a request to include your tree/branch in linux-next (usually the
> branch is called something like "for-next" or just "next") telling me
> the git URL, and the contacts I should send email to if there are
> conflicts/build issues with the branch.  I will then fetch the branch
> every time I create a new linux-next release (most work days), so all
> you need to do is update that branch each time you are ready to publish
> more commits.

I'm in the MAINTAINERS now in Linus' tree. I have requested a kernel.org
account now and will hopefully have my trees set up later this week.

I'll let you know about the URLs as soon as possible.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 80+ messages in thread

end of thread, other threads:[~2023-02-13 16:31 UTC | newest]

Thread overview: 80+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13  6:23 remove arch/sh Christoph Hellwig
2023-01-13  6:23 ` [PATCH 01/22] gpu/drm: remove the shmobile drm driver Christoph Hellwig
2023-01-13  7:46   ` Laurent Pinchart
2023-01-13  7:55     ` Laurent Pinchart
2023-01-13  8:19       ` Geert Uytterhoeven
2023-02-03  7:15     ` Christoph Hellwig
2023-02-03 13:49       ` Laurent Pinchart
2023-02-03 13:53         ` Geert Uytterhoeven
2023-01-13  6:23 ` [PATCH 02/22] usb: remove the dead USB_OHCI_SH option Christoph Hellwig
2023-01-13  7:12   ` Greg Kroah-Hartman
2023-01-13  7:14     ` Christoph Hellwig
2023-01-15  0:55     ` Rob Landley
2023-02-03  7:15     ` Christoph Hellwig
2023-02-03  7:25       ` Greg Kroah-Hartman
2023-01-13  8:59   ` Geert Uytterhoeven
2023-01-13  6:23 ` [PATCH 04/22] sound: remove sound/sh Christoph Hellwig
2023-01-13 16:18   ` Takashi Iwai
2023-01-13  6:23 ` [PATCH 05/22] sound: remove sh-specific sounds/soc/sh drivers Christoph Hellwig
2023-01-17 22:52   ` Kuninori Morimoto
2023-01-13  6:23 ` [PATCH 06/22] watchdog: remove the shwdt driver Christoph Hellwig
2023-01-13 14:00   ` Guenter Roeck
2023-01-13  6:23 ` [PATCH 07/22] cpufreq: remove the sh-cpufreq driver Christoph Hellwig
2023-01-13  6:23 ` [PATCH 08/22] dmaengine: remove the shdmac driver Christoph Hellwig
2023-01-13  6:23 ` [PATCH 09/22] i2c: remove i2c-sh7760 Christoph Hellwig
2023-01-13  6:23 ` [PATCH 10/22] input: remove sh_keysc Christoph Hellwig
2023-01-13  8:28   ` Geert Uytterhoeven
2023-01-13  6:23 ` [PATCH 11/22] mtd/nand: remove sh_flctl Christoph Hellwig
2023-01-13  8:30   ` Geert Uytterhoeven
2023-01-13 10:06     ` Arnd Bergmann
2023-01-13  6:23 ` [PATCH 12/22] net/ethernet/8390: remove stnic Christoph Hellwig
2023-01-13  6:23 ` [PATCH 15/22] spi: remove spi-sh Christoph Hellwig
2023-01-13  6:23 ` [PATCH 16/22] spi: remove spi-sh-sci Christoph Hellwig
2023-01-13  8:50   ` Geert Uytterhoeven
2023-01-13  6:23 ` [PATCH 17/22] spi: remove spi-jcore Christoph Hellwig
2023-01-13  6:23 ` [PATCH 18/22] usb: remove ehci-sh Christoph Hellwig
2023-01-13  6:23 ` [PATCH 19/22] fbdev: remove sh7760fb Christoph Hellwig
2023-01-13  8:53   ` Geert Uytterhoeven
2023-01-13  6:23 ` [PATCH 20/22] media: remove sh_vou Christoph Hellwig
2023-01-13  8:01   ` Laurent Pinchart
2023-01-13  9:05     ` Hans Verkuil
2023-01-13  6:23 ` [PATCH 21/22] drivers: platform: remove is_sh_early_platform_device Christoph Hellwig
2023-01-13  6:23 ` [PATCH 22/22] drivers: platform: remove early_platform_cleanup Christoph Hellwig
2023-01-13  8:09 ` remove arch/sh John Paul Adrian Glaubitz
2023-01-13  8:26   ` Geert Uytterhoeven
2023-01-13  8:52     ` John Paul Adrian Glaubitz
2023-01-13 19:11       ` Rob Landley
2023-01-13 19:05         ` John Paul Adrian Glaubitz
2023-01-13 23:32           ` Rob Landley
2023-01-16  7:14     ` Christoph Hellwig
2023-01-16  7:13   ` Christoph Hellwig
2023-01-16  8:52     ` John Paul Adrian Glaubitz
2023-02-03  7:14       ` Christoph Hellwig
2023-02-03  8:24         ` John Paul Adrian Glaubitz
2023-02-03  8:30           ` Christoph Hellwig
2023-02-03 10:29             ` John Paul Adrian Glaubitz
2023-02-03 10:33               ` Geert Uytterhoeven
2023-02-03 10:36                 ` John Paul Adrian Glaubitz
2023-02-03 15:57                 ` Randy Dunlap
2023-02-03 16:04                   ` Geert Uytterhoeven
2023-02-09  3:06                   ` Rob Landley
2023-02-05 23:08             ` Stephen Rothwell
2023-02-05 23:20               ` John Paul Adrian Glaubitz
2023-02-13 16:30               ` John Paul Adrian Glaubitz
2023-02-07  9:06         ` John Paul Adrian Glaubitz
2023-02-08  1:31           ` Randy Dunlap
2023-02-08 12:13             ` John Paul Adrian Glaubitz
2023-02-08 12:24               ` Huacai Chen
2023-02-08 12:37                 ` John Paul Adrian Glaubitz
2023-02-08 14:12                   ` Wolfram Sang
2023-02-09  3:09               ` Rob Landley
2023-02-09  9:15                 ` John Paul Adrian Glaubitz
2023-01-17 19:13     ` Rob Landley
2023-01-17 20:26       ` Geert Uytterhoeven
2023-01-17 23:05         ` Guenter Roeck
2023-01-18  0:10           ` D. Jeff Dionne
2023-01-18  5:03         ` Rob Landley
2023-01-18  7:46           ` Geert Uytterhoeven
2023-01-18 11:14             ` Rob Landley
     [not found] ` <20230113062339.1909087-14-hch@lst.de>
2023-01-13  8:45   ` [PATCH 13/22] pinctrl: remove renesas sh controllers Geert Uytterhoeven
2023-01-13 15:18 ` remove arch/sh Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).