05 Mar, 2020

1 commit

  • commit 2ba33a4e9e22ac4dda928d3e9b5978a3a2ded4e0 upstream.

    ACPI Generic Address Structure (GAS) access_width field is not in bytes
    as the driver seems to expect in few places so fix this by using the
    newly introduced macro ACPI_ACCESS_BYTE_WIDTH().

    Fixes: b1abf6fc4982 ("ACPI / watchdog: Fix off-by-one error at resource assignment")
    Fixes: 058dfc767008 ("ACPI / watchdog: Add support for WDAT hardware watchdog")
    Reported-by: Jean Delvare
    Signed-off-by: Mika Westerberg
    Reviewed-by: Jean Delvare
    Cc: 4.16+ # 4.16+
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Mika Westerberg
     

15 Feb, 2020

2 commits

  • commit 85fdc63fe256b595f923a69848cd99972ff446d8 upstream.

    If the watchdog hardware is already enabled during the boot process,
    when the Linux watchdog driver loads, it should start/reset the watchdog
    and tell the watchdog framework. As a result, ping can be generated from
    the watchdog framework (if CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED is set),
    until the userspace watchdog daemon takes over control

    Fixes:4332d113c66a ("watchdog: Add STM32 IWDG driver")

    Signed-off-by: Christophe Roullier
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20191122132246.8473-1-christophe.roullier@st.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Greg Kroah-Hartman

    Christophe Roullier
     
  • commit e0b4f4e0cf7fa9d62628d4249c765ec18dffd143 upstream.

    platform_get_irq() prints an error message when the interrupt
    is not available. So on platforms where bark interrupt is
    not specified, following error message is observed on SDM845.

    [ 2.975888] qcom_wdt 17980000.watchdog: IRQ index 0 not found

    This is also seen on SC7180, SM8150 SoCs as well.
    Fix this by using platform_get_irq_optional() instead.

    Fixes: 36375491a4395654 ("watchdog: qcom: support pre-timeout when the bark irq is available")
    Signed-off-by: Sai Prakash Ranjan
    Reviewed-by: Bjorn Andersson
    Reviewed-by: Guenter Roeck
    Reviewed-by: Stephen Boyd
    Link: https://lore.kernel.org/r/20191213064934.4112-1-saiprakash.ranjan@codeaurora.org
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Greg Kroah-Hartman

    Sai Prakash Ranjan
     

11 Feb, 2020

