mbox series

[v2,00/19] Modernize Loongson64 Machine

Message ID 20190905144316.12527-1-jiaxun.yang@flygoat.com
Headers show
Series Modernize Loongson64 Machine | expand

Message

Jiaxun Yang Sept. 5, 2019, 2:42 p.m. UTC
v1:
- dt-bindings fixup according to Rob's comments
- irqchip fixup according to Marc's comments
- ls3-iointc: Make Core&IP map per-IRQ
- Regenerate kconfigs
- Typo & style improvements

v2:
- dt-bindings: Fix IOINTC, collect Rob's review tag
- dtbs: Drop CPU Node, merge different ways according to Huacai and Paul's comments

Jiaxun Yang (19):
  MIPS: Loongson64: Rename CPU TYPES
  MIPS: Loongson64: separate loongson2ef/loongson64 code
  MAINTAINERS: Fix entries for new loongson64 path
  irqchip: Export generic chip domain map/unmap functions
  irqchip: Add driver for Loongson-3 I/O interrupt controller
  dt-bindings: interrupt-controller: Add Loongson-3 IOINTC
  irqchip: Add driver for Loongson-3 HyperTransport interrupt controller
  dt-bindings: interrupt-controller: Add Loongson-3 HTINTC
  irqchip: i8259: Add plat-poll support
  irqchip: mips-cpu: Convert to simple domain
  MIPS: Loongson64: Drop legacy IRQ code
  dt-bindings: mips: Add loongson boards
  dt-bindings: Document loongson vendor-prefix
  MIPS: Loongson64: Add generic dts
  MIPS: Loongson64: Load built-in dtbs
  GPIO: loongson: Drop Loongson-3A/3B support
  MIPS: Loongson: Regenerate defconfigs
  MAINTAINERS: Add new pathes to LOONGSON64 ARCHITECTURE
  MAINTAINERS: Add myself as maintainer of LOONGSON64

 .../loongson,ls3-htintc.yaml                  |  55 ++++
 .../loongson,ls3-iointc.yaml                  |  79 +++++
 .../bindings/mips/loongson/devices.yaml       |  39 +++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 MAINTAINERS                                   |  13 +-
 arch/mips/Kbuild.platforms                    |   1 +
 arch/mips/Kconfig                             |  83 ++++--
 arch/mips/boot/dts/Makefile                   |   1 +
 arch/mips/boot/dts/loongson/3a-package.dtsi   |  69 +++++
 arch/mips/boot/dts/loongson/3a1000_780e.dts   |  10 +
 arch/mips/boot/dts/loongson/3a2000_780e.dts   |  10 +
 arch/mips/boot/dts/loongson/3a3000_780e.dts   |  10 +
 arch/mips/boot/dts/loongson/3b-package.dtsi   |  69 +++++
 arch/mips/boot/dts/loongson/3b1x00_780e.dts   |  10 +
 arch/mips/boot/dts/loongson/Makefile          |   5 +
 arch/mips/boot/dts/loongson/rs780e-pch.dtsi   |  35 +++
 arch/mips/configs/fuloong2e_defconfig         |   8 +-
 arch/mips/configs/lemote2f_defconfig          |   8 +-
 arch/mips/configs/loongson3_defconfig         |  13 +-
 arch/mips/include/asm/bootinfo.h              |   1 -
 arch/mips/include/asm/cop2.h                  |   2 +-
 arch/mips/include/asm/cpu-type.h              |   6 +-
 arch/mips/include/asm/cpu.h                   |   4 +-
 arch/mips/include/asm/hazards.h               |   2 +-
 arch/mips/include/asm/io.h                    |   2 +-
 arch/mips/include/asm/irqflags.h              |   2 +-
 .../mach-loongson2ef/cpu-feature-overrides.h  |  45 +++
 .../cs5536/cs5536.h                           |   0
 .../cs5536/cs5536_mfgpt.h                     |   0
 .../cs5536/cs5536_pci.h                       |   0
 .../cs5536/cs5536_vsm.h                       |   0
 .../loongson2ef.h}                            |  31 +-
 .../machine.h                                 |   6 -
 .../mc146818rtc.h                             |   5 +-
 .../mem.h                                     |   6 +-
 arch/mips/include/asm/mach-loongson2ef/pci.h  |  43 +++
 .../include/asm/mach-loongson2ef/spaces.h     |  10 +
 .../asm/mach-loongson64/builtin_dtbs.h        |  16 +
 .../mach-loongson64/cpu-feature-overrides.h   |   8 +-
 arch/mips/include/asm/mach-loongson64/irq.h   |   6 +-
 .../asm/mach-loongson64/kernel-entry-init.h   |  74 -----
 .../include/asm/mach-loongson64/loongson64.h  |  50 ++++
 .../mips/include/asm/mach-loongson64/mmzone.h |  16 -
 arch/mips/include/asm/mach-loongson64/pci.h   |  41 +--
 .../include/asm/mach-loongson64/workarounds.h |   4 +-
 arch/mips/include/asm/module.h                |   8 +-
 arch/mips/include/asm/processor.h             |   2 +-
 arch/mips/include/asm/r4kcache.h              |   4 +-
 arch/mips/kernel/cpu-probe.c                  |  14 +-
 arch/mips/kernel/idle.c                       |   2 +-
 arch/mips/kernel/perf_event_mipsxx.c          |   4 +-
 arch/mips/kernel/setup.c                      |   2 +-
 arch/mips/kernel/traps.c                      |   2 +-
 arch/mips/lib/csum_partial.S                  |   4 +-
 arch/mips/loongson2ef/Kconfig                 |  93 ++++++
 arch/mips/loongson2ef/Makefile                |  18 ++
 arch/mips/loongson2ef/Platform                |  32 ++
 .../common/Makefile                           |   0
 .../common/bonito-irq.c                       |   2 +-
 .../common/cmdline.c                          |   2 +-
 .../common/cs5536/Makefile                    |   0
 .../common/cs5536/cs5536_acc.c                |   0
 .../common/cs5536/cs5536_ehci.c               |   0
 .../common/cs5536/cs5536_ide.c                |   0
 .../common/cs5536/cs5536_isa.c                |   0
 .../common/cs5536/cs5536_mfgpt.c              |   0
 .../common/cs5536/cs5536_ohci.c               |   0
 .../common/cs5536/cs5536_pci.c                |   0
 .../common/early_printk.c                     |   2 +-
 arch/mips/loongson2ef/common/env.c            |  71 +++++
 .../{loongson64 => loongson2ef}/common/init.c |   7 +-
 .../{loongson64 => loongson2ef}/common/irq.c  |   2 +-
 .../common/machtype.c                         |   3 +-
 .../{loongson64 => loongson2ef}/common/mem.c  |  40 +--
 .../{loongson64 => loongson2ef}/common/pci.c  |  11 +-
 .../common/platform.c                         |   0
 .../{loongson64 => loongson2ef}/common/pm.c   |   2 +-
 .../common/reset.c                            |  23 +-
 .../{loongson64 => loongson2ef}/common/rtc.c  |   0
 .../common/serial.c                           |  37 +--
 .../common/setup.c                            |   2 +-
 .../{loongson64 => loongson2ef}/common/time.c |   2 +-
 .../common/uart_base.c                        |  10 +-
 .../fuloong-2e/Makefile                       |   0
 .../fuloong-2e/dma.c                          |   0
 .../fuloong-2e/irq.c                          |   2 +-
 .../fuloong-2e/reset.c                        |   2 +-
 .../lemote-2f/Makefile                        |   0
 .../lemote-2f/clock.c                         |   2 +-
 .../lemote-2f/dma.c                           |   0
 .../lemote-2f/ec_kb3310b.c                    |   0
 .../lemote-2f/ec_kb3310b.h                    |   0
 .../lemote-2f/irq.c                           |   2 +-
 .../lemote-2f/machtype.c                      |   2 +-
 .../lemote-2f/pm.c                            |   2 +-
 .../lemote-2f/reset.c                         |   2 +-
 arch/mips/loongson64/Kconfig                  | 126 +-------
 arch/mips/loongson64/Makefile                 |  23 +-
 arch/mips/loongson64/Platform                 |  36 +--
 .../loongson64/{loongson-3 => }/acpi_init.c   |   3 +-
 .../loongson64/{loongson-3 => }/cop2-ex.c     |   5 +-
 arch/mips/loongson64/{loongson-3 => }/dma.c   |   6 +-
 arch/mips/loongson64/{common => }/env.c       |  98 +++----
 arch/mips/loongson64/{loongson-3 => }/hpet.c  |   0
 arch/mips/loongson64/irq.c                    |  27 ++
 arch/mips/loongson64/loongson-3/Makefile      |  11 -
 arch/mips/loongson64/loongson-3/irq.c         | 158 ----------
 arch/mips/loongson64/{loongson-3 => }/numa.c  |   4 +-
 arch/mips/loongson64/pci.c                    |  45 +++
 .../loongson64/{loongson-3 => }/platform.c    |   0
 arch/mips/loongson64/reset.c                  |  58 ++++
 arch/mips/loongson64/setup.c                  | 107 +++++++
 arch/mips/loongson64/{loongson-3 => }/smp.c   |  28 +-
 arch/mips/loongson64/{loongson-3 => }/smp.h   |   0
 arch/mips/mm/c-r4k.c                          |  32 +-
 arch/mips/mm/page.c                           |   2 +-
 arch/mips/mm/tlb-r4k.c                        |   4 +-
 arch/mips/mm/tlbex.c                          |   6 +-
 arch/mips/oprofile/Makefile                   |   4 +-
 arch/mips/oprofile/common.c                   |   4 +-
 arch/mips/oprofile/op_model_loongson2.c       |   2 +-
 arch/mips/oprofile/op_model_loongson3.c       |   2 +-
 arch/mips/pci/Makefile                        |   2 +-
 arch/mips/pci/fixup-fuloong2e.c               |   2 +-
 arch/mips/pci/fixup-lemote2f.c                |   2 +-
 arch/mips/pci/ops-loongson2.c                 |   2 +-
 arch/mips/pci/ops-loongson3.c                 |   2 +-
 drivers/cpufreq/loongson2_cpufreq.c           |   2 +-
 drivers/gpio/Kconfig                          |   6 +-
 drivers/gpio/gpio-loongson.c                  |  11 +-
 drivers/irqchip/Kconfig                       |  17 ++
 drivers/irqchip/Makefile                      |   2 +
 drivers/irqchip/irq-i8259.c                   |  47 ++-
 drivers/irqchip/irq-ls3-htintc.c              | 147 ++++++++++
 drivers/irqchip/irq-ls3-iointc.c              | 275 ++++++++++++++++++
 drivers/irqchip/irq-mips-cpu.c                |   2 +-
 drivers/platform/mips/cpu_hwmon.c             |   2 +-
 include/drm/drm_cache.h                       |   2 +-
 include/linux/irq.h                           |   1 +
 kernel/irq/generic-chip.c                     |   4 +-
 140 files changed, 1760 insertions(+), 874 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/loongson,ls3-htintc.yaml
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/loongson,ls3-iointc.yaml
 create mode 100644 Documentation/devicetree/bindings/mips/loongson/devices.yaml
 create mode 100644 arch/mips/boot/dts/loongson/3a-package.dtsi
 create mode 100644 arch/mips/boot/dts/loongson/3a1000_780e.dts
 create mode 100644 arch/mips/boot/dts/loongson/3a2000_780e.dts
 create mode 100644 arch/mips/boot/dts/loongson/3a3000_780e.dts
 create mode 100644 arch/mips/boot/dts/loongson/3b-package.dtsi
 create mode 100644 arch/mips/boot/dts/loongson/3b1x00_780e.dts
 create mode 100644 arch/mips/boot/dts/loongson/Makefile
 create mode 100644 arch/mips/boot/dts/loongson/rs780e-pch.dtsi
 create mode 100644 arch/mips/include/asm/mach-loongson2ef/cpu-feature-overrides.h
 rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/cs5536/cs5536.h (100%)
 rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/cs5536/cs5536_mfgpt.h (100%)
 rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/cs5536/cs5536_pci.h (100%)
 rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/cs5536/cs5536_vsm.h (100%)
 rename arch/mips/include/asm/{mach-loongson64/loongson.h => mach-loongson2ef/loongson2ef.h} (91%)
 rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/machine.h (80%)
 rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/mc146818rtc.h (80%)
 rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/mem.h (86%)
 create mode 100644 arch/mips/include/asm/mach-loongson2ef/pci.h
 create mode 100644 arch/mips/include/asm/mach-loongson2ef/spaces.h
 create mode 100644 arch/mips/include/asm/mach-loongson64/builtin_dtbs.h
 delete mode 100644 arch/mips/include/asm/mach-loongson64/kernel-entry-init.h
 create mode 100644 arch/mips/include/asm/mach-loongson64/loongson64.h
 create mode 100644 arch/mips/loongson2ef/Kconfig
 create mode 100644 arch/mips/loongson2ef/Makefile
 create mode 100644 arch/mips/loongson2ef/Platform
 rename arch/mips/{loongson64 => loongson2ef}/common/Makefile (100%)
 rename arch/mips/{loongson64 => loongson2ef}/common/bonito-irq.c (97%)
 rename arch/mips/{loongson64 => loongson2ef}/common/cmdline.c (97%)
 rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/Makefile (100%)
 rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_acc.c (100%)
 rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_ehci.c (100%)
 rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_ide.c (100%)
 rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_isa.c (100%)
 rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_mfgpt.c (100%)
 rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_ohci.c (100%)
 rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_pci.c (100%)
 rename arch/mips/{loongson64 => loongson2ef}/common/early_printk.c (97%)
 create mode 100644 arch/mips/loongson2ef/common/env.c
 rename arch/mips/{loongson64 => loongson2ef}/common/init.c (90%)
 rename arch/mips/{loongson64 => loongson2ef}/common/irq.c (98%)
 rename arch/mips/{loongson64 => loongson2ef}/common/machtype.c (94%)
 rename arch/mips/{loongson64 => loongson2ef}/common/mem.c (72%)
 rename arch/mips/{loongson64 => loongson2ef}/common/pci.c (89%)
 rename arch/mips/{loongson64 => loongson2ef}/common/platform.c (100%)
 rename arch/mips/{loongson64 => loongson2ef}/common/pm.c (99%)
 rename arch/mips/{loongson64 => loongson2ef}/common/reset.c (77%)
 rename arch/mips/{loongson64 => loongson2ef}/common/rtc.c (100%)
 rename arch/mips/{loongson64 => loongson2ef}/common/serial.c (63%)
 rename arch/mips/{loongson64 => loongson2ef}/common/setup.c (97%)
 rename arch/mips/{loongson64 => loongson2ef}/common/time.c (96%)
 rename arch/mips/{loongson64 => loongson2ef}/common/uart_base.c (77%)
 rename arch/mips/{loongson64 => loongson2ef}/fuloong-2e/Makefile (100%)
 rename arch/mips/{loongson64 => loongson2ef}/fuloong-2e/dma.c (100%)
 rename arch/mips/{loongson64 => loongson2ef}/fuloong-2e/irq.c (98%)
 rename arch/mips/{loongson64 => loongson2ef}/fuloong-2e/reset.c (93%)
 rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/Makefile (100%)
 rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/clock.c (98%)
 rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/dma.c (100%)
 rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/ec_kb3310b.c (100%)
 rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/ec_kb3310b.h (100%)
 rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/irq.c (99%)
 rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/machtype.c (98%)
 rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/pm.c (99%)
 rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/reset.c (99%)
 rename arch/mips/loongson64/{loongson-3 => }/acpi_init.c (99%)
 rename arch/mips/loongson64/{loongson-3 => }/cop2-ex.c (88%)
 rename arch/mips/loongson64/{loongson-3 => }/dma.c (82%)
 rename arch/mips/loongson64/{common => }/env.c (83%)
 rename arch/mips/loongson64/{loongson-3 => }/hpet.c (100%)
 create mode 100644 arch/mips/loongson64/irq.c
 delete mode 100644 arch/mips/loongson64/loongson-3/Makefile
 delete mode 100644 arch/mips/loongson64/loongson-3/irq.c
 rename arch/mips/loongson64/{loongson-3 => }/numa.c (98%)
 create mode 100644 arch/mips/loongson64/pci.c
 rename arch/mips/loongson64/{loongson-3 => }/platform.c (100%)
 create mode 100644 arch/mips/loongson64/reset.c
 create mode 100644 arch/mips/loongson64/setup.c
 rename arch/mips/loongson64/{loongson-3 => }/smp.c (98%)
 rename arch/mips/loongson64/{loongson-3 => }/smp.h (100%)
 create mode 100644 drivers/irqchip/irq-ls3-htintc.c
 create mode 100644 drivers/irqchip/irq-ls3-iointc.c

