25 Feb, 2017

5 commits

  • Functions marked static inline might not be inlined so a driver-specific
    prefix for function name helps when looking through call backtrace.

    Signed-off-by: Krzysztof Kozlowski
    Signed-off-by: Guenter Roeck

    Krzysztof Kozlowski
     
  • Replace the 'debug' module parameter and pr_info() with proper device
    dynamic debug calls because this is the preferred and flexible way of
    enabling debugging printks.

    Also remove some obvious debug printks.

    Signed-off-by: Krzysztof Kozlowski
    Signed-off-by: Guenter Roeck

    Krzysztof Kozlowski
     
  • In soft (no-reboot) mode, the driver self-pings watchdog upon expiration
    of an interrupt. However the interrupt itself was not cleared thus on
    first hit, the system enters infinite interrupt handling loop.

    On Odroid U3 (Exynos4412), when booted with s3c2410_wdt.soft_noboot=1
    argument the console is flooded:
    # killall -9 watchdog
    [ 60.523760] s3c2410-wdt 10060000.watchdog: watchdog timer expired (irq)
    [ 60.536744] s3c2410-wdt 10060000.watchdog: watchdog timer expired (irq)

    Fix this by writing something to the WTCLRINT register to clear the
    interrupt. The register WTCLRINT however appeared in S3C6410 so a new
    watchdog quirk and flavor are needed.

    Signed-off-by: Krzysztof Kozlowski
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck

    Krzysztof Kozlowski
     
  • The CONFIG prefix from defines in the s3c2410_wdt.c might suggest that
    these constants come from Kconfig.

    Signed-off-by: Krzysztof Kozlowski
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck

    Krzysztof Kozlowski
     
  • Declare watchdog_ops structures as const as they are only stored in the
    ops field of a watchdog_device structure. This field is of type const, so
    watchdog_ops structures having this property can be made const too.
    Done using Coccinelle:

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

    @ok@
    struct watchdog_device w;
    identifier r.x;
    position p;
    @@
    w.ops=&x@p;

    @bad@
    position p != {r.p,ok.p};
    identifier r.x;
    @@
    x@p

    @depends on !bad disable optional_qualifier@
    identifier r.x;
    @@
    +const
    struct watchdog_ops x;

    File size details before and after patching.
    First line of every .o file shows the file size before patching
    and second line shows the size after patching.

    text data bss dec hex filename

    1340 544 0 1884 75c drivers/watchdog/bcm_kona_wdt.o
    1436 440 0 1876 754 drivers/watchdog/bcm_kona_wdt.o

    1176 544 4 1724 6bc drivers/watchdog/digicolor_wdt.o
    1272 440 4 1716 6b4 drivers/watchdog/digicolor_wdt.o

    925 580 89 1594 63a drivers/watchdog/ep93xx_wdt.o
    1021 476 89 1586 632 drivers/watchdog/ep93xx_wdt.o

    4932 288 17 5237 1475 drivers/watchdog/s3c2410_wdt.o
    5028 192 17 5237 1475 drivers/watchdog/s3c2410_wdt.o

    1977 292 1 2270 8de drivers/watchdog/sama5d4_wdt.o
    2073 196 1 2270 8de drivers/watchdog/sama5d4_wdt.o

    1375 484 1 1860 744 drivers/watchdog/sirfsoc_wdt.o
    1471 380 1 1852 73c drivers/watchdog/sirfsoc_wdt.o

    Size remains the same for the files drivers/watchdog/diag288_wdt.o
    drivers/watchdog/asm9260_wdt.o and drivers/watchdog/atlas7_wdt.o

    The following .o files did not compile:
    drivers/watchdog/sun4v_wdt.o, drivers/watchdog/sbsa_gwdt.o,
    drivers/watchdog/rt2880_wdt.o, drivers/watchdog/booke_wdt.o
    drivers/watchdog/mt7621_wdt.o

    Signed-off-by: Bhumika Goyal
    Signed-off-by: Guenter Roeck

    Bhumika Goyal
     

17 Mar, 2016

