From patchwork Fri Jan 15 07:50:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 42945 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 57192B7CB9 for ; Fri, 15 Jan 2010 18:52:55 +1100 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NVgx0-0007XJ-2u; Fri, 15 Jan 2010 07:50:34 +0000 Received: from nwd2mail11.analog.com ([137.71.25.57]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NVgwt-0007W4-WE for linux-mtd@lists.infradead.org; Fri, 15 Jan 2010 07:50:32 +0000 X-IronPort-AV: E=Sophos;i="4.49,281,1262581200"; d="scan'208";a="11584380" Received: from nwd2hubcas2.ad.analog.com ([10.64.73.30]) by nwd2mail11.analog.com with ESMTP; 15 Jan 2010 02:50:22 -0500 Received: from sdc1.sdcdesign.analog.com (10.99.22.250) by NWD2HUBCAS2.ad.analog.com (10.64.73.30) with Microsoft SMTP Server id 8.1.358.0; Fri, 15 Jan 2010 02:50:22 -0500 Received: from localhost.localdomain ([10.99.29.104]) by sdc1.sdcdesign.analog.com (8.11.7p1+Sun/8.11.7) with ESMTP id o0F7j0n25718; Fri, 15 Jan 2010 15:45:01 +0800 (CST) From: Barry Song <21cnbao@gmail.com> To: dwmw2@infradead.org Subject: [PATCH 2/2] mtd-physmap: add support users can assign the probe type in board files Date: Fri, 15 Jan 2010 15:50:14 +0800 Message-ID: <1263541814-6642-2-git-send-email-21cnbao@gmail.com> X-Mailer: git-send-email 1.5.6.3 In-Reply-To: <1263541814-6642-1-git-send-email-21cnbao@gmail.com> References: <1263541814-6642-1-git-send-email-21cnbao@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20100115_025028_097235_6DA32356 X-CRM114-Status: GOOD ( 12.06 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.2.5 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- _SUMMARY_ Cc: uclinux-dist-devel@blackfin.uclinux.org, linux-mtd@lists.infradead.org, Mike Frysinger , Barry Song <21cnbao@gmail.com> X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org There are three reasons to add this support: 1. users probably know the interface type of their flashs, then probe can be faster if they give the right type in platform data since wrong types will not be detected. 2. sometimes, detecting can cause destory to system. For example, for kernel XIP, detecting can cause NOR enter a mode instructions can not be fetched right, which will make kernel crash. 3. For a new probe which is not listed in the rom_probe_types, if users assign it in board files, physmap can still probe it. Signed-off-by: Barry Song <21cnbao@gmail.com> Signed-off-by: Mike Frysinger --- drivers/mtd/maps/physmap.c | 8 ++++++-- include/linux/mtd/physmap.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index d9603f7..3b89099 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c @@ -136,8 +136,12 @@ static int physmap_flash_probe(struct platform_device *dev) simple_map_init(&info->map[i]); probe_type = rom_probe_types; - for (; info->mtd[i] == NULL && *probe_type != NULL; probe_type++) - info->mtd[i] = do_map_probe(*probe_type, &info->map[i]); + if (physmap_data->probe_type == NULL) { + for (; info->mtd[i] == NULL && *probe_type != NULL; probe_type++) + info->mtd[i] = do_map_probe(*probe_type, &info->map[i]); + } else + info->mtd[i] = do_map_probe(physmap_data->probe_type, &info->map[i]); + if (info->mtd[i] == NULL) { dev_err(&dev->dev, "map_probe failed\n"); err = -ENXIO; diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h index 76f7cab..bcfd9f7 100644 --- a/include/linux/mtd/physmap.h +++ b/include/linux/mtd/physmap.h @@ -25,6 +25,7 @@ struct physmap_flash_data { void (*set_vpp)(struct map_info *, int); unsigned int nr_parts; unsigned int pfow_base; + char *probe_type; struct mtd_partition *parts; };