devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Tony Lindgren <tony@atomide.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
	devicetree@vger.kernel.org,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Robert Nelson <robertcnelson@gmail.com>,
	Peter De Schrijver <pdeschrijver@nvidia.com>,
	Samuel Ortiz <sameo@linux.intel.com>
Subject: Re: [PATCH 3/7] mfd: twl4030-power: Add generic reset configuration
Date: Tue, 20 May 2014 16:12:05 +0100	[thread overview]
Message-ID: <20140520151205.GY24991@lee--X1> (raw)
In-Reply-To: <1400031250-29542-4-git-send-email-tony@atomide.com>


> The twl4030 PMIC needs to be configured properly for things like
> warm reset and deeper idle states so the PMIC manages the regulators
> properly based on the hardware triggers from the SoC.
> 
> For example, when rebooting an OMAP3530 at 125 MHz, it hangs.
> With this patch, TWL4030 will be reset when a warm reset occures.
> This way the OMAP3530 does not hang on reboot.
> 
> Let's use this as the default when compatible = "ti,twl4030-power".
> Other more complicated configurations can be added to the driver
> based on other compatible flags.
> 
> Based on earlier patch by Matthias Brugger <matthias.bgg@gmail.com>:
> 
> http://lists.infradead.org/pipermail/linux-arm-kernel/2013-January/144165.html
> 
> And Lesly A M <leslyam@ti.com>:
> 
> https://github.com/openembedded/openembedded/blob/master/recipes/linux/linux-omap-2.6.39/mfd/0010-MFD-TWL4030-power-scripts-for-OMAP3-boards.patch
> 
> For more information about twl4030 configuration for the
> "power scripts" see:
> 
> http://www.omappedia.com/wiki/TWL4030_power_scripts

Do you really want this bumph in the commit log?

> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: Robert Nelson <robertcnelson@gmail.com>
> Cc: Peter De Schrijver <pdeschrijver@nvidia.com>
> Cc: Samuel Ortiz <sameo@linux.intel.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  .../devicetree/bindings/mfd/twl4030-power.txt      |  7 +-
>  drivers/mfd/twl4030-power.c                        | 99 +++++++++++++++++++---
>  include/linux/i2c/twl.h                            |  3 +
>  3 files changed, 95 insertions(+), 14 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/twl4030-power.txt b/Documentation/devicetree/bindings/mfd/twl4030-power.txt
> index 8e15ec3..b906116 100644
> --- a/Documentation/devicetree/bindings/mfd/twl4030-power.txt
> +++ b/Documentation/devicetree/bindings/mfd/twl4030-power.txt
> @@ -5,7 +5,12 @@ to control the power resources, including power scripts. For now, the
>  binding only supports the complete shutdown of the system after poweroff.
>  
>  Required properties:
> -- compatible : must be "ti,twl4030-power"
> +- compatible : must be one of the following
> +	"ti,twl4030-power"
> +	"ti,twl4030-power-reset"
> +
> +The use of ti,twl4030-power-reset is recommended at least on
> +3530 that needs a special configuration for warm reset to work.
>  
>  Optional properties:
>  - ti,use_poweroff: With this flag, the chip will initiates an ACTIVE-to-OFF or
> diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
> index c0e4fc3..b61b725 100644
> --- a/drivers/mfd/twl4030-power.c
> +++ b/drivers/mfd/twl4030-power.c
> @@ -29,6 +29,7 @@
>  #include <linux/i2c/twl.h>
>  #include <linux/platform_device.h>
>  #include <linux/of.h>
> +#include <linux/of_device.h>
>  
>  #include <asm/mach-types.h>
>  
> @@ -128,6 +129,30 @@ static u8 res_config_addrs[] = {
>  	[RES_MAIN_REF]	= 0x94,
>  };
>  
> +/*
> + * Usable values for .remap_sleep and .remap_off
> + * Based on table "5.3.3 Resource Operating modes"
> + */
> +enum {
> +	TWL_REMAP_OFF = 0,
> +	TWL_REMAP_SLEEP = 8,
> +	TWL_REMAP_ACTIVE = 9,
> +};
> +
> +#define TWL_RESOURCE_ON(res)						\
> +	{ MSG_SINGULAR(DEV_GRP_NULL, (res), RES_STATE_ACTIVE), 0x02 }

Was ist das? Magic, floating, fluffy numbers.