1 commit

  • The watchdog maximum timeout value is determined by the number of bits
    for the interval timer counter, its source clock frequency, the number
    of bits of the prescaler and maximum divider value.

    This can be calculated with the following equation:

    max_timeout = counter / (freq / (max_prescale + 1) / max_divider)

    Setting a maximum timeout value will allow the watchdog core to refuse
    user-space calls to the WDIOC_SETTIMEOUT ioctl that sets not supported
    timeout values.

    For example, systemd tries to set a timeout of 10 minutes on reboot to
    ensure that the machine will be rebooted even if a reboot failed. This
    leads to the following error message on an Exynos5422 Odroid XU4 board:

    [ 147.986045] s3c2410-wdt 101d0000.watchdog: timeout 600 too big

    Reported-by: Krzysztof Kozlowski
    Signed-off-by: Javier Martinez Canillas
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Javier Martinez Canillas
     

01 Mar, 2016

1 commit


13 Dec, 2015

1 commit


10 Sep, 2015

1 commit

  • /sys/class/watchdog/watchdogn/device/modalias can help to identify the
    driver/module for a given watchdog node. However, many wdt devices do not
    set their parent and so, we do not see an entry for device in sysfs for
    such devices.

    This patch fixes parent of watchdog_device so that
    /sys/class/watchdog/watchdogn/device is populated.

    Exceptions: booke, diag288, octeon, softdog and w83627hf -- They do not
    have any parent. Not sure, how we can identify driver for these devices.

    Signed-off-by: Pratyush Anand
    Reviewed-by: Johannes Thumshirn
    Acked-by: Guenter Roeck
    Acked-by: H Hartley Sweeten
    Acked-by: Lee Jones
    Acked-by: Lubomir Rintel
    Acked-by: Maxime Coquelin
    Acked-by: Thierry Reding
    Acked-by: Viresh Kumar
    Acked-by: Linus Walleij
    Signed-off-by: Wim Van Sebroeck

    Pratyush Anand
     

15 Dec, 2014

1 commit

  • Pull driver core update from Greg KH:
    "Here's the set of driver core patches for 3.19-rc1.

    They are dominated by the removal of the .owner field in platform
    drivers. They touch a lot of files, but they are "simple" changes,
    just removing a line in a structure.

    Other than that, a few minor driver core and debugfs changes. There
    are some ath9k patches coming in through this tree that have been
    acked by the wireless maintainers as they relied on the debugfs
    changes.

    Everything has been in linux-next for a while"

    * tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits)
    Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries"
    fs: debugfs: add forward declaration for struct device type
    firmware class: Deletion of an unnecessary check before the function call "vunmap"
    firmware loader: fix hung task warning dump
    devcoredump: provide a one-way disable function
    device: Add dev__once variants
    ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries
    ath: use seq_file api for ath9k debugfs files
    debugfs: add helper function to create device related seq_file
    drivers/base: cacheinfo: remove noisy error boot message
    Revert "core: platform: add warning if driver has no owner"
    drivers: base: support cpu cache information interface to userspace via sysfs
    drivers: base: add cpu_device_create to support per-cpu devices
    topology: replace custom attribute macros with standard DEVICE_ATTR*
    cpumask: factor out show_cpumap into separate helper function
    driver core: Fix unbalanced device reference in drivers_probe
    driver core: fix race with userland in device_add()
    sysfs/kernfs: make read requests on pre-alloc files use the buffer.
    sysfs/kernfs: allow attributes to request write buffer be pre-allocated.
    fs: sysfs: return EGBIG on write if offset is larger than file size
    ...

    Linus Torvalds
     

06 Dec, 2014

1 commit


04 Nov, 2014

1 commit


21 Oct, 2014

2 commits


20 Oct, 2014

1 commit


31 Mar, 2014

3 commits


29 Jan, 2014

