The RTC core already has error messages in case of failure, there is no
need to have another message in the driver.
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
The actual layout for OCELOT_GPIO_ALT[01] when there are more than 32 pins
is interleaved, i.e. OCELOT_GPIO_ALT0[0], OCELOT_GPIO_ALT1[0],
OCELOT_GPIO_ALT0[1], OCELOT_GPIO_ALT1[1]. Introduce a new REG_ALT macro to
facilitate the register offset calculation and use it where necessary.
Fixes: da801ab56a pinctrl: ocelot: add MSCC Jaguar2 support
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
The third argument passed to REG is not the correct one and
ocelot_gpio_set_direction is not working for pins after 31. Fix that by
passing the pin number instead of the modulo 32 value.
Fixes: da801ab56a pinctrl: ocelot: add MSCC Jaguar2 support
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Using result = (value + divisor/2) / divisor is rounding values up and only
works well for positive values. Instead use DIV_ROUND_CLOSEST which does
the correct thing.
Signed-off-by: Alexandre Belloni <[email protected]>
Gadget drivers may queue request in interrupt context. This would lead to
a descriptor allocation in that context. In that case we would hit
BUG_ON(in_interrupt()) in __get_vm_area_node.
Also remove the unnecessary cast.
Acked-by: Sylvain Lemieux <[email protected]>
Tested-by: James Grant <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
uie_read is a commonly failing test that will block forever on buggy rtc
drivers. Shorten its timeout so it fails earlier. Also increase the timeout
for the two alarm test on a minute boundary.
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>
Commit a745f7af3c ("selftests/harness: Add 30 second timeout per test")
adds an hardcoded 30s timeout to all tests. Unfortunately, rtctest has two
tests taking up to 60s. Allow for individual tests to define their own
timeout.
Signed-off-by: Alexandre Belloni <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>
The RTC core already ensures the alarm is set to a time in the future, it
is not necessary to check again in the driver.
Signed-off-by: Alexandre Belloni <[email protected]>
Stop enabling the oscillator and removing the oscillator failure flags in
probe. Instead, return -EINVAL in .read_time when the oscillaotr is not
start or when it failed at some point. The oscillator gets enabled on the
first .set_time after failure and the failure flags are cleared.
This also removes the possibility of an infinite loop at probe where a
failing RTC will make the goto read_rtc to be taken every time.
Tested on mcp79411.
Reported-by: Mastro Gippo <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
Remove the child nodes of the sckc as they are not necessary anymore.
Also, switch to the new atmel,sama5d3-sckc compatible string to use the
proper startup time for the RC oscillator (500 µs instead of 75).
Signed-off-by: Alexandre Belloni <[email protected]>
There are no users of set_mms and set_mmss64 as they have all been
converted to set_time and are handling the tm to time conversion on their
own.
Signed-off-by: Alexandre Belloni <[email protected]>
While PCAP_RTC_DAY_MASK is set to 0x3ffff, it is very unlikely to be
correct as this ends in june 1992, before the product even existed. It is
more likely to be a 14-bit day counter. The next product in the family (the
mc13xxx) has a 15-bit day counter.
The same issue is seen with PCAP_RTC_TOD_MASK which only has 65535 seconds
and falls short of the necessary 86400 seconds.
Signed-off-by: Alexandre Belloni <[email protected]>
While the range of REFERENCE + TIME is actually 33 bits, the counter
itself (TIME) is a 32-bits seconds counter.
Acked-by: Baruch Siach <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
The IRQ is requested before the struct rtc is allocated and registered, but
this struct is used in the IRQ handler. This may lead to a NULL pointer
dereference.
Switch to devm_rtc_allocate_device/rtc_register_device to allocate the rtc
struct before requesting the IRQ.
Acked-by: Baruch Siach <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
Readout the enabled state so it is possible to get the pre-userspace
handler working. Also, avoid disabling the watchdog to ensure it continues
working and triggers if there is an issue later in the boot or if userspace
fails to start.
Signed-off-by: Alexandre Belloni <[email protected]>
Tested-by: Gregory CLEMENT <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Signed-off-by: Wim Van Sebroeck <[email protected]>
There is no actual need to do the enable/disable_irq dance. Instead enable
the interrupts on the phy only when necessary.
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
The STOTG04 phy is used as a drop-in replacement of the ISP1301 but some
bits doesn't have exactly the same meaning and this can lead to issues.
Detect the phy dynamically and avoid writing to reserved bits.
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Only INT_VBUS_VLD is set to generate ATX interrupts on the phy but
INT_SESS_VLD is checked in vbus_work. This leads to cases where
hot-plugging USB doesn't work after boot.
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Use a threaded IRQ to handle vbus_work instead of using the global
worqueue.
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Simplify .probe and .remove by using devm managed allocations and requests.
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
The TCBs that have children are using the proper DT bindings and don't need
to be handled by tclib.
Acked-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Daniel Lezcano <[email protected]>
For the sake of consistency, let's rename the file to a name similar
to other file names in this directory.
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Daniel Lezcano <[email protected]>
Allow building the PIT driver when COMPILE_TEST is enabled. Also remove its
default value so it can be disabled.
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Daniel Lezcano <[email protected]>
Move the ATMEL_TCB_CLKSRC option to drivers/clocksource and make it silent
if COMPILE_TEST is not selected.
Cc: Arnd Bergmann <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Daniel Lezcano <[email protected]>
Allow selecting and unselecting the PIT clocksource driver so it doesn't
have to be compiled when unused.
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Daniel Lezcano <[email protected]>
Now that the driver is registered early enough, use the TCB as the
sched_clock which is much more accurate than the jiffies implementation.
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Daniel Lezcano <[email protected]>
atmel_tclib is probed too late in the boot process to be able to use the
TCB as the boot clocksource. This is an issue for SoCs without the PIT
(sams70, samv70 and samv71 families) as they simply currently can't boot.
Get rid of the atmel_tclib dependency and probe everything on our own using
the correct device tree binding.
This also allows getting rid of ATMEL_TCB_CLKSRC_BLOCK and makes the driver
a bit more flexible as the TCB is not hardcoded in the kernel anymore.
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Daniel Lezcano <[email protected]>
The scratchpad register is used to detect an invalid time when power to the
RTC has been lost. Instead of deleting that precious information and set
the time to the UNIX epoch, forward it to userspace.
Tested-by: Mathieu Malaterre <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
Use dev_pm_set_wake_irq() to set the RTC as a wakeup source for suspend.
This allows to remove the whole dev_pm_ops structure.
Tested-by: Mathieu Malaterre <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
rtc_time64_to_tm always returns a valid tm, it is not necessary to validate
it.
Tested-by: Mathieu Malaterre <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
Call the 64bit versions of rtc_tm time conversion now that the range is
enforced by the core.
Tested-by: Mathieu Malaterre <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
The RTC core already ensures the alarm is set to a time in the future, it
is not necessary to check again in the driver.
Signed-off-by: Alexandre Belloni <[email protected]>
The RTC Time Counter MSB Register contains the 32 most significant bits
(47:16) of the 47-bit RTC Time Counter. Clocked by a 32.768 KHz clock, this
register is effectively a 32-bit seconds counter.
Signed-off-by: Alexandre Belloni <[email protected]>
Let the core handle the range, and in particular the imx1 offsetting. This
has the benefit of extending the range of the RTC further than 365 days and
making .read_time useful again on imx1.
Signed-off-by: Alexandre Belloni <[email protected]>
The IRQ is requested before the struct rtc is allocated and registered, but
this struct is used in the IRQ handler. This may lead to a NULL pointer
dereference.
Switch to devm_rtc_allocate_device/rtc_register_device to allocate the rtc
struct before requesting the IRQ.
Signed-off-by: Alexandre Belloni <[email protected]>
The PLLs on the sam9x60 (PLLA and USB PLL) use a different register set and
programming model than the previous SoCs.
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
The sam9x60 cpu clock is located at a different offset but is otherwise
similar to the master clock.
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
The sam9x60 USB clock supports four different parents, ensure they can be
selected.
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
The PCR register layout for GCLKCSS is changing for the future SoCs, allow
configuring it.
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
The PCR register actually changed layout for each SoC. By chance, this
didn't have impact on sama5d[2-4] support but since sama5d3, PID is seven
bits wide and sama5d4 and sama5d2 don't have DIV.
For the DT backward compatibility, keep the layout as is.
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
The sama5d3 slow RC oscillator as a different startup time than all the
previous SoCs. Handle that using its own compatible.
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
Remove the need for child nodes in the sckc binding and register the whole
sckc tree (3 clocks in total) from the sckc node.
DT backward compatibility is kept by looking for properties in child nodes
when they are not present in the sckc node.
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
Remove the need for child nodes in the sckc binding to be able to remove
dtc warnings and have a more modern binding.
Also document optional properties.
Cc: Rob Herring <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
The real-time clock is a 5-byte binary counter. It is incremented 256 times
per second. The least significant byte is a count of fractional seconds.
The upper four bytes are a count of seconds. The realtime clock can
accumulate 136 years of seconds before rolling over.
Signed-off-by: Alexandre Belloni <[email protected]>
Use rtc_add_group to add the sysfs group in a race free manner.
This has the side effect of moving the files to their proper location.
Signed-off-by: Alexandre Belloni <[email protected]>
Since commit 28dc5f8038 ("drivers/rtc/rtc-ep93xx.c: use
dev_get_platdata()"), platform_data is not used directly, it is not
necessary to set it anymore.
Signed-off-by: Alexandre Belloni <[email protected]>
While the UDA1380 is described in some lpc3250 device trees, there is
currently no real user of that codec. Anyway, if the codec needs a clock,
it should take it explicitly.
lpc3250_machine_init is called for all the lpc32xx machines and some are
using test1_clk (for example to strobe an HW watchdog). Overwriting
TEST_CLK_SEL prevents booting those platforms.
Signed-off-by: Alexandre Belloni <[email protected]>
Tested-by: Gregory CLEMENT <[email protected]>
Signed-off-by: Vladimir Zapolskiy <[email protected]>
The ab3100 has a 48bit counter running at 65536 Hz (despite one of the
comment). The max value is then (2^48 - 1)/2^16 == 2^32 - 1.
Reviewed-by: Linus Walleij <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>