linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: josh.wu@atmel.com (Josh Wu)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv4] mtd: nand: atmel_nand: retrieve NFC clock
Date: Fri, 12 Sep 2014 17:54:46 +0800	[thread overview]
Message-ID: <5412C2E6.8030602@atmel.com> (raw)
In-Reply-To: <1410514809-25650-1-git-send-email-alexandre.belloni@free-electrons.com>

Hi, Alexandre

On 9/12/2014 5:40 PM, Alexandre Belloni wrote:
> From: Boris BREZILLON <boris.brezillon@free-electrons.com>
>
> Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---

Thanks for the patch.
Acked-by: Josh Wu <josh.wu@atmel.com>

Best Regards,
Josh Wu

>
> Changes in v4:
>   - fix typo in the documentation
>
>   .../devicetree/bindings/mtd/atmel-nand.txt         |  2 ++
>   drivers/mtd/nand/atmel_nand.c                      | 25 ++++++++++++++++++++++
>   2 files changed, 27 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mtd/atmel-nand.txt b/Documentation/devicetree/bindings/mtd/atmel-nand.txt
> index c4728839d0c1..6edc3b616e98 100644
> --- a/Documentation/devicetree/bindings/mtd/atmel-nand.txt
> +++ b/Documentation/devicetree/bindings/mtd/atmel-nand.txt
> @@ -36,6 +36,7 @@ Optional properties:
>       - reg : should specify the address and size used for NFC command registers,
>               NFC registers and NFC Sram. NFC Sram address and size can be absent
>               if don't want to use it.
> +    - clocks: phandle to the peripheral clock
>     - Optional properties:
>       - atmel,write-by-sram: boolean to enable NFC write by sram.
>   
> @@ -98,6 +99,7 @@ nand0: nand at 40000000 {
>   		compatible = "atmel,sama5d3-nfc";
>   		#address-cells = <1>;
>   		#size-cells = <1>;
> +		clocks = <&hsmc_clk>
>   		reg = <
>   			0x70000000 0x10000000	/* NFC Command Registers */
>   			0xffffc000 0x00000070	/* NFC HSMC regs */
> diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
> index 9c5f717bda54..d1e502f8dbd0 100644
> --- a/drivers/mtd/nand/atmel_nand.c
> +++ b/drivers/mtd/nand/atmel_nand.c
> @@ -27,6 +27,7 @@
>    *
>    */
>   
> +#include <linux/clk.h>
>   #include <linux/dma-mapping.h>
>   #include <linux/slab.h>
>   #include <linux/module.h>
> @@ -96,6 +97,8 @@ struct atmel_nfc {
>   	bool			use_nfc_sram;
>   	bool			write_by_sram;
>   
> +	struct clk		*clk;
> +
>   	bool			is_initialized;
>   	struct completion	comp_ready;
>   	struct completion	comp_cmd_done;
> @@ -2248,6 +2251,7 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev)
>   {
>   	struct atmel_nfc *nfc = &nand_nfc;
>   	struct resource *nfc_cmd_regs, *nfc_hsmc_regs, *nfc_sram;
> +	int ret;
>   
>   	nfc_cmd_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>   	nfc->base_cmd_regs = devm_ioremap_resource(&pdev->dev, nfc_cmd_regs);
> @@ -2279,8 +2283,28 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev)
>   	nfc_writel(nfc->hsmc_regs, IDR, 0xffffffff);
>   	nfc_readl(nfc->hsmc_regs, SR);	/* clear the NFC_SR */
>   
> +	nfc->clk = devm_clk_get(&pdev->dev, NULL);
> +	if (!IS_ERR(nfc->clk)) {
> +		ret = clk_prepare_enable(nfc->clk);
> +		if (ret)
> +			return ret;
> +	} else {
> +		dev_warn(&pdev->dev, "NFC clock missing, update your Device Tree");
> +	}
> +
>   	nfc->is_initialized = true;
>   	dev_info(&pdev->dev, "NFC is probed.\n");
> +
> +	return 0;
> +}
> +
> +static int atmel_nand_nfc_remove(struct platform_device *pdev)
> +{
> +	struct atmel_nfc *nfc = &nand_nfc;
> +
> +	if (!IS_ERR(nfc->clk))
> +		clk_disable_unprepare(nfc->clk);
> +
>   	return 0;
>   }
>   
> @@ -2297,6 +2321,7 @@ static struct platform_driver atmel_nand_nfc_driver = {
>   		.of_match_table = of_match_ptr(atmel_nand_nfc_match),
>   	},
>   	.probe = atmel_nand_nfc_probe,
> +	.remove = atmel_nand_nfc_remove,
>   };
>   
>   static struct platform_driver atmel_nand_driver = {

  reply	other threads:[~2014-09-12  9:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-12  9:40 [PATCHv4] mtd: nand: atmel_nand: retrieve NFC clock Alexandre Belloni
2014-09-12  9:54 ` Josh Wu [this message]
2014-09-12 17:06 ` Ezequiel Garcia

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=5412C2E6.8030602@atmel.com \
    --to=josh.wu@atmel.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 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).