From patchwork Thu Oct 18 11:26:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 10647041 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EF1F2181D for ; Thu, 18 Oct 2018 11:27:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1D6528505 for ; Thu, 18 Oct 2018 11:27:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D664628698; Thu, 18 Oct 2018 11:27:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E3A7728653 for ; Thu, 18 Oct 2018 11:27:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BjaXvqp43CqkMWGAlbtRqMPufyAlal+ie9nycbUe08o=; b=he2Txm073ZgUsD eRvwoCZ4X/UyvhuqA54ylRHc01kr85X6A+IF7OsNwS4k9U2vJV4bQYJ/3X6pEP62V5HcJhiu3GLvj V42AxGXP7CVbEdehjFUvVRTO5xShyzIsSDbxwyNsg+o+t8fAJUZhAn4i3bqe9aeQYiE4Yikz/fUmd I8pPJwygd8fuVauLruJNrVqn2WRfll5S83vFuwI4d7ACZPduWCb5e02hPYeeuQWbJlOjw9m0E8yL6 EaPCb8LPiMnDp/TXXMRJBY15f8YcAyWqGJBgJtOY+avL5UqdVCYkc9/GCRjF/K1ZCe2igoHVb4gcq eSm8VzXPcRcThmI6+j1Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gD6SQ-0000rG-Ns; Thu, 18 Oct 2018 11:27:14 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gD6Ro-0000YB-2o for linux-arm-kernel@lists.infradead.org; Thu, 18 Oct 2018 11:26:37 +0000 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gD6RV-0004aN-Eg; Thu, 18 Oct 2018 13:26:17 +0200 Received: from ore by dude.hi.pengutronix.de with local (Exim 4.91) (envelope-from ) id 1gD6RU-0007fC-Jx; Thu, 18 Oct 2018 13:26:16 +0200 From: Oleksij Rempel To: Wolfram Sang , Shawn Guo , Sascha Hauer 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 Message-Id: <20181018112615.29362-3-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181018112615.29362-1-o.rempel@pengutronix.de> References: <20181018112615.29362-1-o.rempel@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181018_042636_310453_A4404203 X-CRM114-Status: GOOD ( 13.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Oleksij Rempel , linux-i2c@vger.kernel.org, Pengutronix Kernel Team , Fabio Estevam , linux-arm-kernel@lists.infradead.org, NXP Linux Team Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The DMA support for I2C was introduced on i.MX50. So, avoid of DMA probing on not supported versions. Signed-off-by: Oleksij Rempel --- 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;