Re: [U-Boot] [PATCH 03/10] am33xx: refactor am33xx clocks and add ti814x support
On Sun, Feb 17, 2013 at 09:17:01PM +0100, Peter Korsgaard wrote: > > "Matt" == Matt Porter writes: > > Matt> Split clock.c for am335x and ti814x and add the ti814x include file. > Matt> Signed-off-by: Matt Porter > Matt> --- > Matt> arch/arm/cpu/armv7/am33xx/Makefile |3 +- > Matt> arch/arm/cpu/armv7/am33xx/clock-am335x.c | 374 > ++ > Matt> arch/arm/cpu/armv7/am33xx/clock-ti814x.c | 234 ++ > Matt> arch/arm/cpu/armv7/am33xx/clock.c| 374 > -- > Matt> arch/arm/include/asm/arch-am33xx/clock.h |4 + > Matt> arch/arm/include/asm/arch-am33xx/clocks_ti814x.h | 112 +++ > Matt> 6 files changed, 726 insertions(+), 375 deletions(-) > Matt> create mode 100644 arch/arm/cpu/armv7/am33xx/clock-am335x.c > Matt> create mode 100644 arch/arm/cpu/armv7/am33xx/clock-ti814x.c > Matt> delete mode 100644 arch/arm/cpu/armv7/am33xx/clock.c > Matt> create mode 100644 arch/arm/include/asm/arch-am33xx/clocks_ti814x.h Hi Peter...thanks for reviewing this. > Do you have rename detection enabled? I would have imagined > clock-am335x.c to show up as a copy of clock.c On any given day I forget to format-patch with rename detection enabled. You caught me...will be fixed in v2. > Matt> +++ b/arch/arm/cpu/armv7/am33xx/clock-am335x.c > Matt> @@ -0,0 +1,374 @@ > Matt> +/* > Matt> + * clock.c > Matt> + * > Matt> + * clocks for AM33XX based boards > Matt> + * > Matt> + * Copyright (C) 2011, Texas Instruments, Incorporated - > http://www.ti.com/ > > This is no longer clock.c or 2011. Care to update the header? Ok > > Matt> +++ b/arch/arm/cpu/armv7/am33xx/clock-ti814x.c > Matt> @@ -0,0 +1,234 @@ > Matt> +/* > Matt> + * clock.c > Matt> + * > Matt> + * clocks for TI814X based boards > Matt> + * > Matt> + * Copyright (C) 2011, Texas Instruments, Incorporated - > http://www.ti.com/ > > Same here. Ok -Matt ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 03/10] am33xx: refactor am33xx clocks and add ti814x support
> "Matt" == Matt Porter writes: Matt> Split clock.c for am335x and ti814x and add the ti814x include file. Matt> Signed-off-by: Matt Porter Matt> --- Matt> arch/arm/cpu/armv7/am33xx/Makefile |3 +- Matt> arch/arm/cpu/armv7/am33xx/clock-am335x.c | 374 ++ Matt> arch/arm/cpu/armv7/am33xx/clock-ti814x.c | 234 ++ Matt> arch/arm/cpu/armv7/am33xx/clock.c| 374 -- Matt> arch/arm/include/asm/arch-am33xx/clock.h |4 + Matt> arch/arm/include/asm/arch-am33xx/clocks_ti814x.h | 112 +++ Matt> 6 files changed, 726 insertions(+), 375 deletions(-) Matt> create mode 100644 arch/arm/cpu/armv7/am33xx/clock-am335x.c Matt> create mode 100644 arch/arm/cpu/armv7/am33xx/clock-ti814x.c Matt> delete mode 100644 arch/arm/cpu/armv7/am33xx/clock.c Matt> create mode 100644 arch/arm/include/asm/arch-am33xx/clocks_ti814x.h Do you have rename detection enabled? I would have imagined clock-am335x.c to show up as a copy of clock.c Matt> +++ b/arch/arm/cpu/armv7/am33xx/clock-am335x.c Matt> @@ -0,0 +1,374 @@ Matt> +/* Matt> + * clock.c Matt> + * Matt> + * clocks for AM33XX based boards Matt> + * Matt> + * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/ This is no longer clock.c or 2011. Care to update the header? Matt> +++ b/arch/arm/cpu/armv7/am33xx/clock-ti814x.c Matt> @@ -0,0 +1,234 @@ Matt> +/* Matt> + * clock.c Matt> + * Matt> + * clocks for TI814X based boards Matt> + * Matt> + * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/ Same here. -- Bye, Peter Korsgaard ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 03/10] am33xx: refactor am33xx clocks and add ti814x support
On Fri, Feb 15, 2013 at 04:37:33PM +, Tom Rini wrote: > On Wed, Feb 13, 2013 at 09:43:57AM -0500, Matt Porter wrote: > > > Split clock.c for am335x and ti814x and add the ti814x include file. > > > > Signed-off-by: Matt Porter > > [snip] > > +++ b/arch/arm/cpu/armv7/am33xx/clock-am335x.c > [snip] > > +#define PRCM_MOD_EN0x2 > > +#define PRCM_FORCE_WAKEUP 0x2 > > +#define PRCM_FUNCTL0x0 > > + > > +#define PRCM_EMIF_CLK_ACTIVITY BIT(2) > > +#define PRCM_L3_GCLK_ACTIVITY BIT(4) > > + > > +#define PLL_BYPASS_MODE0x4 > > +#define ST_MN_BYPASS 0x0100 > > +#define ST_DPLL_CLK0x0001 > > +#define CLK_SEL_MASK 0x7 > > +#define CLK_DIV_MASK 0x1f > > +#define CLK_DIV2_MASK 0x7f > > +#define CLK_SEL_SHIFT 0x8 > > +#define CLK_MODE_SEL 0x7 > > +#define CLK_MODE_MASK 0xfff8 > > +#define CLK_DIV_SEL0xFFE0 > > +#define CPGMAC0_IDLE 0x3 > > +#define DPLL_CLKDCOLDO_GATE_CTRL0x300 > [snip] > > +++ b/arch/arm/cpu/armv7/am33xx/clock-ti814x.c > [snip] > > + /* Selects OSC0 (20MHz) for DMTIMER1 */ > > + temp = readl(DMTIMER_CLKSRC); > > + temp &= ~(0x7 << 3); > > + temp |= (0x4 << 3); > > + writel(temp, DMTIMER_CLKSRC); > > + > > + writel(0x2, DM_TIMER1_BASE + 0x54); > > Magic values are defined for clock-am335x.c but not in clock-ti814x.c, > please fix clock-ti814x.c to define out the magic values ala am335x.c. > Thanks! Ok, will clean this up. -Matt ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 03/10] am33xx: refactor am33xx clocks and add ti814x support
On Wed, Feb 13, 2013 at 09:43:57AM -0500, Matt Porter wrote: > Split clock.c for am335x and ti814x and add the ti814x include file. > > Signed-off-by: Matt Porter [snip] > +++ b/arch/arm/cpu/armv7/am33xx/clock-am335x.c [snip] > +#define PRCM_MOD_EN 0x2 > +#define PRCM_FORCE_WAKEUP0x2 > +#define PRCM_FUNCTL 0x0 > + > +#define PRCM_EMIF_CLK_ACTIVITY BIT(2) > +#define PRCM_L3_GCLK_ACTIVITYBIT(4) > + > +#define PLL_BYPASS_MODE 0x4 > +#define ST_MN_BYPASS 0x0100 > +#define ST_DPLL_CLK 0x0001 > +#define CLK_SEL_MASK 0x7 > +#define CLK_DIV_MASK 0x1f > +#define CLK_DIV2_MASK0x7f > +#define CLK_SEL_SHIFT0x8 > +#define CLK_MODE_SEL 0x7 > +#define CLK_MODE_MASK0xfff8 > +#define CLK_DIV_SEL 0xFFE0 > +#define CPGMAC0_IDLE 0x3 > +#define DPLL_CLKDCOLDO_GATE_CTRL0x300 [snip] > +++ b/arch/arm/cpu/armv7/am33xx/clock-ti814x.c [snip] > + /* Selects OSC0 (20MHz) for DMTIMER1 */ > + temp = readl(DMTIMER_CLKSRC); > + temp &= ~(0x7 << 3); > + temp |= (0x4 << 3); > + writel(temp, DMTIMER_CLKSRC); > + > + writel(0x2, DM_TIMER1_BASE + 0x54); Magic values are defined for clock-am335x.c but not in clock-ti814x.c, please fix clock-ti814x.c to define out the magic values ala am335x.c. Thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 03/10] am33xx: refactor am33xx clocks and add ti814x support
Split clock.c for am335x and ti814x and add the ti814x include file. Signed-off-by: Matt Porter --- arch/arm/cpu/armv7/am33xx/Makefile |3 +- arch/arm/cpu/armv7/am33xx/clock-am335x.c | 374 ++ arch/arm/cpu/armv7/am33xx/clock-ti814x.c | 234 ++ arch/arm/cpu/armv7/am33xx/clock.c| 374 -- arch/arm/include/asm/arch-am33xx/clock.h |4 + arch/arm/include/asm/arch-am33xx/clocks_ti814x.h | 112 +++ 6 files changed, 726 insertions(+), 375 deletions(-) create mode 100644 arch/arm/cpu/armv7/am33xx/clock-am335x.c create mode 100644 arch/arm/cpu/armv7/am33xx/clock-ti814x.c delete mode 100644 arch/arm/cpu/armv7/am33xx/clock.c create mode 100644 arch/arm/include/asm/arch-am33xx/clocks_ti814x.h diff --git a/arch/arm/cpu/armv7/am33xx/Makefile b/arch/arm/cpu/armv7/am33xx/Makefile index 70c443e..7051029 100644 --- a/arch/arm/cpu/armv7/am33xx/Makefile +++ b/arch/arm/cpu/armv7/am33xx/Makefile @@ -16,7 +16,8 @@ include $(TOPDIR)/config.mk LIB= $(obj)lib$(SOC).o -COBJS += clock.o +COBJS-$(CONFIG_AM33XX) += clock-am335x.o +COBJS-$(CONFIG_TI814X) += clock-ti814x.o COBJS += sys_info.o COBJS += mem.o COBJS += ddr.o diff --git a/arch/arm/cpu/armv7/am33xx/clock-am335x.c b/arch/arm/cpu/armv7/am33xx/clock-am335x.c new file mode 100644 index 000..d7d98d1 --- /dev/null +++ b/arch/arm/cpu/armv7/am33xx/clock-am335x.c @@ -0,0 +1,374 @@ +/* + * clock.c + * + * clocks for AM33XX based boards + * + * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.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. + */ + +#include +#include +#include +#include +#include + +#define PRCM_MOD_EN0x2 +#define PRCM_FORCE_WAKEUP 0x2 +#define PRCM_FUNCTL0x0 + +#define PRCM_EMIF_CLK_ACTIVITY BIT(2) +#define PRCM_L3_GCLK_ACTIVITY BIT(4) + +#define PLL_BYPASS_MODE0x4 +#define ST_MN_BYPASS 0x0100 +#define ST_DPLL_CLK0x0001 +#define CLK_SEL_MASK 0x7 +#define CLK_DIV_MASK 0x1f +#define CLK_DIV2_MASK 0x7f +#define CLK_SEL_SHIFT 0x8 +#define CLK_MODE_SEL 0x7 +#define CLK_MODE_MASK 0xfff8 +#define CLK_DIV_SEL0xFFE0 +#define CPGMAC0_IDLE 0x3 +#define DPLL_CLKDCOLDO_GATE_CTRL0x300 + +const struct cm_perpll *cmper = (struct cm_perpll *)CM_PER; +const struct cm_wkuppll *cmwkup = (struct cm_wkuppll *)CM_WKUP; +const struct cm_dpll *cmdpll = (struct cm_dpll *)CM_DPLL; +const struct cm_rtc *cmrtc = (struct cm_rtc *)CM_RTC; + +static void enable_interface_clocks(void) +{ + /* Enable all the Interconnect Modules */ + writel(PRCM_MOD_EN, &cmper->l3clkctrl); + while (readl(&cmper->l3clkctrl) != PRCM_MOD_EN) + ; + + writel(PRCM_MOD_EN, &cmper->l4lsclkctrl); + while (readl(&cmper->l4lsclkctrl) != PRCM_MOD_EN) + ; + + writel(PRCM_MOD_EN, &cmper->l4fwclkctrl); + while (readl(&cmper->l4fwclkctrl) != PRCM_MOD_EN) + ; + + writel(PRCM_MOD_EN, &cmwkup->wkl4wkclkctrl); + while (readl(&cmwkup->wkl4wkclkctrl) != PRCM_MOD_EN) + ; + + writel(PRCM_MOD_EN, &cmper->l3instrclkctrl); + while (readl(&cmper->l3instrclkctrl) != PRCM_MOD_EN) + ; + + writel(PRCM_MOD_EN, &cmper->l4hsclkctrl); + while (readl(&cmper->l4hsclkctrl) != PRCM_MOD_EN) + ; + + writel(PRCM_MOD_EN, &cmwkup->wkgpio0clkctrl); + while (readl(&cmwkup->wkgpio0clkctrl) != PRCM_MOD_EN) + ; +} + +/* + * Force power domain wake up transition + * Ensure that the corresponding interface clock is active before + * using the peripheral + */ +static void power_domain_wkup_transition(void) +{ + writel(PRCM_FORCE_WAKEUP, &cmper->l3clkstctrl); + writel(PRCM_FORCE_WAKEUP, &cmper->l4lsclkstctrl); + writel(PRCM_FORCE_WAKEUP, &cmwkup->wkclkstctrl); + writel(PRCM_FORCE_WAKEUP, &cmper->l4fwclkstctrl); + writel(PRCM_FORCE_WAKEUP, &cmper->l3sclkstctrl); +} + +/* + * Enable the peripheral clock for required peripherals + */ +static void enable_per_clocks(void) +{ + /* Enable the control module though RBL would have done it*/ + writel(PRCM_MOD_EN, &cmwkup->wkctrlclkctrl); + while (readl(&cmwkup->wkctrlclkctrl) != PRCM_MOD_EN) + ; + + /* Enable the module clock */ + writel(PRCM_MOD_EN, &cmper->timer2cl