clk: x86: Add Atom PMC platform clocks
Subsystems (2)
PATCH RESEND v4 1/1 clk: x86: Add Atom PMC platform clocks
The BayTrail and CherryTrail platforms provide platform clocks through their Power Management Controller (PMC).
The SoC supports up to 6 clocks (PMC_PLT_CLK[5:0]) with a frequency of either 19.2 MHz (PLL) or 25 MHz (XTAL) for BayTrail an a frequency of 19.2 MHz (XTAL) for CherryTrail. These clocks are available for general system use, where appropriate, and each have Control & Frequency register fields associated with them.
For example, the usage for platform clocks suggested in the datasheet is the following:
PLT_CLK[2:0] - Camera
PLT_CLK[3] - Audio Codec
PLT_CLK[4] -
PLT_CLK[5] - COMMs
---
Hi,
This patch specifically enables the audio MCLK required by Baytrail CR devices (support already merged in Mark's tree).
The patch has already been reviewed by Stephen Boyd [1]. The only remaining question is the one pointed out by Stephen:
"Will there be problems if this merges through clk tree? If so we could take the clk driver part and the platform data include part could be duplicated into both trees. Or clk tree could be pulled into x86?" [1]
Ingo, can you help answer this question (or point me to the right person)? I am not sure what the process should be in this case.
Thank you,
Irina
[1] http://www.spinics.net/lists/alsa-devel/msg54832.html
Changes from v3:
- replace devm_kzalloc with devm_kcalloc
- add x86 architecture maintainers
Changes from v2:
- move clk platform data structures to a separate include file
- store clk_hw pointer for the fixed rate clocks
Changes from v1:
- register the clk device as child of pmc device
- pass iomem pointer from pmc driver to clk driver to avoid using
pmc_atom_read()/write() and use readl/writel API instead
- use devm_clk_hw_register/clkdev_hw_create instead of
clk_register/clkdev_create
arch/x86/Kconfig | 1 + arch/x86/include/asm/pmc_atom.h | 3 + arch/x86/platform/atom/pmc_atom.c | 78 +++++- drivers/clk/x86/Makefile | 1 + drivers/clk/x86/clk-byt-plt.c | 380 ++++++++++++++++++++++++++++++ include/linux/platform_data/clk-byt-plt.h | 31 +++ 6 files changed, 491 insertions(+), 3 deletions(-) create mode 100644 drivers/clk/x86/clk-byt-plt.c create mode 100644 include/linux/platform_data/clk-byt-plt.h
arch/x86/Kconfig +1 -0
@@ -2756,6 +2756,7 @@ config X86_DMA_REMAP config PMC_ATOM def_bool y depends on PCI + select COMMON_CLK source "net/Kconfig"
arch/x86/include/asm/pmc_atom.h +3 -0
@@ -50,6 +50,9 @@ BIT_ORED_DEDICATED_IRQ_GPSC | \ BIT_SHARED_IRQ_GPSS) +/* Platform clock control registers */ +#define PMC_CLK_CTL_0 0x60 +/* The timers acumulate time spent in sleep state */ #define PMC_S0IR_TMR 0x80#define PMC_S0I1_TMR 0x84
arch/x86/platform/atom/pmc_atom.c +75 -3
123 lines not on this page · raw message
drivers/clk/x86/Makefile +1 -0
@@ -1,2 +1,3 @@ clk-x86-lpss-objs := clk-lpt.o obj-$(CONFIG_X86_INTEL_LPSS) += clk-x86-lpss.o +obj-$(CONFIG_PMC_ATOM) += clk-byt-plt.o
drivers/clk/x86/clk-byt-plt.c new file +380 -0
380 lines not on this page · raw message
include/linux/platform_data/clk-byt-plt.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* Intel Atom platform clocks for BayTrail and CherryTrail SoC. +* +* Copyright (C) 2016, Intel Corporation +* Author: Irina Tirdea <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +*/ + +#ifndef __CLK_BYT_PLT_H +#define __CLK_BYT_PLT_H + +struct pmc_clk { +const char *name; +unsigned long freq; +const char *parent_name; +}; + +struct pmc_clk_data { +void __iomem *base; +const struct pmc_clk *clks; +}; + +#endif /* __CLK_BYT_PLT_H */
Signature · 1 line
1.9.1
Quoted 6 lines · Irina Tirdea
The patch has already been reviewed by Stephen Boyd [1]. The only remaining question is the one pointed out by Stephen:
"Will there be problems if this merges through clk tree? If so we could take the clk driver part and the platform data include part could be duplicated into both trees. Or clk tree could be pulled into x86?" [1]
The proper thing to do is:
Move all that cruft including arch/x86/platform/atom/pmc_atom.c into drivers/platform/x86. There is nothing architecture specific in these files. It's pure peripheral driver enablement. So drivers/platform/x86 is the proper location for this. Please discuss this with Darren Hart (cc'ed).
Thanks,
tglx
Quoted 8 lines · Thomas Gleixner
Quoted 6 lines · Irina Tirdea
The patch has already been reviewed by Stephen Boyd [1]. The only remaining question is the one pointed out by Stephen:
"Will there be problems if this merges through clk tree? If so we could take the clk driver part and the platform data include part could be duplicated into both trees. Or clk tree could be pulled into x86?" [1]
Quoted 6 lines
The proper thing to do is:
Move all that cruft including
arch/x86/platform/atom/pmc_atom.cintodrivers/platform/x86. There is nothing architecture specific in these files. It's pure peripheral driver enablement. Sodrivers/platform/x86is the proper location for this. Please discuss this with Darren Hart (cc'ed).
We've been adding more of the pmc and punit drivers to drivers/platform/x86. This makes more sense than being under "arch". Thomas and I have discussed moving more of the non architectural stuff in arch/x86/platform to my tree under platform/drivers/x86.
Irina, please point me at the relevant context if it's more than just this particular patch.
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Quoted 10 lines
-----Original Message-----
From: Darren Hart [mailto:[email protected]]
Sent: 21 October, 2016 8:00
To: Thomas Gleixner
Cc: Tirdea, Irina; [email protected]; [email protected]; Stephen Boyd; Ingo Molnar; Michael Turquette; H. Peter Anvin; alsa- [email protected]; Mark Brown; Takashi Iwai; Bossart, Pierre-louis; LKML; Pierre-Louis Bossart
Subject: Re: [RESEND PATCH v4] clk: x86: Add Atom PMC platform clocks
Quoted 16 lines
Quoted 14 lines · Thomas Gleixner
Quoted 6 lines · Irina Tirdea
The patch has already been reviewed by Stephen Boyd [1]. The only remaining question is the one pointed out by Stephen:
"Will there be problems if this merges through clk tree? If so we could take the clk driver part and the platform data include part could be duplicated into both trees. Or clk tree could be pulled into x86?" [1]The proper thing to do is:
Move all that cruft including
arch/x86/platform/atom/pmc_atom.cintodrivers/platform/x86. There is nothing architecture specific in these files. It's pure peripheral driver enablement. Sodrivers/platform/x86is the proper location for this. Please discuss this with Darren Hart (cc'ed).
Thanks for pointing me in the right direction, Thomas!
Quoted 5 lines
We've been adding more of the pmc and punit drivers to
drivers/platform/x86. This makes more sense than being under "arch". Thomas and I have discussed moving more of the non architectural stuff inarch/x86/platformto my tree under platform/drivers/x86.
Thanks for the reply, Darren.
I could move the arch/x86/platform/atom/pmc_atom.c into drivers/platform/x86, but I'm not sure what the process is in this case. I took a look at your tree and noticed some intel_pmc_* drivers, but they are quite different from pmc_atom.c in terms of HW registers and capabilities. Should the code from pmc_atom.c be integrated in the intel_pmc_* drivers or is it enough to move it as a standalone driver for now?
Quoted 2 lines
Irina, please point me at the relevant context if it's more than just this particular patch.
This patch comes from a set of patches that enable sound for Baytrail CR devices (especially Asus T100TAF) [1]. The rest of the patches have been already merged in Mark's sound tree. This is the only change remaining for enabling sound on these platforms, so there are no additional changes to the x86 platform code.
Thanks,
Irina
[1] http://mailman.alsa-project.org/pipermail/alsa-devel/2016-August/111704.html
Quoted 25 lines · Irina
Quoted 9 lines · Thomas Gleixner
Quoted 8 lines · Irina Tirdea
Quoted 6 lines
The patch has already been reviewed by Stephen Boyd [1]. The only remaining question is the one pointed out by Stephen:
"Will there be problems if this merges through clk tree? If so we could take the clk driver part and the platform data include part could be duplicated into both trees. Or clk tree could be pulled into x86?" [1]Quoted 7 lines
Quoted 6 lines
The proper thing to do is:
Move all that cruft including
arch/x86/platform/atom/pmc_atom.cintodrivers/platform/x86. There is nothing architecture specific in these files. It's pure peripheral driver enablement. Sodrivers/platform/x86is the proper location for this. Please discuss this with Darren Hart (cc'ed).Thanks for pointing me in the right direction, Thomas!
Quoted 5 lines
We've been adding more of the pmc and punit drivers to
drivers/platform/x86. This makes more sense than being under "arch". Thomas and I have discussed moving more of the non architectural stuff inarch/x86/platformto my tree under platform/drivers/x86.
Quoted 7 lines
Thanks for the reply, Darren.
I could move the
arch/x86/platform/atom/pmc_atom.cintodrivers/platform/x86, but I'm not sure what the process is in this case. I took a look at your tree and noticed some intel_pmc_* drivers, but they are quite different frompmc_atom.cin terms of HW registers and capabilities. Should the code frompmc_atom.cbe integrated in the intel_pmc_* drivers or is it enough to move it as a standalone driver for now?
If the functionality is substantially different, then I don't see a compelling, and certainly not an immediate, need to merge them. Assume for now they are to remain as separate drivers. I suggest keeping the existing name for now as well. Let's just complete the move with as little user-visible changes as possible.
The placement of the header file is a bit tricky as it is being used in drivers/clk/x86 in addition to the pmc_atom driver in drivers/platform/x86.
The best existing location would appear to be include/platform_data/
Thomas, is that acceptable to you?
arch/x86/platform/atom/pmc_atom.c -> drivers/platform/x86 arch/x86/include/asm/pmc_atom.h -> include/platform_data/
If there are enough of these, it might make sense to create:
include/platform/x86/
but I suggest we start with minimal change.
Quoted 15 lines
Quoted 3 lines
Irina, please point me at the relevant context if it's more than just this particular patch.
This patch comes from a set of patches that enable sound for Baytrail CR devices (especially Asus T100TAF) [1]. The rest of the patches have been already merged in Mark's sound tree. This is the only change remaining for enabling sound on these platforms, so there are no additional changes to the x86 platform code.
Thanks,
Irina[1] http://mailman.alsa-project.org/pipermail/alsa-devel/2016-August/111704.html
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Quoted 9 lines · Darren Hart
Quoted 1 line · Irina
intel_pmc_* drivers or is it enough to move it as a standalone driver for now?
If the functionality is substantially different, then I don't see a compelling, and certainly not an immediate, need to merge them. Assume for now they are to remain as separate drivers. I suggest keeping the existing name for now as well. Let's just complete the move with as little user-visible changes as possible.
Quoted 7 lines
The placement of the header file is a bit tricky as it is being used in
drivers/clk/x86in addition to thepmc_atomdriver indrivers/platform/x86.The best existing location would appear to be
include/platform_data/Thomas, is that acceptable to you?
Yes
Quoted 8 lines
arch/x86/platform/atom/pmc_atom.c->drivers/platform/x86arch/x86/include/asm/pmc_atom.h->include/platform_data/If there are enough of these, it might make sense to create:
include/platform/x86/but I suggest we start with minimal change.
No. Make that x86 directory right away. include/platform_data is already a maze of 224 files. Start structuring it now.
Thanks,
tglx
Quoted 23 lines · Thomas Gleixner
Quoted 9 lines · Darren Hart
Quoted 1 line · Irina
intel_pmc_* drivers or is it enough to move it as a standalone driver for now?
If the functionality is substantially different, then I don't see a compelling, and certainly not an immediate, need to merge them. Assume for now they are to remain as separate drivers. I suggest keeping the existing name for now as well. Let's just complete the move with as little user-visible changes as possible.
Quoted 7 lines
The placement of the header file is a bit tricky as it is being used in
drivers/clk/x86in addition to thepmc_atomdriver indrivers/platform/x86.The best existing location would appear to be
include/platform_data/Thomas, is that acceptable to you?
Yes
Quoted 3 lines
arch/x86/platform/atom/pmc_atom.c->drivers/platform/x86arch/x86/include/asm/pmc_atom.h->include/platform_data/
Quoted 8 lines
Quoted 5 lines
If there are enough of these, it might make sense to create:
include/platform/x86/but I suggest we start with minimal change.
No. Make that x86 directory right away.
include/platform_datais already a maze of 224 files. Start structuring it now.
OK, that's fine with me too.
(but I typo'd, should have been: include/linux/platform_data/x86)
Irina, does this give you enough to go on?
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Quoted 31 lines · Darren Hart
Quoted 30 lines · Thomas Gleixner
Quoted 10 lines · Darren Hart
Quoted 2 lines · Irina
intel_pmc_* drivers or is it enough to move it as a standalone driver for now?
If the functionality is substantially different, then I don't see a compelling, and certainly not an immediate, need to merge them. Assume for now they are to remain as separate drivers. I suggest keeping the existing name for now as well. Let's just complete the move with as little user-visible changes as possible.
Quoted 7 lines
The placement of the header file is a bit tricky as it is being used in
drivers/clk/x86in addition to thepmc_atomdriver indrivers/platform/x86.The best existing location would appear to be
include/platform_data/Thomas, is that acceptable to you?
Yes
Quoted 8 lines
arch/x86/platform/atom/pmc_atom.c->drivers/platform/x86arch/x86/include/asm/pmc_atom.h->include/platform_data/If there are enough of these, it might make sense to create:
include/platform/x86/but I suggest we start with minimal change.
Quoted 9 lines
Quoted 2 lines
No. Make that x86 directory right away.
include/platform_datais already a maze of 224 files. Start structuring it now.OK, that's fine with me too.
(but I typo'd, should have been:
include/linux/platform_data/x86)Irina, does this give you enough to go on?
Yes, everything is clear now. I will make the change and send a patch in a few days.
Thanks,
Irina