[U-Boot] [PATCH v2 1/2] ftpmu010: support faraday ftpmu010 driver

Faraday's ftpmu010 is a power managemnet unit which support cpu sleep and frequency scaling. It has been integrated into many SoC.
This patch also move ftpmu010 to a proper place for later enhancement.
Signed-off-by: Macpaul Lin macpaul@andestech.com --- Note: This patch is the correct design with writing a new driver and enhanced features. Previous incorrect patch "ftpmu010: move ftpmu010 power controller to drivers/power folder" will be remove in patchwork since this is a patch moves header files without driver implementation.
Change v2: - Code cleanup
arch/arm/include/asm/arch-a320/ftpmu010.h | 146 ----------------------------- drivers/power/Makefile | 1 + drivers/power/ftpmu010.c | 65 +++++++++++++ drivers/power/ftpmu010.h | 146 +++++++++++++++++++++++++++++ 4 files changed, 212 insertions(+), 146 deletions(-) delete mode 100644 arch/arm/include/asm/arch-a320/ftpmu010.h create mode 100644 drivers/power/ftpmu010.c create mode 100644 drivers/power/ftpmu010.h
diff --git a/arch/arm/include/asm/arch-a320/ftpmu010.h b/arch/arm/include/asm/arch-a320/ftpmu010.h deleted file mode 100644 index 8ef7a37..0000000 --- a/arch/arm/include/asm/arch-a320/ftpmu010.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * (C) Copyright 2009 Faraday Technology - * Po-Yu Chuang ratbert@faraday-tech.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* - * Power Management Unit - */ -#ifndef __FTPMU010_H -#define __FTPMU010_H - -struct ftpmu010 { - unsigned int IDNMBR0; /* 0x00 */ - unsigned int reserved0; /* 0x04 */ - unsigned int OSCC; /* 0x08 */ - unsigned int PMODE; /* 0x0C */ - unsigned int PMCR; /* 0x10 */ - unsigned int PED; /* 0x14 */ - unsigned int PEDSR; /* 0x18 */ - unsigned int reserved1; /* 0x1C */ - unsigned int PMSR; /* 0x20 */ - unsigned int PGSR; /* 0x24 */ - unsigned int MFPSR; /* 0x28 */ - unsigned int MISC; /* 0x2C */ - unsigned int PDLLCR0; /* 0x30 */ - unsigned int PDLLCR1; /* 0x34 */ - unsigned int AHBMCLKOFF; /* 0x38 */ - unsigned int APBMCLKOFF; /* 0x3C */ - unsigned int DCSRCR0; /* 0x40 */ - unsigned int DCSRCR1; /* 0x44 */ - unsigned int DCSRCR2; /* 0x48 */ - unsigned int SDRAMHTC; /* 0x4C */ - unsigned int PSPR0; /* 0x50 */ - unsigned int PSPR1; /* 0x54 */ - unsigned int PSPR2; /* 0x58 */ - unsigned int PSPR3; /* 0x5C */ - unsigned int PSPR4; /* 0x60 */ - unsigned int PSPR5; /* 0x64 */ - unsigned int PSPR6; /* 0x68 */ - unsigned int PSPR7; /* 0x6C */ - unsigned int PSPR8; /* 0x70 */ - unsigned int PSPR9; /* 0x74 */ - unsigned int PSPR10; /* 0x78 */ - unsigned int PSPR11; /* 0x7C */ - unsigned int PSPR12; /* 0x80 */ - unsigned int PSPR13; /* 0x84 */ - unsigned int PSPR14; /* 0x88 */ - unsigned int PSPR15; /* 0x8C */ - unsigned int AHBDMA_RACCS; /* 0x90 */ - unsigned int reserved2; /* 0x94 */ - unsigned int reserved3; /* 0x98 */ - unsigned int JSS; /* 0x9C */ - unsigned int CFC_RACC; /* 0xA0 */ - unsigned int SSP1_RACC; /* 0xA4 */ - unsigned int UART1TX_RACC; /* 0xA8 */ - unsigned int UART1RX_RACC; /* 0xAC */ - unsigned int UART2TX_RACC; /* 0xB0 */ - unsigned int UART2RX_RACC; /* 0xB4 */ - unsigned int SDC_RACC; /* 0xB8 */ - unsigned int I2SAC97_RACC; /* 0xBC */ - unsigned int IRDATX_RACC; /* 0xC0 */ - unsigned int reserved4; /* 0xC4 */ - unsigned int USBD_RACC; /* 0xC8 */ - unsigned int IRDARX_RACC; /* 0xCC */ - unsigned int IRDA_RACC; /* 0xD0 */ - unsigned int ED0_RACC; /* 0xD4 */ - unsigned int ED1_RACC; /* 0xD8 */ -}; - -/* - * ID Number 0 Register - */ -#define FTPMU010_ID_A320A 0x03200000 -#define FTPMU010_ID_A320C 0x03200010 -#define FTPMU010_ID_A320D 0x03200030 - -/* - * OSC Control Register - */ -#define FTPMU010_OSCC_OSCH_TRI (1 << 11) -#define FTPMU010_OSCC_OSCH_STABLE (1 << 9) -#define FTPMU010_OSCC_OSCH_OFF (1 << 8) - -#define FTPMU010_OSCC_OSCL_TRI (1 << 3) -#define FTPMU010_OSCC_OSCL_RTCLSEL (1 << 2) -#define FTPMU010_OSCC_OSCL_STABLE (1 << 1) -#define FTPMU010_OSCC_OSCL_OFF (1 << 0) - -/* - * Power Mode Register - */ -#define FTPMU010_PMODE_DIVAHBCLK_MASK (0x7 << 4) -#define FTPMU010_PMODE_DIVAHBCLK_2 (0x0 << 4) -#define FTPMU010_PMODE_DIVAHBCLK_3 (0x1 << 4) -#define FTPMU010_PMODE_DIVAHBCLK_4 (0x2 << 4) -#define FTPMU010_PMODE_DIVAHBCLK_6 (0x3 << 4) -#define FTPMU010_PMODE_DIVAHBCLK_8 (0x4 << 4) -#define FTPMU010_PMODE_DIVAHBCLK(pmode) (((pmode) >> 4) & 0x7) -#define FTPMU010_PMODE_FCS (1 << 2) -#define FTPMU010_PMODE_TURBO (1 << 1) -#define FTPMU010_PMODE_SLEEP (1 << 0) - -/* - * Power Manager Status Register - */ -#define FTPMU010_PMSR_SMR (1 << 10) - -#define FTPMU010_PMSR_RDH (1 << 2) -#define FTPMU010_PMSR_PH (1 << 1) -#define FTPMU010_PMSR_CKEHLOW (1 << 0) - -/* - * Multi-Function Port Setting Register - */ -#define FTPMU010_MFPSR_MODEMPINSEL (1 << 14) -#define FTPMU010_MFPSR_AC97CLKOUTSEL (1 << 13) -#define FTPMU010_MFPSR_AC97PINSEL (1 << 3) - -/* - * PLL/DLL Control Register 0 - */ -#define FTPMU010_PDLLCR0_HCLKOUTDIS(cr0) (((cr0) >> 20) & 0xf) -#define FTPMU010_PDLLCR0_DLLFRAG (1 << 19) -#define FTPMU010_PDLLCR0_DLLSTSEL (1 << 18) -#define FTPMU010_PDLLCR0_DLLSTABLE (1 << 17) -#define FTPMU010_PDLLCR0_DLLDIS (1 << 16) -#define FTPMU010_PDLLCR0_PLL1NS(cr0) (((cr0) >> 3) & 0x1ff) -#define FTPMU010_PDLLCR0_PLL1STSEL (1 << 2) -#define FTPMU010_PDLLCR0_PLL1STABLE (1 << 1) -#define FTPMU010_PDLLCR0_PLL1DIS (1 << 0) - -#endif /* __FTPMU010_H */ diff --git a/drivers/power/Makefile b/drivers/power/Makefile index c9ba1ae..ead00f8 100644 --- a/drivers/power/Makefile +++ b/drivers/power/Makefile @@ -25,6 +25,7 @@ include $(TOPDIR)/config.mk
LIB := $(obj)libpower.o
+COBJS-$(CONFIG_FTPMU010_POWER) += ftpmu010.o COBJS-$(CONFIG_TWL4030_POWER) += twl4030.o COBJS-$(CONFIG_TWL6030_POWER) += twl6030.o
diff --git a/drivers/power/ftpmu010.c b/drivers/power/ftpmu010.c new file mode 100644 index 0000000..d4bc0f7 --- /dev/null +++ b/drivers/power/ftpmu010.c @@ -0,0 +1,65 @@ +/* + * (C) Copyright 2009 Faraday Technology + * Po-Yu Chuang ratbert@faraday-tech.com + * + * Copyright (C) 2010 Andes Technology Corporation + * Shawn Lin, Andes Technology Corporation nobuhiro@andestech.com + * Macpaul Lin, Andes Technology Corporation macpaul@andestech.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <common.h> +#include <asm/io.h> +#include "ftpmu010.h" + +static struct ftpmu010 *pmu = (struct ftpmu010 *)CONFIG_FTPMU010_BASE; + +void ftpmu010_32768osc_enable(void) +{ + unsigned int oscc; + + /* enable the 32768Hz oscillator */ + oscc = readl(&pmu->OSCC); + oscc &= ~(FTPMU010_OSCC_OSCL_OFF | FTPMU010_OSCC_OSCL_TRI); + writel(oscc, &pmu->OSCC); + + /* wait until ready */ + while (!(readl(&pmu->OSCC) & FTPMU010_OSCC_OSCL_STABLE)) + ; + + /* select 32768Hz oscillator */ + oscc = readl(&pmu->OSCC); + oscc |= FTPMU010_OSCC_OSCL_RTCLSEL; + writel(oscc, &pmu->OSCC); +} + +void ftpmu010_dlldis_disable(void) +{ + unsigned int pdllcr0; + + pdllcr0 = readl(&pmu->PDLLCR0); + pdllcr0 |= FTPMU010_PDLLCR0_DLLDIS; + writel(pdllcr0, &pmu->PDLLCR0); +} + +void ftpmu010_sdram_clk_disable(unsigned int cr0) +{ + unsigned int pdllcr0; + + pdllcr0 = readl(&pmu->PDLLCR0); + pdllcr0 |= FTPMU010_PDLLCR0_HCLKOUTDIS(cr0); + writel(pdllcr0, &pmu->PDLLCR0); +} diff --git a/drivers/power/ftpmu010.h b/drivers/power/ftpmu010.h new file mode 100644 index 0000000..8ef7a37 --- /dev/null +++ b/drivers/power/ftpmu010.h @@ -0,0 +1,146 @@ +/* + * (C) Copyright 2009 Faraday Technology + * Po-Yu Chuang ratbert@faraday-tech.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Power Management Unit + */ +#ifndef __FTPMU010_H +#define __FTPMU010_H + +struct ftpmu010 { + unsigned int IDNMBR0; /* 0x00 */ + unsigned int reserved0; /* 0x04 */ + unsigned int OSCC; /* 0x08 */ + unsigned int PMODE; /* 0x0C */ + unsigned int PMCR; /* 0x10 */ + unsigned int PED; /* 0x14 */ + unsigned int PEDSR; /* 0x18 */ + unsigned int reserved1; /* 0x1C */ + unsigned int PMSR; /* 0x20 */ + unsigned int PGSR; /* 0x24 */ + unsigned int MFPSR; /* 0x28 */ + unsigned int MISC; /* 0x2C */ + unsigned int PDLLCR0; /* 0x30 */ + unsigned int PDLLCR1; /* 0x34 */ + unsigned int AHBMCLKOFF; /* 0x38 */ + unsigned int APBMCLKOFF; /* 0x3C */ + unsigned int DCSRCR0; /* 0x40 */ + unsigned int DCSRCR1; /* 0x44 */ + unsigned int DCSRCR2; /* 0x48 */ + unsigned int SDRAMHTC; /* 0x4C */ + unsigned int PSPR0; /* 0x50 */ + unsigned int PSPR1; /* 0x54 */ + unsigned int PSPR2; /* 0x58 */ + unsigned int PSPR3; /* 0x5C */ + unsigned int PSPR4; /* 0x60 */ + unsigned int PSPR5; /* 0x64 */ + unsigned int PSPR6; /* 0x68 */ + unsigned int PSPR7; /* 0x6C */ + unsigned int PSPR8; /* 0x70 */ + unsigned int PSPR9; /* 0x74 */ + unsigned int PSPR10; /* 0x78 */ + unsigned int PSPR11; /* 0x7C */ + unsigned int PSPR12; /* 0x80 */ + unsigned int PSPR13; /* 0x84 */ + unsigned int PSPR14; /* 0x88 */ + unsigned int PSPR15; /* 0x8C */ + unsigned int AHBDMA_RACCS; /* 0x90 */ + unsigned int reserved2; /* 0x94 */ + unsigned int reserved3; /* 0x98 */ + unsigned int JSS; /* 0x9C */ + unsigned int CFC_RACC; /* 0xA0 */ + unsigned int SSP1_RACC; /* 0xA4 */ + unsigned int UART1TX_RACC; /* 0xA8 */ + unsigned int UART1RX_RACC; /* 0xAC */ + unsigned int UART2TX_RACC; /* 0xB0 */ + unsigned int UART2RX_RACC; /* 0xB4 */ + unsigned int SDC_RACC; /* 0xB8 */ + unsigned int I2SAC97_RACC; /* 0xBC */ + unsigned int IRDATX_RACC; /* 0xC0 */ + unsigned int reserved4; /* 0xC4 */ + unsigned int USBD_RACC; /* 0xC8 */ + unsigned int IRDARX_RACC; /* 0xCC */ + unsigned int IRDA_RACC; /* 0xD0 */ + unsigned int ED0_RACC; /* 0xD4 */ + unsigned int ED1_RACC; /* 0xD8 */ +}; + +/* + * ID Number 0 Register + */ +#define FTPMU010_ID_A320A 0x03200000 +#define FTPMU010_ID_A320C 0x03200010 +#define FTPMU010_ID_A320D 0x03200030 + +/* + * OSC Control Register + */ +#define FTPMU010_OSCC_OSCH_TRI (1 << 11) +#define FTPMU010_OSCC_OSCH_STABLE (1 << 9) +#define FTPMU010_OSCC_OSCH_OFF (1 << 8) + +#define FTPMU010_OSCC_OSCL_TRI (1 << 3) +#define FTPMU010_OSCC_OSCL_RTCLSEL (1 << 2) +#define FTPMU010_OSCC_OSCL_STABLE (1 << 1) +#define FTPMU010_OSCC_OSCL_OFF (1 << 0) + +/* + * Power Mode Register + */ +#define FTPMU010_PMODE_DIVAHBCLK_MASK (0x7 << 4) +#define FTPMU010_PMODE_DIVAHBCLK_2 (0x0 << 4) +#define FTPMU010_PMODE_DIVAHBCLK_3 (0x1 << 4) +#define FTPMU010_PMODE_DIVAHBCLK_4 (0x2 << 4) +#define FTPMU010_PMODE_DIVAHBCLK_6 (0x3 << 4) +#define FTPMU010_PMODE_DIVAHBCLK_8 (0x4 << 4) +#define FTPMU010_PMODE_DIVAHBCLK(pmode) (((pmode) >> 4) & 0x7) +#define FTPMU010_PMODE_FCS (1 << 2) +#define FTPMU010_PMODE_TURBO (1 << 1) +#define FTPMU010_PMODE_SLEEP (1 << 0) + +/* + * Power Manager Status Register + */ +#define FTPMU010_PMSR_SMR (1 << 10) + +#define FTPMU010_PMSR_RDH (1 << 2) +#define FTPMU010_PMSR_PH (1 << 1) +#define FTPMU010_PMSR_CKEHLOW (1 << 0) + +/* + * Multi-Function Port Setting Register + */ +#define FTPMU010_MFPSR_MODEMPINSEL (1 << 14) +#define FTPMU010_MFPSR_AC97CLKOUTSEL (1 << 13) +#define FTPMU010_MFPSR_AC97PINSEL (1 << 3) + +/* + * PLL/DLL Control Register 0 + */ +#define FTPMU010_PDLLCR0_HCLKOUTDIS(cr0) (((cr0) >> 20) & 0xf) +#define FTPMU010_PDLLCR0_DLLFRAG (1 << 19) +#define FTPMU010_PDLLCR0_DLLSTSEL (1 << 18) +#define FTPMU010_PDLLCR0_DLLSTABLE (1 << 17) +#define FTPMU010_PDLLCR0_DLLDIS (1 << 16) +#define FTPMU010_PDLLCR0_PLL1NS(cr0) (((cr0) >> 3) & 0x1ff) +#define FTPMU010_PDLLCR0_PLL1STSEL (1 << 2) +#define FTPMU010_PDLLCR0_PLL1STABLE (1 << 1) +#define FTPMU010_PDLLCR0_PLL1DIS (1 << 0) + +#endif /* __FTPMU010_H */

