1. 31 Aug, 2019 2 commits
  2. 27 Aug, 2019 1 commit
  3. 26 Aug, 2019 4 commits
    • Florian Fainelli's avatar
      firmware: bcm47xx_nvram: Allow COMPILE_TEST · 5699ad0a
      Florian Fainelli authored
      Allow building building the BCM47xx NVRAM and SPROM drivers using
      COMPILE_TEST.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@linux-mips.org
      Cc: joe@perches.com
      Cc: Rafał Miłecki <zajec5@gmail.com>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      5699ad0a
    • Florian Fainelli's avatar
      firmware: bcm47xx_nvram: Correct size_t printf format · feb4eb06
      Florian Fainelli authored
      When building on a 64-bit host, we will get warnings like those:
      
      drivers/firmware/broadcom/bcm47xx_nvram.c:103:3: note: in expansion of macro 'pr_err'
         pr_err("nvram on flash (%i bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n",
         ^~~~~~
      drivers/firmware/broadcom/bcm47xx_nvram.c:103:28: note: format string is defined here
         pr_err("nvram on flash (%i bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n",
                                 ~^
                                 %li
      
      Use %zu instead for that purpose.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@linux-mips.org
      Cc: joe@perches.com
      Cc: Rafał Miłecki <zajec5@gmail.com>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      feb4eb06
    • Jiaxun Yang's avatar
      MIPS: Treat Loongson Extensions as ASEs · d2f96554
      Jiaxun Yang authored
      Recently, binutils had split Loongson-3 Extensions into four ASEs:
      MMI, CAM, EXT, EXT2. This patch do the samething in kernel and expose
      them in cpuinfo so applications can probe supported ASEs at runtime.
      Signed-off-by: default avatarJiaxun Yang <jiaxun.yang@flygoat.com>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Yunqiang Su <ysu@wavecomp.com>
      Cc: stable@vger.kernel.org # v4.14+
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@vger.kernel.org
      d2f96554
    • Stephen Boyd's avatar
      MIPS: Remove dev_err() usage after platform_get_irq() · 322e577b
      Stephen Boyd authored
      We don't need dev_err() messages when platform_get_irq() fails now that
      platform_get_irq() prints an error message itself when something goes
      wrong. Let's remove these prints with a simple semantic patch.
      
      // <smpl>
      @@
      expression ret;
      struct platform_device *E;
      @@
      
      ret =
      (
      platform_get_irq(E, ...)
      |
      platform_get_irq_byname(E, ...)
      );
      
      if ( \( ret < 0 \| ret <= 0 \) )
      {
      (
      -if (ret != -EPROBE_DEFER)
      -{ ...
      -dev_err(...);
      -... }
      |
      ...
      -dev_err(...);
      )
      ...
      }
      // </smpl>
      
      While we're here, remove braces on if statements that only have one
      statement (manually).
      
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: linux-mips@vger.kernel.org
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarStephen Boyd <swboyd@chromium.org>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: linux-kernel@vger.kernel.org
      322e577b
  4. 24 Aug, 2019 4 commits
    • Antoine Tenart's avatar
      MIPS: dts: mscc: describe the PTP ready interrupt · b4742e66
      Antoine Tenart authored
      This patch adds a description of the PTP ready interrupt, which can be
      triggered when a PTP timestamp is available on an hardware FIFO.
      Signed-off-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: davem@davemloft.net
      Cc: richardcochran@gmail.com
      Cc: alexandre.belloni@bootlin.com
      Cc: UNGLinuxDriver@microchip.com
      Cc: ralf@linux-mips.org
      Cc: jhogan@kernel.org
      Cc: netdev@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: thomas.petazzoni@bootlin.com
      Cc: allan.nielsen@microchip.com
      b4742e66
    • Antoine Tenart's avatar
      MIPS: dts: mscc: describe the PTP register range · 048dc3ab
      Antoine Tenart authored
      This patch adds one register range within the mscc,vsc7514-switch node,
      to describe the PTP registers.
      Signed-off-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: davem@davemloft.net
      Cc: richardcochran@gmail.com
      Cc: alexandre.belloni@bootlin.com
      Cc: UNGLinuxDriver@microchip.com
      Cc: ralf@linux-mips.org
      Cc: jhogan@kernel.org
      Cc: netdev@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: thomas.petazzoni@bootlin.com
      Cc: allan.nielsen@microchip.com
      048dc3ab
    • Martin Blumenstingl's avatar
      MIPS: lantiq: update the clock alias' for the mainline PCIe PHY driver · ed90302b
      Martin Blumenstingl authored
      The mainline PCIe PHY driver has it's own devicetree node. Update the
      clock alias so the mainline driver finds the clocks.
      
      The first PCIe PHY is located at 0x1f106800 and exists on VRX200, ARX300
      and GRX390.
      The second PCIe PHY is located at 0x1f700400 and exists on ARX300 and
      GRX390.
      The third PCIe PHY is located at 0x1f106a00 and exists onl on GRX390.
      Lantiq's board support package (called "UGW") names these registers
      "PDI".
      Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@vger.kernel.org
      Cc: devicetree@vger.kernel.org
      Cc: john@phrozen.org
      Cc: kishon@ti.com
      Cc: ralf@linux-mips.org
      Cc: robh+dt@kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: hauke@hauke-m.de
      Cc: mark.rutland@arm.com
      Cc: ms@dev.tdt.de
      ed90302b
    • Nick Desaulniers's avatar
      mips: avoid explicit UB in assignment of mips_io_port_base · 12051b31
      Nick Desaulniers authored
      The code in question is modifying a variable declared const through
      pointer manipulation.  Such code is explicitly undefined behavior, and
      is the lone issue preventing malta_defconfig from booting when built
      with Clang:
      
      If an attempt is made to modify an object defined with a const-qualified
      type through use of an lvalue with non-const-qualified type, the
      behavior is undefined.
      
      LLVM is removing such assignments. A simple fix is to not declare
      variables const that you plan on modifying.  Limiting the scope would be
      a better method of preventing unwanted writes to such a variable.
      
      Further, the code in question mentions "compiler bugs" without any links
      to bug reports, so it is difficult to know if the issue is resolved in
      GCC. The patch was authored in 2006, which would have been GCC 4.0.3 or
      4.1.1. The minimal supported version of GCC in the Linux kernel is
      currently 4.6.
      
      For what its worth, there was UB before the commit in question, it just
      added a barrier and got lucky IRT codegen. I don't think there's any
      actual compiler bugs related, just runtime bugs due to UB.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/610
      Fixes: 966f4406 ("[MIPS] Work around bad code generation for <asm/io.h>.")
      Reported-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Debugged-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Suggested-by: default avatarEli Friedman <efriedma@quicinc.com>
      Signed-off-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Tested-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: ralf@linux-mips.org
      Cc: jhogan@kernel.org
      Cc: Maciej W. Rozycki <macro@linux-mips.org>
      Cc: Hassan Naveed <hnaveed@wavecomp.com>
      Cc: Stephen Kitt <steve@sk2.org>
      Cc: Serge Semin <fancer.lancer@gmail.com>
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: clang-built-linux@googlegroups.com
      12051b31
  5. 23 Aug, 2019 10 commits
  6. 19 Aug, 2019 2 commits
  7. 12 Aug, 2019 3 commits
    • Nathan Chancellor's avatar
      MIPS: tlbex: Explicitly cast _PAGE_NO_EXEC to a boolean · c59ae0a1
      Nathan Chancellor authored
      clang warns:
      
      arch/mips/mm/tlbex.c:634:19: error: use of logical '&&' with constant
      operand [-Werror,-Wconstant-logical-operand]
              if (cpu_has_rixi && _PAGE_NO_EXEC) {
                               ^  ~~~~~~~~~~~~~
      arch/mips/mm/tlbex.c:634:19: note: use '&' for a bitwise operation
              if (cpu_has_rixi && _PAGE_NO_EXEC) {
                               ^~
                               &
      arch/mips/mm/tlbex.c:634:19: note: remove constant to silence this
      warning
              if (cpu_has_rixi && _PAGE_NO_EXEC) {
                              ~^~~~~~~~~~~~~~~~
      1 error generated.
      
      Explicitly cast this value to a boolean so that clang understands we
      intend for this to be a non-zero value.
      
      Fixes: 00bf1c69 ("MIPS: tlbex: Avoid placing software PTE bits in Entry* PFN fields")
      Link: https://github.com/ClangBuiltLinux/linux/issues/609Signed-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
      c59ae0a1
    • Nathan Chancellor's avatar
      MIPS/ptrace: Update mips_get_syscall_arg's return type · 077ff3be
      Nathan Chancellor authored
      clang warns:
      
      arch/mips/include/asm/syscall.h:136:3: error: variable 'ret' is
      uninitialized when used here [-Werror,-Wuninitialized]
                      ret |= mips_get_syscall_arg(args++, task, regs, i++);
                      ^~~
      arch/mips/include/asm/syscall.h:129:9: note: initialize the variable
      'ret' to silence this warning
              int ret;
                     ^
                      = 0
      1 error generated.
      
      It's not wrong; however, it's not an issue in practice because ret is
      only assigned to, not read from. ret could just be initialized to zero
      but looking into it further, ret has been unused since it was first
      added in 2012 so just get rid of it and update mips_get_syscall_arg's
      return type since none of the return values are ever checked. If it is
      ever needed again, this commit can be reverted and ret can be properly
      initialized.
      
      Fixes: c0ff3c53 ("MIPS: Enable HAVE_ARCH_TRACEHOOK.")
      Link: https://github.com/ClangBuiltLinux/linux/issues/604Signed-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
      077ff3be
    • 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
  8. 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