4 commits

  • A good watchdog driver is supposed to report when it was responsible
    for resetting the system. Implement this for the s3c2410, at least on
    exynos5250 and exynos5420 where we already have a pointer to the PMU
    registers to read the information.

    Note that exynos4 SoCs also provide the reset status, but providing
    that is left as an exercise for future changes and is not plumbed up
    in this patch series. Also note the exynos4 SoCs don't appear to need
    any PMU config, which is why this patch separates the concepts of
    having PMU Registers vs. needing PMU Config.

    Signed-off-by: Doug Anderson
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Doug Anderson
     
  • Add device tree support for exynos5250 and 5420 SoCs and use syscon regmap interface
    to configure AUTOMATIC_WDT_RESET_DISABLE and MASK_WDT_RESET_REQUEST registers of PMU
    to mask/unmask enable/disable of watchdog in probe and s2r scenarios.

    Signed-off-by: Leela Krishna Amudala
    Signed-off-by: Doug Anderson
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Leela Krishna Amudala
     
  • The existing watchdog timeout worked OK but didn't deal with
    rounding in an ideal way when dividing out all of its clocks.

    Specifically if you had a timeout of 32 seconds and an input clock of
    66666666, you'd end up setting a timeout of 31.9998 seconds and
    reporting a timeout of 31 seconds.

    Specifically DBG printouts showed:
    s3c2410wdt_set_heartbeat: count=16666656, timeout=32, freq=520833
    s3c2410wdt_set_heartbeat: timeout=32, divisor=255, count=16666656 (0000ff4f)
    and the final timeout reported to the user was:
    ((count / divisor) * divisor) / freq
    (0xff4f * 255) / 520833 = 31 (truncated from 31.9998)
    the technically "correct" value is:
    (0xff4f * 255) / (66666666.0 / 128) = 31.9998

    By using "DIV_ROUND_UP" we can be a little more correct.
    s3c2410wdt_set_heartbeat: count=16666688, timeout=32, freq=520834
    s3c2410wdt_set_heartbeat: timeout=32, divisor=255, count=16666688 (0000ff50)
    and the final timeout reported to the user:
    (0xff50 * 255) / 520834 = 32
    the technically "correct" value is:
    (0xff50 * 255) / (66666666.0 / 128) = 32.0003

    We'll use a DIV_ROUND_UP to solve this, generally erroring on the side
    of reporting shorter values to the user and setting the watchdog to
    slightly longer than requested:
    * Round input frequency up to assume watchdog is counting faster.
    * Round divisions by divisor up to give us extra time.

    At the same time we can avoid a for loop by just doing the right math.

    Signed-off-by: Doug Anderson
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Doug Anderson
     
  • On modern SoCs the watchdog timer is parented on a clock that doesn't
    change every time we have a cpufreq change. That means we don't need
    to constantly adjust the watchdog timer, so avoid registering for and
    dealing with cpufreq transitions unless we've actually got
    CONFIG_ARM_S3C24XX_CPUFREQ defined.

    Note that this is more than just an optimization. The s3c2410
    watchdog driver actually pats the watchdog on every CPU frequency
    change. On modern systems these happen many times per second (even in
    a system where "nothing" is happening). That effectively makes any
    userspace watchdog program useless (the watchdog is constantly patted
    by the kernel). If we need ARM_S3C24XX_CPUFREQ defined on a
    multiplatform kernel we'll need to make sure that kernel supports
    common clock and change this to user common clock framework.

    Signed-off-by: Doug Anderson
    Reviewed-by: Tomasz Figa
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Doug Anderson
     

18 Nov, 2013

1 commit

  • I just can't find any value in MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR)
    and MODULE_ALIAS_MISCDEV(TEMP_MINOR) statements.

    Either the device is enumerated and the driver already has a module
    alias (e.g. PCI, USB etc.) that will get the right driver loaded
    automatically.

    Or the device is not enumerated and loading its driver will lead to
    more or less intrusive hardware poking. Such hardware poking should be
    limited to a bare minimum, so the user should really decide which
    drivers should be tried and in what order. Trying them all in
    arbitrary order can't do any good.

    On top of that, loading that many drivers at once bloats the kernel
    log. Also many drivers will stay loaded afterward, bloating the output
    of "lsmod" and wasting memory. Some modules (cs5535_mfgpt which gets
    loaded as a dependency) can't even be unloaded!

    If defining char-major-10-130 is needed then it should happen in
    user-space.

    Signed-off-by: Jean Delvare
    Acked-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Cc: Stephen Warren
    Cc: Mike Frysinger
    Cc: Wan ZongShun
    Cc: Ben Dooks
    Cc: Kukjin Kim
    Cc: Zwane Mwaikambo
    Cc: Jim Cromie

    Jean Delvare
     

