From patchwork Mon Jul 25 13:37:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 3075 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 1265E23F18 for ; Mon, 25 Jul 2011 13:31:46 +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 C7A89A184B0 for ; Mon, 25 Jul 2011 13:31:45 +0000 (UTC) Received: by qwb8 with SMTP id 8so2986554qwb.11 for ; Mon, 25 Jul 2011 06:31:45 -0700 (PDT) Received: by 10.229.25.212 with SMTP id a20mr3444566qcc.148.1311600705158; Mon, 25 Jul 2011 06:31:45 -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.217.78 with SMTP id hl14cs77132qcb; Mon, 25 Jul 2011 06:31:44 -0700 (PDT) Received: by 10.142.62.29 with SMTP id k29mr2690078wfa.253.1311600704366; Mon, 25 Jul 2011 06:31:44 -0700 (PDT) Received: from VA3EHSOBE005.bigfish.com (va3ehsobe005.messaging.microsoft.com [216.32.180.31]) by mx.google.com with ESMTPS id t14si15875768wfg.17.2011.07.25.06.31.42 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jul 2011 06:31:43 -0700 (PDT) Received-SPF: neutral (google.com: 216.32.180.31 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) client-ip=216.32.180.31; Authentication-Results: mx.google.com; spf=neutral (google.com: 216.32.180.31 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) smtp.mail=shawn.guo@linaro.org Received: from mail129-va3-R.bigfish.com (10.7.14.246) by VA3EHSOBE005.bigfish.com (10.7.40.25) with Microsoft SMTP Server id 14.1.225.22; Mon, 25 Jul 2011 13:31:41 +0000 Received: from mail129-va3 (localhost.localdomain [127.0.0.1]) by mail129-va3-R.bigfish.com (Postfix) with ESMTP id B44727302BC; Mon, 25 Jul 2011 13:31:41 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bh8275dhz2dh87h2a8h668h839h) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-FB-DOMAIN-IP-MATCH: fail Received: from mail129-va3 (localhost.localdomain [127.0.0.1]) by mail129-va3 (MessageSwitch) id 131160065893755_15930; Mon, 25 Jul 2011 13:30:58 +0000 (UTC) Received: from VA3EHSMHS017.bigfish.com (unknown [10.7.14.252]) by mail129-va3.bigfish.com (Postfix) with ESMTP id 8F479670051; Mon, 25 Jul 2011 13:30:57 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS017.bigfish.com (10.7.99.27) with Microsoft SMTP Server (TLS) id 14.1.225.22; Mon, 25 Jul 2011 13:30:46 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server id 14.1.289.8; Mon, 25 Jul 2011 08:30:30 -0500 Received: from S2100-06.ap.freescale.net (S2100-06.ap.freescale.net [10.192.242.125]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id p6PDUQfO017888; Mon, 25 Jul 2011 08:30:27 -0500 (CDT) From: Shawn Guo To: CC: , , , Shawn Guo , Grant Likely , Artem Bityutskiy Subject: [PATCH] mtd/m25p80: add device tree probe support Date: Mon, 25 Jul 2011 21:37:43 +0800 Message-ID: <1311601063-16581-1-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.4.1 MIME-Version: 1.0 X-OriginatorOrg: sigmatel.com It adds device tree probe support for m25p80 driver. Signed-off-by: Shawn Guo Cc: Grant Likely Cc: Artem Bityutskiy Acked-by: Grant Likely --- Documentation/devicetree/bindings/mtd/st-m25p.txt | 14 ++++++++++++++ drivers/mtd/devices/m25p80.c | 12 ++++++++++++ 2 files changed, 26 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/st-m25p.txt diff --git a/Documentation/devicetree/bindings/mtd/st-m25p.txt b/Documentation/devicetree/bindings/mtd/st-m25p.txt new file mode 100644 index 0000000..a8c0485 --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/st-m25p.txt @@ -0,0 +1,14 @@ +* STMicroelectronics SPI Flash + +Required properties: +- compatible : "st,", "st,m25p". + +Examples: + +flash: m25p32@1 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "st,m25p32", "st,m25p"; + spi-max-frequency = <20000000>; + reg = <1>; +}; diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index e6ba034..d9d4101 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -767,6 +768,16 @@ static const struct spi_device_id m25p_ids[] = { }; MODULE_DEVICE_TABLE(spi, m25p_ids); +#ifdef CONFIG_OF +static const struct of_device_id m25p_dt_ids[] = { + { .compatible = "st,m25p", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, m25p_dt_ids); +#else +#define m25p_dt_ids NULL +#endif + static const struct spi_device_id *__devinit jedec_probe(struct spi_device *spi) { int tmp; @@ -986,6 +997,7 @@ static struct spi_driver m25p80_driver = { .name = "m25p80", .bus = &spi_bus_type, .owner = THIS_MODULE, + .of_match_table = m25p_dt_ids, }, .id_table = m25p_ids, .probe = m25p_probe,