26 Apr, 2018

1 commit

  • [ Upstream commit f541c09ebfc61697b586b38c9ebaf4b70defb278 ]

    According to all published information, the watchdog disable bit for SB800
    compatible controllers is bit 1 of PM register 0x48, not bit 2. For the
    most part that doesn't matter in practice, since the bit has to be cleared
    to enable watchdog address decoding, which is the default setting, but it
    still needs to be fixed.

    Cc: Zoltán Böszörményi
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Guenter Roeck
     

24 Apr, 2018

1 commit

  • commit 977f6f68331f94bb72ad84ee96b7b87ce737d89d upstream.

    F71808FG_FLAG_WD_EN defines bit position, not a bitmask

    Signed-off-by: Igor Pylypiv
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Igor Pylypiv
     

12 Apr, 2018

1 commit

  • [ Upstream commit 1bfe8889380890efe4943d125124f5a7b48571b0 ]

    The only way of stopping the watchdog is by resetting it.
    Add the watchdog op for stopping the device and reset if
    a reset line is provided.

    At same time WDOG_HW_RUNNING should be remove from dw_wdt_start.
    As commented by Guenter Roeck:
    dw_wdt sets WDOG_HW_RUNNING in its open function. Result is
    that the kref_get() in watchdog_open() won't be executed. But then
    kref_put() in close will be called since the watchdog now does stop.
    This causes the imbalance.

    Signed-off-by: Oleksij Rempel
    Cc: Wim Van Sebroeck
    Cc: Guenter Roeck
    Cc: linux-watchdog@vger.kernel.org
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Oleksij Rempel
     

29 Mar, 2018

1 commit

  • commit b1abf6fc49829d89660c961fafe3f90f3d843c55 upstream.

    The resource allocation in WDAT watchdog has off-one-by error, it sets
    one byte more than the actual end address. This may eventually lead
    to unexpected resource conflicts.

    Fixes: 058dfc767008 (ACPI / watchdog: Add support for WDAT hardware watchdog)
    Cc: 4.9+ # 4.9+
    Signed-off-by: Takashi Iwai
    Acked-by: Mika Westerberg
    Acked-by: Guenter Roeck
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     

24 Mar, 2018

2 commits

  • [ Upstream commit 914d65f3f013ba2556c7beec5d3baac7b3292504 ]

    If handle_boot_enabled is set to 0, the watchdog driver module use
    counter will not be increased and kref_get() will not be called when
    registering the watchdog. Subsequently, on open, this does not happen
    either because the code believes that it was already done because the
    hardware watchdog is marked as running.

    We could introduce a state variable to indicate this state, but let's
    just increase the module use counter and call kref_get() unconditionally
    if the hardware watchdog is running when a driver is registering itself
    to keep the code simple.

    Fixes: 2501b015313fe ("watchdog: core: add option to avoid early ...")
    Cc: Sebastian Reichel
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Guenter Roeck
     
  • [ Upstream commit 4bcd615fad6adddc68b058d498b30a9e0e0db77a ]

    If a watchdog driver's open function sets WDOG_HW_RUNNING with the
    expectation that the watchdog can not be stopped, but then stops the
    watchdog anyway in its stop function, kref_get() wil not be called in
    watchdog_open(). If the watchdog then stops on close, WDOG_HW_RUNNING
    will be cleared and kref_put() will be called, causing a kref imbalance.
    As result the character device data structure will be released, which in
    turn will cause the system to crash on the next call to watchdog_open().

    Fixes: ee142889e32f5 ("watchdog: Introduce WDOG_HW_RUNNING flag")
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Guenter Roeck
     

15 Mar, 2018