11 Sep, 2013

2 commits

  • Remove unneeded error handling on the result of a call to
    platform_get_resource when the value is passed to devm_ioremap_resource.

    Move the call to platform_get_resource adjacent to the call to
    devm_ioremap_resource to make the connection between them more clear.

    A simplified version of the semantic patch that makes this change is as
    follows: (http://coccinelle.lip6.fr/)

    //
    @@
    expression pdev,res,n,e,e1;
    expression ret != 0;
    identifier l;
    @@

    - res = platform_get_resource(pdev, IORESOURCE_MEM, n);
    ... when != res
    - if (res == NULL) { ... \(goto l;\|return ret;\) }
    ... when != res
    + res = platform_get_resource(pdev, IORESOURCE_MEM, n);
    e = devm_ioremap_resource(e1, res);
    //

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

    Julia Lawall
     
  • This patch removes the global variables in the driver file and
    group them into a structure.

    Signed-off-by: Leela Krishna Amudala
    Reviewed-by: Tomasz Figa
    Acked-by: Kukjin Kim
    Signed-off-by: Wim Van Sebroeck

    Leela Krishna Amudala
     

12 Jul, 2013

2 commits


19 Jun, 2013

1 commit


09 May, 2013

1 commit

  • Use the newly introduced devm_ioremap_resource() instead of
    devm_request_and_ioremap() which provides more consistent error handling.

    devm_ioremap_resource() provides its own error messages; so all explicit
    error messages can be removed from the failure code paths.

    Signed-off-by: Sachin Kamat
    Reviewed-by: Thierry Reding
    Cc: Gabor Juhos
    Cc: Paul Mundt
    Signed-off-by: Wim Van Sebroeck

    Sachin Kamat
     

01 Mar, 2013

2 commits

  • this patchset add the timeout-sec property to the following drivers:
    orion_wdt, pnx4008_wdt, s3c2410_wdt and at91sam9_wdt.

    The at91sam9_wdt is tested on evk-pr3,
    the other drivers are compile tested only.

    Signed-off-by: Fabio Porcedda
    Cc: Andrew Lunn
    Cc: Jason Cooper
    Cc: Wolfram Sang
    Cc: Masanari Iida
    Cc: Ben Dooks
    Cc: Kukjin Kim
    Cc: Andrew Victor
    Cc: Jean-Christophe PLAGNIOL-VILLARD
    Cc: Nicolas Ferre
    Signed-off-by: Wim Van Sebroeck

    Fabio Porcedda
     
  • Use devm_* functions to make cleanup paths more simple.

    Signed-off-by: Jingoo Han
    Signed-off-by: Wim Van Sebroeck

    Jingoo Han
     

20 Dec, 2012

1 commit


29 Nov, 2012

3 commits

  • CONFIG_HOTPLUG is going away as an option so __devexit is no
    longer needed.

    Signed-off-by: Bill Pemberton
    Cc: Wim Van Sebroeck
    Cc: Wan ZongShun
    Cc: Ben Dooks
    Cc: Kukjin Kim
    Acked-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Bill Pemberton
     
  • CONFIG_HOTPLUG is going away as an option so __devinit is no longer
    needed.

    Signed-off-by: Bill Pemberton
    Cc: Wim Van Sebroeck
    Cc: Wan ZongShun
    Cc: Ben Dooks
    Cc: Kukjin Kim
    Acked-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Bill Pemberton
     
  • CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
    needed.

    Signed-off-by: Bill Pemberton
    Cc: Wim Van Sebroeck
    Cc: Wan ZongShun
    Cc: Ben Dooks
    Cc: Kukjin Kim
    Acked-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Bill Pemberton
     

23 Jul, 2012

1 commit


23 May, 2012

2 commits


28 Mar, 2012

2 commits