Replace built-in ftpmu010 related code in timer.c for shared driver support.
Signed-off-by: Macpaul Lin macpaul@andestech.com --- Change v2 - Code cleanup
arch/arm/cpu/arm920t/a320/timer.c | 22 ++-------------------- include/configs/a320evb.h | 5 +++++ 2 files changed, 7 insertions(+), 20 deletions(-)
diff --git a/arch/arm/cpu/arm920t/a320/timer.c b/arch/arm/cpu/arm920t/a320/timer.c index d2e316f..106fd7f 100644 --- a/arch/arm/cpu/arm920t/a320/timer.c +++ b/arch/arm/cpu/arm920t/a320/timer.c @@ -19,21 +19,18 @@
#include <common.h> #include <asm/io.h> -#include <asm/arch/ftpmu010.h> #include <asm/arch/fttmr010.h>
static ulong timestamp; static ulong lastdec;
static struct fttmr010 *tmr = (struct fttmr010 *)CONFIG_FTTMR010_BASE; -static struct ftpmu010 *pmu = (struct ftpmu010 *)CONFIG_FTPMU010_BASE;
#define TIMER_CLOCK 32768 #define TIMER_LOAD_VAL 0xffffffff
int timer_init(void) { - unsigned int oscc; unsigned int cr;
debug("%s()\n", __func__); @@ -41,23 +38,8 @@ int timer_init(void) /* disable timers */ writel(0, &tmr->cr);
- /* - * use 32768Hz oscillator for RTC, WDT, TIMER - */ - - /* enable the 32768Hz oscillator */ - oscc = readl(&pmu->OSCC); - oscc &= ~(FTPMU010_OSCC_OSCL_OFF | FTPMU010_OSCC_OSCL_TRI); - writel(oscc, &pmu->OSCC); - - /* wait until ready */ - while (!(readl(&pmu->OSCC) & FTPMU010_OSCC_OSCL_STABLE)) - ; - - /* select 32768Hz oscillator */ - oscc = readl(&pmu->OSCC); - oscc |= FTPMU010_OSCC_OSCL_RTCLSEL; - writel(oscc, &pmu->OSCC); + /* use 32768Hz oscillator for RTC, WDT, TIMER */ + ftpmu010_32768osc_enable();
/* setup timer */ writel(TIMER_LOAD_VAL, &tmr->timer3_load); diff --git a/include/configs/a320evb.h b/include/configs/a320evb.h index f67cf06..f169e5e 100644 --- a/include/configs/a320evb.h +++ b/include/configs/a320evb.h @@ -41,6 +41,11 @@ */ #define CONFIG_RTC_FTRTC010
+/* + * PMU + */ +#define CONFIG_FTPMU010_POWER + /*----------------------------------------------------------------------- * Serial console configuration */

Dear Macpaul Lin,
Replace built-in ftpmu010 related code in timer.c for shared driver support.
Signed-off-by: Macpaul Linmacpaul@andestech.com
static ulong timestamp; static ulong lastdec;
This is going to fail if used before relocation....
Best Regards, Reinhard

Dear Reinhard,
On Wed, Jan 5, 2011 at 5:46 PM, Reinhard Meyer u-boot@emk-elektronik.de wrote:
Dear Macpaul Lin,
Replace built-in ftpmu010 related code in timer.c for shared driver support.
Signed-off-by: Macpaul Linmacpaul@andestech.com
static ulong timestamp; static ulong lastdec;
This is going to fail if used before relocation....
There is a patch to fix that, but has not been accepted yet.
http://lists.denx.de/pipermail/u-boot/2010-December/084001.html
best regards, Po-Yu Chuang

HI Reinhard,
2011/1/5 Reinhard Meyer u-boot@emk-elektronik.de:
Dear Macpaul Lin,
Replace built-in ftpmu010 related code in timer.c for shared driver support.
Signed-off-by: Macpaul Linmacpaul@andestech.com
static ulong timestamp; static ulong lastdec;
This is going to fail if used before relocation....
I've found that [PATCH v2 1/2] arm: a320 timer: move static data to global_data struct (http://patchwork.ozlabs.org/patch/76177/) which has been hold because the relocation related work still under going.
This patch [PATCH v2 2/2] a320evb: replace built-in ftpmu010 related code was based on current master tree.
Please help on suggest how to merge or correct these patches. However, I think this patch [PATCH v2 1/2] ftpmu010: support faraday ftpmu010 driver is independent to the a320evb timer fix.
I think ftpmu010 could be review at first then we may discuss to fix the a320 related issues.
Thanks a lot.

Dear Macpaul Lin,
In message 1294218744-2535-1-git-send-email-macpaul@andestech.com you wrote:
Faraday's ftpmu010 is a power managemnet unit which support cpu sleep and frequency scaling. It has been integrated into many SoC.
This patch also move ftpmu010 to a proper place for later enhancement.
Signed-off-by: Macpaul Lin macpaul@andestech.com
Note: This patch is the correct design with writing a new driver and enhanced features. Previous incorrect patch "ftpmu010: move ftpmu010 power controller to drivers/power folder" will be remove in patchwork since this is a patch moves header files without driver implementation.
Change v2:
- Code cleanup
arch/arm/include/asm/arch-a320/ftpmu010.h | 146 ----------------------------- drivers/power/Makefile | 1 + drivers/power/ftpmu010.c | 65 +++++++++++++ drivers/power/ftpmu010.h | 146 +++++++++++++++++++++++++++++ 4 files changed, 212 insertions(+), 146 deletions(-) delete mode 100644 arch/arm/include/asm/arch-a320/ftpmu010.h create mode 100644 drivers/power/ftpmu010.c create mode 100644 drivers/power/ftpmu010.h
Applied, thanks.
Best regards,
Wolfgang Denk

Hi Macpaul,
On Wed, Jan 26, 2011 at 5:19 AM, Wolfgang Denk wd@denx.de wrote:
In message 1294218744-2535-1-git-send-email-macpaul@andestech.com you wrote:
Faraday's ftpmu010 is a power managemnet unit which support cpu sleep and frequency scaling. It has been integrated into many SoC.
This patch also move ftpmu010 to a proper place for later enhancement.
Signed-off-by: Macpaul Lin macpaul@andestech.com
Applied, thanks.
Sorry for not following this thread. I notice this today because it breaks a320.
I think maybe it will be better to move driver/power/ftpmu010.h to include/ftpmu010.h and add the API declaration in it?
I am trying to fix arch/arm/cpu/arm920t/a320/timer.c, but I cannot access the new API now.
regards, Po-Yu Chuang

Hi Po-Yu,
2011/2/16 Po-Yu Chuang ratbert.chuang@gmail.com
Hi Macpaul,
On Wed, Jan 26, 2011 at 5:19 AM, Wolfgang Denk wd@denx.de wrote:
In message 1294218744-2535-1-git-send-email-macpaul@andestech.com you
wrote:
Faraday's ftpmu010 is a power managemnet unit which support cpu
Ah, we are all waiting for the timer fix for arm then the related timer and pmu patch could be reorganized.
Sorry for not following this thread.
I notice this today because it breaks a320.
Could you please describe how does it breaks a320?
I think maybe it will be better to move driver/power/ftpmu010.h to include/ftpmu010.h and add the API declaration in it?
Does /* * PMU */ #define CONFIG_FTPMU010_POWER
Couldn't help on fix the compile problem? Or if the problem occurs in runtime?
I am trying to fix arch/arm/cpu/arm920t/a320/timer.c, but I cannot
access the new API now.
regards, Po-Yu Chuang _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

Hi Macpaul,
On Wed, Feb 16, 2011 at 3:07 PM, Macpaul Lin macpaul@gmail.com wrote:
2011/2/16 Po-Yu Chuang ratbert.chuang@gmail.com
On Wed, Jan 26, 2011 at 5:19 AM, Wolfgang Denk wd@denx.de wrote:
Faraday's ftpmu010 is a power managemnet unit which support cpu
Ah, we are all waiting for the timer fix for arm then the related timer and pmu patch could be reorganized.
Do you mean there is another pmu patch to be reviewed?
Yes, I am waiting for the arm timer fix too, but I just want it at least to be able to compile.
Sorry for not following this thread. I notice this today because it breaks a320.
Could you please describe how does it breaks a320?
No big deal. Just because the original a320 timer code uses the register definitions like your new driver. Since the header is moved from arch/arm/include/asm/arch-a320/, it fails to compile (of course).
I think maybe it will be better to move driver/power/ftpmu010.h to include/ftpmu010.h and add the API declaration in it?
Does /* * PMU */ #define CONFIG_FTPMU010_POWER Couldn't help on fix the compile problem? Or if the problem occurs in runtime?
No, I already added that. What I need is the declaration of ftpmu010_32768osc_enable(). I want to use it to replace the original pmu register access code in timer_init().
Actually, I am done with the fix (move ftpmu010.h to include/ and add declarations). I can submit the patch. Just want to know if you think it is appropriate.
I am trying to fix arch/arm/cpu/arm920t/a320/timer.c, but I cannot access the new API now.
regards, Po-Yu Chuang

Hi Po-Yu and Wolfgang,
2011/2/16 Po-Yu Chuang ratbert.chuang@gmail.com
Actually, I am done with the fix (move ftpmu010.h to include/ and add declarations). I can submit the patch. Just want to know if you think it is appropriate.
As you can see, the include of PMU header has been replaced to a correct path. [U-Boot,2/3] fttmr010: move fttmr010 controller to drivers/timer folder http://patchwork.ozlabs.org/patch/71952/
However, I cannot found the part of previous patch [U-Boot,1/3] You can find that I have replace a correct path to the file "arch/arm/cpu/arm920t/a320/timer.c" which haven't been applied. http://www.mail-archive.com/u-boot@lists.denx.de/msg41320.html
Wolfgang, could you please check if something have been missing in the last git apply? It looks like that we have something missed in the current tree while this patch have been already applied "http://www.mail-archive.com/u-boot@lists.denx.de/msg41320.html".
The missing part is the following patch. diff --git a/arch/arm/cpu/arm920t/a320/timer.c b/arch/arm/cpu/arm920t/a320/timer.c index d2e316f..4718ae6 100644 --- a/arch/arm/cpu/arm920t/a320/timer.c +++ b/arch/arm/cpu/arm920t/a320/timer.c @@ -19,7 +19,7 @@
#include <common.h> #include <asm/io.h> -#include <asm/arch/ftpmu010.h> +#include "../../../../../drivers/power/ftpmu010.h" #include <asm/arch/fttmr010.h>
static ulong timestamp;
Po-Yu, Yes, there are also another patches waiting to be review and be applied. ftpmu010: fix relocation and enhance features http://patchwork.ozlabs.org/patch/77704/
I am trying to fix arch/arm/cpu/arm920t/a320/timer.c, but I cannot access the new API now.
regards, Po-Yu Chuang
-- Best regards, Macpaul Lin

Hi Macpaul,
On Wed, Feb 16, 2011 at 3:58 PM, Macpaul Lin macpaul@gmail.com wrote:
As you can see, the include of PMU header has been replaced to a correct path. [U-Boot,2/3] fttmr010: move fttmr010 controller to drivers/timer folder http://patchwork.ozlabs.org/patch/71952/
However, I cannot found the part of previous patch [U-Boot,1/3] You can find that I have replace a correct path to the file "arch/arm/cpu/arm920t/a320/timer.c" which haven't been applied. http://www.mail-archive.com/u-boot@lists.denx.de/msg41320.html
Wolfgang, could you please check if something have been missing in the last git apply? It looks like that we have something missed in the current tree while this patch have been already applied "http://www.mail-archive.com/u-boot@lists.denx.de/msg41320.html".
The missing part is the following patch. diff --git a/arch/arm/cpu/arm920t/a320/timer.c b/arch/arm/cpu/arm920t/a320/timer.c index d2e316f..4718ae6 100644 --- a/arch/arm/cpu/arm920t/a320/timer.c +++ b/arch/arm/cpu/arm920t/a320/timer.c @@ -19,7 +19,7 @@
#include <common.h> #include <asm/io.h> -#include <asm/arch/ftpmu010.h> +#include "../../../../../drivers/power/ftpmu010.h" #include <asm/arch/fttmr010.h>
static ulong timestamp;
If I remember correctly, this patch was not applied because Wolfgang does not like the include "../../../..".
Po-Yu, Yes, there are also another patches waiting to be review and be applied. ftpmu010: fix relocation and enhance features http://patchwork.ozlabs.org/patch/77704/
This patch doesn't seem to affect a320.
Since I have a patch to fix the current (compilation) problem, I'll send it to RFC.
regards, Po-Yu Chuang

Hi Po-Yu,
2011/2/16 Po-Yu Chuang ratbert.chuang@gmail.com:
Hi Macpaul,
On Wed, Feb 16, 2011 at 3:58 PM, Macpaul Lin macpaul@gmail.com wrote:
As you can see, the include of PMU header has been replaced to a correct path. [U-Boot,2/3] fttmr010: move fttmr010 controller to drivers/timer folder http://patchwork.ozlabs.org/patch/71952/
However, I cannot found the part of previous patch [U-Boot,1/3] You can find that I have replace a correct path to the file "arch/arm/cpu/arm920t/a320/timer.c" which haven't been applied. http://www.mail-archive.com/u-boot@lists.denx.de/msg41320.html
Wolfgang, could you please check if something have been missing in the last git apply? It looks like that we have something missed in the current tree while this patch have been already applied "http://www.mail-archive.com/u-boot@lists.denx.de/msg41320.html".
The missing part is the following patch. diff --git a/arch/arm/cpu/arm920t/a320/timer.c b/arch/arm/cpu/arm920t/a320/timer.c index d2e316f..4718ae6 100644 --- a/arch/arm/cpu/arm920t/a320/timer.c +++ b/arch/arm/cpu/arm920t/a320/timer.c @@ -19,7 +19,7 @@
#include <common.h> #include <asm/io.h> -#include <asm/arch/ftpmu010.h> +#include "../../../../../drivers/power/ftpmu010.h" #include <asm/arch/fttmr010.h>
static ulong timestamp;
If I remember correctly, this patch was not applied because Wolfgang does not like the include "../../../..".
Yes. However, I also found there exists similar include format in other SoC. Even you put drivers for all common IP still have the same problem.
For example, like some SoCs will use the drivers in "board/Marvell/common/". If you want to use the API inside "board/Marvell/common/", the code will looks like "include ../../board/Marvell/common".
Po-Yu, Yes, there are also another patches waiting to be review and be applied. ftpmu010: fix relocation and enhance features http://patchwork.ozlabs.org/patch/77704/
This patch doesn't seem to affect a320.
Since I have a patch to fix the current (compilation) problem, I'll send it to RFC.
Just one comment, I think you can put it into folder "include/faraday" I have discussed with Wolfgang about collecting the faraday header files together before. This should be better for future driver releasement.
regards, Po-Yu Chuang

Dear Macpaul Lin,
In message AANLkTin8iSrcnAQ8hgNjdTgOa9uLeiCm7murDjz2z_JU@mail.gmail.com you wrote:
If I remember correctly, this patch was not applied because Wolfgang does not like the include "../../../..".
Yes. However, I also found there exists similar include format in other SoC. Even you put drivers for all common IP still have the same problem.
Bad examples is not an excuse for adding more bad code. Bad code may slip through a review, and sometimes it takes a while until we understand what is god or what is bad.
But when we notice it, we reject it.
Best regards,
Wolfgang Denk

Dear Po-Yu Chuang,
In message AANLkTin5Od4_3W+YPTNP5tJAXKcayg+bjmdPP=+vi5so@mail.gmail.com you wrote:
-#include <asm/arch/ftpmu010.h> +#include "../../../../../drivers/power/ftpmu010.h" #include <asm/arch/fttmr010.h>
static ulong timestamp;
If I remember correctly, this patch was not applied because Wolfgang does not like the include "../../../..".
Correct.
Best regards,
Wolfgang Denk
participants (5)
-
Macpaul Lin
-
Macpaul Lin
-
Po-Yu Chuang
-
Reinhard Meyer
-
Wolfgang Denk