All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
To: Varka Bhadram <varkabhadram-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Maxime Ripard
	<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
	Alessandro Zummo
	<a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	linux-arm-kernel
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	devicetree <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-sunxi <linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: [PATCH v2 1/6] rtc: sun6i: Add sun6i RTC driver
Date: Fri, 25 Jul 2014 16:13:54 +0800	[thread overview]
Message-ID: <CAGb2v67t+-++zjK11Ty7k0f1yo1dDjSsa1JTx97SzRjzUrBVdw@mail.gmail.com> (raw)
In-Reply-To: <CAGb2v6746P-9rtW3gjUS3ttkZeqW6gNbunXHiSidNag1gCmk0A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Fri, Jul 25, 2014 at 3:57 PM, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> wrote:
> On Thu, Jul 24, 2014 at 12:02 AM, Varka Bhadram <varkabhadram-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>
>> On Wednesday 23 July 2014 08:08 PM, Chen-Yu Tsai wrote:
>>>
>>> This patch introduces the driver for the RTC in the Allwinner A31 and
>>> A23 SoCs.
>>>
>>> Unlike the RTC found in A10/A20 SoCs, which was part of the timer, the
>>> RTC in A31/A23 are a separate hardware block, which also contain a few
>>> controls for the RTC block hardware (a regulator and RTC block GPIO pin
>>> latches), while also having separate interrupts for the alarms.
>>>
>>> The hardware is different enough to make a different driver for it.
>>>
>> (...)
>>
>>
>>> +Required properties:
>>> +- compatible : Should be "allwinner,sun6i-a31-rtc"
>>> +- reg: physical base address of the controller and length of memory
>>> mapped
>>> +  region.
>>> +- interrupts: IRQ line for the RTC alarm 0.
>>> +
>>
>>
>> proper indentation..
>> - compatible    : Should be "allwinner,sun6i-a31-rtc"
>>
>> - reg           : physical base address of the controller and length of
>> memory mapped
>>                   region.
>>
>> - interrupts    : IRQ line for the RTC alarm 0.
>> ....
>>
>>> +Example:
>>> +
>>
>>
>> (...)
>>
>>
>>> +
>>> +       ret = devm_request_irq(&pdev->dev, chip->irq, sun6i_rtc_alarmirq,
>>> +                       0, dev_name(&pdev->dev), chip);
>>
>>
>> should match open parenthesis...
>>
>>
>> devm_request_irq(&pdev->dev, chip->irq, sun6i_rtc_alarmirq,
>>                  0, dev_name(&pdev->dev), chip);
>
> ok.
>
>>> +       if (ret) {
>>> +               dev_err(&pdev->dev, "Could not request IRQ\n");
>>> +               return ret;
>>> +       }
>>> +
>>> +       /* clear the alarm counter value */
>>> +       writel(0, chip->base + SUN6I_ALRM_COUNTER);
>>> +
>>> +       /* disable counter alarm */
>>> +       writel(0, chip->base + SUN6I_ALRM_EN);
>>> +
>>> +       /* disable counter alarm interrupt */
>>> +       writel(0, chip->base + SUN6I_ALRM_IRQ_EN);
>>> +
>>> +       /* disable week alarm */
>>> +       writel(0, chip->base + SUN6I_ALRM1_EN);
>>> +
>>> +       /* disable week alarm interrupt */
>>> +       writel(0, chip->base + SUN6I_ALRM1_IRQ_EN);
>>> +
>>> +       /* clear counter alarm pending interrupts */
>>> +       writel(SUN6I_ALRM_IRQ_STA_CNT_IRQ_PEND, chip->base +
>>> +                       SUN6I_ALRM_IRQ_STA);
>>> +
>>> +       /* clear week alarm pending interrupts */
>>> +       writel(SUN6I_ALRM1_IRQ_STA_WEEK_IRQ_PEND, chip->base +
>>> +                       SUN6I_ALRM1_IRQ_STA);
>>> +
>>> +       /* disable alarm wakeup */
>>> +       writel(0, chip->base + SUN6I_ALARM_CONFIG);
>>> +
>>> +       chip->rtc = rtc_device_register("rtc-sun6i", &pdev->dev,
>>> +                       &sun6i_rtc_ops, THIS_MODULE);
>>
>>
>> dto....
>
> ok.
>
>>> +       if (IS_ERR(chip->rtc)) {
>>> +               dev_err(&pdev->dev, "unable to register device\n");
>>> +               return PTR_ERR(chip->rtc);
>>> +       }
>>> +
>>> +       dev_info(&pdev->dev, "RTC enabled\n");
>>> +
>>> +       return 0;
>>> +}
>>> +
>>> +static int sun6i_rtc_remove(struct platform_device *pdev)
>>> +{
>>> +       struct sun6i_rtc_dev *chip = platform_get_drvdata(pdev);
>>> +
>>> +       rtc_device_unregister(chip->rtc);
>>> +
>>> +       return 0;
>>> +}
>>> +
>>> +static const struct of_device_id sun6i_rtc_dt_ids[] = {
>>> +       { .compatible = "allwinner,sun6i-a31-rtc" },
>>> +       { /* sentinel */ },
>>> +};
>>> +MODULE_DEVICE_TABLE(of, sun6i_rtc_dt_ids);
>>> +
>>> +static struct platform_driver sun6i_rtc_driver = {
>>> +       .probe          = sun6i_rtc_probe,
>>> +       .remove         = sun6i_rtc_remove,
>>> +       .driver         = {
>>> +               .name           = "sun6i-rtc",
>>> +               .owner          = THIS_MODULE,
>>
>>
>> we can drop owner field....
>
> May I ask why this is not needed? Seems most if not all drivers
> set it.
>
> Thanks.

Never mind. I figured it out. Sorry for the noise.

>>> +               .of_match_table = sun6i_rtc_dt_ids,
>>> +       },
>>> +};
>>> +
>>> +module_platform_driver(sun6i_rtc_driver);
>>> +
>>> +MODULE_DESCRIPTION("sun6i RTC driver");
>>> +MODULE_AUTHOR("Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>");
>>> +MODULE_LICENSE("GPL");

