1. 12 Aug, 2019 1 commit
    • Nathan Chancellor's avatar
      MIPS: Don't use bc_false uninitialized in __mm_isBranchInstr · c2869aaf
      Nathan Chancellor authored
      clang warns:
      
      arch/mips/kernel/branch.c:148:8: error: variable 'bc_false' is used
      uninitialized whenever switch case is taken
      [-Werror,-Wsometimes-uninitialized]
                      case mm_bc2t_op:
                           ^~~~~~~~~~
      arch/mips/kernel/branch.c:157:8: note: uninitialized use occurs here
                              if (bc_false)
                                  ^~~~~~~~
      arch/mips/kernel/branch.c:149:8: error: variable 'bc_false' is used
      uninitialized whenever switch case is taken
      [-Werror,-Wsometimes-uninitialized]
                      case mm_bc1t_op:
                           ^~~~~~~~~~
      arch/mips/kernel/branch.c:157:8: note: uninitialized use occurs here
                              if (bc_false)
                                  ^~~~~~~~
      arch/mips/kernel/branch.c:142:4: note: variable 'bc_false' is declared
      here
                              int bc_false = 0;
                              ^
      2 errors generated.
      
      When mm_bc1t_op and mm_bc2t_op are taken, the bc_false initialization
      does not happen, which leads to a garbage value upon use, as illustrated
      below with a small sample program.
      
      $ mipsel-linux-gnu-gcc --version | head -n1
      mipsel-linux-gnu-gcc (Debian 8.3.0-2) 8.3.0
      
      $ clang --version | head -n1
      ClangBuiltLinux clang version 9.0.0 (git://github.com/llvm/llvm-project
      544315b4197034a3be8acd12cba56a75fb1f08dc) (based on LLVM 9.0.0svn)
      
      $ cat test.c
       #include <stdio.h>
      
       static void switch_scoped(int opcode)
       {
      	 switch (opcode) {
      	 case 1:
      	 case 2: {
      		 int bc_false = 0;
      
      		 bc_false = 4;
      	 case 3:
      	 case 4:
      		 printf("\t* switch scoped bc_false = %d\n", bc_false);
      	 }
      	 }
       }
      
       static void function_scoped(int opcode)
       {
      	 int bc_false = 0;
      
      	 switch (opcode) {
      	 case 1:
      	 case 2: {
      		 bc_false = 4;
      	 case 3:
      	 case 4:
      		 printf("\t* function scoped bc_false = %d\n", bc_false);
      	 }
      	 }
       }
      
       int main(void)
       {
      	 int opcode;
      
      	 for (opcode = 1; opcode < 5; opcode++) {
      		 printf("opcode = %d:\n", opcode);
      		 switch_scoped(opcode);
      		 function_scoped(opcode);
      		 printf("\n");
      	 }
      
      	 return 0;
       }
      
      $ mipsel-linux-gnu-gcc -std=gnu89 -static test.c && \
        qemu-mipsel a.out
      opcode = 1:
              * switch scoped bc_false = 4
              * function scoped bc_false = 4
      
      opcode = 2:
              * switch scoped bc_false = 4
              * function scoped bc_false = 4
      
      opcode = 3:
              * switch scoped bc_false = 2147483004
              * function scoped bc_false = 0
      
      opcode = 4:
              * switch scoped bc_false = 2147483004
              * function scoped bc_false = 0
      
      $ clang -std=gnu89 --target=mipsel-linux-gnu -m32 -static test.c && \
        qemu-mipsel a.out
      opcode = 1:
              * switch scoped bc_false = 4
              * function scoped bc_false = 4
      
      opcode = 2:
              * switch scoped bc_false = 4
              * function scoped bc_false = 4
      
      opcode = 3:
              * switch scoped bc_false = 2147483004
              * function scoped bc_false = 0
      
      opcode = 4:
              * switch scoped bc_false = 2147483004
              * function scoped bc_false = 0
      
      Move the definition up so that we get the right behavior and mark it
      __maybe_unused as it will not be used when CONFIG_MIPS_FP_SUPPORT
      isn't enabled.
      
      Fixes: 6a1cc218 ("MIPS: branch: Remove FP branch handling when CONFIG_MIPS_FP_SUPPORT=n")
      Link: https://github.com/ClangBuiltLinux/linux/issues/603Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: clang-built-linux@googlegroups.com
      c2869aaf
  2. 08 Aug, 2019 14 commits
    • Paul Burton's avatar
      Merge branch 'ingenic-tcu-v5.4' into mips-next · 75b7329a
      Paul Burton authored
      Merge the Ingenic TCU patchset from the ingenic-tcu-v5.4 branch which
      was created to enable follow-on changes in other subsystems.
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      75b7329a
    • Paul Cercueil's avatar
      MIPS: jz4740: Drop obsolete code · abc55228
      Paul Cercueil authored
      The old clocksource/timer platform code is now obsoleted by the newly
      introduced TCU drivers.
      Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
      Tested-by: default avatarMathieu Malaterre <malat@debian.org>
      Tested-by: default avatarArtur Rojek <contact@artur-rojek.eu>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Lee Jones <lee.jones@linaro.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: devicetree@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: linux-clk@vger.kernel.org
      Cc: od@zcrc.me
      abc55228
    • Paul Cercueil's avatar
      MIPS: GCW0: Reduce system timer and clocksource to 750 kHz · 967a7100
      Paul Cercueil authored
      The default clock (12 MHz) is too fast for the system timer.
      Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
      Tested-by: default avatarMathieu Malaterre <malat@debian.org>
      Tested-by: default avatarArtur Rojek <contact@artur-rojek.eu>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Lee Jones <lee.jones@linaro.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: devicetree@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: linux-clk@vger.kernel.org
      Cc: od@zcrc.me
      967a7100
    • Paul Cercueil's avatar
      MIPS: CI20: Reduce system timer and clocksource to 3 MHz · 157c887a
      Paul Cercueil authored
      The default clock (48 MHz) is too fast for the system timer.
      Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
      Tested-by: default avatarMathieu Malaterre <malat@debian.org>
      Tested-by: default avatarArtur Rojek <contact@artur-rojek.eu>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Lee Jones <lee.jones@linaro.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: devicetree@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: linux-clk@vger.kernel.org
      Cc: od@zcrc.me
      157c887a
    • Paul Cercueil's avatar
      MIPS: qi_lb60: Reduce system timer and clocksource to 750 kHz · a68d3b05
      Paul Cercueil authored
      The default clock (12 MHz) is too fast for the system timer, which fails
      to report time accurately.
      Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
      Tested-by: default avatarMathieu Malaterre <malat@debian.org>
      Tested-by: default avatarArtur Rojek <contact@artur-rojek.eu>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Lee Jones <lee.jones@linaro.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: devicetree@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: linux-clk@vger.kernel.org
      Cc: od@zcrc.me
      a68d3b05
    • Paul Cercueil's avatar
      MIPS: jz4740: Add DTS nodes for the TCU drivers · 36aafdbd
      Paul Cercueil authored
      Add DTS nodes for the JZ4780, JZ4770 and JZ4740 devicetree files.
      Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
      Tested-by: default avatarMathieu Malaterre <malat@debian.org>
      Tested-by: default avatarArtur Rojek <contact@artur-rojek.eu>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Lee Jones <lee.jones@linaro.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: devicetree@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: linux-clk@vger.kernel.org
      Cc: od@zcrc.me
      36aafdbd
    • Paul Cercueil's avatar
      clk: jz4740: Add TCU clock · 73dd11dc
      Paul Cercueil authored
      Add the missing TCU clock to the list of clocks supplied by the CGU for
      the JZ4740 SoC.
      Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
      Tested-by: default avatarMathieu Malaterre <malat@debian.org>
      Tested-by: default avatarArtur Rojek <contact@artur-rojek.eu>
      Acked-by: default avatarStephen Boyd <sboyd@kernel.org>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Lee Jones <lee.jones@linaro.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: devicetree@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: linux-clk@vger.kernel.org
      Cc: od@zcrc.me
      73dd11dc
    • Paul Cercueil's avatar
      clocksource: Add a new timer-ingenic driver · 34e93683
      Paul Cercueil authored
      This driver handles the TCU (Timer Counter Unit) present on the Ingenic
      JZ47xx SoCs, and provides the kernel with a system timer, a clocksource
      and a sched_clock.
      Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
      Tested-by: default avatarMathieu Malaterre <malat@debian.org>
      Tested-by: default avatarArtur Rojek <contact@artur-rojek.eu>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Lee Jones <lee.jones@linaro.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: devicetree@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: linux-clk@vger.kernel.org
      Cc: od@zcrc.me
      34e93683
    • Paul Cercueil's avatar
      irqchip: Add irq-ingenic-tcu driver · 9536eba0
      Paul Cercueil authored
      This driver handles the interrupt controller built in the Timer/Counter
      Unit (TCU) of the JZ47xx SoCs from Ingenic.
      Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
      Tested-by: default avatarMathieu Malaterre <malat@debian.org>
      Tested-by: default avatarArtur Rojek <contact@artur-rojek.eu>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarMarc Zyngier <maz@kernel.org>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Lee Jones <lee.jones@linaro.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: devicetree@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: linux-clk@vger.kernel.org
      Cc: od@zcrc.me
      9536eba0
    • Paul Cercueil's avatar
      clk: ingenic: Add driver for the TCU clocks · 4f89e4b8
      Paul Cercueil authored
      Add driver to support the clocks provided by the Timer/Counter Unit
      (TCU) of the JZ47xx SoCs from Ingenic.
      Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
      Tested-by: default avatarMathieu Malaterre <malat@debian.org>
      Tested-by: default avatarArtur Rojek <contact@artur-rojek.eu>
      Acked-by: default avatarStephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Lee Jones <lee.jones@linaro.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: devicetree@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: linux-clk@vger.kernel.org
      Cc: od@zcrc.me
      4f89e4b8
    • Paul Cercueil's avatar
      mfd/syscon: Add device_node_to_regmap() · 39233b7c
      Paul Cercueil authored
      device_node_to_regmap() is exactly like syscon_node_to_regmap(), but it
      does not check that the node is compatible with "syscon", and won't
      attach the first clock it finds to the regmap.
      
      The rationale behind this, is that one device node with a standard
      compatible string "foo,bar" can be covered by multiple drivers sharing a
      regmap, or by a single driver doing all the job without a regmap, but
      these are implementation details which shouldn't reflect on the
      devicetree.
      Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Lee Jones <lee.jones@linaro.org>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: devicetree@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: linux-clk@vger.kernel.org
      Cc: od@zcrc.me
      Cc: Mathieu Malaterre <malat@debian.org>
      39233b7c
    • Paul Cercueil's avatar
      dt-bindings: Add doc for the Ingenic TCU drivers · 2e8722a5
      Paul Cercueil authored
      Add documentation about how to properly use the Ingenic TCU
      (Timer/Counter Unit) drivers from devicetree.
      Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Tested-by: default avatarMathieu Malaterre <malat@debian.org>
      Tested-by: default avatarArtur Rojek <contact@artur-rojek.eu>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Lee Jones <lee.jones@linaro.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: devicetree@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: linux-clk@vger.kernel.org
      Cc: od@zcrc.me
      2e8722a5
    • Paul Cercueil's avatar
      doc: Add doc for the Ingenic TCU hardware · 97689a1a
      Paul Cercueil authored
      Add documentation about the Timer/Counter Unit (TCU) present in the
      Ingenic JZ47xx SoCs.
      
      The Timer/Counter Unit (TCU) in Ingenic JZ47xx SoCs is a multi-function
      hardware block. It features up to to eight channels, that can be used as
      counters, timers, or PWM.
      
      - JZ4725B, JZ4750, JZ4755 only have six TCU channels. The other SoCs all
        have eight channels.
      
      - JZ4725B introduced a separate channel, called Operating System Timer
        (OST). It is a 32-bit programmable timer. On JZ4770 and above, it is
        64-bit.
      
      - Each one of the TCU channels has its own clock, which can be reparented
        to three different clocks (pclk, ext, rtc), gated, and reclocked, through
        their TCSR register.
        * The watchdog and OST hardware blocks also feature a TCSR register with
          the same format in their register space.
        * The TCU registers used to gate/ungate can also gate/ungate the watchdog
          and OST clocks.
      
      - Each TCU channel works in one of two modes:
        * mode TCU1: channels cannot work in sleep mode, but are easier to
          operate.
        * mode TCU2: channels can work in sleep mode, but the operation is a bit
          more complicated than with TCU1 channels.
      
      - The mode of each TCU channel depends on the SoC used:
        * On the oldest SoCs (up to JZ4740), all of the eight channels operate in
          TCU1 mode.
        * On JZ4725B, channel 5 operates as TCU2, the others operate as TCU1.
        * On newest SoCs (JZ4750 and above), channels 1-2 operate as TCU2, the
          others operate as TCU1.
      
      - Each channel can generate an interrupt. Some channels share an interrupt
        line, some don't, and this changes between SoC versions:
        * on older SoCs (JZ4740 and below), channel 0 and channel 1 have their
          own interrupt line; channels 2-7 share the last interrupt line.
        * On JZ4725B, channel 0 has its own interrupt; channels 1-5 share one
          interrupt line; the OST uses the last interrupt line.
        * on newer SoCs (JZ4750 and above), channel 5 has its own interrupt;
          channels 0-4 and (if eight channels) 6-7 all share one interrupt line;
          the OST uses the last interrupt line.
      Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
      Tested-by: default avatarMathieu Malaterre <malat@debian.org>
      Tested-by: default avatarArtur Rojek <contact@artur-rojek.eu>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Lee Jones <lee.jones@linaro.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: devicetree@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: linux-clk@vger.kernel.org
      Cc: od@zcrc.me
      97689a1a
    • Paul Cercueil's avatar
      dt-bindings: ingenic: Add DT bindings for TCU clocks · 4bc3c420
      Paul Cercueil authored
      This header provides clock numbers for the ingenic,tcu
      DT binding.
      Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
      Tested-by: default avatarMathieu Malaterre <malat@debian.org>
      Tested-by: default avatarArtur Rojek <contact@artur-rojek.eu>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Acked-by: default avatarStephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Lee Jones <lee.jones@linaro.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: devicetree@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: linux-clk@vger.kernel.org
      Cc: od@zcrc.me
      4bc3c420
  3. 06 Aug, 2019 5 commits
    • Arnd Bergmann's avatar
      mips: fix vdso32 build, again · 6393e606
      Arnd Bergmann authored
      The generic vdso support adds the same #if hack in two places,
      asm/vdso/vdso.h and config-n32-o32-env.c, but only the second
      is actually used. The result lacks the BUILD_VDSO32_64 macro,
      and that triggers a build error:
      
      ./include/linux/page-flags-layout.h:95:2: error: #error "Not enough bits in page flags"
      
      Move the macro into the other place, and remove the duplicated
      bits.
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Fixes: ee38d94a ("page flags: prioritize kasan bits over last-cpuid")
      Fixes: 24640f23 ("mips: Add support for generic vDSO")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andrey Konovalov <andreyknvl@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      6393e606
    • Paul Burton's avatar
      MIPS: octeon: Remove ARCH_HAS_IRQ_PER_CPU · 905421ee
      Paul Burton authored
      ARCH_HAS_IRQ_PER_CPU is unused anywhere in the kernel - remove the
      definition.
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      905421ee
    • Paul Burton's avatar
      MIPS: octeon: Remove cpu_has_saa · ece51529
      Paul Burton authored
      The cpu_has_saa feature macro was added along with Cavium Octeon CPU
      support back in commit 5b3b1688 ("MIPS: Add Cavium OCTEON processor
      support files to arch/mips/cavium-octeon.") but has never been used.
      
      Remove the dead code.
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      ece51529
    • Zhou Yanjie's avatar
      MIPS: Ingenic: Disable broken BTB lookup optimization. · 053951dd
      Zhou Yanjie authored
      In order to further reduce power consumption, the XBurst core
      by default attempts to avoid branch target buffer lookups by
      detecting & special casing loops. This feature will cause
      BogoMIPS and lpj calculate in error. Set cp0 config7 bit 4 to
      disable this feature.
      Signed-off-by: default avatarZhou Yanjie <zhouyanjie@zoho.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: ralf@linux-mips.org
      Cc: paul@crapouillou.net
      Cc: jhogan@kernel.org
      Cc: malat@debian.org
      Cc: gregkh@linuxfoundation.org
      Cc: tglx@linutronix.de
      Cc: allison@lohutok.net
      Cc: syq@debian.org
      Cc: chenhc@lemote.com
      Cc: jiaxun.yang@flygoat.com
      053951dd
    • Zhou Yanjie's avatar
      MIPS: Ingenic: Fix bugs when detecting X1000's L2 cache. · 579de8f8
      Zhou Yanjie authored
      1.fix bugs when detecting L2 cache sets value.
      2.fix bugs when detecting L2 cache ways value.
      Signed-off-by: default avatarZhou Yanjie <zhouyanjie@zoho.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: ralf@linux-mips.org
      Cc: paul@crapouillou.net
      Cc: jhogan@kernel.org
      Cc: malat@debian.org
      Cc: gregkh@linuxfoundation.org
      Cc: tglx@linutronix.de
      Cc: allison@lohutok.net
      Cc: syq@debian.org
      Cc: chenhc@lemote.com
      Cc: jiaxun.yang@flygoat.com
      579de8f8
  4. 30 Jul, 2019 13 commits
  5. 26 Jul, 2019 6 commits
    • Vincenzo Frascino's avatar
      mips: vdso: Fix flip/flop vdso building bug · cdab7e2c
      Vincenzo Frascino authored
      Running "make" on an already compiled kernel tree will rebuild the
      vdso library even if this has not been modified.
      
      $ make
        GEN     Makefile
        Using linux as source for kernel
        CALL   linux/scripts/atomic/check-atomics.sh
        CALL   linux/scripts/checksyscalls.sh
      <stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp]
        CHK     include/generated/compile.h
        VDSO    arch/mips/vdso/vdso.so.dbg.raw
        OBJCOPY arch/mips/vdso/vdso.so.raw
        GENVDSO arch/mips/vdso/vdso-image.c
        CC      arch/mips/vdso/vdso-image.o
        AR      arch/mips/vdso/built-in.a
        AR      arch/mips/built-in.a
        CHK     include/generated/autoksyms.h
        GEN     .version
        CHK     include/generated/compile.h
        UPD     include/generated/compile.h
        CC      init/version.o
        AR      init/built-in.a
        LD      vmlinux.o
        MODPOST vmlinux.o
        MODINFO modules.builtin.modinfo
        KSYM    .tmp_kallsyms1.o
        KSYM    .tmp_kallsyms2.o
        LD      vmlinux
        SORTEX  vmlinux
        SYSMAP  System.map
        Building modules, stage 2.
        ITS     arch/mips/boot/vmlinux.gz.its
        OBJCOPY arch/mips/boot/vmlinux.bin
        MODPOST 7 modules
        GZIP    arch/mips/boot/vmlinux.bin.gz
        ITB     arch/mips/boot/vmlinux.gz.itb
      
      The issue is generated by the fact that "if_changed" is called twice
      in a single target.
      
      Fix the build bug merging the two commands into a single function.
      Signed-off-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      cdab7e2c
    • Vincenzo Frascino's avatar
      mips: vdso: Fix source path · b4c0f7fa
      Vincenzo Frascino authored
      The vdso library for o32 and n32 does not compile compile correctly when
      building outside of the source tree due to a wrong inclusion path for
      config-n32-o32-env.c resulting in the error below:
      
      cc1: fatal error: arch/mips/vdso/config-n32-o32-env.c:
      No such file or dnirectory
      compilation terminated.
      arch/mips/vdso/Makefile:153: recipe for target
      'arch/mips/vdso/vgettimeofday-o32.o' failed
      make[3]: *** [arch/mips/vdso/vgettimeofday-o32.o] Error 1
      scripts/Makefile.build:490: recipe for target 'arch/mips/vdso' failed
      
      Fix the config-n32-o32-env.c inclusion path prepending the $(srctree)
      variable.
      Signed-off-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      [paul.burton@mips.com: Note that this occurs specifically when building
                             outside of the source tree.]
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      b4c0f7fa
    • Edward Matijević's avatar
      MIPS: BCM47XX: Add support for Netgear R6200 V1 · 42374b94
      Edward Matijević authored
      The Netgear R6200 v1 uses a BCM4718A1 SOC and a BCM4352/BCM4360 for 5GHz
      wireless. This patch adds support for detecting this model board and
      registers the 3 buttons.
      
      I have tested that the device can boot kernels 4.14 and 4.19 under
      OpenWRT.
      
      There is one issue that the LEDs on the device are controlled by a
      74HC164 that uses bit-banging instead of SPI so it isn't accessible to
      the kernel without adding a workaround. Without any workaround the
      device on boot will flash all LEDs once then the power LED will remain
      amber as all other LEDs stay off.
      Signed-off-by: default avatarEdward Matijevic <motolav@gmail.com>
      Acked-by: default avatarHauke Mehrtens <hauke@hauke-m.de>
      [paul.burton@mips.com:
        - Sort bcm47xx_board_list_board_id alphabetically by board type.
        - Fix whitespace.
        - Wrap commit message & drop OpenWRT-based justification for
          bcm47xx_board_list_board_id being mis-sorted.]
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      42374b94
    • Vincenzo Frascino's avatar
      mips: Add clock_gettime64 entry point · 1f66c45d
      Vincenzo Frascino authored
      With the release of Linux 5.1 has been added a new syscall,
      clock_gettime64, that provided a 64 bit time value for a specified
      clock_ID to make the kernel Y2038 safe on 32 bit architectures.
      
      Update the mips32 specific vDSO library accordingly with what it has
      been done for the kernel syscall exposing the clock_gettime64 entry
      point.
      
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@mips.com>
      Signed-off-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      1f66c45d
    • Vincenzo Frascino's avatar
      mips: Add clock_getres entry point · abed3d82
      Vincenzo Frascino authored
      The generic vDSO library provides an implementation of clock_getres()
      that can be leveraged by each architecture.
      
      Add clock_getres() entry point on mips.
      
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@mips.com>
      Signed-off-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      abed3d82
    • Vincenzo Frascino's avatar
      mips: Add support for generic vDSO · 24640f23
      Vincenzo Frascino authored
      The mips vDSO library requires some adaptations to take advantage of the
      newly introduced generic vDSO library.
      
      Introduce the following changes:
       - Modification of vdso.c to be compliant with the common vdso datapage
       - Use of lib/vdso for gettimeofday
      
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@mips.com>
      Signed-off-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      [paul.burton@mips.com: Prepend $(src) to config-n32-o32-env.c path.]
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      24640f23
  6. 23 Jul, 2019 1 commit