linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/4] Some improvement for Intel MAX 10 MFD drivers
@ 2021-03-10 15:55 Xu Yilun
  2021-03-10 15:55 ` [PATCH v4 1/4] mfd: intel-m10-bmc: Fix the register access range Xu Yilun
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Xu Yilun @ 2021-03-10 15:55 UTC (permalink / raw)
  To: lee.jones, linux-kernel
  Cc: trix, yilun.xu, matthew.gerlach, russell.h.weight, lgoncalv, hao.wu

This patchset is some improvements for intel-m10-bmc and its subdevs.

Main changes from v1:
- Add a patch (#2) to simplify the definition of the legacy version reg.
- Add a patch (#4), add entry in MAINTAINERS for intel-m10-bmc mfd driver
  and the subdev drivers.

Main changes from v2:
- Add Tom Rix as the reviewer for intel-m10-bmc mfd driver and the subdev
  drivers.
- Rebased to 5.12-rc1

Main changes from v3:
- Improve the comments for valid version check.


Matthew Gerlach (1):
  mfd: intel-m10-bmc: Add access table configuration to the regmap

Xu Yilun (3):
  mfd: intel-m10-bmc: Fix the register access range
  mfd: intel-m10-bmc: Simplify the legacy version reg definition
  MAINTAINERS: Add entry for Intel MAX 10 mfd driver

 MAINTAINERS                       | 10 ++++++++++
 drivers/mfd/intel-m10-bmc.c       | 30 ++++++++++++++++++++----------
 include/linux/mfd/intel-m10-bmc.h |  7 +++++--
 3 files changed, 35 insertions(+), 12 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v4 1/4] mfd: intel-m10-bmc: Fix the register access range
  2021-03-10 15:55 [PATCH v4 0/4] Some improvement for Intel MAX 10 MFD drivers Xu Yilun
@ 2021-03-10 15:55 ` Xu Yilun
  2021-03-10 15:55 ` [PATCH v4 2/4] mfd: intel-m10-bmc: Simplify the legacy version reg definition Xu Yilun
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Xu Yilun @ 2021-03-10 15:55 UTC (permalink / raw)
  To: lee.jones, linux-kernel
  Cc: trix, yilun.xu, matthew.gerlach, russell.h.weight, lgoncalv, hao.wu

This patch fixes the max register address of MAX 10 BMC. The range
0x20000000 ~ 0x200000fc are for control registers of the QSPI flash
controller, which are not accessible to host.

Signed-off-by: Xu Yilun <yilun.xu@intel.com>
Reviewed-by: Tom Rix <trix@redhat.com>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
---
v2: no change.
v3: no change, rebased to 5.12-rc1
v4: add Lee's Acked-by, no other change.
---
 include/linux/mfd/intel-m10-bmc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/mfd/intel-m10-bmc.h b/include/linux/mfd/intel-m10-bmc.h
index 74d4e19..9b54ca1 100644
--- a/include/linux/mfd/intel-m10-bmc.h
+++ b/include/linux/mfd/intel-m10-bmc.h
@@ -11,7 +11,7 @@
 
 #define M10BMC_LEGACY_SYS_BASE		0x300400
 #define M10BMC_SYS_BASE			0x300800
-#define M10BMC_MEM_END			0x200000fc
+#define M10BMC_MEM_END			0x1fffffff
 
 /* Register offset of system registers */
 #define NIOS2_FW_VERSION		0x0
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v4 2/4] mfd: intel-m10-bmc: Simplify the legacy version reg definition
  2021-03-10 15:55 [PATCH v4 0/4] Some improvement for Intel MAX 10 MFD drivers Xu Yilun
  2021-03-10 15:55 ` [PATCH v4 1/4] mfd: intel-m10-bmc: Fix the register access range Xu Yilun
@ 2021-03-10 15:55 ` Xu Yilun
  2021-03-10 15:55 ` [PATCH v4 3/4] mfd: intel-m10-bmc: Add access table configuration to the regmap Xu Yilun
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Xu Yilun @ 2021-03-10 15:55 UTC (permalink / raw)
  To: lee.jones, linux-kernel
  Cc: trix, yilun.xu, matthew.gerlach, russell.h.weight, lgoncalv, hao.wu

The version register is the only one in the legacy I/O space to be
accessed, so it is not necessary to define the legacy base & version
register offset. A direct definition of the legacy version register
address would be fine.

Signed-off-by: Xu Yilun <yilun.xu@intel.com>
Reviewed-by: Tom Rix <trix@redhat.com>
---
v3: no change, rebased to 5.12-rc1
v4: improve the comments for valid version check.
---
 drivers/mfd/intel-m10-bmc.c       | 17 +++++++----------
 include/linux/mfd/intel-m10-bmc.h |  2 +-
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/mfd/intel-m10-bmc.c b/drivers/mfd/intel-m10-bmc.c
index 06c9775..90d0448 100644
--- a/drivers/mfd/intel-m10-bmc.c
+++ b/drivers/mfd/intel-m10-bmc.c
@@ -116,17 +116,14 @@ static int check_m10bmc_version(struct intel_m10bmc *ddata)
 	int ret;
 
 	/*
-	 * This check is to filter out the very old legacy BMC versions,
-	 * M10BMC_LEGACY_SYS_BASE is the offset to this old block of mmio
-	 * registers. In the old BMC chips, the BMC version info is stored
-	 * in this old version register (M10BMC_LEGACY_SYS_BASE +
-	 * M10BMC_BUILD_VER), so its read out value would have not been
-	 * LEGACY_INVALID (0xffffffff). But in new BMC chips that the
-	 * driver supports, the value of this register should be
-	 * LEGACY_INVALID.
+	 * This check is to filter out the very old legacy BMC versions. In the
+	 * old BMC chips, the BMC version info is stored in the old version
+	 * register (M10BMC_LEGACY_BUILD_VER), so its read out value would have
+	 * not been M10BMC_VER_LEGACY_INVALID (0xffffffff). But in new BMC
+	 * chips that the driver supports, the value of this register should be
+	 * M10BMC_VER_LEGACY_INVALID.
 	 */
-	ret = m10bmc_raw_read(ddata,
-			      M10BMC_LEGACY_SYS_BASE + M10BMC_BUILD_VER, &v);
+	ret = m10bmc_raw_read(ddata, M10BMC_LEGACY_BUILD_VER, &v);
 	if (ret)
 		return -ENODEV;
 
diff --git a/include/linux/mfd/intel-m10-bmc.h b/include/linux/mfd/intel-m10-bmc.h
index 9b54ca1..4f1071f 100644
--- a/include/linux/mfd/intel-m10-bmc.h
+++ b/include/linux/mfd/intel-m10-bmc.h
@@ -9,7 +9,7 @@
 
 #include <linux/regmap.h>
 
-#define M10BMC_LEGACY_SYS_BASE		0x300400
+#define M10BMC_LEGACY_BUILD_VER		0x300468
 #define M10BMC_SYS_BASE			0x300800
 #define M10BMC_MEM_END			0x1fffffff
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v4 3/4] mfd: intel-m10-bmc: Add access table configuration to the regmap
  2021-03-10 15:55 [PATCH v4 0/4] Some improvement for Intel MAX 10 MFD drivers Xu Yilun
  2021-03-10 15:55 ` [PATCH v4 1/4] mfd: intel-m10-bmc: Fix the register access range Xu Yilun
  2021-03-10 15:55 ` [PATCH v4 2/4] mfd: intel-m10-bmc: Simplify the legacy version reg definition Xu Yilun
@ 2021-03-10 15:55 ` Xu Yilun
  2021-03-10 15:55 ` [PATCH v4 4/4] MAINTAINERS: Add entry for Intel MAX 10 mfd driver Xu Yilun
  2021-03-10 16:35 ` [PATCH v4 0/4] Some improvement for Intel MAX 10 MFD drivers Lee Jones
  4 siblings, 0 replies; 6+ messages in thread
From: Xu Yilun @ 2021-03-10 15:55 UTC (permalink / raw)
  To: lee.jones, linux-kernel
  Cc: trix, yilun.xu, matthew.gerlach, russell.h.weight, lgoncalv, hao.wu

From: Matthew Gerlach <matthew.gerlach@linux.intel.com>

This patch adds access tables to the MAX 10 BMC regmap. This prevents
the host from accessing the unwanted I/O space. It also filters out the
invalid outputs when reading the regmap debugfs interface.

Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
Signed-off-by: Xu Yilun <yilun.xu@intel.com>
Reviewed-by: Tom Rix <trix@redhat.com>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
---
v2: Use the new macro M10BMC_LEGACY_BUILD_VER
v3: No change, rebased to 5.12-rc1
v4: Add Lee's Acked-by, no other change
---
 drivers/mfd/intel-m10-bmc.c       | 13 +++++++++++++
 include/linux/mfd/intel-m10-bmc.h |  5 ++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/intel-m10-bmc.c b/drivers/mfd/intel-m10-bmc.c
index 90d0448..1161933 100644
--- a/drivers/mfd/intel-m10-bmc.c
+++ b/drivers/mfd/intel-m10-bmc.c
@@ -23,10 +23,23 @@ static struct mfd_cell m10bmc_pacn3000_subdevs[] = {
 	{ .name = "n3000bmc-secure" },
 };
 
+static const struct regmap_range m10bmc_regmap_range[] = {
+	regmap_reg_range(M10BMC_LEGACY_BUILD_VER, M10BMC_LEGACY_BUILD_VER),
+	regmap_reg_range(M10BMC_SYS_BASE, M10BMC_SYS_END),
+	regmap_reg_range(M10BMC_FLASH_BASE, M10BMC_FLASH_END),
+};
+
+static const struct regmap_access_table m10bmc_access_table = {
+	.yes_ranges	= m10bmc_regmap_range,
+	.n_yes_ranges	= ARRAY_SIZE(m10bmc_regmap_range),
+};
+
 static struct regmap_config intel_m10bmc_regmap_config = {
 	.reg_bits = 32,
 	.val_bits = 32,
 	.reg_stride = 4,
+	.wr_table = &m10bmc_access_table,
+	.rd_table = &m10bmc_access_table,
 	.max_register = M10BMC_MEM_END,
 };
 
diff --git a/include/linux/mfd/intel-m10-bmc.h b/include/linux/mfd/intel-m10-bmc.h
index 4f1071f..c4eb38c 100644
--- a/include/linux/mfd/intel-m10-bmc.h
+++ b/include/linux/mfd/intel-m10-bmc.h
@@ -11,7 +11,10 @@
 
 #define M10BMC_LEGACY_BUILD_VER		0x300468
 #define M10BMC_SYS_BASE			0x300800
-#define M10BMC_MEM_END			0x1fffffff
+#define M10BMC_SYS_END			0x300fff
+#define M10BMC_FLASH_BASE		0x10000000
+#define M10BMC_FLASH_END		0x1fffffff
+#define M10BMC_MEM_END			M10BMC_FLASH_END
 
 /* Register offset of system registers */
 #define NIOS2_FW_VERSION		0x0
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v4 4/4] MAINTAINERS: Add entry for Intel MAX 10 mfd driver
  2021-03-10 15:55 [PATCH v4 0/4] Some improvement for Intel MAX 10 MFD drivers Xu Yilun
                   ` (2 preceding siblings ...)
  2021-03-10 15:55 ` [PATCH v4 3/4] mfd: intel-m10-bmc: Add access table configuration to the regmap Xu Yilun
@ 2021-03-10 15:55 ` Xu Yilun
  2021-03-10 16:35 ` [PATCH v4 0/4] Some improvement for Intel MAX 10 MFD drivers Lee Jones
  4 siblings, 0 replies; 6+ messages in thread
From: Xu Yilun @ 2021-03-10 15:55 UTC (permalink / raw)
  To: lee.jones, linux-kernel
  Cc: trix, yilun.xu, matthew.gerlach, russell.h.weight, lgoncalv, hao.wu

This patch adds maintainer info for Intel MAX 10 mfd driver.

Signed-off-by: Xu Yilun <yilun.xu@intel.com>
Reviewed-by: Tom Rix <trix@redhat.com>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
---
v3: Add Tom Rix as the reviewer.
v4: Add Lee's Acked-by, no other change.
---
 MAINTAINERS | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index b58a469..ab31c01 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9116,6 +9116,16 @@ F:	include/linux/mei_cl_bus.h
 F:	include/uapi/linux/mei.h
 F:	samples/mei/*
 
+INTEL MAX 10 BMC MFD DRIVER
+M:	Xu Yilun <yilun.xu@intel.com>
+R:	Tom Rix <trix@redhat.com>
+S:	Maintained
+F:	Documentation/ABI/testing/sysfs-driver-intel-m10-bmc
+F:	Documentation/hwmon/intel-m10-bmc-hwmon.rst
+F:	drivers/hwmon/intel-m10-bmc-hwmon.c
+F:	drivers/mfd/intel-m10-bmc.c
+F:	include/linux/mfd/intel-m10-bmc.h
+
 INTEL MENLOW THERMAL DRIVER
 M:	Sujith Thomas <sujith.thomas@intel.com>
 L:	platform-driver-x86@vger.kernel.org
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v4 0/4] Some improvement for Intel MAX 10 MFD drivers
  2021-03-10 15:55 [PATCH v4 0/4] Some improvement for Intel MAX 10 MFD drivers Xu Yilun
                   ` (3 preceding siblings ...)
  2021-03-10 15:55 ` [PATCH v4 4/4] MAINTAINERS: Add entry for Intel MAX 10 mfd driver Xu Yilun
@ 2021-03-10 16:35 ` Lee Jones
  4 siblings, 0 replies; 6+ messages in thread
From: Lee Jones @ 2021-03-10 16:35 UTC (permalink / raw)
  To: Xu Yilun
  Cc: linux-kernel, trix, matthew.gerlach, russell.h.weight, lgoncalv, hao.wu

On Wed, 10 Mar 2021, Xu Yilun wrote:

> This patchset is some improvements for intel-m10-bmc and its subdevs.
> 
> Main changes from v1:
> - Add a patch (#2) to simplify the definition of the legacy version reg.
> - Add a patch (#4), add entry in MAINTAINERS for intel-m10-bmc mfd driver
>   and the subdev drivers.
> 
> Main changes from v2:
> - Add Tom Rix as the reviewer for intel-m10-bmc mfd driver and the subdev
>   drivers.
> - Rebased to 5.12-rc1
> 
> Main changes from v3:
> - Improve the comments for valid version check.

Good enough.

All applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
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:[~2021-03-10 16:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 15:55 [PATCH v4 0/4] Some improvement for Intel MAX 10 MFD drivers Xu Yilun
2021-03-10 15:55 ` [PATCH v4 1/4] mfd: intel-m10-bmc: Fix the register access range Xu Yilun
2021-03-10 15:55 ` [PATCH v4 2/4] mfd: intel-m10-bmc: Simplify the legacy version reg definition Xu Yilun
2021-03-10 15:55 ` [PATCH v4 3/4] mfd: intel-m10-bmc: Add access table configuration to the regmap Xu Yilun
2021-03-10 15:55 ` [PATCH v4 4/4] MAINTAINERS: Add entry for Intel MAX 10 mfd driver Xu Yilun
2021-03-10 16:35 ` [PATCH v4 0/4] Some improvement for Intel MAX 10 MFD drivers Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).