From patchwork Sun Jul 10 07:35:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 2637 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 54E5224259 for ; Sun, 10 Jul 2011 07:24:03 +0000 (UTC) Received: from mail-qw0-f52.google.com (mail-qw0-f52.google.com [209.85.216.52]) by fiordland.canonical.com (Postfix) with ESMTP id 17A9BA183ED for ; Sun, 10 Jul 2011 07:24:03 +0000 (UTC) Received: by qwb8 with SMTP id 8so2118945qwb.11 for ; Sun, 10 Jul 2011 00:24:02 -0700 (PDT) Received: by 10.229.2.131 with SMTP id 3mr2691573qcj.156.1310282642441; Sun, 10 Jul 2011 00:24:02 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.48.135 with SMTP id r7cs169771qcf; Sun, 10 Jul 2011 00:24:01 -0700 (PDT) Received: by 10.42.180.4 with SMTP id bs4mr3730378icb.438.1310282641007; Sun, 10 Jul 2011 00:24:01 -0700 (PDT) Received: from mail-iy0-f178.google.com (mail-iy0-f178.google.com [209.85.210.178]) by mx.google.com with ESMTPS id m7si5442988icn.27.2011.07.10.00.23.59 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 10 Jul 2011 00:23:59 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.210.178 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) client-ip=209.85.210.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.178 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) smtp.mail=shawn.guo@linaro.org Received: by iyb26 with SMTP id 26so3439481iyb.37 for ; Sun, 10 Jul 2011 00:23:59 -0700 (PDT) Received: by 10.42.152.74 with SMTP id h10mr4077706icw.484.1310282639425; Sun, 10 Jul 2011 00:23:59 -0700 (PDT) Received: from localhost.localdomain ([114.216.158.58]) by mx.google.com with ESMTPS id x4sm6231737ibm.42.2011.07.10.00.23.51 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 10 Jul 2011 00:23:57 -0700 (PDT) From: Shawn Guo To: linux-mtd@lists.infradead.org Cc: devicetree-discuss@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, patches@linaro.org, Shawn Guo , Grant Likely , David Woodhouse , Artem Bityutskiy Subject: [PATCH] mtd: dataflash: add device tree probe support Date: Sun, 10 Jul 2011 15:35:13 +0800 Message-Id: <1310283313-32087-1-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.4.1 It adds device tree probe support for mtd_dataflash driver. Signed-off-by: Shawn Guo Cc: Grant Likely Cc: David Woodhouse Cc: Artem Bityutskiy --- drivers/mtd/devices/mtd_dataflash.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c index 8f6b02c..64d7242 100644 --- a/drivers/mtd/devices/mtd_dataflash.c +++ b/drivers/mtd/devices/mtd_dataflash.c @@ -24,6 +24,8 @@ #include #include +#include +#include /* * DataFlash is a kind of SPI flash. Most AT45 chips have two buffers in @@ -98,6 +100,11 @@ struct dataflash { struct mtd_info mtd; }; +static const struct of_device_id dataflash_dt_ids[] = { + { .compatible = "atmel,dataflash", }, + { /* sentinel */ } +}; + /* ......................................................................... */ /* @@ -634,6 +641,7 @@ add_dataflash_otp(struct spi_device *spi, char *name, { struct dataflash *priv; struct mtd_info *device; + struct mtd_part_parser_data ppdata; struct flash_platform_data *pdata = spi->dev.platform_data; char *otp_tag = ""; int err = 0; @@ -675,7 +683,8 @@ add_dataflash_otp(struct spi_device *spi, char *name, pagesize, otp_tag); dev_set_drvdata(&spi->dev, priv); - err = mtd_device_parse_register(device, NULL, 0, + ppdata.of_node = spi->dev.of_node; + err = mtd_device_parse_register(device, NULL, &ppdata, pdata ? pdata->parts : NULL, pdata ? pdata->nr_parts : 0); @@ -926,6 +935,7 @@ static struct spi_driver dataflash_driver = { .name = "mtd_dataflash", .bus = &spi_bus_type, .owner = THIS_MODULE, + .of_match_table = dataflash_dt_ids, }, .probe = dataflash_probe,