From patchwork Mon Apr 28 03:53:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Shijie X-Patchwork-Id: 4075111 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B16109F169 for ; Mon, 28 Apr 2014 05:07:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C31642020A for ; Mon, 28 Apr 2014 05:07:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CF6BA20204 for ; Mon, 28 Apr 2014 05:07:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752992AbaD1FHm (ORCPT ); Mon, 28 Apr 2014 01:07:42 -0400 Received: from mail-bn1blp0187.outbound.protection.outlook.com ([207.46.163.187]:1711 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751964AbaD1FHl (ORCPT ); Mon, 28 Apr 2014 01:07:41 -0400 Received: from CH1PR03CA002.namprd03.prod.outlook.com (10.255.156.147) by BL2PR03MB419.namprd03.prod.outlook.com (10.141.92.18) with Microsoft SMTP Server (TLS) id 15.0.929.12; Mon, 28 Apr 2014 04:52:09 +0000 Received: from BL2FFO11FD041.protection.gbl (10.255.156.132) by CH1PR03CA002.outlook.office365.com (10.255.156.147) with Microsoft SMTP Server (TLS) id 15.0.929.12 via Frontend Transport; Mon, 28 Apr 2014 04:52:09 +0000 Received: from az84smr01.freescale.net (192.88.158.246) by BL2FFO11FD041.mail.protection.outlook.com (10.173.161.137) with Microsoft SMTP Server (TLS) id 15.0.929.8 via Frontend Transport; Mon, 28 Apr 2014 04:52:09 +0000 Received: from shlinux2.ap.freescale.net (shlinux2.ap.freescale.net [10.192.224.44]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s3S4pr3W009014; Sun, 27 Apr 2014 21:52:05 -0700 From: Huang Shijie To: CC: , , , , , , , Huang Shijie Subject: [PATCH v2 02/10] mtd: spi-nor: add a new field for spi_nor{} Date: Mon, 28 Apr 2014 11:53:39 +0800 Message-ID: <1398657227-20721-3-git-send-email-b32955@freescale.com> X-Mailer: git-send-email 1.7.2.rc3 In-Reply-To: <1398657227-20721-1-git-send-email-b32955@freescale.com> References: <1398657227-20721-1-git-send-email-b32955@freescale.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.246; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009001)(6009001)(428001)(189002)(199002)(76176999)(62966002)(87936001)(77096999)(31966008)(74662001)(74502001)(50466002)(36756003)(48376002)(99396002)(81542001)(81342001)(87286001)(77982001)(50226001)(88136002)(89996001)(4396001)(93916002)(92726001)(83072002)(85852003)(92566001)(6806004)(76482001)(79102001)(20776003)(47776003)(33646001)(44976005)(19580395003)(19580405001)(83322001)(77156001)(80022001)(46102001)(80976001)(42262001); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2PR03MB419; H:az84smr01.freescale.net; FPR:BC476FD5.2C2A5514.2DC32FBE.C0F8DF02.202BB; MLV:sfv; PTR:gate-az5.freescale.com; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Forefront-PRVS: 01952C6E96 Received-SPF: None (: freescale.com does not designate permitted sender hosts) X-OriginatorOrg: freescale.com Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We need the SPI NOR child node to store some specific features, such as the dummy cycles for the DDR Quad read. But now, we only have the @dev field in the spi_nor{}. The @dev may points to a spi_device{} for m25p80, while it may points to a platform_deivice{} for the SPI NOR controller, such as fsl_quadspi.c. It is not convenient for us to get come information from the SPI NOR flash. This patch adds a new field @np to spi_nor{}, it points to the child node for the SPI NOR flash. Signed-off-by: Huang Shijie --- drivers/mtd/devices/m25p80.c | 1 + drivers/mtd/spi-nor/spi-nor.c | 2 +- include/linux/mtd/spi-nor.h | 3 +++ 3 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 3a1d9e0..f996c3a 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -215,6 +215,7 @@ static int m25p_probe(struct spi_device *spi) nor->read_reg = m25p80_read_reg; nor->dev = &spi->dev; + nor->np = spi->dev.of_node; nor->mtd = &flash->mtd; nor->priv = flash; diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index 1a12f81..f374e44 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -891,7 +891,7 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, struct flash_platform_data *data; struct device *dev = nor->dev; struct mtd_info *mtd = nor->mtd; - struct device_node *np = dev->of_node; + struct device_node *np = nor->np; int ret; int i; diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index 5324184..48fe9fc 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h @@ -117,6 +117,8 @@ enum spi_nor_ops { * @mtd: point to a mtd_info structure * @lock: the lock for the read/write/erase/lock/unlock operations * @dev: point to a spi device, or a spi nor controller device. + * @np: If exit, it points to a device_node which stands for the + * SPI NOR flash child node. * @page_size: the page size of the SPI NOR * @addr_width: number of address bytes * @erase_opcode: the opcode for erasing a sector @@ -148,6 +150,7 @@ struct spi_nor { struct mtd_info *mtd; struct mutex lock; struct device *dev; + struct device_node *np; u32 page_size; u8 addr_width; u8 erase_opcode;