public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom <Tom.Rix@windriver.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 6/8] ux500: add SoC-specific code
Date: Sun, 28 Mar 2010 12:42:27 -0500	[thread overview]
Message-ID: <4BAF9503.5040706@windriver.com> (raw)
In-Reply-To: <1268889017-32457-1-git-send-email-rabin.vincent@stericsson.com>

Rabin Vincent wrote:
> Add the base SoC code for ST-Ericsson's Ux500 series of Cortex A9 based
> SoCs.
> 
> Even though this is a Cortex A9, we put it under Cortex A8 to avoid code
> duplication, since the CPU specific code can be used unmodified across
> the two CPUs.
> 
I would rather have arm_cortexa9 be created.
Minimize the duplication by only copying the arm_cortexa8 files
that are needed.
Make this initial copying of a8->a9 its own patch

> Acked-by: Michael Brandt <michael.brandt@stericsson.com>
> Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
> ---
>  cpu/arm_cortexa8/ux500/Makefile       |   45 +++++++++++++++++++
>  cpu/arm_cortexa8/ux500/clock.c        |   56 +++++++++++++++++++++++
>  cpu/arm_cortexa8/ux500/cpu.c          |   49 ++++++++++++++++++++
>  include/asm-arm/arch-ux500/clock.h    |   72 ++++++++++++++++++++++++++++++
>  include/asm-arm/arch-ux500/hardware.h |   78 +++++++++++++++++++++++++++++++++
>  5 files changed, 300 insertions(+), 0 deletions(-)
>  create mode 100644 cpu/arm_cortexa8/ux500/Makefile
>  create mode 100644 cpu/arm_cortexa8/ux500/clock.c
>  create mode 100644 cpu/arm_cortexa8/ux500/cpu.c
>  create mode 100644 include/asm-arm/arch-ux500/clock.h
>  create mode 100644 include/asm-arm/arch-ux500/hardware.h
> 
> diff --git a/cpu/arm_cortexa8/ux500/Makefile b/cpu/arm_cortexa8/ux500/Makefile
> new file mode 100644
> index 0000000..c671010
> --- /dev/null
> +++ b/cpu/arm_cortexa8/ux500/Makefile
> @@ -0,0 +1,45 @@
> +#
> +# (C) Copyright 2000-2003
> +# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
> +#
> +# See file CREDITS for list of people who contributed to this
> +# project.
> +#
> +# 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., 59 Temple Place, Suite 330, Boston,
> +# MA 02111-1307 USA
> +#
> +
> +include $(TOPDIR)/config.mk
> +
> +LIB	=  $(obj)lib$(SOC).a
> +
> +COBJS	+= clock.o cpu.o
> +
> +SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
> +OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
> +
> +all:	 $(obj).depend $(LIB)
> +
> +$(LIB):	$(OBJS)
> +	$(AR) $(ARFLAGS) $@ $(OBJS)
> +
> +#########################################################################
> +
> +# defines $(obj).depend target
> +include $(SRCTREE)/rules.mk
> +
> +sinclude $(obj).depend
> +
> +#########################################################################
> diff --git a/cpu/arm_cortexa8/ux500/clock.c b/cpu/arm_cortexa8/ux500/clock.c
> new file mode 100644
> index 0000000..6b67fe8
> --- /dev/null
> +++ b/cpu/arm_cortexa8/ux500/clock.c
> @@ -0,0 +1,56 @@
> +/*
> + * (C) Copyright 2010 ST-Ericsson SA
> + * Author: Rabin Vincent <rabin.vincent@stericsson.com>
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * 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., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +
> +#include <common.h>
> +#include <asm/io.h>
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +struct clkrst {
> +	unsigned int pcken;
> +	unsigned int pckdis;
> +	unsigned int kcken;
> +	unsigned int kckdis;
> +};
> +
> +static unsigned int clkrst_base[] = {
> +	U8500_CLKRST1_BASE,
> +	U8500_CLKRST2_BASE,
> +	U8500_CLKRST3_BASE,
> +	0,
0 ?
If this is an exception, it should be checked for.
Should also have a comment.

Expected to have U8500_CLKRSTR4_BASE.

> +	U8500_CLKRST5_BASE,
> +	U8500_CLKRST6_BASE,
> +	U8500_CLKRST7_BASE,
> +};

Could these structures be added to an arch or board *.h ?

> +
> +/* Turn on peripheral clock at PRCC level */
> +void u8500_clock_enable(int periph, int kern, int cluster)
> +{
> +	struct clkrst *clkrst = (struct clkrst *) clkrst_base[periph - 1];

-1 on array access.
Convert to unsigned access

> +
> +	if (kern != -1)
> +		writel(1 << kern, &clkrst->kcken);
> +
> +	if (cluster != -1)
> +		writel(1 << cluster, &clkrst->pcken);

Checking that some of the parameters are expected to be bad.
This function should be split.

> +}
> diff --git a/cpu/arm_cortexa8/ux500/cpu.c b/cpu/arm_cortexa8/ux500/cpu.c
> new file mode 100644
> index 0000000..b3c66fa
> --- /dev/null
> +++ b/cpu/arm_cortexa8/ux500/cpu.c
> @@ -0,0 +1,49 @@
> +/*
> + * (C) Copyright 2010 ST-Ericsson SA
> + * Author: Rabin Vincent <rabin.vincent@stericsson.com>
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * 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., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +
> +#include <common.h>
> +#include <asm/io.h>
> +#include <asm/arch/clock.h>
> +#include <nomadik_gpio.h>
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +unsigned long nmk_gpio_base[] = {
> +	U8500_GPIO0_BASE,
> +	U8500_GPIO1_BASE,
> +	U8500_GPIO2_BASE,
> +	U8500_GPIO3_BASE,
> +	U8500_GPIO4_BASE,
> +	U8500_GPIO5_BASE,
> +	U8500_GPIO6_BASE,
> +	U8500_GPIO7_BASE,
> +	U8500_GPIO8_BASE
> +};
> +

Could this be added to arch or board *.h ?

> +void reset_cpu(unsigned long ignored)
> +{
> +	struct prcmu *prcmu = (struct prcmu *) U8500_PRCMU_BASE;
> +
> +	writel(0x1, &prcmu->ape_softrst);
> +	while (1);

busy wait..
put ';' on next line
Add a comment that this really is an infinite loop

> +}
> diff --git a/include/asm-arm/arch-ux500/clock.h b/include/asm-arm/arch-ux500/clock.h
> new file mode 100644
> index 0000000..b384f49
> --- /dev/null
> +++ b/include/asm-arm/arch-ux500/clock.h
> @@ -0,0 +1,72 @@
> +/*
> + * (C) Copyright 2010 ST-Ericsson SA
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * 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., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +
> +#ifndef __ASM_ARCH_CLOCK
> +#define __ASM_ARCH_CLOCK
> +
> +struct prcmu {
> +	unsigned int armclkfix_mgt;
> +	unsigned int armclk_mgt;
> +	unsigned int svammdspclk_mgt;
> +	unsigned int siammdspclk_mgt;
> +	unsigned int reserved;
> +	unsigned int sgaclk_mgt;
> +	unsigned int uartclk_mgt;
> +	unsigned int msp02clk_mgt;
> +	unsigned int i2cclk_mgt;
> +	unsigned int sdmmcclk_mgt;
> +	unsigned int slimclk_mgt;
> +	unsigned int per1clk_mgt;
> +	unsigned int per2clk_mgt;
> +	unsigned int per3clk_mgt;
> +	unsigned int per5clk_mgt;
> +	unsigned int per6clk_mgt;
> +	unsigned int per7clk_mgt;
> +	unsigned int lcdclk_mgt;
> +	unsigned int reserved1;
> +	unsigned int bmlclk_mgt;
> +	unsigned int hsitxclk_mgt;
> +	unsigned int hsirxclk_mgt;
> +	unsigned int hdmiclk_mgt;
> +	unsigned int apeatclk_mgt;
> +	unsigned int apetraceclk_mgt;
> +	unsigned int mcdeclk_mgt;
> +	unsigned int ipi2cclk_mgt;
> +	unsigned int dsialtclk_mgt;
> +	unsigned int spare2clk_mgt;
> +	unsigned int dmaclk_mgt;
> +	unsigned int b2r2clk_mgt;
> +	unsigned int tvclk_mgt;
> +	unsigned int unused[82];
> +	unsigned int tcr;
> +	unsigned int unused1[23];
> +	unsigned int ape_softrst;
> +};
> +
> +extern void u8500_clock_enable(int periph, int kern, int cluster);
> +
> +static inline void u8500_prcmu_enable(unsigned int *reg)
> +{
> +	writel(readl(reg) | (1 << 8), reg);
> +}
> +
> +#endif /* __ASM_ARCH_CLOCK */
> diff --git a/include/asm-arm/arch-ux500/hardware.h b/include/asm-arm/arch-ux500/hardware.h
> new file mode 100644
> index 0000000..2d75538
> --- /dev/null
> +++ b/include/asm-arm/arch-ux500/hardware.h
> @@ -0,0 +1,78 @@
> +/*
> + * (C) Copyright 2010 ST-Ericsson SA
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * 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., 51 Franklin Street, Fifth Floor, Boston,
> + * MA 02110-1301 USA
> + */
> +
> +#ifndef __ASM_ARCH_HARDWARE_H
> +#define __ASM_ARCH_HARDWARE_H
> +
> +/* Peripheral clusters */
> +
> +#define U8500_PER3_BASE		0x80000000
> +#define U8500_PER2_BASE		0x80110000
> +#define U8500_PER1_BASE		0x80120000
> +#define U8500_PER4_BASE		0x80150000
> +
> +#define U8500_PER6_BASE		0xa03c0000
> +#define U8500_PER7_BASE		0xa03d0000
> +#define U8500_PER5_BASE		0xa03e0000
> +

