Skip to contentSkip to conversation

x86: pmc_atom: Add Cherrytrail support

PATCH In review Andy Shevchenko 6 participants 20 messages Jul 6, 2015 – Jul 7, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover x86: pmc_atom: Add Cherrytrail support

This is the next generation of the patch series which had been sent earlier [1] to support Intel CherryTrail SoC.

The patches were tested on both BayTrail and CherryTrail SoCs.

[1] http://www.spinics.net/lists/linux-acpi/msg55213.html

Changes to v2:
- added patch 1 that replaces previous patch 1 and exports PMC accessors
- amended subject line for patch 4
- added patch 5 that moves the driver under arch/x86/platform/atom hood
- rebased on top of recent linux-next

Changes to v1:
- rebased on top of recent pmc_atom changes
- cleaned up, reqorked and split to few smaller patches

Andy Shevchenko (5):
x86: pmc_atom: export accessors to PMC registers
x86: pmc_atom: print index of device in loop
x86: pmc_atom: supply register mappings via pmc object
x86: pmc_atom: Add Cherrytrail PMC interface
x86: pmc_atom: place it under arch/x86/platform/atom

 arch/x86/include/asm/pmc_atom.h               |  29 +++
 arch/x86/kernel/Makefile                      |   1 -
 arch/x86/platform/atom/Makefile               |   3 +-
 arch/x86/{kernel => platform/atom}/pmc_atom.c | 302 +++++++++++++++++---------
 4 files changed, 229 insertions(+), 106 deletions(-)
 rename arch/x86/{kernel => platform/atom}/pmc_atom.c (53%)
Signature · 1 line
2.1.4
#1 lore raw

PATCH v3 1/5 x86: pmc_atom: export accessors to PMC registers

Export pmc_atom_read() and pmc_atom_write() accessors to the PMC registers. On early initcall stages the functions will return -ENODEV, and caller has to wait when it will be available. Additionally make absence of debugfs a non-fatal error.

The patch will be useful for the upcoming fixes regarding to LPSS block found on Intel BayTrail-T and Braswell.

---
 arch/x86/include/asm/pmc_atom.h |  4 ++++
 arch/x86/kernel/pmc_atom.c      | 49 ++++++++++++++++++++++++++++-------------
 2 files changed, 38 insertions(+), 15 deletions(-)
arch/x86/include/asm/pmc_atom.h +4 -0
index bc0fc08..6ee2200 100644
@@ -126,4 +126,8 @@
 #define	SLEEP_TYPE_MASK		0xFFFFECFF
 #define	SLEEP_TYPE_S5		0x1C00
 #define	SLEEP_ENABLE		0x2000
+
+extern int pmc_atom_read(int offset, u32 *value);
+extern int pmc_atom_write(int offset, u32 value);
+
 #endif /* PMC_ATOM_H */
arch/x86/kernel/pmc_atom.c +34 -15

95 lines not on this page · raw message

Signature · 1 line
2.1.4
#2 lore raw

[tip:x86/platform] x86/platform/intel/pmc_atom: Export accessors to PMC registers

x86/platform/intel/pmc_atom: Export accessors to PMC registers
Commit-ID:  68872eb9b19bbd85883262a4e0927b487653816c
Gitweb:     http://git.kernel.org/tip/68872eb9b19bbd85883262a4e0927b487653816c
Author:     Andy Shevchenko <[email protected]>
AuthorDate: Mon, 6 Jul 2015 17:29:00 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 6 Jul 2015 17:42:45 +0200

x86/platform/intel/pmc_atom: Export accessors to PMC registers

Export the pmc_atom_read() and pmc_atom_write() accessors to the PMC registers. On early initcall stages the functions will return -ENODEV, and caller has to wait when it will be available.

Additionally make absence of debugfs a non-fatal error.

The patch will be useful for the upcoming fixes regarding to the LPSS block found on Intel BayTrail-T and Braswell.

---
 arch/x86/include/asm/pmc_atom.h |  4 ++++
 arch/x86/kernel/pmc_atom.c      | 49 ++++++++++++++++++++++++++++-------------
 2 files changed, 38 insertions(+), 15 deletions(-)
arch/x86/include/asm/pmc_atom.h +4 -0
index bc0fc08..6ee2200 100644
@@ -126,4 +126,8 @@
 #define	SLEEP_TYPE_MASK		0xFFFFECFF
 #define	SLEEP_TYPE_S5		0x1C00
 #define	SLEEP_ENABLE		0x2000
+
+extern int pmc_atom_read(int offset, u32 *value);
+extern int pmc_atom_write(int offset, u32 value);
+
 #endif /* PMC_ATOM_H */
arch/x86/kernel/pmc_atom.c +34 -15

95 lines not on this page · raw message

#3 lore raw

PATCH v3 2/5 x86: pmc_atom: print index of device in loop

In reply to Andy Shevchenko

The register mapping may change from one platform to another. Thus, indices might be not the same on different platforms. The patch makes the code to print the device index dynamically at run time.

The patch also changes the for loop to iterate over the map until a terminator is found.

---
 arch/x86/kernel/pmc_atom.c | 126 ++++++++++++++++++++++-----------------------
 1 file changed, 63 insertions(+), 63 deletions(-)