4 commits

  • commit 2b3d89b402b085b08498e896c65267a145bed486 upstream.

    Gen8 and prior Proliant systems supported the "CRU" interface
    to firmware. This interfaces allows linux to "call back" into firmware
    to source the cause of an NMI. This feature isn't fully utilized
    as the actual source of the NMI isn't printed, the driver only
    indicates that the source couldn't be determined when the call
    fails.

    With the advent of Gen9, iCRU replaces the CRU. The call back
    feature is no longer available in firmware. To be compatible and
    not attempt to call back into firmware on system not supporting CRU,
    the SMBIOS table is consulted to determine if it is safe to
    make the call back or not.

    This results in about half of the driver code being devoted
    to either making CRU calls or determing if it is safe to make
    CRU calls. As noted, the driver isn't really using the results of
    the CRU calls.

    Furthermore, as a consequence of the Spectre security issue, the
    BIOS/EFI calls are being wrapped into Spectre-disabling section.
    Removing the call back in hpwdt_pretimeout assists in this effort.

    As the CRU sourcing of the NMI isn't required for handling the
    NMI and there are security concerns with making the call back, remove
    the legacy (pre Gen9) NMI sourcing and the DMI code to determine if
    the system had the CRU interface.

    Signed-off-by: Jerry Hoemann
    Acked-by: Ingo Molnar
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Greg Kroah-Hartman

    Jerry Hoemann
     
  • commit aeebc6ba88ba3758ad95467ff6191fabf2074c13 upstream.

    The new hpwdt_my_nmi() function is used conditionally, which produces
    a harmless warning in some configurations:

    drivers/watchdog/hpwdt.c:478:12: error: 'hpwdt_my_nmi' defined but not used [-Werror=unused-function]

    This moves it inside of the #ifdef that protects its caller, to silence
    the warning.

    Fixes: 621174a92851 ("watchdog: hpwdt: Check source of NMI")
    Signed-off-by: Arnd Bergmann
    Reviewed-by: Jerry Hoemann
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     
  • commit 838534e50e2e5c1e644e30ab6cb28da88eb31368 upstream.

    Do not claim the NMI (i.e. return NMI_DONE) if the source of
    the NMI isn't the iLO watchdog or debug.

    Signed-off-by: Jerry Hoemann
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Greg Kroah-Hartman

    Jerry Hoemann
     
  • commit c42cbe41727a138905a28f8e0b00c147be77ee93 upstream.

    This corrects:
    commit cce78da76601 ("watchdog: hpwdt: Add check for UEFI bits")

    The test on HPE SMBIOS extension type 219 record "Misc Features"
    bits for UEFI support is incorrect. The definition of the Misc Features
    bits in the HPE SMBIOS OEM Extensions specification (and related
    firmware) was changed to use a different pair of bits to
    represent UEFI supported. Howerver, a corresponding change
    to Linux was missed.

    Current code/platform work because the iCRU test is working.
    But purpose of cce78da766 is to ensure correct functionality
    on future systems where iCRU isn't supported.

    Signed-off-by: Jerry Hoemann
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Greg Kroah-Hartman

    Jerry Hoemann
     

17 Feb, 2018

