[PATCH v24 00/11] acpi, clocksource: add GTDT driver and GTDT support in arm_arch_timer

2017-04-14 Thread fu . wei
From: Fu Wei 

This patchset:
(1)Preparation for adding GTDT support in arm_arch_timer:
1. Introduce a MMIO CNTFRQ helper.
2. separate out device-tree code from arch_timer_detect_rate
3. replace arch_timer_detect_rate with arch_timer_of_configure_rate
4. Refactor arch_timer_needs_probing, and move it into DT init call
5. Introduce some new structs and refactor the MMIO timer init code
for reusing some common code.

(2)Introduce ACPI GTDT parser: drivers/acpi/arm64/gtdt.c
Parse all kinds of timer in GTDT table of ACPI:arch timer,
memory-mapped timer and SBSA Generic Watchdog timer.
This driver can help to simplify all the relevant timer drivers,
and separate all the ACPI GTDT knowledge from them.

(3)Simplify ACPI code for arm_arch_timer

(4)Add GTDT support for ARM memory-mapped timer.

This patchset has been tested on the following platforms with ACPI enabled:
(1)ARM Foundation v8 model

Changelog:
v24: https://lkml.org/lkml/2017/4/14/
 Mark Rutland:
 Rework comments
 Refactor the probing split
 Verify CNTFRQ:arch_timer_mem_verify_cntfrq
 Only register the first frame:arch_timer_mem_find_best_frame
 Fu Wei:
 Fetches from 
git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git arch-timer/gtdt
 Introduces acpi_unregister_irq function, and use it in 
drivers/acpi/arm64/gtdt.c

v23: https://lkml.org/lkml/2017/3/31/629
 Rebase to git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git 
arch-timer/cleanup
 Improve the data struct of arch_timer_mem and arch_timer_mem_frame to
 improve the parser of GT blocks and arch_timer_mem initualization.
 Improve arch_timer_rate detection: sysreg frequency is primary in DT boot
 Improve some comments in GTDT parser driver.
 Improve acpi_gtdt_init function, and make a comment for the multiple calls.
 Improve the unwinding for the irq of timers, when an error occurs.
 Handle the case of virtual timer GSIV is 0.

v22: https://lkml.org/lkml/2017/3/21/523
 Rebase to git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git 
arch-timer/cleanup
 Only Introduce arch_timer_mem_get_cntfrq to get the frequency from mmio.
 Merged patch 2,3(about arch_timer_detect_rate).
 Keep arch_timer_rate, do NOT split it for different types of timer.
 Improve  memory-mapped timer support by comments and variable name:
 data-->timer_mem
 frame-->gtdt_frame
 Delete zero check for SBSA watchdog irq.
 Skip secure SBSA watchdog in GTDT driver.
 Delete Kconfig modification for SBSA watchdog driver.
 Delete no_irq, using nr_res instead.

v21: https://lkml.org/lkml/2017/2/6/734
 Introduce two functions to get the frequency from mmio and sysreg.
 Remove arch_timer_detect_rate use arch_timer_get_*_freq directly
 Split arch_timer_rate for different types of timer.
 Skip secure timer frame in GTDT driver.
 Rebase to git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git 
arch-timer/cleanup
 (The first 6 patches in v20 have been merged into arch-timer/cleanup 
branch)

v20: https://lkml.org/lkml/2017/1/18/534
 Reorder the first 4 patches and split the 4th patches.
 Leave CNTHCTL_* as they originally were.
 Fix the bug in arch_timer_select_ppi.
 Split "Rework counter frequency detection" patch.
 Rework the arch_timer_detect_rate function.
 Improve the commit message of "Refactor MMIO timer probing".
 Rebase to 4.10.0-rc4

v19: https://lkml.org/lkml/2016/12/21/25
 Fix a '\n' missing in a error message in arch_timer_mem_init.
 Add "request_mem_region" for ioremapping cntbase, according to
 f947ee1 clocksource/drivers/arm_arch_timer: Map frame with 
of_io_request_and_map()
 Rebase to 4.9.0-gfb779ff

v18: https://lkml.org/lkml/2016/12/8/446
 Fix 8/15 patch problem of "int ret;" in arch_timer_acpi_init.
 Rebase to 4.9.0-rc8-g9269898

v17: https://lkml.org/lkml/2016/11/25/140
 Take out some cleanups from 4/15.
 Merge 5/15 and 6/15, improve PPI determination code,
 improve commit message.
 Rework counter frequency detection.
 Move arch_timer_needs_of_probing into DT init call.
 Move Platform Timer scan loop back to timer init call to avoid allocating
 and free memory.
 Improve all the exported functions' comment.

v16: https://lkml.org/lkml/2016/11/16/268
 Fix patchset problem about static enum ppi_nr of 01/13 in v15.
 Refactor arch_timer_detect_rate.
 Refactor arch_timer_needs_probing.

v15: https://lkml.org/lkml/2016/11/15/366
 Re-order patches
 Add arm_arch_timer refactoring patches to prepare for GTDT:
 1. rename some  enums and defines, and some cleanups
 2. separate out arch_timer_uses_ppi init code and fix a potential bug
 3. Improve some new structs, refactor the timer init code.
 Since the some 

