public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Mohammed Billoo <mab@mab-labs.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Mohammed Billoo <mab@mab-labs.com>,
	peter@korsgaard.com, andrew@lunn.ch, linux-i2c@vger.kernel.org
Subject: [PATCH 1/2] i2c: ocores: add gaisler to platform data
Date: Fri, 14 Aug 2020 12:31:33 -0400	[thread overview]
Message-ID: <20200814163134.29493-1-mab@mab-labs.com> (raw)

There may be instances when the device tree is not suitable to interface
with the ocores implementation. For example, when the FPGA/ASIC is
not on the same silicon die (e.g. the communication between the CPU and
the FPGA/ASIC is over PCI), information about the ocore implementation,
such as whether the gaisler implementation is used, must be determined
during runtime. In this case, the client driver would prepopulate the
platform data during device instantiation. Thus, a boolean needs to be
added in the platform data, to instruct the i2c-ocores driver whether
the gaisler register callbacks should be used.

Signed-off-by: Mohammed Billoo <mab@mab-labs.com>
---
 drivers/i2c/busses/i2c-ocores.c          | 4 ++++
 include/linux/platform_data/i2c-ocores.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index f5fc75b65a19..0975f6797069 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -647,6 +647,10 @@ static int ocores_i2c_probe(struct platform_device *pdev)
 			i2c->bus_clock_khz = pdata->bus_khz;
 		else
 			i2c->bus_clock_khz = 100;
+		if (pdata->gaisler) {
+			i2c->setreg = oc_setreg_grlib;
+			i2c->getreg = oc_getreg_grlib;
+		}
 	} else {
 		ret = ocores_i2c_of_probe(pdev, i2c);
 		if (ret)
diff --git a/include/linux/platform_data/i2c-ocores.h b/include/linux/platform_data/i2c-ocores.h
index e6326cbafe59..8a5849f1e267 100644
--- a/include/linux/platform_data/i2c-ocores.h
+++ b/include/linux/platform_data/i2c-ocores.h
@@ -14,6 +14,7 @@ struct ocores_i2c_platform_data {
 	u32 clock_khz; /* input clock in kHz */
 	u32 bus_khz; /* bus clock in kHz */
 	bool big_endian; /* registers are big endian */
+	bool gaisler; /* use grlib accessors */
 	u8 num_devices; /* number of devices in the devices list */
 	struct i2c_board_info const *devices; /* devices connected to the bus */
 };
-- 
2.17.1


             reply	other threads:[~2020-08-14 16:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14 16:31 Mohammed Billoo [this message]
2020-08-14 16:31 ` [PATCH 2/2] i2c: ocores: add be/le support for gaisler Mohammed Billoo
2020-08-14 16:50   ` Andrew Lunn
     [not found]     ` <CALkjhPppeOwekp-ZJZ9QGfNGa=K5g6P+TWs42Anrb+QvFSrspQ@mail.gmail.com>
2020-08-14 19:02       ` Andrew Lunn
2020-08-14 19:05         ` Wolfram Sang
2020-08-14 16:49 ` [PATCH 1/2] i2c: ocores: add gaisler to platform data Andrew Lunn
     [not found]   ` <CALkjhPo3BGRDao=Rz9S5Xxf1bubBXv7WEGu6B=5V1WvnmGUmwg@mail.gmail.com>
2020-08-14 19:04     ` Andrew Lunn

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=20200814163134.29493-1-mab@mab-labs.com \
    --to=mab@mab-labs.com \
    --cc=andrew@lunn.ch \
    --cc=linux-i2c@vger.kernel.org \
    --cc=peter@korsgaard.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