Comments

Huacai Chen Sept. 7, 2019, 2:53 a.m. UTC | #1
On Thu, Sep 5, 2019 at 10:47 PM Jiaxun Yang <jiaxun.yang@flygoat.com> wrote:
>
> Add generic device dts for Loongson-3 devices.
> They seems identical but will be different later.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>  arch/mips/Kconfig                           |  4 +-
>  arch/mips/boot/dts/Makefile                 |  1 +
>  arch/mips/boot/dts/loongson/3a-package.dtsi | 69 +++++++++++++++++++++
>  arch/mips/boot/dts/loongson/3a1000_780e.dts | 10 +++
>  arch/mips/boot/dts/loongson/3a2000_780e.dts | 10 +++
>  arch/mips/boot/dts/loongson/3a3000_780e.dts | 10 +++
>  arch/mips/boot/dts/loongson/3b-package.dtsi | 69 +++++++++++++++++++++
>  arch/mips/boot/dts/loongson/3b1x00_780e.dts | 10 +++
>  arch/mips/boot/dts/loongson/Makefile        |  5 ++
>  arch/mips/boot/dts/loongson/rs780e-pch.dtsi | 35 +++++++++++
>  10 files changed, 222 insertions(+), 1 deletion(-)
>  create mode 100644 arch/mips/boot/dts/loongson/3a-package.dtsi
>  create mode 100644 arch/mips/boot/dts/loongson/3a1000_780e.dts
>  create mode 100644 arch/mips/boot/dts/loongson/3a2000_780e.dts
>  create mode 100644 arch/mips/boot/dts/loongson/3a3000_780e.dts
>  create mode 100644 arch/mips/boot/dts/loongson/3b-package.dtsi
>  create mode 100644 arch/mips/boot/dts/loongson/3b1x00_780e.dts
>  create mode 100644 arch/mips/boot/dts/loongson/Makefile
>  create mode 100644 arch/mips/boot/dts/loongson/rs780e-pch.dtsi
>
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index b6bdd96ec74e..5bad9aafcbdf 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -489,6 +489,8 @@ config MACH_LOONGSON64
>         select SYS_SUPPORTS_LITTLE_ENDIAN
>         select ZONE_DMA32
>         select SYS_SUPPORTS_ZBOOT
> +       select USE_OF
> +       select BUILTIN_DTB
>         help
>           This enables the support of Loongson-3A/3B/2-series-soc processors
>
> @@ -3047,7 +3049,7 @@ endchoice
>  choice
>         prompt "Kernel command line type" if !CMDLINE_OVERRIDE
>         default MIPS_CMDLINE_FROM_DTB if USE_OF && !ATH79 && !MACH_INGENIC && \
> -                                        !MIPS_MALTA && \
> +                                        !MACH_LOONGSON64 && !MIPS_MALTA && \
>                                          !CAVIUM_OCTEON_SOC
>         default MIPS_CMDLINE_FROM_BOOTLOADER
>
> diff --git a/arch/mips/boot/dts/Makefile b/arch/mips/boot/dts/Makefile
> index 1e79cab8e269..d429a69bfe30 100644
> --- a/arch/mips/boot/dts/Makefile
> +++ b/arch/mips/boot/dts/Makefile
> @@ -4,6 +4,7 @@ subdir-y        += cavium-octeon
>  subdir-y       += img
>  subdir-y       += ingenic
>  subdir-y       += lantiq
> +subdir-y       += loongson
>  subdir-y       += mscc
>  subdir-y       += mti
>  subdir-y       += netlogic
> diff --git a/arch/mips/boot/dts/loongson/3a-package.dtsi b/arch/mips/boot/dts/loongson/3a-package.dtsi
> new file mode 100644
> index 000000000000..739cf43c7310
> --- /dev/null
> +++ b/arch/mips/boot/dts/loongson/3a-package.dtsi
> @@ -0,0 +1,69 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <dt-bindings/interrupt-controller/irq.h>
> +
> +/ {
> +       #address-cells = <2>;
> +       #size-cells = <2>;
> +
> +       cpuintc: interrupt-controller {
> +               #address-cells = <0>;
> +               #interrupt-cells = <1>;
> +               interrupt-controller;
> +               compatible = "mti,cpu-interrupt-controller";
> +       };
> +
> +       package@0 {
> +               compatible = "simple-bus";
> +               #address-cells = <2>;
> +               #size-cells = <1>;
> +               ranges = <0 0x1fe00000 0 0x1fe00000 0x100000
> +                               0 0x3ff00000 0 0x3ff00000 0x100000
> +                               0xEFD 0xFB000000 0xEFD 0xFB000000 0x10000000 /* 3A HT Config Space */>;
> +
> +               iointc: interrupt-controller@3ff01400 {
> +                       compatible = "loongson,ls3-iointc";
> +                       reg = <0 0x3ff01400 0x64>;
> +
> +                       interrupt-controller;
> +                       #interrupt-cells = <2>;
> +
> +                       interrupt-parent = <&cpuintc>;
> +                       interrupts = <2>;
> +                       };
> +
> +               cpu_uart0: serial@1fe001e0 {
> +                       device_type = "serial";
> +                       compatible = "ns16550a";
> +                       reg = <0 0x1fe001e0 0x8>;
> +                       clock-frequency = <33000000>;
> +                       interrupt-parent = <&iointc>;
> +                       interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
> +                       no-loopback-test;
> +               };
> +
> +               cpu_uart1: serial@1fe001e8 {
> +                       status = "disabled";
> +                       device_type = "serial";
> +                       compatible = "ns16550a";
> +                       reg = <0 0x1fe001e8 0x8>;
> +                       clock-frequency = <33000000>;
> +                       interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
> +                       interrupt-parent = <&iointc>;
> +                       no-loopback-test;
> +               };
> +
> +               htintc: interrupt-controller@0xEFDFB000080 {
> +                       compatible = "loongson,ls3-htintc";
> +                       reg = <0xEFD 0xFB000080 0x100>;
> +                       interrupt-controller;
> +                       #interrupt-cells = <1>;
> +
> +                       interrupt-parent = <&iointc>;
> +                       interrupts = <24 IRQ_TYPE_LEVEL_HIGH>,
> +                                               <25 IRQ_TYPE_LEVEL_HIGH>,
> +                                               <26 IRQ_TYPE_LEVEL_HIGH>,
> +                                               <27 IRQ_TYPE_LEVEL_HIGH>;
> +               };
> +       };
> +};

Hi, Jiaxun,

I'm very glad to see that dts files become less in this version, but I
think we also don't need to distinguish cpu types (i.e.,
3a1000/3b1500/3a2000/3a3000). Then, we only need three dts files
(loongson3_ls2h.dts, loongson3_ls7a.dts, loongson3_rs780.dts) which is
the same as in our own git repository. If we really need to
distinguish cpu type, PRID or CPUCFG in Loongson-3A4000 is more
suitable than dts. In other words, I want dts only do as minimal as
possible.

Huacai

