summaryrefslogtreecommitdiffstats
path: root/drivers/clocksource
Commit message (Collapse)AuthorAgeFilesLines
* RISC-V: extend multi-image to support both S- and M-ModeAhmad Fatoum2021-06-212-3/+5
| | | | | | | | | | | | | | | | | | We can't currently mix S-Mode and M-Mode images in the same build and there's no straight-forward way to determine which mode we are in. Move the decision on which mode barebox is targeted at out of Kconfig and into the PBL. PBL code can call either barebox_riscv_supervisor_entry or barebox_riscv_machine_entry to signal to barebox proper which mode it's running in. Currently the only user of this information is the RISC-V timer clocksource driver. Any new code that does IS_ENABLED(CONFIG_RISCV_SBI) or IS_ENABLED(CONFIG_RISCV_M_MODE) should also be adapted to use riscv_mode(). Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210619045055.779-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clocksource: RISC-V: demote probe success messages to debug levelAhmad Fatoum2021-06-212-2/+2
| | | | | | | | | | | | There's always some clocksource driver loaded, so reporting it probed successfully doesn't add much value. timebase-frequency can be read from the device tree if needed and which drivers were probed successfully can be seen in drvinfo output, so demote both riscv and clint timer messages to debug level. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210619045055.779-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clocksource: timer-riscv: adapt riscv_timer_get_count_rdcycle() for RV32Antony Pavlov2021-03-301-3/+10
| | | | | | | | | | | | | | | | | | | | | | | On RV64 rdcycle instruction reads 64-bit counter which holds a count of the number of clock cycles executed by the processor core. On RV32 rdcycle instruction reads only bits 31-0 of the same counter; RDCYCLEH should be used to read bits 63–32. The code of this patch is based on Figure 2.5: 'Sample code for reading the 64-bit cycle counter in RV32' [1]: again: rdcycleh x3 rdcycle x2 rdcycleh x4 bne x3, x4, again [1] The RISC-V Instruction Set Manual. Volume I: User-Level ISA, Document Version 2.2 Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clocksource: add driver for RISC-V and CLINT timersAhmad Fatoum2021-03-234-0/+176
| | | | | | | | | | | | | CLINT is selected by Linux on nommu RISC-V machines, while the RISC-V timer with SBI is selected on MMU enabled ones. Both are also available on the Qemu Virt machine, but only SBI is available on TinyEmu. As we'll add Virt support in a follow-up commit, import both drivers now. Erizo could in theory make use of the RISC-V timer, but even a 2GHz timer base is too slow for it to be accurate. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* amba: add *_amba_driver helper macrosRouven Czerwinski2020-11-121-1/+1
| | | | | | | | | Reuse the flexible register_driver_macro() to add {device,coredevice,console}_amba_driver to get rid of the init boilerplate code used within the amba drivers. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Use driver macroSascha Hauer2020-09-2915-77/+15
| | | | | | | We have several macros for a oneline driver registration. Add some missing and use them consistently where possible througout the tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/sandbox-compile-test'Sascha Hauer2020-06-111-1/+0
|\
| * clocksource: arm_global_timer.c: remove unused asm/ headerAhmad Fatoum2020-06-031-1/+0
| | | | | | | | | | | | | | | | We don't use the header and dropping it allows us to compile-test the driver under non-ARM architectures. Do so. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clocksource: kvx: remove unused variable npClement Leger2020-05-181-1/+0
|/ | | | | | | Remove unused variable np from probe function. Signed-off-by: Clement Leger <cleger@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2020-05-144-8/+0
|\
| * treewide: remove references to CREDITSUwe Kleine-König2020-04-274-8/+0
| | | | | | | | | | | | | | | | The CREDITS file was removed from barebox in 2015 by commit 6570288f2d97 ("Remove the CREDITS file"). Remove references to it from several files. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | drivers: add COMPILE_TEST prompts for some off-by-default optionsAhmad Fatoum2020-05-081-14/+14
| | | | | | | | | | | | | | | | | | | | | | Some Kconfig options we have are promptless and off-by-default and instead can only be enabled by being selected from platform options. For some of those that aren't compile testable, add a new COMPILE_TEST-only prompt. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | drivers: add COMPILE_TEST prompts to some on-by-default driversAhmad Fatoum2020-05-081-5/+7
|/ | | | | | | | | | Many clock source and GPIO controller drivers don't have a prompt, but are instead default y if their respective platform is enabled. Maintain this behavior, but add a prompt for when COMPILE_TEST is enabled, so they can be included in test builds. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clocksource: kvx: Add kvx clocksource supportClement Leger2020-04-153-0/+64
| | | | | | | | | Add a clocksource for kvx architecture based on core performance counter. This performance counter is configured to count cycles and as such can be used to be a clocksource. Signed-off-by: Clement Leger <cleger@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clocksource: rename driver for ARMv8 Timer to ARM architected timerAhmad Fatoum2020-02-123-13/+12
| | | | | | | | | | | | The driver matches against both "arm,armv7-timer" and "arm,armv8-timer" compatibles, thus rename it to better reflect that it's not only ARMv8 specific. Only functional change intended is name changes. The symbol is default y, so the rename shouldn't cause it to get lost with olddefconfig. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Revert "clocksource: ARMv8 timer can only be built on ARMv8"Ahmad Fatoum2020-01-162-2/+5
| | | | | | | | | | | | | | | | This reverts commit 33ec8cb5872617fa95aea08d9f7f2b684d95b6de, so that barebox can once again match against "arm,armv7-timer" compatibles. The reverted commit restricted the timer to CPU_V8, because in i.MX multi-image configuration with MACH_SCB9328 set, we can have both CPU_32v7 and CPU_32v4T in the same build. To avoid this issue properly, force use of -march=armv7-a for non-CONFIG_CPU_V8 targets. This is acceptable as we don't expect non-ARMv7 device trees to have the architected arm,armv7-timer. Suggested-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clocksource: ARMv8 timer can only be built on ARMv8Lucas Stach2019-12-021-1/+1
| | | | | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: at91: replace __raw_{readl, writel} of peripherals with readl, writelAhmad Fatoum2019-05-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Use the potentially endianness-changing readl, writel and siblings directly. They looks prettier and are the correct thing to do, as even if the CPU is in big-endian mode, the peripherals are little-endian. Unlike Linux, barebox readl,writel are the same Linux' {readl,writel}_relaxed (they don't imply memory barriers) and thus there shouldn't be any functional change. Patch was generated by a mass search and replace. I looked it over, adjust some whitespace and further verified by reviewing the output of git diff HEAD~1 --word-diff | \ perl -pe 's/\[-(.*?)__raw_/{+$1/; s/-\]\{\+/+}{+/;' \ -e 's/(\{\+.*?\+\})\1/__ALL_IS_WELL__/' | grep '+}{+' which filters out the common case of lines where a single __raw_{readT,writeT} had its __raw_ prefix stripped without any further changes. Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Tested-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/warnings'Sascha Hauer2019-04-091-1/+1
|\
| * treewide: Make locally used functions staticSascha Hauer2019-03-181-1/+1
| | | | | | | | | | | | | | Many functions are only used locally but still are globally visible. Make these function static. Avoids warnings generated with -Wmissing-prototypes Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clocksource: Enable architected timer support for CPU_V7Sascha Hauer2019-03-112-1/+2
|/ | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/efi'Sascha Hauer2019-03-071-2/+2
|\
| * efi: cleanupsOleksij Rempel2019-02-181-2/+2
| | | | | | | | | | | | | | make local functions static and remove unused code Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clocksource: Do not mix depends and select for ATMEL_PITSam Ravnborg2019-02-251-1/+0
|/ | | | | | | | | | CLOCKSOURCE_ATMEL_PIT was both set to yes using depends on and using select. Use only select to set this non-visible symbol to 'y' Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Tested-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/missing-prototypes'Sascha Hauer2019-01-151-1/+1
|\
| * ARM: AT91: pit: Make locally used function staticSascha Hauer2018-12-141-1/+1
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/clps711x'Sascha Hauer2019-01-151-14/+9
|\ \
| * | clocksource: clps711x: Use coredevice_platform_driver() macroAlexander Shiyan2018-12-201-6/+1
| | | | | | | | | | | | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | clocksource: clps711x: Switch to SPDX identifierAlexander Shiyan2018-12-201-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | Adopt the SPDX license identifier headers to ease license compliance management. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | clocksource: clps711x: Add devicetree supportAlexander Shiyan2018-12-201-0/+6
| |/ | | | | | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: omap: 32ktimer: Turn into a driverSascha Hauer2018-12-203-1/+111
| | | | | | | | | | | | Turn OMAP 32KHz timer into a driver and move to drivers/clocksource. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: omap: dmtimer: Turn into a driverSascha Hauer2018-12-203-0/+123
|/ | | | | | Turn OMAP dmtimer into a driver and move to drivers/clocksource. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clocksource: Add dw_apb_timer driverJules Maselbas2018-11-303-0/+154
| | | | | | | Adapt linux kernel dw_apb_timer driver to barebox. Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Kconfig: Add clocksource menuJules Maselbas2018-11-291-0/+4
| | | | | Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/net-switch-mv88e6xxx'Sascha Hauer2018-11-094-0/+317
|\
| * clocksource: Introduce ARCH_HAS_IMX_GPTAndrey Smirnov2018-10-181-1/+4
| | | | | | | | | | | | | | | | Not all SoCs use i.MX GPT block as a clocksource, so introduce ARCH_HAS_IMX_GPT to mark the ones that do. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * i.MX: Move GPT driver to drivers/clocksourceAndrey Smirnov2018-10-183-0/+196
| | | | | | | | | | | | | | | | | | Move GPT driver to drivers/clocksource and rename it to timer-imx-gpt.c to match Linux kernel as well as to keep all clocksource drivers in a common location. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * clocksource: Add ARM global timer supportAndrey Smirnov2018-10-183-0/+118
| | | | | | | | | | | | | | | | | | Port corresponding Linux kernel driver. Currently VFxxx SoC is the intended consumer because it doesn't include common i.MX GPT block used as clocksource by other i.MX SoCs. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: at91: remove mach/io.hSascha Hauer2018-11-061-1/+0
|/ | | | | | | Remove at91_sys_read() and at91_sys_write() since these are no longer used. This makes mach/io.h empty so remove that aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clocksource: armv8-timer: Make use of postcore_platform_driver()Andrey Smirnov2018-06-111-5/+1
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clocksource: armv8-timer: Make armv8_clocksource_read() staticAndrey Smirnov2018-06-111-1/+1
| | | | | | | | There are no users of that function outside of the driver itself, so re-declare it as static. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clocksource: armv8-timer: Convert explicit assembly into helpersAndrey Smirnov2018-06-111-11/+2
| | | | | | | | | | Move inline assembly related to querying and counter value as well as getting and setting counter frequency register into asm/system.h as well as converting it inot helper functions. This is done to make the code availible to other parts of the system. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clocksource: Add armv8 generic timer supportSascha Hauer2018-03-213-0/+71
| | | | | | armv8 has a generic time used in many SoCs. Add support for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clocksource: sp804: silently ignore secondary instacesLucas Stach2017-10-171-2/+2
| | | | | | | | | When probing from an upstream DT, we don't always have influence on how many timer instances are enabled. Just use the first one and silently skip the other instances. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2017-04-071-1/+1
|\
| * clocksource: mvebu: don't request the used iomem resourceUwe Kleine-König2017-03-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | The register ranges of the device nodes timer@20300 and watchdog@20300 overlap, so it is impossible that both devices properly use request_iomem_region (e.g. by using dev_request_mem_resource). In Linux only the watchdog driver is registered in /proc/iomem, do the same for barebox. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clocksource: at91: Add DT compatibility tableAndrey Smirnov2017-03-301-0/+9
|/ | | | | | Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* efi: clocksoure: make sure the meassured frequency is validMichael Olbrich2017-03-151-0/+4
| | | | | | | | | Some EFI implementations have a even slower tick rate and the meassured frequency may be zero. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/rpi'Sascha Hauer2017-03-131-13/+22
|\
| * clocksource: bcm2835: use clock-frequency property when availableEnrico Joerns2017-03-021-13/+22
| | | | | | | | | | | | | | | | | | If the clock frequency is given by a DT property, use this and don't try to use the clock handle. Signed-off-by: Enrico Joerns <ejo@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>