From patchwork Mon Feb 20 16:54:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris BREZILLON X-Patchwork-Id: 9583325 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 73FF5604A0 for ; Mon, 20 Feb 2017 17:03:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80D93284A5 for ; Mon, 20 Feb 2017 17:03:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 75B3F2855E; Mon, 20 Feb 2017 17:03:11 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 E81B2284A5 for ; Mon, 20 Feb 2017 17:03:10 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=EtyJkn3ZXF/SWNePYwj7zt3a0cgiNxdiwsVfAzBrdc8=; b=E0rMYQ03wE5eH/Nd1XrC2zTsTX v9VWTOudimwNsE39B8NlVpzhgAZKVuRCj2k97y8Th9eNZfpOjHNr7R8pjZQUtJouPFQjbvqX01Zx8 ejlBabkC8ml4OBD01kdFM6cjInIHHsGXIrkAxJqMK00Rpcm1c+S/3VxUrJGCtyuJbqgrlF9N+Wtrn v+N+LTdTm5E15CAUld+N36r7hxs41idkcLBdVnVMJsz7ZsQoQEjYoXAu5TqzfUSuiCLk8R5C7Jt+b 6SxPThrbpn78S22PuDWw5C2C6LYYBTXLxcs0Z52WbjgVapeuAe4idQqrWUfToOdYjziejUwqMWhfh NeBJM1DQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cfrMj-0000c6-RA; Mon, 20 Feb 2017 17:03:09 +0000 Received: from mail.free-electrons.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cfrFS-0005Zi-TR for linux-arm-kernel@lists.infradead.org; Mon, 20 Feb 2017 16:55:44 +0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id 0F835206F9; Mon, 20 Feb 2017 17:55:18 +0100 (CET) Received: from bbrezillon.home (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id CEC5B20707; Mon, 20 Feb 2017 17:55:07 +0100 (CET) From: Boris Brezillon To: Nicolas Ferre , Alexandre Belloni Subject: [PATCH 3/7] memory: atmel-ebi: Stop using reg_field objects for simple things Date: Mon, 20 Feb 2017 17:54:57 +0100 Message-Id: <1487609701-10300-4-git-send-email-boris.brezillon@free-electrons.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487609701-10300-1-git-send-email-boris.brezillon@free-electrons.com> References: <1487609701-10300-1-git-send-email-boris.brezillon@free-electrons.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170220_085539_578459_E55C77B4 X-CRM114-Status: GOOD ( 15.44 ) 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: Boris Brezillon , Lee Jones , Samuel Ortiz , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 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 Turn the ->ebi_csa reg field into a simple offset that can be used with with the matrix regmap. Using reg fields was overkill for this use case. Signed-off-by: Boris Brezillon --- drivers/memory/atmel-ebi.c | 55 +++++++++++----------------------------------- 1 file changed, 13 insertions(+), 42 deletions(-) diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c index 8363735f8aef..6b3c9fc7a602 100644 --- a/drivers/memory/atmel-ebi.c +++ b/drivers/memory/atmel-ebi.c @@ -35,7 +35,7 @@ struct at91_ebi_dev { struct at91_ebi_caps { unsigned int available_cs; - const struct reg_field *ebi_csa; + unsigned int ebi_csa_offs; void (*get_config)(struct at91_ebi_dev *ebid, struct at91_ebi_dev_config *conf); int (*xlate_config)(struct at91_ebi_dev *ebid, @@ -52,7 +52,6 @@ struct at91_ebi { struct regmap *regmap; struct clk *clk; } smc; - struct regmap_field *ebi_csa; struct device *dev; const struct at91_ebi_caps *caps; @@ -354,9 +353,10 @@ static int at91_ebi_dev_setup(struct at91_ebi *ebi, struct device_node *np, * Attach the EBI device to the generic SMC logic if at least * one "atmel,smc-" property is present. */ - if (ebi->ebi_csa && apply) - regmap_field_update_bits(ebi->ebi_csa, - BIT(cs), 0); + if (ebi->caps->ebi_csa_offs && apply) + regmap_update_bits(ebi->matrix, + ebi->caps->ebi_csa_offs, + BIT(cs), 0); i++; } @@ -366,73 +366,49 @@ static int at91_ebi_dev_setup(struct at91_ebi *ebi, struct device_node *np, return 0; } -static const struct reg_field at91sam9260_ebi_csa = - REG_FIELD(AT91SAM9260_MATRIX_EBICSA, 0, - AT91_MATRIX_EBI_NUM_CS - 1); - static const struct at91_ebi_caps at91sam9260_ebi_caps = { .available_cs = 0xff, - .ebi_csa = &at91sam9260_ebi_csa, + .ebi_csa_offs = AT91SAM9260_MATRIX_EBICSA, .get_config = at91sam9_ebi_get_config, .xlate_config = at91_ebi_xslate_smc_config, .apply_config = at91sam9_ebi_apply_config, }; -static const struct reg_field at91sam9261_ebi_csa = - REG_FIELD(AT91SAM9261_MATRIX_EBICSA, 0, - AT91_MATRIX_EBI_NUM_CS - 1); - static const struct at91_ebi_caps at91sam9261_ebi_caps = { .available_cs = 0xff, - .ebi_csa = &at91sam9261_ebi_csa, + .ebi_csa_offs = AT91SAM9261_MATRIX_EBICSA, .get_config = at91sam9_ebi_get_config, .xlate_config = at91_ebi_xslate_smc_config, .apply_config = at91sam9_ebi_apply_config, }; -static const struct reg_field at91sam9263_ebi0_csa = - REG_FIELD(AT91SAM9263_MATRIX_EBI0CSA, 0, - AT91_MATRIX_EBI_NUM_CS - 1); - static const struct at91_ebi_caps at91sam9263_ebi0_caps = { .available_cs = 0x3f, - .ebi_csa = &at91sam9263_ebi0_csa, + .ebi_csa_offs = AT91SAM9263_MATRIX_EBI0CSA, .get_config = at91sam9_ebi_get_config, .xlate_config = at91_ebi_xslate_smc_config, .apply_config = at91sam9_ebi_apply_config, }; -static const struct reg_field at91sam9263_ebi1_csa = - REG_FIELD(AT91SAM9263_MATRIX_EBI1CSA, 0, - AT91_MATRIX_EBI_NUM_CS - 1); - static const struct at91_ebi_caps at91sam9263_ebi1_caps = { .available_cs = 0x7, - .ebi_csa = &at91sam9263_ebi1_csa, + .ebi_csa_offs = AT91SAM9263_MATRIX_EBI1CSA, .get_config = at91sam9_ebi_get_config, .xlate_config = at91_ebi_xslate_smc_config, .apply_config = at91sam9_ebi_apply_config, }; -static const struct reg_field at91sam9rl_ebi_csa = - REG_FIELD(AT91SAM9RL_MATRIX_EBICSA, 0, - AT91_MATRIX_EBI_NUM_CS - 1); - static const struct at91_ebi_caps at91sam9rl_ebi_caps = { .available_cs = 0x3f, - .ebi_csa = &at91sam9rl_ebi_csa, + .ebi_csa_offs = AT91SAM9RL_MATRIX_EBICSA, .get_config = at91sam9_ebi_get_config, .xlate_config = at91_ebi_xslate_smc_config, .apply_config = at91sam9_ebi_apply_config, }; -static const struct reg_field at91sam9g45_ebi_csa = - REG_FIELD(AT91SAM9G45_MATRIX_EBICSA, 0, - AT91_MATRIX_EBI_NUM_CS - 1); - static const struct at91_ebi_caps at91sam9g45_ebi_caps = { .available_cs = 0x3f, - .ebi_csa = &at91sam9g45_ebi_csa, + .ebi_csa_offs = AT91SAM9G45_MATRIX_EBICSA, .get_config = at91sam9_ebi_get_config, .xlate_config = at91_ebi_xslate_smc_config, .apply_config = at91sam9_ebi_apply_config, @@ -440,7 +416,7 @@ static const struct at91_ebi_caps at91sam9g45_ebi_caps = { static const struct at91_ebi_caps at91sam9x5_ebi_caps = { .available_cs = 0x3f, - .ebi_csa = &at91sam9263_ebi0_csa, + .ebi_csa_offs = AT91SAM9X5_MATRIX_EBICSA, .get_config = at91sam9_ebi_get_config, .xlate_config = at91_ebi_xslate_smc_config, .apply_config = at91sam9_ebi_apply_config, @@ -560,16 +536,11 @@ static int at91_ebi_probe(struct platform_device *pdev) * The sama5d3 does not provide an EBICSA register and thus does need * to access the matrix registers. */ - if (ebi->caps->ebi_csa) { + if (ebi->caps->ebi_csa_offs) { ebi->matrix = syscon_regmap_lookup_by_phandle(np, "atmel,matrix"); if (IS_ERR(ebi->matrix)) return PTR_ERR(ebi->matrix); - - ebi->ebi_csa = regmap_field_alloc(ebi->matrix, - *ebi->caps->ebi_csa); - if (IS_ERR(ebi->ebi_csa)) - return PTR_ERR(ebi->ebi_csa); } ret = of_property_read_u32(np, "#address-cells", &val);