1 commit

  • commit 69503e585192fdd84b240f18a0873d20e18a2e0a upstream.

    After the commit 44ea39420fc9 ("drivers/watchdog: make use of
    devm_register_reboot_notifier()") the struct notifier_block reboot_nb in
    the struct watchdog_device is removed from the reboot notifiers chain at
    the time watchdog's chardev is closed. But at least in i6300esb.c case
    reboot_nb is embedded in the struct esb_dev which can be freed on its
    device removal and before the chardev is closed, thus UAF at reboot:

    [ 7.728581] esb_probe: esb_dev.watchdog_device ffff91316f91ab28
    ts# uname -r note the address ^^^
    5.5.0-rc5-ae6088-wdog
    ts# ./openwdog0 &
    [1] 696
    ts# opened /dev/watchdog0, sleeping 10s...
    ts# echo 1 > /sys/devices/pci0000\:00/0000\:00\:09.0/remove
    [ 178.086079] devres:rel_nodes: dev ffff91317668a0b0 data ffff91316f91ab28
    esb_dev.watchdog_device.reboot_nb memory is freed here ^^^
    ts# ...woken up
    [ 181.459010] devres:rel_nodes: dev ffff913171781000 data ffff913174a1dae8
    [ 181.460195] devm_unreg_reboot_notifier: res ffff913174a1dae8 nb ffff91316f91ab78
    attempt to use memory already freed ^^^
    [ 181.461063] devm_unreg_reboot_notifier: nb->call 6b6b6b6b6b6b6b6b
    [ 181.461243] devm_unreg_reboot_notifier: nb->next 6b6b6b6b6b6b6b6b
    freed memory is filled with a slub poison ^^^
    [1]+ Done ./openwdog0
    ts# reboot
    [ 229.921862] systemd-shutdown[1]: Rebooting.
    [ 229.939265] notifier_call_chain: nb ffffffff9c6c2f20 nb->next ffffffff9c6d50c0
    [ 229.943080] notifier_call_chain: nb ffffffff9c6d50c0 nb->next 6b6b6b6b6b6b6b6b
    [ 229.946054] notifier_call_chain: nb 6b6b6b6b6b6b6b6b INVAL
    [ 229.957584] general protection fault: 0000 [#1] SMP
    [ 229.958770] CPU: 0 PID: 1 Comm: systemd-shutdow Not tainted 5.5.0-rc5-ae6088-wdog
    [ 229.960224] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), ...
    [ 229.963288] RIP: 0010:notifier_call_chain+0x66/0xd0
    [ 229.969082] RSP: 0018:ffffb20dc0013d88 EFLAGS: 00010246
    [ 229.970812] RAX: 000000000000002e RBX: 6b6b6b6b6b6b6b6b RCX: 00000000000008b3
    [ 229.972929] RDX: 0000000000000000 RSI: 0000000000000096 RDI: ffffffff9ccc46ac
    [ 229.975028] RBP: 0000000000000001 R08: 0000000000000000 R09: 00000000000008b3
    [ 229.977039] R10: 0000000000000001 R11: ffffffff9c26c740 R12: 0000000000000000
    [ 229.979155] R13: 6b6b6b6b6b6b6b6b R14: 0000000000000000 R15: 00000000fffffffa
    ... slub_debug=FZP poison ^^^
    [ 229.989089] Call Trace:
    [ 229.990157] blocking_notifier_call_chain+0x43/0x59
    [ 229.991401] kernel_restart_prepare+0x14/0x30
    [ 229.992607] kernel_restart+0x9/0x30
    [ 229.993800] __do_sys_reboot+0x1d2/0x210
    [ 230.000149] do_syscall_64+0x3d/0x130
    [ 230.001277] entry_SYSCALL_64_after_hwframe+0x44/0xa9
    [ 230.002639] RIP: 0033:0x7f5461bdd177
    [ 230.016402] Modules linked in: i6300esb
    [ 230.050261] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

    Fix the crash by reverting 44ea39420fc9 so unregister_reboot_notifier()
    is called when watchdog device is removed. This also makes handling of
    the reboot notifier unified with the handling of the restart handler,
    which is freed with unregister_restart_handler() in the same place.

    Fixes: 44ea39420fc9 ("drivers/watchdog: make use of devm_register_reboot_notifier()")
    Cc: stable@vger.kernel.org # v4.15+
    Signed-off-by: Vladis Dronov
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20200108125347.6067-1-vdronov@redhat.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Greg Kroah-Hartman

    Vladis Dronov
     

01 Feb, 2020

3 commits

  • [ Upstream commit dcbce5fbcc69bf2553f650004aad44bf390eca73 ]

    Fix:

    orion_wdt f1020300.watchdog: IRQ index 1 not found

    which is caused by platform_get_irq() now complaining when optional
    IRQs are not found. Neither interrupt for orion is required, so
    make them both optional.

    Signed-off-by: Russell King
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/E1iahcN-0000AT-Co@rmk-PC.armlinux.org.uk
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Sasha Levin

    Russell King
     
  • [ Upstream commit a76dfb859cd42df6e3d1910659128ffcd2fb6ba2 ]

    Platform device aliases were missing so module autoloading
    did not work.

    Signed-off-by: Andreas Kemnade
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20191213214802.22268-1-andreas@kemnade.info
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Sasha Levin

    Andreas Kemnade
     
  • [ Upstream commit da9e3f4e30a53cd420cf1e6961c3b4110f0f21f0 ]

    max77620_wdt uses watchdog core functions. Enable CONFIG_WATCHDOG_CORE
    to fix potential build errors.

    Signed-off-by: David Engraf
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20191127084617.16937-1-david.engraf@sysgo.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Sasha Levin

    David Engraf
     

26 Jan, 2020

1 commit

  • commit 39e68d9e7ab276880980ee5386301fb218202192 upstream.

    The device driver data saved the 'struct sprd_wdt' object, it is
    incorrect to get 'struct watchdog_device' object from the driver
    data, thus fix it.

    Fixes: 477603467009 ("watchdog: Add Spreadtrum watchdog driver")
    Reported-by: Dongwei Wang
    Signed-off-by: Shuiqing Li
    Signed-off-by: Baolin Wang
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/76d4687189ec940baa90cb8d679a8d4c8f02ee80.1573210405.git.baolin.wang@linaro.org
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Greg Kroah-Hartman

    Shuiqing Li
     

09 Jan, 2020

1 commit

  • commit 9a6c274ac1c4346f5384f2290caeb42dc674c471 upstream.

    If TQMX86_WDT is y and WATCHDOG_CORE is m, building fails:

    drivers/watchdog/tqmx86_wdt.o: In function `tqmx86_wdt_probe':
    tqmx86_wdt.c:(.text+0x46e): undefined reference to `watchdog_init_timeout'
    tqmx86_wdt.c:(.text+0x4e0): undefined reference to `devm_watchdog_register_device'

    Select WATCHDOG_CORE to fix this.

    Reported-by: Hulk Robot
    Fixes: e3c21e088f89 ("watchdog: tqmx86: Add watchdog driver for the IO controller")
    Signed-off-by: YueHaibing
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20191206124259.25880-1-yuehaibing@huawei.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Greg Kroah-Hartman

    YueHaibing
     

05 Jan, 2020

3 commits

  • [ Upstream commit 72139dfa2464e43957d330266994740bb7be2535 ]

    The struct cdev is embedded in the struct watchdog_core_data. In the
    current code, we manage the watchdog_core_data with a kref, but the
    cdev is manged by a kobject. There is no any relationship between
    this kref and kobject. So it is possible that the watchdog_core_data is
    freed before the cdev is entirely released. We can easily get the
    following call trace with CONFIG_DEBUG_KOBJECT_RELEASE and
    CONFIG_DEBUG_OBJECTS_TIMERS enabled.
    ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x38
    WARNING: CPU: 23 PID: 1028 at lib/debugobjects.c:481 debug_print_object+0xb0/0xf0
    Modules linked in: softdog(-) deflate ctr twofish_generic twofish_common camellia_generic serpent_generic blowfish_generic blowfish_common cast5_generic cast_common cmac xcbc af_key sch_fq_codel openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4
    CPU: 23 PID: 1028 Comm: modprobe Not tainted 5.3.0-next-20190924-yoctodev-standard+ #180
    Hardware name: Marvell OcteonTX CN96XX board (DT)
    pstate: 00400009 (nzcv daif +PAN -UAO)
    pc : debug_print_object+0xb0/0xf0
    lr : debug_print_object+0xb0/0xf0
    sp : ffff80001cbcfc70
    x29: ffff80001cbcfc70 x28: ffff800010ea2128
    x27: ffff800010bad000 x26: 0000000000000000
    x25: ffff80001103c640 x24: ffff80001107b268
    x23: ffff800010bad9e8 x22: ffff800010ea2128
    x21: ffff000bc2c62af8 x20: ffff80001103c600
    x19: ffff800010e867d8 x18: 0000000000000060
    x17: 0000000000000000 x16: 0000000000000000
    x15: ffff000bd7240470 x14: 6e6968207473696c
    x13: 5f72656d6974203a x12: 6570797420746365
    x11: 6a626f2029302065 x10: 7461747320657669
    x9 : 7463612820657669 x8 : 3378302f3078302b
    x7 : 0000000000001d7a x6 : ffff800010fd5889
    x5 : 0000000000000000 x4 : 0000000000000000
    x3 : 0000000000000000 x2 : ffff000bff948548
    x1 : 276a1c9e1edc2300 x0 : 0000000000000000
    Call trace:
    debug_print_object+0xb0/0xf0
    debug_check_no_obj_freed+0x1e8/0x210
    kfree+0x1b8/0x368
    watchdog_cdev_unregister+0x88/0xc8
    watchdog_dev_unregister+0x38/0x48
    watchdog_unregister_device+0xa8/0x100
    softdog_exit+0x18/0xfec4 [softdog]
    __arm64_sys_delete_module+0x174/0x200
    el0_svc_handler+0xd0/0x1c8
    el0_svc+0x8/0xc

    This is a common issue when using cdev embedded in a struct.
    Fortunately, we already have a mechanism to solve this kind of issue.
    Please see commit 233ed09d7fda ("chardev: add helper function to
    register char devs with a struct device") for more detail.

    In this patch, we choose to embed the struct device into the
    watchdog_core_data, and use the API provided by the commit 233ed09d7fda
    to make sure that the release of watchdog_core_data and cdev are
    in sequence.

    Signed-off-by: Kevin Hao
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20191008112934.29669-1-haokexin@gmail.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Sasha Levin

    Kevin Hao
     
  • [ Upstream commit a19f89335f4bda3d77d991c96583e3e51856acbb ]

    When PREEMPT_RT is enabled, all hrtimer expiry functions are
    deferred for execution into the context of ksoftirqd unless otherwise
    annotated.

    Deferring the expiry of the hrtimer used by the watchdog core, however,
    is a waste, as the callback does nothing but queue a kthread work item
    and wakeup watchdogd.

    It's worst then that, too: the deferral through ksoftirqd also means
    that for correct behavior a user must adjust the scheduling parameters
    of both watchdogd _and_ ksoftirqd, which is unnecessary and has other
    side effects (like causing unrelated expiry functions to execute at
    potentially elevated priority).

    Instead, mark the hrtimer used by the watchdog core as being _HARD to
    allow it's execution directly from hardirq context. The work done in
    this expiry function is well-bounded and minimal.

    A user still must adjust the scheduling parameters of the watchdogd
    to be correct w.r.t. their application needs.

    Link: https://lkml.kernel.org/r/0e02d8327aeca344096c246713033887bc490dd7.1538089180.git.julia@ni.com
    Cc: Guenter Roeck
    Reported-and-tested-by: Steffen Trumtrar
    Reported-by: Tim Sander
    Signed-off-by: Julia Cartwright
    Acked-by: Guenter Roeck
    [bigeasy: use only HRTIMER_MODE_REL_HARD]
    Signed-off-by: Sebastian Andrzej Siewior
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20191105144506.clyadjbvnn7b7b2m@linutronix.de
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Sasha Levin

    Julia Cartwright
     
  • [ Upstream commit 6083ab7b2f3f25022e2e8f4c42f14a8521f47873 ]

    The following hang is observed when a 'reboot' command is issued:

    # reboot
    # Stopping network: OK
    Stopping klogd: OK
    Stopping syslogd: OK
    umount: devtmpfs busy - remounted read-only
    [ 8.612079] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
    The system is going down NOW!
    Sent SIGTERM to all processes
    Sent SIGKILL to all processes
    Requesting system reboot
    [ 10.694753] reboot: Restarting system
    [ 11.699008] Reboot failed -- System halted

    Fix this problem by adding a .restart ops member.

    Fixes: 41b630f41bf7 ("watchdog: Add i.MX7ULP watchdog support")
    Signed-off-by: Fabio Estevam
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20191029174037.25381-1-festevam@gmail.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Sasha Levin

    Fabio Estevam
     

13 Dec, 2019

1 commit

  • [ Upstream commit c04571251b3d842096f1597f5d4badb508be016d ]

    The ast2600 no longer uses bit 4 in the control register to indicate a
    1MHz clock (It now controls whether this watchdog is reset by a SOC
    reset). This means we do not want to set it. It also does not need to be
    set for the ast2500, as it is read-only on that SoC.

    The comment next to the clock rate selection wandered away from where it
    was set, so put it back next to the register setting it's describing.

    Fixes: b3528b487448 ("watchdog: aspeed: Add support for AST2600")
    Signed-off-by: Joel Stanley
    Reviewed-by: Cédric Le Goater
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20191108032905.22463-1-joel@jms.id.au
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Sasha Levin

    Joel Stanley
     

05 Nov, 2019

5 commits

  • The bd70528 watchdog driver is probed by MFD driver. Add MODULE_ALIAS
    in order to allow udev to load the module when MFD sub-device cell for
    watchdog is added.

    Fixes: bbc88a0ec9f37 ("watchdog: bd70528: Initial support for ROHM BD70528 watchdog block")
    Signed-off-by: Matti Vaittinen
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Matti Vaittinen
     
  • SCU firmware calculates pretimeout based on current time stamp
    instead of watchdog timeout stamp, need to convert the pretimeout
    to SCU firmware's timeout value.

    Fixes: 15f7d7fc5542 ("watchdog: imx_sc: Add pretimeout support")
    Signed-off-by: Anson Huang
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Anson Huang
     
  • The left time value is wrong when we get it by sysfs. The left time value
    should be equal to preset timeout value minus elapsed time value. According
    to the Meson-GXB/GXL datasheets which can be found at [0], the timeout value
    is saved to BIT[0-15] of the WATCHDOG_TCNT, and elapsed time value is saved
    to BIT[16-31] of the WATCHDOG_TCNT.

    [0]: http://linux-meson.com

    Fixes: 683fa50f0e18 ("watchdog: Add Meson GXBB Watchdog Driver")
    Signed-off-by: Xingyu Chen
    Acked-by: Neil Armstrong
    Reviewed-by: Kevin Hilman
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Xingyu Chen
     
  • When an IRQ is present in the dts, the probe function shall fail if
    the interrupt can not be registered.

    The probe function shall also be retried if getting the irq is being
    deferred.

    Signed-off-by: Jorge Ramirez-Ortiz
    Reviewed-by: Loic Poulain
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Jorge Ramirez-Ortiz
     
  • The compat_ptr_ioctl() infrastructure did not make it into
    linux-5.4, so cpwd now fails to build.

    Fix it by using an open-coded version.

    Fixes: 68f28b01fb9e ("watchdog: cpwd: use generic compat_ptr_ioctl")
    Signed-off-by: Arnd Bergmann
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Arnd Bergmann
     

28 Sep, 2019

1 commit

  • Pull watchdog updates from Wim Van Sebroeck:

    - addition of AST2600, i.MX7ULP and F81803 watchdog support

    - removal of the w90x900 and ks8695 drivers

    - ziirave_wdt improvements

    - small fixes and improvements

    * tag 'linux-watchdog-5.4-rc1' of git://www.linux-watchdog.org/linux-watchdog: (51 commits)
    watchdog: f71808e_wdt: Add F81803 support
    watchdog: qcom: remove unnecessary variable from private storage
    watchdog: qcom: support pre-timeout when the bark irq is available
    watchdog: imx_sc: this patch just fixes whitespaces
    watchdog: apseed: Add access_cs0 option for alt-boot
    watchdog: aspeed: add support for dual boot
    watchdog: orion_wdt: use timer1 as a pretimeout
    watchdog: Add i.MX7ULP watchdog support
    dt-bindings: watchdog: Add i.MX7ULP bindings
    dt-bindings: watchdog: sun4i: Add the watchdog clock
    dt-bindings: watchdog: sun4i: Add the watchdog interrupts
    dt-bindings: watchdog: Convert Allwinner watchdog to a schema
    dt-bindings: watchdog: Add YAML schemas for the generic watchdog bindings
    watchdog: aspeed: Add support for AST2600
    dt-bindings: watchdog: Add ast2600 compatible
    watchdog: ziirave_wdt: Update checked I2C functionality mask
    watchdog: ziirave_wdt: Drop ziirave_firm_write_block_data()
    watchdog: ziirave_wdt: Fix DOWNLOAD_START payload
    watchdog: ziirave_wdt: Drop status polling code
    watchdog: ziirave_wdt: Fix RESET_PROCESSOR payload
    ...

    Linus Torvalds
     

25 Sep, 2019

1 commit

  • Pull i2c updates from Wolfram Sang:

    - new driver for ICY, an Amiga Zorro card :)

    - axxia driver gained slave mode support, NXP driver gained ACPI

    - the slave EEPROM backend gained 16 bit address support

    - and lots of regular driver updates and reworks

    * 'i2c/for-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (52 commits)
    i2c: tegra: Move suspend handling to NOIRQ phase
    i2c: imx: ACPI support for NXP i2c controller
    i2c: uniphier(-f): remove all dev_dbg()
    i2c: uniphier(-f): use devm_platform_ioremap_resource()
    i2c: slave-eeprom: Add comment about address handling
    i2c: exynos5: Remove IRQF_ONESHOT
    i2c: stm32f7: Make structure stm32f7_i2c_algo constant
    i2c: cht-wc: drop check because i2c_unregister_device() is NULL safe
    i2c-eeprom_slave: Add support for more eeprom models
    i2c: fsi: Add of_put_node() before break
    i2c: synquacer: Make synquacer_i2c_ops constant
    i2c: hix5hd2: Remove IRQF_ONESHOT
    i2c: i801: Use iTCO version 6 in Cannon Lake PCH and beyond
    watchdog: iTCO: Add support for Cannon Lake PCH iTCO
    i2c: iproc: Make bcm_iproc_i2c_quirks constant
    i2c: iproc: Add full name of devicetree node to adapter name
    i2c: piix4: Add ACPI support
    i2c: piix4: Fix probing of reserved ports on AMD Family 16h Model 30h
    i2c: ocores: use request_any_context_irq() to register IRQ handler
    i2c: designware: Fix optional reset error handling
    ...

    Linus Torvalds
     

17 Sep, 2019

20 commits

  • This adds watchdog support for the Fintek F81803 Super I/O chip.

    Testing was done on the Seneca XK-QUAD.

    Signed-off-by: Jaret Cantu
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190912175550.9340-1-jaret.cantu@timesys.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Jaret Cantu
     
  • there is no need to continue keeping the clock in private storage.

    Signed-off-by: Jorge Ramirez-Ortiz
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190906205411.31666-3-jorge.ramirez-ortiz@linaro.org
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Jorge Ramirez-Ortiz
     
  • Use the bark interrupt as the pre-timeout notifier whenever this
    interrupt is available.

    By default, the pretimeout notification shall occur one second earlier
    than the timeout.

    Signed-off-by: Jorge Ramirez-Ortiz
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190906205411.31666-2-jorge.ramirez-ortiz@linaro.org
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Jorge Ramirez-Ortiz
     
  • Fix only whitespace errors in imx_sc_wdt_probe()

    Signed-off-by: Oliver Graute
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190905143644.20952-1-oliver.graute@kococonnector.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Oliver Graute
     
  • Set WDT_CLEAR_TIMEOUT_AND_BOOT_CODE_SELECTION into WDT_CLEAR_TIMEOUT_STATUS
    to clear out boot code source and re-enable access to the primary SPI flash
    chip while booted via wdt2 from the alternate chip.

    AST2400 datasheet says:
    "In the 2nd flash booting mode, all the address mapping to CS0# would be
    re-directed to CS1#. And CS0# is not accessible under this mode. To access
    CS0#, firmware should clear the 2nd boot mode register in the WDT2 status
    register WDT30.bit[1]."

    Signed-off-by: Ivan Mikhaylov
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190828102402.13155-4-i.mikhaylov@yadro.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Ivan Mikhaylov
     
  • The orion watchdog can either reset the CPU or generate an interrupt.
    The interrupt would be useful for debugging as it provides panic()
    output about the watchdog expiry, however if the interrupt is used the
    watchdog can't reset the CPU in the event of being stuck in a loop with
    interrupts disabled or if the CPU is prevented from accessing memory
    (e.g. an unterminated DMA).

    The Armada SoCs have spare timers that aren't currently used by the
    Linux kernel. We can use timer1 to provide a pre-timeout ahead of the
    watchdog timer and provide the possibility of gathering debug before the
    reset triggers.

    Signed-off-by: Chris Packham
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190829215224.27956-1-chris.packham@alliedtelesis.co.nz
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Chris Packham
     
  • The i.MX7ULP Watchdog Timer (WDOG) module is an independent timer
    that is available for system use.
    It provides a safety feature to ensure that software is executing
    as planned and that the CPU is not stuck in an infinite loop or
    executing unintended code. If the WDOG module is not serviced
    (refreshed) within a certain period, it resets the MCU.

    Add driver support for i.MX7ULP watchdog.

    Signed-off-by: Anson Huang
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/1566999303-18795-2-git-send-email-Anson.Huang@nxp.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Anson Huang
     
  • The ast2600 can be supported by the same code as the ast2500.

    Signed-off-by: Ryan Chen
    Signed-off-by: Joel Stanley
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190819051738.17370-3-joel@jms.id.au
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Ryan Chen
     
  • Update checked I2C functionality mask to reflect all of the SMBus
    primitives used by this driver.

    Signed-off-by: Andrey Smirnov
    Cc: Chris Healy
    Cc: Guenter Roeck
    Cc: Rick Ramstetter
    Cc: linux-watchdog@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190812200906.31344-23-andrew.smirnov@gmail.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Andrey Smirnov
     
  • There's only one user of ziirave_firm_write_block_data(), so we may as
    well inline it.

    Signed-off-by: Andrey Smirnov
    Cc: Chris Healy
    Cc: Guenter Roeck
    Cc: Rick Ramstetter
    Cc: linux-watchdog@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190812200906.31344-22-andrew.smirnov@gmail.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Andrey Smirnov
     
  • Bootloader firmware expects the following traffic for DOWNLOAD_END:

    S Addr Wr [A] 0x10 [A] P

    using ziirave_firm_write_byte() will result in

    S Addr Wr [A] 0x10 [A] 0x01 [A] 0x01 [A] P

    which happens to work because firmware will ignore any extra bytes
    sent. Fix this by converting the code to use i2c_smbus_write_byte()
    instead.

    Signed-off-by: Andrey Smirnov
    Cc: Chris Healy
    Cc: Guenter Roeck
    Cc: Rick Ramstetter
    Cc: linux-watchdog@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190812200906.31344-21-andrew.smirnov@gmail.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Andrey Smirnov
     
  • Bootloader firmware doesn't implement DOWNLOAD_START or
    DOWNLOAD_PACKET in a non-blocking way. It will stretch the clock of
    the first status byte read until the operation is complete. Polling
    for the status is not really necessary since it will always succed on
    the first try. Replace polling code with a simple single byte read to
    simplify things.

    Signed-off-by: Andrey Smirnov
    Cc: Chris Healy
    Cc: Guenter Roeck
    Cc: Rick Ramstetter
    Cc: linux-watchdog@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190812200906.31344-20-andrew.smirnov@gmail.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Andrey Smirnov
     
  • Bootloader firmware expects the following traffic for
    RESET_PROCESSOR:

    S Addr Wr [A] 0x0b [A] 0x01 [A] P

    using ziirave_firm_write_byte() will result in

    S Addr Wr [A] 0x0b [A] 0x01 [A] 0x01 [A] P

    which happens to work because firmware will ignore any extra bytes and
    expected magic value matches byte count sent by
    i2c_smbus_write_block_data(). Fix this by converting the code to use
    i2c_smbus_write_byte_data() instead.

    Signed-off-by: Andrey Smirnov
    Cc: Chris Healy
    Cc: Guenter Roeck
    Cc: Rick Ramstetter
    Cc: linux-watchdog@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190812200906.31344-19-andrew.smirnov@gmail.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Andrey Smirnov
     
  • Bootloader firmware expects the following traffic for DOWNLOAD_END:

    S Addr Wr [A] 0x11 [A] P

    using ziirave_firm_write_byte() will result in

    S Addr Wr [A] 0x11 [A] 0x01 [A] 0x01 [A] P

    which happens to work because firmware will ignore any extra bytes
    sent. Fix this by converting the code to use i2c_smbus_write_byte()
    instead.

    Signed-off-by: Andrey Smirnov
    Cc: Chris Healy
    Cc: Guenter Roeck
    Cc: Rick Ramstetter
    Cc: linux-watchdog@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190812200906.31344-18-andrew.smirnov@gmail.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Andrey Smirnov
     
  • Bootloader firmware expects the following traffic for
    JUMP_TO_BOOTLOADER:

    S Addr Wr [A] 0x0c [A] 0x01 [A] P

    using ziirave_firm_write_byte() will result in

    S Addr Wr [A] 0x0c [A] 0x01 [A] 0x01 [A] P

    which happens to work because firmware will ignore any extra bytes and
    expected magic value matches byte count sent by
    i2c_smbus_write_block_data(). Fix this by converting the code to use
    i2c_smbus_write_byte_data() instead.

    Signed-off-by: Andrey Smirnov
    Cc: Chris Healy
    Cc: Guenter Roeck
    Cc: Rick Ramstetter
    Cc: linux-watchdog@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190812200906.31344-17-andrew.smirnov@gmail.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Andrey Smirnov
     
  • Fix misleading error message in ziirave_wdt_init_duration(). Saying
    "unable to set ..." implies that an attempt at communication with
    watchdog device has taken palce and was not successful. In this case,
    however, all it indicates is that no reset pulse duration was
    specified either via kernel parameter or Device Tree. Re-phase the log
    message to be more clear about benign nature of this event.

    Signed-off-by: Andrey Smirnov
    Cc: Chris Healy
    Cc: Guenter Roeck
    Cc: Rick Ramstetter
    Cc: linux-watchdog@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190812200906.31344-16-andrew.smirnov@gmail.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Andrey Smirnov
     
  • Bootloader code will ignore any attempts to write data to any flash
    area outside of [ZIIRAVE_FIRM_FLASH_MEMORY_START;
    ZIIRAVE_FIRM_FLASH_MEMORY_END]. Firmware update code already have an
    appropriate check to skip those areas when validating updated
    firmware. Firmware programming code, OTOH, does not and will
    needlessly send no-op I2C traffic. Add an appropriate check to
    __ziirave_firm_write_pkt() so as to save all of that wasted effort.

    While at it, normalize all of the address handling code to use full
    32-bit address in units of bytes and convert it to an appropriate
    value only in places where that is necessary.

    Signed-off-by: Andrey Smirnov
    Cc: Chris Healy
    Cc: Guenter Roeck
    Cc: Rick Ramstetter
    Cc: linux-watchdog@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190812200906.31344-15-andrew.smirnov@gmail.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Andrey Smirnov
     
  • We only compare first 'len' bytes of read firmware, so we don't need
    to read more that that.

    Signed-off-by: Andrey Smirnov
    Cc: Chris Healy
    Cc: Guenter Roeck
    Cc: Rick Ramstetter
    Cc: linux-watchdog@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190812200906.31344-14-andrew.smirnov@gmail.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Andrey Smirnov
     
  • Ihex_next_binrec() will return NULL if next record's 'len' is zero, so
    explicit checks for that in the driver are unnecessary. Drop them.

    Signed-off-by: Andrey Smirnov
    Cc: Chris Healy
    Cc: Guenter Roeck
    Cc: Rick Ramstetter
    Cc: linux-watchdog@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190812200906.31344-13-andrew.smirnov@gmail.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Andrey Smirnov
     
  • Instead of doing this explicitly use put_unaligned_le16() to place
    16-bit address value into command payload.

    Signed-off-by: Andrey Smirnov
    Cc: Chris Healy
    Cc: Guenter Roeck
    Cc: Rick Ramstetter
    Cc: linux-watchdog@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190812200906.31344-12-andrew.smirnov@gmail.com
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Andrey Smirnov