> diff --git a/arch/mips/boot/dts/loongson/3a1000_780e.dts b/arch/mips/boot/dts/loongson/3a1000_780e.dts
> new file mode 100644
> index 000000000000..dc1afe9410c8
> --- /dev/null
> +++ b/arch/mips/boot/dts/loongson/3a1000_780e.dts
> @@ -0,0 +1,10 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +/dts-v1/;
> +
> +#include "3a-package.dtsi"
> +#include "rs780e-pch.dtsi"
> +
> +/ {
> +       compatible = "loongson,ls3a1000-780e";
> +};
> diff --git a/arch/mips/boot/dts/loongson/3a2000_780e.dts b/arch/mips/boot/dts/loongson/3a2000_780e.dts
> new file mode 100644
> index 000000000000..621e0d3b5fbd
> --- /dev/null
> +++ b/arch/mips/boot/dts/loongson/3a2000_780e.dts
> @@ -0,0 +1,10 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +/dts-v1/;
> +
> +#include "3a-package.dtsi"
> +#include "rs780e-pch.dtsi"
> +
> +/ {
> +       compatible = "loongson,ls3a2000-780e";
> +};
> diff --git a/arch/mips/boot/dts/loongson/3a3000_780e.dts b/arch/mips/boot/dts/loongson/3a3000_780e.dts
> new file mode 100644
> index 000000000000..f170f1c2189d
> --- /dev/null
> +++ b/arch/mips/boot/dts/loongson/3a3000_780e.dts
> @@ -0,0 +1,10 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +/dts-v1/;
> +
> +#include "3a-package.dtsi"
> +#include "rs780e-pch.dtsi"
> +
> +/ {
> +       compatible = "loongson,ls3a3000-780e";
> +};
> diff --git a/arch/mips/boot/dts/loongson/3b-package.dtsi b/arch/mips/boot/dts/loongson/3b-package.dtsi
> new file mode 100644
> index 000000000000..af6e115d33c0
> --- /dev/null
> +++ b/arch/mips/boot/dts/loongson/3b-package.dtsi
> @@ -0,0 +1,69 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <dt-bindings/interrupt-controller/irq.h>
> +
> +/ {
> +       #address-cells = <2>;
> +       #size-cells = <2>;
> +
> +       cpuintc: interrupt-controller {
> +               #address-cells = <0>;
> +               #interrupt-cells = <1>;
> +               interrupt-controller;
> +               compatible = "mti,cpu-interrupt-controller";
> +       };
> +
> +       package@0 {
> +               compatible = "simple-bus";
> +               #address-cells = <2>;
> +               #size-cells = <1>;
> +               ranges = <0 0x1fe00000 0 0x1fe00000 0x100000
> +                               0 0x3ff00000 0 0x3ff00000 0x100000
> +                               0x1EFD 0xFB000000 0x1EFD 0xFB000000 0x10000000 /* 3B HT Config Space */>;
> +
> +               iointc: interrupt-controller@3ff01400 {
> +                       compatible = "loongson,ls3-iointc";
> +                       reg = <0 0x3ff01400 0x64>;
> +
> +                       interrupt-controller;
> +                       #interrupt-cells = <2>;
> +
> +                       interrupt-parent = <&cpuintc>;
> +                       interrupts = <2>;
> +                       };
> +
> +               cpu_uart0: serial@1fe001e0 {
> +                       device_type = "serial";
> +                       compatible = "ns16550a";
> +                       reg = <0 0x1fe001e0 0x8>;
> +                       clock-frequency = <33000000>;
> +                       interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
> +                       interrupt-parent = <&iointc>;
> +                       no-loopback-test;
> +               };
> +
> +               cpu_uart1: serial@1fe001e8 {
> +                       status = "disabled";
> +                       device_type = "serial";
> +                       compatible = "ns16550a";
> +                       reg = <0 0x1fe001e8 0x8>;
> +                       clock-frequency = <33000000>;
> +                       interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
> +                       interrupt-parent = <&iointc>;
> +                       no-loopback-test;
> +               };
> +
> +               htintc: interrupt-controller@0x1EFDFB000080 {
> +                       compatible = "loongson,ls3-htintc";
> +                       reg = <0x1EFD 0xFB000080 0x100>;
> +                       interrupt-controller;
> +                       #interrupt-cells = <1>;
> +
> +                       interrupt-parent = <&iointc>;
> +                       interrupts = <24 IRQ_TYPE_LEVEL_HIGH>,
> +                                               <25 IRQ_TYPE_LEVEL_HIGH>,
> +                                               <26 IRQ_TYPE_LEVEL_HIGH>,
> +                                               <27 IRQ_TYPE_LEVEL_HIGH>;
> +               };
> +       };
> +};
> diff --git a/arch/mips/boot/dts/loongson/3b1x00_780e.dts b/arch/mips/boot/dts/loongson/3b1x00_780e.dts
> new file mode 100644
> index 000000000000..9b0dff0b1482
> --- /dev/null
> +++ b/arch/mips/boot/dts/loongson/3b1x00_780e.dts
> @@ -0,0 +1,10 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +/dts-v1/;
> +
> +#include "3b-package.dtsi"
> +#include "rs780e-pch.dtsi"
> +
> +/ {
> +       compatible = "loongson,ls3b-780e";
> +};
> diff --git a/arch/mips/boot/dts/loongson/Makefile b/arch/mips/boot/dts/loongson/Makefile
> new file mode 100644
> index 000000000000..a225d84a521e
> --- /dev/null
> +++ b/arch/mips/boot/dts/loongson/Makefile
> @@ -0,0 +1,5 @@
> +# SPDX_License_Identifier: GPL_2.0
> +dtb-$(CONFIG_MACH_LOONGSON64)  += 3a1000_780e.dtb 3a2000_780e.dtb 3a3000_780e.dtb 3b1x00_780e.dtb \
> +
> +
> +obj-$(CONFIG_BUILTIN_DTB)      += $(addsuffix .o, $(dtb-y))
> diff --git a/arch/mips/boot/dts/loongson/rs780e-pch.dtsi b/arch/mips/boot/dts/loongson/rs780e-pch.dtsi
> new file mode 100644
> index 000000000000..915363eafa2f
> --- /dev/null
> +++ b/arch/mips/boot/dts/loongson/rs780e-pch.dtsi
> @@ -0,0 +1,35 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +/ {
> +       pch {
> +               compatible = "simple-bus";
> +               #address-cells = <2>;
> +               #size-cells = <1>;
> +               ranges = <0x000 0x10000000 0x000 0x10000000 0x10000000
> +                         0x000 0x40000000 0x000 0x40000000 0x40000000>;
> +
> +               isa {
> +                       compatible = "isa";
> +                       #address-cells = <2>;
> +                       #size-cells = <1>;
> +                       ranges = <1 0 0 0 0x1000>;
> +
> +                       i8259: interrupt-controller@20 {
> +                               compatible = "intel,i8259";
> +                               interrupt-controller;
> +                               #interrupt-cells = <1>;
> +                               plat-poll;
> +                               interrupts = <0>, <1>, <2>, <3>, <4>, <5>, <6>, <7>,
> +                                                       <8>, <9>, <10>, <11>, <12>, <13>, <14>, <15>;
> +                               interrupt-parent = <&htintc>;
> +                       };
> +
> +                       rtc0: rtc@70 {
> +                               compatible = "motorola,mc146818";
> +                               reg = <1 0x70 0x8>;
> +                               interrupts = <8>;
> +                               interrupt-parent = <&i8259>;
> +                       };
> +               };
> +       };
> +};
> --
> 2.22.0
>
Huacai Chen Sept. 7, 2019, 3:13 a.m. UTC | #2
Hi, Jiaxun,

All of us think that Loongson Technology Co. Ltd's naming is very
confusing. They call  both their processors and their bridge-chipset
as "Loongson", so Loongson-3A is processor, Loongson-7A is bridge, and
Loongson-2H can be both processor and bridge.....

We all think this is a bad thing, so let's do something in our code to
make life easier:
1, Don't use raw "ls" to stand for loongson anywhere.
2, To describe CPU please use "loongson". E.g., Loongson, Loongson-3,
Loongson-2H, Loongson-3A, Loongson-3B, Loongson-3A4000.
3, To describe bridge (chipset, or PCH) please use LS2H, LS2K and
LS7A, and we can use LS2X to cover them all in some drivers.
4, In file names use their lower-case names. E.g., loongson,
loongson3, ls2h, ls7a.

Don't be afraid of long names. Long names is harmless, but disordered
abbreviation is a nightmare.

Huacai