3 commits

  • commit 0be267255cef64e1c58475baa7b25568355a3816 upstream.

    When the watchdog device is suspended, its timeout is set to the maximum
    value. During resume, the previously set timeout should be restored.
    This does not work at the moment.

    The suspend function calls

    imx2_wdt_set_timeout(wdog, IMX2_WDT_MAX_TIME);

    and resume reverts this by calling

    imx2_wdt_set_timeout(wdog, wdog->timeout);

    However, imx2_wdt_set_timeout() updates wdog->timeout. Therefore,
    wdog->timeout is set to IMX2_WDT_MAX_TIME when we enter the resume
    function.

    Fix this by adding a new function __imx2_wdt_set_timeout() which
    only updates the hardware settings. imx2_wdt_set_timeout() now calls
    __imx2_wdt_set_timeout() and then saves the new timeout to
    wdog->timeout.

    During suspend, we call __imx2_wdt_set_timeout() directly so that
    wdog->timeout won't be updated and we can restore the previous value
    during resume. This approach makes wdog->timeout different from the
    actual setting in the hardware which is usually not a good thing.
    However, the two differ only while we're suspended and no kernel code is
    running, so it should be ok in this case.

    Signed-off-by: Martin Kaiser
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Greg Kroah-Hartman

    Martin Kaiser
     
  • commit bc137dfdbec27c0ec5731a89002daded4a4aa1ea upstream.

    The first patch above (https://patchwork.kernel.org/patch/9970181/)
    makes the oops go away, but it just papers over the problem. The real
    problem is that the watchdog core clears WDOG_HW_RUNNING in
    watchdog_stop, and the gpio driver fails to set it in its stop
    function when it doesn't actually stop it. This means that the core
    doesn't know that it now has responsibility for petting the device, in
    turn causing the device to reset the system (I hadn't noticed this
    because the board I'm working on has that reset logic disabled).

    How about this (other drivers may of course have the same problem, I
    haven't checked). One might say that ->stop should return an error
    when the device can't be stopped, but OTOH this brings parity between
    a device without a ->stop method and a GPIO wd that has always-running
    set. IOW, I think ->stop should only return an error when an actual
    attempt to stop the hardware failed.

    From: Rasmus Villemoes

    The watchdog framework clears WDOG_HW_RUNNING before calling
    ->stop. If the driver is unable to stop the device, it is supposed to
    set that bit again so that the watchdog core takes care of sending
    heart-beats while the device is not open from user-space. Update the
    gpio_wdt driver to honour that contract (and get rid of the redundant
    clearing of WDOG_HW_RUNNING).

    Fixes: 3c10bbde10 ("watchdog: core: Clear WDOG_HW_RUNNING before calling the stop function")
    Signed-off-by: Rasmus Villemoes
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Greg Kroah-Hartman

    Rasmus Villemoes
     
  • commit 24f8d233074badd4c18e4dafd2fb97d65838afed upstream.

    Commit da2a68b3eb47 ("watchdog: Enable COMPILE_TEST where possible")
    enabled building the Indy watchdog driver when COMPILE_TEST is enabled.
    However, the driver makes reference to symbols that are only defined for
    certain platforms are selected in the config. These platforms select
    SGI_HAS_INDYDOG. Without this, link time errors result, for example
    when building a MIPS allyesconfig.

    drivers/watchdog/indydog.o: In function `indydog_write':
    indydog.c:(.text+0x18): undefined reference to `sgimc'
    indydog.c:(.text+0x1c): undefined reference to `sgimc'
    drivers/watchdog/indydog.o: In function `indydog_start':
    indydog.c:(.text+0x54): undefined reference to `sgimc'
    indydog.c:(.text+0x58): undefined reference to `sgimc'
    drivers/watchdog/indydog.o: In function `indydog_stop':
    indydog.c:(.text+0xa4): undefined reference to `sgimc'
    drivers/watchdog/indydog.o:indydog.c:(.text+0xa8): more undefined
    references to `sgimc' follow
    make: *** [Makefile:1005: vmlinux] Error 1

    Fix this by ensuring that CONFIG_INDIDOG can only be selected when the
    necessary dependent platform symbols are built in.

    Fixes: da2a68b3eb47 ("watchdog: Enable COMPILE_TEST where possible")
    Signed-off-by: Matt Redfearn
    Signed-off-by: Ralf Baechle
    Suggested-by: James Hogan
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Greg Kroah-Hartman

    Matt Redfearn
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

16 Sep, 2017

1 commit

  • Pull MIPS updates from Ralf Baechle:
    "This is the main pull request for 4.14 for MIPS; below a summary of
    the non-merge commits:

    CM:
    - Rename mips_cm_base to mips_gcr_base
    - Specify register size when generating accessors
    - Use BIT/GENMASK for register fields, order & drop shifts
    - Add cluster & block args to mips_cm_lock_other()

    CPC:
    - Use common CPS accessor generation macros
    - Use BIT/GENMASK for register fields, order & drop shifts
    - Introduce register modify (set/clear/change) accessors
    - Use change_*, set_* & clear_* where appropriate
    - Add CM/CPC 3.5 register definitions
    - Use GlobalNumber macros rather than magic numbers
    - Have asm/mips-cps.h include CM & CPC headers
    - Cluster support for topology functions
    - Detect CPUs in secondary clusters

    CPS:
    - Read GIC_VL_IDENT directly, not via irqchip driver

    DMA:
    - Consolidate coherent and non-coherent dma_alloc code
    - Don't use dma_cache_sync to implement fd_cacheflush

    FPU emulation / FP assist code:
    - Another series of 14 commits fixing corner cases such as NaN
    propgagation and other special input values.
    - Zero bits 32-63 of the result for a CLASS.D instruction.
    - Enhanced statics via debugfs
    - Do not use bools for arithmetic. GCC 7.1 moans about this.
    - Correct user fault_addr type

    Generic MIPS:
    - Enhancement of stack backtraces
    - Cleanup from non-existing options
    - Handle non word sized instructions when examining frame
    - Fix detection and decoding of ADDIUSP instruction
    - Fix decoding of SWSP16 instruction
    - Refactor handling of stack pointer in get_frame_info
    - Remove unreachable code from force_fcr31_sig()
    - Convert to using %pOF instead of full_name
    - Remove the R6000 support.
    - Move FP code from *_switch.S to *_fpu.S
    - Remove unused ST_OFF from r2300_switch.S
    - Allow platform to specify multiple its.S files
    - Add #includes to various files to ensure code builds reliable and
    without warning..
    - Remove __invalidate_kernel_vmap_range
    - Remove plat_timer_setup
    - Declare various variables & functions static
    - Abstract CPU core & VP(E) ID access through accessor functions
    - Store core & VP IDs in GlobalNumber-style variable
    - Unify checks for sibling CPUs
    - Add CPU cluster number accessors
    - Prevent direct use of generic_defconfig
    - Make CONFIG_MIPS_MT_SMP default y
    - Add __ioread64_copy
    - Remove unnecessary inclusions of linux/irqchip/mips-gic.h

    GIC:
    - Introduce asm/mips-gic.h with accessor functions
    - Use new GIC accessor functions in mips-gic-timer
    - Remove counter access functions from irq-mips-gic.c
    - Remove gic_read_local_vp_id() from irq-mips-gic.c
    - Simplify shared interrupt pending/mask reads in irq-mips-gic.c
    - Simplify gic_local_irq_domain_map() in irq-mips-gic.c
    - Drop gic_(re)set_mask() functions in irq-mips-gic.c
    - Remove gic_set_polarity(), gic_set_trigger(), gic_set_dual_edge(),
    gic_map_to_pin() and gic_map_to_vpe() from irq-mips-gic.c.
    - Convert remaining shared reg access, local int mask access and
    remaining local reg access to new accessors
    - Move GIC_LOCAL_INT_* to asm/mips-gic.h
    - Remove GIC_CPU_INT* macros from irq-mips-gic.c
    - Move various definitions to the driver
    - Remove gic_get_usm_range()
    - Remove __gic_irq_dispatch() forward declaration
    - Remove gic_init()
    - Use mips_gic_present() in place of gic_present and remove
    gic_present
    - Move gic_get_c0_*_int() to asm/mips-gic.h
    - Remove linux/irqchip/mips-gic.h
    - Inline __gic_init()
    - Inline gic_basic_init()
    - Make pcpu_masks a per-cpu variable
    - Use pcpu_masks to avoid reading GIC_SH_MASK*
    - Clean up mti, reserved-cpu-vectors handling
    - Use cpumask_first_and() in gic_set_affinity()
    - Let the core set struct irq_common_data affinity

    microMIPS:
    - Fix microMIPS stack unwinding on big endian systems

    MIPS-GIC:
    - SYNC after enabling GIC region

    NUMA:
    - Remove the unused parent_node() macro

    R6:
    - Constify r2_decoder_tables
    - Add accessor & bit definitions for GlobalNumber

    SMP:
    - Constify smp ops
    - Allow boot_secondary SMP op to return errors

    VDSO:
    - Drop gic_get_usm_range() usage
    - Avoid use of linux/irqchip/mips-gic.h

    Platform changes:

    Alchemy:
    - Add devboard machine type to cpuinfo
    - update cpu feature overrides
    - Threaded carddetect irqs for devboards

    AR7:
    - allow NULL clock for clk_get_rate

    BCM63xx:
    - Fix ENETDMA_6345_MAXBURST_REG offset
    - Allow NULL clock for clk_get_rate

    CI20:
    - Enable GPIO and RTC drivers in defconfig
    - Add ethernet and fixed-regulator nodes to DTS

    Generic platform:
    - Move Boston and NI 169445 FIT image source to their own files
    - Include asm/bootinfo.h for plat_fdt_relocated()
    - Include asm/time.h for get_c0_*_int()
    - Include asm/bootinfo.h for plat_fdt_relocated()
    - Include asm/time.h for get_c0_*_int()
    - Allow filtering enabled boards by requirements
    - Don't explicitly disable CONFIG_USB_SUPPORT
    - Bump default NR_CPUS to 16

    JZ4700:
    - Probe the jz4740-rtc driver from devicetree

    Lantiq:
    - Drop check of boot select from the spi-falcon driver.
    - Drop check of boot select from the lantiq-flash MTD driver.
    - Access boot cause register in the watchdog driver through regmap
    - Add device tree binding documentation for the watchdog driver
    - Add docs for the RCU DT bindings.
    - Convert the fpi bus driver to a platform_driver
    - Remove ltq_reset_cause() and ltq_boot_select(
    - Switch to a proper reset driver
    - Switch to a new drivers/soc GPHY driver
    - Add an USB PHY driver for the Lantiq SoCs using the RCU module
    - Use of_platform_default_populate instead of __dt_register_buses
    - Enable MFD_SYSCON to be able to use it for the RCU MFD
    - Replace ltq_boot_select() with dummy implementation.

    Loongson 2F:
    - Allow NULL clock for clk_get_rate

    Malta:
    - Use new GIC accessor functions

    NI 169445:
    - Add support for NI 169445 board.
    - Only include in 32r2el kernels

    Octeon:
    - Add support for watchdog of 78XX SOCs.
    - Add support for watchdog of CN68XX SOCs.
    - Expose support for mips32r1, mips32r2 and mips64r1
    - Enable more drivers in config file
    - Add support for accessing the boot vector.
    - Remove old boot vector code from watchdog driver
    - Define watchdog registers for 70xx, 73xx, 78xx, F75xx.
    - Make CSR functions node aware.
    - Allow access to CIU3 IRQ domains.
    - Misc cleanups in the watchdog driver

    Omega2+:
    - New board, add support and defconfig

    Pistachio:
    - Enable Root FS on NFS in defconfig

    Ralink:
    - Add Mediatek MT7628A SoC
    - Allow NULL clock for clk_get_rate
    - Explicitly request exclusive reset control in the pci-mt7620 PCI driver.

    SEAD3:
    - Only include in 32 bit kernels by default

    VoCore:
    - Add VoCore as a vendor t0 dt-bindings
    - Add defconfig file"

    * '4.14-features' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (167 commits)
    MIPS: Refactor handling of stack pointer in get_frame_info
    MIPS: Stacktrace: Fix microMIPS stack unwinding on big endian systems
    MIPS: microMIPS: Fix decoding of swsp16 instruction
    MIPS: microMIPS: Fix decoding of addiusp instruction
    MIPS: microMIPS: Fix detection of addiusp instruction
    MIPS: Handle non word sized instructions when examining frame
    MIPS: ralink: allow NULL clock for clk_get_rate
    MIPS: Loongson 2F: allow NULL clock for clk_get_rate
    MIPS: BCM63XX: allow NULL clock for clk_get_rate
    MIPS: AR7: allow NULL clock for clk_get_rate
    MIPS: BCM63XX: fix ENETDMA_6345_MAXBURST_REG offset
    mips: Save all registers when saving the frame
    MIPS: Add DWARF unwinding to assembly
    MIPS: Make SAVE_SOME more standard
    MIPS: Fix issues in backtraces
    MIPS: jz4780: DTS: Probe the jz4740-rtc driver from devicetree
    MIPS: Ci20: Enable RTC driver
    watchdog: octeon-wdt: Add support for 78XX SOCs.
    watchdog: octeon-wdt: Add support for cn68XX SOCs.
    watchdog: octeon-wdt: File cleaning.
    ...

    Linus Torvalds
     

10 Sep, 2017

25 commits

  • mei_cl_device_id are not supposed to change at runtime. All functions
    working with mei_cl_device_id provided by work
    with const mei_cl_device_id. So mark the non-const structs as const.

    Signed-off-by: Arvind Yadav
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Arvind Yadav
     
  • amba_id are not supposed to change at runtime. All functions
    working with const amba_id. So mark the non-const structs as const.

    Signed-off-by: Arvind Yadav
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Arvind Yadav
     
  • i2c_device_id are not supposed to change at runtime. All functions
    working with i2c_device_id provided by work with
    const i2c_device_id. So mark the non-const structs as const.

    Signed-off-by: Arvind Yadav
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Arvind Yadav
     
  • pnp_device_id are not supposed to change at runtime. All functions
    working with pnp_device_id provided by work with
    const pnp_device_id. So mark the non-const structs as const.

    Signed-off-by: Arvind Yadav
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Arvind Yadav
     
  • Signed-off-by: Wolfram Sang
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Wolfram Sang
     
  • It is not needed outside probe() anymore.

    Signed-off-by: Wolfram Sang
    Reviewed-by: Geert Uytterhoeven
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Wolfram Sang
     
  • On Renesas R-Car archs, RuntimePM does all the clock handling. So, use
    it consistently to enable/disable the clocks. Also make sure that clocks
    are really enabled around clk_get_rate(). clk_summary looks proper now:

    clock enable_cnt prepare_cnt rate ...
    Before this commit:

    At boot: rwdt 1 1 32768 0 0
    WDT running: rwdt 2 2 32768 0 0

    After this commit:

    At boot: rwdt 0 1 32768 0 0
    WDT running rwdt 1 1 32768 0 0

    Signed-off-by: Wolfram Sang
    Reviewed-by: Geert Uytterhoeven
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Wolfram Sang
     
  • Add support for configuring the drive strength and polarity on the
    AST2500, and the pulse duration on both the AST2400 and AST2500.

    Signed-off-by: Andrew Jeffery
    Tested-by: Matt Spinler
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Andrew Jeffery
     
  • Reference the system device tree when configuring the watchdog
    engines. If property 'aspeed,reset_type' is present then set
    reset behavior based on the specified value. This can be one of
    three different mutually exclusive values
    * cpu - Reset CPU only on watchdog timeout
    * soc - Reset System on Chip
    * system - Full system reset

    No reset can also be specified by indicating:
    * none - No reset, assumes another watchdog is responsible for
    this.

    Add optional property 'aspeed,external-signal'. If present then
    configure to generate external signal on watchdog timeout.

    Signed-off-by: Christopher Bostic
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Christopher Bostic
     
  • ...da9063_watchdog, which contained nothing but struct watchdog_device and a
    struct da9063 pointer.
    Assign the struct da9063 pointer directly to the struct watchdog_device's
    driver_data field instead of creating struct da9063_watchdog and assigning
    it's address there.
    Spares a pointer's size data memory and an indirection level in the callbacks.

    Signed-off-by: Karsten Wiese
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    fzuuzf@googlemail.com
     
  • clk_prepare_enable() may fail, so we should better check its return value
    and propagate it in the case of error.

    Signed-off-by: Fabio Estevam
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Fabio Estevam
     
  • platform_get_resource() may fail, so we should better check its
    return value and propagate an error in case it fails.

    This avoids a NULL pointer dereference a bit later in the code.

    Signed-off-by: Fabio Estevam
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Fabio Estevam
     
  • Add suspend/resume support to driver.

    Signed-off-by: Michal Simek
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Michal Simek
     
  • Improve CLK handling in the code to read freq via CCF.
    Also disable CLK asap and add clk handling code to start and stop.

    Signed-off-by: Maulik Jodhani
    Signed-off-by: Michal Simek
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Maulik Jodhani
     
  • platform_device_id are not supposed to change at runtime. All functions
    working with platform_device_id provided by
    work with const platform_device_id. So mark the non-const structs as
    const.

    Signed-off-by: Arvind Yadav
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Arvind Yadav
     
  • usb_device_id are not supposed to change at runtime. All functions
    working with usb_device_id provided by work with
    const usb_device_id. So mark the non-const structs as const.

    Signed-off-by: Arvind Yadav
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Arvind Yadav
     
  • Showing message that driver is loaded is common across drivers.
    This change also fixes checkpatch (--strict) warning
    "Alignment should match open parenthesis".

    Signed-off-by: Michal Simek
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Michal Simek
     
  • Give read access to module parameters to all and write access to root.
    This change also improves driver error path testing.

    Signed-off-by: Michal Simek
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Michal Simek
     
  • These watchdog_ops and watchdog_info structures are only stored
    in the ops and info fields of a watchdog_device structure,
    respectively, which are const. Thus make the watchdog_ops and
    watchdog_info structures const as well.

    Done with the help of Coccinelle. The rules for the watchdog_ops case are
    as follows:

    //
    @r disable optional_qualifier@
    identifier i;
    position p;
    @@
    static struct watchdog_ops i@p = { ... };

    @ok@
    identifier r.i;
    struct watchdog_device e;
    position p;
    @@
    e.ops = &i@p;

    @bad@
    position p != {r.p,ok.p};
    identifier r.i;
    struct watchdog_ops e;
    @@
    e@i@p

    @depends on !bad disable optional_qualifier@
    identifier r.i;
    @@
    static
    +const
    struct watchdog_ops i = { ... };
    //

    Signed-off-by: Julia Lawall
    Acked-by: Linus Walleij
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Julia Lawall
     
  • We should never return more time left than there actually is. So, switch
    to a plain divider instead of DIV_ROUND_CLOSEST.

    Signed-off-by: Wolfram Sang
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Wolfram Sang
     
  • If we set RWTCSRB to 0, we can gain 4096 as another divider value. This
    is supported by all R-Car Gen2 and Gen3 devices which we aim to support.

    Signed-off-by: Wolfram Sang
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Wolfram Sang
     
  • The error margin of the clks_per_second variable was too large and
    caused offsets when used with clock frequencies which left a remainder
    after applying the dividers. Now we always calculate directly using the
    clock rate and the divider using some helper macros. That also means
    that DIV_ROUND_UP moves from probe to the multiplication macro. In
    probe, we don't need to ensure anymore that 'clks_per_sec' would go too
    fast but rather ensure that the lower limit is really at least 1 to
    certainly get a full cycle.

    Signed-off-by: Wolfram Sang
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Wolfram Sang
     
  • We should never return more time left than there actually is. So, switch
    to a plain divider instead of DIV_ROUND_CLOSEST.

    Signed-off-by: Wolfram Sang
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Wolfram Sang
     
  • When checking the clock rate, ensure also that counting all 16 bits
    takes at least one second to match the granularity of the framework.

    Signed-off-by: Wolfram Sang
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Wolfram Sang
     
  • Because the smallest clock divider we can select is 1, 'clks_per_sec'
    must be the same type as 'rate'.

    Signed-off-by: Wolfram Sang
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Wolfram Sang