WARNING: multiple messages have this Message-ID (diff)
From: wens@csie.org (Chen-Yu Tsai)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/6] rtc: sun6i: Add sun6i RTC driver
Date: Fri, 25 Jul 2014 16:13:54 +0800	[thread overview]
Message-ID: <CAGb2v67t+-++zjK11Ty7k0f1yo1dDjSsa1JTx97SzRjzUrBVdw@mail.gmail.com> (raw)
In-Reply-To: <CAGb2v6746P-9rtW3gjUS3ttkZeqW6gNbunXHiSidNag1gCmk0A@mail.gmail.com>

On Fri, Jul 25, 2014 at 3:57 PM, Chen-Yu Tsai <wens@csie.org> wrote:
> On Thu, Jul 24, 2014 at 12:02 AM, Varka Bhadram <varkabhadram@gmail.com> wrote:
>>
>> On Wednesday 23 July 2014 08:08 PM, Chen-Yu Tsai wrote:
>>>
>>> This patch introduces the driver for the RTC in the Allwinner A31 and
>>> A23 SoCs.
>>>
>>> Unlike the RTC found in A10/A20 SoCs, which was part of the timer, the
>>> RTC in A31/A23 are a separate hardware block, which also contain a few
>>> controls for the RTC block hardware (a regulator and RTC block GPIO pin
>>> latches), while also having separate interrupts for the alarms.
>>>
>>> The hardware is different enough to make a different driver for it.
>>>
>> (...)
>>
>>
>>> +Required properties:
>>> +- compatible : Should be "allwinner,sun6i-a31-rtc"
>>> +- reg: physical base address of the controller and length of memory
>>> mapped
>>> +  region.
>>> +- interrupts: IRQ line for the RTC alarm 0.
>>> +
>>
>>
>> proper indentation..
>> - compatible    : Should be "allwinner,sun6i-a31-rtc"
>>
>> - reg           : physical base address of the controller and length of
>> memory mapped
>>                   region.
>>
>> - interrupts    : IRQ line for the RTC alarm 0.
>> ....
>>
>>> +Example:
>>> +
>>
>>
>> (...)
>>
>>
>>> +
>>> +       ret = devm_request_irq(&pdev->dev, chip->irq, sun6i_rtc_alarmirq,
>>> +                       0, dev_name(&pdev->dev), chip);
>>
>>
>> should match open parenthesis...
>>
>>
>> devm_request_irq(&pdev->dev, chip->irq, sun6i_rtc_alarmirq,
>>                  0, dev_name(&pdev->dev), chip);
>
> ok.
>
>>> +       if (ret) {
>>> +               dev_err(&pdev->dev, "Could not request IRQ\n");
>>> +               return ret;
>>> +       }
>>> +
>>> +       /* clear the alarm counter value */
>>> +       writel(0, chip->base + SUN6I_ALRM_COUNTER);
>>> +
>>> +       /* disable counter alarm */
>>> +       writel(0, chip->base + SUN6I_ALRM_EN);
>>> +
>>> +       /* disable counter alarm interrupt */
>>> +       writel(0, chip->base + SUN6I_ALRM_IRQ_EN);
>>> +
>>> +       /* disable week alarm */
>>> +       writel(0, chip->base + SUN6I_ALRM1_EN);
>>> +
>>> +       /* disable week alarm interrupt */
>>> +       writel(0, chip->base + SUN6I_ALRM1_IRQ_EN);
>>> +
>>> +       /* clear counter alarm pending interrupts */
>>> +       writel(SUN6I_ALRM_IRQ_STA_CNT_IRQ_PEND, chip->base +
>>> +                       SUN6I_ALRM_IRQ_STA);
>>> +
>>> +       /* clear week alarm pending interrupts */
>>> +       writel(SUN6I_ALRM1_IRQ_STA_WEEK_IRQ_PEND, chip->base +
>>> +                       SUN6I_ALRM1_IRQ_STA);
>>> +
>>> +       /* disable alarm wakeup */
>>> +       writel(0, chip->base + SUN6I_ALARM_CONFIG);
>>> +
>>> +       chip->rtc = rtc_device_register("rtc-sun6i", &pdev->dev,
>>> +                       &sun6i_rtc_ops, THIS_MODULE);
>>
>>
>> dto....
>
> ok.
>
>>> +       if (IS_ERR(chip->rtc)) {
>>> +               dev_err(&pdev->dev, "unable to register device\n");
>>> +               return PTR_ERR(chip->rtc);
>>> +       }
>>> +
>>> +       dev_info(&pdev->dev, "RTC enabled\n");
>>> +
>>> +       return 0;
>>> +}
>>> +
>>> +static int sun6i_rtc_remove(struct platform_device *pdev)
>>> +{
>>> +       struct sun6i_rtc_dev *chip = platform_get_drvdata(pdev);
>>> +
>>> +       rtc_device_unregister(chip->rtc);
>>> +
>>> +       return 0;
>>> +}
>>> +
>>> +static const struct of_device_id sun6i_rtc_dt_ids[] = {
>>> +       { .compatible = "allwinner,sun6i-a31-rtc" },
>>> +       { /* sentinel */ },
>>> +};
>>> +MODULE_DEVICE_TABLE(of, sun6i_rtc_dt_ids);
>>> +
>>> +static struct platform_driver sun6i_rtc_driver = {
>>> +       .probe          = sun6i_rtc_probe,
>>> +       .remove         = sun6i_rtc_remove,
>>> +       .driver         = {
>>> +               .name           = "sun6i-rtc",
>>> +               .owner          = THIS_MODULE,
>>
>>
>> we can drop owner field....
>
> May I ask why this is not needed? Seems most if not all drivers
> set it.
>
> Thanks.

Never mind. I figured it out. Sorry for the noise.

>>> +               .of_match_table = sun6i_rtc_dt_ids,
>>> +       },
>>> +};
>>> +
>>> +module_platform_driver(sun6i_rtc_driver);
>>> +
>>> +MODULE_DESCRIPTION("sun6i RTC driver");
>>> +MODULE_AUTHOR("Chen-Yu Tsai <wens@csie.org>");
>>> +MODULE_LICENSE("GPL");

  parent reply	other threads:[~2014-07-25  8:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-23 14:38 [PATCH v2 0/6] ARM: sunxi: RTC support for A31/A23 Chen-Yu Tsai
2014-07-23 14:38 ` Chen-Yu Tsai
     [not found] ` <1406126338-15062-1-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2014-07-23 14:38   ` [PATCH v2 1/6] rtc: sun6i: Add sun6i RTC driver Chen-Yu Tsai
2014-07-23 14:38     ` Chen-Yu Tsai
     [not found]     ` <1406126338-15062-2-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2014-07-23 16:02       ` Varka Bhadram
2014-07-23 16:02         ` Varka Bhadram
     [not found]         ` <53CFDC9F.9060208-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-07-25  7:57           ` Chen-Yu Tsai
2014-07-25  7:57             ` Chen-Yu Tsai
     [not found]             ` <CAGb2v6746P-9rtW3gjUS3ttkZeqW6gNbunXHiSidNag1gCmk0A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-25  8:13               ` Chen-Yu Tsai [this message]
2014-07-25  8:13                 ` Chen-Yu Tsai
2014-07-23 14:38   ` [PATCH v2 2/6] rtc: sunxi: Depend on platforms sun4i/sun7i that actually have the rtc Chen-Yu Tsai
2014-07-23 14:38     ` Chen-Yu Tsai
2014-07-23 14:38   ` [PATCH v2 3/6] ARM: dts: sun6i: add rtc device node Chen-Yu Tsai
2014-07-23 14:38     ` Chen-Yu Tsai
2014-07-23 14:38   ` [PATCH v2 4/6] ARM: dts: sun8i: " Chen-Yu Tsai
2014-07-23 14:38     ` Chen-Yu Tsai
2014-07-23 14:38   ` [PATCH v2 5/6] ARM: sunxi: Add A31 RTC driver to sunxi_defconfig Chen-Yu Tsai
2014-07-23 14:38     ` Chen-Yu Tsai
2014-07-23 14:38   ` [PATCH v2 6/6] ARM: sunxi: Add A31 RTC driver to multi_v7_defconfig Chen-Yu Tsai
2014-07-23 14:38     ` Chen-Yu Tsai

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=CAGb2v67t+-++zjK11Ty7k0f1yo1dDjSsa1JTx97SzRjzUrBVdw@mail.gmail.com \
    --to=wens-jday2fn1rrm@public.gmane.org \
    --cc=a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=varkabhadram-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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.