Re: [PATCH 3/3] OMAP: UART: use atomic idle notifiers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Govindraj <govindraj.ti@xxxxxxxxx> writes:

> Thanks Kevin,
>
> works fine tested on 3630sdp/zoom3 board.
>
> Tested-by: Govindraj.R <govindraj.raja@xxxxxx>

Govindraj,  thanks for testing!

Kevin

>
> On Thu, Oct 21, 2010 at 5:01 AM, Kevin Hilman
> <khilman@xxxxxxxxxxxxxxxxxxx> wrote:
>> Convert UART idle management routines from custom hooks in the core
>> idle path to use new idle notifiers.
>>
>> Signed-off-by: Kevin Hilman <khilman@xxxxxxxxxxxxxxxxxxx>
>> ---
>> Âarch/arm/mach-omap2/pm24xx.c       |  Â9 +---
>> Âarch/arm/mach-omap2/pm34xx.c       |  Â8 ---
>> Âarch/arm/mach-omap2/serial.c       |  71 +++++++++++++++++++----------
>> Âarch/arm/plat-omap/include/plat/serial.h | Â Â2 -
>> Â4 files changed, 47 insertions(+), 43 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
>> index cb1b333..47644d2 100644
>> --- a/arch/arm/mach-omap2/pm24xx.c
>> +++ b/arch/arm/mach-omap2/pm24xx.c
>> @@ -40,6 +40,7 @@
>> Â#include <plat/sram.h>
>> Â#include <plat/dma.h>
>> Â#include <plat/board.h>
>> +#include <plat/common.h>
>>
>> Â#include "prm.h"
>> Â#include "prm-regbits-24xx.h"
>> @@ -120,19 +121,11 @@ static void omap2_enter_full_retention(void)
>> Â Â Â Âif (omap_irq_pending())
>> Â Â Â Â Â Â Â Âgoto no_sleep;
>>
>> - Â Â Â omap_uart_prepare_idle(0);
>> - Â Â Â omap_uart_prepare_idle(1);
>> - Â Â Â omap_uart_prepare_idle(2);
>> -
>> Â Â Â Â/* Jump to SRAM suspend code */
>> Â Â Â Âomap2_sram_suspend(sdrc_read_reg(SDRC_DLLA_CTRL),
>> Â Â Â Â Â Â Â Â Â Â Â Â Â OMAP_SDRC_REGADDR(SDRC_DLLA_CTRL),
>> Â Â Â Â Â Â Â Â Â Â Â Â Â OMAP_SDRC_REGADDR(SDRC_POWER));
>>
>> - Â Â Â omap_uart_resume_idle(2);
>> - Â Â Â omap_uart_resume_idle(1);
>> - Â Â Â omap_uart_resume_idle(0);
>> -
>> Âno_sleep:
>> Â Â Â Âif (omap2_pm_debug) {
>> Â Â Â Â Â Â Â Âunsigned long long tmp;
>> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
>> index 4674748..eaed95d 100644
>> --- a/arch/arm/mach-omap2/pm34xx.c
>> +++ b/arch/arm/mach-omap2/pm34xx.c
>> @@ -390,8 +390,6 @@ void omap_sram_idle(void)
>>
>> Â Â Â Â/* PER */
>> Â Â Â Âif (per_next_state < PWRDM_POWER_ON) {
>> - Â Â Â Â Â Â Â omap_uart_prepare_idle(2);
>> - Â Â Â Â Â Â Â omap_uart_prepare_idle(3);
>> Â Â Â Â Â Â Â Âomap2_gpio_prepare_for_idle(per_next_state);
>> Â Â Â Â Â Â Â Âif (per_next_state == PWRDM_POWER_OFF)
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âomap3_per_save_context();
>> @@ -399,8 +397,6 @@ void omap_sram_idle(void)
>>
>> Â Â Â Â/* CORE */
>> Â Â Â Âif (core_next_state < PWRDM_POWER_ON) {
>> - Â Â Â Â Â Â Â omap_uart_prepare_idle(0);
>> - Â Â Â Â Â Â Â omap_uart_prepare_idle(1);
>> Â Â Â Â Â Â Â Âif (core_next_state == PWRDM_POWER_OFF) {
>> Â Â Â Â Â Â Â Â Â Â Â Âomap3_core_save_context();
>> Â Â Â Â Â Â Â Â Â Â Â Âomap3_prcm_save_context();
>> @@ -445,8 +441,6 @@ void omap_sram_idle(void)
>> Â Â Â Â Â Â Â Â Â Â Â Âomap3_sram_restore_context();
>> Â Â Â Â Â Â Â Â Â Â Â Âomap2_sms_restore_context();
>> Â Â Â Â Â Â Â Â}
>> - Â Â Â Â Â Â Â omap_uart_resume_idle(0);
>> - Â Â Â Â Â Â Â omap_uart_resume_idle(1);
>> Â Â Â Â Â Â Â Âif (core_next_state == PWRDM_POWER_OFF)
>> Â Â Â Â Â Â Â Â Â Â Â Âprm_clear_mod_reg_bits(OMAP3430_AUTO_OFF_MASK,
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â OMAP3430_GR_MOD,
>> @@ -459,8 +453,6 @@ void omap_sram_idle(void)
>> Â Â Â Â Â Â Â Âomap2_gpio_resume_after_idle();
>> Â Â Â Â Â Â Â Âif (per_prev_state == PWRDM_POWER_OFF)
>> Â Â Â Â Â Â Â Â Â Â Â Âomap3_per_restore_context();
>> - Â Â Â Â Â Â Â omap_uart_resume_idle(2);
>> - Â Â Â Â Â Â Â omap_uart_resume_idle(3);
>> Â Â Â Â}
>>
>> Â Â Â Â/* Disable IO-PAD and IO-CHAIN wakeup */
>> diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
>> index becf0e3..8a619ff 100644
>> --- a/arch/arm/mach-omap2/serial.c
>> +++ b/arch/arm/mach-omap2/serial.c
>> @@ -73,6 +73,7 @@ struct omap_uart_state {
>> Â Â Â Âu32 padconf;
>> Â Â Â Âu32 dma_enabled;
>>
>> + Â Â Â struct powerdomain *pwrdm;
>> Â Â Â Âstruct clk *ick;
>> Â Â Â Âstruct clk *fck;
>> Â Â Â Âint clocked;
>> @@ -389,39 +390,31 @@ static void omap_uart_idle_timer(unsigned long data)
>> Â Â Â Âomap_uart_allow_sleep(uart);
>> Â}
>>
>> -void omap_uart_prepare_idle(int num)
>> +static void omap_uart_prepare_idle(struct omap_uart_state *uart)
>> Â{
>> - Â Â Â struct omap_uart_state *uart;
>> -
>> - Â Â Â list_for_each_entry(uart, &uart_list, node) {
>> - Â Â Â Â Â Â Â if (num == uart->num && uart->can_sleep) {
>> - Â Â Â Â Â Â Â Â Â Â Â omap_uart_disable_clocks(uart);
>> - Â Â Â Â Â Â Â Â Â Â Â return;
>> - Â Â Â Â Â Â Â }
>> - Â Â Â }
>> + Â Â Â if (uart->can_sleep &&
>> + Â Â Â Â Â pwrdm_read_next_pwrst(uart->pwrdm) < PWRDM_POWER_ON)
>> + Â Â Â Â Â Â Â omap_uart_disable_clocks(uart);
>> Â}
>>
>> -void omap_uart_resume_idle(int num)
>> +static void omap_uart_resume_idle(struct omap_uart_state *uart)
>> Â{
>> - Â Â Â struct omap_uart_state *uart;
>> + Â Â Â if (uart->can_sleep &&
>> + Â Â Â Â Â pwrdm_read_next_pwrst(uart->pwrdm) < PWRDM_POWER_ON) {
>> + Â Â Â Â Â Â Â omap_uart_enable_clocks(uart);
>>
>> - Â Â Â list_for_each_entry(uart, &uart_list, node) {
>> - Â Â Â Â Â Â Â if (num == uart->num) {
>> - Â Â Â Â Â Â Â Â Â Â Â omap_uart_enable_clocks(uart);
>> -
>> - Â Â Â Â Â Â Â Â Â Â Â /* Check for IO pad wakeup */
>> - Â Â Â Â Â Â Â Â Â Â Â if (cpu_is_omap34xx() && uart->padconf) {
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â u16 p = omap_ctrl_readw(uart->padconf);
>> -
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â if (p & OMAP3_PADCONF_WAKEUPEVENT0)
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â omap_uart_block_sleep(uart);
>> - Â Â Â Â Â Â Â Â Â Â Â }
>> + Â Â Â Â Â Â Â /* Check for IO pad wakeup */
>> + Â Â Â Â Â Â Â if (cpu_is_omap34xx() && uart->padconf) {
>> + Â Â Â Â Â Â Â Â Â Â Â u16 p = omap_ctrl_readw(uart->padconf);
>>
>> - Â Â Â Â Â Â Â Â Â Â Â /* Check for normal UART wakeup */
>> - Â Â Â Â Â Â Â Â Â Â Â if (__raw_readl(uart->wk_st) & uart->wk_mask)
>> + Â Â Â Â Â Â Â Â Â Â Â if (p & OMAP3_PADCONF_WAKEUPEVENT0)
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âomap_uart_block_sleep(uart);
>> - Â Â Â Â Â Â Â Â Â Â Â return;
>> Â Â Â Â Â Â Â Â}
>> +
>> + Â Â Â Â Â Â Â /* Check for normal UART wakeup */
>> + Â Â Â Â Â Â Â if (__raw_readl(uart->wk_st) & uart->wk_mask)
>> + Â Â Â Â Â Â Â Â Â Â Â omap_uart_block_sleep(uart);
>> + Â Â Â Â Â Â Â return;
>> Â Â Â Â}
>> Â}
>>
>> @@ -474,6 +467,27 @@ static irqreturn_t omap_uart_interrupt(int irq, void *dev_id)
>> Â Â Â Âreturn IRQ_NONE;
>> Â}
>>
>> +static int omap_uart_idle_notifier(struct notifier_block *n,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âunsigned long val,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âvoid *p)
>> +{
>> + Â Â Â struct omap_uart_state *uart;
>> +
>> + Â Â Â if (val == OMAP_IDLE_START)
>> + Â Â Â Â Â Â Â list_for_each_entry(uart, &uart_list, node)
>> + Â Â Â Â Â Â Â Â Â Â Â omap_uart_prepare_idle(uart);
>> + Â Â Â else
>> + Â Â Â Â Â Â Â list_for_each_entry(uart, &uart_list, node)
>> + Â Â Â Â Â Â Â Â Â Â Â omap_uart_resume_idle(uart);
>> +
>> + Â Â Â return 0;
>> +}
>> +
>> +static bool omap_uart_notifier_enabled;
>> +static struct notifier_block omap_uart_notifier = {
>> + Â Â Â .notifier_call = omap_uart_idle_notifier,
>> +};
>> +
>> Âstatic void omap_uart_idle_init(struct omap_uart_state *uart)
>> Â{
>> Â Â Â Âint ret;
>> @@ -549,6 +563,11 @@ static void omap_uart_idle_init(struct omap_uart_state *uart)
>> Â Â Â Âret = request_threaded_irq(uart->irq, NULL, omap_uart_interrupt,
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â IRQF_SHARED, "serial idle", (void *)uart);
>> Â Â Â ÂWARN_ON(ret);
>> +
>> + Â Â Â if (!omap_uart_notifier_enabled) {
>> + Â Â Â Â Â Â Â omap_idle_notifier_register(&omap_uart_notifier);
>> + Â Â Â Â Â Â Â omap_uart_notifier_enabled = true;
>> + Â Â Â }
>> Â}
>>
>> Âvoid omap_uart_enable_irqs(int enable)
>> @@ -731,6 +750,8 @@ void __init omap_serial_init_port(int port)
>> Â Â Â Â Â Â Â Â Â Â Â Âbreak;
>>
>> Â Â Â Âoh = uart->oh;
>> + Â Â Â uart->pwrdm = omap_hwmod_get_pwrdm(oh);
>> + Â Â Â WARN_ON(!uart->pwrdm);
>> Â Â Â Âuart->dma_enabled = 0;
>> Â#ifndef CONFIG_SERIAL_OMAP
>> Â Â Â Âname = "serial8250";
>> diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h
>> index 19145f5..d3ee47b 100644
>> --- a/arch/arm/plat-omap/include/plat/serial.h
>> +++ b/arch/arm/plat-omap/include/plat/serial.h
>> @@ -99,8 +99,6 @@ extern void omap_serial_init_port(int port);
>> Âextern int omap_uart_can_sleep(void);
>> Âextern void omap_uart_check_wakeup(void);
>> Âextern void omap_uart_prepare_suspend(void);
>> -extern void omap_uart_prepare_idle(int num);
>> -extern void omap_uart_resume_idle(int num);
>> Âextern void omap_uart_enable_irqs(int enable);
>> Â#endif
>>
>> --
>> 1.7.2.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html
>>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux