Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3492636ybi; Mon, 29 Jul 2019 07:29:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwTTnPCn2xK0yAqj/IWgq4TVjOZRYbg+k35SklPgy4rmWAJAD2Yl+qyq7gxDY5GSMh8T+Bn X-Received: by 2002:a62:1807:: with SMTP id 7mr36230430pfy.149.1564410590000; Mon, 29 Jul 2019 07:29:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564410589; cv=none; d=google.com; s=arc-20160816; b=HdYoCYNlwSdq7uUBe+w8jDLcpZVKabVWznRMyg55OtOKJCFwlGKGTdDJl0jMhVeVon KFJxlLg/kz3vwGVwdJMnHD8gnJ2oQ57oBiQu8BvcKcB+BdOSjv6hiTzLt5ilNAY/0lkC b+LnyvXDENyTGwC5UeAxqNle6kBv7c06emkY0f09xF7Zqy9YyG3i30AjAAHCXar0jOQp mMmW04B0gStr0IRm1Fm1+kUCXV1HAepiYeWglm151BwRPKVNOucDzw3rH+GOkER/jzdb mR3uqc94PnKnH/typ7okpQwdNHn/e3bCrG8S5hHyiGLEwq9ZRNdBlcXxnFGde9H23Xi2 B6ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=W0uPCNr/DsWKO1afSsH5zinjuVhA/kCF5UlBNJimAdw=; b=TEcwN5toNCcXya7ouPglwCebcQ3EaMPwkhSQS7khQP2MvWKsufPGHATGR0x23Wpayw TKxOzqRRdIC3TuGt/RTgNj0qjWRHET6w+69ty4AmjDzcHL1tJoSE/F7NDN41as3n3SCu BDJBdV+7mmSAma8gBYRfKYMO5hszdCVZdvkseF/oo78tLPXkb3HU1hWYj2MZ2/F0QqqW AVqJi4jwjw55hOFRZ0ZpbQpAEL6ItUUUSY34XnjdjPFviyyE2eCkoggZK8NBNvDbqrQW 9EiKS77YtdGZsRdPs0tCwtNEwLRMRlNof0cNDS8GgM28PP+qJuW6oWM/kDLV0XXvDJBF vVOA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l69si25955362plb.302.2019.07.29.07.29.34; Mon, 29 Jul 2019 07:29:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727254AbfG2O2X (ORCPT + 99 others); Mon, 29 Jul 2019 10:28:23 -0400 Received: from 212.199.177.27.static.012.net.il ([212.199.177.27]:40085 "EHLO herzl.nuvoton.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726478AbfG2O2X (ORCPT ); Mon, 29 Jul 2019 10:28:23 -0400 Received: from taln60.nuvoton.co.il (ntil-fw [212.199.177.25]) by herzl.nuvoton.co.il (8.13.8/8.13.8) with ESMTP id x6TEP7Fj025574; Mon, 29 Jul 2019 17:25:07 +0300 Received: by taln60.nuvoton.co.il (Postfix, from userid 10070) id 29394622F0; Mon, 29 Jul 2019 17:25:07 +0300 (IDT) From: Tomer Maimon To: broonie@kernel.org, dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, bbrezillon@kernel.org, yogeshnarayan.gaur@nxp.com, tudor.ambarus@microchip.com, gregkh@linuxfoundation.org, frieder.schrempf@exceet.de, tglx@linutronix.de Cc: linux-spi@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Tomer Maimon Subject: [RFC v1 3/3] mtd: m25p80: add get Flash size callback support Date: Mon, 29 Jul 2019 17:25:04 +0300 Message-Id: <20190729142504.188336-4-tmaimon77@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190729142504.188336-1-tmaimon77@gmail.com> References: <20190729142504.188336-1-tmaimon77@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add get Flash size function support for passing Flash size through callback use to the spi layer. Add get Flash size function support Signed-off-by: Tomer Maimon --- drivers/mtd/devices/m25p80.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index c50888670250..fd14c8c6d8d8 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -151,6 +151,15 @@ static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len, return len; } +/* Sending Flash size thourgh callback function to spi layer */ +size_t m25p80_get_flash_size(void *param) +{ + struct spi_mem *spimem = param; + struct m25p *flash = spi_mem_get_drvdata(spimem); + + return (u32)(flash->spi_nor.mtd.size >> 10) * 1024; +} + /* * board specific setup should have ensured the SPI clock used here * matches what the READ command supports, at least until this driver @@ -188,6 +197,9 @@ static int m25p_probe(struct spi_mem *spimem) spi_nor_set_flash_node(nor, spi->dev.of_node); nor->priv = flash; + spimem->callback = m25p80_get_flash_size; + spimem->callback_param = spimem; + spi_mem_set_drvdata(spimem, flash); flash->spimem = spimem; -- 2.18.0