Extra line spaces should be removed.

> +/* GPIO */
> +
> +#define U8500_GPIO0_BASE	(U8500_PER1_BASE + 0xE000)
> +#define U8500_GPIO1_BASE	(U8500_PER1_BASE + 0xE000 + 0x80)
> +
> +#define U8500_GPIO2_BASE	(U8500_PER3_BASE + 0xE000)
> +#define U8500_GPIO3_BASE	(U8500_PER3_BASE + 0xE000 + 0x80)
> +#define U8500_GPIO4_BASE	(U8500_PER3_BASE + 0xE000 + 0x100)
> +#define U8500_GPIO5_BASE	(U8500_PER3_BASE + 0xE000 + 0x180)
> +
> +#define U8500_GPIO6_BASE	(U8500_PER2_BASE + 0xE000)
> +#define U8500_GPIO7_BASE	(U8500_PER2_BASE + 0xE000 + 0x80)
> +
> +#define U8500_GPIO8_BASE	(U8500_PER5_BASE + 0x1E000)
> +

Extra line spaces should be removed.

> +/* Per7 */
> +#define U8500_MTU0_BASE		(U8500_PER7_BASE + 0xa000)
> +#define U8500_MTU1_BASE		(U8500_PER7_BASE + 0xb000)
> +#define U8500_CLKRST7_BASE	(U8500_PER7_BASE + 0xf000)
> +
> +/* Per6 */
> +#define U8500_CLKRST6_BASE	(U8500_PER6_BASE + 0xf000)
> +
> +/* Per5 */
> +#define U8500_CLKRST5_BASE	(U8500_PER5_BASE + 0x1f000)
> +
> +/* Per4 */
> +#define U8500_PRCMU_BASE	(U8500_PER4_BASE + 0x07000)
> +
> +/* Per3 */
> +#define U8500_UART2_BASE	(U8500_PER3_BASE + 0x7000)
> +#define U8500_CLKRST3_BASE	(U8500_PER3_BASE + 0xf000)
> +
> +/* Per2 */
> +#define U8500_CLKRST2_BASE	(U8500_PER2_BASE + 0xf000)
> +
> +/* Per1 */
> +#define U8500_UART0_BASE	(U8500_PER1_BASE + 0x0000)
> +#define U8500_UART1_BASE	(U8500_PER1_BASE + 0x1000)
> +#define U8500_CLKRST1_BASE	(U8500_PER1_BASE + 0xf000)
> +
> +#endif /* __ASM_ARCH_HARDWARE_H */