[PATCH v24 00/11] acpi, clocksource: add GTDT driver and GTDT support in arm_arch_timer

2017-04-14 Thread fu . wei
From: Fu Wei 

This patchset:
(1)Preparation for adding GTDT support in arm_arch_timer:
1. Introduce a MMIO CNTFRQ helper.
2. separate out device-tree code from arch_timer_detect_rate
3. replace arch_timer_detect_rate with arch_timer_of_configure_rate
4. Refactor arch_timer_needs_probing, and move it into DT init call
5. Introduce some new structs and refactor the MMIO timer init code
for reusing some common code.

(2)Introduce ACPI GTDT parser: drivers/acpi/arm64/gtdt.c
Parse all kinds of timer in GTDT table of ACPI:arch timer,
memory-mapped timer and SBSA Generic Watchdog timer.
This driver can help to simplify all the relevant timer drivers,
and separate all the ACPI GTDT knowledge from them.

(3)Simplify ACPI code for arm_arch_timer

(4)Add GTDT support for ARM memory-mapped timer.

This patchset has been tested on the following platforms with ACPI enabled:
(1)ARM Foundation v8 model

Changelog:
v24: https://lkml.org/lkml/2017/4/14/
 Mark Rutland:
 Rework comments
 Refactor the probing split
 Verify CNTFRQ:arch_timer_mem_verify_cntfrq
 Only register the first frame:arch_timer_mem_find_best_frame
 Fu Wei:
 Fetches from 
git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git arch-timer/gtdt
 Introduces acpi_unregister_irq function, and use it in 
drivers/acpi/arm64/gtdt.c

v23: https://lkml.org/lkml/2017/3/31/629
 Rebase to git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git 
arch-timer/cleanup
 Improve the data struct of arch_timer_mem and arch_timer_mem_frame to
 improve the parser of GT blocks and arch_timer_mem initualization.
 Improve arch_timer_rate detection: sysreg frequency is primary in DT boot
 Improve some comments in GTDT parser driver.
 Improve acpi_gtdt_init function, and make a comment for the multiple calls.
 Improve the unwinding for the irq of timers, when an error occurs.
 Handle the case of virtual timer GSIV is 0.

v22: https://lkml.org/lkml/2017/3/21/523
 Rebase to git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git 
arch-timer/cleanup
 Only Introduce arch_timer_mem_get_cntfrq to get the frequency from mmio.
 Merged patch 2,3(about arch_timer_detect_rate).
 Keep arch_timer_rate, do NOT split it for different types of timer.
 Improve  memory-mapped timer support by comments and variable name:
 data-->timer_mem
 frame-->gtdt_frame
 Delete zero check for SBSA watchdog irq.
 Skip secure SBSA watchdog in GTDT driver.
 Delete Kconfig modification for SBSA watchdog driver.
 Delete no_irq, using nr_res instead.

v21: https://lkml.org/lkml/2017/2/6/734
 Introduce two functions to get the frequency from mmio and sysreg.
 Remove arch_timer_detect_rate use arch_timer_get_*_freq directly
 Split arch_timer_rate for different types of timer.
 Skip secure timer frame in GTDT driver.
 Rebase to git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git 
arch-timer/cleanup
 (The first 6 patches in v20 have been merged into arch-timer/cleanup 
branch)

v20: https://lkml.org/lkml/2017/1/18/534
 Reorder the first 4 patches and split the 4th patches.
 Leave CNTHCTL_* as they originally were.
 Fix the bug in arch_timer_select_ppi.
 Split "Rework counter frequency detection" patch.
 Rework the arch_timer_detect_rate function.
 Improve the commit message of "Refactor MMIO timer probing".
 Rebase to 4.10.0-rc4

v19: https://lkml.org/lkml/2016/12/21/25
 Fix a '\n' missing in a error message in arch_timer_mem_init.
 Add "request_mem_region" for ioremapping cntbase, according to
 f947ee1 clocksource/drivers/arm_arch_timer: Map frame with 
of_io_request_and_map()
 Rebase to 4.9.0-gfb779ff

v18: https://lkml.org/lkml/2016/12/8/446
 Fix 8/15 patch problem of "int ret;" in arch_timer_acpi_init.
 Rebase to 4.9.0-rc8-g9269898

v17: https://lkml.org/lkml/2016/11/25/140
 Take out some cleanups from 4/15.
 Merge 5/15 and 6/15, improve PPI determination code,
 improve commit message.
 Rework counter frequency detection.
 Move arch_timer_needs_of_probing into DT init call.
 Move Platform Timer scan loop back to timer init call to avoid allocating
 and free memory.
 Improve all the exported functions' comment.

v16: https://lkml.org/lkml/2016/11/16/268
 Fix patchset problem about static enum ppi_nr of 01/13 in v15.
 Refactor arch_timer_detect_rate.
 Refactor arch_timer_needs_probing.

v15: https://lkml.org/lkml/2016/11/15/366
 Re-order patches
 Add arm_arch_timer refactoring patches to prepare for GTDT:
 1. rename some  enums and defines, and some cleanups
 2. separate out arch_timer_uses_ppi init code and fix a potential bug
 3. Improve some new structs, refactor the timer init code.
 Since the some structs have been