From: Frans Klaver <fransklaver@gmail.com>
To: Bert Vermeulen <bert@biot.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
linux-mtd@lists.infradead.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] nand: Add NAND driver for Mikrotik RB4xx series boards
Date: Fri, 8 May 2015 12:14:40 +0200 [thread overview]
Message-ID: <CAH6sp9OcFXcX6vgkPPJqCE-X1_fKPOBo0Ak2g=pWiWPZuCt5Yg@mail.gmail.com> (raw)
In-Reply-To: <1431001910-4004-1-git-send-email-bert@biot.com>
On Thu, May 7, 2015 at 2:31 PM, Bert Vermeulen <bert@biot.com> wrote:
> +static int rb4xx_nand_probe(struct platform_device *pdev)
> +{
> + struct device *spi_dev;
> + struct rb4xx_nand_info *info;
> + struct rb4xx_cpld_platform_data *pdata;
> + int ret;
> +
> + /*
> + * NAND chip is behind the CPLD on SPI bus 0 CS 1. Allow this
> + * to silently fail the second time around.
> + */
> + spi_register_driver(&rb4xx_cpld_driver);
> +
> + /*
> + * Getting a handle on the SPI device above will fail the first time,
> + * but should succeed whenever that driver gets probed.
> + */
> + spi_dev = bus_find_device_by_name(&spi_bus_type, NULL, "spi0.1");
> + if (!spi_dev)
> + return -EPROBE_DEFER;
> +
> + pdata = dev_get_platdata(spi_dev);
> + if (!pdata)
> + return -ENODATA;
> +
> + info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
> + if (!info)
> + return -ENOMEM;
> +
> + info->gpio_ale = devm_gpiod_get(&pdev->dev, "NAND ALE", GPIOD_OUT_LOW);
> + if (IS_ERR(info->gpio_ale)) {
> + dev_err(&pdev->dev, "unable to request gpio NAND ALE: %ld\n",
> + PTR_ERR(info->gpio_ale));
> + return -ENOENT;
> + }
> +
> + info->gpio_cle = devm_gpiod_get(&pdev->dev, "NAND CLE", GPIOD_OUT_LOW);
> + if (IS_ERR(info->gpio_cle)) {
> + dev_err(&pdev->dev, "unable to request gpio NAND CLE: %ld\n",
> + PTR_ERR(info->gpio_cle));
> + return -ENOENT;
> + }
> +
> + info->gpio_nce = devm_gpiod_get(&pdev->dev, "NAND NCE", GPIOD_OUT_LOW);
> + if (IS_ERR(info->gpio_nce)) {
> + dev_err(&pdev->dev, "unable to request gpio NAND NCE: %ld\n",
> + PTR_ERR(info->gpio_nce));
> + return -ENOENT;
> + }
> +
> + /* Platform GPIO, has no device to manage it. */
> + info->gpio_rdy = gpiod_get(NULL, "NAND RDY", GPIOD_IN);
> + if (IS_ERR(info->gpio_rdy)) {
> + dev_err(&pdev->dev, "unable to request gpio RDY: %ld\n",
> + PTR_ERR(info->gpio_rdy));
> + return -ENOENT;
> + }
> +
> + info->spi_dev = container_of(spi_dev, struct spi_device, dev);
> +
> + info->chip.priv = info;
> + info->mtd.priv = &info->chip;
> + info->mtd.owner = THIS_MODULE;
If you should respin, could you add
info->mtd.dev.parent = &pdev->dev;
This will have a symlink to the parent device show up in sysfs. Seems
some people feel rather strongly about that.
Thanks,
Frans
next prev parent reply other threads:[~2015-05-08 10:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-07 12:31 [PATCH v2] nand: Add NAND driver for Mikrotik RB4xx series boards Bert Vermeulen
2015-05-08 10:14 ` Frans Klaver [this message]
2015-05-08 14:29 ` Bert Vermeulen
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='CAH6sp9OcFXcX6vgkPPJqCE-X1_fKPOBo0Ak2g=pWiWPZuCt5Yg@mail.gmail.com' \
--to=fransklaver@gmail.com \
--cc=bert@biot.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).