arch/x86/kernel/pmc_atom.c +63 -63
index 4e1242e..c7dca07 100644
@@ -43,63 +43,65 @@ struct pmc_bit_map {
 };
 
 static const struct pmc_bit_map dev_map[] = {
-	{"0  - LPSS1_F0_DMA",		BIT_LPSS1_F0_DMA},
-	{"1  - LPSS1_F1_PWM1",		BIT_LPSS1_F1_PWM1},
-	{"2  - LPSS1_F2_PWM2",		BIT_LPSS1_F2_PWM2},
-	{"3  - LPSS1_F3_HSUART1",	BIT_LPSS1_F3_HSUART1},
-	{"4  - LPSS1_F4_HSUART2",	BIT_LPSS1_F4_HSUART2},
-	{"5  - LPSS1_F5_SPI",		BIT_LPSS1_F5_SPI},
-	{"6  - LPSS1_F6_Reserved",	BIT_LPSS1_F6_XXX},
-	{"7  - LPSS1_F7_Reserved",	BIT_LPSS1_F7_XXX},
-	{"8  - SCC_EMMC",		BIT_SCC_EMMC},
-	{"9  - SCC_SDIO",		BIT_SCC_SDIO},
-	{"10 - SCC_SDCARD",		BIT_SCC_SDCARD},
-	{"11 - SCC_MIPI",		BIT_SCC_MIPI},
-	{"12 - HDA",			BIT_HDA},
-	{"13 - LPE",			BIT_LPE},
-	{"14 - OTG",			BIT_OTG},
-	{"15 - USH",			BIT_USH},
-	{"16 - GBE",			BIT_GBE},
-	{"17 - SATA",			BIT_SATA},
-	{"18 - USB_EHCI",		BIT_USB_EHCI},
-	{"19 - SEC",			BIT_SEC},
-	{"20 - PCIE_PORT0",		BIT_PCIE_PORT0},
-	{"21 - PCIE_PORT1",		BIT_PCIE_PORT1},
-	{"22 - PCIE_PORT2",		BIT_PCIE_PORT2},
-	{"23 - PCIE_PORT3",		BIT_PCIE_PORT3},
-	{"24 - LPSS2_F0_DMA",		BIT_LPSS2_F0_DMA},
-	{"25 - LPSS2_F1_I2C1",		BIT_LPSS2_F1_I2C1},
-	{"26 - LPSS2_F2_I2C2",		BIT_LPSS2_F2_I2C2},
-	{"27 - LPSS2_F3_I2C3",		BIT_LPSS2_F3_I2C3},
-	{"28 - LPSS2_F3_I2C4",		BIT_LPSS2_F4_I2C4},
-	{"29 - LPSS2_F5_I2C5",		BIT_LPSS2_F5_I2C5},
-	{"30 - LPSS2_F6_I2C6",		BIT_LPSS2_F6_I2C6},
-	{"31 - LPSS2_F7_I2C7",		BIT_LPSS2_F7_I2C7},
-	{"32 - SMB",			BIT_SMB},
-	{"33 - OTG_SS_PHY",		BIT_OTG_SS_PHY},
-	{"34 - USH_SS_PHY",		BIT_USH_SS_PHY},
-	{"35 - DFX",			BIT_DFX},
+	{"LPSS1_F0_DMA",	BIT_LPSS1_F0_DMA},
+	{"LPSS1_F1_PWM1",	BIT_LPSS1_F1_PWM1},
+	{"LPSS1_F2_PWM2",	BIT_LPSS1_F2_PWM2},
+	{"LPSS1_F3_HSUART1",	BIT_LPSS1_F3_HSUART1},
+	{"LPSS1_F4_HSUART2",	BIT_LPSS1_F4_HSUART2},
+	{"LPSS1_F5_SPI",	BIT_LPSS1_F5_SPI},
+	{"LPSS1_F6_Reserved",	BIT_LPSS1_F6_XXX},
+	{"LPSS1_F7_Reserved",	BIT_LPSS1_F7_XXX},
+	{"SCC_EMMC",		BIT_SCC_EMMC},
+	{"SCC_SDIO",		BIT_SCC_SDIO},
+	{"SCC_SDCARD",		BIT_SCC_SDCARD},
+	{"SCC_MIPI",		BIT_SCC_MIPI},
+	{"HDA",			BIT_HDA},
+	{"LPE",			BIT_LPE},
+	{"OTG",			BIT_OTG},
+	{"USH",			BIT_USH},
+	{"GBE",			BIT_GBE},
+	{"SATA",		BIT_SATA},
+	{"USB_EHCI",		BIT_USB_EHCI},
+	{"SEC",			BIT_SEC},
+	{"PCIE_PORT0",		BIT_PCIE_PORT0},
+	{"PCIE_PORT1",		BIT_PCIE_PORT1},
+	{"PCIE_PORT2",		BIT_PCIE_PORT2},
+	{"PCIE_PORT3",		BIT_PCIE_PORT3},
+	{"LPSS2_F0_DMA",	BIT_LPSS2_F0_DMA},
+	{"LPSS2_F1_I2C1",	BIT_LPSS2_F1_I2C1},
+	{"LPSS2_F2_I2C2",	BIT_LPSS2_F2_I2C2},
+	{"LPSS2_F3_I2C3",	BIT_LPSS2_F3_I2C3},
+	{"LPSS2_F3_I2C4",	BIT_LPSS2_F4_I2C4},
+	{"LPSS2_F5_I2C5",	BIT_LPSS2_F5_I2C5},
+	{"LPSS2_F6_I2C6",	BIT_LPSS2_F6_I2C6},
+	{"LPSS2_F7_I2C7",	BIT_LPSS2_F7_I2C7},
+	{"SMB",			BIT_SMB},
+	{"OTG_SS_PHY",		BIT_OTG_SS_PHY},
+	{"USH_SS_PHY",		BIT_USH_SS_PHY},
+	{"DFX",			BIT_DFX},
+	{},
 };
 
 static const struct pmc_bit_map pss_map[] = {
-	{"0  - GBE",			PMC_PSS_BIT_GBE},
-	{"1  - SATA",			PMC_PSS_BIT_SATA},
-	{"2  - HDA",			PMC_PSS_BIT_HDA},
-	{"3  - SEC",			PMC_PSS_BIT_SEC},
-	{"4  - PCIE",			PMC_PSS_BIT_PCIE},
-	{"5  - LPSS",			PMC_PSS_BIT_LPSS},
-	{"6  - LPE",			PMC_PSS_BIT_LPE},
-	{"7  - DFX",			PMC_PSS_BIT_DFX},
-	{"8  - USH_CTRL",		PMC_PSS_BIT_USH_CTRL},
-	{"9  - USH_SUS",		PMC_PSS_BIT_USH_SUS},
-	{"10 - USH_VCCS",		PMC_PSS_BIT_USH_VCCS},
-	{"11 - USH_VCCA",		PMC_PSS_BIT_USH_VCCA},
-	{"12 - OTG_CTRL",		PMC_PSS_BIT_OTG_CTRL},
-	{"13 - OTG_VCCS",		PMC_PSS_BIT_OTG_VCCS},
-	{"14 - OTG_VCCA_CLK",		PMC_PSS_BIT_OTG_VCCA_CLK},
-	{"15 - OTG_VCCA",		PMC_PSS_BIT_OTG_VCCA},
-	{"16 - USB",			PMC_PSS_BIT_USB},
-	{"17 - USB_SUS",		PMC_PSS_BIT_USB_SUS},
+	{"GBE",			PMC_PSS_BIT_GBE},
+	{"SATA",		PMC_PSS_BIT_SATA},
+	{"HDA",			PMC_PSS_BIT_HDA},
+	{"SEC",			PMC_PSS_BIT_SEC},
+	{"PCIE",		PMC_PSS_BIT_PCIE},
+	{"LPSS",		PMC_PSS_BIT_LPSS},
+	{"LPE",			PMC_PSS_BIT_LPE},
+	{"DFX",			PMC_PSS_BIT_DFX},
+	{"USH_CTRL",		PMC_PSS_BIT_USH_CTRL},
+	{"USH_SUS",		PMC_PSS_BIT_USH_SUS},
+	{"USH_VCCS",		PMC_PSS_BIT_USH_VCCS},
+	{"USH_VCCA",		PMC_PSS_BIT_USH_VCCA},
+	{"OTG_CTRL",		PMC_PSS_BIT_OTG_CTRL},
+	{"OTG_VCCS",		PMC_PSS_BIT_OTG_VCCS},
+	{"OTG_VCCA_CLK",	PMC_PSS_BIT_OTG_VCCA_CLK},
+	{"OTG_VCCA",		PMC_PSS_BIT_OTG_VCCA},
+	{"USB",			PMC_PSS_BIT_USB},
+	{"USB_SUS",		PMC_PSS_BIT_USB_SUS},
+	{},
 };
 
 static inline u32 pmc_reg_read(struct pmc_dev *pmc, int reg_offset)
@@ -172,16 +174,14 @@ static int pmc_dev_state_show(struct seq_file *s, void *unused)
 	struct pmc_dev *pmc = s->private;
 	u32 func_dis, func_dis_2, func_dis_index;
 	u32 d3_sts_0, d3_sts_1, d3_sts_index;
-	int dev_num, dev_index, reg_index;
+	int dev_index, reg_index;
 
 	func_dis = pmc_reg_read(pmc, PMC_FUNC_DIS);
 	func_dis_2 = pmc_reg_read(pmc, PMC_FUNC_DIS_2);
 	d3_sts_0 = pmc_reg_read(pmc, PMC_D3_STS_0);
 	d3_sts_1 = pmc_reg_read(pmc, PMC_D3_STS_1);
 