Tom

  reply	other threads:[~2010-03-28 17:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-18  4:20 [U-Boot] [PATCH 0/8] ST-Ericsson Ux500 support Rabin Vincent
2010-03-18  4:20 ` [U-Boot] [PATCH 1/8] Nomadik: move timer code to drivers/misc Rabin Vincent
2010-03-28 17:30   ` Tom
2010-04-06 11:16     ` Rabin VINCENT
2010-04-06 11:30       ` Alessandro Rubini
2010-03-18  4:28 ` [U-Boot] [PATCH 2/8] Nomadik: move gpio driver to drivers/gpio Rabin Vincent
2010-03-28 17:32   ` Tom
2010-04-06 11:25     ` Rabin VINCENT
2010-03-18  5:02 ` [U-Boot] [PATCH 3/8] nomadik_gpio: get base address from platform code Rabin Vincent
2010-03-28 17:35   ` Tom
2010-03-18  5:08 ` [U-Boot] [PATCH 4/8] nomadik_mtu: support configurable clock rates Rabin Vincent
2010-03-28 17:36   ` Tom
2010-03-18  5:10 ` [U-Boot] [PATCH 5/8] ARM Cortex A8: ifdef code calling lowlevel init Rabin Vincent
2010-03-28 17:38   ` Tom
2010-03-18  5:10 ` [U-Boot] [PATCH 6/8] ux500: add SoC-specific code Rabin Vincent
2010-03-28 17:42   ` Tom [this message]
2010-04-07  6:15     ` Rabin VINCENT
2010-03-18  5:10 ` [U-Boot] [PATCH 7/8] pl01x: add support for Ux500 variant of pl011 Rabin Vincent
2010-03-28 17:45   ` Tom
2010-03-18  5:33 ` [U-Boot] [PATCH 8/8] mop500: add board-specific files Rabin Vincent
2010-03-28 17:49   ` Tom
2010-04-08 13:41     ` Rabin VINCENT
2010-04-09 22:28       ` Wolfgang Denk
2010-04-17 21:46       ` Tom Rix
2010-03-21 19:42 ` [U-Boot] [PATCH 0/8] ST-Ericsson Ux500 support Wolfgang Denk
2010-03-28 17:27 ` Tom

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=4BAF9503.5040706@windriver.com \
    --to=tom.rix@windriver.com \
    --cc=u-boot@lists.denx.de \
    /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