29 Jun, 2016

1 commit

  • An opal_msg of type OPAL_MSG_ASYNC_COMP contains the return code in the
    params[1] struct member. However this isn't intuitive or obvious when
    reading the code and requires that a user look at the skiboot
    documentation or opal-api.h to verify this.

    Add an inline function to get the return code from an opal_msg and update
    call sites accordingly.

    Signed-off-by: Suraj Jitindar Singh
    Signed-off-by: Michael Ellerman

    Suraj Jitindar Singh
     

16 Dec, 2015

1 commit

  • GregorianDay() is supposed to calculate the day of the week
    (tm->tm_wday) for a given day/month/year. In that calcuation it
    indexed into an array called MonthOffset using tm->tm_mon-1. However
    tm_mon is zero-based, not one-based, so this is off-by-one. It also
    means that every January, GregoiranDay() will access element -1 of
    the MonthOffset array.

    It also doesn't appear to be a correct algorithm either: see in
    contrast kernel/time/timeconv.c's time_to_tm function.

    It's been broken forever, which suggests no-one in userland uses
    this. It looks like no-one in the kernel uses tm->tm_wday either
    (see e.g. drivers/rtc/rtc-ds1305.c:319).

    tm->tm_wday is conventionally set to -1 when not available in
    hardware so we can simply set it to -1 and drop the function.
    (There are over a dozen other drivers in drivers/rtc that do
    this.)

    Found using UBSAN.

    Cc: Andrey Ryabinin
    Cc: Andrew Morton # as an example of what UBSan finds.
    Cc: Alessandro Zummo
    Cc: Alexandre Belloni
    Cc: rtc-linux@googlegroups.com
    Signed-off-by: Daniel Axtens
    Acked-by: Alexandre Belloni
    Signed-off-by: Michael Ellerman

    Daniel Axtens
     

08 Nov, 2015

2 commits

  • Though the opal rtc driver should and will continue to support the legacy
    "has-tpo" property to enable RTC as the wakeup source, we need to add
    support for the new standard property "wakeup-source"

    This patch adds support for "wakeup-source" property in addition to the
    existing "has-tpo" property.

    Cc: Alessandro Zummo
    Cc: Alexandre Belloni
    Cc: rtc-linux@googlegroups.com
    Signed-off-by: Sudeep Holla
    Signed-off-by: Alexandre Belloni

    Sudeep Holla
     
  • The variable can take signed values.

    The problem has been detected using proposed semantic patch
    scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].

    [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576

    Signed-off-by: Andrzej Hajda
    Signed-off-by: Alexandre Belloni

    Andrzej Hajda
     

05 Sep, 2015

2 commits

  • rtc-opal driver provides support for rtc alarms via
    timed-power-on(tpo). However some Power platforms like BML use a fake
    rtc clock and don't support tpo. Such platforms are indicated by the
    missing 'has-tpo' property in the device tree.

    Current implementation however enables callback for
    rtc_class_ops.read/set alarm irrespective of the tpo support from the
    platform. This results in a failed opal call when kernel tries to read
    an existing alarms via opal_get_tpo_time during rtc device registration.

    This patch fixes this issue by setting opal_rtc_ops.read/set_alarm
    callback pointers only when tpo is supported.

    Acked-by: Michael Neuling
    Acked-by: Neelesh Gupta
    Signed-off-by: Vaibhav Jain
    Acked-by: Stewart Smith
    Signed-off-by: Alexandre Belloni

    Vaibhav Jain
     
  • platform_driver does not need to set an owner because
    platform_driver_register() will set it.

    Signed-off-by: Alexandre Belloni

    Krzysztof Kozlowski
     

17 Apr, 2015

1 commit

  • Neaten the logging a bit by adding #define pr_fmt

    Miscellanea:

    o Remove __FILE__/__func__ uses
    o Coalesce formats adding missing spaces
    o Align arguments
    o (rtc-cmos) Integrated 2 consecutive messages

    Signed-off-by: Joe Perches
    Acked-by: Alexandre Belloni
    Cc: Alessandro Zummo
    Cc: Joshua Kinard
    Cc: Chanwoo Choi
    Reviewed-by: Krzysztof Kozlowski
    Tested-by: Krzysztof Kozlowski
    Cc: Aaro Koskinen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

17 Nov, 2014

1 commit

  • The patch implements the OPAL rtc driver that binds with the rtc
    driver subsystem. The driver uses the platform device infrastructure
    to probe the rtc device and register it to rtc class framework. The
    'wakeup' is supported depending upon the property 'has-tpo' present
    in the OF node. It provides a way to load the generic rtc driver in
    in the absence of an OPAL driver.

    The patch also moves the existing OPAL rtc get/set time interfaces to the
    new driver and exposes the necessary OPAL calls using EXPORT_SYMBOL_GPL.

    Test results:
    -------------
    Host:
    [root@tul169p1 ~]# ls -l /sys/class/rtc/
    total 0
    lrwxrwxrwx 1 root root 0 Oct 14 03:07 rtc0 -> ../../devices/opal-rtc/rtc/rtc0
    [root@tul169p1 ~]# cat /sys/devices/opal-rtc/rtc/rtc0/time
    08:10:07
    [root@tul169p1 ~]# echo `date '+%s' -d '+ 2 minutes'` > /sys/class/rtc/rtc0/wakealarm
    [root@tul169p1 ~]# cat /sys/class/rtc/rtc0/wakealarm
    1413274345
    [root@tul169p1 ~]#

    FSP:
    $ smgr mfgState
    standby
    $ rtim timeofday

    System time is valid: 2014/10/14 08:12:04.225115

    $ smgr mfgState
    ipling
    $

    CC: devicetree@vger.kernel.org
    CC: tglx@linutronix.de
    CC: rtc-linux@googlegroups.com
    CC: a.zummo@towertech.it
    Signed-off-by: Neelesh Gupta
    Signed-off-by: Michael Ellerman

    Neelesh Gupta