> +#define TWL_RESOURCE_OFF(res)						\
> +	{ MSG_SINGULAR(DEV_GRP_NULL, (res), RES_STATE_OFF), 0x02 }
> +#define TWL_RESOURCE_RESET(res)						\
> +	{ MSG_SINGULAR(DEV_GRP_NULL, (res), RES_STATE_WRST), 0x02 }
> +#define TWL_RESOURCE_GROUP_RESET(group, type1, type2)			\
> +	{ MSG_BROADCAST(DEV_GRP_NULL, (group), (type1), (type2),	\
> +		RES_STATE_WRST), 0x02 }
> +#define TWL_REMAP_SLEEP(res, devgrp, typ, typ2)				\
> +	{ .resource = (res), .devgroup = (devgrp),			\
> +	  .type = (typ), .type2 = (typ2),				\
> +	  .remap_off = TWL_REMAP_OFF, .remap_sleep = TWL_REMAP_SLEEP, }
> +
>  static int twl4030_write_script_byte(u8 address, u8 byte)
>  {
>  	int err;
> @@ -502,7 +527,8 @@ int twl4030_remove_script(u8 flags)
>  	return err;
>  }
>  
> -static int twl4030_power_configure_scripts(struct twl4030_power_data *pdata)
> +static int
> +twl4030_power_configure_scripts(const struct twl4030_power_data *pdata)

Is this doing anything besides some sneaky clean-up?  If not, it
might be worth mentioning that you're taking advantage of these
changes to conduct such activities.

>  {
>  	int err;
>  	int i;
> @@ -518,7 +544,8 @@ static int twl4030_power_configure_scripts(struct twl4030_power_data *pdata)
>  	return 0;
>  }
>  
> -static int twl4030_power_configure_resources(struct twl4030_power_data *pdata)
> +static int
> +twl4030_power_configure_resources(const struct twl4030_power_data *pdata)

Ditto.

>  {
>  	struct twl4030_resconfig *resconfig = pdata->resource_config;
>  	int err;
> @@ -550,7 +577,7 @@ void twl4030_power_off(void)
>  		pr_err("TWL4030 Unable to power off\n");
>  }
>  
> -static bool twl4030_power_use_poweroff(struct twl4030_power_data *pdata,
> +static bool twl4030_power_use_poweroff(const struct twl4030_power_data *pdata,
>  					struct device_node *node)

Etc.

[...]

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-05-20 15:12 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14  1:34 [PATCH v2 0/7] mfd: twl4030-power: Enable off-idle configuration when booted with device tree Tony Lindgren
2014-05-14  1:34 ` [PATCH 1/7] mfd: twl4030-power: Fix hang on reboot if sleep configuration was loaded earlier Tony Lindgren
2014-05-20 15:01   ` Lee Jones
2014-05-20 15:07     ` Tony Lindgren
2014-05-20 17:37       ` Lee Jones
2014-05-20 17:48         ` Tony Lindgren
2014-05-20 17:55           ` Lee Jones
2014-05-14  1:34 ` [PATCH 2/7] mfd: twl4030-power: Fix some defines for SW_EVENTS Tony Lindgren
2014-05-20 15:03   ` Lee Jones
2014-05-21  2:33     ` Tony Lindgren
2014-05-14  1:34 ` [PATCH 3/7] mfd: twl4030-power: Add generic reset configuration Tony Lindgren
2014-05-20 15:12   ` Lee Jones [this message]
2014-05-21  2:39     ` Tony Lindgren
2014-05-14  1:34 ` [PATCH 4/7] mfd: twl4030-power: Add recommended idle configuration Tony Lindgren
     [not found]   ` <1400031250-29542-5-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2014-05-20 15:14     ` Lee Jones
2014-05-21  2:44       ` Tony Lindgren
2014-05-14  1:34 ` [PATCH 5/7] mfd: twl4030-power: Add support for board specific configuration Tony Lindgren
2014-05-20 15:17   ` Lee Jones
2014-05-21  2:45     ` Tony Lindgren
2014-05-21  9:18       ` Lee Jones
2014-05-21 14:41         ` Tony Lindgren
2014-05-21 15:06           ` Lee Jones
2014-05-14  1:34 ` [PATCH 6/7] mfd: twl4030power: Add a configuration to turn off oscillator during off-idle Tony Lindgren
2014-05-14  1:34 ` [PATCH 7/7] ARM: dts: Enable twl4030 off-idle configuration for selected omaps Tony Lindgren
2014-05-21  9:23 ` [PATCH v2 0/7] mfd: twl4030-power: Enable off-idle configuration when booted with device tree Lee Jones
2014-05-21 14:49   ` Tony Lindgren
     [not found] ` <1400031250-29542-1-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2014-05-27 16:52   ` Lee Jones
2014-05-27 17:13     ` Tony Lindgren
2014-05-28  7:03       ` Lee Jones

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=20140520151205.GY24991@lee--X1 \
    --to=lee.jones@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=pdeschrijver@nvidia.com \
    --cc=robertcnelson@gmail.com \
    --cc=sameo@linux.intel.com \
    --cc=tony@atomide.com \
    /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).