All of lore.kernel.org
 help / color / mirror / Atom feed
From: boris.brezillon@free-electrons.com (Boris Brezillon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 1/2] memory: add Atmel EBI (External Bus Interface) driver
Date: Thu, 28 Apr 2016 10:57:50 +0200	[thread overview]
Message-ID: <20160428105750.01a32818@bbrezillon> (raw)
In-Reply-To: <CACh+v5MM68U64PQYKBzaKZehfEs7qNNH3XYXm0HyO=Lwy=KAkg@mail.gmail.com>

On Thu, 28 Apr 2016 10:47:24 +0200
Jean-Jacques Hiblot <jjhiblot@traphandler.com> wrote:

> > +static int at91_ebi_probe(struct platform_device *pdev)
> > +{
> > +       const struct of_device_id *match;
> > +       struct device_node *child;
> > +       struct at91_ebi *ebi;
> > +       struct clk *clk;
> > +       int ret;
> > +
> > +       match = of_match_device(at91_ebi_id_table, &pdev->dev);
> > +       if (!match || !match->data)
> > +               return -EINVAL;
> > +
> > +       ebi = devm_kzalloc(&pdev->dev, sizeof(*ebi), GFP_KERNEL);
> > +       if (!ebi)
> > +               return -ENOMEM;
> > +
> > +       ebi->caps = match->data;
> > +       ebi->dev = &pdev->dev;
> > +
> > +       clk = devm_clk_get(&pdev->dev, NULL);
> > +       if (IS_ERR(clk))
> > +               return PTR_ERR(clk);
> > +
> > +       ebi->clk = clk;
> > +
> > +       ebi->smc = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
> > +                                                  "atmel,smc");
> > +       if (IS_ERR(ebi->smc))
> > +               return PTR_ERR(ebi->smc);
> > +
> > +       /*
> > +        * The sama5d3 does not provide an EBICSA register and thus does need
> > +        * to access the matrix registers.
> > +        */
> > +       if (ebi->caps->ebi_csa) {
> > +               ebi->matrix =
> > +                       syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
> > +                                                       "atmel,matrix");
> > +               if (IS_ERR(ebi->matrix))
> > +                       return PTR_ERR(ebi->matrix);
> > +
> > +               ebi->ebi_csa = regmap_field_alloc(ebi->matrix,
> > +                                                 *ebi->caps->ebi_csa);
> > +               if (IS_ERR(ebi->ebi_csa))
> > +                       return PTR_ERR(ebi->ebi_csa);
> > +       }
> > +
> > +       ret = ebi->caps->init(ebi);
> > +       if (ret)
> > +               return ret;
> > +
> > +       for_each_child_of_node(pdev->dev.of_node, child) {
> > +               ret = at91_ebi_dev_setup(ebi, child);
> > +               if (ret)
> > +                       return ret;  
> 
> I'm not sure about breaking out of the loop here, if
> at91_ebi_dev_setup() for a device fail then the remaining devices
> won't be probed. If you add a bad config for a fpga on CS1, you can
> prevent your NAND  on CS2 to be probed.

Fair enough, I'll continue iterating even if an error occurs.


-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>,
	Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	devicetree <devicetree@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH v6 1/2] memory: add Atmel EBI (External Bus Interface) driver
Date: Thu, 28 Apr 2016 10:57:50 +0200	[thread overview]
Message-ID: <20160428105750.01a32818@bbrezillon> (raw)
In-Reply-To: <CACh+v5MM68U64PQYKBzaKZehfEs7qNNH3XYXm0HyO=Lwy=KAkg@mail.gmail.com>

On Thu, 28 Apr 2016 10:47:24 +0200
Jean-Jacques Hiblot <jjhiblot@traphandler.com> wrote:

> > +static int at91_ebi_probe(struct platform_device *pdev)
> > +{
> > +       const struct of_device_id *match;
> > +       struct device_node *child;
> > +       struct at91_ebi *ebi;
> > +       struct clk *clk;
> > +       int ret;
> > +
> > +       match = of_match_device(at91_ebi_id_table, &pdev->dev);
> > +       if (!match || !match->data)
> > +               return -EINVAL;
> > +
> > +       ebi = devm_kzalloc(&pdev->dev, sizeof(*ebi), GFP_KERNEL);
> > +       if (!ebi)
> > +               return -ENOMEM;
> > +
> > +       ebi->caps = match->data;
> > +       ebi->dev = &pdev->dev;
> > +
> > +       clk = devm_clk_get(&pdev->dev, NULL);
> > +       if (IS_ERR(clk))
> > +               return PTR_ERR(clk);
> > +
> > +       ebi->clk = clk;
> > +
> > +       ebi->smc = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
> > +                                                  "atmel,smc");
> > +       if (IS_ERR(ebi->smc))
> > +               return PTR_ERR(ebi->smc);
> > +
> > +       /*
> > +        * The sama5d3 does not provide an EBICSA register and thus does need
> > +        * to access the matrix registers.
> > +        */
> > +       if (ebi->caps->ebi_csa) {
> > +               ebi->matrix =
> > +                       syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
> > +                                                       "atmel,matrix");
> > +               if (IS_ERR(ebi->matrix))
> > +                       return PTR_ERR(ebi->matrix);
> > +
> > +               ebi->ebi_csa = regmap_field_alloc(ebi->matrix,
> > +                                                 *ebi->caps->ebi_csa);
> > +               if (IS_ERR(ebi->ebi_csa))
> > +                       return PTR_ERR(ebi->ebi_csa);
> > +       }
> > +
> > +       ret = ebi->caps->init(ebi);
> > +       if (ret)
> > +               return ret;
> > +
> > +       for_each_child_of_node(pdev->dev.of_node, child) {
> > +               ret = at91_ebi_dev_setup(ebi, child);
> > +               if (ret)
> > +                       return ret;  
> 
> I'm not sure about breaking out of the loop here, if
> at91_ebi_dev_setup() for a device fail then the remaining devices
> won't be probed. If you add a bad config for a fpga on CS1, you can
> prevent your NAND  on CS2 to be probed.

Fair enough, I'll continue iterating even if an error occurs.


-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2016-04-28  8:57 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-27 14:35 [PATCH v6 0/2] memory: add Atmel EBI (External Bus Interface) driver Boris Brezillon
2016-04-27 14:35 ` Boris Brezillon
2016-04-27 14:35 ` [PATCH v6 1/2] " Boris Brezillon
2016-04-27 14:35   ` Boris Brezillon
2016-04-27 14:35   ` Boris Brezillon
2016-04-28  8:47   ` Jean-Jacques Hiblot
2016-04-28  8:47     ` Jean-Jacques Hiblot
2016-04-28  8:47     ` Jean-Jacques Hiblot
2016-04-28  8:57     ` Boris Brezillon [this message]
2016-04-28  8:57       ` Boris Brezillon
2016-04-27 14:35 ` [PATCH v6 2/2] memory: atmel-ebi: add DT bindings documentation Boris Brezillon
2016-04-27 14:35   ` Boris Brezillon
2016-04-27 15:07   ` Mark Rutland
2016-04-27 15:07     ` Mark Rutland
2016-04-27 15:07     ` Mark Rutland
2016-04-27 15:37     ` Boris Brezillon
2016-04-27 15:37       ` Boris Brezillon
2016-04-28  6:44     ` Boris Brezillon
2016-04-28  6:44       ` Boris Brezillon
2016-04-28  6:44       ` Boris Brezillon
2016-04-28  9:29       ` Mark Rutland
2016-04-28  9:29         ` Mark Rutland
2016-04-28  9:29         ` Mark Rutland
2016-04-28  8:32   ` Jean-Jacques Hiblot
2016-04-28  8:32     ` Jean-Jacques Hiblot
2016-04-28  8:32     ` Jean-Jacques Hiblot
2016-04-28  8:49     ` Boris Brezillon
2016-04-28  8:49       ` Boris Brezillon
2016-04-28  8:49       ` Boris Brezillon
2016-04-28 12:18       ` Jean-Jacques Hiblot
2016-04-28 12:18         ` Jean-Jacques Hiblot
2016-04-28 12:18         ` Jean-Jacques Hiblot
2016-04-28 12:46         ` Boris Brezillon
2016-04-28 12:46           ` Boris Brezillon
2016-04-28 12:46           ` Boris Brezillon
2016-04-28 12:54           ` Jean-Jacques Hiblot
2016-04-28 12:54             ` Jean-Jacques Hiblot
2016-04-28 12:54             ` Jean-Jacques Hiblot
2016-04-28 13:17             ` Boris Brezillon
2016-04-28 13:17               ` Boris Brezillon
2016-04-28 13:17               ` Boris Brezillon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160428105750.01a32818@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.