All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Zhao Chenhui <chenhui.zhao@freescale.com>
Cc: netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 6/7] fsl_pmc: Add API to enable device as wakeup event source
Date: Mon, 7 Nov 2011 09:49:39 -0600	[thread overview]
Message-ID: <4EB7FE13.1000501@freescale.com> (raw)
In-Reply-To: <20111107112236.GB16470@localhost.localdomain>

On 11/07/2011 05:22 AM, Zhao Chenhui wrote:
> On Fri, Nov 04, 2011 at 04:14:25PM -0500, Scott Wood wrote:
>> On 11/04/2011 07:39 AM, Zhao Chenhui wrote:
>>> +	if (enable && !device_may_wakeup(&pdev->dev))
>>> +		return -EINVAL;
>>> +
>>> +	clk_np = of_parse_phandle(pdev->dev.of_node, "clk-handle", 0);
>>> +	if (!clk_np)
>>> +		return -EINVAL;
>>> +
>>> +	pmcdr_mask = (u32 *)of_get_property(clk_np, "fsl,pmcdr-mask", NULL);
>>> +	if (!pmcdr_mask) {
>>> +		ret = -EINVAL;
>>> +		goto out;
>>> +	}
>>> +
>>> +	/* clear to enable clock in low power mode */
>>> +	if (enable)
>>> +		clrbits32(&pmc_regs->pmcdr, *pmcdr_mask);
>>> +	else
>>> +		setbits32(&pmc_regs->pmcdr, *pmcdr_mask);
>>
>> We should probably initialize PMCDR to all bits set (or at least all
>> ones we know are valid) -- the default should be "not a wakeup source".
> 
> I think it should be initialized in u-boot.

I don't see it.  If you mean you think this should be added to U-Boot, I
disagree.  U-Boot does not use this, and we should not add gratuitous
U-Boot dependencies to Linux -- especially in cases where there are
existing U-Boots in use for relevant boards, that do not have this.

>>> +/**
>>> + * pmc_enable_lossless - enable lossless ethernet in low power mode
>>> + * @enable: True to enable event generation; false to disable
>>> + */
>>> +void pmc_enable_lossless(int enable)
>>> +{
>>> +	if (enable && has_lossless)
>>> +		setbits32(&pmc_regs->pmcsr, PMCSR_LOSSLESS);
>>> +	else
>>> +		clrbits32(&pmc_regs->pmcsr, PMCSR_LOSSLESS);
>>> +}
>>> +EXPORT_SYMBOL_GPL(pmc_enable_lossless);
>>> +#endif
>>
>> Won't we overwrite this later?
>>
>> -Scott
> 
> Do you have any idea?

Set a flag that the code that enters (deep) sleep can use.

Also, rename function to mpc85xx_pmc_set_lossless_ethernet().

-Scott

WARNING: multiple messages have this Message-ID (diff)
From: Scott Wood <scottwood@freescale.com>
To: Zhao Chenhui <chenhui.zhao@freescale.com>
Cc: <linuxppc-dev@lists.ozlabs.org>, <netdev@vger.kernel.org>,
	<leoli@freescale.com>
Subject: Re: [PATCH 6/7] fsl_pmc: Add API to enable device as wakeup event source
Date: Mon, 7 Nov 2011 09:49:39 -0600	[thread overview]
Message-ID: <4EB7FE13.1000501@freescale.com> (raw)
In-Reply-To: <20111107112236.GB16470@localhost.localdomain>

On 11/07/2011 05:22 AM, Zhao Chenhui wrote:
> On Fri, Nov 04, 2011 at 04:14:25PM -0500, Scott Wood wrote:
>> On 11/04/2011 07:39 AM, Zhao Chenhui wrote:
>>> +	if (enable && !device_may_wakeup(&pdev->dev))
>>> +		return -EINVAL;
>>> +
>>> +	clk_np = of_parse_phandle(pdev->dev.of_node, "clk-handle", 0);
>>> +	if (!clk_np)
>>> +		return -EINVAL;
>>> +
>>> +	pmcdr_mask = (u32 *)of_get_property(clk_np, "fsl,pmcdr-mask", NULL);
>>> +	if (!pmcdr_mask) {
>>> +		ret = -EINVAL;
>>> +		goto out;
>>> +	}
>>> +
>>> +	/* clear to enable clock in low power mode */
>>> +	if (enable)
>>> +		clrbits32(&pmc_regs->pmcdr, *pmcdr_mask);
>>> +	else
>>> +		setbits32(&pmc_regs->pmcdr, *pmcdr_mask);
>>
>> We should probably initialize PMCDR to all bits set (or at least all
>> ones we know are valid) -- the default should be "not a wakeup source".
> 
> I think it should be initialized in u-boot.

I don't see it.  If you mean you think this should be added to U-Boot, I
disagree.  U-Boot does not use this, and we should not add gratuitous
U-Boot dependencies to Linux -- especially in cases where there are
existing U-Boots in use for relevant boards, that do not have this.

>>> +/**
>>> + * pmc_enable_lossless - enable lossless ethernet in low power mode
>>> + * @enable: True to enable event generation; false to disable
>>> + */
>>> +void pmc_enable_lossless(int enable)
>>> +{
>>> +	if (enable && has_lossless)
>>> +		setbits32(&pmc_regs->pmcsr, PMCSR_LOSSLESS);
>>> +	else
>>> +		clrbits32(&pmc_regs->pmcsr, PMCSR_LOSSLESS);
>>> +}
>>> +EXPORT_SYMBOL_GPL(pmc_enable_lossless);
>>> +#endif
>>
>> Won't we overwrite this later?
>>
>> -Scott
> 
> Do you have any idea?

Set a flag that the code that enters (deep) sleep can use.

Also, rename function to mpc85xx_pmc_set_lossless_ethernet().

-Scott

  reply	other threads:[~2011-11-07 15:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-04 12:39 [PATCH 6/7] fsl_pmc: Add API to enable device as wakeup event source Zhao Chenhui
2011-11-04 12:39 ` Zhao Chenhui
2011-11-04 21:14 ` Scott Wood
2011-11-04 21:14   ` Scott Wood
2011-11-07 11:22   ` Zhao Chenhui
2011-11-07 11:22     ` Zhao Chenhui
2011-11-07 15:49     ` Scott Wood [this message]
2011-11-07 15:49       ` Scott Wood
2011-11-08 11:12   ` Li Yang-R58472
2011-11-08 11:12     ` Li Yang-R58472
2011-11-05  0:08 ` Tabi Timur-B04825
2011-11-05  0:08   ` Tabi Timur-B04825
2011-11-07 11:24   ` Zhao Chenhui
2011-11-07 11:24     ` Zhao Chenhui
2011-11-07 18:41   ` Scott Wood
2011-11-07 18:41     ` Scott Wood

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=4EB7FE13.1000501@freescale.com \
    --to=scottwood@freescale.com \
    --cc=chenhui.zhao@freescale.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=netdev@vger.kernel.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.