All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cousson, Benoit" <b-cousson@ti.com>
To: "Basak, Partha" <p-basak2@ti.com>
Cc: "Varadarajan, Charulatha" <charu@ti.com>,
	Kevin Hilman <khilman@deeprootsystems.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"paul@pwsan.com" <paul@pwsan.com>,
	"Nayak, Rajendra" <rnayak@ti.com>,
	khasim@ti.com
Subject: Re: [PATCH 01/13 v5] OMAP: GPIO: Modify init() in preparation for platform device implementation
Date: Tue, 10 Aug 2010 12:44:57 +0200	[thread overview]
Message-ID: <4C612DA9.7070002@ti.com> (raw)
In-Reply-To: <B85A65D85D7EB246BE421B3FB0FBB59301E80AC12E@dbde02.ent.ti.com>

On 8/10/2010 9:20 AM, Basak, Partha wrote:
>
>> From: Varadarajan, Charulatha
>> Sent: Tuesday, August 10, 2010 10:49 AM
>>
>>> From: Kevin Hilman [mailto:khilman@deeprootsystems.com]
>>> Sent: Tuesday, August 10, 2010 3:51 AM
>>>
>>> Charulatha V<charu@ti.com>  writes:
>>>
>>>> This is in prepartion for implementing GPIO as a platform device.
>>>> gpio bank's base addresses are moved from gpio.c to plat/gpio.h.
>>>>
>>>> This patch also modifies omap_gpio_init() to make use of
>>>> omap_gpio_chip_init() and omap_gpio_mod_init(). omap_gpio_mod_init()
>>> does
>>>> the module init by clearing the status register and initializing the
>>>> GPIO control register. omap_gpio_chip_init() initializes the chip
>>> request,
>>>> free, get, set and other function pointers and sets the gpio irq
>> handler.
>>>>
>>>> Signed-off-by: Charulatha V<charu@ti.com>
>>>> Signed-off-by: Basak, Partha<p-basak2@ti.com>
>>>
>>> [...]
>>>
>>>> +static void omap_gpio_mod_init(struct gpio_bank *bank, int id)
>>>> +{
>>>> +	if (cpu_class_is_omap2()) {
>>>> +		if (cpu_is_omap44xx()) {
>>>> +			__raw_writel(0xffffffff, bank->base +
>>>> +					OMAP4_GPIO_IRQSTATUSCLR0);
>>>> +			__raw_writel(0x00000000, bank->base +
>>>> +					 OMAP4_GPIO_DEBOUNCENABLE);
>>>> +			/* Initialize interface clk ungated, module enabled */
>>>> +			__raw_writel(0, bank->base + OMAP4_GPIO_CTRL);
>>>> +		} else if (cpu_is_omap34xx()) {
>>>> +			__raw_writel(0x00000000, bank->base +
>>>> +					OMAP24XX_GPIO_IRQENABLE1);
>>>> +			__raw_writel(0xffffffff, bank->base +
>>>> +					OMAP24XX_GPIO_IRQSTATUS1);
>>>> +			__raw_writel(0x00000000, bank->base +
>>>> +					OMAP24XX_GPIO_DEBOUNCE_EN);
>>>> +
>>>> +			/* Initialize interface clk ungated, module enabled */
>>>> +			__raw_writel(0, bank->base + OMAP24XX_GPIO_CTRL);
>>>> +			/* Enable autoidle for the OCP interface */
>>>> +			omap_writel(1<<  0, 0x48306814);
>>>
>>> This autoidle stuff should be removed in this series as setting this is
>>> handled by the hwmod layer.
>>
>> Okay.
>
> This code is incorrectly setting the PRCM_SYSCONFIG(0x48306814) register inside GPIO module which is incorrect. Ideally it should be moved to generic code like prcm_setup_regs() inside PM44xx.c/PM34xx.c. Having said that, the reset value of PRCM_SYSCONFIG is 0x01, so it would be safe just to remove this.

That's weird, do you know where it come from? Maybe it is re-enable 
because someone disable it at some point?
It is indeed a dirty hack, but it will be good to understand the 
rational, if any?

The code is from that commit: 5492fb1a ARM: OMAP: Add 3430 gpio support 
from Khasim Syed Mohammed (Added in Cc).

It seems to be a bad copy paste of the 2420 code (omap_writel(1<<  0, 
0x48019010)). That one is indeed changing the GPIO SYSCONFIG.


> Now, coming to setting of AutoIdle (in CM_AUTOIDLE_XXX registers), even though prcm_reg_ids are being populated, hwmod framework is not setting these anywhere, all CM_AutoIdle settings are being done one-time in side prcm_setup_regs().

In this case, Kevin was referring to the SYSCONFIG autoidle setting not 
the PRCM one. But the following point is still valid.

> Kevin, as you pointed out this needs to be done in the framework.

Yep, good point, it was indeed already suggested by the comment:

	/*
	 * Enable interface clock autoidle for all modules.
	 * Note that in the long run this should be done by clockfw
	 */

Except that doing that in hwmod make more sense now. hwmod probably 
didn't exist at that time.

Everything is in place in the hwmod prcm struct to set this setting from 
the hwmod core code.

> Can we do it as part of enabling the slave clocks? How does the following look?
>
> static int _enable_clocks(struct omap_hwmod *oh)
> {
> 	int i;
>
> 	pr_debug("omap_hwmod: %s: enabling clocks\n", oh->name);
>
> 	if (oh->_clk)
> 		clk_enable(oh->_clk);
>
> 	if (oh->slaves_cnt>  0) {
> 		for (i = 0; i<  oh->slaves_cnt; i++) {
> 			struct omap_hwmod_ocp_if *os = oh->slaves[i];
> 			struct clk *c = os->_clk;
>
> 			if (c&&  (os->flags&  OCPIF_SWSUP_IDLE))
> 				clk_enable(c);
> 			else
> 				/*TODO: Set CM_AutoIdle here*/
> 		}
> 	}
>
> 	/* The opt clocks are controlled by the device driver. */
>
> 	return 0;
> }

It should be done only once, so it is better to do that at _setup time 
instead.
Please note that this is an OMAP2&3 setting only. That bit does not 
exist anymore in OMAP4.

Regards,
Benoit

  reply	other threads:[~2010-08-10 10:45 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-06 12:34 [PATCH 00/13 v5] OMAP: GPIO: Implement GPIO in HWMOD way Charulatha V
2010-08-06 12:34 ` [PATCH 01/13 v5] OMAP: GPIO: Modify init() in preparation for platform device implementation Charulatha V
2010-08-06 12:34   ` [PATCH 02/13 v5] OMAP: GPIO: Introduce support for OMAP15xx chip GPIO init Charulatha V
2010-08-06 12:34     ` [PATCH 03/13 v5] OMAP: GPIO: Introduce support for OMAP16xx " Charulatha V
2010-08-06 12:34       ` [PATCH 04/13 v5] OMAP: GPIO: Introduce support for OMAP7xx " Charulatha V
2010-08-06 12:34         ` [PATCH 05/13 v5] OMAP: GPIO: add GPIO hwmods structures for OMAP3 Charulatha V
2010-08-06 12:34           ` [PATCH 06/13 v5] OMAP: GPIO: add GPIO hwmods structures for OMAP242X Charulatha V
2010-08-06 12:34             ` [PATCH 07/13 v5] OMAP: GPIO: add GPIO hwmods structures for OMAP243X Charulatha V
2010-08-06 12:34               ` [PATCH 08/13 v5] OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct Charulatha V
2010-08-06 12:34                 ` [PATCH 09/13 v5] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init Charulatha V
2010-08-06 12:34                   ` [PATCH 10/13 v5] OMAP: GPIO: Implement GPIO as a platform device Charulatha V
2010-08-06 12:34                     ` [PATCH 11/13 v5] OMAP: GPIO: Make gpio_context as part of gpio_bank structure Charulatha V
2010-08-06 12:34                       ` [PATCH 12/13 v5] OMAP: GPIO: Use dev_pm_ops instead of sys_dev_class Charulatha V
2010-08-06 12:34                         ` [PATCH 13/13 v5] OMAP: GPIO: Remove omap_gpio_init() Charulatha V
2010-08-09 23:00                           ` Kevin Hilman
2010-08-10  5:22                             ` Varadarajan, Charulatha
2010-08-09 21:45                         ` [PATCH 12/13 v5] OMAP: GPIO: Use dev_pm_ops instead of sys_dev_class Kevin Hilman
2010-08-10  0:21                         ` Kevin Hilman
2010-08-10 12:37                           ` Basak, Partha
2010-08-10 18:10                             ` Kevin Hilman
2010-08-12  7:49                               ` Basak, Partha
2010-08-12 14:07                                 ` Kevin Hilman
2010-08-12 12:43                           ` Basak, Partha
2010-08-09 23:06                     ` [PATCH 10/13 v5] OMAP: GPIO: Implement GPIO as a platform device Kevin Hilman
2010-08-10 11:53                       ` Basak, Partha
2010-08-10 17:59                         ` Kevin Hilman
2010-08-11  5:47                         ` Paul Walmsley
2010-08-12 12:10                           ` Basak, Partha
2010-08-23 15:46                           ` Basak, Partha
2010-08-09 23:58                   ` [PATCH 09/13 v5] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init Kevin Hilman
2010-08-10  5:56                     ` Varadarajan, Charulatha
2010-08-10  0:21                   ` Kevin Hilman
2010-08-09  3:51       ` [PATCH 03/13 v5] OMAP: GPIO: Introduce support for OMAP16xx " DebBarma, Tarun Kanti
2010-08-09 22:20   ` [PATCH 01/13 v5] OMAP: GPIO: Modify init() in preparation for platform device implementation Kevin Hilman
2010-08-10  5:18     ` Varadarajan, Charulatha
2010-08-10  7:20       ` Basak, Partha
2010-08-10 10:44         ` Cousson, Benoit [this message]
2010-08-10 11:31           ` Basak, Partha

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=4C612DA9.7070002@ti.com \
    --to=b-cousson@ti.com \
    --cc=charu@ti.com \
    --cc=khasim@ti.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=p-basak2@ti.com \
    --cc=paul@pwsan.com \
    --cc=rnayak@ti.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 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.