From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Wolfram Sang <wsa@the-dreams.de>, Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>,
linux-i2c@vger.kernel.org,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <fabio.estevam@nxp.com>,
linux-arm-kernel@lists.infradead.org,
NXP Linux Team <linux-imx@nxp.com>
Subject: [PATCH v1 2/3] i2c: imx: probe dma only only on i.MX50 and later.
Date: Thu, 18 Oct 2018 13:26:14 +0200 [thread overview]
Message-ID: <20181018112615.29362-3-o.rempel@pengutronix.de> (raw)
In-Reply-To: <20181018112615.29362-1-o.rempel@pengutronix.de>
The DMA support for I2C was introduced on i.MX50. So,
avoid of DMA probing on not supported versions.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/i2c/busses/i2c-imx.c | 53 ++++++++++++++++++++++++++++++++++--
1 file changed, 51 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index c406700789e1..df013b1b6fa4 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -169,6 +169,7 @@ struct imx_i2c_hwdata {
unsigned ndivs;
unsigned i2sr_clr_opcode;
unsigned i2cr_ien_opcode;
+ bool has_dmamode;
};
struct imx_i2c_dma {
@@ -211,7 +212,7 @@ static const struct imx_i2c_hwdata imx1_i2c_hwdata = {
.ndivs = ARRAY_SIZE(imx_i2c_clk_div),
.i2sr_clr_opcode = I2SR_CLR_OPCODE_W0C,
.i2cr_ien_opcode = I2CR_IEN_OPCODE_1,
-
+ .has_dmamode = false,
};
static const struct imx_i2c_hwdata imx21_i2c_hwdata = {
@@ -221,7 +222,17 @@ static const struct imx_i2c_hwdata imx21_i2c_hwdata = {
.ndivs = ARRAY_SIZE(imx_i2c_clk_div),
.i2sr_clr_opcode = I2SR_CLR_OPCODE_W0C,
.i2cr_ien_opcode = I2CR_IEN_OPCODE_1,
+ .has_dmamode = false,
+};
+static const struct imx_i2c_hwdata imx50_i2c_hwdata = {
+ .devtype = IMX21_I2C,
+ .regshift = IMX_I2C_REGSHIFT,
+ .clk_div = imx_i2c_clk_div,
+ .ndivs = ARRAY_SIZE(imx_i2c_clk_div),
+ .i2sr_clr_opcode = I2SR_CLR_OPCODE_W0C,
+ .i2cr_ien_opcode = I2CR_IEN_OPCODE_1,
+ .has_dmamode = true,
};
static struct imx_i2c_hwdata vf610_i2c_hwdata = {
@@ -231,7 +242,7 @@ static struct imx_i2c_hwdata vf610_i2c_hwdata = {
.ndivs = ARRAY_SIZE(vf610_i2c_clk_div),
.i2sr_clr_opcode = I2SR_CLR_OPCODE_W1C,
.i2cr_ien_opcode = I2CR_IEN_OPCODE_0,
-
+ .has_dmamode = true,
};
static const struct platform_device_id imx_i2c_devtype[] = {
@@ -241,6 +252,33 @@ static const struct platform_device_id imx_i2c_devtype[] = {
}, {
.name = "imx21-i2c",
.driver_data = (kernel_ulong_t)&imx21_i2c_hwdata,
+ }, {
+ .name = "imx50-i2c",
+ .driver_data = (kernel_ulong_t)&imx50_i2c_hwdata,
+ }, {
+ .name = "imx51-i2c",
+ .driver_data = (kernel_ulong_t)&imx50_i2c_hwdata,
+ }, {
+ .name = "imx53-i2c",
+ .driver_data = (kernel_ulong_t)&imx50_i2c_hwdata,
+ }, {
+ .name = "imx6q-i2c",
+ .driver_data = (kernel_ulong_t)&imx50_i2c_hwdata,
+ }, {
+ .name = "imx6sl-i2c",
+ .driver_data = (kernel_ulong_t)&imx50_i2c_hwdata,
+ }, {
+ .name = "imx6sll-i2c",
+ .driver_data = (kernel_ulong_t)&imx50_i2c_hwdata,
+ }, {
+ .name = "imx6sx-i2c",
+ .driver_data = (kernel_ulong_t)&imx50_i2c_hwdata,
+ }, {
+ .name = "imx6ul-i2c",
+ .driver_data = (kernel_ulong_t)&imx50_i2c_hwdata,
+ }, {
+ .name = "imx7d-i2c",
+ .driver_data = (kernel_ulong_t)&imx50_i2c_hwdata,
}, {
/* sentinel */
}
@@ -250,6 +288,14 @@ MODULE_DEVICE_TABLE(platform, imx_i2c_devtype);
static const struct of_device_id i2c_imx_dt_ids[] = {
{ .compatible = "fsl,imx1-i2c", .data = &imx1_i2c_hwdata, },
{ .compatible = "fsl,imx21-i2c", .data = &imx21_i2c_hwdata, },
+ { .compatible = "fsl,imx50-i2c", .data = &imx50_i2c_hwdata, },
+ { .compatible = "fsl,imx51-i2c", .data = &imx50_i2c_hwdata, },
+ { .compatible = "fsl,imx53-i2c", .data = &imx50_i2c_hwdata, },
+ { .compatible = "fsl,imx6q-i2c", .data = &imx50_i2c_hwdata, },
+ { .compatible = "fsl,imx6sl-i2c", .data = &imx50_i2c_hwdata, },
+ { .compatible = "fsl,imx6sll-i2c", .data = &imx50_i2c_hwdata, },
+ { .compatible = "fsl,imx6sx-i2c", .data = &imx50_i2c_hwdata, },
+ { .compatible = "fsl,imx6ul-i2c", .data = &imx50_i2c_hwdata, },
{ .compatible = "fsl,vf610-i2c", .data = &vf610_i2c_hwdata, },
{ /* sentinel */ }
};
@@ -281,6 +327,9 @@ static void i2c_imx_dma_request(struct imx_i2c_struct *i2c_imx,
struct device *dev = &i2c_imx->adapter.dev;
int ret;
+ if (!i2c_imx->hwdata->has_dmamode)
+ return;
+
dma = devm_kzalloc(dev, sizeof(*dma), GFP_KERNEL);
if (!dma)
return;
--
2.19.0
next prev parent reply other threads:[~2018-10-18 11:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-18 11:26 [PATCH v1 0/3] i2c: imx: DMA related fixes Oleksij Rempel
2018-10-18 11:26 ` [PATCH v1 1/3] ARM: dts: imx6sll: fix typo for fsl,imx6sll-i2c node Oleksij Rempel
2018-10-18 18:43 ` Uwe Kleine-König
2018-10-31 7:50 ` Shawn Guo
2018-10-18 11:26 ` Oleksij Rempel [this message]
2018-10-19 7:12 ` [PATCH v1 2/3] i2c: imx: probe dma only only on i.MX50 and later Uwe Kleine-König
2018-10-19 9:01 ` Oleksij Rempel
2018-10-19 9:21 ` Uwe Kleine-König
2018-10-19 10:17 ` Oleksij Rempel
2018-10-18 11:26 ` [PATCH v1 3/3] i2c: imx: don't print error if DMA is not configured Oleksij Rempel
2018-10-28 22:11 ` Wolfram Sang
2018-10-29 8:07 ` Oleksij Rempel
2018-10-29 8:54 ` Wolfram Sang
2018-11-03 20:59 ` Uwe Kleine-König
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=20181018112615.29362-3-o.rempel@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=fabio.estevam@nxp.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=wsa@the-dreams.de \
/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).