From patchwork Thu Jan 25 07:21:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yogesh Narayan Gaur X-Patchwork-Id: 10183715 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 89FE160383 for ; Thu, 25 Jan 2018 07:24:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7158C28A1B for ; Thu, 25 Jan 2018 07:24:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65C6928A1D; Thu, 25 Jan 2018 07:24:39 +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=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED 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 C90F228A1B for ; Thu, 25 Jan 2018 07:24:38 +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=WKKa3x3GjTAKEiXMhFIfAz7uYzNO27Teppb8TC7yLto=; b=Gp6Em+1jRX1OHB YOZox/HB7I7uL00VWqXaPF8nL9RAr5Ik7RX7qjhk7UyQq0ItiQdXBe2cS8tBkq6DhMFu1CjYu/3y4 IY5RlVh5MAunnPAgHXt9tdbbkybFnlBtJjj7sGWkD3ItH9dxq5/+JaqoysyQxLOdY2Q6ybtWfc4so El+pM1FJt4XvlW6hdzru5lEcJ4zy4Hr4VVv3w1wLtz1F4ihfrCm9H1h+/BqqqwOgfqEue+2l9zvUh XYdOHSSVj23VLw+/cTay9fAMq0vElKwfOJNPAqAiVzxD1ZbfAa2sFVdxX8aecLu18PqSv0MDv/+dZ X9rREUfiH85YvhMnhY3Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eebtj-0004AL-1R; Thu, 25 Jan 2018 07:24:35 +0000 Received: from mail-db5eur01on0074.outbound.protection.outlook.com ([104.47.2.74] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eebsZ-0002sw-GD; Thu, 25 Jan 2018 07:23:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=V4fdPC1WsZeKgiohAw8Om7dIKyTR/AtU2yd+b5sJYh0=; b=I691RC3z+nQ5QqoWKkTCitPEd5ZDQWeaactAJ0uqNx+FCaD/rkTgsoK9Obiavs/I/Ne1c/25ODN4WTpjHoVMGjNXSEv+9DuMOyUCSHOOnF+UsNegicuBoWhO9rbW3xXLuqrxKnVeWXXDoyMl9thBrNg5mOY+j06TCYgS15barHw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yogeshnarayan.gaur@nxp.com; Received: from idcbfarm.ap.freescale.net (192.88.169.1) by DB6PR0402MB2840.eurprd04.prod.outlook.com (2603:10a6:4:98::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Thu, 25 Jan 2018 07:23:10 +0000 From: Yogesh Gaur To: linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, robh@kernel.org, mark.rutland@arm.com, shawnguo@kernel.org Subject: [PATCH 2/2] mtd: fsl-quadspi: Update hwcap based on mode provided in dtsi file Date: Thu, 25 Jan 2018 12:51:57 +0530 Message-Id: <1516864917-31969-3-git-send-email-yogeshnarayan.gaur@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1516864917-31969-1-git-send-email-yogeshnarayan.gaur@nxp.com> References: <1516864917-31969-1-git-send-email-yogeshnarayan.gaur@nxp.com> MIME-Version: 1.0 X-Originating-IP: [192.88.169.1] X-ClientProxiedBy: MA1PR01CA0082.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00::22) To DB6PR0402MB2840.eurprd04.prod.outlook.com (2603:10a6:4:98::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f490d131-03d1-46a1-8546-08d563c47f51 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DB6PR0402MB2840; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0402MB2840; 3:+IDvHZTbxvE9tJrpcpmYpfpOwctYkqM3bX24qmBfbWnGzegJDP3vZgAcrLjNQzMLDOr08jD8qw/bYtocp4cRCcLMCS+o+FF3MbqoKjFg7DUesyokpQ5NRPEJtgz+1ZiPeuGBdpFD0a1HSHJKAABb0pPUsSjcb4erDuKsmaA2bu8oIeRXqiPCX6aJU4ER0lG5ButLn+s/RS4fqGW+w5BDQScVP1hfS7qdB/JSd3U1ufdh6ptgGMeVRJzYM1r0Qw2D; 25:b4f/o081toLUWDpi24dXRLvnLoK0406MunLy6pM7/DlHocMjS3iL9FNRozpGy3ft4/3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NO+afPwShXotRUjrYQvPnOh0kiu; 4:JwlPtpceNkifMAfaehB/p17i18d8Ui5oKkFZJrO8FArhgqg24N+jMZ7JCxqVnspYf9y94M8UzDoUB9qaNWLJtzalj7kCvsJbIu7KoFAD872nxXrkUcokVK8SW+PvnuVp8mIzpa3bp8oEYW2v+3niggoD2ujBdj21YmE/V/GQKIBo7ARIUdhWfo2SQhmQ7ZUW/wO9Un846xMxdAfiJ1eiWOqSqKn80zquDiLyoZKG0MprDVl1UGlRNE35NEdAHZ5qdYLPZ5ApCux5cpgyJrLTuI/Iyu7qJ6lfRk/ykpa1itbe4tcSPx7mL1c3MFQ1obcV X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3231023)(2400081)(944501161)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041288)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011); SRVR:DB6PR0402MB2840; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0402MB2840; X-Forefront-PRVS: 0563F2E8B7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(396003)(39860400002)(39380400002)(346002)(376002)(189003)(199004)(25786009)(305945005)(7416002)(4326008)(7736002)(39060400002)(15650500001)(36756003)(106356001)(97736004)(68736007)(8936002)(8676002)(50226002)(81166006)(81156014)(316002)(52116002)(3846002)(105586002)(2906002)(386003)(6506007)(59450400001)(76176011)(6116002)(51416003)(16586007)(16526018)(186003)(66066001)(26005)(47776003)(50466002)(6512007)(5660300001)(53936002)(478600001)(48376002)(6666003)(2950100002)(6486002)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0402MB2840; H:idcbfarm.ap.freescale.net; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0402MB2840; 23:2N8yxb4+tDx/OrTs3UMNQ+wD0a47ihhxY9bKB4i?= =?us-ascii?Q?OYzHlyed7ItTHtdxM723g4cCu0k8OkLqadw7zNLStDCy2d7gtKvSF2okICNK?= =?us-ascii?Q?lzCAIYZLQqoO+NjKqxcokfGTgQ2MsBRZ3xt2zHEVzyUlMYlGWr6lxwoW789H?= =?us-ascii?Q?83xcXf2dnqmObPqu84fPpl9tT26sukW33rHzqETIPUQG0BTd1FmK0edEQL6Z?= =?us-ascii?Q?NhW9Qg7Fls9OBd52sSxLlKnOf7Dex/E/P13f+9/XL+nGWkpWhqabvvnI/LGP?= =?us-ascii?Q?MULjtOsTCrD55HA82wQl/4rhCaJKTHhZUXBIptqA6yaYOVN57cBQ5xFXpKfH?= =?us-ascii?Q?PHgXu8pKQQX9MTRhpDkYzCg8nTAPDW7Cyg7OLlJdaqMz09fQhWX1HJInpZrk?= =?us-ascii?Q?BDkJevcultnkrAoT8XzrIvc0hPO+uh+hRdKgeLmRKUCoJCGFOHL0buGfl5kG?= =?us-ascii?Q?I+hYfelHG6NZcERgMPdZT57YQSJa8Vm3b+THxztbLA0nyJylrYp7OP1lqvjW?= =?us-ascii?Q?0dn05L29MFrPbG5pjCovIpm8lXjXSEdjB6QI1c5rcy2kP0JDGcBeCfsnb2Y0?= =?us-ascii?Q?NSr28vR87xYkxKApASZhcfXQaY2Hc0AraVhHByNm964S2rD1nRUmgkvieFb8?= =?us-ascii?Q?o5PMPIkzpCrv7cdebl8YOF3b98tutBerhTmVuKIkKLz9PiAIlFLtj+kNr7PZ?= =?us-ascii?Q?99DOfIvUTEZuemmUEQY2ntYgWu2HrxKjAmJiLIoggOU5zMcM7ST3wbvP83Ul?= =?us-ascii?Q?fOj8YE78f6+z09LsqGb73FQlLrzG3JXnybLRSWNU9SpB5gLJaAPtPYuek9yH?= =?us-ascii?Q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aE6dAi5EyEqm56NUbPcU19seAa5QUjDYXG5WNpkUDgV5cn8KhGNPFoWzvDfb47nFZ+ymypJn8McyD7U3vuGnv5Osmg=; 7:L8ToVqQEIO2tf0T1quiNe0KOGgFWrQMkzm1CQDv2It1X+e3RuQbWZpQsPAqNn3pqpqhgC25SwULGL9fmNW9qu8zf01wwWJk2FZ5a/NRLNXf9wdtAsCR0tjpErGTEU4oFy+IN/O75jn4NbHh2wunW3r4PcjyF+VWNXUOAXtM/U9zdBsgT2ARL+pbY2pt1RV4e97Fh+bx0NZZap/ShOse6ddlkSAdWNEPipF7lNKh3apGC6mJSwnrUVtbZLGcBqE05 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2018 07:23:10.0769 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f490d131-03d1-46a1-8546-08d563c47f51 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0402MB2840 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@free-electrons.com, Yogesh Gaur , prabhakar.kushwaha@nxp.com, suresh.gupta@nxp.com, cyrille.pitchen@wedev4u.fr, han.xu@nxp.com, computersforpeace@gmail.com, festevam@gmail.com, linux-arm-kernel@lists.infradead.org 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 FSL QuadSPI controller supports Single, dual, quad modes of operation. Mode information is available via "spi-tx-bus-width" and "spi-rx-bus-width" nodes of device tree. Update read hwcap capability by reading "spi-rx-bus-width". Update write hwcap capability by reading "spi-tx-bus-width". If value not provided in device tree file, then fallback to default mode i.e. SNOR_HWCAPS_READ_1_1_4 and SNOR_HWCAPS_PP. Signed-off-by: Prabhakar Kushwaha Signed-off-by: Yogesh Gaur --- drivers/mtd/spi-nor/fsl-quadspi.c | 46 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c index 11389d8..ff98e5a 100644 --- a/drivers/mtd/spi-nor/fsl-quadspi.c +++ b/drivers/mtd/spi-nor/fsl-quadspi.c @@ -979,8 +979,8 @@ static void fsl_qspi_unprep(struct spi_nor *nor, enum spi_nor_ops ops) static int fsl_qspi_probe(struct platform_device *pdev) { - const struct spi_nor_hwcaps hwcaps = { - .mask = SNOR_HWCAPS_READ_1_1_4 | + struct spi_nor_hwcaps hwcaps = { + .mask = SNOR_HWCAPS_READ_FAST | SNOR_HWCAPS_PP, }; struct device_node *np = pdev->dev.of_node; @@ -989,7 +989,7 @@ static int fsl_qspi_probe(struct platform_device *pdev) struct resource *res; struct spi_nor *nor; struct mtd_info *mtd; - int ret, i = 0; + int ret, i = 0, value; q = devm_kzalloc(dev, sizeof(*q), GFP_KERNEL); if (!q) @@ -1037,6 +1037,46 @@ static int fsl_qspi_probe(struct platform_device *pdev) goto clk_failed; } + if (!of_property_read_u32(np, "spi-rx-bus-width", &value)) { + switch (value) { + case 1: + hwcaps.mask |= SNOR_HWCAPS_READ | + SNOR_HWCAPS_READ_FAST; + break; + case 2: + hwcaps.mask |= SNOR_HWCAPS_READ_1_1_2 | + SNOR_HWCAPS_READ_1_2_2; + break; + case 4: + hwcaps.mask |= SNOR_HWCAPS_READ_1_1_4 | + SNOR_HWCAPS_READ_1_4_4; + break; + default: + dev_err(dev, + "spi-rx-bus-width %d not supported\n", + value); + break; + } + } else + hwcaps.mask |= SNOR_HWCAPS_READ_1_1_4; + + if (!of_property_read_u32(np, "spi-tx-bus-width", &value)) { + switch (value) { + case 1: + hwcaps.mask |= SNOR_HWCAPS_PP; + break; + case 4: + hwcaps.mask |= SNOR_HWCAPS_PP_1_1_4 | + SNOR_HWCAPS_PP_1_4_4; + break; + default: + dev_err(dev, + "spi-tx-bus-width %d not supported\n", + value); + break; + } + } + /* find the irq */ ret = platform_get_irq(pdev, 0); if (ret < 0) {