On Thu, Sep 5, 2019 at 10:44 PM Jiaxun Yang <jiaxun.yang@flygoat.com> wrote:
>
> v1:
> - dt-bindings fixup according to Rob's comments
> - irqchip fixup according to Marc's comments
> - ls3-iointc: Make Core&IP map per-IRQ
> - Regenerate kconfigs
> - Typo & style improvements
>
> v2:
> - dt-bindings: Fix IOINTC, collect Rob's review tag
> - dtbs: Drop CPU Node, merge different ways according to Huacai and Paul's comments
>
> Jiaxun Yang (19):
>   MIPS: Loongson64: Rename CPU TYPES
>   MIPS: Loongson64: separate loongson2ef/loongson64 code
>   MAINTAINERS: Fix entries for new loongson64 path
>   irqchip: Export generic chip domain map/unmap functions
>   irqchip: Add driver for Loongson-3 I/O interrupt controller
>   dt-bindings: interrupt-controller: Add Loongson-3 IOINTC
>   irqchip: Add driver for Loongson-3 HyperTransport interrupt controller
>   dt-bindings: interrupt-controller: Add Loongson-3 HTINTC
>   irqchip: i8259: Add plat-poll support
>   irqchip: mips-cpu: Convert to simple domain
>   MIPS: Loongson64: Drop legacy IRQ code
>   dt-bindings: mips: Add loongson boards
>   dt-bindings: Document loongson vendor-prefix
>   MIPS: Loongson64: Add generic dts
>   MIPS: Loongson64: Load built-in dtbs
>   GPIO: loongson: Drop Loongson-3A/3B support
>   MIPS: Loongson: Regenerate defconfigs
>   MAINTAINERS: Add new pathes to LOONGSON64 ARCHITECTURE
>   MAINTAINERS: Add myself as maintainer of LOONGSON64
>
>  .../loongson,ls3-htintc.yaml                  |  55 ++++
>  .../loongson,ls3-iointc.yaml                  |  79 +++++
>  .../bindings/mips/loongson/devices.yaml       |  39 +++
>  .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
>  MAINTAINERS                                   |  13 +-
>  arch/mips/Kbuild.platforms                    |   1 +
>  arch/mips/Kconfig                             |  83 ++++--
>  arch/mips/boot/dts/Makefile                   |   1 +
>  arch/mips/boot/dts/loongson/3a-package.dtsi   |  69 +++++
>  arch/mips/boot/dts/loongson/3a1000_780e.dts   |  10 +
>  arch/mips/boot/dts/loongson/3a2000_780e.dts   |  10 +
>  arch/mips/boot/dts/loongson/3a3000_780e.dts   |  10 +
>  arch/mips/boot/dts/loongson/3b-package.dtsi   |  69 +++++
>  arch/mips/boot/dts/loongson/3b1x00_780e.dts   |  10 +
>  arch/mips/boot/dts/loongson/Makefile          |   5 +
>  arch/mips/boot/dts/loongson/rs780e-pch.dtsi   |  35 +++
>  arch/mips/configs/fuloong2e_defconfig         |   8 +-
>  arch/mips/configs/lemote2f_defconfig          |   8 +-
>  arch/mips/configs/loongson3_defconfig         |  13 +-
>  arch/mips/include/asm/bootinfo.h              |   1 -
>  arch/mips/include/asm/cop2.h                  |   2 +-
>  arch/mips/include/asm/cpu-type.h              |   6 +-
>  arch/mips/include/asm/cpu.h                   |   4 +-
>  arch/mips/include/asm/hazards.h               |   2 +-
>  arch/mips/include/asm/io.h                    |   2 +-
>  arch/mips/include/asm/irqflags.h              |   2 +-
>  .../mach-loongson2ef/cpu-feature-overrides.h  |  45 +++
>  .../cs5536/cs5536.h                           |   0
>  .../cs5536/cs5536_mfgpt.h                     |   0
>  .../cs5536/cs5536_pci.h                       |   0
>  .../cs5536/cs5536_vsm.h                       |   0
>  .../loongson2ef.h}                            |  31 +-
>  .../machine.h                                 |   6 -
>  .../mc146818rtc.h                             |   5 +-
>  .../mem.h                                     |   6 +-
>  arch/mips/include/asm/mach-loongson2ef/pci.h  |  43 +++
>  .../include/asm/mach-loongson2ef/spaces.h     |  10 +
>  .../asm/mach-loongson64/builtin_dtbs.h        |  16 +
>  .../mach-loongson64/cpu-feature-overrides.h   |   8 +-
>  arch/mips/include/asm/mach-loongson64/irq.h   |   6 +-
>  .../asm/mach-loongson64/kernel-entry-init.h   |  74 -----
>  .../include/asm/mach-loongson64/loongson64.h  |  50 ++++
>  .../mips/include/asm/mach-loongson64/mmzone.h |  16 -
>  arch/mips/include/asm/mach-loongson64/pci.h   |  41 +--
>  .../include/asm/mach-loongson64/workarounds.h |   4 +-
>  arch/mips/include/asm/module.h                |   8 +-
>  arch/mips/include/asm/processor.h             |   2 +-
>  arch/mips/include/asm/r4kcache.h              |   4 +-
>  arch/mips/kernel/cpu-probe.c                  |  14 +-
>  arch/mips/kernel/idle.c                       |   2 +-
>  arch/mips/kernel/perf_event_mipsxx.c          |   4 +-
>  arch/mips/kernel/setup.c                      |   2 +-
>  arch/mips/kernel/traps.c                      |   2 +-
>  arch/mips/lib/csum_partial.S                  |   4 +-
>  arch/mips/loongson2ef/Kconfig                 |  93 ++++++
>  arch/mips/loongson2ef/Makefile                |  18 ++
>  arch/mips/loongson2ef/Platform                |  32 ++
>  .../common/Makefile                           |   0
>  .../common/bonito-irq.c                       |   2 +-
>  .../common/cmdline.c                          |   2 +-
>  .../common/cs5536/Makefile                    |   0
>  .../common/cs5536/cs5536_acc.c                |   0
>  .../common/cs5536/cs5536_ehci.c               |   0
>  .../common/cs5536/cs5536_ide.c                |   0
>  .../common/cs5536/cs5536_isa.c                |   0
>  .../common/cs5536/cs5536_mfgpt.c              |   0
>  .../common/cs5536/cs5536_ohci.c               |   0
>  .../common/cs5536/cs5536_pci.c                |   0
>  .../common/early_printk.c                     |   2 +-
>  arch/mips/loongson2ef/common/env.c            |  71 +++++
>  .../{loongson64 => loongson2ef}/common/init.c |   7 +-
>  .../{loongson64 => loongson2ef}/common/irq.c  |   2 +-
>  .../common/machtype.c                         |   3 +-
>  .../{loongson64 => loongson2ef}/common/mem.c  |  40 +--
>  .../{loongson64 => loongson2ef}/common/pci.c  |  11 +-
>  .../common/platform.c                         |   0
>  .../{loongson64 => loongson2ef}/common/pm.c   |   2 +-
>  .../common/reset.c                            |  23 +-
>  .../{loongson64 => loongson2ef}/common/rtc.c  |   0
>  .../common/serial.c                           |  37 +--
>  .../common/setup.c                            |   2 +-
>  .../{loongson64 => loongson2ef}/common/time.c |   2 +-
>  .../common/uart_base.c                        |  10 +-
>  .../fuloong-2e/Makefile                       |   0
>  .../fuloong-2e/dma.c                          |   0
>  .../fuloong-2e/irq.c                          |   2 +-
>  .../fuloong-2e/reset.c                        |   2 +-
>  .../lemote-2f/Makefile                        |   0
>  .../lemote-2f/clock.c                         |   2 +-
>  .../lemote-2f/dma.c                           |   0
>  .../lemote-2f/ec_kb3310b.c                    |   0
>  .../lemote-2f/ec_kb3310b.h                    |   0
>  .../lemote-2f/irq.c                           |   2 +-
>  .../lemote-2f/machtype.c                      |   2 +-
>  .../lemote-2f/pm.c                            |   2 +-
>  .../lemote-2f/reset.c                         |   2 +-
>  arch/mips/loongson64/Kconfig                  | 126 +-------
>  arch/mips/loongson64/Makefile                 |  23 +-
>  arch/mips/loongson64/Platform                 |  36 +--
>  .../loongson64/{loongson-3 => }/acpi_init.c   |   3 +-
>  .../loongson64/{loongson-3 => }/cop2-ex.c     |   5 +-
>  arch/mips/loongson64/{loongson-3 => }/dma.c   |   6 +-
>  arch/mips/loongson64/{common => }/env.c       |  98 +++----
>  arch/mips/loongson64/{loongson-3 => }/hpet.c  |   0
>  arch/mips/loongson64/irq.c                    |  27 ++
>  arch/mips/loongson64/loongson-3/Makefile      |  11 -
>  arch/mips/loongson64/loongson-3/irq.c         | 158 ----------
>  arch/mips/loongson64/{loongson-3 => }/numa.c  |   4 +-
>  arch/mips/loongson64/pci.c                    |  45 +++
>  .../loongson64/{loongson-3 => }/platform.c    |   0
>  arch/mips/loongson64/reset.c                  |  58 ++++
>  arch/mips/loongson64/setup.c                  | 107 +++++++
>  arch/mips/loongson64/{loongson-3 => }/smp.c   |  28 +-
>  arch/mips/loongson64/{loongson-3 => }/smp.h   |   0
>  arch/mips/mm/c-r4k.c                          |  32 +-
>  arch/mips/mm/page.c                           |   2 +-
>  arch/mips/mm/tlb-r4k.c                        |   4 +-
>  arch/mips/mm/tlbex.c                          |   6 +-
>  arch/mips/oprofile/Makefile                   |   4 +-
>  arch/mips/oprofile/common.c                   |   4 +-
>  arch/mips/oprofile/op_model_loongson2.c       |   2 +-
>  arch/mips/oprofile/op_model_loongson3.c       |   2 +-
>  arch/mips/pci/Makefile                        |   2 +-
>  arch/mips/pci/fixup-fuloong2e.c               |   2 +-
>  arch/mips/pci/fixup-lemote2f.c                |   2 +-
>  arch/mips/pci/ops-loongson2.c                 |   2 +-
>  arch/mips/pci/ops-loongson3.c                 |   2 +-
>  drivers/cpufreq/loongson2_cpufreq.c           |   2 +-
>  drivers/gpio/Kconfig                          |   6 +-
>  drivers/gpio/gpio-loongson.c                  |  11 +-
>  drivers/irqchip/Kconfig                       |  17 ++
>  drivers/irqchip/Makefile                      |   2 +
>  drivers/irqchip/irq-i8259.c                   |  47 ++-
>  drivers/irqchip/irq-ls3-htintc.c              | 147 ++++++++++
>  drivers/irqchip/irq-ls3-iointc.c              | 275 ++++++++++++++++++
>  drivers/irqchip/irq-mips-cpu.c                |   2 +-
>  drivers/platform/mips/cpu_hwmon.c             |   2 +-
>  include/drm/drm_cache.h                       |   2 +-
>  include/linux/irq.h                           |   1 +
>  kernel/irq/generic-chip.c                     |   4 +-
>  140 files changed, 1760 insertions(+), 874 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/interrupt-controller/loongson,ls3-htintc.yaml
>  create mode 100644 Documentation/devicetree/bindings/interrupt-controller/loongson,ls3-iointc.yaml
>  create mode 100644 Documentation/devicetree/bindings/mips/loongson/devices.yaml
>  create mode 100644 arch/mips/boot/dts/loongson/3a-package.dtsi
>  create mode 100644 arch/mips/boot/dts/loongson/3a1000_780e.dts
>  create mode 100644 arch/mips/boot/dts/loongson/3a2000_780e.dts
>  create mode 100644 arch/mips/boot/dts/loongson/3a3000_780e.dts
>  create mode 100644 arch/mips/boot/dts/loongson/3b-package.dtsi
>  create mode 100644 arch/mips/boot/dts/loongson/3b1x00_780e.dts
>  create mode 100644 arch/mips/boot/dts/loongson/Makefile
>  create mode 100644 arch/mips/boot/dts/loongson/rs780e-pch.dtsi
>  create mode 100644 arch/mips/include/asm/mach-loongson2ef/cpu-feature-overrides.h
>  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/cs5536/cs5536.h (100%)
>  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/cs5536/cs5536_mfgpt.h (100%)
>  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/cs5536/cs5536_pci.h (100%)
>  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/cs5536/cs5536_vsm.h (100%)
>  rename arch/mips/include/asm/{mach-loongson64/loongson.h => mach-loongson2ef/loongson2ef.h} (91%)
>  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/machine.h (80%)
>  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/mc146818rtc.h (80%)
>  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/mem.h (86%)
>  create mode 100644 arch/mips/include/asm/mach-loongson2ef/pci.h
>  create mode 100644 arch/mips/include/asm/mach-loongson2ef/spaces.h
>  create mode 100644 arch/mips/include/asm/mach-loongson64/builtin_dtbs.h
>  delete mode 100644 arch/mips/include/asm/mach-loongson64/kernel-entry-init.h
>  create mode 100644 arch/mips/include/asm/mach-loongson64/loongson64.h
>  create mode 100644 arch/mips/loongson2ef/Kconfig
>  create mode 100644 arch/mips/loongson2ef/Makefile
>  create mode 100644 arch/mips/loongson2ef/Platform
>  rename arch/mips/{loongson64 => loongson2ef}/common/Makefile (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/bonito-irq.c (97%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/cmdline.c (97%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/Makefile (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_acc.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_ehci.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_ide.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_isa.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_mfgpt.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_ohci.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_pci.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/early_printk.c (97%)
>  create mode 100644 arch/mips/loongson2ef/common/env.c
>  rename arch/mips/{loongson64 => loongson2ef}/common/init.c (90%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/irq.c (98%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/machtype.c (94%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/mem.c (72%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/pci.c (89%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/platform.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/pm.c (99%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/reset.c (77%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/rtc.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/serial.c (63%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/setup.c (97%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/time.c (96%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/uart_base.c (77%)
>  rename arch/mips/{loongson64 => loongson2ef}/fuloong-2e/Makefile (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/fuloong-2e/dma.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/fuloong-2e/irq.c (98%)
>  rename arch/mips/{loongson64 => loongson2ef}/fuloong-2e/reset.c (93%)
>  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/Makefile (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/clock.c (98%)
>  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/dma.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/ec_kb3310b.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/ec_kb3310b.h (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/irq.c (99%)
>  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/machtype.c (98%)
>  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/pm.c (99%)
>  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/reset.c (99%)
>  rename arch/mips/loongson64/{loongson-3 => }/acpi_init.c (99%)
>  rename arch/mips/loongson64/{loongson-3 => }/cop2-ex.c (88%)
>  rename arch/mips/loongson64/{loongson-3 => }/dma.c (82%)
>  rename arch/mips/loongson64/{common => }/env.c (83%)
>  rename arch/mips/loongson64/{loongson-3 => }/hpet.c (100%)
>  create mode 100644 arch/mips/loongson64/irq.c
>  delete mode 100644 arch/mips/loongson64/loongson-3/Makefile
>  delete mode 100644 arch/mips/loongson64/loongson-3/irq.c
>  rename arch/mips/loongson64/{loongson-3 => }/numa.c (98%)
>  create mode 100644 arch/mips/loongson64/pci.c
>  rename arch/mips/loongson64/{loongson-3 => }/platform.c (100%)
>  create mode 100644 arch/mips/loongson64/reset.c
>  create mode 100644 arch/mips/loongson64/setup.c
>  rename arch/mips/loongson64/{loongson-3 => }/smp.c (98%)
>  rename arch/mips/loongson64/{loongson-3 => }/smp.h (100%)
>  create mode 100644 drivers/irqchip/irq-ls3-htintc.c
>  create mode 100644 drivers/irqchip/irq-ls3-iointc.c
>
> --
> 2.22.0
>
Jiaxun Yang Sept. 7, 2019, 3:14 a.m. UTC | #3
On 2019/9/7 上午10:53, Huacai Chen wrote:
> On Thu, Sep 5, 2019 at 10:47 PM Jiaxun Yang <jiaxun.yang@flygoat.com> wrote:
>> Add generic device dts for Loongson-3 devices.
>> They seems identical but will be different later.
>>
>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Hi, Jiaxun,
>
> I'm very glad to see that dts files become less in this version, but I
> think we also don't need to distinguish cpu types (i.e.,
> 3a1000/3b1500/3a2000/3a3000). Then, we only need three dts files
> (loongson3_ls2h.dts, loongson3_ls7a.dts, loongson3_rs780.dts) which is
> the same as in our own git repository. If we really need to
> distinguish cpu type, PRID or CPUCFG in Loongson-3A4000 is more
> suitable than dts. In other words, I want dts only do as minimal as
> possible.

Hi Huacai,

I have the  same consideration with you. However, the reason why I split 
this dts is that these chips have significant differences.

For example, 3B1x00 have different memory and config registers layout, 
Their HT config space is a delicate node, HTMSI interrupts is not 
functional until 3A3000, and their syscon registers are not identical.

You may say they can be identified by PRID, but I'm not intend to spread 
PRID all the way in other subsystems, thus I think dts is still the best 
way to tell these differences.

Thanks

--

Jiaxun Yang

>
> Huacai
>
Paul Burton Sept. 10, 2019, 12:12 a.m. UTC | #4
Hi Jiaxun & Huacai,

On Thu, Sep 05, 2019 at 10:42:59PM +0800, Jiaxun Yang wrote:
> As later model of GSx64 family processors including 2-series-soc have
> similar design with initial loongson3a while loongson2e/f seems less
> identical, we separate loongson2e/f support code out of mach-loongson64
> to make our life easier.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>

I looked at applying the first 3 patches of this series to mips-next &
squashed in the relevant defconfig updates, then was looking at applying
Huacai's recent 3 patch series.

One issue is that they conflict, but beyond that it showed me that this
patch deletes kernel-entry-init.h entirely. Was that intentional? If so
it should be a separate patch & it needs an explanation.

Please could the two of you make it clear what branch & commit your
patches are based upon? Ideally it should be the current head of the
mips-next branch.

Also Jiaxun, it's really hard to see whether this patch is making any
functional changes in addition to the duplication & renaming. I think it
would be much better to split this into a few steps across multiple
commits, something like this:

1) Copy the loongson64 directory to loongson2ef, and keep the copy as-is
   *except* for the removal of the loongson2ef/loongon-3 subdirectory.
   Delete loongson64/fuloong-2e & loongson64/lemote-2f.

2) Now clean up the loongson64 directory by moving files up from the
   loongson-3 subdirectory.

3) Now clean up code, removing #ifdef's etc that no longer make sense.

Provide the -M & -C flags to git format-patch when generating your
patches. --find-copies-harder might help with the first step, if it's
practical to run.

That way each commit will be easier to review, and issues like the
deletion of kernel-entry-init.h will be easier to spot.

For now I undid the whole thing. It's getting late in the cycle anyway,
so this will probably be v5.5 material.

Thanks,
    Paul

> ---
>  arch/mips/Kbuild.platforms                    |   1 +
>  arch/mips/Kconfig                             |  51 +++++--
>  arch/mips/include/asm/bootinfo.h              |   1 -
>  .../mach-loongson2ef/cpu-feature-overrides.h  |  45 +++++++
>  .../cs5536/cs5536.h                           |   0
>  .../cs5536/cs5536_mfgpt.h                     |   0
>  .../cs5536/cs5536_pci.h                       |   0
>  .../cs5536/cs5536_vsm.h                       |   0
>  .../loongson2ef.h}                            |  29 +---
>  .../machine.h                                 |   6 -
>  .../mc146818rtc.h                             |   5 +-
>  .../mem.h                                     |   6 +-
>  arch/mips/include/asm/mach-loongson2ef/pci.h  |  43 ++++++
>  .../include/asm/mach-loongson2ef/spaces.h     |  10 ++
>  .../mach-loongson64/cpu-feature-overrides.h   |   8 +-
>  arch/mips/include/asm/mach-loongson64/irq.h   |   7 +-
>  .../asm/mach-loongson64/kernel-entry-init.h   |  74 ----------
>  .../include/asm/mach-loongson64/loongson64.h  |  48 +++++++
>  .../mips/include/asm/mach-loongson64/mmzone.h |  16 ---
>  arch/mips/include/asm/mach-loongson64/pci.h   |  41 +-----
>  .../include/asm/mach-loongson64/workarounds.h |   4 +-
>  arch/mips/loongson2ef/Kconfig                 |  93 +++++++++++++
>  arch/mips/loongson2ef/Makefile                |  18 +++
>  arch/mips/loongson2ef/Platform                |  32 +++++
>  .../common/Makefile                           |   0
>  .../common/bonito-irq.c                       |   2 +-
>  .../common/cmdline.c                          |   2 +-
>  .../common/cs5536/Makefile                    |   0
>  .../common/cs5536/cs5536_acc.c                |   0
>  .../common/cs5536/cs5536_ehci.c               |   0
>  .../common/cs5536/cs5536_ide.c                |   0
>  .../common/cs5536/cs5536_isa.c                |   0
>  .../common/cs5536/cs5536_mfgpt.c              |   0
>  .../common/cs5536/cs5536_ohci.c               |   0
>  .../common/cs5536/cs5536_pci.c                |   0
>  .../common/early_printk.c                     |   2 +-
>  arch/mips/loongson2ef/common/env.c            |  71 ++++++++++
>  .../{loongson64 => loongson2ef}/common/init.c |   7 +-
>  .../{loongson64 => loongson2ef}/common/irq.c  |   2 +-
>  .../common/machtype.c                         |   3 +-
>  .../{loongson64 => loongson2ef}/common/mem.c  |  40 +-----
>  .../{loongson64 => loongson2ef}/common/pci.c  |  11 +-
>  .../common/platform.c                         |   0
>  .../{loongson64 => loongson2ef}/common/pm.c   |   2 +-
>  .../common/reset.c                            |  23 +---
>  .../{loongson64 => loongson2ef}/common/rtc.c  |   0
>  .../common/serial.c                           |  37 +----
>  .../common/setup.c                            |   2 +-
>  .../{loongson64 => loongson2ef}/common/time.c |   2 +-
>  .../common/uart_base.c                        |  10 +-
>  .../fuloong-2e/Makefile                       |   0
>  .../fuloong-2e/dma.c                          |   0
>  .../fuloong-2e/irq.c                          |   2 +-
>  .../fuloong-2e/reset.c                        |   2 +-
>  .../lemote-2f/Makefile                        |   0
>  .../lemote-2f/clock.c                         |   2 +-
>  .../lemote-2f/dma.c                           |   0
>  .../lemote-2f/ec_kb3310b.c                    |   0
>  .../lemote-2f/ec_kb3310b.h                    |   0
>  .../lemote-2f/irq.c                           |   2 +-
>  .../lemote-2f/machtype.c                      |   2 +-
>  .../lemote-2f/pm.c                            |   2 +-
>  .../lemote-2f/reset.c                         |   2 +-
>  arch/mips/loongson64/Kconfig                  | 126 +-----------------
>  arch/mips/loongson64/Makefile                 |  23 +---
>  arch/mips/loongson64/Platform                 |  26 +---
>  .../loongson64/{loongson-3 => }/acpi_init.c   |   3 +-
>  .../loongson64/{loongson-3 => }/cop2-ex.c     |   5 +-
>  arch/mips/loongson64/{loongson-3 => }/dma.c   |   6 +-
>  arch/mips/loongson64/{common => }/env.c       |  72 +++-------
>  arch/mips/loongson64/{loongson-3 => }/hpet.c  |   0
>  arch/mips/loongson64/{loongson-3 => }/irq.c   |  40 +++++-
>  arch/mips/loongson64/loongson-3/Makefile      |  11 --
>  arch/mips/loongson64/{loongson-3 => }/numa.c  |   4 +-
>  arch/mips/loongson64/pci.c                    |  45 +++++++
>  .../loongson64/{loongson-3 => }/platform.c    |   0
>  arch/mips/loongson64/reset.c                  |  58 ++++++++
>  arch/mips/loongson64/setup.c                  |  91 +++++++++++++
>  arch/mips/loongson64/{loongson-3 => }/smp.c   |   4 +-
>  arch/mips/loongson64/{loongson-3 => }/smp.h   |   0
>  arch/mips/oprofile/op_model_loongson2.c       |   2 +-
>  arch/mips/oprofile/op_model_loongson3.c       |   2 +-
>  arch/mips/pci/Makefile                        |   2 +-
>  arch/mips/pci/fixup-fuloong2e.c               |   2 +-
>  arch/mips/pci/fixup-lemote2f.c                |   2 +-
>  arch/mips/pci/ops-loongson2.c                 |   2 +-
>  arch/mips/pci/ops-loongson3.c                 |   2 +-
>  drivers/cpufreq/loongson2_cpufreq.c           |   2 +-
>  drivers/gpio/gpio-loongson.c                  |   2 +-
>  drivers/platform/mips/cpu_hwmon.c             |   2 +-
>  90 files changed, 720 insertions(+), 582 deletions(-)
>  create mode 100644 arch/mips/include/asm/mach-loongson2ef/cpu-feature-overrides.h
>  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/cs5536/cs5536.h (100%)
>  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/cs5536/cs5536_mfgpt.h (100%)
>  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/cs5536/cs5536_pci.h (100%)
>  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/cs5536/cs5536_vsm.h (100%)
>  rename arch/mips/include/asm/{mach-loongson64/loongson.h => mach-loongson2ef/loongson2ef.h} (91%)
>  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/machine.h (80%)
>  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/mc146818rtc.h (80%)
>  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/mem.h (86%)
>  create mode 100644 arch/mips/include/asm/mach-loongson2ef/pci.h
>  create mode 100644 arch/mips/include/asm/mach-loongson2ef/spaces.h
>  delete mode 100644 arch/mips/include/asm/mach-loongson64/kernel-entry-init.h
>  create mode 100644 arch/mips/include/asm/mach-loongson64/loongson64.h
>  create mode 100644 arch/mips/loongson2ef/Kconfig
>  create mode 100644 arch/mips/loongson2ef/Makefile
>  create mode 100644 arch/mips/loongson2ef/Platform
>  rename arch/mips/{loongson64 => loongson2ef}/common/Makefile (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/bonito-irq.c (97%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/cmdline.c (97%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/Makefile (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_acc.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_ehci.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_ide.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_isa.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_mfgpt.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_ohci.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_pci.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/early_printk.c (97%)
>  create mode 100644 arch/mips/loongson2ef/common/env.c
>  rename arch/mips/{loongson64 => loongson2ef}/common/init.c (90%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/irq.c (98%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/machtype.c (94%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/mem.c (72%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/pci.c (89%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/platform.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/pm.c (99%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/reset.c (77%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/rtc.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/serial.c (63%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/setup.c (97%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/time.c (96%)
>  rename arch/mips/{loongson64 => loongson2ef}/common/uart_base.c (77%)
>  rename arch/mips/{loongson64 => loongson2ef}/fuloong-2e/Makefile (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/fuloong-2e/dma.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/fuloong-2e/irq.c (98%)
>  rename arch/mips/{loongson64 => loongson2ef}/fuloong-2e/reset.c (93%)
>  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/Makefile (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/clock.c (98%)
>  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/dma.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/ec_kb3310b.c (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/ec_kb3310b.h (100%)
>  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/irq.c (99%)
>  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/machtype.c (98%)
>  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/pm.c (99%)
>  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/reset.c (99%)
>  rename arch/mips/loongson64/{loongson-3 => }/acpi_init.c (99%)
>  rename arch/mips/loongson64/{loongson-3 => }/cop2-ex.c (88%)
>  rename arch/mips/loongson64/{loongson-3 => }/dma.c (82%)
>  rename arch/mips/loongson64/{common => }/env.c (79%)
>  rename arch/mips/loongson64/{loongson-3 => }/hpet.c (100%)
>  rename arch/mips/loongson64/{loongson-3 => }/irq.c (77%)
>  delete mode 100644 arch/mips/loongson64/loongson-3/Makefile
>  rename arch/mips/loongson64/{loongson-3 => }/numa.c (98%)
>  create mode 100644 arch/mips/loongson64/pci.c
>  rename arch/mips/loongson64/{loongson-3 => }/platform.c (100%)
>  create mode 100644 arch/mips/loongson64/reset.c
>  create mode 100644 arch/mips/loongson64/setup.c
>  rename arch/mips/loongson64/{loongson-3 => }/smp.c (99%)
>  rename arch/mips/loongson64/{loongson-3 => }/smp.h (100%)
Huacai Chen Sept. 16, 2019, 2:23 a.m. UTC | #5
On Tue, Sep 10, 2019 at 6:26 PM Paul Burton <paul.burton@mips.com> wrote:
>
> Hi Jiaxun & Huacai,
>
> On Thu, Sep 05, 2019 at 10:42:59PM +0800, Jiaxun Yang wrote:
> > As later model of GSx64 family processors including 2-series-soc have
> > similar design with initial loongson3a while loongson2e/f seems less
> > identical, we separate loongson2e/f support code out of mach-loongson64
> > to make our life easier.
> >
> > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>
> I looked at applying the first 3 patches of this series to mips-next &
> squashed in the relevant defconfig updates, then was looking at applying
> Huacai's recent 3 patch series.
>
> One issue is that they conflict, but beyond that it showed me that this
> patch deletes kernel-entry-init.h entirely. Was that intentional? If so
> it should be a separate patch & it needs an explanation.
>
> Please could the two of you make it clear what branch & commit your
> patches are based upon? Ideally it should be the current head of the
> mips-next branch.
Hi, Paul,

Jiaxun has replied your question but his email is blocked by mail-list
for some unkown reasons. We have discussed and we both think that the
big-rework-patchset need some more improvements and the Loongson-3A R4
patchset can be merged first.

Huacai

>
> Also Jiaxun, it's really hard to see whether this patch is making any
> functional changes in addition to the duplication & renaming. I think it
> would be much better to split this into a few steps across multiple
> commits, something like this:
>
> 1) Copy the loongson64 directory to loongson2ef, and keep the copy as-is
>    *except* for the removal of the loongson2ef/loongon-3 subdirectory.
>    Delete loongson64/fuloong-2e & loongson64/lemote-2f.
>
> 2) Now clean up the loongson64 directory by moving files up from the
>    loongson-3 subdirectory.
>
> 3) Now clean up code, removing #ifdef's etc that no longer make sense.
>
> Provide the -M & -C flags to git format-patch when generating your
> patches. --find-copies-harder might help with the first step, if it's
> practical to run.
>
> That way each commit will be easier to review, and issues like the
> deletion of kernel-entry-init.h will be easier to spot.
>
> For now I undid the whole thing. It's getting late in the cycle anyway,
> so this will probably be v5.5 material.
>
> Thanks,
>     Paul
>
> > ---
> >  arch/mips/Kbuild.platforms                    |   1 +
> >  arch/mips/Kconfig                             |  51 +++++--
> >  arch/mips/include/asm/bootinfo.h              |   1 -
> >  .../mach-loongson2ef/cpu-feature-overrides.h  |  45 +++++++
> >  .../cs5536/cs5536.h                           |   0
> >  .../cs5536/cs5536_mfgpt.h                     |   0
> >  .../cs5536/cs5536_pci.h                       |   0
> >  .../cs5536/cs5536_vsm.h                       |   0
> >  .../loongson2ef.h}                            |  29 +---
> >  .../machine.h                                 |   6 -
> >  .../mc146818rtc.h                             |   5 +-
> >  .../mem.h                                     |   6 +-
> >  arch/mips/include/asm/mach-loongson2ef/pci.h  |  43 ++++++
> >  .../include/asm/mach-loongson2ef/spaces.h     |  10 ++
> >  .../mach-loongson64/cpu-feature-overrides.h   |   8 +-
> >  arch/mips/include/asm/mach-loongson64/irq.h   |   7 +-
> >  .../asm/mach-loongson64/kernel-entry-init.h   |  74 ----------
> >  .../include/asm/mach-loongson64/loongson64.h  |  48 +++++++
> >  .../mips/include/asm/mach-loongson64/mmzone.h |  16 ---
> >  arch/mips/include/asm/mach-loongson64/pci.h   |  41 +-----
> >  .../include/asm/mach-loongson64/workarounds.h |   4 +-
> >  arch/mips/loongson2ef/Kconfig                 |  93 +++++++++++++
> >  arch/mips/loongson2ef/Makefile                |  18 +++
> >  arch/mips/loongson2ef/Platform                |  32 +++++
> >  .../common/Makefile                           |   0
> >  .../common/bonito-irq.c                       |   2 +-
> >  .../common/cmdline.c                          |   2 +-
> >  .../common/cs5536/Makefile                    |   0
> >  .../common/cs5536/cs5536_acc.c                |   0
> >  .../common/cs5536/cs5536_ehci.c               |   0
> >  .../common/cs5536/cs5536_ide.c                |   0
> >  .../common/cs5536/cs5536_isa.c                |   0
> >  .../common/cs5536/cs5536_mfgpt.c              |   0
> >  .../common/cs5536/cs5536_ohci.c               |   0
> >  .../common/cs5536/cs5536_pci.c                |   0
> >  .../common/early_printk.c                     |   2 +-
> >  arch/mips/loongson2ef/common/env.c            |  71 ++++++++++
> >  .../{loongson64 => loongson2ef}/common/init.c |   7 +-
> >  .../{loongson64 => loongson2ef}/common/irq.c  |   2 +-
> >  .../common/machtype.c                         |   3 +-
> >  .../{loongson64 => loongson2ef}/common/mem.c  |  40 +-----
> >  .../{loongson64 => loongson2ef}/common/pci.c  |  11 +-
> >  .../common/platform.c                         |   0
> >  .../{loongson64 => loongson2ef}/common/pm.c   |   2 +-
> >  .../common/reset.c                            |  23 +---
> >  .../{loongson64 => loongson2ef}/common/rtc.c  |   0
> >  .../common/serial.c                           |  37 +----
> >  .../common/setup.c                            |   2 +-
> >  .../{loongson64 => loongson2ef}/common/time.c |   2 +-
> >  .../common/uart_base.c                        |  10 +-
> >  .../fuloong-2e/Makefile                       |   0
> >  .../fuloong-2e/dma.c                          |   0
> >  .../fuloong-2e/irq.c                          |   2 +-
> >  .../fuloong-2e/reset.c                        |   2 +-
> >  .../lemote-2f/Makefile                        |   0
> >  .../lemote-2f/clock.c                         |   2 +-
> >  .../lemote-2f/dma.c                           |   0
> >  .../lemote-2f/ec_kb3310b.c                    |   0
> >  .../lemote-2f/ec_kb3310b.h                    |   0
> >  .../lemote-2f/irq.c                           |   2 +-
> >  .../lemote-2f/machtype.c                      |   2 +-
> >  .../lemote-2f/pm.c                            |   2 +-
> >  .../lemote-2f/reset.c                         |   2 +-
> >  arch/mips/loongson64/Kconfig                  | 126 +-----------------
> >  arch/mips/loongson64/Makefile                 |  23 +---
> >  arch/mips/loongson64/Platform                 |  26 +---
> >  .../loongson64/{loongson-3 => }/acpi_init.c   |   3 +-
> >  .../loongson64/{loongson-3 => }/cop2-ex.c     |   5 +-
> >  arch/mips/loongson64/{loongson-3 => }/dma.c   |   6 +-
> >  arch/mips/loongson64/{common => }/env.c       |  72 +++-------
> >  arch/mips/loongson64/{loongson-3 => }/hpet.c  |   0
> >  arch/mips/loongson64/{loongson-3 => }/irq.c   |  40 +++++-
> >  arch/mips/loongson64/loongson-3/Makefile      |  11 --
> >  arch/mips/loongson64/{loongson-3 => }/numa.c  |   4 +-
> >  arch/mips/loongson64/pci.c                    |  45 +++++++
> >  .../loongson64/{loongson-3 => }/platform.c    |   0
> >  arch/mips/loongson64/reset.c                  |  58 ++++++++
> >  arch/mips/loongson64/setup.c                  |  91 +++++++++++++
> >  arch/mips/loongson64/{loongson-3 => }/smp.c   |   4 +-
> >  arch/mips/loongson64/{loongson-3 => }/smp.h   |   0
> >  arch/mips/oprofile/op_model_loongson2.c       |   2 +-
> >  arch/mips/oprofile/op_model_loongson3.c       |   2 +-
> >  arch/mips/pci/Makefile                        |   2 +-
> >  arch/mips/pci/fixup-fuloong2e.c               |   2 +-
> >  arch/mips/pci/fixup-lemote2f.c                |   2 +-
> >  arch/mips/pci/ops-loongson2.c                 |   2 +-
> >  arch/mips/pci/ops-loongson3.c                 |   2 +-
> >  drivers/cpufreq/loongson2_cpufreq.c           |   2 +-
> >  drivers/gpio/gpio-loongson.c                  |   2 +-
> >  drivers/platform/mips/cpu_hwmon.c             |   2 +-
> >  90 files changed, 720 insertions(+), 582 deletions(-)
> >  create mode 100644 arch/mips/include/asm/mach-loongson2ef/cpu-feature-overrides.h
> >  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/cs5536/cs5536.h (100%)
> >  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/cs5536/cs5536_mfgpt.h (100%)
> >  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/cs5536/cs5536_pci.h (100%)
> >  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/cs5536/cs5536_vsm.h (100%)
> >  rename arch/mips/include/asm/{mach-loongson64/loongson.h => mach-loongson2ef/loongson2ef.h} (91%)
> >  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/machine.h (80%)
> >  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/mc146818rtc.h (80%)
> >  rename arch/mips/include/asm/{mach-loongson64 => mach-loongson2ef}/mem.h (86%)
> >  create mode 100644 arch/mips/include/asm/mach-loongson2ef/pci.h
> >  create mode 100644 arch/mips/include/asm/mach-loongson2ef/spaces.h
> >  delete mode 100644 arch/mips/include/asm/mach-loongson64/kernel-entry-init.h
> >  create mode 100644 arch/mips/include/asm/mach-loongson64/loongson64.h
> >  create mode 100644 arch/mips/loongson2ef/Kconfig
> >  create mode 100644 arch/mips/loongson2ef/Makefile
> >  create mode 100644 arch/mips/loongson2ef/Platform
> >  rename arch/mips/{loongson64 => loongson2ef}/common/Makefile (100%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/bonito-irq.c (97%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/cmdline.c (97%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/Makefile (100%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_acc.c (100%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_ehci.c (100%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_ide.c (100%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_isa.c (100%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_mfgpt.c (100%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_ohci.c (100%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/cs5536/cs5536_pci.c (100%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/early_printk.c (97%)
> >  create mode 100644 arch/mips/loongson2ef/common/env.c
> >  rename arch/mips/{loongson64 => loongson2ef}/common/init.c (90%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/irq.c (98%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/machtype.c (94%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/mem.c (72%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/pci.c (89%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/platform.c (100%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/pm.c (99%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/reset.c (77%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/rtc.c (100%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/serial.c (63%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/setup.c (97%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/time.c (96%)
> >  rename arch/mips/{loongson64 => loongson2ef}/common/uart_base.c (77%)
> >  rename arch/mips/{loongson64 => loongson2ef}/fuloong-2e/Makefile (100%)
> >  rename arch/mips/{loongson64 => loongson2ef}/fuloong-2e/dma.c (100%)
> >  rename arch/mips/{loongson64 => loongson2ef}/fuloong-2e/irq.c (98%)
> >  rename arch/mips/{loongson64 => loongson2ef}/fuloong-2e/reset.c (93%)
> >  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/Makefile (100%)
> >  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/clock.c (98%)
> >  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/dma.c (100%)
> >  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/ec_kb3310b.c (100%)
> >  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/ec_kb3310b.h (100%)
> >  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/irq.c (99%)
> >  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/machtype.c (98%)
> >  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/pm.c (99%)
> >  rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/reset.c (99%)
> >  rename arch/mips/loongson64/{loongson-3 => }/acpi_init.c (99%)
> >  rename arch/mips/loongson64/{loongson-3 => }/cop2-ex.c (88%)
> >  rename arch/mips/loongson64/{loongson-3 => }/dma.c (82%)
> >  rename arch/mips/loongson64/{common => }/env.c (79%)
> >  rename arch/mips/loongson64/{loongson-3 => }/hpet.c (100%)
> >  rename arch/mips/loongson64/{loongson-3 => }/irq.c (77%)
> >  delete mode 100644 arch/mips/loongson64/loongson-3/Makefile
> >  rename arch/mips/loongson64/{loongson-3 => }/numa.c (98%)
> >  create mode 100644 arch/mips/loongson64/pci.c
> >  rename arch/mips/loongson64/{loongson-3 => }/platform.c (100%)
> >  create mode 100644 arch/mips/loongson64/reset.c
> >  create mode 100644 arch/mips/loongson64/setup.c
> >  rename arch/mips/loongson64/{loongson-3 => }/smp.c (99%)
> >  rename arch/mips/loongson64/{loongson-3 => }/smp.h (100%)
Jiaxun Yang Sept. 18, 2019, 12:38 a.m. UTC | #6
08:12, 2019年9月10日, Paul Burton <paul.burton@mips.com>:

    Hi Jiaxun & Huacai,

    On Thu, Sep 05, 2019 at 10:42:59PM +0800, Jiaxun Yang wrote:

          As later model of GSx64 family processors including
        2-series-soc have
          similar design with initial loongson3a while loongson2e/f
        seems less
          identical, we separate loongson2e/f support code out of
        mach-loongson64
          to make our life easier.

          Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com
        <mailto:jiaxun.yang@flygoat.com>>


    I looked at applying the first 3 patches of this series to mips-next &
    squashed in the relevant defconfig updates, then was looking at applying
    Huacai's recent 3 patch series.

Hi Paul,
Thanks for your effort.
Please let Huacai's patches go first.

I'm going to make a delicated set for separate the code. Based on mips-next.

    One issue is that they conflict, but beyond that it showed me that this
    patch deletes kernel-entry-init.h entirely. Was that intentional? If so
    it should be a separate patch & it needs an explanation.

Yes, that's intentional, I'm going to explain them in sets later.

    Please could the two of you make it clear what branch & commit your
    patches are based upon? Ideally it should be the current head of the
    mips-next branch.

    Also Jiaxun, it's really hard to see whether this patch is making any
    functional changes in addition to the duplication & renaming. I think it
    would be much better to split this into a few steps across multiple
    commits, something like this:

    1) Copy the loongson64 directory to loongson2ef, and keep the copy as-is
        *except* for the removal of the loongson2ef/loongon-3 subdirectory.
        Delete loongson64/fuloong-2e & loongson64/lemote-2f.

    2) Now clean up the loongson64 directory by moving files up from the
        loongson-3 subdirectory.

    3) Now clean up code, removing #ifdef's etc that no longer make sense.

    Provide the -M & -C flags to git format-patch when generating your
    patches. --find-copies-harder might help with the first step, if it's
    practical to run.

    That way each commit will be easier to review, and issues like the
    deletion of kernel-entry-init.h will be easier to spot.

Got it!
--
Jiaxun

    For now I undid the whole thing. It's getting late in the cycle anyway,
    so this will probably be v5.5 material.

    Thanks,
         Paul

          ---
           arch/mips/Kbuild.platforms | 1 +
           arch/mips/Kconfig | 51 +++++--
           arch/mips/include/asm/bootinfo.h | 1 -
           .../mach-loongson2ef/cpu-feature-overrides.h | 45 +++++++
           .../cs5536/cs5536.h | 0
           .../cs5536/cs5536_mfgpt.h | 0
           .../cs5536/cs5536_pci.h | 0
           .../cs5536/cs5536_vsm.h | 0
           .../loongson2ef.h} | 29 +---
           .../machine.h | 6 -
           .../mc146818rtc.h | 5 +-
           .../mem.h | 6 +-
           arch/mips/include/asm/mach-loongson2ef/pci.h | 43 ++++++
           .../include/asm/mach-loongson2ef/spaces.h | 10 ++
           .../mach-loongson64/cpu-feature-overrides.h | 8 +-
           arch/mips/include/asm/mach-loongson64/irq.h | 7 +-
           .../asm/mach-loongson64/kernel-entry-init.h | 74 ----------
           .../include/asm/mach-loongson64/loongson64.h | 48 +++++++
           .../mips/include/asm/mach-loongson64/mmzone.h | 16 ---
           arch/mips/include/asm/mach-loongson64/pci.h | 41 +-----
           .../include/asm/mach-loongson64/workarounds.h | 4 +-
           arch/mips/loongson2ef/Kconfig | 93 +++++++++++++
           arch/mips/loongson2ef/Makefile | 18 +++
           arch/mips/loongson2ef/Platform | 32 +++++
           .../common/Makefile | 0
           .../common/bonito-irq.c | 2 +-
           .../common/cmdline.c | 2 +-
           .../common/cs5536/Makefile | 0
           .../common/cs5536/cs5536_acc.c | 0
           .../common/cs5536/cs5536_ehci.c | 0
           .../common/cs5536/cs5536_ide.c | 0
           .../common/cs5536/cs5536_isa.c | 0
           .../common/cs5536/cs5536_mfgpt.c | 0
           .../common/cs5536/cs5536_ohci.c | 0
           .../common/cs5536/cs5536_pci.c | 0
           .../common/early_printk.c | 2 +-
           arch/mips/loongson2ef/common/env.c | 71 ++++++++++
           .../{loongson64 => loongson2ef}/common/init.c | 7 +-
           .../{loongson64 => loongson2ef}/common/irq.c | 2 +-
           .../common/machtype.c | 3 +-
           .../{loongson64 => loongson2ef}/common/mem.c | 40 +-----
           .../{loongson64 => loongson2ef}/common/pci.c | 11 +-
           .../common/platform.c | 0
           .../{loongson64 => loongson2ef}/common/pm.c | 2 +-
           .../common/reset.c | 23 +---
           .../{loongson64 => loongson2ef}/common/rtc.c | 0
           .../common/serial.c | 37 +----
           .../common/setup.c | 2 +-
           .../{loongson64 => loongson2ef}/common/time.c | 2 +-
           .../common/uart_base.c | 10 +-
           .../fuloong-2e/Makefile | 0
           .../fuloong-2e/dma.c | 0
           .../fuloong-2e/irq.c | 2 +-
           .../fuloong-2e/reset.c | 2 +-
           .../lemote-2f/Makefile | 0
           .../lemote-2f/clock.c | 2 +-
           .../lemote-2f/dma.c | 0
           .../lemote-2f/ec_kb3310b.c | 0
           .../lemote-2f/ec_kb3310b.h | 0
           .../lemote-2f/irq.c | 2 +-
           .../lemote-2f/machtype.c | 2 +-
           .../lemote-2f/pm.c | 2 +-
           .../lemote-2f/reset.c | 2 +-
           arch/mips/loongson64/Kconfig | 126 +-----------------
           arch/mips/loongson64/Makefile | 23 +---
           arch/mips/loongson64/Platform | 26 +---
           .../loongson64/{loongson-3 => }/acpi_init.c | 3 +-
           .../loongson64/{loongson-3 => }/cop2-ex.c | 5 +-
           arch/mips/loongson64/{loongson-3 => }/dma.c | 6 +-
           arch/mips/loongson64/{common => }/env.c | 72 +++-------
           arch/mips/loongson64/{loongson-3 => }/hpet.c | 0
           arch/mips/loongson64/{loongson-3 => }/irq.c | 40 +++++-
           arch/mips/loongson64/loongson-3/Makefile | 11 --
           arch/mips/loongson64/{loongson-3 => }/numa.c | 4 +-
           arch/mips/loongson64/pci.c | 45 +++++++
           .../loongson64/{loongson-3 => }/platform.c | 0
           arch/mips/loongson64/reset.c | 58 ++++++++
           arch/mips/loongson64/setup.c | 91 +++++++++++++
           arch/mips/loongson64/{loongson-3 => }/smp.c | 4 +-
           arch/mips/loongson64/{loongson-3 => }/smp.h | 0
           arch/mips/oprofile/op_model_loongson2.c | 2 +-
           arch/mips/oprofile/op_model_loongson3.c | 2 +-
           arch/mips/pci/Makefile | 2 +-
           arch/mips/pci/fixup-fuloong2e.c | 2 +-
           arch/mips/pci/fixup-lemote2f.c | 2 +-
           arch/mips/pci/ops-loongson2.c | 2 +-
           arch/mips/pci/ops-loongson3.c | 2 +-
           drivers/cpufreq/loongson2_cpufreq.c | 2 +-
           drivers/gpio/gpio-loongson.c | 2 +-
           drivers/platform/mips/cpu_hwmon.c | 2 +-
           90 files changed, 720 insertions(+), 582 deletions(-)
           create mode 100644
        arch/mips/include/asm/mach-loongson2ef/cpu-feature-overrides.h
           rename arch/mips/include/asm/{mach-loongson64 =>
        mach-loongson2ef}/cs5536/cs5536.h (100%)
           rename arch/mips/include/asm/{mach-loongson64 =>
        mach-loongson2ef}/cs5536/cs5536_mfgpt.h (100%)
           rename arch/mips/include/asm/{mach-loongson64 =>
        mach-loongson2ef}/cs5536/cs5536_pci.h (100%)
           rename arch/mips/include/asm/{mach-loongson64 =>
        mach-loongson2ef}/cs5536/cs5536_vsm.h (100%)
           rename arch/mips/include/asm/{mach-loongson64/loongson.h =>
        mach-loongson2ef/loongson2ef.h} (91%)
           rename arch/mips/include/asm/{mach-loongson64 =>
        mach-loongson2ef}/machine.h (80%)
           rename arch/mips/include/asm/{mach-loongson64 =>
        mach-loongson2ef}/mc146818rtc.h (80%)
           rename arch/mips/include/asm/{mach-loongson64 =>
        mach-loongson2ef}/mem.h (86%)
           create mode 100644 arch/mips/include/asm/mach-loongson2ef/pci.h
           create mode 100644
        arch/mips/include/asm/mach-loongson2ef/spaces.h
           delete mode 100644
        arch/mips/include/asm/mach-loongson64/kernel-entry-init.h
           create mode 100644
        arch/mips/include/asm/mach-loongson64/loongson64.h
           create mode 100644 arch/mips/loongson2ef/Kconfig
           create mode 100644 arch/mips/loongson2ef/Makefile
           create mode 100644 arch/mips/loongson2ef/Platform
           rename arch/mips/{loongson64 => loongson2ef}/common/Makefile
        (100%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/common/bonito-irq.c (97%)
           rename arch/mips/{loongson64 => loongson2ef}/common/cmdline.c
        (97%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/common/cs5536/Makefile (100%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/common/cs5536/cs5536_acc.c (100%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/common/cs5536/cs5536_ehci.c (100%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/common/cs5536/cs5536_ide.c (100%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/common/cs5536/cs5536_isa.c (100%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/common/cs5536/cs5536_mfgpt.c (100%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/common/cs5536/cs5536_ohci.c (100%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/common/cs5536/cs5536_pci.c (100%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/common/early_printk.c (97%)
           create mode 100644 arch/mips/loongson2ef/common/env.c
           rename arch/mips/{loongson64 => loongson2ef}/common/init.c (90%)
           rename arch/mips/{loongson64 => loongson2ef}/common/irq.c (98%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/common/machtype.c (94%)
           rename arch/mips/{loongson64 => loongson2ef}/common/mem.c (72%)
           rename arch/mips/{loongson64 => loongson2ef}/common/pci.c (89%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/common/platform.c (100%)
           rename arch/mips/{loongson64 => loongson2ef}/common/pm.c (99%)
           rename arch/mips/{loongson64 => loongson2ef}/common/reset.c (77%)
           rename arch/mips/{loongson64 => loongson2ef}/common/rtc.c (100%)
           rename arch/mips/{loongson64 => loongson2ef}/common/serial.c
        (63%)
           rename arch/mips/{loongson64 => loongson2ef}/common/setup.c (97%)
           rename arch/mips/{loongson64 => loongson2ef}/common/time.c (96%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/common/uart_base.c (77%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/fuloong-2e/Makefile (100%)
           rename arch/mips/{loongson64 => loongson2ef}/fuloong-2e/dma.c
        (100%)
           rename arch/mips/{loongson64 => loongson2ef}/fuloong-2e/irq.c
        (98%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/fuloong-2e/reset.c (93%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/lemote-2f/Makefile (100%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/lemote-2f/clock.c (98%)
           rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/dma.c
        (100%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/lemote-2f/ec_kb3310b.c (100%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/lemote-2f/ec_kb3310b.h (100%)
           rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/irq.c
        (99%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/lemote-2f/machtype.c (98%)
           rename arch/mips/{loongson64 => loongson2ef}/lemote-2f/pm.c (99%)
           rename arch/mips/{loongson64 =>
        loongson2ef}/lemote-2f/reset.c (99%)
           rename arch/mips/loongson64/{loongson-3 => }/acpi_init.c (99%)
           rename arch/mips/loongson64/{loongson-3 => }/cop2-ex.c (88%)
           rename arch/mips/loongson64/{loongson-3 => }/dma.c (82%)
           rename arch/mips/loongson64/{common => }/env.c (79%)
           rename arch/mips/loongson64/{loongson-3 => }/hpet.c (100%)
           rename arch/mips/loongson64/{loongson-3 => }/irq.c (77%)
           delete mode 100644 arch/mips/loongson64/loongson-3/Makefile
           rename arch/mips/loongson64/{loongson-3 => }/numa.c (98%)
           create mode 100644 arch/mips/loongson64/pci.c
           rename arch/mips/loongson64/{loongson-3 => }/platform.c (100%)
           create mode 100644 arch/mips/loongson64/reset.c
           create mode 100644 arch/mips/loongson64/setup.c
           rename arch/mips/loongson64/{loongson-3 => }/smp.c (99%)
           rename arch/mips/loongson64/{loongson-3 => }/smp.h (100%)
Rob Herring (Arm) Sept. 30, 2019, 1:20 p.m. UTC | #7
On Thu, Sep 05, 2019 at 10:43:11PM +0800, Jiaxun Yang wrote:
> Add generic device dts for Loongson-3 devices.
> They seems identical but will be different later.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>  arch/mips/Kconfig                           |  4 +-
>  arch/mips/boot/dts/Makefile                 |  1 +
>  arch/mips/boot/dts/loongson/3a-package.dtsi | 69 +++++++++++++++++++++
>  arch/mips/boot/dts/loongson/3a1000_780e.dts | 10 +++
>  arch/mips/boot/dts/loongson/3a2000_780e.dts | 10 +++
>  arch/mips/boot/dts/loongson/3a3000_780e.dts | 10 +++
>  arch/mips/boot/dts/loongson/3b-package.dtsi | 69 +++++++++++++++++++++
>  arch/mips/boot/dts/loongson/3b1x00_780e.dts | 10 +++
>  arch/mips/boot/dts/loongson/Makefile        |  5 ++
>  arch/mips/boot/dts/loongson/rs780e-pch.dtsi | 35 +++++++++++
>  10 files changed, 222 insertions(+), 1 deletion(-)
>  create mode 100644 arch/mips/boot/dts/loongson/3a-package.dtsi
>  create mode 100644 arch/mips/boot/dts/loongson/3a1000_780e.dts
>  create mode 100644 arch/mips/boot/dts/loongson/3a2000_780e.dts
>  create mode 100644 arch/mips/boot/dts/loongson/3a3000_780e.dts
>  create mode 100644 arch/mips/boot/dts/loongson/3b-package.dtsi
>  create mode 100644 arch/mips/boot/dts/loongson/3b1x00_780e.dts
>  create mode 100644 arch/mips/boot/dts/loongson/Makefile
>  create mode 100644 arch/mips/boot/dts/loongson/rs780e-pch.dtsi
> 
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index b6bdd96ec74e..5bad9aafcbdf 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -489,6 +489,8 @@ config MACH_LOONGSON64
>  	select SYS_SUPPORTS_LITTLE_ENDIAN
>  	select ZONE_DMA32
>  	select SYS_SUPPORTS_ZBOOT
> +	select USE_OF
> +	select BUILTIN_DTB
>  	help
>  	  This enables the support of Loongson-3A/3B/2-series-soc processors
>  
> @@ -3047,7 +3049,7 @@ endchoice
>  choice
>  	prompt "Kernel command line type" if !CMDLINE_OVERRIDE
>  	default MIPS_CMDLINE_FROM_DTB if USE_OF && !ATH79 && !MACH_INGENIC && \
> -					 !MIPS_MALTA && \
> +					 !MACH_LOONGSON64 && !MIPS_MALTA && \
>  					 !CAVIUM_OCTEON_SOC
>  	default MIPS_CMDLINE_FROM_BOOTLOADER
>  
> diff --git a/arch/mips/boot/dts/Makefile b/arch/mips/boot/dts/Makefile
> index 1e79cab8e269..d429a69bfe30 100644
> --- a/arch/mips/boot/dts/Makefile
> +++ b/arch/mips/boot/dts/Makefile
> @@ -4,6 +4,7 @@ subdir-y	+= cavium-octeon
>  subdir-y	+= img
>  subdir-y	+= ingenic
>  subdir-y	+= lantiq
> +subdir-y	+= loongson
>  subdir-y	+= mscc
>  subdir-y	+= mti
>  subdir-y	+= netlogic
> diff --git a/arch/mips/boot/dts/loongson/3a-package.dtsi b/arch/mips/boot/dts/loongson/3a-package.dtsi
> new file mode 100644
> index 000000000000..739cf43c7310
> --- /dev/null
> +++ b/arch/mips/boot/dts/loongson/3a-package.dtsi
> @@ -0,0 +1,69 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <dt-bindings/interrupt-controller/irq.h>
> +
> +/ {
> +	#address-cells = <2>;
> +	#size-cells = <2>;
> +
> +	cpuintc: interrupt-controller {
> +		#address-cells = <0>;
> +		#interrupt-cells = <1>;
> +		interrupt-controller;
> +		compatible = "mti,cpu-interrupt-controller";
> +	};
> +
> +	package@0 {

bus@1fe00000

> +		compatible = "simple-bus";
> +		#address-cells = <2>;
> +		#size-cells = <1>;
> +		ranges = <0 0x1fe00000 0 0x1fe00000 0x100000
> +				0 0x3ff00000 0 0x3ff00000 0x100000
> +				0xEFD 0xFB000000 0xEFD 0xFB000000 0x10000000 /* 3A HT Config Space */>;

Lowercase hex please.

> +
> +		iointc: interrupt-controller@3ff01400 {
> +			compatible = "loongson,ls3-iointc";
> +			reg = <0 0x3ff01400 0x64>;
> +
> +			interrupt-controller;
> +			#interrupt-cells = <2>;
> +
> +			interrupt-parent = <&cpuintc>;
> +			interrupts = <2>;
> +			};

Too much indentation.

> +
> +		cpu_uart0: serial@1fe001e0 {
> +			device_type = "serial";

Drop device_type. It's deprecated for everything but cpu, memory, and 
pci.

> +			compatible = "ns16550a";
> +			reg = <0 0x1fe001e0 0x8>;
> +			clock-frequency = <33000000>;
> +			interrupt-parent = <&iointc>;
> +			interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
> +			no-loopback-test;
> +		};
> +
> +		cpu_uart1: serial@1fe001e8 {
> +			status = "disabled";
> +			device_type = "serial";
> +			compatible = "ns16550a";
> +			reg = <0 0x1fe001e8 0x8>;
> +			clock-frequency = <33000000>;
> +			interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
> +			interrupt-parent = <&iointc>;
> +			no-loopback-test;
> +		};
> +
> +		htintc: interrupt-controller@0xEFDFB000080 {

Drop '0x' and lowercase. Building with 'W=12' will tell you this. Do 
that, and fix the warnings.

> +			compatible = "loongson,ls3-htintc";
> +			reg = <0xEFD 0xFB000080 0x100>;

lowercase

> +			interrupt-controller;
> +			#interrupt-cells = <1>;
> +
> +			interrupt-parent = <&iointc>;
> +			interrupts = <24 IRQ_TYPE_LEVEL_HIGH>,
> +						<25 IRQ_TYPE_LEVEL_HIGH>,
> +						<26 IRQ_TYPE_LEVEL_HIGH>,
> +						<27 IRQ_TYPE_LEVEL_HIGH>;
> +		};
> +	};
> +};
> diff --git a/arch/mips/boot/dts/loongson/3a1000_780e.dts b/arch/mips/boot/dts/loongson/3a1000_780e.dts
> new file mode 100644
> index 000000000000..dc1afe9410c8
> --- /dev/null
> +++ b/arch/mips/boot/dts/loongson/3a1000_780e.dts
> @@ -0,0 +1,10 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +/dts-v1/;
> +
> +#include "3a-package.dtsi"
> +#include "rs780e-pch.dtsi"
> +
> +/ {
> +	compatible = "loongson,ls3a1000-780e";
> +};
> diff --git a/arch/mips/boot/dts/loongson/3a2000_780e.dts b/arch/mips/boot/dts/loongson/3a2000_780e.dts
> new file mode 100644
> index 000000000000..621e0d3b5fbd
> --- /dev/null
> +++ b/arch/mips/boot/dts/loongson/3a2000_780e.dts
> @@ -0,0 +1,10 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +/dts-v1/;
> +
> +#include "3a-package.dtsi"
> +#include "rs780e-pch.dtsi"
> +
> +/ {
> +	compatible = "loongson,ls3a2000-780e";
> +};
> diff --git a/arch/mips/boot/dts/loongson/3a3000_780e.dts b/arch/mips/boot/dts/loongson/3a3000_780e.dts
> new file mode 100644
> index 000000000000..f170f1c2189d
> --- /dev/null
> +++ b/arch/mips/boot/dts/loongson/3a3000_780e.dts
> @@ -0,0 +1,10 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +/dts-v1/;
> +
> +#include "3a-package.dtsi"
> +#include "rs780e-pch.dtsi"
> +
> +/ {
> +	compatible = "loongson,ls3a3000-780e";
> +};
> diff --git a/arch/mips/boot/dts/loongson/3b-package.dtsi b/arch/mips/boot/dts/loongson/3b-package.dtsi
> new file mode 100644
> index 000000000000..af6e115d33c0
> --- /dev/null
> +++ b/arch/mips/boot/dts/loongson/3b-package.dtsi

Same comments apply to this file.

Looks like this one is pretty similar to 3a-package.dtsi. Can't you 
share more?

> @@ -0,0 +1,69 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <dt-bindings/interrupt-controller/irq.h>
> +
> +/ {
> +	#address-cells = <2>;
> +	#size-cells = <2>;
> +
> +	cpuintc: interrupt-controller {
> +		#address-cells = <0>;
> +		#interrupt-cells = <1>;
> +		interrupt-controller;
> +		compatible = "mti,cpu-interrupt-controller";
> +	};
> +
> +	package@0 {
> +		compatible = "simple-bus";
> +		#address-cells = <2>;
> +		#size-cells = <1>;
> +		ranges = <0 0x1fe00000 0 0x1fe00000 0x100000
> +				0 0x3ff00000 0 0x3ff00000 0x100000
> +				0x1EFD 0xFB000000 0x1EFD 0xFB000000 0x10000000 /* 3B HT Config Space */>;
> +
> +		iointc: interrupt-controller@3ff01400 {
> +			compatible = "loongson,ls3-iointc";
> +			reg = <0 0x3ff01400 0x64>;
> +
> +			interrupt-controller;
> +			#interrupt-cells = <2>;
> +
> +			interrupt-parent = <&cpuintc>;
> +			interrupts = <2>;
> +			};
> +
> +		cpu_uart0: serial@1fe001e0 {
> +			device_type = "serial";
> +			compatible = "ns16550a";
> +			reg = <0 0x1fe001e0 0x8>;
> +			clock-frequency = <33000000>;
> +			interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
> +			interrupt-parent = <&iointc>;
> +			no-loopback-test;
> +		};
> +
> +		cpu_uart1: serial@1fe001e8 {
> +			status = "disabled";
> +			device_type = "serial";
> +			compatible = "ns16550a";
> +			reg = <0 0x1fe001e8 0x8>;
> +			clock-frequency = <33000000>;
> +			interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
> +			interrupt-parent = <&iointc>;
> +			no-loopback-test;
> +		};
> +
> +		htintc: interrupt-controller@0x1EFDFB000080 {
> +			compatible = "loongson,ls3-htintc";
> +			reg = <0x1EFD 0xFB000080 0x100>;
> +			interrupt-controller;
> +			#interrupt-cells = <1>;
> +
> +			interrupt-parent = <&iointc>;
> +			interrupts = <24 IRQ_TYPE_LEVEL_HIGH>,
> +						<25 IRQ_TYPE_LEVEL_HIGH>,
> +						<26 IRQ_TYPE_LEVEL_HIGH>,
> +						<27 IRQ_TYPE_LEVEL_HIGH>;
> +		};
> +	};
> +};
> diff --git a/arch/mips/boot/dts/loongson/3b1x00_780e.dts b/arch/mips/boot/dts/loongson/3b1x00_780e.dts
> new file mode 100644
> index 000000000000..9b0dff0b1482
> --- /dev/null
> +++ b/arch/mips/boot/dts/loongson/3b1x00_780e.dts
> @@ -0,0 +1,10 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +/dts-v1/;
> +
> +#include "3b-package.dtsi"
> +#include "rs780e-pch.dtsi"
> +
> +/ {
> +	compatible = "loongson,ls3b-780e";
> +};
> diff --git a/arch/mips/boot/dts/loongson/Makefile b/arch/mips/boot/dts/loongson/Makefile
> new file mode 100644
> index 000000000000..a225d84a521e
> --- /dev/null
> +++ b/arch/mips/boot/dts/loongson/Makefile
> @@ -0,0 +1,5 @@
> +# SPDX_License_Identifier: GPL_2.0
> +dtb-$(CONFIG_MACH_LOONGSON64)	+= 3a1000_780e.dtb 3a2000_780e.dtb 3a3000_780e.dtb 3b1x00_780e.dtb \
> +
> +
> +obj-$(CONFIG_BUILTIN_DTB)	+= $(addsuffix .o, $(dtb-y))
> diff --git a/arch/mips/boot/dts/loongson/rs780e-pch.dtsi b/arch/mips/boot/dts/loongson/rs780e-pch.dtsi
> new file mode 100644
> index 000000000000..915363eafa2f
> --- /dev/null
> +++ b/arch/mips/boot/dts/loongson/rs780e-pch.dtsi
> @@ -0,0 +1,35 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +/ {
> +	pch {

bus@10000000

> +		compatible = "simple-bus";
> +		#address-cells = <2>;
> +		#size-cells = <1>;
> +		ranges = <0x000 0x10000000 0x000 0x10000000 0x10000000
> +			  0x000 0x40000000 0x000 0x40000000 0x40000000>;
> +
> +		isa {

This doesn't seem like it would be an accurate representation of the 
h/w. I'd expect this would be behind a PCI bridge for example? How do 
you identify a RS780E chip? Using the top level compatible is not the 
right way to do it.

> +			compatible = "isa";
> +			#address-cells = <2>;
> +			#size-cells = <1>;
> +			ranges = <1 0 0 0 0x1000>;
> +
> +			i8259: interrupt-controller@20 {
> +				compatible = "intel,i8259";
> +				interrupt-controller;
> +				#interrupt-cells = <1>;
> +				plat-poll;
> +				interrupts = <0>, <1>, <2>, <3>, <4>, <5>, <6>, <7>,
> +							<8>, <9>, <10>, <11>, <12>, <13>, <14>, <15>;
> +				interrupt-parent = <&htintc>;
> +			};
> +
> +			rtc0: rtc@70 {
> +				compatible = "motorola,mc146818";
> +				reg = <1 0x70 0x8>;
> +				interrupts = <8>;
> +				interrupt-parent = <&i8259>;
> +			};
> +		};
> +	};
> +};
> -- 
> 2.22.0
>