-	dev_num = ARRAY_SIZE(dev_map);
-
-	for (dev_index = 0; dev_index < dev_num; dev_index++) {
+	for (dev_index = 0; dev_map[dev_index].name; dev_index++) {
 		reg_index = dev_index / PMC_REG_BIT_WIDTH;
 		if (reg_index) {
 			func_dis_index = func_dis_2;
@@ -191,8 +191,8 @@ static int pmc_dev_state_show(struct seq_file *s, void *unused)
 			d3_sts_index = d3_sts_0;
 		}
 
-		seq_printf(s, "Dev: %-32s\tState: %s [%s]\n",
-			dev_map[dev_index].name,
+		seq_printf(s, "Dev: %-2d - %-32s\tState: %s [%s]\n",
+			dev_index, dev_map[dev_index].name,
 			dev_map[dev_index].bit_mask & func_dis_index ?
 			"Disabled" : "Enabled ",
 			dev_map[dev_index].bit_mask & d3_sts_index ?
@@ -219,9 +219,9 @@ static int pmc_pss_state_show(struct seq_file *s, void *unused)
 	u32 pss = pmc_reg_read(pmc, PMC_PSS);
 	int pss_index;
 
-	for (pss_index = 0; pss_index < ARRAY_SIZE(pss_map); pss_index++) {
-		seq_printf(s, "Island: %-32s\tState: %s\n",
-			pss_map[pss_index].name,
+	for (pss_index = 0; pss_map[pss_index].name; pss_index++) {
+		seq_printf(s, "Island: %-2d - %-32s\tState: %s\n",
+			pss_index, pss_map[pss_index].name,
 			pss_map[pss_index].bit_mask & pss ? "Off" : "On");
 	}
 	return 0;
Signature · 1 line
2.1.4
#4 lore raw

[tip:x86/platform] x86/platform/intel/pmc_atom: Print index of device in loop

x86/platform/intel/pmc_atom: Print index of device in loop
Commit-ID:  c3c65aa6d43f9e9f23f688848b08ffec97be893b
Gitweb:     http://git.kernel.org/tip/c3c65aa6d43f9e9f23f688848b08ffec97be893b
Author:     Andy Shevchenko <[email protected]>
AuthorDate: Mon, 6 Jul 2015 17:29:01 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 6 Jul 2015 17:42:46 +0200

x86/platform/intel/pmc_atom: Print index of device in loop

The register mapping may change from one platform to another. Thus, indices might be not the same on different platforms. The patch makes the code to print the device index dynamically at run time.

The patch also changes the for loop to iterate over the map until a terminator is found.

---
 arch/x86/kernel/pmc_atom.c | 126 ++++++++++++++++++++++-----------------------
 1 file changed, 63 insertions(+), 63 deletions(-)
arch/x86/kernel/pmc_atom.c +63 -63
index 4e1242e..c7dca07 100644
@@ -43,63 +43,65 @@ struct pmc_bit_map {
 };
 
 static const struct pmc_bit_map dev_map[] = {
-	{"0  - LPSS1_F0_DMA",		BIT_LPSS1_F0_DMA},
-	{"1  - LPSS1_F1_PWM1",		BIT_LPSS1_F1_PWM1},
-	{"2  - LPSS1_F2_PWM2",		BIT_LPSS1_F2_PWM2},
-	{"3  - LPSS1_F3_HSUART1",	BIT_LPSS1_F3_HSUART1},
-	{"4  - LPSS1_F4_HSUART2",	BIT_LPSS1_F4_HSUART2},
-	{"5  - LPSS1_F5_SPI",		BIT_LPSS1_F5_SPI},
-	{"6  - LPSS1_F6_Reserved",	BIT_LPSS1_F6_XXX},
-	{"7  - LPSS1_F7_Reserved",	BIT_LPSS1_F7_XXX},
-	{"8  - SCC_EMMC",		BIT_SCC_EMMC},
-	{"9  - SCC_SDIO",		BIT_SCC_SDIO},
-	{"10 - SCC_SDCARD",		BIT_SCC_SDCARD},
-	{"11 - SCC_MIPI",		BIT_SCC_MIPI},
-	{"12 - HDA",			BIT_HDA},
-	{"13 - LPE",			BIT_LPE},
-	{"14 - OTG",			BIT_OTG},
-	{"15 - USH",			BIT_USH},
-	{"16 - GBE",			BIT_GBE},
-	{"17 - SATA",			BIT_SATA},
-	{"18 - USB_EHCI",		BIT_USB_EHCI},
-	{"19 - SEC",			BIT_SEC},
-	{"20 - PCIE_PORT0",		BIT_PCIE_PORT0},
-	{"21 - PCIE_PORT1",		BIT_PCIE_PORT1},
-	{"22 - PCIE_PORT2",		BIT_PCIE_PORT2},
-	{"23 - PCIE_PORT3",		BIT_PCIE_PORT3},
-	{"24 - LPSS2_F0_DMA",		BIT_LPSS2_F0_DMA},
-	{"25 - LPSS2_F1_I2C1",		BIT_LPSS2_F1_I2C1},
-	{"26 - LPSS2_F2_I2C2",		BIT_LPSS2_F2_I2C2},
-	{"27 - LPSS2_F3_I2C3",		BIT_LPSS2_F3_I2C3},
-	{"28 - LPSS2_F3_I2C4",		BIT_LPSS2_F4_I2C4},
-	{"29 - LPSS2_F5_I2C5",		BIT_LPSS2_F5_I2C5},
-	{"30 - LPSS2_F6_I2C6",		BIT_LPSS2_F6_I2C6},
-	{"31 - LPSS2_F7_I2C7",		BIT_LPSS2_F7_I2C7},
-	{"32 - SMB",			BIT_SMB},
-	{"33 - OTG_SS_PHY",		BIT_OTG_SS_PHY},
-	{"34 - USH_SS_PHY",		BIT_USH_SS_PHY},
-	{"35 - DFX",			BIT_DFX},
+	{"LPSS1_F0_DMA",	BIT_LPSS1_F0_DMA},
+	{"LPSS1_F1_PWM1",	BIT_LPSS1_F1_PWM1},
+	{"LPSS1_F2_PWM2",	BIT_LPSS1_F2_PWM2},
+	{"LPSS1_F3_HSUART1",	BIT_LPSS1_F3_HSUART1},
+	{"LPSS1_F4_HSUART2",	BIT_LPSS1_F4_HSUART2},
+	{"LPSS1_F5_SPI",	BIT_LPSS1_F5_SPI},
+	{"LPSS1_F6_Reserved",	BIT_LPSS1_F6_XXX},
+	{"LPSS1_F7_Reserved",	BIT_LPSS1_F7_XXX},
+	{"SCC_EMMC",		BIT_SCC_EMMC},
+	{"SCC_SDIO",		BIT_SCC_SDIO},
+	{"SCC_SDCARD",		BIT_SCC_SDCARD},
+	{"SCC_MIPI",		BIT_SCC_MIPI},
+	{"HDA",			BIT_HDA},
+	{"LPE",			BIT_LPE},
+	{"OTG",			BIT_OTG},
+	{"USH",			BIT_USH},
+	{"GBE",			BIT_GBE},
+	{"SATA",		BIT_SATA},
+	{"USB_EHCI",		BIT_USB_EHCI},
+	{"SEC",			BIT_SEC},
+	{"PCIE_PORT0",		BIT_PCIE_PORT0},
+	{"PCIE_PORT1",		BIT_PCIE_PORT1},
+	{"PCIE_PORT2",		BIT_PCIE_PORT2},
+	{"PCIE_PORT3",		BIT_PCIE_PORT3},
+	{"LPSS2_F0_DMA",	BIT_LPSS2_F0_DMA},
+	{"LPSS2_F1_I2C1",	BIT_LPSS2_F1_I2C1},
+	{"LPSS2_F2_I2C2",	BIT_LPSS2_F2_I2C2},
+	{"LPSS2_F3_I2C3",	BIT_LPSS2_F3_I2C3},
+	{"LPSS2_F3_I2C4",	BIT_LPSS2_F4_I2C4},
+	{"LPSS2_F5_I2C5",	BIT_LPSS2_F5_I2C5},
+	{"LPSS2_F6_I2C6",	BIT_LPSS2_F6_I2C6},
+	{"LPSS2_F7_I2C7",	BIT_LPSS2_F7_I2C7},
+	{"SMB",			BIT_SMB},
+	{"OTG_SS_PHY",		BIT_OTG_SS_PHY},
+	{"USH_SS_PHY",		BIT_USH_SS_PHY},
+	{"DFX",			BIT_DFX},
+	{},
 };
 
 static const struct pmc_bit_map pss_map[] = {
-	{"0  - GBE",			PMC_PSS_BIT_GBE},
-	{"1  - SATA",			PMC_PSS_BIT_SATA},
-	{"2  - HDA",			PMC_PSS_BIT_HDA},
-	{"3  - SEC",			PMC_PSS_BIT_SEC},
-	{"4  - PCIE",			PMC_PSS_BIT_PCIE},
-	{"5  - LPSS",			PMC_PSS_BIT_LPSS},
-	{"6  - LPE",			PMC_PSS_BIT_LPE},
-	{"7  - DFX",			PMC_PSS_BIT_DFX},
-	{"8  - USH_CTRL",		PMC_PSS_BIT_USH_CTRL},
-	{"9  - USH_SUS",		PMC_PSS_BIT_USH_SUS},
-	{"10 - USH_VCCS",		PMC_PSS_BIT_USH_VCCS},
-	{"11 - USH_VCCA",		PMC_PSS_BIT_USH_VCCA},
-	{"12 - OTG_CTRL",		PMC_PSS_BIT_OTG_CTRL},
-	{"13 - OTG_VCCS",		PMC_PSS_BIT_OTG_VCCS},
-	{"14 - OTG_VCCA_CLK",		PMC_PSS_BIT_OTG_VCCA_CLK},
-	{"15 - OTG_VCCA",		PMC_PSS_BIT_OTG_VCCA},
-	{"16 - USB",			PMC_PSS_BIT_USB},
-	{"17 - USB_SUS",		PMC_PSS_BIT_USB_SUS},
+	{"GBE",			PMC_PSS_BIT_GBE},
+	{"SATA",		PMC_PSS_BIT_SATA},
+	{"HDA",			PMC_PSS_BIT_HDA},
+	{"SEC",			PMC_PSS_BIT_SEC},
+	{"PCIE",		PMC_PSS_BIT_PCIE},
+	{"LPSS",		PMC_PSS_BIT_LPSS},
+	{"LPE",			PMC_PSS_BIT_LPE},
+	{"DFX",			PMC_PSS_BIT_DFX},
+	{"USH_CTRL",		PMC_PSS_BIT_USH_CTRL},
+	{"USH_SUS",		PMC_PSS_BIT_USH_SUS},
+	{"USH_VCCS",		PMC_PSS_BIT_USH_VCCS},
+	{"USH_VCCA",		PMC_PSS_BIT_USH_VCCA},
+	{"OTG_CTRL",		PMC_PSS_BIT_OTG_CTRL},
+	{"OTG_VCCS",		PMC_PSS_BIT_OTG_VCCS},
+	{"OTG_VCCA_CLK",	PMC_PSS_BIT_OTG_VCCA_CLK},
+	{"OTG_VCCA",		PMC_PSS_BIT_OTG_VCCA},
+	{"USB",			PMC_PSS_BIT_USB},
+	{"USB_SUS",		PMC_PSS_BIT_USB_SUS},
+	{},
 };
 
 static inline u32 pmc_reg_read(struct pmc_dev *pmc, int reg_offset)
@@ -172,16 +174,14 @@ static int pmc_dev_state_show(struct seq_file *s, void *unused)
 	struct pmc_dev *pmc = s->private;
 	u32 func_dis, func_dis_2, func_dis_index;
 	u32 d3_sts_0, d3_sts_1, d3_sts_index;
-	int dev_num, dev_index, reg_index;
+	int dev_index, reg_index;
 
 	func_dis = pmc_reg_read(pmc, PMC_FUNC_DIS);
 	func_dis_2 = pmc_reg_read(pmc, PMC_FUNC_DIS_2);
 	d3_sts_0 = pmc_reg_read(pmc, PMC_D3_STS_0);
 	d3_sts_1 = pmc_reg_read(pmc, PMC_D3_STS_1);
 
-	dev_num = ARRAY_SIZE(dev_map);
-
-	for (dev_index = 0; dev_index < dev_num; dev_index++) {
+	for (dev_index = 0; dev_map[dev_index].name; dev_index++) {
 		reg_index = dev_index / PMC_REG_BIT_WIDTH;
 		if (reg_index) {
 			func_dis_index = func_dis_2;
@@ -191,8 +191,8 @@ static int pmc_dev_state_show(struct seq_file *s, void *unused)
 			d3_sts_index = d3_sts_0;
 		}
 
-		seq_printf(s, "Dev: %-32s\tState: %s [%s]\n",
-			dev_map[dev_index].name,
+		seq_printf(s, "Dev: %-2d - %-32s\tState: %s [%s]\n",
+			dev_index, dev_map[dev_index].name,
 			dev_map[dev_index].bit_mask & func_dis_index ?
 			"Disabled" : "Enabled ",
 			dev_map[dev_index].bit_mask & d3_sts_index ?
@@ -219,9 +219,9 @@ static int pmc_pss_state_show(struct seq_file *s, void *unused)
 	u32 pss = pmc_reg_read(pmc, PMC_PSS);
 	int pss_index;
 
-	for (pss_index = 0; pss_index < ARRAY_SIZE(pss_map); pss_index++) {
-		seq_printf(s, "Island: %-32s\tState: %s\n",
-			pss_map[pss_index].name,
+	for (pss_index = 0; pss_map[pss_index].name; pss_index++) {
+		seq_printf(s, "Island: %-2d - %-32s\tState: %s\n",
+			pss_index, pss_map[pss_index].name,
 			pss_map[pss_index].bit_mask & pss ? "Off" : "On");
 	}
 	return 0;
#5 lore raw

PATCH v3 3/5 x86: pmc_atom: supply register mappings via pmc object

In reply to Andy Shevchenko

The patch converts the functions to use the register mappings provided by pmc object. It would help in case of mappings on different platforms.

---
 arch/x86/kernel/pmc_atom.c | 49 ++++++++++++++++++++++++++++++----------------
 1 file changed, 32 insertions(+), 17 deletions(-)
arch/x86/kernel/pmc_atom.c +32 -17
index c7dca07..4752b1a62 100644
@@ -25,9 +25,20 @@
 
 #include <asm/pmc_atom.h>
 
+struct pmc_bit_map {
+	const char *name;
+	u32 bit_mask;
+};
+
+struct pmc_reg_map {
+	const struct pmc_bit_map *dev;
+	const struct pmc_bit_map *pss;
+};
+
 struct pmc_dev {
 	u32 base_addr;
 	void __iomem *regmap;
+	const struct pmc_reg_map *map;
 #ifdef CONFIG_DEBUG_FS
 	struct dentry *dbgfs_dir;
 #endif /* CONFIG_DEBUG_FS */
@@ -37,11 +48,6 @@ struct pmc_dev {
 static struct pmc_dev pmc_device;
 static u32 acpi_base_addr;
 
-struct pmc_bit_map {
-	const char *name;
-	u32 bit_mask;
-};
-
 static const struct pmc_bit_map dev_map[] = {
 	{"LPSS1_F0_DMA",	BIT_LPSS1_F0_DMA},
 	{"LPSS1_F1_PWM1",	BIT_LPSS1_F1_PWM1},
@@ -104,6 +110,11 @@ static const struct pmc_bit_map pss_map[] = {
 	{},
 };
 
+static const struct pmc_reg_map reg_map = {
+	.dev		= dev_map,
+	.pss		= pss_map,
+};
+
 static inline u32 pmc_reg_read(struct pmc_dev *pmc, int reg_offset)
 {
 	return readl(pmc->regmap + reg_offset);
@@ -172,17 +183,18 @@ static void pmc_hw_reg_setup(struct pmc_dev *pmc)
 static int pmc_dev_state_show(struct seq_file *s, void *unused)
 {
 	struct pmc_dev *pmc = s->private;
+	const struct pmc_bit_map *map = pmc->map->dev;
 	u32 func_dis, func_dis_2, func_dis_index;
 	u32 d3_sts_0, d3_sts_1, d3_sts_index;
-	int dev_index, reg_index;
+	int index, reg_index;
 
 	func_dis = pmc_reg_read(pmc, PMC_FUNC_DIS);
 	func_dis_2 = pmc_reg_read(pmc, PMC_FUNC_DIS_2);
 	d3_sts_0 = pmc_reg_read(pmc, PMC_D3_STS_0);
 	d3_sts_1 = pmc_reg_read(pmc, PMC_D3_STS_1);
 
-	for (dev_index = 0; dev_map[dev_index].name; dev_index++) {
-		reg_index = dev_index / PMC_REG_BIT_WIDTH;
+	for (index = 0; map[index].name; index++) {
+		reg_index = index / PMC_REG_BIT_WIDTH;
 		if (reg_index) {
 			func_dis_index = func_dis_2;
 			d3_sts_index = d3_sts_1;
@@ -192,10 +204,10 @@ static int pmc_dev_state_show(struct seq_file *s, void *unused)
 		}
 
 		seq_printf(s, "Dev: %-2d - %-32s\tState: %s [%s]\n",
-			dev_index, dev_map[dev_index].name,
-			dev_map[dev_index].bit_mask & func_dis_index ?
+			index, map[index].name,
+			map[index].bit_mask & func_dis_index ?
 			"Disabled" : "Enabled ",
-			dev_map[dev_index].bit_mask & d3_sts_index ?
+			map[index].bit_mask & d3_sts_index ?
 			"D3" : "D0");
 	}
 	return 0;
@@ -216,13 +228,14 @@ static const struct file_operations pmc_dev_state_ops = {
 static int pmc_pss_state_show(struct seq_file *s, void *unused)
 {
 	struct pmc_dev *pmc = s->private;
+	const struct pmc_bit_map *map = pmc->map->pss;
 	u32 pss = pmc_reg_read(pmc, PMC_PSS);
-	int pss_index;
+	int index;
 
-	for (pss_index = 0; pss_map[pss_index].name; pss_index++) {
+	for (index = 0; map[index].name; index++) {
 		seq_printf(s, "Island: %-2d - %-32s\tState: %s\n",
-			pss_index, pss_map[pss_index].name,
-			pss_map[pss_index].bit_mask & pss ? "Off" : "On");
+			index, map[index].name,
+			map[index].bit_mask & pss ? "Off" : "On");
 	}
 	return 0;
 }
@@ -312,7 +325,7 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc)
 }
 #endif /* CONFIG_DEBUG_FS */
 
-static int pmc_setup_dev(struct pci_dev *pdev)
+static int pmc_setup_dev(struct pci_dev *pdev, const struct pmc_reg_map *map)
 {
 	struct pmc_dev *pmc = &pmc_device;
 	int ret;
@@ -334,6 +347,8 @@ static int pmc_setup_dev(struct pci_dev *pdev)
 		return -ENOMEM;
 	}
 
+	pmc->map = map;
+
 	/* PMC hardware registers setup */
 	pmc_hw_reg_setup(pmc);
 
@@ -376,7 +391,7 @@ static int __init pmc_atom_init(void)
 	for_each_pci_dev(pdev) {
 		ent = pci_match_id(pmc_pci_ids, pdev);
 		if (ent)
-			return pmc_setup_dev(pdev);
+			return pmc_setup_dev(pdev, &reg_map);
 	}
 	/* Device not found. */
 	return -ENODEV;
Signature · 1 line
2.1.4
#6 lore raw

[tip:x86/platform] x86/platform/intel/pmc_atom: Supply register mappings via PMC object

x86/platform/intel/pmc_atom: Supply register mappings via PMC object
Commit-ID:  940406d1cfb5b35cb9716d186fe3e6308f2700c5
Gitweb:     http://git.kernel.org/tip/940406d1cfb5b35cb9716d186fe3e6308f2700c5
Author:     Andy Shevchenko <[email protected]>
AuthorDate: Mon, 6 Jul 2015 17:29:02 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 6 Jul 2015 17:42:46 +0200

x86/platform/intel/pmc_atom: Supply register mappings via PMC object

The patch converts the functions to use the register mappings provided by PMC object. It would help in case of mappings on different platforms.

---
 arch/x86/kernel/pmc_atom.c | 49 ++++++++++++++++++++++++++++++----------------
 1 file changed, 32 insertions(+), 17 deletions(-)
arch/x86/kernel/pmc_atom.c +32 -17
index c7dca07..4752b1a62 100644
@@ -25,9 +25,20 @@
 
 #include <asm/pmc_atom.h>
 
+struct pmc_bit_map {
+	const char *name;
+	u32 bit_mask;
+};
+
+struct pmc_reg_map {
+	const struct pmc_bit_map *dev;
+	const struct pmc_bit_map *pss;
+};
+
 struct pmc_dev {
 	u32 base_addr;
 	void __iomem *regmap;
+	const struct pmc_reg_map *map;
 #ifdef CONFIG_DEBUG_FS
 	struct dentry *dbgfs_dir;
 #endif /* CONFIG_DEBUG_FS */
@@ -37,11 +48,6 @@ struct pmc_dev {
 static struct pmc_dev pmc_device;
 static u32 acpi_base_addr;
 
-struct pmc_bit_map {
-	const char *name;
-	u32 bit_mask;
-};
-
 static const struct pmc_bit_map dev_map[] = {
 	{"LPSS1_F0_DMA",	BIT_LPSS1_F0_DMA},
 	{"LPSS1_F1_PWM1",	BIT_LPSS1_F1_PWM1},
@@ -104,6 +110,11 @@ static const struct pmc_bit_map pss_map[] = {
 	{},
 };
 
+static const struct pmc_reg_map reg_map = {
+	.dev		= dev_map,
+	.pss		= pss_map,
+};
+
 static inline u32 pmc_reg_read(struct pmc_dev *pmc, int reg_offset)
 {
 	return readl(pmc->regmap + reg_offset);
@@ -172,17 +183,18 @@ static void pmc_hw_reg_setup(struct pmc_dev *pmc)
 static int pmc_dev_state_show(struct seq_file *s, void *unused)
 {
 	struct pmc_dev *pmc = s->private;
+	const struct pmc_bit_map *map = pmc->map->dev;
 	u32 func_dis, func_dis_2, func_dis_index;
 	u32 d3_sts_0, d3_sts_1, d3_sts_index;
-	int dev_index, reg_index;
+	int index, reg_index;
 
 	func_dis = pmc_reg_read(pmc, PMC_FUNC_DIS);
 	func_dis_2 = pmc_reg_read(pmc, PMC_FUNC_DIS_2);
 	d3_sts_0 = pmc_reg_read(pmc, PMC_D3_STS_0);
 	d3_sts_1 = pmc_reg_read(pmc, PMC_D3_STS_1);
 
-	for (dev_index = 0; dev_map[dev_index].name; dev_index++) {
-		reg_index = dev_index / PMC_REG_BIT_WIDTH;
+	for (index = 0; map[index].name; index++) {
+		reg_index = index / PMC_REG_BIT_WIDTH;
 		if (reg_index) {
 			func_dis_index = func_dis_2;
 			d3_sts_index = d3_sts_1;
@@ -192,10 +204,10 @@ static int pmc_dev_state_show(struct seq_file *s, void *unused)
 		}
 
 		seq_printf(s, "Dev: %-2d - %-32s\tState: %s [%s]\n",
-			dev_index, dev_map[dev_index].name,
-			dev_map[dev_index].bit_mask & func_dis_index ?
+			index, map[index].name,
+			map[index].bit_mask & func_dis_index ?
 			"Disabled" : "Enabled ",
-			dev_map[dev_index].bit_mask & d3_sts_index ?
+			map[index].bit_mask & d3_sts_index ?
 			"D3" : "D0");
 	}
 	return 0;
@@ -216,13 +228,14 @@ static const struct file_operations pmc_dev_state_ops = {
 static int pmc_pss_state_show(struct seq_file *s, void *unused)
 {
 	struct pmc_dev *pmc = s->private;
+	const struct pmc_bit_map *map = pmc->map->pss;
 	u32 pss = pmc_reg_read(pmc, PMC_PSS);
-	int pss_index;
+	int index;
 
-	for (pss_index = 0; pss_map[pss_index].name; pss_index++) {
+	for (index = 0; map[index].name; index++) {
 		seq_printf(s, "Island: %-2d - %-32s\tState: %s\n",
-			pss_index, pss_map[pss_index].name,
-			pss_map[pss_index].bit_mask & pss ? "Off" : "On");
+			index, map[index].name,
+			map[index].bit_mask & pss ? "Off" : "On");
 	}
 	return 0;
 }
@@ -312,7 +325,7 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc)
 }
 #endif /* CONFIG_DEBUG_FS */
 
-static int pmc_setup_dev(struct pci_dev *pdev)
+static int pmc_setup_dev(struct pci_dev *pdev, const struct pmc_reg_map *map)
 {
 	struct pmc_dev *pmc = &pmc_device;
 	int ret;
@@ -334,6 +347,8 @@ static int pmc_setup_dev(struct pci_dev *pdev)
 		return -ENOMEM;
 	}
 
+	pmc->map = map;
+
 	/* PMC hardware registers setup */
 	pmc_hw_reg_setup(pmc);
 
@@ -376,7 +391,7 @@ static int __init pmc_atom_init(void)
 	for_each_pci_dev(pdev) {
 		ent = pci_match_id(pmc_pci_ids, pdev);
 		if (ent)
-			return pmc_setup_dev(pdev);
+			return pmc_setup_dev(pdev, &reg_map);
 	}
 	/* Device not found. */
 	return -ENODEV;
#7 lore raw

PATCH v3 4/5 x86: pmc_atom: Add Cherrytrail PMC interface

In reply to Andy Shevchenko

The patch adds CHT PMC interface. This exposes all the South IP device power states and S0ix states for CHT. The bit map of FUNC_DIS and D3_STS_0 registers for SoCs are consistent. The D3_STS_1 and FUNC_DIS_2 registers, however, are not aligned. This is fixed by splitting a common mapping on per register basis.

---
 arch/x86/include/asm/pmc_atom.h |  25 +++++++++
 arch/x86/kernel/pmc_atom.c      | 118 ++++++++++++++++++++++++++++++----------
 2 files changed, 114 insertions(+), 29 deletions(-)
arch/x86/include/asm/pmc_atom.h +25 -0
index 6ee2200..aa8744c 100644
@@ -18,6 +18,8 @@
 
 /* ValleyView Power Control Unit PCI Device ID */
 #define	PCI_DEVICE_ID_VLV_PMC	0x0F1C
+/* CherryTrail Power Control Unit PCI Device ID */
+#define	PCI_DEVICE_ID_CHT_PMC	0x229C
 
 /* PMC Memory mapped IO registers */
 #define	PMC_BASE_ADDR_OFFSET	0x44
@@ -29,6 +31,10 @@
 #define	PMC_FUNC_DIS		0x34
 #define	PMC_FUNC_DIS_2		0x38
 
+/* CHT specific bits in FUNC_DIS2 register */
+#define	BIT_FD_GMM		BIT(3)
+#define	BIT_FD_ISH		BIT(4)
+
 /* S0ix wake event control */
 #define	PMC_S0IX_WAKE_EN	0x3C
 
@@ -75,6 +81,21 @@
 #define PMC_PSS_BIT_USB			BIT(16)
 #define PMC_PSS_BIT_USB_SUS		BIT(17)
 
+/* CHT specific bits in PSS register */
+#define	PMC_PSS_BIT_CHT_UFS		BIT(7)
+#define	PMC_PSS_BIT_CHT_UXD		BIT(11)
+#define	PMC_PSS_BIT_CHT_UXD_FD		BIT(12)
+#define	PMC_PSS_BIT_CHT_UX_ENG		BIT(15)
+#define	PMC_PSS_BIT_CHT_USB_SUS		BIT(16)
+#define	PMC_PSS_BIT_CHT_GMM		BIT(17)
+#define	PMC_PSS_BIT_CHT_ISH		BIT(18)
+#define	PMC_PSS_BIT_CHT_DFX_MASTER	BIT(26)
+#define	PMC_PSS_BIT_CHT_DFX_CLUSTER1	BIT(27)
+#define	PMC_PSS_BIT_CHT_DFX_CLUSTER2	BIT(28)
+#define	PMC_PSS_BIT_CHT_DFX_CLUSTER3	BIT(29)
+#define	PMC_PSS_BIT_CHT_DFX_CLUSTER4	BIT(30)
+#define	PMC_PSS_BIT_CHT_DFX_CLUSTER5	BIT(31)
+
 /* These registers reflect D3 status of functions */
 #define	PMC_D3_STS_0		0xA0
 
@@ -117,6 +138,10 @@
 #define	BIT_USH_SS_PHY		BIT(2)
 #define	BIT_DFX			BIT(3)
 
+/* CHT specific bits in PMC_D3_STS_1 register */
+#define	BIT_STS_GMM		BIT(1)
+#define	BIT_STS_ISH		BIT(2)
+
 /* PMC I/O Registers */
 #define	ACPI_BASE_ADDR_OFFSET	0x40
 #define	ACPI_BASE_ADDR_MASK	0xFFFFFE00
arch/x86/kernel/pmc_atom.c +89 -29

184 lines not on this page · raw message

Signature · 1 line
2.1.4
Acked-by Kumar P Mahesh on v3 4/5
#8 lore raw

Re: [PATCH v3 4/5] x86: pmc_atom: Add Cherrytrail PMC interface

Quoted 7 lines · Andy Shevchenko

The patch adds CHT PMC interface. This exposes all the South IP device power states and S0ix states for CHT. The bit map of FUNC_DIS and D3_STS_0 registers for SoCs are consistent. The D3_STS_1 and FUNC_DIS_2 registers, however, are not aligned. This is fixed by splitting a common mapping on per register basis.

That's a weird signoff sequence. I changed it to:

Thanks,

Ingo

#9 lore raw

Re: [PATCH v3 4/5] x86: pmc_atom: Add Cherrytrail PMC interface

Quoted 7 lines · Ingo Molnar
Quoted 5 lines · Andy Shevchenko

The patch adds CHT PMC interface. This exposes all the South IP device power states and S0ix states for CHT. The bit map of FUNC_DIS and D3_STS_0 registers for SoCs are consistent. The D3_STS_1 and FUNC_DIS_2 registers, however, are not aligned. This is fixed by splitting a common mapping on per register basis.

Quoted 7 lines
Quoted 2 lines

That's a weird signoff sequence. I changed it to:

It might lack a From: Kumar ...

#10 lore raw

Re: [PATCH v3 4/5] x86: pmc_atom: Add Cherrytrail PMC interface

Quoted 12 lines · Thomas Gleixner
Quoted 10 lines · Ingo Molnar
Quoted 7 lines · Andy Shevchenko

The patch adds CHT PMC interface. This exposes all the South IP device power states and S0ix states for CHT. The bit map of FUNC_DIS and D3_STS_0 registers for SoCs are consistent. The D3_STS_1 and FUNC_DIS_2 registers, however, are not aligned. This is fixed by splitting a common mapping on per register basis.

Quoted 6 lines
Quoted 4 lines

That's a weird signoff sequence. I changed it to:

It might lack a From: Kumar ...

Yeah, and got lost due to a rebase. Will change it to that, to preserve authorship. Won't push it out before I hear back from Andy though.

Thanks,

Ingo

#11 lore raw

Re: [PATCH v3 4/5] x86: pmc_atom: Add Cherrytrail PMC interface

Quoted 17 lines · Ingo Molnar
Quoted 14 lines · Thomas Gleixner
Quoted 12 lines · Ingo Molnar
Quoted 7 lines · Andy Shevchenko

The patch adds CHT PMC interface. This exposes all the South IP device power states and S0ix states for CHT. The bit map of FUNC_DIS and D3_STS_0 registers for SoCs are consistent. The D3_STS_1 and FUNC_DIS_2 registers, however, are not aligned. This is fixed by splitting a common mapping on per register basis.

That's a weird signoff sequence. I changed it to:

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

It might lack a From: Kumar ...

Yeah, and got lost due to a rebase. Will change it to that, to preserve authorship. Won't push it out before I hear back from Andy though.

To clarify: "It's based on the previous work done by Kumar P Mahesh." and we can remove SoB. It's quite far from the code initially taken from Kumar.

Would you like me to update the commit message accordingly?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#12 lore raw

Re: [PATCH v3 4/5] x86: pmc_atom: Add Cherrytrail PMC interface

Quoted 23 lines · Andy Shevchenko
Quoted 22 lines · Ingo Molnar
Quoted 18 lines · Thomas Gleixner
Quoted 7 lines · Ingo Molnar
Quoted 5 lines · Andy Shevchenko

The patch adds CHT PMC interface. This exposes all the South IP device power states and S0ix states for CHT. The bit map of FUNC_DIS and D3_STS_0 registers for SoCs are consistent. The D3_STS_1 and FUNC_DIS_2 registers, however, are not aligned. This is fixed by splitting a common mapping on per register basis.

Quoted 7 lines
Quoted 2 lines

That's a weird signoff sequence. I changed it to:

It might lack a From: Kumar ...

Quoted 8 lines
Quoted 2 lines

Yeah, and got lost due to a rebase. Will change it to that, to preserve authorship. Won't push it out before I hear back from Andy though.

To clarify: "It's based on the previous work done by Kumar P Mahesh." and we can remove SoB. It's quite far from the code initially taken from Kumar.

Would you like me to update the commit message accordingly?

Ok.

Thanks,

Ingo

#13 lore raw

[tip:x86/platform] x86/platform/intel/pmc_atom: Add Cherrytrail PMC interface

In reply to Andy Shevchenko
x86/platform/intel/pmc_atom: Add Cherrytrail PMC interface
Commit-ID:  daf61e1b7fc31d553fe3bf2dead95d9404ad0f57
Gitweb:     http://git.kernel.org/tip/daf61e1b7fc31d553fe3bf2dead95d9404ad0f57
Author:     Kumar P Mahesh <[email protected]>
AuthorDate: Mon, 6 Jul 2015 17:29:03 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 6 Jul 2015 17:50:59 +0200

x86/platform/intel/pmc_atom: Add Cherrytrail PMC interface

The patch adds CHT PMC interface. This exposes all the South IP device power states and S0ix states for CHT. The bit map of FUNC_DIS and D3_STS_0 registers for SoCs are consistent. The D3_STS_1 and FUNC_DIS_2 registers, however, are not aligned. This is fixed by splitting a common mapping on per register basis.

---
 arch/x86/include/asm/pmc_atom.h |  25 +++++++++
 arch/x86/kernel/pmc_atom.c      | 118 ++++++++++++++++++++++++++++++----------
 2 files changed, 114 insertions(+), 29 deletions(-)
arch/x86/include/asm/pmc_atom.h +25 -0
index 6ee2200..aa8744c 100644
@@ -18,6 +18,8 @@
 
 /* ValleyView Power Control Unit PCI Device ID */
 #define	PCI_DEVICE_ID_VLV_PMC	0x0F1C
+/* CherryTrail Power Control Unit PCI Device ID */
+#define	PCI_DEVICE_ID_CHT_PMC	0x229C
 
 /* PMC Memory mapped IO registers */
 #define	PMC_BASE_ADDR_OFFSET	0x44
@@ -29,6 +31,10 @@
 #define	PMC_FUNC_DIS		0x34
 #define	PMC_FUNC_DIS_2		0x38
 
+/* CHT specific bits in FUNC_DIS2 register */
+#define	BIT_FD_GMM		BIT(3)
+#define	BIT_FD_ISH		BIT(4)
+
 /* S0ix wake event control */
 #define	PMC_S0IX_WAKE_EN	0x3C
 
@@ -75,6 +81,21 @@
 #define PMC_PSS_BIT_USB			BIT(16)
 #define PMC_PSS_BIT_USB_SUS		BIT(17)
 
+/* CHT specific bits in PSS register */
+#define	PMC_PSS_BIT_CHT_UFS		BIT(7)
+#define	PMC_PSS_BIT_CHT_UXD		BIT(11)
+#define	PMC_PSS_BIT_CHT_UXD_FD		BIT(12)
+#define	PMC_PSS_BIT_CHT_UX_ENG		BIT(15)
+#define	PMC_PSS_BIT_CHT_USB_SUS		BIT(16)
+#define	PMC_PSS_BIT_CHT_GMM		BIT(17)
+#define	PMC_PSS_BIT_CHT_ISH		BIT(18)
+#define	PMC_PSS_BIT_CHT_DFX_MASTER	BIT(26)
+#define	PMC_PSS_BIT_CHT_DFX_CLUSTER1	BIT(27)
+#define	PMC_PSS_BIT_CHT_DFX_CLUSTER2	BIT(28)
+#define	PMC_PSS_BIT_CHT_DFX_CLUSTER3	BIT(29)
+#define	PMC_PSS_BIT_CHT_DFX_CLUSTER4	BIT(30)
+#define	PMC_PSS_BIT_CHT_DFX_CLUSTER5	BIT(31)
+
 /* These registers reflect D3 status of functions */
 #define	PMC_D3_STS_0		0xA0
 
@@ -117,6 +138,10 @@
 #define	BIT_USH_SS_PHY		BIT(2)
 #define	BIT_DFX			BIT(3)
 
+/* CHT specific bits in PMC_D3_STS_1 register */
+#define	BIT_STS_GMM		BIT(1)
+#define	BIT_STS_ISH		BIT(2)
+
 /* PMC I/O Registers */
 #define	ACPI_BASE_ADDR_OFFSET	0x40
 #define	ACPI_BASE_ADDR_MASK	0xFFFFFE00
arch/x86/kernel/pmc_atom.c +89 -29

184 lines not on this page · raw message

#14 lore raw

Re: [tip:x86/platform] x86/platform/intel/pmc_atom: Add Cherrytrail PMC interface

Quoted 7 lines · tip-bot for Kumar P Mahesh
Commit-ID:  daf61e1b7fc31d553fe3bf2dead95d9404ad0f57
Gitweb:     http://git.kernel.org/tip/daf61e1b7fc31d553fe3bf2dead95d9404ad0f57
Author:     Kumar P Mahesh <[email protected]>
AuthorDate: Mon, 6 Jul 2015 17:29:03 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 6 Jul 2015 17:50:59 +0200
Quoted 7 lines

x86/platform/intel/pmc_atom: Add Cherrytrail PMC interface

The patch adds CHT PMC interface. This exposes all the South IP device power states and S0ix states for CHT. The bit map of FUNC_DIS and D3_STS_0 registers for SoCs are consistent. The D3_STS_1 and FUNC_DIS_2 registers, however, are not aligned. This is fixed by splitting a common mapping on per register basis.

TLA collision.. I thought this was about performance monitor counters :/

#15 lore raw

Re: [tip:x86/platform] x86/platform/intel/pmc_atom: Add Cherrytrail PMC interface

Quoted 10 lines · Peter Zijlstra
Quoted 9 lines · tip-bot for Kumar P Mahesh
Commit-ID:  daf61e1b7fc31d553fe3bf2dead95d9404ad0f57
Gitweb:     http://git.kernel.org/tip/daf61e1b7fc31d553fe3bf2dead95d9404ad0f57
Author:     Kumar P Mahesh <[email protected]>
AuthorDate: Mon, 6 Jul 2015 17:29:03 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 6 Jul 2015 17:50:59 +0200

x86/platform/intel/pmc_atom: Add Cherrytrail PMC interface

Quoted 7 lines
Quoted 5 lines

The patch adds CHT PMC interface. This exposes all the South IP device power states and S0ix states for CHT. The bit map of FUNC_DIS and D3_STS_0 registers for SoCs are consistent. The D3_STS_1 and FUNC_DIS_2 registers, however, are not aligned. This is fixed by splitting a common mapping on per register basis.

TLA collision.. I thought this was about performance monitor counters :/

I had to look twice as well - but PMC as 'Power Management Controller' in used in the kernel consistently in a number of places.

Thanks,

Ingo

#16 lore raw

[tip:x86/platform] x86/platform/intel/pmc_atom: Add Cherrytrail PMC interface

In reply to Andy Shevchenko
x86/platform/intel/pmc_atom: Add Cherrytrail PMC interface
Commit-ID:  2b8f8eddaf05c02bb4a21db5be1691e36e242c65
Gitweb:     http://git.kernel.org/tip/2b8f8eddaf05c02bb4a21db5be1691e36e242c65
Author:     Andy Shevchenko <[email protected]>
AuthorDate: Mon, 6 Jul 2015 17:29:03 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 6 Jul 2015 18:39:38 +0200

x86/platform/intel/pmc_atom: Add Cherrytrail PMC interface

The patch adds CHT PMC interface. This exposes all the South IP device power states and S0ix states for CHT. The bit map of FUNC_DIS and D3_STS_0 registers for SoCs are consistent. The D3_STS_1 and FUNC_DIS_2 registers, however, are not aligned. This is fixed by splitting a common mapping on per register basis.

(Originally based on code from Kumar P Mahesh.)

Originally-from: Kumar P Mahesh <[email protected]>

---
 arch/x86/include/asm/pmc_atom.h |  25 +++++++++
 arch/x86/kernel/pmc_atom.c      | 118 ++++++++++++++++++++++++++++++----------
 2 files changed, 114 insertions(+), 29 deletions(-)
arch/x86/include/asm/pmc_atom.h +25 -0
index 6ee2200..aa8744c 100644
@@ -18,6 +18,8 @@
 
 /* ValleyView Power Control Unit PCI Device ID */
 #define	PCI_DEVICE_ID_VLV_PMC	0x0F1C
+/* CherryTrail Power Control Unit PCI Device ID */
+#define	PCI_DEVICE_ID_CHT_PMC	0x229C
 
 /* PMC Memory mapped IO registers */
 #define	PMC_BASE_ADDR_OFFSET	0x44
@@ -29,6 +31,10 @@
 #define	PMC_FUNC_DIS		0x34
 #define	PMC_FUNC_DIS_2		0x38
 
+/* CHT specific bits in FUNC_DIS2 register */
+#define	BIT_FD_GMM		BIT(3)
+#define	BIT_FD_ISH		BIT(4)
+
 /* S0ix wake event control */
 #define	PMC_S0IX_WAKE_EN	0x3C
 
@@ -75,6 +81,21 @@
 #define PMC_PSS_BIT_USB			BIT(16)
 #define PMC_PSS_BIT_USB_SUS		BIT(17)
 
+/* CHT specific bits in PSS register */
+#define	PMC_PSS_BIT_CHT_UFS		BIT(7)
+#define	PMC_PSS_BIT_CHT_UXD		BIT(11)
+#define	PMC_PSS_BIT_CHT_UXD_FD		BIT(12)
+#define	PMC_PSS_BIT_CHT_UX_ENG		BIT(15)
+#define	PMC_PSS_BIT_CHT_USB_SUS		BIT(16)
+#define	PMC_PSS_BIT_CHT_GMM		BIT(17)
+#define	PMC_PSS_BIT_CHT_ISH		BIT(18)
+#define	PMC_PSS_BIT_CHT_DFX_MASTER	BIT(26)
+#define	PMC_PSS_BIT_CHT_DFX_CLUSTER1	BIT(27)
+#define	PMC_PSS_BIT_CHT_DFX_CLUSTER2	BIT(28)
+#define	PMC_PSS_BIT_CHT_DFX_CLUSTER3	BIT(29)
+#define	PMC_PSS_BIT_CHT_DFX_CLUSTER4	BIT(30)
+#define	PMC_PSS_BIT_CHT_DFX_CLUSTER5	BIT(31)
+
 /* These registers reflect D3 status of functions */
 #define	PMC_D3_STS_0		0xA0
 
@@ -117,6 +138,10 @@
 #define	BIT_USH_SS_PHY		BIT(2)
 #define	BIT_DFX			BIT(3)
 
+/* CHT specific bits in PMC_D3_STS_1 register */
+#define	BIT_STS_GMM		BIT(1)
+#define	BIT_STS_ISH		BIT(2)
+
 /* PMC I/O Registers */
 #define	ACPI_BASE_ADDR_OFFSET	0x40
 #define	ACPI_BASE_ADDR_MASK	0xFFFFFE00
arch/x86/kernel/pmc_atom.c +89 -29

184 lines not on this page · raw message

#17 lore raw

PATCH v3 5/5 x86: pmc_atom: place it under arch/x86/platform/atom

In reply to Andy Shevchenko

This is specific driver for Intel Atom SoCs like BayTrail and Braswell. Let's move it to dedicated folder and alleviate a arch/x86/kernel burden.

There is no functional change.

---
 arch/x86/kernel/Makefile                      | 1 -
 arch/x86/platform/atom/Makefile               | 3 ++-
 arch/x86/{kernel => platform/atom}/pmc_atom.c | 0
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename arch/x86/{kernel => platform/atom}/pmc_atom.c (100%)
arch/x86/kernel/Makefile +0 -1
index 0f15af4..81db53b 100644
@@ -108,7 +108,6 @@ obj-$(CONFIG_EFI)			+= sysfb_efi.o
 obj-$(CONFIG_PERF_EVENTS)		+= perf_regs.o
 obj-$(CONFIG_TRACING)			+= tracepoint.o
 obj-$(CONFIG_IOSF_MBI)			+= iosf_mbi.o
-obj-$(CONFIG_PMC_ATOM)			+= pmc_atom.o
 
 ###
 # 64 bit specific files
arch/x86/platform/atom/Makefile +2 -1
index 0a3a40c..40983f5 100644
@@ -1 +1,2 @@
-obj-$(CONFIG_PUNIT_ATOM_DEBUG) += punit_atom_debug.o
+obj-$(CONFIG_PMC_ATOM)		+= pmc_atom.o
+obj-$(CONFIG_PUNIT_ATOM_DEBUG)	+= punit_atom_debug.o
arch/x86/platform/atom/pmc_atom.c renamed from arch/x86/kernel/pmc_atom.c +0 -0
similarity index 100%
rename from arch/x86/kernel/pmc_atom.c
rename to arch/x86/platform/atom/pmc_atom.c
Signature · 1 line
2.1.4
#18 lore raw

[tip:x86/platform] x86/platform/intel/pmc_atom: Move the PMC-Atom code to arch/x86/platform/atom

x86/platform/intel/pmc_atom: Move the PMC-Atom code to arch/x86/platform/atom
Commit-ID:  d3889467c221b5c40cd6499b805eacce4c739cd1
Gitweb:     http://git.kernel.org/tip/d3889467c221b5c40cd6499b805eacce4c739cd1
Author:     Andy Shevchenko <[email protected]>
AuthorDate: Mon, 6 Jul 2015 17:29:04 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 6 Jul 2015 17:51:00 +0200

x86/platform/intel/pmc_atom: Move the PMC-Atom code to arch/x86/platform/atom

This is specific driver for Intel Atom SoCs like BayTrail and Braswell. Let's move it to dedicated folder and alleviate a arch/x86/kernel burden.

There is no functional change.

---
 arch/x86/kernel/Makefile                      | 1 -
 arch/x86/platform/atom/Makefile               | 3 ++-
 arch/x86/{kernel => platform/atom}/pmc_atom.c | 0
 3 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/Makefile +0 -1
index 0f15af4..81db53b 100644
@@ -108,7 +108,6 @@ obj-$(CONFIG_EFI)			+= sysfb_efi.o
 obj-$(CONFIG_PERF_EVENTS)		+= perf_regs.o
 obj-$(CONFIG_TRACING)			+= tracepoint.o
 obj-$(CONFIG_IOSF_MBI)			+= iosf_mbi.o
-obj-$(CONFIG_PMC_ATOM)			+= pmc_atom.o
 
 ###
 # 64 bit specific files
arch/x86/platform/atom/Makefile +2 -1
index 0a3a40c..40983f5 100644
@@ -1 +1,2 @@
-obj-$(CONFIG_PUNIT_ATOM_DEBUG) += punit_atom_debug.o
+obj-$(CONFIG_PMC_ATOM)		+= pmc_atom.o
+obj-$(CONFIG_PUNIT_ATOM_DEBUG)	+= punit_atom_debug.o
arch/x86/platform/atom/pmc_atom.c renamed from arch/x86/kernel/pmc_atom.c +0 -0
similarity index 100%
rename from arch/x86/kernel/pmc_atom.c
rename to arch/x86/platform/atom/pmc_atom.c
#19 lore raw

[tip:x86/platform] x86/platform/intel/pmc_atom: Move the PMC-Atom code to arch/x86/platform/atom

In reply to Andy Shevchenko
x86/platform/intel/pmc_atom: Move the PMC-Atom code to arch/x86/platform/atom
Commit-ID:  91780c41a9e03ca6c351a0b2152662139b94b274
Gitweb:     http://git.kernel.org/tip/91780c41a9e03ca6c351a0b2152662139b94b274
Author:     Andy Shevchenko <[email protected]>
AuthorDate: Mon, 6 Jul 2015 17:29:04 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 6 Jul 2015 18:39:38 +0200

x86/platform/intel/pmc_atom: Move the PMC-Atom code to arch/x86/platform/atom

This is specific driver for Intel Atom SoCs like BayTrail and Braswell. Let's move it to dedicated folder and alleviate a arch/x86/kernel burden.

There is no functional change.

---
 arch/x86/kernel/Makefile                      | 1 -
 arch/x86/platform/atom/Makefile               | 3 ++-
 arch/x86/{kernel => platform/atom}/pmc_atom.c | 0
 3 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/Makefile +0 -1
index 0f15af4..81db53b 100644
@@ -108,7 +108,6 @@ obj-$(CONFIG_EFI)			+= sysfb_efi.o
 obj-$(CONFIG_PERF_EVENTS)		+= perf_regs.o
 obj-$(CONFIG_TRACING)			+= tracepoint.o
 obj-$(CONFIG_IOSF_MBI)			+= iosf_mbi.o
-obj-$(CONFIG_PMC_ATOM)			+= pmc_atom.o
 
 ###
 # 64 bit specific files
arch/x86/platform/atom/Makefile +2 -1
index 0a3a40c..40983f5 100644
@@ -1 +1,2 @@
-obj-$(CONFIG_PUNIT_ATOM_DEBUG) += punit_atom_debug.o
+obj-$(CONFIG_PMC_ATOM)		+= pmc_atom.o
+obj-$(CONFIG_PUNIT_ATOM_DEBUG)	+= punit_atom_debug.o
arch/x86/platform/atom/pmc_atom.c renamed from arch/x86/kernel/pmc_atom.c +0 -0
similarity index 100%
rename from arch/x86/kernel/pmc_atom.c
rename to arch/x86/platform/atom/pmc_atom.c