* [PATCH v3] doc: kernel-parameters.txt: fix documentation of nmi_watchdog parameter
From: Zhenzhong Duan @ 2019-05-21 2:32 UTC (permalink / raw)
To: linux-kernel, linux-doc
Cc: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel,
corbet, tglx, mingo, gregkh, keescook, srinivas.eeda,
Zhenzhong Duan
The default behavior of hardlockup depends on the config of
CONFIG_BOOTPARAM_HARDLOCKUP_PANIC.
Fix the description of nmi_watchdog to make it clear.
Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kees Cook <keescook@chromium.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-doc@vger.kernel.org
---
v3: add Suggested-by and Acked-by
v2: fix description using words suggested by Steven Rostedt
Documentation/admin-guide/kernel-parameters.txt | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 08df588..b9d4358 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2805,8 +2805,9 @@
0 - turn hardlockup detector in nmi_watchdog off
1 - turn hardlockup detector in nmi_watchdog on
When panic is specified, panic when an NMI watchdog
- timeout occurs (or 'nopanic' to override the opposite
- default). To disable both hard and soft lockup detectors,
+ timeout occurs (or 'nopanic' to not panic on an NMI
+ watchdog, if CONFIG_BOOTPARAM_HARDLOCKUP_PANIC is set)
+ To disable both hard and soft lockup detectors,
please see 'nowatchdog'.
This is useful when you use a panic=... timeout and
need the box quickly up again.
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH 00/10] Fix broken documentation references at v5.2-rc1
From: Mauro Carvalho Chehab @ 2019-05-22 0:26 UTC (permalink / raw)
To: Federico Vaga
Cc: Linux Doc Mailing List, Mauro Carvalho Chehab, linux-kernel,
Jonathan Corbet
In-Reply-To: <51951662.QppCrsbGrr@harkonnen>
Hi Frederico,
Em Wed, 22 May 2019 00:54:48 +0200
Federico Vaga <federico.vaga@vaga.pv.it> escreveu:
> On Monday, May 20, 2019 4:47:29 PM CEST Mauro Carvalho Chehab wrote:
> > There are several broken Documentation/* references within the Kernel
> > tree. There are some reasons for several of them:
> >
> > 1. The acpi and x86 documentation files were renamed, but the
> > references weren't updated;
> > 2. The DT files have been converted to JSON format, causing them
> > to be renamed;
> > 3. Translated files point to future translation work still pending merge
> > or require some action from someone that it is fluent at the
> > translated language;
>
> Hi Mauro
My main goal with this patchset is to get as close as possible to zero
warnings, as this helps me on rebasing a documentation patch series
I wrote with renames hundreds of file from .txt to .rst.
In the case of (3), the scripts/documentation-file-ref-check was unable to
find some files pointed by Italian and Chinese translations. So, after
this series, it will keep pointing for broken links there.
> I am not sure to get what you mean in terms of actions but I think you are
> referring to the "empty" files I added in the Italian translations. I added
> those files to avoid broken links; the alternative would have been to not
> write those links or to point directly to the main document, but in both
> cases it easy to forget to update them later.
> I chose to have links to "empty" files so that the document does
> not need to be updated later.
>
> If you are not referring to those files than I am not understanding, can you
> point to a clear example?
What I meant is that I can barely read Italian and have no glue on
Chinese. So, I can't really address those properly :-)
So, basically, it should be up to someone else fluent on such
languages to address those.
Btw, I understand why you pointed to some non-existing files:
translating the Kernel's documents takes a lot of time[1].
[1] If I was doing a translation, I would probably have opted to keep
pointing to the English doc and have a script to point me links to
non-translated docs, but your way also works. The only drawback is that
the script will keep pinpointing to translations with broken links,
while the translation is not complete.
Thanks,
Mauro
^ permalink raw reply
* Re: [PATCH 10/10] docs: fix broken documentation links
From: Federico Vaga @ 2019-05-21 22:56 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Linux Doc Mailing List, Mauro Carvalho Chehab, linux-kernel,
Jonathan Corbet, x86, linux-acpi, linux-edac, netdev, devicetree,
linux-pci, linux-arm-kernel, linux-amlogic, linux-arm-msm,
linux-gpio, linux-i2c, linuxppc-dev, xen-devel,
platform-driver-x86, devel, kvm, virtualization, devel, linux-mm,
linux-security-module, linux-kselftest
In-Reply-To: <4fd1182b4a41feb2447c7ccde4d7f0a6b3c92686.1558362030.git.mchehab+samsung@kernel.org>
On Monday, May 20, 2019 4:47:39 PM CEST Mauro Carvalho Chehab wrote:
> Mostly due to x86 and acpi conversion, several documentation
> links are still pointing to the old file. Fix them.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
> ---
> Documentation/acpi/dsd/leds.txt | 2 +-
> Documentation/admin-guide/kernel-parameters.rst | 6 +++---
> Documentation/admin-guide/kernel-parameters.txt | 16 ++++++++--------
> Documentation/admin-guide/ras.rst | 2 +-
> .../devicetree/bindings/net/fsl-enetc.txt | 7 +++----
> .../bindings/pci/amlogic,meson-pcie.txt | 2 +-
> .../bindings/regulator/qcom,rpmh-regulator.txt | 2 +-
> Documentation/devicetree/booting-without-of.txt | 2 +-
> Documentation/driver-api/gpio/board.rst | 2 +-
> Documentation/driver-api/gpio/consumer.rst | 2 +-
> .../firmware-guide/acpi/enumeration.rst | 2 +-
> .../firmware-guide/acpi/method-tracing.rst | 2 +-
> Documentation/i2c/instantiating-devices | 2 +-
> Documentation/sysctl/kernel.txt | 4 ++--
> .../translations/it_IT/process/4.Coding.rst | 2 +-
> .../translations/it_IT/process/howto.rst | 2 +-
> .../it_IT/process/stable-kernel-rules.rst | 4 ++--
> .../translations/zh_CN/process/4.Coding.rst | 2 +-
> Documentation/x86/x86_64/5level-paging.rst | 2 +-
> Documentation/x86/x86_64/boot-options.rst | 4 ++--
> .../x86/x86_64/fake-numa-for-cpusets.rst | 2 +-
> MAINTAINERS | 6 +++---
> arch/arm/Kconfig | 2 +-
> arch/arm64/kernel/kexec_image.c | 2 +-
> arch/powerpc/Kconfig | 2 +-
> arch/x86/Kconfig | 16 ++++++++--------
> arch/x86/Kconfig.debug | 2 +-
> arch/x86/boot/header.S | 2 +-
> arch/x86/entry/entry_64.S | 2 +-
> arch/x86/include/asm/bootparam_utils.h | 2 +-
> arch/x86/include/asm/page_64_types.h | 2 +-
> arch/x86/include/asm/pgtable_64_types.h | 2 +-
> arch/x86/kernel/cpu/microcode/amd.c | 2 +-
> arch/x86/kernel/kexec-bzimage64.c | 2 +-
> arch/x86/kernel/pci-dma.c | 2 +-
> arch/x86/mm/tlb.c | 2 +-
> arch/x86/platform/pvh/enlighten.c | 2 +-
> drivers/acpi/Kconfig | 10 +++++-----
> drivers/net/ethernet/faraday/ftgmac100.c | 2 +-
> .../fieldbus/Documentation/fieldbus_dev.txt | 4 ++--
> drivers/vhost/vhost.c | 2 +-
> include/acpi/acpi_drivers.h | 2 +-
> include/linux/fs_context.h | 2 +-
> include/linux/lsm_hooks.h | 2 +-
> mm/Kconfig | 2 +-
> security/Kconfig | 2 +-
> tools/include/linux/err.h | 2 +-
> tools/objtool/Documentation/stack-validation.txt | 4 ++--
> tools/testing/selftests/x86/protection_keys.c | 2 +-
> 49 files changed, 78 insertions(+), 79 deletions(-)
>
> diff --git a/Documentation/acpi/dsd/leds.txt
> b/Documentation/acpi/dsd/leds.txt index 81a63af42ed2..cc58b1a574c5 100644
> --- a/Documentation/acpi/dsd/leds.txt
> +++ b/Documentation/acpi/dsd/leds.txt
> @@ -96,4 +96,4 @@ where
>
> <URL:http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-da
> ta-extension-UUID-v1.1.pdf>, referenced 2019-02-21.
>
> -[7] Documentation/acpi/dsd/data-node-reference.txt
> +[7] Documentation/firmware-guide/acpi/dsd/data-node-references.rst
> diff --git a/Documentation/admin-guide/kernel-parameters.rst
> b/Documentation/admin-guide/kernel-parameters.rst index
> 0124980dca2d..8d3273e32eb1 100644
> --- a/Documentation/admin-guide/kernel-parameters.rst
> +++ b/Documentation/admin-guide/kernel-parameters.rst
> @@ -167,7 +167,7 @@ parameter is applicable::
> X86-32 X86-32, aka i386 architecture is enabled.
> X86-64 X86-64 architecture is enabled.
> More X86-64 boot options can be found in
> - Documentation/x86/x86_64/boot-options.txt
.
> + Documentation/x86/x86_64/boot-options.rst.
> X86 Either 32-bit or 64-bit x86 (same as X86-32+X86-64)
> X86_UV SGI UV support is enabled.
> XEN Xen support is enabled
> @@ -181,10 +181,10 @@ In addition, the following text indicates that the
> option:: Parameters denoted with BOOT are actually interpreted by the boot
> loader, and have no meaning to the kernel directly.
> Do not modify the syntax of boot loader parameters without extreme
> -need or coordination with <Documentation/x86/boot.txt>.
> +need or coordination with <Documentation/x86/boot.rst>.
>
> There are also arch-specific kernel-parameters not documented here.
> -See for example <Documentation/x86/x86_64/boot-options.txt>.
> +See for example <Documentation/x86/x86_64/boot-options.rst>.
>
> Note that ALL kernel parameters listed below are CASE SENSITIVE, and that
> a trailing = on the name of any parameter states that that parameter will
> diff --git a/Documentation/admin-guide/kernel-parameters.txt
> b/Documentation/admin-guide/kernel-parameters.txt index
> 138f6664b2e2..bc5f202d42ec 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -53,7 +53,7 @@
> ACPI_DEBUG_PRINT statements, e.g.,
> ACPI_DEBUG_PRINT((ACPI_DB_INFO, ...
> The debug_level mask defaults to "info".
See
> - Documentation/acpi/debug.txt for more
information about
> + Documentation/firmware-guide/acpi/debug.rst
for more information about
> debug layers and levels.
>
> Enable processor driver info messages:
> @@ -963,7 +963,7 @@
> for details.
>
> nompx [X86] Disables Intel Memory Protection
Extensions.
> - See Documentation/x86/intel_mpx.txt for
more
> + See Documentation/x86/intel_mpx.rst for
more
> information about the feature.
>
> nopku [X86] Disable Memory Protection Keys CPU
feature found
> @@ -1189,7 +1189,7 @@
> that is to be dynamically loaded by Linux.
If there are
> multiple variables with the same name but
with different
> vendor GUIDs, all of them will be loaded.
See
> - Documentation/acpi/ssdt-overlays.txt for
details.
> + Documentation/admin-guide/acpi/ssdt-
overlays.rst for details.
>
>
> eisa_irq_edge= [PARISC,HW]
> @@ -2383,7 +2383,7 @@
>
> mce [X86-32] Machine Check Exception
>
> - mce=option [X86-64] See Documentation/x86/x86_64/boot-
options.txt
> + mce=option [X86-64] See Documentation/x86/x86_64/boot-
options.rst
>
> md= [HW] RAID subsystems devices and level
> See Documentation/admin-guide/md.rst.
> @@ -2439,7 +2439,7 @@
> set according to the
> CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE
kernel config
> option.
> - See Documentation/memory-hotplug.txt.
> + See Documentation/admin-guide/mm/memory-
hotplug.rst.
>
> memmap=exactmap [KNL,X86] Enable setting of an exact
> E820 memory map, as specified by the user.
> @@ -2528,7 +2528,7 @@
> mem_encrypt=on: Activate
SME
> mem_encrypt=off: Do not activate SME
>
> - Refer to Documentation/x86/amd-memory-
encryption.txt
> + Refer to Documentation/x86/amd-memory-
encryption.rst
> for details on when memory encryption can
be activated.
>
> mem_sleep_default= [SUSPEND] Default system suspend mode:
> @@ -3528,7 +3528,7 @@
> See Documentation/blockdev/paride.txt.
>
> pirq= [SMP,APIC] Manual mp-table setup
> - See Documentation/x86/i386/IO-APIC.txt.
> + See Documentation/x86/i386/IO-APIC.rst.
>
> plip= [PPT,NET] Parallel port network link
> Format: { parport<nr> | timid | 0 }
> @@ -5054,7 +5054,7 @@
> Can be used multiple times for multiple
devices.
>
> vga= [BOOT,X86-32] Select a particular video
mode
> - See Documentation/x86/boot.txt and
> + See Documentation/x86/boot.rst and
> Documentation/svga.txt.
> Use vga=ask for menu.
> This is actually a boot loader parameter;
the value is
> diff --git a/Documentation/admin-guide/ras.rst
> b/Documentation/admin-guide/ras.rst index c7495e42e6f4..2b20f5f7380d 100644
> --- a/Documentation/admin-guide/ras.rst
> +++ b/Documentation/admin-guide/ras.rst
> @@ -199,7 +199,7 @@ Architecture (MCA)\ [#f3]_.
> mode).
>
> .. [#f3] For more details about the Machine Check Architecture (MCA),
> - please read Documentation/x86/x86_64/machinecheck at the Kernel tree.
> + please read Documentation/x86/x86_64/machinecheck.rst at the Kernel tree.
>
> EDAC - Error Detection And Correction
> *************************************
> diff --git a/Documentation/devicetree/bindings/net/fsl-enetc.txt
> b/Documentation/devicetree/bindings/net/fsl-enetc.txt index
> c812e25ae90f..25fc687419db 100644
> --- a/Documentation/devicetree/bindings/net/fsl-enetc.txt
> +++ b/Documentation/devicetree/bindings/net/fsl-enetc.txt
> @@ -16,8 +16,8 @@ Required properties:
> In this case, the ENETC node should include a "mdio" sub-node
> that in turn should contain the "ethernet-phy" node describing the
> external phy. Below properties are required, their bindings
> -already defined in ethernet.txt or phy.txt, under
> -Documentation/devicetree/bindings/net/*.
> +already defined in Documentation/devicetree/bindings/net/ethernet.txt or
> +Documentation/devicetree/bindings/net/phy.txt.
>
> Required:
>
> @@ -51,8 +51,7 @@ Example:
> connection:
>
> In this case, the ENETC port node defines a fixed link connection,
> -as specified by "fixed-link.txt", under
> -Documentation/devicetree/bindings/net/*.
> +as specified by Documentation/devicetree/bindings/net/fixed-link.txt.
>
> Required:
>
> diff --git a/Documentation/devicetree/bindings/pci/amlogic,meson-pcie.txt
> b/Documentation/devicetree/bindings/pci/amlogic,meson-pcie.txt index
> 12b18f82d441..efa2c8b9b85a 100644
> --- a/Documentation/devicetree/bindings/pci/amlogic,meson-pcie.txt
> +++ b/Documentation/devicetree/bindings/pci/amlogic,meson-pcie.txt
> @@ -3,7 +3,7 @@ Amlogic Meson AXG DWC PCIE SoC controller
> Amlogic Meson PCIe host controller is based on the Synopsys DesignWare PCI
> core. It shares common functions with the PCIe DesignWare core driver and
> inherits common properties defined in
> -Documentation/devicetree/bindings/pci/designware-pci.txt.
> +Documentation/devicetree/bindings/pci/designware-pcie.txt.
>
> Additional properties are described here:
>
> diff --git
> a/Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.txt
> b/Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.txt index
> 7ef2dbe48e8a..14d2eee96b3d 100644
> --- a/Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.txt
> +++ b/Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.txt
> @@ -97,7 +97,7 @@ Second Level Nodes - Regulators
> sent for this regulator including those which are
for a
> strictly lower power state.
>
> -Other properties defined in Documentation/devicetree/bindings/regulator.txt
> +Other properties defined in
> Documentation/devicetree/bindings/regulator/regulator.txt may also be used.
> regulator-initial-mode and regulator-allowed-modes may be specified for
> VRM regulators using mode values from
> include/dt-bindings/regulator/qcom,rpmh-regulator.h.
> regulator-allow-bypass diff --git
> a/Documentation/devicetree/booting-without-of.txt
> b/Documentation/devicetree/booting-without-of.txt index
> e86bd2f64117..60f8640f2b2f 100644
> --- a/Documentation/devicetree/booting-without-of.txt
> +++ b/Documentation/devicetree/booting-without-of.txt
> @@ -277,7 +277,7 @@ it with special cases.
> the decompressor (the real mode entry point goes to the same 32bit
> entry point once it switched into protected mode). That entry point
> supports one calling convention which is documented in
> - Documentation/x86/boot.txt
> + Documentation/x86/boot.rst
> The physical pointer to the device-tree block (defined in chapter II)
> is passed via setup_data which requires at least boot protocol 2.09.
> The type filed is defined as
> diff --git a/Documentation/driver-api/gpio/board.rst
> b/Documentation/driver-api/gpio/board.rst index b37f3f7b8926..ce91518bf9f4
> 100644
> --- a/Documentation/driver-api/gpio/board.rst
> +++ b/Documentation/driver-api/gpio/board.rst
> @@ -101,7 +101,7 @@ with the help of _DSD (Device Specific Data), introduced
> in ACPI 5.1:: }
>
> For more information about the ACPI GPIO bindings see
> -Documentation/acpi/gpio-properties.txt.
> +Documentation/firmware-guide/acpi/gpio-properties.rst.
>
> Platform Data
> -------------
> diff --git a/Documentation/driver-api/gpio/consumer.rst
> b/Documentation/driver-api/gpio/consumer.rst index
> 5e4d8aa68913..fdecb6d711db 100644
> --- a/Documentation/driver-api/gpio/consumer.rst
> +++ b/Documentation/driver-api/gpio/consumer.rst
> @@ -437,7 +437,7 @@ case, it will be handled by the GPIO subsystem
> automatically. However, if the _DSD is not present, the mappings between
> GpioIo()/GpioInt() resources and GPIO connection IDs need to be provided by
> device drivers.
>
> -For details refer to Documentation/acpi/gpio-properties.txt
> +For details refer to Documentation/firmware-guide/acpi/gpio-properties.rst
>
>
> Interacting With the Legacy GPIO Subsystem
> diff --git a/Documentation/firmware-guide/acpi/enumeration.rst
> b/Documentation/firmware-guide/acpi/enumeration.rst index
> 6b32b7be8c85..65f5bb5725ac 100644
> --- a/Documentation/firmware-guide/acpi/enumeration.rst
> +++ b/Documentation/firmware-guide/acpi/enumeration.rst
> @@ -339,7 +339,7 @@ a code like this::
> There are also devm_* versions of these functions which release the
> descriptors once the device is released.
>
> -See Documentation/acpi/gpio-properties.txt for more information about the
> +See Documentation/firmware-guide/acpi/gpio-properties.rst for more
> information about the _DSD binding related to GPIOs.
>
> MFD devices
> diff --git a/Documentation/firmware-guide/acpi/method-tracing.rst
> b/Documentation/firmware-guide/acpi/method-tracing.rst index
> d0b077b73f5f..0aa7e2c5d32a 100644
> --- a/Documentation/firmware-guide/acpi/method-tracing.rst
> +++ b/Documentation/firmware-guide/acpi/method-tracing.rst
> @@ -68,7 +68,7 @@ c. Filter out the debug layer/level matched logs when the
> specified
>
> Where:
> 0xXXXXXXXX/0xYYYYYYYY
> - Refer to Documentation/acpi/debug.txt for possible debug layer/level
> + Refer to Documentation/firmware-guide/acpi/debug.rst for possible
> debug layer/level masking values.
> \PPPP.AAAA.TTTT.HHHH
> Full path of a control method that can be found in the ACPI namespace.
> diff --git a/Documentation/i2c/instantiating-devices
> b/Documentation/i2c/instantiating-devices index 0d85ac1935b7..5a3e2f331e8c
> 100644
> --- a/Documentation/i2c/instantiating-devices
> +++ b/Documentation/i2c/instantiating-devices
> @@ -85,7 +85,7 @@ Method 1c: Declare the I2C devices via ACPI
> -------------------------------------------
>
> ACPI can also describe I2C devices. There is special documentation for this
> -which is currently located at Documentation/acpi/enumeration.txt. +which
> is currently located at Documentation/firmware-guide/acpi/enumeration.rst.
>
>
> Method 2: Instantiate the devices explicitly
> diff --git a/Documentation/sysctl/kernel.txt
> b/Documentation/sysctl/kernel.txt index f0c86fbb3b48..92f7f34b021a 100644
> --- a/Documentation/sysctl/kernel.txt
> +++ b/Documentation/sysctl/kernel.txt
> @@ -155,7 +155,7 @@ is 0x15 and the full version number is 0x234, this file
> will contain the value 340 = 0x154.
>
> See the type_of_loader and ext_loader_type fields in
> -Documentation/x86/boot.txt for additional information.
> +Documentation/x86/boot.rst for additional information.
>
> ==============================================================
>
> @@ -167,7 +167,7 @@ The complete bootloader version number. In the example
> above, this file will contain the value 564 = 0x234.
>
> See the type_of_loader and ext_loader_ver fields in
> -Documentation/x86/boot.txt for additional information.
> +Documentation/x86/boot.rst for additional information.
>
> ==============================================================
>
> diff --git a/Documentation/translations/it_IT/process/4.Coding.rst
> b/Documentation/translations/it_IT/process/4.Coding.rst index
> c05b89e616dd..1d23e951491f 100644
> --- a/Documentation/translations/it_IT/process/4.Coding.rst
> +++ b/Documentation/translations/it_IT/process/4.Coding.rst
> @@ -370,7 +370,7 @@ con cosa stanno lavorando. Consultate:
> Documentation/ABI/README per avere una descrizione di come questi documenti
> devono essere impostati e quali informazioni devono essere fornite.
>
> -Il file
> :ref:`Documentation/translations/it_IT/admin-guide/kernel-parameters.rst
> <kernelparameters>` +Il file
> :ref:`Documentation/admin-guide/kernel-parameters.rst <kernelparameters>`
> descrive tutti i parametri di avvio del kernel. Ogni patch che aggiunga
> nuovi parametri dovrebbe aggiungere nuove voci a questo file.
ACK
I will provide later a patch that adds that translation (just the .rst file)
> diff --git a/Documentation/translations/it_IT/process/howto.rst
> b/Documentation/translations/it_IT/process/howto.rst index
> 9903ac7c566b..44e6077730e8 100644
> --- a/Documentation/translations/it_IT/process/howto.rst
> +++ b/Documentation/translations/it_IT/process/howto.rst
> @@ -131,7 +131,7 @@ Di seguito una lista di file che sono presenti nei
> sorgente del kernel e che "Linux kernel patch submission format"
> http://linux.yyz.us/patch-format.html
>
> - :ref:`Documentation/process/translations/it_IT/stable-api-nonsense.rst
> <it_stable_api_nonsense>` +
> :ref:`Documentation/translations/it_IT/process/stable-api-nonsense.rst
> <it_stable_api_nonsense>`
ACK
> Questo file descrive la motivazioni sottostanti la conscia decisione di
> non avere un API stabile all'interno del kernel, incluso cose come: diff
> --git a/Documentation/translations/it_IT/process/stable-kernel-rules.rst
> b/Documentation/translations/it_IT/process/stable-kernel-rules.rst index
> 48e88e5ad2c5..4f206cee31a7 100644
> --- a/Documentation/translations/it_IT/process/stable-kernel-rules.rst
> +++ b/Documentation/translations/it_IT/process/stable-kernel-rules.rst
> @@ -33,7 +33,7 @@ Regole sul tipo di patch che vengono o non vengono
> accettate nei sorgenti - Non deve includere alcuna correzione "banale"
> (correzioni grammaticali, pulizia dagli spazi bianchi, eccetera).
> - Deve rispettare le regole scritte in
> - :ref:`Documentation/translation/it_IT/process/submitting-patches.rst
> <it_submittingpatches>` +
> :ref:`Documentation/translations/it_IT/process/submitting-patches.rst
> <it_submittingpatches>` - Questa patch o una equivalente deve esistere già
> nei sorgenti principali di Linux
ACK
>
> @@ -43,7 +43,7 @@ Procedura per sottomettere patch per i sorgenti -stable
>
> - Se la patch contiene modifiche a dei file nelle cartelle net/ o
> drivers/net, allora seguite le linee guida descritte in
> - :ref:`Documentation/translation/it_IT/networking/netdev-FAQ.rst
> <it_netdev-FAQ>`; +
> :ref:`Documentation/translations/it_IT/networking/netdev-FAQ.rst
> <it_netdev-FAQ>`; ma solo dopo aver verificato al seguente indirizzo che la
> patch non sia già in coda:
>
ACK
Thanks for the fixes, out of curiosity. How did you spot those mistakes?
> https://patchwork.ozlabs.org/bundle/davem/stable/?series=&submitter=&state=
> *&q=&archive= diff --git
> a/Documentation/translations/zh_CN/process/4.Coding.rst
> b/Documentation/translations/zh_CN/process/4.Coding.rst index
> 5301e9d55255..8bb777941394 100644
> --- a/Documentation/translations/zh_CN/process/4.Coding.rst
> +++ b/Documentation/translations/zh_CN/process/4.Coding.rst
> @@ -241,7 +241,7 @@ scripts/coccinelle目录下已经打包了相当多的内核“语义补丁”
>
> 任何添加新用户空间界面的代码(包括新的sysfs或/proc文件)都应该包含该界面的
> 文档,该文档使用户空间开发人员能够知道他们在使用什么。请参阅
> -Documentation/abi/readme,了解如何格式化此文档以及需要提供哪些信息。
> +Documentation/ABI/README,了解如何格式化此文档以及需要提供哪些信息。
>
> 文件 :ref:`Documentation/admin-guide/kernel-parameters.rst
> <kernelparameters>` 描述了内核的所有引导时间参数。任何添加新参数的补丁都应该向该文件添加适当的
> diff --git a/Documentation/x86/x86_64/5level-paging.rst
> b/Documentation/x86/x86_64/5level-paging.rst index
> ab88a4514163..44856417e6a5 100644
> --- a/Documentation/x86/x86_64/5level-paging.rst
> +++ b/Documentation/x86/x86_64/5level-paging.rst
> @@ -20,7 +20,7 @@ physical address space. This "ought to be enough for
> anybody" ©. QEMU 2.9 and later support 5-level paging.
>
> Virtual memory layout for 5-level paging is described in
> -Documentation/x86/x86_64/mm.txt
> +Documentation/x86/x86_64/mm.rst
>
>
> Enabling 5-level paging
> diff --git a/Documentation/x86/x86_64/boot-options.rst
> b/Documentation/x86/x86_64/boot-options.rst index
> 2f69836b8445..6a4285a3c7a4 100644
> --- a/Documentation/x86/x86_64/boot-options.rst
> +++ b/Documentation/x86/x86_64/boot-options.rst
> @@ -9,7 +9,7 @@ only the AMD64 specific ones are listed here.
>
> Machine check
> =============
> -Please see Documentation/x86/x86_64/machinecheck for sysfs runtime
> tunables. +Please see Documentation/x86/x86_64/machinecheck.rst for sysfs
> runtime tunables.
>
> mce=off
> Disable machine check
> @@ -89,7 +89,7 @@ APICs
> Don't use the local APIC (alias for i386 compatibility)
>
> pirq=...
> - See Documentation/x86/i386/IO-APIC.txt
> + See Documentation/x86/i386/IO-APIC.rst
>
> noapictimer
> Don't set up the APIC timer
> diff --git a/Documentation/x86/x86_64/fake-numa-for-cpusets.rst
> b/Documentation/x86/x86_64/fake-numa-for-cpusets.rst index
> 74fbb78b3c67..04df57b9aa3f 100644
> --- a/Documentation/x86/x86_64/fake-numa-for-cpusets.rst
> +++ b/Documentation/x86/x86_64/fake-numa-for-cpusets.rst
> @@ -18,7 +18,7 @@ For more information on the features of cpusets, see
> Documentation/cgroup-v1/cpusets.txt.
> There are a number of different configurations you can use for your needs.
> For more information on the numa=fake command line option and its various
> ways of -configuring fake nodes, see
> Documentation/x86/x86_64/boot-options.txt. +configuring fake nodes, see
> Documentation/x86/x86_64/boot-options.rst.
>
> For the purposes of this introduction, we'll assume a very primitive NUMA
> emulation setup of "numa=fake=4*512,". This will split our system memory
> into diff --git a/MAINTAINERS b/MAINTAINERS
> index 0c84bf76d165..47aa4f6defb9 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -3874,7 +3874,7 @@
> F: Documentation/devicetree/bindings/hwmon/cirrus,lochnagar.txt
> F: Documentation/devicetree/bindings/pinctrl/cirrus,lochnagar.txt
> F: Documentation/devicetree/bindings/regulator/cirrus,lochnagar.txt
> F: Documentation/devicetree/bindings/sound/cirrus,lochnagar.txt
> -F: Documentation/hwmon/lochnagar
> +F: Documentation/hwmon/lochnagar.rst
>
> CISCO FCOE HBA DRIVER
> M: Satish Kharat <satishkh@cisco.com>
> @@ -11272,7 +11272,7 @@ NXP FXAS21002C DRIVER
> M: Rui Miguel Silva <rmfrfs@gmail.com>
> L: linux-iio@vger.kernel.org
> S: Maintained
> -F: Documentation/devicetree/bindings/iio/gyroscope/fxas21002c.txt
> +F: Documentation/devicetree/bindings/iio/gyroscope/nxp,fxas21002c.txt
> F: drivers/iio/gyro/fxas21002c_core.c
> F: drivers/iio/gyro/fxas21002c.h
> F: drivers/iio/gyro/fxas21002c_i2c.c
> @@ -13043,7 +13043,7 @@ M: Niklas Cassel <niklas.cassel@linaro.org>
> L: netdev@vger.kernel.org
> S: Maintained
> F: drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> -F: Documentation/devicetree/bindings/net/qcom,dwmac.txt
> +F: Documentation/devicetree/bindings/net/qcom,ethqos.txt
>
> QUALCOMM GENERIC INTERFACE I2C DRIVER
> M: Alok Chauhan <alokc@codeaurora.org>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 8869742a85df..0f220264cc23 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -1263,7 +1263,7 @@ config SMP
> uniprocessor machines. On a uniprocessor machine, the kernel
> will run faster if you say N here.
>
> - See also <file:Documentation/x86/i386/IO-APIC.txt>,
> + See also <file:Documentation/x86/i386/IO-APIC.rst>,
> <file:Documentation/lockup-watchdogs.txt> and the SMP-HOWTO
available at
> <http://tldp.org/HOWTO/SMP-HOWTO.html>.
>
> diff --git a/arch/arm64/kernel/kexec_image.c
> b/arch/arm64/kernel/kexec_image.c index 07bf740bea91..31cc2f423aa8 100644
> --- a/arch/arm64/kernel/kexec_image.c
> +++ b/arch/arm64/kernel/kexec_image.c
> @@ -53,7 +53,7 @@ static void *image_load(struct kimage *image,
>
> /*
> * We require a kernel with an unambiguous Image header. Per
> - * Documentation/booting.txt, this is the case when image_size
> + * Documentation/arm64/booting.txt, this is the case when
image_size
> * is non-zero (practically speaking, since v3.17).
> */
> h = (struct arm64_image_header *)kernel;
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 8c1c636308c8..e868d2bd48b8 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -898,7 +898,7 @@ config PPC_MEM_KEYS
> page-based protections, but without requiring modification of
the
> page tables when an application changes protection domains.
>
> - For details, see Documentation/vm/protection-keys.rst
> + For details, see Documentation/x86/protection-keys.rst
>
> If unsure, say y.
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 2bbbd4d1ba31..78fdf2dd71d1 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -395,7 +395,7 @@ config SMP
> Y to "Enhanced Real Time Clock Support", below. The "Advanced
Power
> Management" code will be disabled if you say Y here.
>
> - See also <file:Documentation/x86/i386/IO-APIC.txt>,
> + See also <file:Documentation/x86/i386/IO-APIC.rst>,
> <file:Documentation/lockup-watchdogs.txt> and the SMP-HOWTO
available at
> <http://www.tldp.org/docs.html#howto>.
>
> @@ -1290,7 +1290,7 @@ config MICROCODE
> the Linux kernel.
>
> The preferred method to load microcode from a detached initrd is
> described - in Documentation/x86/microcode.txt. For that you
need to
> enable + in Documentation/x86/microcode.rst. For that you need to enable
> CONFIG_BLK_DEV_INITRD in order for the loader to be able to scan the initrd
> for microcode blobs.
>
> @@ -1329,7 +1329,7 @@ config MICROCODE_OLD_INTERFACE
> It is inadequate because it runs too late to be able to properly
> load microcode on a machine and it needs special tools. Instead,
you
> should've switched to the early loading method with the initrd
or
> - builtin microcode by now: Documentation/x86/microcode.txt
> + builtin microcode by now: Documentation/x86/microcode.rst
>
> config X86_MSR
> tristate "/dev/cpu/*/msr - Model-specific register support"
> @@ -1478,7 +1478,7 @@ config X86_5LEVEL
> A kernel with the option enabled can be booted on machines that
> support 4- or 5-level paging.
>
> - See Documentation/x86/x86_64/5level-paging.txt for more
> + See Documentation/x86/x86_64/5level-paging.rst for more
> information.
>
> Say N if unsure.
> @@ -1626,7 +1626,7 @@ config ARCH_MEMORY_PROBE
> depends on X86_64 && MEMORY_HOTPLUG
> help
> This option enables a sysfs memory/probe interface for testing.
> - See Documentation/memory-hotplug.txt for more information.
> + See Documentation/admin-guide/mm/memory-hotplug.rst for more
> information. If you are unsure how to answer this question, answer N.
>
> config ARCH_PROC_KCORE_TEXT
> @@ -1783,7 +1783,7 @@ config MTRR
> You can safely say Y even if your machine doesn't have MTRRs,
you'll
> just add about 9 KB to your kernel.
>
> - See <file:Documentation/x86/mtrr.txt> for more information.
> + See <file:Documentation/x86/mtrr.rst> for more information.
>
> config MTRR_SANITIZER
> def_bool y
> @@ -1895,7 +1895,7 @@ config X86_INTEL_MPX
> process and adds some branches to paths used during
> exec() and munmap().
>
> - For details, see Documentation/x86/intel_mpx.txt
> + For details, see Documentation/x86/intel_mpx.rst
>
> If unsure, say N.
>
> @@ -1911,7 +1911,7 @@ config X86_INTEL_MEMORY_PROTECTION_KEYS
> page-based protections, but without requiring modification of
the
> page tables when an application changes protection domains.
>
> - For details, see Documentation/x86/protection-keys.txt
> + For details, see Documentation/x86/protection-keys.rst
>
> If unsure, say y.
>
> diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
> index f730680dc818..59f598543203 100644
> --- a/arch/x86/Kconfig.debug
> +++ b/arch/x86/Kconfig.debug
> @@ -156,7 +156,7 @@ config IOMMU_DEBUG
> code. When you use it make sure you have a big enough
> IOMMU/AGP aperture. Most of the options enabled by this can
> be set more finegrained using the iommu= command line
> - options. See Documentation/x86/x86_64/boot-options.txt for more
> + options. See Documentation/x86/x86_64/boot-options.rst for more
> details.
>
> config IOMMU_LEAK
> diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
> index 850b8762e889..90d791ca1a95 100644
> --- a/arch/x86/boot/header.S
> +++ b/arch/x86/boot/header.S
> @@ -313,7 +313,7 @@ start_sys_seg: .word SYSSEG
# obsolete and meaningless,
> but just
>
> type_of_loader: .byte 0 # 0 means ancient
bootloader, newer
> # bootloaders know
to change this.
> - # See
Documentation/x86/boot.txt for
> + # See
Documentation/x86/boot.rst for
> # assigned ids
>
> # flags, unused bits must be zero (RFU) bit within loadflags
> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
> index 11aa3b2afa4d..33f9fc38d014 100644
> --- a/arch/x86/entry/entry_64.S
> +++ b/arch/x86/entry/entry_64.S
> @@ -8,7 +8,7 @@
> *
> * entry.S contains the system-call and fault low-level handling routines.
> *
> - * Some of this is documented in Documentation/x86/entry_64.txt
> + * Some of this is documented in Documentation/x86/entry_64.rst
> *
> * A note on terminology:
> * - iret frame: Architecture defined interrupt frame from SS to RIP
> diff --git a/arch/x86/include/asm/bootparam_utils.h
> b/arch/x86/include/asm/bootparam_utils.h index f6f6ef436599..101eb944f13c
> 100644
> --- a/arch/x86/include/asm/bootparam_utils.h
> +++ b/arch/x86/include/asm/bootparam_utils.h
> @@ -24,7 +24,7 @@ static void sanitize_boot_params(struct boot_params
> *boot_params) * IMPORTANT NOTE TO BOOTLOADER AUTHORS: do not simply clear
> * this field. The purpose of this field is to guarantee
> * compliance with the x86 boot spec located in
> - * Documentation/x86/boot.txt . That spec says that the
> + * Documentation/x86/boot.rst . That spec says that the
> * *whole* structure should be cleared, after which only the
> * portion defined by struct setup_header (boot_params->hdr)
> * should be copied in.
> diff --git a/arch/x86/include/asm/page_64_types.h
> b/arch/x86/include/asm/page_64_types.h index 793c14c372cb..288b065955b7
> 100644
> --- a/arch/x86/include/asm/page_64_types.h
> +++ b/arch/x86/include/asm/page_64_types.h
> @@ -48,7 +48,7 @@
>
> #define __START_KERNEL_map _AC(0xffffffff80000000, UL)
>
> -/* See Documentation/x86/x86_64/mm.txt for a description of the memory map.
> */ +/* See Documentation/x86/x86_64/mm.rst for a description of the memory
> map. */
>
> #define __PHYSICAL_MASK_SHIFT 52
>
> diff --git a/arch/x86/include/asm/pgtable_64_types.h
> b/arch/x86/include/asm/pgtable_64_types.h index 88bca456da99..52e5f5f2240d
> 100644
> --- a/arch/x86/include/asm/pgtable_64_types.h
> +++ b/arch/x86/include/asm/pgtable_64_types.h
> @@ -103,7 +103,7 @@ extern unsigned int ptrs_per_p4d;
> #define PGDIR_MASK (~(PGDIR_SIZE - 1))
>
> /*
> - * See Documentation/x86/x86_64/mm.txt for a description of the memory map.
> + * See Documentation/x86/x86_64/mm.rst for a description of the memory
> map. *
> * Be very careful vs. KASLR when changing anything here. The KASLR address
> * range must not overlap with anything except the KASAN shadow area, which
> diff --git a/arch/x86/kernel/cpu/microcode/amd.c
> b/arch/x86/kernel/cpu/microcode/amd.c index e1f3ba19ba54..06d4e67f31ab
> 100644
> --- a/arch/x86/kernel/cpu/microcode/amd.c
> +++ b/arch/x86/kernel/cpu/microcode/amd.c
> @@ -61,7 +61,7 @@ static u8 amd_ucode_patch[PATCH_MAX_SIZE];
>
> /*
> * Microcode patch container file is prepended to the initrd in cpio
> - * format. See Documentation/x86/microcode.txt
> + * format. See Documentation/x86/microcode.rst
> */
> static const char
> ucode_path[] __maybe_unused = "kernel/x86/microcode/AuthenticAMD.bin";
> diff --git a/arch/x86/kernel/kexec-bzimage64.c
> b/arch/x86/kernel/kexec-bzimage64.c index 22f60dd26460..b07e7069b09e 100644
> --- a/arch/x86/kernel/kexec-bzimage64.c
> +++ b/arch/x86/kernel/kexec-bzimage64.c
> @@ -416,7 +416,7 @@ static void *bzImage64_load(struct kimage *image, char
> *kernel, efi_map_offset = params_cmdline_sz;
> efi_setup_data_offset = efi_map_offset + ALIGN(efi_map_sz, 16);
>
> - /* Copy setup header onto bootparams. Documentation/x86/boot.txt
*/
> + /* Copy setup header onto bootparams. Documentation/x86/boot.rst */
> setup_header_size = 0x0202 + kernel[0x0201] - setup_hdr_offset;
>
> /* Is there a limit on setup header size? */
> diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
> index dcd272dbd0a9..f62b498b18fb 100644
> --- a/arch/x86/kernel/pci-dma.c
> +++ b/arch/x86/kernel/pci-dma.c
> @@ -70,7 +70,7 @@ void __init pci_iommu_alloc(void)
> }
>
> /*
> - * See <Documentation/x86/x86_64/boot-options.txt> for the iommu kernel
> + * See <Documentation/x86/x86_64/boot-options.rst> for the iommu kernel
> * parameter documentation.
> */
> static __init int iommu_setup(char *p)
> diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
> index 7f61431c75fb..400c1ba033aa 100644
> --- a/arch/x86/mm/tlb.c
> +++ b/arch/x86/mm/tlb.c
> @@ -711,7 +711,7 @@ void native_flush_tlb_others(const struct cpumask
> *cpumask, }
>
> /*
> - * See Documentation/x86/tlb.txt for details. We choose 33
> + * See Documentation/x86/tlb.rst for details. We choose 33
> * because it is large enough to cover the vast majority (at
> * least 95%) of allocations, and is small enough that we are
> * confident it will not cause too much overhead. Each single
> diff --git a/arch/x86/platform/pvh/enlighten.c
> b/arch/x86/platform/pvh/enlighten.c index 1861a2ba0f2b..c0a502f7e3a7 100644
> --- a/arch/x86/platform/pvh/enlighten.c
> +++ b/arch/x86/platform/pvh/enlighten.c
> @@ -86,7 +86,7 @@ static void __init init_pvh_bootparams(bool xen_guest)
> }
>
> /*
> - * See Documentation/x86/boot.txt.
> + * See Documentation/x86/boot.rst.
> *
> * Version 2.12 supports Xen entry point but we will use default
x86/PC
> * environment (i.e. hardware_subarch 0).
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index 283ee94224c6..2438f37f2ca1 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -333,7 +333,7 @@ config ACPI_CUSTOM_DSDT_FILE
> depends on !STANDALONE
> help
> This option supports a custom DSDT by linking it into the
kernel.
> - See Documentation/acpi/dsdt-override.txt
> + See Documentation/admin-guide/acpi/dsdt-override.rst
>
> Enter the full path name to the file which includes the AmlCode
> or dsdt_aml_code declaration.
> @@ -355,7 +355,7 @@ config ACPI_TABLE_UPGRADE
> This option provides functionality to upgrade arbitrary ACPI
tables
> via initrd. No functional change if no ACPI tables are passed
via
> initrd, therefore it's safe to say Y.
> - See Documentation/acpi/initrd_table_override.txt for details
> + See Documentation/admin-guide/acpi/initrd_table_override.rst for
details
>
> config ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD
> bool "Override ACPI tables from built-in initrd"
> @@ -365,7 +365,7 @@ config ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD
> This option provides functionality to override arbitrary ACPI
tables
> from built-in uncompressed initrd.
>
> - See Documentation/acpi/initrd_table_override.txt for details
> + See Documentation/admin-guide/acpi/initrd_table_override.rst for
details
>
> config ACPI_DEBUG
> bool "Debug Statements"
> @@ -374,7 +374,7 @@ config ACPI_DEBUG
> output and increases the kernel size by around 50K.
>
> Use the acpi.debug_layer and acpi.debug_level kernel command-
line
> - parameters documented in Documentation/acpi/debug.txt and
> + parameters documented in Documentation/firmware-guide/acpi/
debug.rst and
> Documentation/admin-guide/kernel-parameters.rst to control the type and
> amount of debug output.
>
> @@ -445,7 +445,7 @@ config ACPI_CUSTOM_METHOD
> help
> This debug facility allows ACPI AML methods to be inserted and/
or
> replaced without rebooting the system. For details refer to:
> - Documentation/acpi/method-customizing.txt.
> + Documentation/firmware-guide/acpi/method-customizing.rst.
>
> NOTE: This option is security sensitive, because it allows
arbitrary
> kernel memory to be written to by root (uid=0) users, allowing
them
> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c
> b/drivers/net/ethernet/faraday/ftgmac100.c index b17b79e612a3..ac6280ad43a1
> 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.c
> +++ b/drivers/net/ethernet/faraday/ftgmac100.c
> @@ -1075,7 +1075,7 @@ static int ftgmac100_mii_probe(struct ftgmac100 *priv,
> phy_interface_t intf) }
>
> /* Indicate that we support PAUSE frames (see comment in
> - * Documentation/networking/phy.txt)
> + * Documentation/networking/phy.rst)
> */
> phy_support_asym_pause(phydev);
>
> diff --git a/drivers/staging/fieldbus/Documentation/fieldbus_dev.txt
> b/drivers/staging/fieldbus/Documentation/fieldbus_dev.txt index
> 56af3f650fa3..89fb8e14676f 100644
> --- a/drivers/staging/fieldbus/Documentation/fieldbus_dev.txt
> +++ b/drivers/staging/fieldbus/Documentation/fieldbus_dev.txt
> @@ -54,8 +54,8 @@ a limited few common behaviours and properties. This
> allows us to define a simple interface consisting of a character device and
> a set of sysfs files:
>
> See:
> -Documentation/ABI/testing/sysfs-class-fieldbus-dev
> -Documentation/ABI/testing/fieldbus-dev-cdev
> +drivers/staging/fieldbus/Documentation/ABI/sysfs-class-fieldbus-dev
> +drivers/staging/fieldbus/Documentation/ABI/fieldbus-dev-cdev
>
> Note that this simple interface does not provide a way to modify adapter
> configuration settings. It is therefore useful only for adapters that get
> their diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 1e3ed41ae1f3..69938dbae2d0 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -1694,7 +1694,7 @@ EXPORT_SYMBOL_GPL(vhost_dev_ioctl);
>
> /* TODO: This is really inefficient. We need something like get_user()
> * (instruction directly accesses the data, with an exception table entry
> - * returning -EFAULT). See Documentation/x86/exception-tables.txt.
> + * returning -EFAULT). See Documentation/x86/exception-tables.rst.
> */
> static int set_bit_to_user(int nr, void __user *addr)
> {
> diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
> index de1804aeaf69..98e3db7a89cd 100644
> --- a/include/acpi/acpi_drivers.h
> +++ b/include/acpi/acpi_drivers.h
> @@ -25,7 +25,7 @@
> #define ACPI_MAX_STRING 80
>
> /*
> - * Please update drivers/acpi/debug.c and Documentation/acpi/debug.txt
> + * Please update drivers/acpi/debug.c and
> Documentation/firmware-guide/acpi/debug.rst * if you add to this list.
> */
> #define ACPI_BUS_COMPONENT 0x00010000
> diff --git a/include/linux/fs_context.h b/include/linux/fs_context.h
> index 1f966670c8dc..623eb58560b9 100644
> --- a/include/linux/fs_context.h
> +++ b/include/linux/fs_context.h
> @@ -85,7 +85,7 @@ struct fs_parameter {
> * Superblock creation fills in ->root whereas reconfiguration begins with
> this * already set.
> *
> - * See Documentation/filesystems/mounting.txt
> + * See Documentation/filesystems/mount_api.txt
> */
> struct fs_context {
> const struct fs_context_operations *ops;
> diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
> index 47f58cfb6a19..df1318d85f7d 100644
> --- a/include/linux/lsm_hooks.h
> +++ b/include/linux/lsm_hooks.h
> @@ -77,7 +77,7 @@
> * state. This is called immediately after commit_creds().
> *
> * Security hooks for mount using fs_context.
> - * [See also Documentation/filesystems/mounting.txt]
> + * [See also Documentation/filesystems/mount_api.txt]
> *
> * @fs_context_dup:
> * Allocate and attach a security structure to sc->security. This
pointer
> diff --git a/mm/Kconfig b/mm/Kconfig
> index ee8d1f311858..6e5fb81bde4b 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -165,7 +165,7 @@ config MEMORY_HOTPLUG_DEFAULT_ONLINE
> onlining policy (/sys/devices/system/memory/auto_online_blocks)
which
> determines what happens to newly added memory regions. Policy
setting
> can always be changed at runtime.
> - See Documentation/memory-hotplug.txt for more information.
> + See Documentation/admin-guide/mm/memory-hotplug.rst for more
> information.
>
> Say Y here if you want all hot-plugged memory blocks to appear
in
> 'online' state by default.
> diff --git a/security/Kconfig b/security/Kconfig
> index aeac3676dd4d..6d75ed71970c 100644
> --- a/security/Kconfig
> +++ b/security/Kconfig
> @@ -62,7 +62,7 @@ config PAGE_TABLE_ISOLATION
> ensuring that the majority of kernel addresses are not mapped
> into userspace.
>
> - See Documentation/x86/pti.txt for more details.
> + See Documentation/x86/pti.rst for more details.
>
> config SECURITY_INFINIBAND
> bool "Infiniband Security Hooks"
> diff --git a/tools/include/linux/err.h b/tools/include/linux/err.h
> index 2f5a12b88a86..25f2bb3a991d 100644
> --- a/tools/include/linux/err.h
> +++ b/tools/include/linux/err.h
> @@ -20,7 +20,7 @@
> * Userspace note:
> * The same principle works for userspace, because 'error' pointers
> * fall down to the unused hole far from user space, as described
> - * in Documentation/x86/x86_64/mm.txt for x86_64 arch:
> + * in Documentation/x86/x86_64/mm.rst for x86_64 arch:
> *
> * 0000000000000000 - 00007fffffffffff (=47 bits) user space, different per
> mm hole caused by [48:63] sign extension * ffffffffffe00000 -
> ffffffffffffffff (=2 MB) unused hole
> diff --git a/tools/objtool/Documentation/stack-validation.txt
> b/tools/objtool/Documentation/stack-validation.txt index
> 4dd11a554b9b..de094670050b 100644
> --- a/tools/objtool/Documentation/stack-validation.txt
> +++ b/tools/objtool/Documentation/stack-validation.txt
> @@ -21,7 +21,7 @@ instructions). Similarly, it knows how to follow switch
> statements, for which gcc sometimes uses jump tables.
>
> (Objtool also has an 'orc generate' subcommand which generates debuginfo
> -for the ORC unwinder. See Documentation/x86/orc-unwinder.txt in the
> +for the ORC unwinder. See Documentation/x86/orc-unwinder.rst in the
> kernel tree for more details.)
>
>
> @@ -101,7 +101,7 @@ b) ORC (Oops Rewind Capability) unwind table generation
> band. So it doesn't affect runtime performance and it can be
> reliable even when interrupts or exceptions are involved.
>
> - For more details, see Documentation/x86/orc-unwinder.txt.
> + For more details, see Documentation/x86/orc-unwinder.rst.
>
> c) Higher live patching compatibility rate
>
> diff --git a/tools/testing/selftests/x86/protection_keys.c
> b/tools/testing/selftests/x86/protection_keys.c index
> 5d546dcdbc80..798a5ddeee55 100644
> --- a/tools/testing/selftests/x86/protection_keys.c
> +++ b/tools/testing/selftests/x86/protection_keys.c
> @@ -1,6 +1,6 @@
> // SPDX-License-Identifier: GPL-2.0
> /*
> - * Tests x86 Memory Protection Keys (see
> Documentation/x86/protection-keys.txt) + * Tests x86 Memory Protection Keys
> (see Documentation/x86/protection-keys.rst) *
> * There are examples in here of:
> * * how to set protection keys on memory
^ permalink raw reply
* Re: [PATCH 00/10] Fix broken documentation references at v5.2-rc1
From: Federico Vaga @ 2019-05-21 22:54 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Linux Doc Mailing List, Mauro Carvalho Chehab, linux-kernel,
Jonathan Corbet
In-Reply-To: <cover.1558362030.git.mchehab+samsung@kernel.org>
On Monday, May 20, 2019 4:47:29 PM CEST Mauro Carvalho Chehab wrote:
> There are several broken Documentation/* references within the Kernel
> tree. There are some reasons for several of them:
>
> 1. The acpi and x86 documentation files were renamed, but the
> references weren't updated;
> 2. The DT files have been converted to JSON format, causing them
> to be renamed;
> 3. Translated files point to future translation work still pending merge
> or require some action from someone that it is fluent at the
> translated language;
Hi Mauro
I am not sure to get what you mean in terms of actions but I think you are
referring to the "empty" files I added in the Italian translations. I added
those files to avoid broken links; the alternative would have been to not
write those links or to point directly to the main document, but in both
cases it easy to forget to update them later.
I chose to have links to "empty" files so that the document does
not need to be updated later.
If you are not referring to those files than I am not understanding, can you
point to a clear example?
> 4. Some files (specially at DT) weren't accepted yet, but there are already
> references for them (at MAINTAINERS and on other DT files);
> 5. Some files got removed without addressing Documentation, with
> needs them to describe some things.
>
> This series addresses problems 1 and 2, plus other random trivial
> breakages. Problems 3 to 5 depend on either accepting a patch or
> some specific knowledge. So, won't be addressed by this series.
>
> The first 4 patches improve the documentation script to address some
> corner cases I detected while doing this series. The remaining ones are
> documentation fixes, being the last one having just trivial renaming
> stuff all over the Kernel tree.
>
> After this series, only those warnings will be reported on v5.2-rc1:
>
> Removed file without a non-trivial documentation adjustment:
>
> Documentation/cgroup-v1/blkio-controller.txt:
> Documentation/block/cfq-iosched.txt
> Documentation/cgroup-v1/blkio-controller.txt:
> Documentation/block/cfq-iosched.txt
>
> The documentation file uses cfq as an example, but it got removed
> recently. Some parts of doc should be re-written to use another
> scheduler as an example.
>
> Files pending addition (as far as I identified, there were e-mails asking
> their inclusions, but it didn't happen upstream yet):
>
> Documentation/devicetree/bindings/regulator/rohm,bd70528-regulator.txt:
> Documentation/devicetree/bindings/mfd/rohm,bd70528-pmic.txt
> Documentation/driver-api/generic-counter.rst:
> Documentation/ABI/testing/sys-bus-counter-generic-sysfs
> Documentation/driver-api/generic-counter.rst:
> Documentation/ABI/testing/sys-bus-counter MAINTAINERS:
> Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.txt
>
> Translation files with broken stuff:
>
> Documentation/translations/it_IT/process/adding-syscalls.rst:
> Documentation/translations/it_IT/filesystems/sysfs.txt
> Documentation/translations/it_IT/process/coding-style.rst:
> Documentation/translations/it_IT/kbuild/kconfig-language.txt
> Documentation/translations/it_IT/process/magic-number.rst:
> Documentation/process/magic-numbers.rst
> Documentation/translations/zh_CN/basic_profiling.txt:
> Documentation/basic_profiling
> Documentation/translations/zh_CN/basic_profiling.txt:
> Documentation/basic_profiling
> Documentation/translations/zh_CN/process/howto.rst: Documentation/DocBook/
>
> Mauro Carvalho Chehab (10):
> scripts/documentation-file-ref-check: better handle translations
> scripts/documentation-file-ref-check: exclude false-positives
> scripts/documentation-file-ref-check: improve tools ref handling
> scripts/documentation-file-ref-check: teach about .txt -> .yaml
> renames
> ABI: sysfs-devices-system-cpu: point to the right docs
> isdn: mISDN: remove a bogus reference to a non-existing doc
> mfd: madera: point to the right pinctrl binding file
> dt: fix refs that were renamed to json with the same file name
> dt: fix broken references to nand.txt
> docs: fix broken documentation links
>
> .../ABI/testing/sysfs-devices-system-cpu | 3 +-
> Documentation/acpi/dsd/leds.txt | 2 +-
> .../admin-guide/kernel-parameters.rst | 6 +--
> .../admin-guide/kernel-parameters.txt | 16 +++----
> Documentation/admin-guide/ras.rst | 2 +-
> .../devicetree/bindings/arm/omap/crossbar.txt | 2 +-
> .../bindings/clock/samsung,s5pv210-clock.txt | 2 +-
> .../marvell,odmi-controller.txt | 2 +-
> .../bindings/leds/irled/spi-ir-led.txt | 2 +-
> .../bindings/mtd/amlogic,meson-nand.txt | 2 +-
> .../devicetree/bindings/mtd/gpmc-nand.txt | 2 +-
> .../devicetree/bindings/mtd/marvell-nand.txt | 2 +-
> .../devicetree/bindings/mtd/tango-nand.txt | 2 +-
> .../devicetree/bindings/net/fsl-enetc.txt | 7 ++-
> .../bindings/pci/amlogic,meson-pcie.txt | 2 +-
> .../regulator/qcom,rpmh-regulator.txt | 2 +-
> .../devicetree/booting-without-of.txt | 2 +-
> Documentation/driver-api/gpio/board.rst | 2 +-
> Documentation/driver-api/gpio/consumer.rst | 2 +-
> .../firmware-guide/acpi/enumeration.rst | 2 +-
> .../firmware-guide/acpi/method-tracing.rst | 2 +-
> Documentation/i2c/instantiating-devices | 2 +-
> Documentation/sysctl/kernel.txt | 4 +-
> .../translations/it_IT/process/4.Coding.rst | 2 +-
> .../translations/it_IT/process/howto.rst | 2 +-
> .../it_IT/process/stable-kernel-rules.rst | 4 +-
> .../translations/zh_CN/process/4.Coding.rst | 2 +-
> Documentation/x86/x86_64/5level-paging.rst | 2 +-
> Documentation/x86/x86_64/boot-options.rst | 4 +-
> .../x86/x86_64/fake-numa-for-cpusets.rst | 2 +-
> MAINTAINERS | 10 ++---
> arch/arm/Kconfig | 2 +-
> arch/arm64/kernel/kexec_image.c | 2 +-
> arch/powerpc/Kconfig | 2 +-
> arch/x86/Kconfig | 16 +++----
> arch/x86/Kconfig.debug | 2 +-
> arch/x86/boot/header.S | 2 +-
> arch/x86/entry/entry_64.S | 2 +-
> arch/x86/include/asm/bootparam_utils.h | 2 +-
> arch/x86/include/asm/page_64_types.h | 2 +-
> arch/x86/include/asm/pgtable_64_types.h | 2 +-
> arch/x86/kernel/cpu/microcode/amd.c | 2 +-
> arch/x86/kernel/kexec-bzimage64.c | 2 +-
> arch/x86/kernel/pci-dma.c | 2 +-
> arch/x86/mm/tlb.c | 2 +-
> arch/x86/platform/pvh/enlighten.c | 2 +-
> drivers/acpi/Kconfig | 10 ++---
> drivers/isdn/mISDN/dsp_core.c | 2 -
> drivers/net/ethernet/faraday/ftgmac100.c | 2 +-
> .../fieldbus/Documentation/fieldbus_dev.txt | 4 +-
> drivers/vhost/vhost.c | 2 +-
> include/acpi/acpi_drivers.h | 2 +-
> include/linux/fs_context.h | 2 +-
> include/linux/lsm_hooks.h | 2 +-
> include/linux/mfd/madera/pdata.h | 3 +-
> mm/Kconfig | 2 +-
> scripts/documentation-file-ref-check | 44 +++++++++++++++----
> security/Kconfig | 2 +-
> tools/include/linux/err.h | 2 +-
> .../Documentation/stack-validation.txt | 4 +-
> tools/testing/selftests/x86/protection_keys.c | 2 +-
> 61 files changed, 127 insertions(+), 102 deletions(-)
^ permalink raw reply
* [PATCH 2/2] doc: Cope with the deprecation of AutoReporter
From: Jonathan Corbet @ 2019-05-21 21:17 UTC (permalink / raw)
To: linux-doc
Cc: linux-kernel, Jani Nikula, Markus Heiser, Mauro Carvalho Chehab,
Jonathan Corbet
In-Reply-To: <20190521211714.1395-1-corbet@lwn.net>
AutoReporter is going away; recent versions of sphinx emit a warning like:
/stuff/k/git/kernel/Documentation/sphinx/kerneldoc.py:125:
RemovedInSphinx20Warning: AutodocReporter is now deprecated.
Use sphinx.util.docutils.switch_source_input() instead.
Make the switch. But switch_source_input() only showed up in 1.7, so we
have to do ugly version checks to keep things working in older versions.
---
Documentation/sphinx/kerneldoc.py | 38 ++++++++++++++++++++++++-------
1 file changed, 30 insertions(+), 8 deletions(-)
diff --git a/Documentation/sphinx/kerneldoc.py b/Documentation/sphinx/kerneldoc.py
index e8891e63e001..d3216f7b4170 100644
--- a/Documentation/sphinx/kerneldoc.py
+++ b/Documentation/sphinx/kerneldoc.py
@@ -37,7 +37,17 @@ import glob
from docutils import nodes, statemachine
from docutils.statemachine import ViewList
from docutils.parsers.rst import directives, Directive
-from sphinx.ext.autodoc import AutodocReporter
+
+#
+# AutodocReporter is only good up to Sphinx 1.7
+#
+import sphinx
+
+Use_SSI = sphinx.__version__[:3] >= '1.7'
+if Use_SSI:
+ from sphinx.util.docutils import switch_source_input
+else:
+ from sphinx.ext.autodoc import AutodocReporter
import kernellog
@@ -125,13 +135,7 @@ class KernelDocDirective(Directive):
lineoffset += 1
node = nodes.section()
- buf = self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter
- self.state.memo.reporter = AutodocReporter(result, self.state.memo.reporter)
- self.state.memo.title_styles, self.state.memo.section_level = [], 0
- try:
- self.state.nested_parse(result, 0, node, match_titles=1)
- finally:
- self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter = buf
+ self.do_parse(result, node)
return node.children
@@ -140,6 +144,24 @@ class KernelDocDirective(Directive):
(" ".join(cmd), str(e)))
return [nodes.error(None, nodes.paragraph(text = "kernel-doc missing"))]
+ def do_parse(self, result, node):
+ if Use_SSI:
+ save = self.state.memo.title_styles, self.state.memo.section_level
+ try:
+ with switch_source_input(self.state, result):
+ self.state.nested_parse(result, 0, node, match_titles=1)
+ finally:
+ self.state.memo.title_styles, self.state.memo.section_level = save
+ else:
+ save = self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter
+ self.state.memo.reporter = AutodocReporter(result, self.state.memo.reporter)
+ self.state.memo.title_styles, self.state.memo.section_level = [], 0
+ try:
+ self.state.nested_parse(result, 0, node, match_titles=1)
+ finally:
+ self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter = save
+
+
def setup(app):
app.add_config_value('kerneldoc_bin', None, 'env')
app.add_config_value('kerneldoc_srctree', None, 'env')
--
2.21.0
^ permalink raw reply related
* [PATCH 1/2] doc: Cope with Sphinx logging deprecations
From: Jonathan Corbet @ 2019-05-21 21:17 UTC (permalink / raw)
To: linux-doc
Cc: linux-kernel, Jani Nikula, Markus Heiser, Mauro Carvalho Chehab,
Jonathan Corbet
In-Reply-To: <20190521211714.1395-1-corbet@lwn.net>
Recent versions of sphinx will emit messages like:
/stuff/k/git/kernel/Documentation/sphinx/kerneldoc.py:103:
RemovedInSphinx20Warning: app.warning() is now deprecated.
Use sphinx.util.logging instead.
Switch to sphinx.util.logging to make this unsightly message go away.
Alas, that interface was only added in version 1.6, so we have to add a
version check to keep things working with older sphinxes.
---
Documentation/sphinx/kerneldoc.py | 12 ++++++----
Documentation/sphinx/kernellog.py | 28 +++++++++++++++++++++++
Documentation/sphinx/kfigure.py | 38 ++++++++++++++++++-------------
3 files changed, 58 insertions(+), 20 deletions(-)
create mode 100644 Documentation/sphinx/kernellog.py
diff --git a/Documentation/sphinx/kerneldoc.py b/Documentation/sphinx/kerneldoc.py
index 9d0a7f08f93b..e8891e63e001 100644
--- a/Documentation/sphinx/kerneldoc.py
+++ b/Documentation/sphinx/kerneldoc.py
@@ -39,6 +39,8 @@ from docutils.statemachine import ViewList
from docutils.parsers.rst import directives, Directive
from sphinx.ext.autodoc import AutodocReporter
+import kernellog
+
__version__ = '1.0'
class KernelDocDirective(Directive):
@@ -90,7 +92,8 @@ class KernelDocDirective(Directive):
cmd += [filename]
try:
- env.app.verbose('calling kernel-doc \'%s\'' % (" ".join(cmd)))
+ kernellog.verbose(env.app,
+ 'calling kernel-doc \'%s\'' % (" ".join(cmd)))
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
@@ -100,7 +103,8 @@ class KernelDocDirective(Directive):
if p.returncode != 0:
sys.stderr.write(err)
- env.app.warn('kernel-doc \'%s\' failed with return code %d' % (" ".join(cmd), p.returncode))
+ kernellog.warn(env.app,
+ 'kernel-doc \'%s\' failed with return code %d' % (" ".join(cmd), p.returncode))
return [nodes.error(None, nodes.paragraph(text = "kernel-doc missing"))]
elif env.config.kerneldoc_verbosity > 0:
sys.stderr.write(err)
@@ -132,8 +136,8 @@ class KernelDocDirective(Directive):
return node.children
except Exception as e: # pylint: disable=W0703
- env.app.warn('kernel-doc \'%s\' processing failed with: %s' %
- (" ".join(cmd), str(e)))
+ kernellog.warn(app, 'kernel-doc \'%s\' processing failed with: %s' %
+ (" ".join(cmd), str(e)))
return [nodes.error(None, nodes.paragraph(text = "kernel-doc missing"))]
def setup(app):
diff --git a/Documentation/sphinx/kernellog.py b/Documentation/sphinx/kernellog.py
new file mode 100644
index 000000000000..af924f51a7dc
--- /dev/null
+++ b/Documentation/sphinx/kernellog.py
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Sphinx has deprecated its older logging interface, but the replacement
+# only goes back to 1.6. So here's a wrapper layer to keep around for
+# as long as we support 1.4.
+#
+import sphinx
+
+if sphinx.__version__[:3] >= '1.6':
+ UseLogging = True
+ from sphinx.util import logging
+ logger = logging.getLogger('kerneldoc')
+else:
+ UseLogging = False
+
+def warn(app, message):
+ if UseLogging:
+ logger.warning(message)
+ else:
+ app.warn(message)
+
+def verbose(app, message):
+ if UseLogging:
+ logger.verbose(message)
+ else:
+ app.verbose(message)
+
+
diff --git a/Documentation/sphinx/kfigure.py b/Documentation/sphinx/kfigure.py
index b97228d2cc0e..448c450fe70c 100644
--- a/Documentation/sphinx/kfigure.py
+++ b/Documentation/sphinx/kfigure.py
@@ -60,6 +60,8 @@ import sphinx
from sphinx.util.nodes import clean_astext
from six import iteritems
+import kernellog
+
PY3 = sys.version_info[0] == 3
if PY3:
@@ -171,20 +173,20 @@ def setupTools(app):
This function is called once, when the builder is initiated.
"""
global dot_cmd, convert_cmd # pylint: disable=W0603
- app.verbose("kfigure: check installed tools ...")
+ kernellog.verbose(app, "kfigure: check installed tools ...")
dot_cmd = which('dot')
convert_cmd = which('convert')
if dot_cmd:
- app.verbose("use dot(1) from: " + dot_cmd)
+ kernellog.verbose(app, "use dot(1) from: " + dot_cmd)
else:
- app.warn("dot(1) not found, for better output quality install "
- "graphviz from http://www.graphviz.org")
+ kernellog.warn(app, "dot(1) not found, for better output quality install "
+ "graphviz from http://www.graphviz.org")
if convert_cmd:
- app.verbose("use convert(1) from: " + convert_cmd)
+ kernellog.verbose(app, "use convert(1) from: " + convert_cmd)
else:
- app.warn(
+ kernellog.warn(app,
"convert(1) not found, for SVG to PDF conversion install "
"ImageMagick (https://www.imagemagick.org)")
@@ -225,7 +227,8 @@ def convert_image(img_node, translator, src_fname=None):
if in_ext == '.dot':
if not dot_cmd:
- app.verbose("dot from graphviz not available / include DOT raw.")
+ kernellog.verbose(app,
+ "dot from graphviz not available / include DOT raw.")
img_node.replace_self(file2literal(src_fname))
elif translator.builder.format == 'latex':
@@ -252,7 +255,8 @@ def convert_image(img_node, translator, src_fname=None):
if translator.builder.format == 'latex':
if convert_cmd is None:
- app.verbose("no SVG to PDF conversion available / include SVG raw.")
+ kernellog.verbose(app,
+ "no SVG to PDF conversion available / include SVG raw.")
img_node.replace_self(file2literal(src_fname))
else:
dst_fname = path.join(translator.builder.outdir, fname + '.pdf')
@@ -265,18 +269,19 @@ def convert_image(img_node, translator, src_fname=None):
_name = dst_fname[len(translator.builder.outdir) + 1:]
if isNewer(dst_fname, src_fname):
- app.verbose("convert: {out}/%s already exists and is newer" % _name)
+ kernellog.verbose(app,
+ "convert: {out}/%s already exists and is newer" % _name)
else:
ok = False
mkdir(path.dirname(dst_fname))
if in_ext == '.dot':
- app.verbose('convert DOT to: {out}/' + _name)
+ kernellog.verbose(app, 'convert DOT to: {out}/' + _name)
ok = dot2format(app, src_fname, dst_fname)
elif in_ext == '.svg':
- app.verbose('convert SVG to: {out}/' + _name)
+ kernellog.verbose(app, 'convert SVG to: {out}/' + _name)
ok = svg2pdf(app, src_fname, dst_fname)
if not ok:
@@ -305,7 +310,8 @@ def dot2format(app, dot_fname, out_fname):
with open(out_fname, "w") as out:
exit_code = subprocess.call(cmd, stdout = out)
if exit_code != 0:
- app.warn("Error #%d when calling: %s" % (exit_code, " ".join(cmd)))
+ kernellog.warn(app,
+ "Error #%d when calling: %s" % (exit_code, " ".join(cmd)))
return bool(exit_code == 0)
def svg2pdf(app, svg_fname, pdf_fname):
@@ -322,7 +328,7 @@ def svg2pdf(app, svg_fname, pdf_fname):
# use stdout and stderr from parent
exit_code = subprocess.call(cmd)
if exit_code != 0:
- app.warn("Error #%d when calling: %s" % (exit_code, " ".join(cmd)))
+ kernellog.warn(app, "Error #%d when calling: %s" % (exit_code, " ".join(cmd)))
return bool(exit_code == 0)
@@ -415,15 +421,15 @@ def visit_kernel_render(self, node):
app = self.builder.app
srclang = node.get('srclang')
- app.verbose('visit kernel-render node lang: "%s"' % (srclang))
+ kernellog.verbose(app, 'visit kernel-render node lang: "%s"' % (srclang))
tmp_ext = RENDER_MARKUP_EXT.get(srclang, None)
if tmp_ext is None:
- app.warn('kernel-render: "%s" unknown / include raw.' % (srclang))
+ kernellog.warn(app, 'kernel-render: "%s" unknown / include raw.' % (srclang))
return
if not dot_cmd and tmp_ext == '.dot':
- app.verbose("dot from graphviz not available / include raw.")
+ kernellog.verbose(app, "dot from graphviz not available / include raw.")
return
literal_block = node[0]
--
2.21.0
^ permalink raw reply related
* [PATCH RFC 0/2] docs: Deal with some Sphinx deprecation warnings
From: Jonathan Corbet @ 2019-05-21 21:17 UTC (permalink / raw)
To: linux-doc
Cc: linux-kernel, Jani Nikula, Markus Heiser, Mauro Carvalho Chehab,
Jonathan Corbet
The Sphinx folks are deprecating some interfaces in the upcoming 2.0
release; one immediate result of that is a bunch of warnings that show up
when building with 1.8. These two patches make those warnings go away,
but at a cost:
- It introduces a couple of Sphinx version checks, which are always
ugly, but the alternative would be to stop supporting versions
before 1.7. For now, I think we can carry that cruft.
- The second patch causes the build to fail horribly on newer
Sphinx installations. The change to switch_source_input() seems
to make the parser much more finicky, increasing warnings and
eventually failing the build altogether. In particular, it will
scream about problems in .rst files that are not included in the
TOC tree at all. The complaints appear to be legitimate, but it's
a bunch of stuff to clean up.
I've tested these with 1.4 and 1.8, but not various versions in between.
Jonathan Corbet (2):
doc: Cope with Sphinx logging deprecations
doc: Cope with the deprecation of AutoReporter
Documentation/sphinx/kerneldoc.py | 48 ++++++++++++++++++++++++-------
Documentation/sphinx/kernellog.py | 28 ++++++++++++++++++
Documentation/sphinx/kfigure.py | 38 +++++++++++++-----------
3 files changed, 87 insertions(+), 27 deletions(-)
create mode 100644 Documentation/sphinx/kernellog.py
--
2.21.0
^ permalink raw reply
* Re: [PATCH] net-next: net: Fix typos in ip-sysctl.txt
From: David Miller @ 2019-05-21 20:21 UTC (permalink / raw)
To: standby24x7; +Cc: corbet, linux-doc, linux-kernel, netdev
In-Reply-To: <20190521034115.18896-1-standby24x7@gmail.com>
From: Masanari Iida <standby24x7@gmail.com>
Date: Tue, 21 May 2019 12:41:15 +0900
> This patch fixes some spelling typos found in ip-sysctl.txt
>
> Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Documentation typos and fixes are always reasonable for 'net' and
therefore that's where I have applied this.
Thanks.
^ permalink raw reply
* Re: [PATCH] docs: reorder memory-hotplug documentation
From: Oscar Salvador @ 2019-05-21 16:11 UTC (permalink / raw)
To: David Hildenbrand
Cc: Mike Rapoport, Jonathan Corbet, linux-doc, linux-mm, linux-kernel
In-Reply-To: <43092504-a95f-374d-f3db-b961dd8ac428@redhat.com>
On Tue, May 21, 2019 at 12:41:50PM +0200, David Hildenbrand wrote:
> > +Future Work
> > +===========
> > +
> > + - allowing memory hot-add to ZONE_MOVABLE. maybe we need some switch like
> > + sysctl or new control file.
>
> ... that already works if I am not completely missing the point here
It does.
> > + - support HugeTLB page migration and offlining.
>
> ... I remember that Oscar was doing something in that area, Oscar?
Yes, in general offlinining on hugetlb pages was already working, but we did not
allow to offline 1GB-hugetlb pages on x86_64.
I removed that limitation with
("commit: 10eeadf3045c mm,memory_hotplug: unlock 1GB-hugetlb on x86_64") , so now
offlining on hugetlb pages should be fully operative.
> I'd vote for removing the future work part, this is pretty outdated.
Instead of removing it, I would rather make it consistent with the present.
E.g:
- Move page handling from memory-hotremove to offline stage
- Enable a way to allocate vmemmap pages from hot-added memory
etc.
--
Oscar Salvador
SUSE L3
^ permalink raw reply
* [PATCH] Fix comments with paths pointing to renamed or moved files.
From: Lukas Prause @ 2019-05-21 15:54 UTC (permalink / raw)
To: lizefan, tj, hannes, peterz, mingo, will.deacon, rjw, len.brown,
pavel, rostedt
Cc: linux-doc, linux-kernel, cgroups, linux-pm, Lukas Prause,
Lennart Glauer
This patch corrects renamed or moved paths in comments.
Signed-off-by: Lukas Prause <langspielplatte@black-mesa.xyz>
Signed-off-by: Lennart Glauer <mail@lennart-glauer.de>
---
kernel/cgroup/cpuset.c | 2 +-
kernel/locking/mutex-debug.h | 2 +-
kernel/power/power.h | 2 +-
kernel/sched/core.c | 2 +-
kernel/trace/trace.h | 14 +++++++-------
5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 6a1942ed781c..6381622e2f2f 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -329,7 +329,7 @@ static struct cpuset top_cpuset = {
* cpumasks and nodemasks.
*
* Accessing a task's cpuset should be done in accordance with the
- * guidelines for accessing subsystem state in kernel/cgroup.c
+ * guidelines for accessing subsystem state in kernel/cgroup/cgroup.c
*/
static DEFINE_MUTEX(cpuset_mutex);
diff --git a/kernel/locking/mutex-debug.h b/kernel/locking/mutex-debug.h
index 1edd3f45a4ec..0dee0a07cd4c 100644
--- a/kernel/locking/mutex-debug.h
+++ b/kernel/locking/mutex-debug.h
@@ -8,7 +8,7 @@
*
* This file contains mutex debugging related internal declarations,
* prototypes and inline functions, for the CONFIG_DEBUG_MUTEXES case.
- * More details are in kernel/mutex-debug.c.
+ * More details are in kernel/locking/mutex-debug.c.
*/
/*
diff --git a/kernel/power/power.h b/kernel/power/power.h
index 9e58bdc8a562..5de8b0c7f657 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -182,7 +182,7 @@ extern int swsusp_unmark(void);
#endif
struct timeval;
-/* kernel/power/swsusp.c */
+/* kernel/power/hibernate.c */
extern void swsusp_show_speed(ktime_t, ktime_t, unsigned int, char *);
#ifdef CONFIG_SUSPEND
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 102dfcf0a29a..0ce0dc44ffc3 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3334,7 +3334,7 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
* 1. Explicit blocking: mutex, semaphore, waitqueue, etc.
*
* 2. TIF_NEED_RESCHED flag is checked on interrupt and userspace return
- * paths. For example, see arch/x86/entry_64.S.
+ * paths. For example, see arch/x86/entry/entry_64.S.
*
* To drive preemption between tasks, the scheduler sets the flag in timer
* interrupt handler scheduler_tick().
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 1974ce818ddb..0c304d6f5b31 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -1684,7 +1684,7 @@ extern int register_trigger_hist_enable_disable_cmds(void);
* initialization such as incrementing a per-trigger reference
* count, for instance. This is usually implemented by the
* generic utility function @event_trigger_init() (see
- * trace_event_triggers.c).
+ * trace_events_trigger.c).
*
* @free: An optional de-initialization function called for the
* trigger when the trigger is unregistered (via the
@@ -1693,12 +1693,12 @@ extern int register_trigger_hist_enable_disable_cmds(void);
* per-trigger reference count and freeing corresponding trigger
* data, for instance. This is usually implemented by the
* generic utility function @event_trigger_free() (see
- * trace_event_triggers.c).
+ * trace_events_trigger.c).
*
* @print: The callback function invoked to have the trigger print
* itself. This is usually implemented by a wrapper function
* that calls the generic utility function @event_trigger_print()
- * (see trace_event_triggers.c).
+ * (see trace_events_trigger.c).
*/
struct event_trigger_ops {
void (*func)(struct event_trigger_data *data,
@@ -1758,7 +1758,7 @@ struct event_trigger_ops {
* the appropriate trace event. It makes use of the other
* event_command callback functions to orchestrate this, and is
* usually implemented by the generic utility function
- * @event_trigger_callback() (see trace_event_triggers.c).
+ * @event_trigger_callback() (see trace_events_trigger.c).
*
* @reg: Adds the trigger to the list of triggers associated with the
* event, and enables the event trigger itself, after
@@ -1767,13 +1767,13 @@ struct event_trigger_ops {
* make the decision as to whether or not multiple instances of
* the trigger should be allowed. This is usually implemented by
* the generic utility function @register_trigger() (see
- * trace_event_triggers.c).
+ * trace_events_trigger.c).
*
* @unreg: Removes the trigger from the list of triggers associated
* with the event, and disables the event trigger itself, after
* initializing it (via the event_trigger_ops @free() function).
* This is usually implemented by the generic utility function
- * @unregister_trigger() (see trace_event_triggers.c).
+ * @unregister_trigger() (see trace_events_trigger.c).
*
* @unreg_all: An optional function called to remove all the triggers
* from the list of triggers associated with the event. Called
@@ -1783,7 +1783,7 @@ struct event_trigger_ops {
* for the trigger. If no @set_filter() method is set for the
* event command, filters set by the user for the command will be
* ignored. This is usually implemented by the generic utility
- * function @set_trigger_filter() (see trace_event_triggers.c).
+ * function @set_trigger_filter() (see trace_events_trigger.c).
*
* @get_trigger_ops: The callback function invoked to retrieve the
* event_trigger_ops implementation associated with the command.
--
2.17.1
^ permalink raw reply related
* Re: [PATCH] docs: reorder memory-hotplug documentation
From: Mike Rapoport @ 2019-05-21 16:00 UTC (permalink / raw)
To: David Hildenbrand; +Cc: Jonathan Corbet, linux-doc, linux-mm, linux-kernel
In-Reply-To: <43092504-a95f-374d-f3db-b961dd8ac428@redhat.com>
On Tue, May 21, 2019 at 12:41:50PM +0200, David Hildenbrand wrote:
> On 14.05.19 10:23, Mike Rapoport wrote:
> > The "Locking Internals" section of the memory-hotplug documentation is
> > duplicated in admin-guide and core-api. Drop the admin-guide copy as
> > locking internals does not belong there.
> >
> > While on it, move the "Future Work" section to the core-api part.
>
> Looks sane, but the future work part is really outdated, can we remove
> this completely?
>
> >
> > Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> > ---
> > +
> > +Future Work
> > +===========
> > +
> > + - allowing memory hot-add to ZONE_MOVABLE. maybe we need some switch like
> > + sysctl or new control file.
>
> ... that already works if I am not completely missing the point here
>
> > + - showing memory block and physical device relationship.
>
> ... that is available for s390x only AFAIK
>
> > + - test and make it better memory offlining.
>
> ... no big news ;)
>
> > + - support HugeTLB page migration and offlining.
>
> ... I remember that Oscar was doing something in that area, Oscar?
>
> > + - memmap removing at memory offline.
>
> ... no, we don't want this. However, we should properly clean up zone
> information when offlining
>
> > + - physical remove memory.
>
> ... I don't even understand what that means.
>
>
> I'd vote for removing the future work part, this is pretty outdated.
Frankly, I haven't looked at the details, just simply moved the text over.
I don't mind sending another mechanical patch that removes the future work
part.
But it would be far better if somebody who's actively working on memory
hotplug would replace it with a description how this actually works ;-)
> --
>
> Thanks,
>
> David / dhildenb
>
--
Sincerely yours,
Mike.
^ permalink raw reply
* Re: [PATCH 0/2] Enable new kprobe event at boot
From: Masami Hiramatsu @ 2019-05-21 15:39 UTC (permalink / raw)
To: Steven Rostedt
Cc: Ingo Molnar, Naveen N . Rao, Anil S Keshavamurthy,
David S . Miller, linux-kernel, linux-doc
In-Reply-To: <20190521093317.7d698f79@gandalf.local.home>
On Tue, 21 May 2019 09:33:17 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> On Tue, 21 May 2019 16:56:16 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> > Note that 'trace_event=' option enables trace event at very early
> > timing, but the events added by 'kprobe_event=' are enabled right
> > before enabling device drivers at this point. It is enough for
> > tracing device driver initialization etc.
>
> Nice!
>
> I wonder if we can have this called before the trace_event boot is
> analyzed. Then have the kprobe_event work more like the kprobe_events
> file, and not enable the kprobes but only create them. If you want to
> enable them you do a trace_event=kprobes as well.
Yeah, I considered that, but there are several reasons to not to do that.
- trace_event seems enabled very early point than kprobes itself.(but this can
be fixable)
- if user specifies kprobes at boot, he/she wants to enable that point at boot.
- it is redundant to specify kprobe_event= and trace_event=, especially command
line size is very limited.
> Perhaps we could enable kprobes at early init?
It should be possible, I will try to find what blocks it. I guess after we
switch early_text_poke() to text_poke(), we can use kprobes on x86. But
for other archs, I need to investigate more.
> What do you think? Or is there something else in kprobes that prevents
> such an early enabling of it?
As I pointed above, I think we should enable it if user specify it. That's
less typing :). Anyway I'll recheck early kprobe availablity.
Thank you,
--
Masami Hiramatsu <mhiramat@kernel.org>
^ permalink raw reply
* [PATCH v12 01/13] dt-bindings: ingenic: Add DT bindings for TCU clocks
From: Paul Cercueil @ 2019-05-21 14:51 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Ralf Baechle, Paul Burton, James Hogan,
Jonathan Corbet, Daniel Lezcano, Thomas Gleixner,
Michael Turquette, Stephen Boyd, Jason Cooper, Marc Zyngier,
Lee Jones
Cc: Mathieu Malaterre, linux-kernel, devicetree, linux-mips,
linux-doc, linux-clk, od, Paul Cercueil, Rob Herring
In-Reply-To: <20190521145141.9813-1-paul@crapouillou.net>
This header provides clock numbers for the ingenic,tcu
DT binding.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Stephen Boyd <sboyd@kernel.org>
---
Notes:
v2: Use SPDX identifier for the license
v3/v4: No change
v5: s/JZ47*_/TCU_/ and dropped *_CLK_LAST defines
v6-v12: No change
include/dt-bindings/clock/ingenic,tcu.h | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 include/dt-bindings/clock/ingenic,tcu.h
diff --git a/include/dt-bindings/clock/ingenic,tcu.h b/include/dt-bindings/clock/ingenic,tcu.h
new file mode 100644
index 000000000000..d569650a7945
--- /dev/null
+++ b/include/dt-bindings/clock/ingenic,tcu.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * This header provides clock numbers for the ingenic,tcu DT binding.
+ */
+
+#ifndef __DT_BINDINGS_CLOCK_INGENIC_TCU_H__
+#define __DT_BINDINGS_CLOCK_INGENIC_TCU_H__
+
+#define TCU_CLK_TIMER0 0
+#define TCU_CLK_TIMER1 1
+#define TCU_CLK_TIMER2 2
+#define TCU_CLK_TIMER3 3
+#define TCU_CLK_TIMER4 4
+#define TCU_CLK_TIMER5 5
+#define TCU_CLK_TIMER6 6
+#define TCU_CLK_TIMER7 7
+#define TCU_CLK_WDT 8
+#define TCU_CLK_OST 9
+
+#endif /* __DT_BINDINGS_CLOCK_INGENIC_TCU_H__ */
--
2.21.0.593.g511ec345e18
^ permalink raw reply related
* [PATCH v12 04/13] mfd: Add Ingenic TCU driver
From: Paul Cercueil @ 2019-05-21 14:51 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Ralf Baechle, Paul Burton, James Hogan,
Jonathan Corbet, Daniel Lezcano, Thomas Gleixner,
Michael Turquette, Stephen Boyd, Jason Cooper, Marc Zyngier,
Lee Jones
Cc: Mathieu Malaterre, linux-kernel, devicetree, linux-mips,
linux-doc, linux-clk, od, Paul Cercueil
In-Reply-To: <20190521145141.9813-1-paul@crapouillou.net>
This driver will provide a regmap that can be retrieved very early in
the boot process through the API function ingenic_tcu_get_regmap().
Additionally, it will call devm_of_platform_populate() so that all the
children devices will be probed.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
Notes:
v12: New patch
drivers/mfd/Kconfig | 8 +++
drivers/mfd/Makefile | 1 +
drivers/mfd/ingenic-tcu.c | 113 ++++++++++++++++++++++++++++++++
include/linux/mfd/ingenic-tcu.h | 8 +++
4 files changed, 130 insertions(+)
create mode 100644 drivers/mfd/ingenic-tcu.c
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 294d9567cc71..a13544474e05 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -494,6 +494,14 @@ config HTC_I2CPLD
This device provides input and output GPIOs through an I2C
interface to one or more sub-chips.
+config INGENIC_TCU
+ bool "Ingenic Timer/Counter Unit (TCU) support"
+ depends on MIPS || COMPILE_TEST
+ select REGMAP_MMIO
+ help
+ Say yes here to support the Timer/Counter Unit (TCU) IP present
+ in the JZ47xx SoCs from Ingenic.
+
config MFD_INTEL_QUARK_I2C_GPIO
tristate "Intel Quark MFD I2C GPIO"
depends on PCI
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 52b1a90ff515..fb89e131ae98 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -180,6 +180,7 @@ obj-$(CONFIG_AB8500_CORE) += ab8500-core.o ab8500-sysctrl.o
obj-$(CONFIG_MFD_TIMBERDALE) += timberdale.o
obj-$(CONFIG_PMIC_ADP5520) += adp5520.o
obj-$(CONFIG_MFD_KEMPLD) += kempld-core.o
+obj-$(CONFIG_INGENIC_TCU) += ingenic-tcu.o
obj-$(CONFIG_MFD_INTEL_QUARK_I2C_GPIO) += intel_quark_i2c_gpio.o
obj-$(CONFIG_LPC_SCH) += lpc_sch.o
obj-$(CONFIG_LPC_ICH) += lpc_ich.o
diff --git a/drivers/mfd/ingenic-tcu.c b/drivers/mfd/ingenic-tcu.c
new file mode 100644
index 000000000000..6c1d5e4310c1
--- /dev/null
+++ b/drivers/mfd/ingenic-tcu.c
@@ -0,0 +1,113 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * JZ47xx SoCs TCU MFD driver
+ * Copyright (C) 2019 Paul Cercueil <paul@crapouillou.net>
+ */
+
+#include <linux/mfd/ingenic-tcu.h>
+#include <linux/of_address.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+
+struct ingenic_soc_info {
+ unsigned int num_channels;
+};
+
+static struct regmap *tcu_regmap __initdata;
+
+static const struct regmap_config ingenic_tcu_regmap_config = {
+ .reg_bits = 32,
+ .val_bits = 32,
+ .reg_stride = 4,
+ .max_register = TCU_REG_OST_CNTHBUF,
+};
+
+static const struct ingenic_soc_info jz4740_soc_info = {
+ .num_channels = 8,
+};
+
+static const struct ingenic_soc_info jz4725b_soc_info = {
+ .num_channels = 6,
+};
+
+static const struct of_device_id ingenic_tcu_of_match[] = {
+ { .compatible = "ingenic,jz4740-tcu", .data = &jz4740_soc_info, },
+ { .compatible = "ingenic,jz4725b-tcu", .data = &jz4725b_soc_info, },
+ { .compatible = "ingenic,jz4770-tcu", .data = &jz4740_soc_info, },
+ { }
+};
+
+static struct regmap * __init ingenic_tcu_create_regmap(struct device_node *np)
+{
+ struct resource res;
+ void __iomem *base;
+ struct regmap *map;
+
+ if (!of_match_node(ingenic_tcu_of_match, np))
+ return ERR_PTR(-EINVAL);
+
+ base = of_io_request_and_map(np, 0, "TCU");
+ if (IS_ERR(base))
+ return ERR_PTR(PTR_ERR(base));
+
+ map = regmap_init_mmio(NULL, base, &ingenic_tcu_regmap_config);
+ if (IS_ERR(map))
+ goto err_iounmap;
+
+ return map;
+
+err_iounmap:
+ iounmap(base);
+ of_address_to_resource(np, 0, &res);
+ release_mem_region(res.start, resource_size(&res));
+
+ return map;
+}
+
+static int __init ingenic_tcu_probe(struct platform_device *pdev)
+{
+ struct regmap *map = ingenic_tcu_get_regmap(pdev->dev.of_node);
+
+ platform_set_drvdata(pdev, map);
+
+ regmap_attach_dev(&pdev->dev, map, &ingenic_tcu_regmap_config);
+
+ return devm_of_platform_populate(&pdev->dev);
+}
+
+static struct platform_driver ingenic_tcu_driver = {
+ .driver = {
+ .name = "ingenic-tcu",
+ .of_match_table = ingenic_tcu_of_match,
+ },
+};
+
+static int __init ingenic_tcu_platform_init(void)
+{
+ return platform_driver_probe(&ingenic_tcu_driver,
+ ingenic_tcu_probe);
+}
+subsys_initcall(ingenic_tcu_platform_init);
+
+struct regmap * __init ingenic_tcu_get_regmap(struct device_node *np)
+{
+ if (!tcu_regmap)
+ tcu_regmap = ingenic_tcu_create_regmap(np);
+
+ return tcu_regmap;
+}
+
+bool ingenic_tcu_pwm_can_use_chn(struct device *dev, unsigned int channel)
+{
+ const struct ingenic_soc_info *soc = device_get_match_data(dev->parent);
+
+ /* Enable all TCU channels for PWM use by default except channels 0/1 */
+ u32 pwm_channels_mask = GENMASK(soc->num_channels - 1, 2);
+
+ device_property_read_u32(dev->parent, "ingenic,pwm-channels-mask",
+ &pwm_channels_mask);
+
+ return !!(pwm_channels_mask & BIT(channel));
+}
+EXPORT_SYMBOL_GPL(ingenic_tcu_pwm_can_use_chn);
diff --git a/include/linux/mfd/ingenic-tcu.h b/include/linux/mfd/ingenic-tcu.h
index 2083fa20821d..21df23916cd2 100644
--- a/include/linux/mfd/ingenic-tcu.h
+++ b/include/linux/mfd/ingenic-tcu.h
@@ -6,6 +6,11 @@
#define __LINUX_MFD_INGENIC_TCU_H_
#include <linux/bitops.h>
+#include <linux/init.h>
+
+struct device;
+struct device_node;
+struct regmap;
#define TCU_REG_WDT_TDR 0x00
#define TCU_REG_WDT_TCER 0x04
@@ -53,4 +58,7 @@
#define TCU_REG_TCNTc(c) (TCU_REG_TCNT0 + ((c) * TCU_CHANNEL_STRIDE))
#define TCU_REG_TCSRc(c) (TCU_REG_TCSR0 + ((c) * TCU_CHANNEL_STRIDE))
+struct regmap * __init ingenic_tcu_get_regmap(struct device_node *np);
+bool ingenic_tcu_pwm_can_use_chn(struct device *dev, unsigned int channel);
+
#endif /* __LINUX_MFD_INGENIC_TCU_H_ */
--
2.21.0.593.g511ec345e18
^ permalink raw reply related
* [PATCH v12 03/13] dt-bindings: Add doc for the Ingenic TCU drivers
From: Paul Cercueil @ 2019-05-21 14:51 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Ralf Baechle, Paul Burton, James Hogan,
Jonathan Corbet, Daniel Lezcano, Thomas Gleixner,
Michael Turquette, Stephen Boyd, Jason Cooper, Marc Zyngier,
Lee Jones
Cc: Mathieu Malaterre, linux-kernel, devicetree, linux-mips,
linux-doc, linux-clk, od, Paul Cercueil
In-Reply-To: <20190521145141.9813-1-paul@crapouillou.net>
Add documentation about how to properly use the Ingenic TCU
(Timer/Counter Unit) drivers from devicetree.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
Notes:
v4: New patch in this series. Corresponds to V2 patches 3-4-5 with
added content.
v5: - Edited PWM/watchdog DT bindings documentation to point to the new
document.
- Moved main document to
Documentation/devicetree/bindings/timer/ingenic,tcu.txt
- Updated documentation to reflect the new devicetree bindings.
v6: - Removed PWM/watchdog documentation files as asked by upstream
- Removed doc about properties that should be implicit
- Removed doc about ingenic,timer-channel /
ingenic,clocksource-channel as they are gone
- Fix WDT clock name in the binding doc
- Fix lengths of register areas in watchdog/pwm nodes
v7: No change
v8: - Fix address of the PWM node
- Added doc about system timer and clocksource children nodes
v9: - Remove doc about system timer and clocksource children
nodes...
- Add doc about ingenic,pwm-channels-mask property
v10: No change
v11: Fix info about default value of ingenic,pwm-channels-mask
v12: Drop sub-nodes for now; they will be introduced in a follow-up
patchset.
.../devicetree/bindings/timer/ingenic,tcu.txt | 59 +++++++++++++++++++
1 file changed, 59 insertions(+)
create mode 100644 Documentation/devicetree/bindings/timer/ingenic,tcu.txt
diff --git a/Documentation/devicetree/bindings/timer/ingenic,tcu.txt b/Documentation/devicetree/bindings/timer/ingenic,tcu.txt
new file mode 100644
index 000000000000..d101cd72c9b0
--- /dev/null
+++ b/Documentation/devicetree/bindings/timer/ingenic,tcu.txt
@@ -0,0 +1,59 @@
+Ingenic JZ47xx SoCs Timer/Counter Unit devicetree bindings
+==========================================================
+
+For a description of the TCU hardware and drivers, have a look at
+Documentation/mips/ingenic-tcu.txt.
+
+Required properties:
+
+- compatible: Must be one of:
+ * "ingenic,jz4740-tcu"
+ * "ingenic,jz4725b-tcu"
+ * "ingenic,jz4770-tcu"
+- reg: Should be the offset/length value corresponding to the TCU registers
+- clocks: List of phandle & clock specifiers for clocks external to the TCU.
+ The "pclk", "rtc" and "ext" clocks should be provided. The "tcu" clock
+ should be provided if the SoC has it.
+- clock-names: List of name strings for the external clocks.
+- #clock-cells: Should be <1>;
+ Clock consumers specify this argument to identify a clock. The valid values
+ may be found in <dt-bindings/clock/ingenic,tcu.h>.
+- interrupt-controller : Identifies the node as an interrupt controller
+- #interrupt-cells : Specifies the number of cells needed to encode an
+ interrupt source. The value should be 1.
+- interrupt-parent : phandle of the interrupt controller.
+- interrupts : Specifies the interrupt the controller is connected to.
+
+Optional properties:
+
+- ingenic,pwm-channels-mask: Bitmask of TCU channels reserved for PWM use.
+ Default value is 0xfc.
+
+
+Example
+==========================================================
+
+#include <dt-bindings/clock/jz4770-cgu.h>
+
+/ {
+ tcu: timer@10002000 {
+ compatible = "ingenic,jz4770-tcu";
+ reg = <0x10002000 0x1000>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges = <0x0 0x10002000 0x1000>;
+
+ #clock-cells = <1>;
+
+ clocks = <&cgu JZ4770_CLK_RTC
+ &cgu JZ4770_CLK_EXT
+ &cgu JZ4770_CLK_PCLK>;
+ clock-names = "rtc", "ext", "pclk";
+
+ interrupt-controller;
+ #interrupt-cells = <1>;
+
+ interrupt-parent = <&intc>;
+ interrupts = <27 26 25>;
+ };
+};
--
2.21.0.593.g511ec345e18
^ permalink raw reply related
* [PATCH v12 05/13] clk: ingenic: Add driver for the TCU clocks
From: Paul Cercueil @ 2019-05-21 14:51 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Ralf Baechle, Paul Burton, James Hogan,
Jonathan Corbet, Daniel Lezcano, Thomas Gleixner,
Michael Turquette, Stephen Boyd, Jason Cooper, Marc Zyngier,
Lee Jones
Cc: Mathieu Malaterre, linux-kernel, devicetree, linux-mips,
linux-doc, linux-clk, od, Paul Cercueil
In-Reply-To: <20190521145141.9813-1-paul@crapouillou.net>
Add driver to support the clocks provided by the Timer/Counter Unit
(TCU) of the JZ47xx SoCs from Ingenic.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
Notes:
v12: New patch
drivers/clk/ingenic/Kconfig | 11 +-
drivers/clk/ingenic/Makefile | 1 +
drivers/clk/ingenic/tcu.c | 458 +++++++++++++++++++++++++++++++++++
3 files changed, 469 insertions(+), 1 deletion(-)
create mode 100644 drivers/clk/ingenic/tcu.c
diff --git a/drivers/clk/ingenic/Kconfig b/drivers/clk/ingenic/Kconfig
index 34dc0da79c39..434893133eb4 100644
--- a/drivers/clk/ingenic/Kconfig
+++ b/drivers/clk/ingenic/Kconfig
@@ -1,4 +1,4 @@
-menu "Ingenic JZ47xx CGU drivers"
+menu "Ingenic JZ47xx drivers"
depends on MIPS
config INGENIC_CGU_COMMON
@@ -44,4 +44,13 @@ config INGENIC_CGU_JZ4780
If building for a JZ4780 SoC, you want to say Y here.
+config INGENIC_TCU_CLK
+ bool "Ingenic JZ47xx TCU clocks driver"
+ default MACH_INGENIC
+ depends on COMMON_CLK
+ select INGENIC_TCU
+ help
+ Support the clocks of the Timer/Counter Unit (TCU) of the Ingenic
+ JZ47xx SoCs.
+
endmenu
diff --git a/drivers/clk/ingenic/Makefile b/drivers/clk/ingenic/Makefile
index 00a79b2fba10..9ef8551926b7 100644
--- a/drivers/clk/ingenic/Makefile
+++ b/drivers/clk/ingenic/Makefile
@@ -3,3 +3,4 @@ obj-$(CONFIG_INGENIC_CGU_JZ4740) += jz4740-cgu.o
obj-$(CONFIG_INGENIC_CGU_JZ4725B) += jz4725b-cgu.o
obj-$(CONFIG_INGENIC_CGU_JZ4770) += jz4770-cgu.o
obj-$(CONFIG_INGENIC_CGU_JZ4780) += jz4780-cgu.o
+obj-$(CONFIG_INGENIC_TCU_CLK) += tcu.o
diff --git a/drivers/clk/ingenic/tcu.c b/drivers/clk/ingenic/tcu.c
new file mode 100644
index 000000000000..7249225a6994
--- /dev/null
+++ b/drivers/clk/ingenic/tcu.c
@@ -0,0 +1,458 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * JZ47xx SoCs TCU clocks driver
+ * Copyright (C) 2019 Paul Cercueil <paul@crapouillou.net>
+ */
+
+#include <linux/clk.h>
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/clockchips.h>
+#include <linux/mfd/ingenic-tcu.h>
+#include <linux/regmap.h>
+
+#include <dt-bindings/clock/ingenic,tcu.h>
+
+/* 8 channels max + watchdog + OST */
+#define TCU_CLK_COUNT 10
+
+#define TCU_ERR(...) pr_crit("ingenic-tcu-clk: " __VA_ARGS__)
+
+enum tcu_clk_parent {
+ TCU_PARENT_PCLK,
+ TCU_PARENT_RTC,
+ TCU_PARENT_EXT,
+};
+
+struct ingenic_soc_info {
+ unsigned int num_channels;
+ bool has_ost;
+ bool has_tcu_clk;
+};
+
+struct ingenic_tcu_clk_info {
+ struct clk_init_data init_data;
+ u8 gate_bit;
+ u8 tcsr_reg;
+};
+
+struct ingenic_tcu_clk {
+ struct clk_hw hw;
+ unsigned int idx;
+ struct ingenic_tcu *tcu;
+ const struct ingenic_tcu_clk_info *info;
+};
+
+struct ingenic_tcu {
+ const struct ingenic_soc_info *soc_info;
+ struct regmap *map;
+ struct clk *clk;
+
+ struct clk_hw_onecell_data *clocks;
+};
+
+static inline struct ingenic_tcu_clk *to_tcu_clk(struct clk_hw *hw)
+{
+ return container_of(hw, struct ingenic_tcu_clk, hw);
+}
+
+static int ingenic_tcu_enable(struct clk_hw *hw)
+{
+ struct ingenic_tcu_clk *tcu_clk = to_tcu_clk(hw);
+ const struct ingenic_tcu_clk_info *info = tcu_clk->info;
+ struct ingenic_tcu *tcu = tcu_clk->tcu;
+ int ret;
+
+ if (tcu->clk) {
+ ret = clk_prepare_enable(tcu->clk);
+ if (ret)
+ return ret;
+ }
+
+ regmap_write(tcu->map, TCU_REG_TSCR, BIT(info->gate_bit));
+
+ return 0;
+}
+
+static void ingenic_tcu_disable(struct clk_hw *hw)
+{
+ struct ingenic_tcu_clk *tcu_clk = to_tcu_clk(hw);
+ const struct ingenic_tcu_clk_info *info = tcu_clk->info;
+ struct ingenic_tcu *tcu = tcu_clk->tcu;
+
+ regmap_write(tcu->map, TCU_REG_TSSR, BIT(info->gate_bit));
+
+ if (tcu->clk)
+ clk_disable_unprepare(tcu->clk);
+}
+
+static int ingenic_tcu_is_enabled(struct clk_hw *hw)
+{
+ struct ingenic_tcu_clk *tcu_clk = to_tcu_clk(hw);
+ const struct ingenic_tcu_clk_info *info = tcu_clk->info;
+ unsigned int value;
+
+ regmap_read(tcu_clk->tcu->map, TCU_REG_TSR, &value);
+
+ return !(value & BIT(info->gate_bit));
+}
+
+static bool ingenic_tcu_enable_regs(struct clk_hw *hw)
+{
+ struct ingenic_tcu_clk *tcu_clk = to_tcu_clk(hw);
+ const struct ingenic_tcu_clk_info *info = tcu_clk->info;
+ struct ingenic_tcu *tcu = tcu_clk->tcu;
+ bool enabled = false;
+
+ /*
+ * If the SoC has no global TCU clock, we must ungate the channel's
+ * clock to be able to access its registers.
+ * If we have a TCU clock, it will be enabled automatically as it has
+ * been attached to the regmap.
+ */
+ if (!tcu->clk) {
+ enabled = !!ingenic_tcu_is_enabled(hw);
+ regmap_write(tcu->map, TCU_REG_TSCR, BIT(info->gate_bit));
+ }
+
+ return enabled;
+}
+
+static void ingenic_tcu_disable_regs(struct clk_hw *hw)
+{
+ struct ingenic_tcu_clk *tcu_clk = to_tcu_clk(hw);
+ const struct ingenic_tcu_clk_info *info = tcu_clk->info;
+ struct ingenic_tcu *tcu = tcu_clk->tcu;
+
+ if (!tcu->clk)
+ regmap_write(tcu->map, TCU_REG_TSSR, BIT(info->gate_bit));
+}
+
+static u8 ingenic_tcu_get_parent(struct clk_hw *hw)
+{
+ struct ingenic_tcu_clk *tcu_clk = to_tcu_clk(hw);
+ const struct ingenic_tcu_clk_info *info = tcu_clk->info;
+ unsigned int val = 0;
+ int ret;
+
+ ret = regmap_read(tcu_clk->tcu->map, info->tcsr_reg, &val);
+ WARN_ONCE(ret < 0, "Unable to read TCSR %i", tcu_clk->idx);
+
+ return ffs(val & TCU_TCSR_PARENT_CLOCK_MASK) - 1;
+}
+
+static int ingenic_tcu_set_parent(struct clk_hw *hw, u8 idx)
+{
+ struct ingenic_tcu_clk *tcu_clk = to_tcu_clk(hw);
+ const struct ingenic_tcu_clk_info *info = tcu_clk->info;
+ bool was_enabled;
+ int ret;
+
+ was_enabled = ingenic_tcu_enable_regs(hw);
+
+ ret = regmap_update_bits(tcu_clk->tcu->map, info->tcsr_reg,
+ TCU_TCSR_PARENT_CLOCK_MASK, BIT(idx));
+ WARN_ONCE(ret < 0, "Unable to update TCSR %i", tcu_clk->idx);
+
+ if (!was_enabled)
+ ingenic_tcu_disable_regs(hw);
+
+ return 0;
+}
+
+static unsigned long ingenic_tcu_recalc_rate(struct clk_hw *hw,
+ unsigned long parent_rate)
+{
+ struct ingenic_tcu_clk *tcu_clk = to_tcu_clk(hw);
+ const struct ingenic_tcu_clk_info *info = tcu_clk->info;
+ unsigned int prescale;
+ int ret;
+
+ ret = regmap_read(tcu_clk->tcu->map, info->tcsr_reg, &prescale);
+ WARN_ONCE(ret < 0, "Unable to read TCSR %i", tcu_clk->idx);
+
+ prescale = (prescale & TCU_TCSR_PRESCALE_MASK) >> TCU_TCSR_PRESCALE_LSB;
+
+ return parent_rate >> (prescale * 2);
+}
+
+static u8 ingenic_tcu_get_prescale(unsigned long rate, unsigned long req_rate)
+{
+ u8 prescale;
+
+ for (prescale = 0; prescale < 5; prescale++)
+ if ((rate >> (prescale * 2)) <= req_rate)
+ return prescale;
+
+ return 5; /* /1024 divider */
+}
+
+static long ingenic_tcu_round_rate(struct clk_hw *hw, unsigned long req_rate,
+ unsigned long *parent_rate)
+{
+ unsigned long rate = *parent_rate;
+ u8 prescale;
+
+ if (req_rate > rate)
+ return -EINVAL;
+
+ prescale = ingenic_tcu_get_prescale(rate, req_rate);
+
+ return rate >> (prescale * 2);
+}
+
+static int ingenic_tcu_set_rate(struct clk_hw *hw, unsigned long req_rate,
+ unsigned long parent_rate)
+{
+ struct ingenic_tcu_clk *tcu_clk = to_tcu_clk(hw);
+ const struct ingenic_tcu_clk_info *info = tcu_clk->info;
+ u8 prescale = ingenic_tcu_get_prescale(parent_rate, req_rate);
+ bool was_enabled;
+ int ret;
+
+ was_enabled = ingenic_tcu_enable_regs(hw);
+
+ ret = regmap_update_bits(tcu_clk->tcu->map, info->tcsr_reg,
+ TCU_TCSR_PRESCALE_MASK,
+ prescale << TCU_TCSR_PRESCALE_LSB);
+ WARN_ONCE(ret < 0, "Unable to update TCSR %i", tcu_clk->idx);
+
+ if (!was_enabled)
+ ingenic_tcu_disable_regs(hw);
+
+ return 0;
+}
+
+static const struct clk_ops ingenic_tcu_clk_ops = {
+ .get_parent = ingenic_tcu_get_parent,
+ .set_parent = ingenic_tcu_set_parent,
+
+ .recalc_rate = ingenic_tcu_recalc_rate,
+ .round_rate = ingenic_tcu_round_rate,
+ .set_rate = ingenic_tcu_set_rate,
+
+ .enable = ingenic_tcu_enable,
+ .disable = ingenic_tcu_disable,
+ .is_enabled = ingenic_tcu_is_enabled,
+};
+
+static const char * const ingenic_tcu_timer_parents[] = {
+ [TCU_PARENT_PCLK] = "pclk",
+ [TCU_PARENT_RTC] = "rtc",
+ [TCU_PARENT_EXT] = "ext",
+};
+
+#define DEF_TIMER(_name, _gate_bit, _tcsr) \
+ { \
+ .init_data = { \
+ .name = _name, \
+ .parent_names = ingenic_tcu_timer_parents, \
+ .num_parents = ARRAY_SIZE(ingenic_tcu_timer_parents),\
+ .ops = &ingenic_tcu_clk_ops, \
+ .flags = CLK_SET_RATE_UNGATE, \
+ }, \
+ .gate_bit = _gate_bit, \
+ .tcsr_reg = _tcsr, \
+ }
+static const struct ingenic_tcu_clk_info ingenic_tcu_clk_info[] = {
+ [TCU_CLK_TIMER0] = DEF_TIMER("timer0", 0, TCU_REG_TCSRc(0)),
+ [TCU_CLK_TIMER1] = DEF_TIMER("timer1", 1, TCU_REG_TCSRc(1)),
+ [TCU_CLK_TIMER2] = DEF_TIMER("timer2", 2, TCU_REG_TCSRc(2)),
+ [TCU_CLK_TIMER3] = DEF_TIMER("timer3", 3, TCU_REG_TCSRc(3)),
+ [TCU_CLK_TIMER4] = DEF_TIMER("timer4", 4, TCU_REG_TCSRc(4)),
+ [TCU_CLK_TIMER5] = DEF_TIMER("timer5", 5, TCU_REG_TCSRc(5)),
+ [TCU_CLK_TIMER6] = DEF_TIMER("timer6", 6, TCU_REG_TCSRc(6)),
+ [TCU_CLK_TIMER7] = DEF_TIMER("timer7", 7, TCU_REG_TCSRc(7)),
+};
+
+static const struct ingenic_tcu_clk_info ingenic_tcu_watchdog_clk_info =
+ DEF_TIMER("wdt", 16, TCU_REG_WDT_TCSR);
+static const struct ingenic_tcu_clk_info ingenic_tcu_ost_clk_info =
+ DEF_TIMER("ost", 15, TCU_REG_OST_TCSR);
+#undef DEF_TIMER
+
+static int __init ingenic_tcu_register_clock(struct ingenic_tcu *tcu,
+ unsigned int idx, enum tcu_clk_parent parent,
+ const struct ingenic_tcu_clk_info *info,
+ struct clk_hw_onecell_data *clocks)
+{
+ struct ingenic_tcu_clk *tcu_clk;
+ int err;
+
+ tcu_clk = kzalloc(sizeof(*tcu_clk), GFP_KERNEL);
+ if (!tcu_clk)
+ return -ENOMEM;
+
+ tcu_clk->hw.init = &info->init_data;
+ tcu_clk->idx = idx;
+ tcu_clk->info = info;
+ tcu_clk->tcu = tcu;
+
+ /* Reset channel and clock divider, set default parent */
+ ingenic_tcu_enable_regs(&tcu_clk->hw);
+ regmap_update_bits(tcu->map, info->tcsr_reg, 0xffff, BIT(parent));
+ ingenic_tcu_disable_regs(&tcu_clk->hw);
+
+ err = clk_hw_register(NULL, &tcu_clk->hw);
+ if (err)
+ goto err_free_tcu_clk;
+
+ err = clk_hw_register_clkdev(&tcu_clk->hw, info->init_data.name, NULL);
+ if (err)
+ goto err_clk_unregister;
+
+ clocks->hws[idx] = &tcu_clk->hw;
+
+ return 0;
+
+err_clk_unregister:
+ clk_hw_unregister(&tcu_clk->hw);
+err_free_tcu_clk:
+ kfree(tcu_clk);
+ return err;
+}
+
+static const struct ingenic_soc_info jz4740_soc_info = {
+ .num_channels = 8,
+ .has_ost = false,
+ .has_tcu_clk = true,
+};
+
+static const struct ingenic_soc_info jz4725b_soc_info = {
+ .num_channels = 6,
+ .has_ost = true,
+ .has_tcu_clk = true,
+};
+
+static const struct ingenic_soc_info jz4770_soc_info = {
+ .num_channels = 8,
+ .has_ost = true,
+ .has_tcu_clk = false,
+};
+
+static const struct of_device_id ingenic_tcu_of_match[] __initconst = {
+ { .compatible = "ingenic,jz4740-tcu", .data = &jz4740_soc_info, },
+ { .compatible = "ingenic,jz4725b-tcu", .data = &jz4725b_soc_info, },
+ { .compatible = "ingenic,jz4770-tcu", .data = &jz4770_soc_info, },
+ { }
+};
+
+static int __init ingenic_tcu_probe(struct device_node *np)
+{
+ const struct of_device_id *id = of_match_node(ingenic_tcu_of_match, np);
+ struct ingenic_tcu *tcu;
+ struct regmap *map;
+ unsigned int i;
+ int ret;
+
+ map = ingenic_tcu_get_regmap(np);
+ if (IS_ERR(map))
+ return PTR_ERR(map);
+
+ tcu = kzalloc(sizeof(*tcu), GFP_KERNEL);
+ if (!tcu)
+ return -ENOMEM;
+
+ tcu->map = map;
+ tcu->soc_info = id->data;
+
+ if (tcu->soc_info->has_tcu_clk) {
+ tcu->clk = of_clk_get_by_name(np, "tcu");
+ if (IS_ERR(tcu->clk)) {
+ ret = PTR_ERR(tcu->clk);
+ TCU_ERR("Cannot get TCU clock\n");
+ goto err_free_tcu;
+ }
+
+ ret = regmap_mmio_attach_clk(map, tcu->clk);
+ if (ret) {
+ TCU_ERR("Unable to attach TCU clock\n");
+ goto err_put_clk;
+ }
+ }
+
+ tcu->clocks = kzalloc(sizeof(*tcu->clocks) +
+ sizeof(*tcu->clocks->hws) * TCU_CLK_COUNT,
+ GFP_KERNEL);
+ if (!tcu->clocks) {
+ ret = -ENOMEM;
+ goto err_clk_detach;
+ }
+
+ tcu->clocks->num = TCU_CLK_COUNT;
+
+ for (i = 0; i < tcu->soc_info->num_channels; i++) {
+ ret = ingenic_tcu_register_clock(tcu, i, TCU_PARENT_EXT,
+ &ingenic_tcu_clk_info[i],
+ tcu->clocks);
+ if (ret) {
+ TCU_ERR("cannot register clock %i\n", i);
+ goto err_unregister_timer_clocks;
+ }
+ }
+
+ /* We set EXT as the default parent clock for all the TCU clocks
+ * except for the watchdog one, where we set the RTC clock as the
+ * parent. Since the EXT and PCLK are much faster than the RTC clock,
+ * the watchdog would kick after a maximum time of 5s, and we might
+ * want a slower kicking time.
+ */
+ ret = ingenic_tcu_register_clock(tcu, TCU_CLK_WDT, TCU_PARENT_RTC,
+ &ingenic_tcu_watchdog_clk_info,
+ tcu->clocks);
+ if (ret) {
+ TCU_ERR("cannot register watchdog clock\n");
+ goto err_unregister_timer_clocks;
+ }
+
+ if (tcu->soc_info->has_ost) {
+ ret = ingenic_tcu_register_clock(tcu, TCU_CLK_OST,
+ TCU_PARENT_EXT,
+ &ingenic_tcu_ost_clk_info,
+ tcu->clocks);
+ if (ret) {
+ TCU_ERR("cannot register ost clock\n");
+ goto err_unregister_watchdog_clock;
+ }
+ }
+
+ ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, tcu->clocks);
+ if (ret) {
+ TCU_ERR("cannot add OF clock provider\n");
+ goto err_unregister_ost_clock;
+ }
+
+ return 0;
+
+err_unregister_ost_clock:
+ if (tcu->soc_info->has_ost)
+ clk_hw_unregister(tcu->clocks->hws[i + 1]);
+err_unregister_watchdog_clock:
+ clk_hw_unregister(tcu->clocks->hws[i]);
+err_unregister_timer_clocks:
+ for (i = 0; i < tcu->clocks->num; i++)
+ if (tcu->clocks->hws[i])
+ clk_hw_unregister(tcu->clocks->hws[i]);
+ kfree(tcu->clocks);
+err_clk_detach:
+ if (tcu->soc_info->has_tcu_clk)
+ regmap_mmio_detach_clk(map);
+err_put_clk:
+ if (tcu->soc_info->has_tcu_clk)
+ clk_put(tcu->clk);
+err_free_tcu:
+ kfree(tcu);
+ return ret;
+}
+
+static void __init ingenic_tcu_init(struct device_node *np)
+{
+ int ret = ingenic_tcu_probe(np);
+
+ if (ret)
+ TCU_ERR("Failed to initialize TCU clocks: %i\n", ret);
+}
+
+CLK_OF_DECLARE(jz4740_cgu, "ingenic,jz4740-tcu", ingenic_tcu_init);
+CLK_OF_DECLARE(jz4725b_cgu, "ingenic,jz4725b-tcu", ingenic_tcu_init);
+CLK_OF_DECLARE(jz4770_cgu, "ingenic,jz4770-tcu", ingenic_tcu_init);
--
2.21.0.593.g511ec345e18
^ permalink raw reply related
* [PATCH v12 06/13] irqchip: Add irq-ingenic-tcu driver
From: Paul Cercueil @ 2019-05-21 14:51 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Ralf Baechle, Paul Burton, James Hogan,
Jonathan Corbet, Daniel Lezcano, Thomas Gleixner,
Michael Turquette, Stephen Boyd, Jason Cooper, Marc Zyngier,
Lee Jones
Cc: Mathieu Malaterre, linux-kernel, devicetree, linux-mips,
linux-doc, linux-clk, od, Paul Cercueil
In-Reply-To: <20190521145141.9813-1-paul@crapouillou.net>
This driver handles the interrupt controller built in the Timer/Counter
Unit (TCU) of the JZ47xx SoCs from Ingenic.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
drivers/irqchip/Kconfig | 11 ++
drivers/irqchip/Makefile | 1 +
drivers/irqchip/irq-ingenic-tcu.c | 182 ++++++++++++++++++++++++++++++
3 files changed, 194 insertions(+)
create mode 100644 drivers/irqchip/irq-ingenic-tcu.c
diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 1c1f3f66dfd3..2d0700e52db7 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -293,6 +293,17 @@ config INGENIC_IRQ
depends on MACH_INGENIC
default y
+config INGENIC_TCU_IRQ
+ bool "Ingenic JZ47xx TCU interrupt controller"
+ default MACH_INGENIC
+ depends on MIPS || COMPILE_TEST
+ select INGENIC_TCU
+ help
+ Support for interrupts in the Timer/Counter Unit (TCU) of the Ingenic
+ JZ47xx SoCs.
+
+ If unsure, say N.
+
config RENESAS_H8300H_INTC
bool
select IRQ_DOMAIN
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index 606a003a0000..f403b2c221e4 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -73,6 +73,7 @@ obj-$(CONFIG_RENESAS_H8300H_INTC) += irq-renesas-h8300h.o
obj-$(CONFIG_RENESAS_H8S_INTC) += irq-renesas-h8s.o
obj-$(CONFIG_ARCH_SA1100) += irq-sa11x0.o
obj-$(CONFIG_INGENIC_IRQ) += irq-ingenic.o
+obj-$(CONFIG_INGENIC_TCU_IRQ) += irq-ingenic-tcu.o
obj-$(CONFIG_IMX_GPCV2) += irq-imx-gpcv2.o
obj-$(CONFIG_PIC32_EVIC) += irq-pic32-evic.o
obj-$(CONFIG_MSCC_OCELOT_IRQ) += irq-mscc-ocelot.o
diff --git a/drivers/irqchip/irq-ingenic-tcu.c b/drivers/irqchip/irq-ingenic-tcu.c
new file mode 100644
index 000000000000..738ed06c983f
--- /dev/null
+++ b/drivers/irqchip/irq-ingenic-tcu.c
@@ -0,0 +1,182 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * JZ47xx SoCs TCU IRQ driver
+ * Copyright (C) 2019 Paul Cercueil <paul@crapouillou.net>
+ */
+
+#include <linux/clk.h>
+#include <linux/interrupt.h>
+#include <linux/irqchip.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/mfd/ingenic-tcu.h>
+#include <linux/of_irq.h>
+#include <linux/regmap.h>
+
+struct ingenic_tcu {
+ struct regmap *map;
+ struct clk *clk;
+
+ struct irq_domain *domain;
+ unsigned int nb_parent_irqs;
+ u32 parent_irqs[3];
+};
+
+static void ingenic_tcu_intc_cascade(struct irq_desc *desc)
+{
+ struct irq_chip *irq_chip = irq_data_get_irq_chip(&desc->irq_data);
+ struct irq_domain *domain = irq_desc_get_handler_data(desc);
+ struct irq_chip_generic *gc = irq_get_domain_generic_chip(domain, 0);
+ struct regmap *map = gc->private;
+ uint32_t irq_reg, irq_mask;
+ unsigned int i;
+
+ regmap_read(map, TCU_REG_TFR, &irq_reg);
+ regmap_read(map, TCU_REG_TMR, &irq_mask);
+
+ chained_irq_enter(irq_chip, desc);
+
+ irq_reg &= ~irq_mask;
+
+ for_each_set_bit(i, (unsigned long *)&irq_reg, 32)
+ generic_handle_irq(irq_linear_revmap(domain, i));
+
+ chained_irq_exit(irq_chip, desc);
+}
+
+static void ingenic_tcu_gc_unmask_enable_reg(struct irq_data *d)
+{
+ struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+ struct irq_chip_type *ct = irq_data_get_chip_type(d);
+ struct regmap *map = gc->private;
+ u32 mask = d->mask;
+
+ irq_gc_lock(gc);
+ regmap_write(map, ct->regs.ack, mask);
+ regmap_write(map, ct->regs.enable, mask);
+ *ct->mask_cache |= mask;
+ irq_gc_unlock(gc);
+}
+
+static void ingenic_tcu_gc_mask_disable_reg(struct irq_data *d)
+{
+ struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+ struct irq_chip_type *ct = irq_data_get_chip_type(d);
+ struct regmap *map = gc->private;
+ u32 mask = d->mask;
+
+ irq_gc_lock(gc);
+ regmap_write(map, ct->regs.disable, mask);
+ *ct->mask_cache &= ~mask;
+ irq_gc_unlock(gc);
+}
+
+static void ingenic_tcu_gc_mask_disable_reg_and_ack(struct irq_data *d)
+{
+ struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+ struct irq_chip_type *ct = irq_data_get_chip_type(d);
+ struct regmap *map = gc->private;
+ u32 mask = d->mask;
+
+ irq_gc_lock(gc);
+ regmap_write(map, ct->regs.ack, mask);
+ regmap_write(map, ct->regs.disable, mask);
+ irq_gc_unlock(gc);
+}
+
+static int __init ingenic_tcu_irq_init(struct device_node *np,
+ struct device_node *parent)
+{
+ struct irq_chip_generic *gc;
+ struct irq_chip_type *ct;
+ struct ingenic_tcu *tcu;
+ struct regmap *map;
+ unsigned int i;
+ int ret, irqs;
+
+ map = ingenic_tcu_get_regmap(np);
+ if (IS_ERR(map))
+ return PTR_ERR(map);
+
+ tcu = kzalloc(sizeof(*tcu), GFP_KERNEL);
+ if (!tcu)
+ return -ENOMEM;
+
+ tcu->map = map;
+
+ irqs = of_property_count_elems_of_size(np, "interrupts", sizeof(u32));
+ if (irqs < 0 || irqs > ARRAY_SIZE(tcu->parent_irqs)) {
+ pr_crit("%s: Invalid 'interrupts' property\n", __func__);
+ ret = -EINVAL;
+ goto err_free_tcu;
+ }
+
+ tcu->nb_parent_irqs = irqs;
+
+ tcu->domain = irq_domain_add_linear(np, 32, &irq_generic_chip_ops,
+ NULL);
+ if (!tcu->domain) {
+ ret = -ENOMEM;
+ goto err_free_tcu;
+ }
+
+ ret = irq_alloc_domain_generic_chips(tcu->domain, 32, 1, "TCU",
+ handle_level_irq, 0,
+ IRQ_NOPROBE | IRQ_LEVEL, 0);
+ if (ret) {
+ pr_crit("%s: Invalid 'interrupts' property\n", __func__);
+ goto out_domain_remove;
+ }
+
+ gc = irq_get_domain_generic_chip(tcu->domain, 0);
+ ct = gc->chip_types;
+
+ gc->wake_enabled = IRQ_MSK(32);
+ gc->private = tcu->map;
+
+ ct->regs.disable = TCU_REG_TMSR;
+ ct->regs.enable = TCU_REG_TMCR;
+ ct->regs.ack = TCU_REG_TFCR;
+ ct->chip.irq_unmask = ingenic_tcu_gc_unmask_enable_reg;
+ ct->chip.irq_mask = ingenic_tcu_gc_mask_disable_reg;
+ ct->chip.irq_mask_ack = ingenic_tcu_gc_mask_disable_reg_and_ack;
+ ct->chip.flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_SKIP_SET_WAKE;
+
+ /* Mask all IRQs by default */
+ regmap_write(tcu->map, TCU_REG_TMSR, IRQ_MSK(32));
+
+ /*
+ * On JZ4740, timer 0 and timer 1 have their own interrupt line;
+ * timers 2-7 share one interrupt.
+ * On SoCs >= JZ4770, timer 5 has its own interrupt line;
+ * timers 0-4 and 6-7 share one single interrupt.
+ *
+ * To keep things simple, we just register the same handler to
+ * all parent interrupts. The handler will properly detect which
+ * channel fired the interrupt.
+ */
+ for (i = 0; i < irqs; i++) {
+ tcu->parent_irqs[i] = irq_of_parse_and_map(np, i);
+ if (!tcu->parent_irqs[i]) {
+ ret = -EINVAL;
+ goto out_unmap_irqs;
+ }
+
+ irq_set_chained_handler_and_data(tcu->parent_irqs[i],
+ ingenic_tcu_intc_cascade,
+ tcu->domain);
+ }
+
+ return 0;
+
+out_unmap_irqs:
+ for (; i > 0; i--)
+ irq_dispose_mapping(tcu->parent_irqs[i - 1]);
+out_domain_remove:
+ irq_domain_remove(tcu->domain);
+err_free_tcu:
+ kfree(tcu);
+ return ret;
+}
+IRQCHIP_DECLARE(jz4740_tcu_irq, "ingenic,jz4740-tcu", ingenic_tcu_irq_init);
+IRQCHIP_DECLARE(jz4725b_tcu_irq, "ingenic,jz4725b-tcu", ingenic_tcu_irq_init);
+IRQCHIP_DECLARE(jz4770_tcu_irq, "ingenic,jz4770-tcu", ingenic_tcu_irq_init);
--
2.21.0.593.g511ec345e18
^ permalink raw reply related
* [PATCH v12 08/13] clk: jz4740: Add TCU clock
From: Paul Cercueil @ 2019-05-21 14:51 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Ralf Baechle, Paul Burton, James Hogan,
Jonathan Corbet, Daniel Lezcano, Thomas Gleixner,
Michael Turquette, Stephen Boyd, Jason Cooper, Marc Zyngier,
Lee Jones
Cc: Mathieu Malaterre, linux-kernel, devicetree, linux-mips,
linux-doc, linux-clk, od, Paul Cercueil, Rob Herring
In-Reply-To: <20190521145141.9813-1-paul@crapouillou.net>
Add the missing TCU clock to the list of clocks supplied by the CGU for
the JZ4740 SoC.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Acked-by: Rob Herring <robh@kernel.org>
---
Notes:
v5: New patch
v6-v12: No change
drivers/clk/ingenic/jz4740-cgu.c | 6 ++++++
include/dt-bindings/clock/jz4740-cgu.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/drivers/clk/ingenic/jz4740-cgu.c b/drivers/clk/ingenic/jz4740-cgu.c
index 25f7df028e67..fbc7319c2861 100644
--- a/drivers/clk/ingenic/jz4740-cgu.c
+++ b/drivers/clk/ingenic/jz4740-cgu.c
@@ -212,6 +212,12 @@ static const struct ingenic_cgu_clk_info jz4740_cgu_clocks[] = {
.parents = { JZ4740_CLK_EXT, -1, -1, -1 },
.gate = { CGU_REG_CLKGR, 5 },
},
+
+ [JZ4740_CLK_TCU] = {
+ "tcu", CGU_CLK_GATE,
+ .parents = { JZ4740_CLK_EXT, -1, -1, -1 },
+ .gate = { CGU_REG_CLKGR, 1 },
+ },
};
static void __init jz4740_cgu_init(struct device_node *np)
diff --git a/include/dt-bindings/clock/jz4740-cgu.h b/include/dt-bindings/clock/jz4740-cgu.h
index 6ed83f926ae7..e82d77028581 100644
--- a/include/dt-bindings/clock/jz4740-cgu.h
+++ b/include/dt-bindings/clock/jz4740-cgu.h
@@ -34,5 +34,6 @@
#define JZ4740_CLK_ADC 19
#define JZ4740_CLK_I2C 20
#define JZ4740_CLK_AIC 21
+#define JZ4740_CLK_TCU 22
#endif /* __DT_BINDINGS_CLOCK_JZ4740_CGU_H__ */
--
2.21.0.593.g511ec345e18
^ permalink raw reply related
* [PATCH v12 11/13] MIPS: CI20: Reduce system timer and clocksource to 3 MHz
From: Paul Cercueil @ 2019-05-21 14:51 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Ralf Baechle, Paul Burton, James Hogan,
Jonathan Corbet, Daniel Lezcano, Thomas Gleixner,
Michael Turquette, Stephen Boyd, Jason Cooper, Marc Zyngier,
Lee Jones
Cc: Mathieu Malaterre, linux-kernel, devicetree, linux-mips,
linux-doc, linux-clk, od, Paul Cercueil
In-Reply-To: <20190521145141.9813-1-paul@crapouillou.net>
The default clock (48 MHz) is too fast for the system timer.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
Notes:
v5: New patch
v6: Set also the rate for the clocksource channel's clock
v7: No change
v8: No change
v9: Don't configure clock timer1, as the OS Timer is used as
clocksource on this SoC
v10: Revert back to v8 bahaviour. Let the user choose what
clocksource should be used.
v11-v12: No change
arch/mips/boot/dts/ingenic/ci20.dts | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/mips/boot/dts/ingenic/ci20.dts b/arch/mips/boot/dts/ingenic/ci20.dts
index 4f7b1fa31cf5..2e9952311ecd 100644
--- a/arch/mips/boot/dts/ingenic/ci20.dts
+++ b/arch/mips/boot/dts/ingenic/ci20.dts
@@ -2,6 +2,7 @@
/dts-v1/;
#include "jz4780.dtsi"
+#include <dt-bindings/clock/ingenic,tcu.h>
#include <dt-bindings/gpio/gpio.h>
/ {
@@ -238,3 +239,9 @@
bias-disable;
};
};
+
+&tcu {
+ /* 3 MHz for the system timer and clocksource */
+ assigned-clocks = <&tcu TCU_CLK_TIMER0>, <&tcu TCU_CLK_TIMER1>;
+ assigned-clock-rates = <3000000>, <3000000>;
+};
--
2.21.0.593.g511ec345e18
^ permalink raw reply related
* [PATCH v12 13/13] MIPS: jz4740: Drop obsolete code
From: Paul Cercueil @ 2019-05-21 14:51 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Ralf Baechle, Paul Burton, James Hogan,
Jonathan Corbet, Daniel Lezcano, Thomas Gleixner,
Michael Turquette, Stephen Boyd, Jason Cooper, Marc Zyngier,
Lee Jones
Cc: Mathieu Malaterre, linux-kernel, devicetree, linux-mips,
linux-doc, linux-clk, od, Paul Cercueil
In-Reply-To: <20190521145141.9813-1-paul@crapouillou.net>
The old clocksource/timer platform code is now obsoleted by the newly
introduced TCU drivers.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
Notes:
v5: New patch
v6-v11: No change
v12: Only remove clocksource code. The rest will eventually be
removed in a future patchset when the PWM/watchdog drivers
are updated.
arch/mips/jz4740/time.c | 154 +---------------------------------------
1 file changed, 2 insertions(+), 152 deletions(-)
diff --git a/arch/mips/jz4740/time.c b/arch/mips/jz4740/time.c
index 2ca9160f642a..9a61bca8e9f0 100644
--- a/arch/mips/jz4740/time.c
+++ b/arch/mips/jz4740/time.c
@@ -13,164 +13,14 @@
*
*/
-#include <linux/clk.h>
#include <linux/clk-provider.h>
-#include <linux/interrupt.h>
-#include <linux/kernel.h>
-#include <linux/time.h>
+#include <linux/clocksource.h>
-#include <linux/clockchips.h>
-#include <linux/sched_clock.h>
-
-#include <asm/mach-jz4740/clock.h>
-#include <asm/mach-jz4740/irq.h>
#include <asm/mach-jz4740/timer.h>
-#include <asm/time.h>
-
-#include "clock.h"
-
-#define TIMER_CLOCKEVENT 0
-#define TIMER_CLOCKSOURCE 1
-
-static uint16_t jz4740_jiffies_per_tick;
-
-static u64 jz4740_clocksource_read(struct clocksource *cs)
-{
- return jz4740_timer_get_count(TIMER_CLOCKSOURCE);
-}
-
-static struct clocksource jz4740_clocksource = {
- .name = "jz4740-timer",
- .rating = 200,
- .read = jz4740_clocksource_read,
- .mask = CLOCKSOURCE_MASK(16),
- .flags = CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
-static u64 notrace jz4740_read_sched_clock(void)
-{
- return jz4740_timer_get_count(TIMER_CLOCKSOURCE);
-}
-
-static irqreturn_t jz4740_clockevent_irq(int irq, void *devid)
-{
- struct clock_event_device *cd = devid;
-
- jz4740_timer_ack_full(TIMER_CLOCKEVENT);
-
- if (!clockevent_state_periodic(cd))
- jz4740_timer_disable(TIMER_CLOCKEVENT);
-
- cd->event_handler(cd);
-
- return IRQ_HANDLED;
-}
-
-static int jz4740_clockevent_set_periodic(struct clock_event_device *evt)
-{
- jz4740_timer_set_count(TIMER_CLOCKEVENT, 0);
- jz4740_timer_set_period(TIMER_CLOCKEVENT, jz4740_jiffies_per_tick);
- jz4740_timer_irq_full_enable(TIMER_CLOCKEVENT);
- jz4740_timer_enable(TIMER_CLOCKEVENT);
-
- return 0;
-}
-
-static int jz4740_clockevent_resume(struct clock_event_device *evt)
-{
- jz4740_timer_irq_full_enable(TIMER_CLOCKEVENT);
- jz4740_timer_enable(TIMER_CLOCKEVENT);
-
- return 0;
-}
-
-static int jz4740_clockevent_shutdown(struct clock_event_device *evt)
-{
- jz4740_timer_disable(TIMER_CLOCKEVENT);
-
- return 0;
-}
-
-static int jz4740_clockevent_set_next(unsigned long evt,
- struct clock_event_device *cd)
-{
- jz4740_timer_set_count(TIMER_CLOCKEVENT, 0);
- jz4740_timer_set_period(TIMER_CLOCKEVENT, evt);
- jz4740_timer_enable(TIMER_CLOCKEVENT);
-
- return 0;
-}
-
-static struct clock_event_device jz4740_clockevent = {
- .name = "jz4740-timer",
- .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
- .set_next_event = jz4740_clockevent_set_next,
- .set_state_shutdown = jz4740_clockevent_shutdown,
- .set_state_periodic = jz4740_clockevent_set_periodic,
- .set_state_oneshot = jz4740_clockevent_shutdown,
- .tick_resume = jz4740_clockevent_resume,
- .rating = 200,
-#ifdef CONFIG_MACH_JZ4740
- .irq = JZ4740_IRQ_TCU0,
-#endif
-#if defined(CONFIG_MACH_JZ4770) || defined(CONFIG_MACH_JZ4780)
- .irq = JZ4780_IRQ_TCU2,
-#endif
-};
-
-static struct irqaction timer_irqaction = {
- .handler = jz4740_clockevent_irq,
- .flags = IRQF_PERCPU | IRQF_TIMER,
- .name = "jz4740-timerirq",
- .dev_id = &jz4740_clockevent,
-};
void __init plat_time_init(void)
{
- int ret;
- uint32_t clk_rate;
- uint16_t ctrl;
- struct clk *ext_clk;
-
of_clk_init(NULL);
jz4740_timer_init();
-
- ext_clk = clk_get(NULL, "ext");
- if (IS_ERR(ext_clk))
- panic("unable to get ext clock");
- clk_rate = clk_get_rate(ext_clk) >> 4;
- clk_put(ext_clk);
-
- jz4740_jiffies_per_tick = DIV_ROUND_CLOSEST(clk_rate, HZ);
-
- clockevent_set_clock(&jz4740_clockevent, clk_rate);
- jz4740_clockevent.min_delta_ns = clockevent_delta2ns(100, &jz4740_clockevent);
- jz4740_clockevent.min_delta_ticks = 100;
- jz4740_clockevent.max_delta_ns = clockevent_delta2ns(0xffff, &jz4740_clockevent);
- jz4740_clockevent.max_delta_ticks = 0xffff;
- jz4740_clockevent.cpumask = cpumask_of(0);
-
- clockevents_register_device(&jz4740_clockevent);
-
- ret = clocksource_register_hz(&jz4740_clocksource, clk_rate);
-
- if (ret)
- printk(KERN_ERR "Failed to register clocksource: %d\n", ret);
-
- sched_clock_register(jz4740_read_sched_clock, 16, clk_rate);
-
- setup_irq(jz4740_clockevent.irq, &timer_irqaction);
-
- ctrl = JZ_TIMER_CTRL_PRESCALE_16 | JZ_TIMER_CTRL_SRC_EXT;
-
- jz4740_timer_set_ctrl(TIMER_CLOCKEVENT, ctrl);
- jz4740_timer_set_ctrl(TIMER_CLOCKSOURCE, ctrl);
-
- jz4740_timer_set_period(TIMER_CLOCKEVENT, jz4740_jiffies_per_tick);
- jz4740_timer_irq_full_enable(TIMER_CLOCKEVENT);
-
- jz4740_timer_set_period(TIMER_CLOCKSOURCE, 0xffff);
-
- jz4740_timer_enable(TIMER_CLOCKEVENT);
- jz4740_timer_enable(TIMER_CLOCKSOURCE);
+ timer_probe();
}
--
2.21.0.593.g511ec345e18
^ permalink raw reply related
* [PATCH v12 09/13] MIPS: jz4740: Add DTS nodes for the TCU drivers
From: Paul Cercueil @ 2019-05-21 14:51 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Ralf Baechle, Paul Burton, James Hogan,
Jonathan Corbet, Daniel Lezcano, Thomas Gleixner,
Michael Turquette, Stephen Boyd, Jason Cooper, Marc Zyngier,
Lee Jones
Cc: Mathieu Malaterre, linux-kernel, devicetree, linux-mips,
linux-doc, linux-clk, od, Paul Cercueil
In-Reply-To: <20190521145141.9813-1-paul@crapouillou.net>
Add DTS nodes for the JZ4780, JZ4770 and JZ4740 devicetree files.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
Notes:
v5: New patch
v6: Fix register lengths in watchdog/pwm nodes
v7: No change
v8: - Fix wrong start address for PWM node
- Add system timer and clocksource sub-nodes
v9: Drop timer and clocksource sub-nodes
v10-v11: No change
v12: Drop PWM/watchdog/OST sub-nodes, for now.
arch/mips/boot/dts/ingenic/jz4740.dtsi | 22 ++++++++++++++++++++++
arch/mips/boot/dts/ingenic/jz4770.dtsi | 21 +++++++++++++++++++++
arch/mips/boot/dts/ingenic/jz4780.dtsi | 21 +++++++++++++++++++++
3 files changed, 64 insertions(+)
diff --git a/arch/mips/boot/dts/ingenic/jz4740.dtsi b/arch/mips/boot/dts/ingenic/jz4740.dtsi
index 2beb78a62b7d..807d9702d4cf 100644
--- a/arch/mips/boot/dts/ingenic/jz4740.dtsi
+++ b/arch/mips/boot/dts/ingenic/jz4740.dtsi
@@ -53,6 +53,28 @@
clock-names = "rtc";
};
+ tcu: timer@10002000 {
+ compatible = "ingenic,jz4740-tcu";
+ reg = <0x10002000 0x1000>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges = <0x0 0x10002000 0x1000>;
+
+ #clock-cells = <1>;
+
+ clocks = <&cgu JZ4740_CLK_RTC
+ &cgu JZ4740_CLK_EXT
+ &cgu JZ4740_CLK_PCLK
+ &cgu JZ4740_CLK_TCU>;
+ clock-names = "rtc", "ext", "pclk", "tcu";
+
+ interrupt-controller;
+ #interrupt-cells = <1>;
+
+ interrupt-parent = <&intc>;
+ interrupts = <23 22 21>;
+ };
+
rtc_dev: rtc@10003000 {
compatible = "ingenic,jz4740-rtc";
reg = <0x10003000 0x40>;
diff --git a/arch/mips/boot/dts/ingenic/jz4770.dtsi b/arch/mips/boot/dts/ingenic/jz4770.dtsi
index 49ede6c14ff3..70932fd90902 100644
--- a/arch/mips/boot/dts/ingenic/jz4770.dtsi
+++ b/arch/mips/boot/dts/ingenic/jz4770.dtsi
@@ -46,6 +46,27 @@
#clock-cells = <1>;
};
+ tcu: timer@10002000 {
+ compatible = "ingenic,jz4770-tcu";
+ reg = <0x10002000 0x1000>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges = <0x0 0x10002000 0x1000>;
+
+ #clock-cells = <1>;
+
+ clocks = <&cgu JZ4770_CLK_RTC
+ &cgu JZ4770_CLK_EXT
+ &cgu JZ4770_CLK_PCLK>;
+ clock-names = "rtc", "ext", "pclk";
+
+ interrupt-controller;
+ #interrupt-cells = <1>;
+
+ interrupt-parent = <&intc>;
+ interrupts = <27 26 25>;
+ };
+
pinctrl: pin-controller@10010000 {
compatible = "ingenic,jz4770-pinctrl";
reg = <0x10010000 0x600>;
diff --git a/arch/mips/boot/dts/ingenic/jz4780.dtsi b/arch/mips/boot/dts/ingenic/jz4780.dtsi
index b03cdec56de9..495082ce7fc5 100644
--- a/arch/mips/boot/dts/ingenic/jz4780.dtsi
+++ b/arch/mips/boot/dts/ingenic/jz4780.dtsi
@@ -46,6 +46,27 @@
#clock-cells = <1>;
};
+ tcu: timer@10002000 {
+ compatible = "ingenic,jz4770-tcu";
+ reg = <0x10002000 0x1000>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges = <0x0 0x10002000 0x1000>;
+
+ #clock-cells = <1>;
+
+ clocks = <&cgu JZ4780_CLK_RTCLK
+ &cgu JZ4780_CLK_EXCLK
+ &cgu JZ4780_CLK_PCLK>;
+ clock-names = "rtc", "ext", "pclk";
+
+ interrupt-controller;
+ #interrupt-cells = <1>;
+
+ interrupt-parent = <&intc>;
+ interrupts = <27 26 25>;
+ };
+
rtc_dev: rtc@10003000 {
compatible = "ingenic,jz4780-rtc";
reg = <0x10003000 0x4c>;
--
2.21.0.593.g511ec345e18
^ permalink raw reply related
* [PATCH v12 12/13] MIPS: GCW0: Reduce system timer and clocksource to 750 kHz
From: Paul Cercueil @ 2019-05-21 14:51 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Ralf Baechle, Paul Burton, James Hogan,
Jonathan Corbet, Daniel Lezcano, Thomas Gleixner,
Michael Turquette, Stephen Boyd, Jason Cooper, Marc Zyngier,
Lee Jones
Cc: Mathieu Malaterre, linux-kernel, devicetree, linux-mips,
linux-doc, linux-clk, od, Paul Cercueil
In-Reply-To: <20190521145141.9813-1-paul@crapouillou.net>
The default clock (12 MHz) is too fast for the system timer.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
Notes:
v8: New patch
v9: Don't configure clock timer1, as the OS Timer is used as
clocksource on this SoC
v10: Revert back to v8 bahaviour. Let the user choose what
clocksource should be used.
v11: No change
v12: Move clocksource to channel 2, as channel 1 is used as PWM
for the backlight.
arch/mips/boot/dts/ingenic/gcw0.dts | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/mips/boot/dts/ingenic/gcw0.dts b/arch/mips/boot/dts/ingenic/gcw0.dts
index 35f0291e8d38..f58d239c2058 100644
--- a/arch/mips/boot/dts/ingenic/gcw0.dts
+++ b/arch/mips/boot/dts/ingenic/gcw0.dts
@@ -2,6 +2,7 @@
/dts-v1/;
#include "jz4770.dtsi"
+#include <dt-bindings/clock/ingenic,tcu.h>
/ {
compatible = "gcw,zero", "ingenic,jz4770";
@@ -60,3 +61,12 @@
/* The WiFi module is connected to the UHC. */
status = "okay";
};
+
+&tcu {
+ /* 750 kHz for the system timer and clocksource */
+ assigned-clocks = <&tcu TCU_CLK_TIMER0>, <&tcu TCU_CLK_TIMER2>;
+ assigned-clock-rates = <750000>, <750000>;
+
+ /* PWM1 is in use, so reserve channel #2 for the clocksource */
+ ingenic,pwm-channels-mask = <0xfa>;
+};
--
2.21.0.593.g511ec345e18
^ permalink raw reply related
* [PATCH v12 10/13] MIPS: qi_lb60: Reduce system timer and clocksource to 750 kHz
From: Paul Cercueil @ 2019-05-21 14:51 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Ralf Baechle, Paul Burton, James Hogan,
Jonathan Corbet, Daniel Lezcano, Thomas Gleixner,
Michael Turquette, Stephen Boyd, Jason Cooper, Marc Zyngier,
Lee Jones
Cc: Mathieu Malaterre, linux-kernel, devicetree, linux-mips,
linux-doc, linux-clk, od, Paul Cercueil
In-Reply-To: <20190521145141.9813-1-paul@crapouillou.net>
The default clock (12 MHz) is too fast for the system timer, which fails
to report time accurately.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
Notes:
v5: New patch
v6: Remove ingenic,clocksource-channel property
v7-v12: No change
arch/mips/boot/dts/ingenic/qi_lb60.dts | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/mips/boot/dts/ingenic/qi_lb60.dts b/arch/mips/boot/dts/ingenic/qi_lb60.dts
index 76aaf8982554..01b8c917cb33 100644
--- a/arch/mips/boot/dts/ingenic/qi_lb60.dts
+++ b/arch/mips/boot/dts/ingenic/qi_lb60.dts
@@ -2,6 +2,7 @@
/dts-v1/;
#include "jz4740.dtsi"
+#include <dt-bindings/clock/ingenic,tcu.h>
/ {
compatible = "qi,lb60", "ingenic,jz4740";
@@ -31,3 +32,9 @@
bias-disable;
};
};
+
+&tcu {
+ /* 750 kHz for the system timer and clocksource */
+ assigned-clocks = <&tcu TCU_CLK_TIMER0>, <&tcu TCU_CLK_TIMER1>;
+ assigned-clock-rates = <750000>, <750000>;
+};
--
2.21.0.593.g511ec345e18
^ permalink raw reply related
* [PATCH v12 07/13] clocksource: Add a new timer-ingenic driver
From: Paul Cercueil @ 2019-05-21 14:51 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Ralf Baechle, Paul Burton, James Hogan,
Jonathan Corbet, Daniel Lezcano, Thomas Gleixner,
Michael Turquette, Stephen Boyd, Jason Cooper, Marc Zyngier,
Lee Jones
Cc: Mathieu Malaterre, linux-kernel, devicetree, linux-mips,
linux-doc, linux-clk, od, Paul Cercueil
In-Reply-To: <20190521145141.9813-1-paul@crapouillou.net>
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: Paul Cercueil <paul@crapouillou.net>
---
Notes:
v2: Use SPDX identifier for the license
v3: - Move documentation to its own patch
- Search the devicetree for PWM clients, and use all the TCU
channels that won't be used for PWM
v4: - Add documentation about why we search for PWM clients
- Verify that the PWM clients are for the TCU PWM driver
v5: Major overhaul. Too many changes to list. Consider it's a new
patch.
v6: - Add two API functions ingenic_tcu_request_channel and
ingenic_tcu_release_channel. To be used by the PWM driver to
request the use of a TCU channel. The driver will now dynamically
move away the system timer or clocksource to a new TCU channel.
- The system timer now defaults to channel 0, the clocksource now
defaults to channel 1 and is no more optional. The
ingenic,timer-channel and ingenic,clocksource-channel devicetree
properties are now gone.
- Fix round_rate / set_rate not calculating the prescale divider
the same way. This caused problems when (parent_rate / div) would
give a non-integer result. The behaviour is correct now.
- The clocksource clock is turned off on suspend now.
v7: Fix section mismatch by using builtin_platform_driver_probe()
v8: - Removed ingenic_tcu_[request,release]_channel, and the mechanism
to dynamically change the TCU channel of the system timer or
the clocksource.
- The driver's devicetree node can now have two more children
nodes, that correspond to the system timer and clocksource.
For these two, the driver will use the TCU timer that
correspond to the memory resource supplied in their
respective node.
v9: - Removed support for clocksource / timer children devicetree
nodes. Now, we use a property "ingenic,pwm-channels-mask" to
know which PWM channels are reserved for PWM use and should
not be used as OS timers.
v10: - Use CLK_SET_RATE_UNGATE instead of CLK_SET_RATE_GATE + manually
un-gating the clock before changing rate. Same for re-parenting.
- Unconditionally create the clocksource and sched_clock even if
the SoC possesses a OS Timer. That gives the choice back to the
user which clocksource should be selected.
- Use subsys_initcall() instead of builtin_platform_driver_probe().
The OS Timer driver calls builtin_platform_driver_probe, which
requires the device to be created before that.
- Cosmetic cleanups
v11: - Change prototype of exported function
ingenic_tcu_pwm_can_use_chn(), use a struct device * as first
argument.
- Read clocksource using the regmap instead of bypassing it.
Bypassing the regmap makes sense only for the sched_clock where
the read operation must be as fast as possible.
- Fix incorrect format in pr_crit() macro
v12: - Clock handling and IRQ handling are gone, and are now handled
in their own driver.
- Obtain regmap from the ingenic-tcu MFD driver. As a result, we
cannot bypass the regmap anymore for the sched_clock.
drivers/clocksource/Kconfig | 11 +
drivers/clocksource/Makefile | 1 +
drivers/clocksource/ingenic-timer.c | 357 ++++++++++++++++++++++++++++
3 files changed, 369 insertions(+)
create mode 100644 drivers/clocksource/ingenic-timer.c
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 6bcaa4e2e72c..bb5d5c044341 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -672,4 +672,15 @@ config MILBEAUT_TIMER
help
Enables the support for Milbeaut timer driver.
+config INGENIC_TIMER
+ bool "Clocksource/timer using the TCU in Ingenic JZ SoCs"
+ default MACH_INGENIC
+ depends on MIPS || COMPILE_TEST
+ depends on COMMON_CLK
+ select INGENIC_TCU
+ select TIMER_OF
+ select IRQ_DOMAIN
+ help
+ Support for the timer/counter unit of the Ingenic JZ SoCs.
+
endmenu
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index 236858fa7fbf..553f3c61717a 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -78,6 +78,7 @@ obj-$(CONFIG_ASM9260_TIMER) += asm9260_timer.o
obj-$(CONFIG_H8300_TMR8) += h8300_timer8.o
obj-$(CONFIG_H8300_TMR16) += h8300_timer16.o
obj-$(CONFIG_H8300_TPU) += h8300_tpu.o
+obj-$(CONFIG_INGENIC_TIMER) += ingenic-timer.o
obj-$(CONFIG_CLKSRC_ST_LPC) += clksrc_st_lpc.o
obj-$(CONFIG_X86_NUMACHIP) += numachip.o
obj-$(CONFIG_ATCPIT100_TIMER) += timer-atcpit100.o
diff --git a/drivers/clocksource/ingenic-timer.c b/drivers/clocksource/ingenic-timer.c
new file mode 100644
index 000000000000..9f4df64390f4
--- /dev/null
+++ b/drivers/clocksource/ingenic-timer.c
@@ -0,0 +1,357 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * JZ47xx SoCs TCU IRQ driver
+ * Copyright (C) 2019 Paul Cercueil <paul@crapouillou.net>
+ */
+
+#include <linux/bitops.h>
+#include <linux/clk.h>
+#include <linux/clockchips.h>
+#include <linux/clocksource.h>
+#include <linux/interrupt.h>
+#include <linux/mfd/ingenic-tcu.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/sched_clock.h>
+
+#include <dt-bindings/clock/ingenic,tcu.h>
+
+struct ingenic_soc_info {
+ unsigned int num_channels;
+};
+
+struct ingenic_tcu {
+ struct regmap *map;
+ struct clk *timer_clk, *cs_clk;
+
+ unsigned int timer_channel, cs_channel;
+ struct clock_event_device cevt;
+ struct clocksource cs;
+ char name[4];
+
+ unsigned long pwm_channels_mask;
+};
+
+static struct ingenic_tcu *ingenic_tcu;
+
+static u64 notrace ingenic_tcu_timer_read(void)
+{
+ struct ingenic_tcu *tcu = ingenic_tcu;
+ unsigned int count;
+
+ regmap_read(tcu->map, TCU_REG_TCNTc(tcu->cs_channel), &count);
+
+ return count;
+}
+
+static u64 notrace ingenic_tcu_timer_cs_read(struct clocksource *cs)
+{
+ return ingenic_tcu_timer_read();
+}
+
+static inline struct ingenic_tcu *to_ingenic_tcu(struct clock_event_device *evt)
+{
+ return container_of(evt, struct ingenic_tcu, cevt);
+}
+
+static int ingenic_tcu_cevt_set_state_shutdown(struct clock_event_device *evt)
+{
+ struct ingenic_tcu *tcu = to_ingenic_tcu(evt);
+
+ regmap_write(tcu->map, TCU_REG_TECR, BIT(tcu->timer_channel));
+
+ return 0;
+}
+
+static int ingenic_tcu_cevt_set_next(unsigned long next,
+ struct clock_event_device *evt)
+{
+ struct ingenic_tcu *tcu = to_ingenic_tcu(evt);
+
+ if (next > 0xffff)
+ return -EINVAL;
+
+ regmap_write(tcu->map, TCU_REG_TDFRc(tcu->timer_channel), next);
+ regmap_write(tcu->map, TCU_REG_TCNTc(tcu->timer_channel), 0);
+ regmap_write(tcu->map, TCU_REG_TESR, BIT(tcu->timer_channel));
+
+ return 0;
+}
+
+static irqreturn_t ingenic_tcu_cevt_cb(int irq, void *dev_id)
+{
+ struct clock_event_device *evt = dev_id;
+ struct ingenic_tcu *tcu = to_ingenic_tcu(evt);
+
+ regmap_write(tcu->map, TCU_REG_TECR, BIT(tcu->timer_channel));
+
+ if (evt->event_handler)
+ evt->event_handler(evt);
+
+ return IRQ_HANDLED;
+}
+
+static struct clk * __init ingenic_tcu_get_clock(struct device_node *np, int id)
+{
+ struct of_phandle_args args;
+
+ args.np = np;
+ args.args_count = 1;
+ args.args[0] = id;
+
+ return of_clk_get_from_provider(&args);
+}
+
+static int __init ingenic_tcu_timer_init(struct device_node *np,
+ struct ingenic_tcu *tcu)
+{
+ unsigned int timer_virq, channel = tcu->timer_channel;
+ struct irq_domain *domain;
+ unsigned long rate;
+ int err;
+
+ tcu->timer_clk = ingenic_tcu_get_clock(np, channel);
+ if (IS_ERR(tcu->timer_clk))
+ return PTR_ERR(tcu->timer_clk);
+
+ err = clk_prepare_enable(tcu->timer_clk);
+ if (err)
+ goto err_clk_put;
+
+ rate = clk_get_rate(tcu->timer_clk);
+ if (!rate) {
+ err = -EINVAL;
+ goto err_clk_disable;
+ }
+
+ domain = irq_find_host(np);
+ if (!domain) {
+ err = -ENODEV;
+ goto err_clk_disable;
+ }
+
+ timer_virq = irq_create_mapping(domain, channel);
+ if (!timer_virq) {
+ err = -EINVAL;
+ goto err_clk_disable;
+ }
+
+ snprintf(tcu->name, sizeof(tcu->name), "TCU");
+
+ err = request_irq(timer_virq, ingenic_tcu_cevt_cb, IRQF_TIMER,
+ tcu->name, &tcu->cevt);
+ if (err)
+ goto err_irq_dispose_mapping;
+
+ tcu->cevt.cpumask = cpumask_of(smp_processor_id());
+ tcu->cevt.features = CLOCK_EVT_FEAT_ONESHOT;
+ tcu->cevt.name = tcu->name;
+ tcu->cevt.rating = 200;
+ tcu->cevt.set_state_shutdown = ingenic_tcu_cevt_set_state_shutdown;
+ tcu->cevt.set_next_event = ingenic_tcu_cevt_set_next;
+
+ clockevents_config_and_register(&tcu->cevt, rate, 10, 0xffff);
+
+ return 0;
+
+err_irq_dispose_mapping:
+ irq_dispose_mapping(timer_virq);
+err_clk_disable:
+ clk_disable_unprepare(tcu->timer_clk);
+err_clk_put:
+ clk_put(tcu->timer_clk);
+ return err;
+}
+
+static int __init ingenic_tcu_clocksource_init(struct device_node *np,
+ struct ingenic_tcu *tcu)
+{
+ unsigned int channel = tcu->cs_channel;
+ struct clocksource *cs = &tcu->cs;
+ unsigned long rate;
+ int err;
+
+ tcu->cs_clk = ingenic_tcu_get_clock(np, channel);
+ if (IS_ERR(tcu->cs_clk))
+ return PTR_ERR(tcu->cs_clk);
+
+ err = clk_prepare_enable(tcu->cs_clk);
+ if (err)
+ goto err_clk_put;
+
+ rate = clk_get_rate(tcu->cs_clk);
+ if (!rate) {
+ err = -EINVAL;
+ goto err_clk_disable;
+ }
+
+ /* Reset channel */
+ regmap_update_bits(tcu->map, TCU_REG_TCSRc(channel),
+ 0xffff & ~TCU_TCSR_RESERVED_BITS, 0);
+
+ /* Reset counter */
+ regmap_write(tcu->map, TCU_REG_TDFRc(channel), 0xffff);
+ regmap_write(tcu->map, TCU_REG_TCNTc(channel), 0);
+
+ /* Enable channel */
+ regmap_write(tcu->map, TCU_REG_TESR, BIT(channel));
+
+ cs->name = "ingenic-timer";
+ cs->rating = 200;
+ cs->flags = CLOCK_SOURCE_IS_CONTINUOUS;
+ cs->mask = CLOCKSOURCE_MASK(16);
+ cs->read = ingenic_tcu_timer_cs_read;
+
+ err = clocksource_register_hz(cs, rate);
+ if (err)
+ goto err_clk_disable;
+
+ return 0;
+
+err_clk_disable:
+ clk_disable_unprepare(tcu->cs_clk);
+err_clk_put:
+ clk_put(tcu->cs_clk);
+ return err;
+}
+
+static const struct ingenic_soc_info jz4740_soc_info = {
+ .num_channels = 8,
+};
+
+static const struct ingenic_soc_info jz4725b_soc_info = {
+ .num_channels = 6,
+};
+
+static const struct of_device_id ingenic_tcu_of_match[] = {
+ { .compatible = "ingenic,jz4740-tcu", .data = &jz4740_soc_info, },
+ { .compatible = "ingenic,jz4725b-tcu", .data = &jz4725b_soc_info, },
+ { .compatible = "ingenic,jz4770-tcu", .data = &jz4740_soc_info, },
+ { }
+};
+
+static int __init ingenic_tcu_init(struct device_node *np)
+{
+ const struct of_device_id *id = of_match_node(ingenic_tcu_of_match, np);
+ const struct ingenic_soc_info *soc_info = id->data;
+ struct ingenic_tcu *tcu;
+ struct regmap *map;
+ long rate;
+ int ret;
+
+ of_node_clear_flag(np, OF_POPULATED);
+
+ map = ingenic_tcu_get_regmap(np);
+ if (IS_ERR(map))
+ return PTR_ERR(map);
+
+ tcu = kzalloc(sizeof(*tcu), GFP_KERNEL);
+ if (!tcu)
+ return -ENOMEM;
+
+ /* Enable all TCU channels for PWM use by default except channels 0/1 */
+ tcu->pwm_channels_mask = GENMASK(soc_info->num_channels - 1, 2);
+ of_property_read_u32(np, "ingenic,pwm-channels-mask",
+ (u32 *)&tcu->pwm_channels_mask);
+
+ /* Verify that we have at least two free channels */
+ if (hweight8(tcu->pwm_channels_mask) > soc_info->num_channels - 2) {
+ pr_crit("%s: Invalid PWM channel mask: 0x%02lx\n", __func__,
+ tcu->pwm_channels_mask);
+ ret = -EINVAL;
+ goto err_free_ingenic_tcu;
+ }
+
+ tcu->map = map;
+ ingenic_tcu = tcu;
+
+ tcu->timer_channel = find_first_zero_bit(&tcu->pwm_channels_mask,
+ soc_info->num_channels);
+ tcu->cs_channel = find_next_zero_bit(&tcu->pwm_channels_mask,
+ soc_info->num_channels,
+ tcu->timer_channel + 1);
+
+ ret = ingenic_tcu_clocksource_init(np, tcu);
+ if (ret) {
+ pr_crit("%s: Unable to init clocksource: %i\n", __func__, ret);
+ goto err_free_ingenic_tcu;
+ }
+
+ ret = ingenic_tcu_timer_init(np, tcu);
+ if (ret)
+ goto err_tcu_clocksource_cleanup;
+
+ /* Register the sched_clock at the end as there's no way to undo it */
+ rate = clk_get_rate(tcu->cs_clk);
+ sched_clock_register(ingenic_tcu_timer_read, 16, rate);
+
+ return 0;
+
+err_tcu_clocksource_cleanup:
+ clocksource_unregister(&tcu->cs);
+ clk_disable_unprepare(tcu->cs_clk);
+ clk_put(tcu->cs_clk);
+err_free_ingenic_tcu:
+ kfree(tcu);
+ return ret;
+}
+
+TIMER_OF_DECLARE(jz4740_tcu_intc, "ingenic,jz4740-tcu", ingenic_tcu_init);
+TIMER_OF_DECLARE(jz4725b_tcu_intc, "ingenic,jz4725b-tcu", ingenic_tcu_init);
+TIMER_OF_DECLARE(jz4770_tcu_intc, "ingenic,jz4770-tcu", ingenic_tcu_init);
+
+
+static int __init ingenic_tcu_probe(struct platform_device *pdev)
+{
+ platform_set_drvdata(pdev, ingenic_tcu);
+
+ return 0;
+}
+
+static int __maybe_unused ingenic_tcu_suspend(struct device *dev)
+{
+ struct ingenic_tcu *tcu = dev_get_drvdata(dev);
+
+ clk_disable(tcu->cs_clk);
+ clk_disable(tcu->timer_clk);
+ return 0;
+}
+
+static int __maybe_unused ingenic_tcu_resume(struct device *dev)
+{
+ struct ingenic_tcu *tcu = dev_get_drvdata(dev);
+ int ret;
+
+ ret = clk_enable(tcu->timer_clk);
+ if (ret)
+ return ret;
+
+ ret = clk_enable(tcu->cs_clk);
+ if (ret) {
+ clk_disable(tcu->timer_clk);
+ return ret;
+ }
+
+ return 0;
+}
+
+static const struct dev_pm_ops __maybe_unused ingenic_tcu_pm_ops = {
+ /* _noirq: We want the TCU clocks to be gated last / ungated first */
+ .suspend_noirq = ingenic_tcu_suspend,
+ .resume_noirq = ingenic_tcu_resume,
+};
+
+static struct platform_driver ingenic_tcu_driver = {
+ .driver = {
+ .name = "ingenic-tcu-timer",
+#ifdef CONFIG_PM_SLEEP
+ .pm = &ingenic_tcu_pm_ops,
+#endif
+ .of_match_table = ingenic_tcu_of_match,
+ },
+};
+builtin_platform_driver_probe(ingenic_tcu_driver, ingenic_tcu_probe);
--
2.21.0.593.g511ec345e18
^ permalink raw reply related
* [PATCH v12 02/13] doc: Add doc for the Ingenic TCU hardware
From: Paul Cercueil @ 2019-05-21 14:51 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Ralf Baechle, Paul Burton, James Hogan,
Jonathan Corbet, Daniel Lezcano, Thomas Gleixner,
Michael Turquette, Stephen Boyd, Jason Cooper, Marc Zyngier,
Lee Jones
Cc: Mathieu Malaterre, linux-kernel, devicetree, linux-mips,
linux-doc, linux-clk, od, Paul Cercueil
In-Reply-To: <20190521145141.9813-1-paul@crapouillou.net>
Add a documentation file 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: Paul Cercueil <paul@crapouillou.net>
---
Notes:
v4: New patch in this series
v5: Added information about number of channels, and improved
documentation about channel modes
v6: Add info about OST (can be 32-bit on older SoCs)
v7-v11: No change
v12: Add details about new implementation
Documentation/mips/ingenic-tcu.txt | 63 ++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)
create mode 100644 Documentation/mips/ingenic-tcu.txt
diff --git a/Documentation/mips/ingenic-tcu.txt b/Documentation/mips/ingenic-tcu.txt
new file mode 100644
index 000000000000..1a753805779c
--- /dev/null
+++ b/Documentation/mips/ingenic-tcu.txt
@@ -0,0 +1,63 @@
+Ingenic JZ47xx SoCs Timer/Counter Unit hardware
+-----------------------------------------------
+
+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 JZ4760B 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.
+
+Implementation
+--------------
+
+The functionalities of the TCU hardware are spread across multiple drivers:
+- boilerplate: drivers/mfd/ingenic-tcu.c
+- clocks: drivers/clk/ingenic/tcu.c
+- interrupts: drivers/irqchip/irq-ingenic-tcu.c
+- timers: drivers/clocksource/ingenic-timer.c
+- PWM: drivers/pwm/pwm-jz4740.c
+- watchdog: drivers/watchdog/jz4740_wdt.c
+- OST: drivers/clocksource/ingenic-ost.c
+
+Because various functionalities of the TCU that belong to different drivers
+and frameworks can be controlled from the same registers, all of these
+drivers access their registers through the same regmap.
+
+For more information regarding the devicetree bindings of the TCU drivers,
+have a look at Documentation/devicetree/bindings/mfd/ingenic,tcu.txt.
--
2.21.0.593.g511ec345e18
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox