linux-fpga.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tianfei Zhang <tianfei.zhang@intel.com>
To: yilun.xu@intel.com, lee.jones@linaro.org
Cc: hao.wu@intel.com, trix@redhat.com, linux-kernel@vger.kernel.org,
	linux-fpga@vger.kernel.org, russell.h.weight@intel.com,
	matthew.gerlach@linux.intel.com,
	Tianfei Zhang <tianfei.zhang@intel.com>
Subject: [PATCH v3 3/3] mfd: intel-m10-bmc: support different BMC base register address
Date: Fri, 24 Jun 2022 05:22:29 -0400	[thread overview]
Message-ID: <20220624092229.45854-4-tianfei.zhang@intel.com> (raw)
In-Reply-To: <20220624092229.45854-1-tianfei.zhang@intel.com>

There are different base addresses for the MAX10 CSR registers.
Introducing a new member "base" in intel_m10bmc data structure
to support different BMC base register addresses.

Signed-off-by: Tianfei Zhang <tianfei.zhang@intel.com>
---
v3:
 - use a new member "base" instead of m10bmc_csr data structure.
---
 drivers/mfd/intel-m10-bmc-pmci.c  | 1 +
 drivers/mfd/intel-m10-bmc.c       | 1 +
 include/linux/mfd/intel-m10-bmc.h | 4 +++-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/intel-m10-bmc-pmci.c b/drivers/mfd/intel-m10-bmc-pmci.c
index 93eca4483ac7..26eeda9720dc 100644
--- a/drivers/mfd/intel-m10-bmc-pmci.c
+++ b/drivers/mfd/intel-m10-bmc-pmci.c
@@ -221,6 +221,7 @@ static int pmci_probe(struct dfl_device *ddev)
 		return -ENOMEM;
 
 	pmci->m10bmc.dev = dev;
+	pmci->m10bmc.base = M10BMC_PMCI_SYS_BASE;
 	pmci->dev = dev;
 
 	pmci->base = devm_ioremap_resource(dev, &ddev->mmio_res);
diff --git a/drivers/mfd/intel-m10-bmc.c b/drivers/mfd/intel-m10-bmc.c
index 7e521df29c72..f4cb67629404 100644
--- a/drivers/mfd/intel-m10-bmc.c
+++ b/drivers/mfd/intel-m10-bmc.c
@@ -171,6 +171,7 @@ static int intel_m10_bmc_spi_probe(struct spi_device *spi)
 		return -ENOMEM;
 
 	ddata->dev = dev;
+	ddata->base = M10BMC_SYS_BASE;
 
 	ddata->regmap =
 		devm_regmap_init_spi_avmm(spi, &intel_m10bmc_regmap_config);
diff --git a/include/linux/mfd/intel-m10-bmc.h b/include/linux/mfd/intel-m10-bmc.h
index 7b58af207b72..0c81dbcdc3dc 100644
--- a/include/linux/mfd/intel-m10-bmc.h
+++ b/include/linux/mfd/intel-m10-bmc.h
@@ -130,10 +130,12 @@
  * struct intel_m10bmc - Intel MAX 10 BMC parent driver data structure
  * @dev: this device
  * @regmap: the regmap used to access registers by m10bmc itself
+ * @base: the base address of MAX10 BMC registers
  */
 struct intel_m10bmc {
 	struct device *dev;
 	struct regmap *regmap;
+	unsigned int base;
 };
 
 /*
@@ -165,6 +167,6 @@ m10bmc_raw_read(struct intel_m10bmc *m10bmc, unsigned int addr,
  * M10BMC_SYS_BASE accordingly.
  */
 #define m10bmc_sys_read(m10bmc, offset, val) \
-	m10bmc_raw_read(m10bmc, M10BMC_SYS_BASE + (offset), val)
+	m10bmc_raw_read(m10bmc, (m10bmc)->base + (offset), val)
 
 #endif /* __MFD_INTEL_M10_BMC_H */
-- 
2.26.2


      parent reply	other threads:[~2022-06-24  9:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-24  9:22 [PATCH v3 0/3] add PMCI driver support Tianfei Zhang
2022-06-24  9:22 ` [PATCH v3 1/3] mfd: intel-m10-bmc: rename the local variables Tianfei Zhang
2022-06-25 13:28   ` Tom Rix
2022-06-27  8:04     ` Lee Jones
2022-06-24  9:22 ` [PATCH v3 2/3] mfd: intel-m10-bmc: add PMCI driver Tianfei Zhang
2022-06-25 13:52   ` Tom Rix
2022-06-27 14:03     ` Zhang, Tianfei
2022-06-27 16:30       ` Xu Yilun
2022-06-28  3:51         ` Zhang, Tianfei
2022-06-24  9:22 ` Tianfei Zhang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220624092229.45854-4-tianfei.zhang@intel.com \
    --to=tianfei.zhang@intel.com \
    --cc=hao.wu@intel.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.gerlach@linux.intel.com \
    --cc=russell.h.weight@intel.com \
    --cc=trix@redhat.com \
    --cc=yilun.xu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).