* [PATCH v5 1/2] mfd: intel_soc_pmic: Select designware i2c-bus driver
@ 2017-05-26 11:15 Hans de Goede
2017-05-26 11:15 ` [PATCH v5 2/2] mfd: axp20x-i2c: Document that this must be builtin on x86 Hans de Goede
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Hans de Goede @ 2017-05-26 11:15 UTC (permalink / raw)
To: Lee Jones, Chen-Yu Tsai; +Cc: Hans de Goede, linux-kernel, Andy Shevchenko
The Crystal Cove PMIC provides an ACPI OPRegion handler, which must be
available before other drivers using it are loaded, which is why
INTEL_SOC_PMIC is a bool.
Just having the driver is not enough, the driver for the i2c-bus must
also be built in, to ensure this, this patch adds a select for it.
This fixes errors like these during boot:
mmc0: SDHCI controller on ACPI [80860F14:00] using ADMA
ACPI Error: No handler for Region [REGS] (ffff93543b0cc3a8) [UserDefinedRegion] (20170119/evregion-166)
ACPI Error: Region UserDefinedRegion (ID=143) has no handler (20170119/exfldio-299)
ACPI Error: Method parse/execution failed [\_SB.PCI0.I2C7.PMI5.GET] (Node ffff93543b0cde10), AE_NOT_EXIST (20170119/psparse-543)
ACPI Error: Method parse/execution failed [\_SB.PCI0.SHC1._PS0] (Node ffff93543b0b5cd0), AE_NOT_EXIST (20170119/psparse-543)
acpi 80860F14:02: Failed to change power state to D0
While at it this patch also changes the human readable name of the Kconfig
option to make clear the INTEL_SOC_PMIC option selects support for the
Intel Crystal Cove PMIC and documents why this is a bool.
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
Changes in v2:
-Fix Kconfig depends and selects to fix warning reported by kbuild test robot
-Improve commit msg (add example of ACPI errors this avoids)
Changes in v3:
-No changes
Changes in v4:
-Add explanation why this is a bool and why it selects i2c-designwaree
to the help text rather then as comments in the Kconfig
Changes in v5:
-Add Andy's Reviewed-by
-Fix OpRegion spelling
---
drivers/mfd/Kconfig | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 1b6a83a4a114..4f71cab2e6e8 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -448,17 +448,24 @@ config LPC_SCH
config INTEL_SOC_PMIC
bool "Support for Crystal Cove PMIC"
- depends on GPIOLIB
- depends on I2C=y
+ depends on HAS_IOMEM
+ select GPIOLIB
+ select I2C
select MFD_CORE
select REGMAP_I2C
select REGMAP_IRQ
+ select COMMON_CLK
+ select I2C_DESIGNWARE_PLATFORM
help
Select this option to enable support for Crystal Cove PMIC
on some Intel SoC systems. The PMIC provides ADC, GPIO,
thermal, charger and related power management functions
on these systems.
+ This option is a bool as it provides an ACPI OpRegion which must be
+ available before any devices using it are probed. This option also
+ causes the designware-i2c driver to be builtin for the same reason.
+
config INTEL_SOC_PMIC_BXTWC
tristate "Support for Intel Broxton Whiskey Cove PMIC"
depends on INTEL_PMC_IPC
--
2.13.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v5 2/2] mfd: axp20x-i2c: Document that this must be builtin on x86
2017-05-26 11:15 [PATCH v5 1/2] mfd: intel_soc_pmic: Select designware i2c-bus driver Hans de Goede
@ 2017-05-26 11:15 ` Hans de Goede
2017-05-26 12:00 ` Chen-Yu Tsai
2017-05-30 9:28 ` Lee Jones
2017-05-28 5:30 ` [PATCH v5 1/2] mfd: intel_soc_pmic: Select designware i2c-bus driver kbuild test robot
2017-05-30 9:29 ` Lee Jones
2 siblings, 2 replies; 6+ messages in thread
From: Hans de Goede @ 2017-05-26 11:15 UTC (permalink / raw)
To: Lee Jones, Chen-Yu Tsai; +Cc: Hans de Goede, linux-kernel
On x86 the axp288 PMIC provides an ACPI OpRegion handler, which must be
available before other drivers using it are loaded, which can only be
ensured if the mfd, OpRegionr and i2c-bus drivers are built in.
Since the axp20x mfd code is used on non X86 too we cannot simply change
this into a bool, I've tried some Kconfig magic with if x86 but I could
not get this working correctly, so this commit just documents that this
should be builtin on x86, which fixes errors like these during boot:
mmc0: SDHCI controller on ACPI [80860F14:00] using ADMA
ACPI Error: No handler for Region [REGS] (ffff93543b0cc3a8) [UserDefinedRegion]
ACPI Error: Region UserDefinedRegion (ID=143) has no handler (20170119/exfldio-2
ACPI Error: Method parse/execution failed [\_SB.PCI0.I2C7.PMI5.GET] (Node ffff93
ACPI Error: Method parse/execution failed [\_SB.PCI0.SHC1._PS0] (Node ffff93543b
acpi 80860F14:02: Failed to change power state to D0
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
-Fix Kconfig depends and selects to fix warning reported by kbuild test robot
-Improve commit msg (add example of ACPI errors this avoids)
Changes in v3:
-Since the axp20x mfd code is used on ARM too where it does not necessarily
need to be builtin settle for simply documenting the need to have this
builtin on x86
Changes in v5:
-Fix I2C spelling
---
drivers/mfd/Kconfig | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 4f71cab2e6e8..e03853affcc5 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -160,6 +160,11 @@ config MFD_AXP20X_I2C
components like regulators or the PEK (Power Enable Key) under the
corresponding menus.
+ Note on x86 this provides an ACPI OpRegion, so this must be 'y'
+ (builtin) and not a module, as the OpRegion must be available as
+ soon as possible. For the same reason the I2C bus driver options
+ I2C_DESIGNWARE_PLATFORM and I2C_DESIGNWARE_BAYTRAIL must be 'y' too.
+
config MFD_AXP20X_RSB
tristate "X-Powers AXP series PMICs with RSB"
select MFD_AXP20X
--
2.13.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v5 2/2] mfd: axp20x-i2c: Document that this must be builtin on x86
2017-05-26 11:15 ` [PATCH v5 2/2] mfd: axp20x-i2c: Document that this must be builtin on x86 Hans de Goede
@ 2017-05-26 12:00 ` Chen-Yu Tsai
2017-05-30 9:28 ` Lee Jones
1 sibling, 0 replies; 6+ messages in thread
From: Chen-Yu Tsai @ 2017-05-26 12:00 UTC (permalink / raw)
To: Lee Jones; +Cc: Chen-Yu Tsai, linux-kernel, Hans de Goede
On Fri, May 26, 2017 at 7:15 PM, Hans de Goede <hdegoede@redhat.com> wrote:
> On x86 the axp288 PMIC provides an ACPI OpRegion handler, which must be
> available before other drivers using it are loaded, which can only be
> ensured if the mfd, OpRegionr and i2c-bus drivers are built in.
Extra "r" after OpRegion.
>
> Since the axp20x mfd code is used on non X86 too we cannot simply change
> this into a bool, I've tried some Kconfig magic with if x86 but I could
> not get this working correctly, so this commit just documents that this
> should be builtin on x86, which fixes errors like these during boot:
>
> mmc0: SDHCI controller on ACPI [80860F14:00] using ADMA
> ACPI Error: No handler for Region [REGS] (ffff93543b0cc3a8) [UserDefinedRegion]
> ACPI Error: Region UserDefinedRegion (ID=143) has no handler (20170119/exfldio-2
> ACPI Error: Method parse/execution failed [\_SB.PCI0.I2C7.PMI5.GET] (Node ffff93
> ACPI Error: Method parse/execution failed [\_SB.PCI0.SHC1._PS0] (Node ffff93543b
> acpi 80860F14:02: Failed to change power state to D0
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Lee, unfortunately I do not have any hardware with the AXP288, nor any
other x86 tablets. As Hans mentioned, he is the only one improving the
AXP288 part of the axp20x bunch of drivers, after the original authors
dropped support for them.
FWIW,
Acked-by: Chen-Yu Tsai <wens@csie.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v5 1/2] mfd: intel_soc_pmic: Select designware i2c-bus driver
2017-05-26 11:15 [PATCH v5 1/2] mfd: intel_soc_pmic: Select designware i2c-bus driver Hans de Goede
2017-05-26 11:15 ` [PATCH v5 2/2] mfd: axp20x-i2c: Document that this must be builtin on x86 Hans de Goede
@ 2017-05-28 5:30 ` kbuild test robot
2017-05-30 9:29 ` Lee Jones
2 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2017-05-28 5:30 UTC (permalink / raw)
To: Hans de Goede
Cc: kbuild-all, Lee Jones, Chen-Yu Tsai, Hans de Goede, linux-kernel,
Andy Shevchenko
[-- Attachment #1: Type: text/plain, Size: 34907 bytes --]
Hi Hans,
[auto build test ERROR on ljones-mfd/for-mfd-next]
[also build test ERROR on v4.12-rc2 next-20170526]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Hans-de-Goede/mfd-intel_soc_pmic-Select-designware-i2c-bus-driver/20170526-211338
base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: frv-allmodconfig (attached as .config)
compiler: frv-linux-gcc (GCC) 6.2.0
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=frv
All errors (new ones prefixed by >>):
>> drivers//clocksource/timer-sun5i.c:52:21: error: field 'clksrc' has incomplete type
struct clocksource clksrc;
^~~~~~
>> drivers//clocksource/timer-sun5i.c:60:28: error: field 'clkevt' has incomplete type
struct clock_event_device clkevt;
^~~~~~
In file included from include/linux/clk.h:16:0,
from drivers//clocksource/timer-sun5i.c:13:
drivers//clocksource/timer-sun5i.c: In function 'sun5i_clkevt_shutdown':
include/linux/kernel.h:854:48: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/timer-sun5i.c:64:2: note: in expansion of macro 'container_of'
container_of(x, struct sun5i_timer_clkevt, clkevt)
^~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c:108:34: note: in expansion of macro 'to_sun5i_timer_clkevt'
struct sun5i_timer_clkevt *ce = to_sun5i_timer_clkevt(clkevt);
^~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:854:48: note: (near initialization for 'ce')
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/timer-sun5i.c:64:2: note: in expansion of macro 'container_of'
container_of(x, struct sun5i_timer_clkevt, clkevt)
^~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c:108:34: note: in expansion of macro 'to_sun5i_timer_clkevt'
struct sun5i_timer_clkevt *ce = to_sun5i_timer_clkevt(clkevt);
^~~~~~~~~~~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c: In function 'sun5i_clkevt_set_oneshot':
include/linux/kernel.h:854:48: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/timer-sun5i.c:64:2: note: in expansion of macro 'container_of'
container_of(x, struct sun5i_timer_clkevt, clkevt)
^~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c:116:34: note: in expansion of macro 'to_sun5i_timer_clkevt'
struct sun5i_timer_clkevt *ce = to_sun5i_timer_clkevt(clkevt);
^~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:854:48: note: (near initialization for 'ce')
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/timer-sun5i.c:64:2: note: in expansion of macro 'container_of'
container_of(x, struct sun5i_timer_clkevt, clkevt)
^~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c:116:34: note: in expansion of macro 'to_sun5i_timer_clkevt'
struct sun5i_timer_clkevt *ce = to_sun5i_timer_clkevt(clkevt);
^~~~~~~~~~~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c: In function 'sun5i_clkevt_set_periodic':
include/linux/kernel.h:854:48: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/timer-sun5i.c:64:2: note: in expansion of macro 'container_of'
container_of(x, struct sun5i_timer_clkevt, clkevt)
^~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c:125:34: note: in expansion of macro 'to_sun5i_timer_clkevt'
struct sun5i_timer_clkevt *ce = to_sun5i_timer_clkevt(clkevt);
^~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:854:48: note: (near initialization for 'ce')
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/timer-sun5i.c:64:2: note: in expansion of macro 'container_of'
container_of(x, struct sun5i_timer_clkevt, clkevt)
^~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c:125:34: note: in expansion of macro 'to_sun5i_timer_clkevt'
struct sun5i_timer_clkevt *ce = to_sun5i_timer_clkevt(clkevt);
^~~~~~~~~~~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c: In function 'sun5i_clkevt_next_event':
include/linux/kernel.h:854:48: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/timer-sun5i.c:64:2: note: in expansion of macro 'container_of'
container_of(x, struct sun5i_timer_clkevt, clkevt)
^~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c:136:34: note: in expansion of macro 'to_sun5i_timer_clkevt'
struct sun5i_timer_clkevt *ce = to_sun5i_timer_clkevt(clkevt);
^~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:854:48: note: (near initialization for 'ce')
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/timer-sun5i.c:64:2: note: in expansion of macro 'container_of'
container_of(x, struct sun5i_timer_clkevt, clkevt)
^~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c:136:34: note: in expansion of macro 'to_sun5i_timer_clkevt'
struct sun5i_timer_clkevt *ce = to_sun5i_timer_clkevt(clkevt);
^~~~~~~~~~~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c: In function 'sun5i_clksrc_read':
include/linux/kernel.h:854:48: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/timer-sun5i.c:56:2: note: in expansion of macro 'container_of'
container_of(x, struct sun5i_timer_clksrc, clksrc)
^~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c:157:34: note: in expansion of macro 'to_sun5i_timer_clksrc'
struct sun5i_timer_clksrc *cs = to_sun5i_timer_clksrc(clksrc);
^~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:854:48: note: (near initialization for 'cs')
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/timer-sun5i.c:56:2: note: in expansion of macro 'container_of'
container_of(x, struct sun5i_timer_clksrc, clksrc)
^~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c:157:34: note: in expansion of macro 'to_sun5i_timer_clksrc'
struct sun5i_timer_clksrc *cs = to_sun5i_timer_clksrc(clksrc);
^~~~~~~~~~~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c: In function 'sun5i_rate_cb_clksrc':
>> drivers//clocksource/timer-sun5i.c:171:3: error: implicit declaration of function 'clocksource_unregister' [-Werror=implicit-function-declaration]
clocksource_unregister(&cs->clksrc);
^~~~~~~~~~~~~~~~~~~~~~
>> drivers//clocksource/timer-sun5i.c:175:3: error: implicit declaration of function 'clocksource_register_hz' [-Werror=implicit-function-declaration]
clocksource_register_hz(&cs->clksrc, ndata->new_rate);
^~~~~~~~~~~~~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c: In function 'sun5i_setup_clocksource':
>> drivers//clocksource/timer-sun5i.c:223:20: error: implicit declaration of function 'CLOCKSOURCE_MASK' [-Werror=implicit-function-declaration]
cs->clksrc.mask = CLOCKSOURCE_MASK(32);
^~~~~~~~~~~~~~~~
>> drivers//clocksource/timer-sun5i.c:224:21: error: 'CLOCK_SOURCE_IS_CONTINUOUS' undeclared (first use in this function)
cs->clksrc.flags = CLOCK_SOURCE_IS_CONTINUOUS;
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c:224:21: note: each undeclared identifier is reported only once for each function it appears in
drivers//clocksource/timer-sun5i.c: In function 'sun5i_rate_cb_clkevt':
>> drivers//clocksource/timer-sun5i.c:251:3: error: implicit declaration of function 'clockevents_update_freq' [-Werror=implicit-function-declaration]
clockevents_update_freq(&ce->clkevt, ndata->new_rate);
^~~~~~~~~~~~~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c: In function 'sun5i_setup_clockevent':
>> drivers//clocksource/timer-sun5i.c:291:24: error: 'CLOCK_EVT_FEAT_PERIODIC' undeclared (first use in this function)
ce->clkevt.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT;
^~~~~~~~~~~~~~~~~~~~~~~
>> drivers//clocksource/timer-sun5i.c:291:50: error: 'CLOCK_EVT_FEAT_ONESHOT' undeclared (first use in this function)
ce->clkevt.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT;
^~~~~~~~~~~~~~~~~~~~~~
>> drivers//clocksource/timer-sun5i.c:305:2: error: implicit declaration of function 'clockevents_config_and_register' [-Werror=implicit-function-declaration]
clockevents_config_and_register(&ce->clkevt, rate,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c: At top level:
>> drivers//clocksource/timer-sun5i.c:361:35: error: expected ')' before string constant
CLOCKSOURCE_OF_DECLARE(sun5i_a13, "allwinner,sun5i-a13-hstimer",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c:363:35: error: expected ')' before string constant
CLOCKSOURCE_OF_DECLARE(sun7i_a20, "allwinner,sun7i-a20-hstimer",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers//clocksource/timer-sun5i.c:326:19: warning: 'sun5i_timer_init' defined but not used [-Wunused-function]
static int __init sun5i_timer_init(struct device_node *node)
^~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
>> drivers//clocksource/cadence_ttc_timer.c:92:21: error: field 'cs' has incomplete type
struct clocksource cs;
^~
>> drivers//clocksource/cadence_ttc_timer.c:100:28: error: field 'ce' has incomplete type
struct clock_event_device ce;
^~
In file included from include/linux/clk.h:16:0,
from drivers//clocksource/cadence_ttc_timer.c:18:
drivers//clocksource/cadence_ttc_timer.c: In function '__ttc_clocksource_read':
include/linux/kernel.h:854:48: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/cadence_ttc_timer.c:96:3: note: in expansion of macro 'container_of'
container_of(x, struct ttc_timer_clocksource, cs)
^~~~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c:163:29: note: in expansion of macro 'to_ttc_timer_clksrc'
struct ttc_timer *timer = &to_ttc_timer_clksrc(cs)->ttc;
^~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:854:48: note: (near initialization for 'timer')
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/cadence_ttc_timer.c:96:3: note: in expansion of macro 'container_of'
container_of(x, struct ttc_timer_clocksource, cs)
^~~~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c:163:29: note: in expansion of macro 'to_ttc_timer_clksrc'
struct ttc_timer *timer = &to_ttc_timer_clksrc(cs)->ttc;
^~~~~~~~~~~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c: In function 'ttc_set_next_event':
include/linux/kernel.h:854:48: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/cadence_ttc_timer.c:104:3: note: in expansion of macro 'container_of'
container_of(x, struct ttc_timer_clockevent, ce)
^~~~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c:185:38: note: in expansion of macro 'to_ttc_timer_clkevent'
struct ttc_timer_clockevent *ttce = to_ttc_timer_clkevent(evt);
^~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:854:48: note: (near initialization for 'ttce')
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/cadence_ttc_timer.c:104:3: note: in expansion of macro 'container_of'
container_of(x, struct ttc_timer_clockevent, ce)
^~~~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c:185:38: note: in expansion of macro 'to_ttc_timer_clkevent'
struct ttc_timer_clockevent *ttce = to_ttc_timer_clkevent(evt);
^~~~~~~~~~~~~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c: In function 'ttc_shutdown':
include/linux/kernel.h:854:48: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/cadence_ttc_timer.c:104:3: note: in expansion of macro 'container_of'
container_of(x, struct ttc_timer_clockevent, ce)
^~~~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c:199:38: note: in expansion of macro 'to_ttc_timer_clkevent'
struct ttc_timer_clockevent *ttce = to_ttc_timer_clkevent(evt);
^~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:854:48: note: (near initialization for 'ttce')
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/cadence_ttc_timer.c:104:3: note: in expansion of macro 'container_of'
container_of(x, struct ttc_timer_clockevent, ce)
^~~~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c:199:38: note: in expansion of macro 'to_ttc_timer_clkevent'
struct ttc_timer_clockevent *ttce = to_ttc_timer_clkevent(evt);
^~~~~~~~~~~~~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c: In function 'ttc_set_periodic':
include/linux/kernel.h:854:48: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/cadence_ttc_timer.c:104:3: note: in expansion of macro 'container_of'
container_of(x, struct ttc_timer_clockevent, ce)
^~~~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c:211:38: note: in expansion of macro 'to_ttc_timer_clkevent'
struct ttc_timer_clockevent *ttce = to_ttc_timer_clkevent(evt);
^~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:854:48: note: (near initialization for 'ttce')
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/cadence_ttc_timer.c:104:3: note: in expansion of macro 'container_of'
container_of(x, struct ttc_timer_clockevent, ce)
^~~~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c:211:38: note: in expansion of macro 'to_ttc_timer_clkevent'
struct ttc_timer_clockevent *ttce = to_ttc_timer_clkevent(evt);
^~~~~~~~~~~~~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c: In function 'ttc_resume':
include/linux/kernel.h:854:48: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/cadence_ttc_timer.c:104:3: note: in expansion of macro 'container_of'
container_of(x, struct ttc_timer_clockevent, ce)
^~~~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c:221:38: note: in expansion of macro 'to_ttc_timer_clkevent'
struct ttc_timer_clockevent *ttce = to_ttc_timer_clkevent(evt);
^~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:854:48: note: (near initialization for 'ttce')
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
drivers//clocksource/cadence_ttc_timer.c:104:3: note: in expansion of macro 'container_of'
container_of(x, struct ttc_timer_clockevent, ce)
^~~~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c:221:38: note: in expansion of macro 'to_ttc_timer_clkevent'
struct ttc_timer_clockevent *ttce = to_ttc_timer_clkevent(evt);
^~~~~~~~~~~~~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c: In function 'ttc_setup_clocksource':
>> drivers//clocksource/cadence_ttc_timer.c:358:19: error: implicit declaration of function 'CLOCKSOURCE_MASK' [-Werror=implicit-function-declaration]
ttccs->cs.mask = CLOCKSOURCE_MASK(timer_width);
^~~~~~~~~~~~~~~~
>> drivers//clocksource/cadence_ttc_timer.c:359:20: error: 'CLOCK_SOURCE_IS_CONTINUOUS' undeclared (first use in this function)
ttccs->cs.flags = CLOCK_SOURCE_IS_CONTINUOUS;
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c:359:20: note: each undeclared identifier is reported only once for each function it appears in
>> drivers//clocksource/cadence_ttc_timer.c:372:8: error: implicit declaration of function 'clocksource_register_hz' [-Werror=implicit-function-declaration]
err = clocksource_register_hz(&ttccs->cs, ttccs->ttc.freq / PRESCALE);
^~~~~~~~~~~~~~~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c: In function 'ttc_rate_change_clockevent_cb':
>> drivers//clocksource/cadence_ttc_timer.c:398:3: error: implicit declaration of function 'clockevents_update_freq' [-Werror=implicit-function-declaration]
clockevents_update_freq(&ttcce->ce, ndata->new_rate / PRESCALE);
^~~~~~~~~~~~~~~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c: In function 'ttc_setup_clockevent':
>> drivers//clocksource/cadence_ttc_timer.c:441:23: error: 'CLOCK_EVT_FEAT_PERIODIC' undeclared (first use in this function)
ttcce->ce.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT;
^~~~~~~~~~~~~~~~~~~~~~~
>> drivers//clocksource/cadence_ttc_timer.c:441:49: error: 'CLOCK_EVT_FEAT_ONESHOT' undeclared (first use in this function)
ttcce->ce.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT;
^~~~~~~~~~~~~~~~~~~~~~
>> drivers//clocksource/cadence_ttc_timer.c:468:2: error: implicit declaration of function 'clockevents_config_and_register' [-Werror=implicit-function-declaration]
clockevents_config_and_register(&ttcce->ce,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c: At top level:
>> drivers//clocksource/cadence_ttc_timer.c:542:29: error: expected ')' before string constant
CLOCKSOURCE_OF_DECLARE(ttc, "cdns,ttc", ttc_timer_init);
^~~~~~~~~~
drivers//clocksource/cadence_ttc_timer.c:480:19: warning: 'ttc_timer_init' defined but not used [-Wunused-function]
static int __init ttc_timer_init(struct device_node *timer)
^~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/clksrc +52 drivers//clocksource/timer-sun5i.c
4a59058f Maxime Ripard 2015-03-31 46
3071efa4 Maxime Ripard 2015-03-31 47 #define to_sun5i_timer(x) \
3071efa4 Maxime Ripard 2015-03-31 48 container_of(x, struct sun5i_timer, clk_rate_cb)
3071efa4 Maxime Ripard 2015-03-31 49
4a59058f Maxime Ripard 2015-03-31 50 struct sun5i_timer_clksrc {
4a59058f Maxime Ripard 2015-03-31 51 struct sun5i_timer timer;
4a59058f Maxime Ripard 2015-03-31 @52 struct clocksource clksrc;
4a59058f Maxime Ripard 2015-03-31 53 };
4a59058f Maxime Ripard 2015-03-31 54
4a59058f Maxime Ripard 2015-03-31 55 #define to_sun5i_timer_clksrc(x) \
4a59058f Maxime Ripard 2015-03-31 @56 container_of(x, struct sun5i_timer_clksrc, clksrc)
4a59058f Maxime Ripard 2015-03-31 57
4a59058f Maxime Ripard 2015-03-31 58 struct sun5i_timer_clkevt {
4a59058f Maxime Ripard 2015-03-31 59 struct sun5i_timer timer;
4a59058f Maxime Ripard 2015-03-31 @60 struct clock_event_device clkevt;
4a59058f Maxime Ripard 2015-03-31 61 };
4a59058f Maxime Ripard 2015-03-31 62
4a59058f Maxime Ripard 2015-03-31 63 #define to_sun5i_timer_clkevt(x) \
4a59058f Maxime Ripard 2015-03-31 64 container_of(x, struct sun5i_timer_clkevt, clkevt)
67905540 Maxime Ripard 2013-11-07 65
67905540 Maxime Ripard 2013-11-07 66 /*
67905540 Maxime Ripard 2013-11-07 67 * When we disable a timer, we need to wait at least for 2 cycles of
67905540 Maxime Ripard 2013-11-07 68 * the timer source clock. We will use for that the clocksource timer
67905540 Maxime Ripard 2013-11-07 69 * that is already setup and runs at the same frequency than the other
67905540 Maxime Ripard 2013-11-07 70 * timers, and we never will be disabled.
67905540 Maxime Ripard 2013-11-07 71 */
4a59058f Maxime Ripard 2015-03-31 72 static void sun5i_clkevt_sync(struct sun5i_timer_clkevt *ce)
67905540 Maxime Ripard 2013-11-07 73 {
4a59058f Maxime Ripard 2015-03-31 74 u32 old = readl(ce->timer.base + TIMER_CNTVAL_LO_REG(1));
67905540 Maxime Ripard 2013-11-07 75
4a59058f Maxime Ripard 2015-03-31 76 while ((old - readl(ce->timer.base + TIMER_CNTVAL_LO_REG(1))) < TIMER_SYNC_TICKS)
67905540 Maxime Ripard 2013-11-07 77 cpu_relax();
67905540 Maxime Ripard 2013-11-07 78 }
67905540 Maxime Ripard 2013-11-07 79
4a59058f Maxime Ripard 2015-03-31 80 static void sun5i_clkevt_time_stop(struct sun5i_timer_clkevt *ce, u8 timer)
67905540 Maxime Ripard 2013-11-07 81 {
4a59058f Maxime Ripard 2015-03-31 82 u32 val = readl(ce->timer.base + TIMER_CTL_REG(timer));
4a59058f Maxime Ripard 2015-03-31 83 writel(val & ~TIMER_CTL_ENABLE, ce->timer.base + TIMER_CTL_REG(timer));
67905540 Maxime Ripard 2013-11-07 84
4a59058f Maxime Ripard 2015-03-31 85 sun5i_clkevt_sync(ce);
67905540 Maxime Ripard 2013-11-07 86 }
67905540 Maxime Ripard 2013-11-07 87
4a59058f Maxime Ripard 2015-03-31 88 static void sun5i_clkevt_time_setup(struct sun5i_timer_clkevt *ce, u8 timer, u32 delay)
67905540 Maxime Ripard 2013-11-07 89 {
4a59058f Maxime Ripard 2015-03-31 90 writel(delay, ce->timer.base + TIMER_INTVAL_LO_REG(timer));
67905540 Maxime Ripard 2013-11-07 91 }
67905540 Maxime Ripard 2013-11-07 92
4a59058f Maxime Ripard 2015-03-31 93 static void sun5i_clkevt_time_start(struct sun5i_timer_clkevt *ce, u8 timer, bool periodic)
67905540 Maxime Ripard 2013-11-07 94 {
4a59058f Maxime Ripard 2015-03-31 95 u32 val = readl(ce->timer.base + TIMER_CTL_REG(timer));
67905540 Maxime Ripard 2013-11-07 96
67905540 Maxime Ripard 2013-11-07 97 if (periodic)
67905540 Maxime Ripard 2013-11-07 98 val &= ~TIMER_CTL_ONESHOT;
67905540 Maxime Ripard 2013-11-07 99 else
67905540 Maxime Ripard 2013-11-07 100 val |= TIMER_CTL_ONESHOT;
67905540 Maxime Ripard 2013-11-07 101
67905540 Maxime Ripard 2013-11-07 102 writel(val | TIMER_CTL_ENABLE | TIMER_CTL_RELOAD,
4a59058f Maxime Ripard 2015-03-31 103 ce->timer.base + TIMER_CTL_REG(timer));
67905540 Maxime Ripard 2013-11-07 104 }
67905540 Maxime Ripard 2013-11-07 105
7486f5ad Viresh Kumar 2015-06-18 106 static int sun5i_clkevt_shutdown(struct clock_event_device *clkevt)
67905540 Maxime Ripard 2013-11-07 107 {
4a59058f Maxime Ripard 2015-03-31 108 struct sun5i_timer_clkevt *ce = to_sun5i_timer_clkevt(clkevt);
4a59058f Maxime Ripard 2015-03-31 109
4a59058f Maxime Ripard 2015-03-31 110 sun5i_clkevt_time_stop(ce, 0);
7486f5ad Viresh Kumar 2015-06-18 111 return 0;
7486f5ad Viresh Kumar 2015-06-18 112 }
7486f5ad Viresh Kumar 2015-06-18 113
7486f5ad Viresh Kumar 2015-06-18 114 static int sun5i_clkevt_set_oneshot(struct clock_event_device *clkevt)
7486f5ad Viresh Kumar 2015-06-18 115 {
7486f5ad Viresh Kumar 2015-06-18 116 struct sun5i_timer_clkevt *ce = to_sun5i_timer_clkevt(clkevt);
7486f5ad Viresh Kumar 2015-06-18 117
4a59058f Maxime Ripard 2015-03-31 118 sun5i_clkevt_time_stop(ce, 0);
4a59058f Maxime Ripard 2015-03-31 119 sun5i_clkevt_time_start(ce, 0, false);
7486f5ad Viresh Kumar 2015-06-18 120 return 0;
67905540 Maxime Ripard 2013-11-07 121 }
7486f5ad Viresh Kumar 2015-06-18 122
7486f5ad Viresh Kumar 2015-06-18 123 static int sun5i_clkevt_set_periodic(struct clock_event_device *clkevt)
7486f5ad Viresh Kumar 2015-06-18 124 {
7486f5ad Viresh Kumar 2015-06-18 125 struct sun5i_timer_clkevt *ce = to_sun5i_timer_clkevt(clkevt);
7486f5ad Viresh Kumar 2015-06-18 126
7486f5ad Viresh Kumar 2015-06-18 127 sun5i_clkevt_time_stop(ce, 0);
7486f5ad Viresh Kumar 2015-06-18 128 sun5i_clkevt_time_setup(ce, 0, ce->timer.ticks_per_jiffy);
7486f5ad Viresh Kumar 2015-06-18 129 sun5i_clkevt_time_start(ce, 0, true);
7486f5ad Viresh Kumar 2015-06-18 130 return 0;
67905540 Maxime Ripard 2013-11-07 131 }
67905540 Maxime Ripard 2013-11-07 132
67905540 Maxime Ripard 2013-11-07 133 static int sun5i_clkevt_next_event(unsigned long evt,
4a59058f Maxime Ripard 2015-03-31 134 struct clock_event_device *clkevt)
67905540 Maxime Ripard 2013-11-07 135 {
4a59058f Maxime Ripard 2015-03-31 136 struct sun5i_timer_clkevt *ce = to_sun5i_timer_clkevt(clkevt);
4a59058f Maxime Ripard 2015-03-31 137
4a59058f Maxime Ripard 2015-03-31 138 sun5i_clkevt_time_stop(ce, 0);
4a59058f Maxime Ripard 2015-03-31 139 sun5i_clkevt_time_setup(ce, 0, evt - TIMER_SYNC_TICKS);
4a59058f Maxime Ripard 2015-03-31 140 sun5i_clkevt_time_start(ce, 0, false);
67905540 Maxime Ripard 2013-11-07 141
67905540 Maxime Ripard 2013-11-07 142 return 0;
67905540 Maxime Ripard 2013-11-07 143 }
67905540 Maxime Ripard 2013-11-07 144
67905540 Maxime Ripard 2013-11-07 145 static irqreturn_t sun5i_timer_interrupt(int irq, void *dev_id)
67905540 Maxime Ripard 2013-11-07 146 {
4a59058f Maxime Ripard 2015-03-31 147 struct sun5i_timer_clkevt *ce = (struct sun5i_timer_clkevt *)dev_id;
67905540 Maxime Ripard 2013-11-07 148
4a59058f Maxime Ripard 2015-03-31 149 writel(0x1, ce->timer.base + TIMER_IRQ_ST_REG);
4a59058f Maxime Ripard 2015-03-31 150 ce->clkevt.event_handler(&ce->clkevt);
67905540 Maxime Ripard 2013-11-07 151
67905540 Maxime Ripard 2013-11-07 152 return IRQ_HANDLED;
67905540 Maxime Ripard 2013-11-07 153 }
67905540 Maxime Ripard 2013-11-07 154
a5a1d1c2 Thomas Gleixner 2016-12-21 155 static u64 sun5i_clksrc_read(struct clocksource *clksrc)
59387683 Chen-Yu Tsai 2016-10-18 156 {
59387683 Chen-Yu Tsai 2016-10-18 @157 struct sun5i_timer_clksrc *cs = to_sun5i_timer_clksrc(clksrc);
59387683 Chen-Yu Tsai 2016-10-18 158
59387683 Chen-Yu Tsai 2016-10-18 159 return ~readl(cs->timer.base + TIMER_CNTVAL_LO_REG(1));
59387683 Chen-Yu Tsai 2016-10-18 160 }
59387683 Chen-Yu Tsai 2016-10-18 161
3071efa4 Maxime Ripard 2015-03-31 162 static int sun5i_rate_cb_clksrc(struct notifier_block *nb,
3071efa4 Maxime Ripard 2015-03-31 163 unsigned long event, void *data)
3071efa4 Maxime Ripard 2015-03-31 164 {
3071efa4 Maxime Ripard 2015-03-31 165 struct clk_notifier_data *ndata = data;
3071efa4 Maxime Ripard 2015-03-31 166 struct sun5i_timer *timer = to_sun5i_timer(nb);
3071efa4 Maxime Ripard 2015-03-31 167 struct sun5i_timer_clksrc *cs = container_of(timer, struct sun5i_timer_clksrc, timer);
3071efa4 Maxime Ripard 2015-03-31 168
3071efa4 Maxime Ripard 2015-03-31 169 switch (event) {
3071efa4 Maxime Ripard 2015-03-31 170 case PRE_RATE_CHANGE:
3071efa4 Maxime Ripard 2015-03-31 @171 clocksource_unregister(&cs->clksrc);
3071efa4 Maxime Ripard 2015-03-31 172 break;
3071efa4 Maxime Ripard 2015-03-31 173
3071efa4 Maxime Ripard 2015-03-31 174 case POST_RATE_CHANGE:
3071efa4 Maxime Ripard 2015-03-31 @175 clocksource_register_hz(&cs->clksrc, ndata->new_rate);
3071efa4 Maxime Ripard 2015-03-31 176 break;
3071efa4 Maxime Ripard 2015-03-31 177
3071efa4 Maxime Ripard 2015-03-31 178 default:
3071efa4 Maxime Ripard 2015-03-31 179 break;
3071efa4 Maxime Ripard 2015-03-31 180 }
3071efa4 Maxime Ripard 2015-03-31 181
3071efa4 Maxime Ripard 2015-03-31 182 return NOTIFY_DONE;
3071efa4 Maxime Ripard 2015-03-31 183 }
3071efa4 Maxime Ripard 2015-03-31 184
4a59058f Maxime Ripard 2015-03-31 185 static int __init sun5i_setup_clocksource(struct device_node *node,
4a59058f Maxime Ripard 2015-03-31 186 void __iomem *base,
4a59058f Maxime Ripard 2015-03-31 187 struct clk *clk, int irq)
4a59058f Maxime Ripard 2015-03-31 188 {
4a59058f Maxime Ripard 2015-03-31 189 struct sun5i_timer_clksrc *cs;
4a59058f Maxime Ripard 2015-03-31 190 unsigned long rate;
4a59058f Maxime Ripard 2015-03-31 191 int ret;
4a59058f Maxime Ripard 2015-03-31 192
4a59058f Maxime Ripard 2015-03-31 193 cs = kzalloc(sizeof(*cs), GFP_KERNEL);
4a59058f Maxime Ripard 2015-03-31 194 if (!cs)
4a59058f Maxime Ripard 2015-03-31 195 return -ENOMEM;
4a59058f Maxime Ripard 2015-03-31 196
4a59058f Maxime Ripard 2015-03-31 197 ret = clk_prepare_enable(clk);
4a59058f Maxime Ripard 2015-03-31 198 if (ret) {
4a59058f Maxime Ripard 2015-03-31 199 pr_err("Couldn't enable parent clock\n");
4a59058f Maxime Ripard 2015-03-31 200 goto err_free;
4a59058f Maxime Ripard 2015-03-31 201 }
4a59058f Maxime Ripard 2015-03-31 202
4a59058f Maxime Ripard 2015-03-31 203 rate = clk_get_rate(clk);
4a59058f Maxime Ripard 2015-03-31 204
4a59058f Maxime Ripard 2015-03-31 205 cs->timer.base = base;
4a59058f Maxime Ripard 2015-03-31 206 cs->timer.clk = clk;
3071efa4 Maxime Ripard 2015-03-31 207 cs->timer.clk_rate_cb.notifier_call = sun5i_rate_cb_clksrc;
3071efa4 Maxime Ripard 2015-03-31 208 cs->timer.clk_rate_cb.next = NULL;
3071efa4 Maxime Ripard 2015-03-31 209
3071efa4 Maxime Ripard 2015-03-31 210 ret = clk_notifier_register(clk, &cs->timer.clk_rate_cb);
3071efa4 Maxime Ripard 2015-03-31 211 if (ret) {
3071efa4 Maxime Ripard 2015-03-31 212 pr_err("Unable to register clock notifier.\n");
3071efa4 Maxime Ripard 2015-03-31 213 goto err_disable_clk;
3071efa4 Maxime Ripard 2015-03-31 214 }
4a59058f Maxime Ripard 2015-03-31 215
4a59058f Maxime Ripard 2015-03-31 216 writel(~0, base + TIMER_INTVAL_LO_REG(1));
4a59058f Maxime Ripard 2015-03-31 217 writel(TIMER_CTL_ENABLE | TIMER_CTL_RELOAD,
4a59058f Maxime Ripard 2015-03-31 218 base + TIMER_CTL_REG(1));
4a59058f Maxime Ripard 2015-03-31 219
59387683 Chen-Yu Tsai 2016-10-18 220 cs->clksrc.name = node->name;
59387683 Chen-Yu Tsai 2016-10-18 221 cs->clksrc.rating = 340;
59387683 Chen-Yu Tsai 2016-10-18 222 cs->clksrc.read = sun5i_clksrc_read;
59387683 Chen-Yu Tsai 2016-10-18 @223 cs->clksrc.mask = CLOCKSOURCE_MASK(32);
59387683 Chen-Yu Tsai 2016-10-18 @224 cs->clksrc.flags = CLOCK_SOURCE_IS_CONTINUOUS;
59387683 Chen-Yu Tsai 2016-10-18 225
59387683 Chen-Yu Tsai 2016-10-18 226 ret = clocksource_register_hz(&cs->clksrc, rate);
4a59058f Maxime Ripard 2015-03-31 227 if (ret) {
4a59058f Maxime Ripard 2015-03-31 228 pr_err("Couldn't register clock source.\n");
3071efa4 Maxime Ripard 2015-03-31 229 goto err_remove_notifier;
4a59058f Maxime Ripard 2015-03-31 230 }
4a59058f Maxime Ripard 2015-03-31 231
4a59058f Maxime Ripard 2015-03-31 232 return 0;
4a59058f Maxime Ripard 2015-03-31 233
3071efa4 Maxime Ripard 2015-03-31 234 err_remove_notifier:
3071efa4 Maxime Ripard 2015-03-31 235 clk_notifier_unregister(clk, &cs->timer.clk_rate_cb);
4a59058f Maxime Ripard 2015-03-31 236 err_disable_clk:
4a59058f Maxime Ripard 2015-03-31 237 clk_disable_unprepare(clk);
4a59058f Maxime Ripard 2015-03-31 238 err_free:
4a59058f Maxime Ripard 2015-03-31 239 kfree(cs);
4a59058f Maxime Ripard 2015-03-31 240 return ret;
4a59058f Maxime Ripard 2015-03-31 241 }
4a59058f Maxime Ripard 2015-03-31 242
3071efa4 Maxime Ripard 2015-03-31 243 static int sun5i_rate_cb_clkevt(struct notifier_block *nb,
3071efa4 Maxime Ripard 2015-03-31 244 unsigned long event, void *data)
3071efa4 Maxime Ripard 2015-03-31 245 {
3071efa4 Maxime Ripard 2015-03-31 246 struct clk_notifier_data *ndata = data;
3071efa4 Maxime Ripard 2015-03-31 247 struct sun5i_timer *timer = to_sun5i_timer(nb);
3071efa4 Maxime Ripard 2015-03-31 248 struct sun5i_timer_clkevt *ce = container_of(timer, struct sun5i_timer_clkevt, timer);
3071efa4 Maxime Ripard 2015-03-31 249
3071efa4 Maxime Ripard 2015-03-31 250 if (event == POST_RATE_CHANGE) {
3071efa4 Maxime Ripard 2015-03-31 @251 clockevents_update_freq(&ce->clkevt, ndata->new_rate);
3071efa4 Maxime Ripard 2015-03-31 252 ce->timer.ticks_per_jiffy = DIV_ROUND_UP(ndata->new_rate, HZ);
3071efa4 Maxime Ripard 2015-03-31 253 }
3071efa4 Maxime Ripard 2015-03-31 254
:::::: The code at line 52 was first introduced by commit
:::::: 4a59058f0b09682200c04b1db236b4a3b92128d7 clocksource/drivers/sun5i: Refactor the current code
:::::: TO: Maxime Ripard <maxime.ripard@free-electrons.com>
:::::: CC: Ingo Molnar <mingo@kernel.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 50171 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v5 2/2] mfd: axp20x-i2c: Document that this must be builtin on x86
2017-05-26 11:15 ` [PATCH v5 2/2] mfd: axp20x-i2c: Document that this must be builtin on x86 Hans de Goede
2017-05-26 12:00 ` Chen-Yu Tsai
@ 2017-05-30 9:28 ` Lee Jones
1 sibling, 0 replies; 6+ messages in thread
From: Lee Jones @ 2017-05-30 9:28 UTC (permalink / raw)
To: Hans de Goede; +Cc: Chen-Yu Tsai, linux-kernel
On Fri, 26 May 2017, Hans de Goede wrote:
> On x86 the axp288 PMIC provides an ACPI OpRegion handler, which must be
AXP288
> available before other drivers using it are loaded, which can only be
> ensured if the mfd, OpRegionr and i2c-bus drivers are built in.
MFD
OpRegion
built-in
> Since the axp20x mfd code is used on non X86 too we cannot simply change
AXP20x MFD
Either X86 or x86 -- please be consistent.
> this into a bool, I've tried some Kconfig magic with if x86 but I could
> not get this working correctly, so this commit just documents that this
> should be builtin on x86, which fixes errors like these during boot:
Once the typos have been fixed, you can apply my:
For my own reference:
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
> mmc0: SDHCI controller on ACPI [80860F14:00] using ADMA
> ACPI Error: No handler for Region [REGS] (ffff93543b0cc3a8) [UserDefinedRegion]
> ACPI Error: Region UserDefinedRegion (ID=143) has no handler (20170119/exfldio-2
> ACPI Error: Method parse/execution failed [\_SB.PCI0.I2C7.PMI5.GET] (Node ffff93
> ACPI Error: Method parse/execution failed [\_SB.PCI0.SHC1._PS0] (Node ffff93543b
> acpi 80860F14:02: Failed to change power state to D0
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> -Fix Kconfig depends and selects to fix warning reported by kbuild test robot
> -Improve commit msg (add example of ACPI errors this avoids)
> Changes in v3:
> -Since the axp20x mfd code is used on ARM too where it does not necessarily
> need to be builtin settle for simply documenting the need to have this
> builtin on x86
> Changes in v5:
> -Fix I2C spelling
> ---
> drivers/mfd/Kconfig | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 4f71cab2e6e8..e03853affcc5 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -160,6 +160,11 @@ config MFD_AXP20X_I2C
> components like regulators or the PEK (Power Enable Key) under the
> corresponding menus.
>
> + Note on x86 this provides an ACPI OpRegion, so this must be 'y'
> + (builtin) and not a module, as the OpRegion must be available as
> + soon as possible. For the same reason the I2C bus driver options
> + I2C_DESIGNWARE_PLATFORM and I2C_DESIGNWARE_BAYTRAIL must be 'y' too.
> +
> config MFD_AXP20X_RSB
> tristate "X-Powers AXP series PMICs with RSB"
> select MFD_AXP20X
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v5 1/2] mfd: intel_soc_pmic: Select designware i2c-bus driver
2017-05-26 11:15 [PATCH v5 1/2] mfd: intel_soc_pmic: Select designware i2c-bus driver Hans de Goede
2017-05-26 11:15 ` [PATCH v5 2/2] mfd: axp20x-i2c: Document that this must be builtin on x86 Hans de Goede
2017-05-28 5:30 ` [PATCH v5 1/2] mfd: intel_soc_pmic: Select designware i2c-bus driver kbuild test robot
@ 2017-05-30 9:29 ` Lee Jones
2 siblings, 0 replies; 6+ messages in thread
From: Lee Jones @ 2017-05-30 9:29 UTC (permalink / raw)
To: Hans de Goede; +Cc: Chen-Yu Tsai, linux-kernel, Andy Shevchenko
On Fri, 26 May 2017, Hans de Goede wrote:
> The Crystal Cove PMIC provides an ACPI OPRegion handler, which must be
> available before other drivers using it are loaded, which is why
> INTEL_SOC_PMIC is a bool.
>
> Just having the driver is not enough, the driver for the i2c-bus must
> also be built in, to ensure this, this patch adds a select for it.
>
> This fixes errors like these during boot:
>
> mmc0: SDHCI controller on ACPI [80860F14:00] using ADMA
> ACPI Error: No handler for Region [REGS] (ffff93543b0cc3a8) [UserDefinedRegion] (20170119/evregion-166)
> ACPI Error: Region UserDefinedRegion (ID=143) has no handler (20170119/exfldio-299)
> ACPI Error: Method parse/execution failed [\_SB.PCI0.I2C7.PMI5.GET] (Node ffff93543b0cde10), AE_NOT_EXIST (20170119/psparse-543)
> ACPI Error: Method parse/execution failed [\_SB.PCI0.SHC1._PS0] (Node ffff93543b0b5cd0), AE_NOT_EXIST (20170119/psparse-543)
> acpi 80860F14:02: Failed to change power state to D0
>
> While at it this patch also changes the human readable name of the Kconfig
> option to make clear the INTEL_SOC_PMIC option selects support for the
> Intel Crystal Cove PMIC and documents why this is a bool.
>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> Changes in v2:
> -Fix Kconfig depends and selects to fix warning reported by kbuild test robot
> -Improve commit msg (add example of ACPI errors this avoids)
> Changes in v3:
> -No changes
> Changes in v4:
> -Add explanation why this is a bool and why it selects i2c-designwaree
> to the help text rather then as comments in the Kconfig
> Changes in v5:
> -Add Andy's Reviewed-by
> -Fix OpRegion spelling
> ---
> drivers/mfd/Kconfig | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
Applied, thanks.
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 1b6a83a4a114..4f71cab2e6e8 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -448,17 +448,24 @@ config LPC_SCH
>
> config INTEL_SOC_PMIC
> bool "Support for Crystal Cove PMIC"
> - depends on GPIOLIB
> - depends on I2C=y
> + depends on HAS_IOMEM
> + select GPIOLIB
> + select I2C
> select MFD_CORE
> select REGMAP_I2C
> select REGMAP_IRQ
> + select COMMON_CLK
> + select I2C_DESIGNWARE_PLATFORM
> help
> Select this option to enable support for Crystal Cove PMIC
> on some Intel SoC systems. The PMIC provides ADC, GPIO,
> thermal, charger and related power management functions
> on these systems.
>
> + This option is a bool as it provides an ACPI OpRegion which must be
> + available before any devices using it are probed. This option also
> + causes the designware-i2c driver to be builtin for the same reason.
> +
> config INTEL_SOC_PMIC_BXTWC
> tristate "Support for Intel Broxton Whiskey Cove PMIC"
> depends on INTEL_PMC_IPC
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-05-30 9:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-26 11:15 [PATCH v5 1/2] mfd: intel_soc_pmic: Select designware i2c-bus driver Hans de Goede
2017-05-26 11:15 ` [PATCH v5 2/2] mfd: axp20x-i2c: Document that this must be builtin on x86 Hans de Goede
2017-05-26 12:00 ` Chen-Yu Tsai
2017-05-30 9:28 ` Lee Jones
2017-05-28 5:30 ` [PATCH v5 1/2] mfd: intel_soc_pmic: Select designware i2c-bus driver kbuild test robot
2017-05-30 9:29 ` Lee Jones
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.