public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 01/22] ARM: sunxi: Basic Allwinner A10/A13 (sun4i/sun5i) support
Date: Sun, 25 Nov 2012 19:06:13 +0100	[thread overview]
Message-ID: <201211251906.13698.marex@denx.de> (raw)
In-Reply-To: <1353843450.17518.13.camel@home.hno.se>

Dear Henrik Nordstr?m,

> This adds support for the Allwinner A10/A13 SoC's. Additionally
> board support for the dev-boards sun4i/sun5i is added.
> 
> Signed-off-by: Tom Cubie <tangliang@allwinnertech.com>
> Signed-off-by: Henrik Nordstr?m <henrik@henriknordstrom.net>
> Signed-off-by: Stefan Roese <sr@denx.de>

[..]

> +Henrik Nordstrom <henrik@henriknordstrom.net>
> +	A13_OLINUXINO	ARM V7 (Allwinner A13 SoC)
> +	A13_MID		ARM V7 (Allwinner A13 SoC)
> +	CUBIEBOARD	ARM V7 (Allwinner A10 SoC)
> +	CUBIEBOARD_512	ARM V7 (Allwinner A10 SoC)
> +	HACKBERRY	ARM V7 (Allwinner A10 SoC)
> +	MELE_A1000	ARM V7 (Allwinner A10 SoC)
> +	MINI-X		ARM V7 (Allwinner A10 SoC)
> +	SUN4I		ARM V7 (Allwinner A10 SoC)
> +	SUN4I_SDCON	ARM V7 (Allwinner A10 SoC)
> +	SUN5I		ARM V7 (Allwinner A13 SoC)
> +	SUN5I_SDCON	ARM V7 (Allwinner A13 SoC)

You're not adding these boards here yet ...

>  Kyle Moffett <Kyle.D.Moffett@boeing.com>
> 
>  	HWW1U1A		P2020
[...]

> diff --git a/arch/arm/cpu/armv7/sunxi/Makefile
> b/arch/arm/cpu/armv7/sunxi/Makefile new file mode 100644
> index 0000000..cbe1015
> --- /dev/null
> +++ b/arch/arm/cpu/armv7/sunxi/Makefile
[...]

> +include $(TOPDIR)/config.mk
> +
> +LIB	=  $(obj)lib$(SOC).o
> +
> +SOBJS	+= reset.o
> +
> +COBJS	+= timer.o
> +COBJS	+= dram.o
> +COBJS	+= board.o
> +COBJS	+= clock.o
> +COBJS	+= pinmux.o

COBJS = x.o y.o z.o
works just fine

> +SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
> +OBJS	:= $(addprefix $(obj),$(COBJS) $(COBJS-y) $(SOBJS))
> +
> +all:	 $(obj).depend $(LIB)
> +
> +$(LIB):	$(OBJS)
> +	$(call cmd_link_o_target, $(OBJS))
> +
[...]

> +#ifndef CONFIG_SYS_DCACHE_OFF
> +void enable_caches(void)
> +{
> +	/* Enable D-cache. I-cache is already enabled in start.S */
> +	dcache_enable();

Why don't you enable them both? What if someone fiddled with them prior to 
reset?

> +}
> +#endif
[...]

> +	cfg = readl(&pio->cfg[0] + index);
> +	cfg &= ~(0xf << offset);
> +	cfg |= val << offset;
> +
> +	writel(cfg, &pio->cfg[0] + index);

clrsetbits_le32()

> +	return 0;
> +}
> +
> +int sunxi_gpio_get_cfgpin(u32 pin)
> +{
> +	u32 cfg;
> +	u32 bank = GPIO_BANK(pin);
> +	u32 index = GPIO_CFG_INDEX(pin);
> +	u32 offset = GPIO_CFG_OFFSET(pin);
> +	struct sunxi_gpio *pio =
> +	    &((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)->gpio_bank[bank];
> +
> +	cfg = readl(&pio->cfg[0] + index);
> +	cfg >>= offset;

I think you want to put this into drivers/gpio, no?

> +	return cfg & 0xf;
> +}
> +
> diff --git a/arch/arm/cpu/armv7/sunxi/reset.S
> b/arch/arm/cpu/armv7/sunxi/reset.S new file mode 100644
> index 0000000..36714e7
> --- /dev/null
> +++ b/arch/arm/cpu/armv7/sunxi/reset.S
[...]

> +#include <asm/arch/cpu.h>
> +
> +#define SUNXI_WDOG_CTL		0x01C20C90
> +#define SUNXI_WDOG_MODE		0x01C20C94
> +
> +.globl sunxi_reset
> +sunxi_reset:
> +	ldr r1, =SUNXI_WDOG_MODE
> +	mov r3, #0x3
> +	str r3, [r1]
> +	mov r0, r0
> +_loop_forever:
> +	b	_loop_forever

Put this into proper C code.

> diff --git a/arch/arm/cpu/armv7/sunxi/timer.c
> b/arch/arm/cpu/armv7/sunxi/timer.c new file mode 100644
> index 0000000..e19df09
> --- /dev/null
> +++ b/arch/arm/cpu/armv7/sunxi/timer.c
> @@ -0,0 +1,117 @@
[...]

> +/* delay x useconds */

proper kerneldoc all around won't hurt.

> +void __udelay(unsigned long usec)
> +{
> +	long tmo = usec * (TIMER_CLOCK / 1000) / 1000;
> +	ulong now, last = READ_TIMER();
> +
> +	while (tmo > 0) {
> +		now = READ_TIMER();
> +		if (now > last)	/* normal (non rollover) */
> +			tmo -= now - last;
> +		else		/* rollover */
> +			tmo -= TIMER_LOAD_VAL - last + now;
> +		last = now;
> +	}
> +}
> +
> +/*
> + * This function is derived from PowerPC code (read timebase as long
> long). + * On ARM it just returns the timer value.
> + */
> +unsigned long long get_ticks(void)
> +{
> +	return get_timer(0);
> +}
[...]

  parent reply	other threads:[~2012-11-25 18:06 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1353842684.git.henrik@henriknordstrom.net>
2012-11-25 11:37 ` [U-Boot] [PATCH 01/22] ARM: sunxi: Basic Allwinner A10/A13 (sun4i/sun5i) support Henrik Nordström
2012-11-25 12:23   ` Luka Perkov
2012-11-25 13:08     ` Henrik Nordström
2012-11-25 19:55       ` Wolfgang Denk
2012-11-26  1:05         ` [U-Boot] [PATCH 01/22] Re: Copyright on board makefiles Henrik Nordström
2012-11-26  5:54           ` Wolfgang Denk
2012-11-25 19:52     ` [U-Boot] [PATCH 01/22] ARM: sunxi: Basic Allwinner A10/A13 (sun4i/sun5i) support Wolfgang Denk
2012-11-25 18:06   ` Marek Vasut [this message]
2012-11-26  0:21     ` Henrik Nordström
2012-11-26  0:33       ` Marek Vasut
2012-11-26  5:52       ` Wolfgang Denk
2012-11-25 19:33   ` Wolfgang Denk
2012-11-25 23:53     ` Henrik Nordström
2012-11-26  8:00       ` Stefan Roese
2012-11-25 19:40   ` Wolfgang Denk
2012-11-25 11:37 ` [U-Boot] [PATCH 02/22] ARM: sunxi: MMC driver Henrik Nordström
2012-11-25 14:33   ` Luka Perkov
2012-11-25 15:39     ` Henrik Nordström
2012-11-25 17:07       ` Luka Perkov
2012-11-25 19:58       ` Wolfgang Denk
2012-11-25 19:56     ` Wolfgang Denk
2012-11-25 18:09   ` Marek Vasut
2012-11-25 19:44   ` Wolfgang Denk
2012-11-25 11:38 ` [U-Boot] [PATCH 03/22] ARM sunxi: I2C driver Henrik Nordström
2012-11-25 14:41   ` Luka Perkov
2012-11-25 15:47     ` Henrik Nordström
2012-11-25 18:11   ` Marek Vasut
2012-11-25 19:47   ` Wolfgang Denk
2012-11-26 11:13   ` Heiko Schocher
2012-11-26 13:39     ` Henrik Nordström
2012-11-25 11:39 ` [U-Boot] [PATCH 05/22] power: Add AXP209 Power Management controller (I2C) Henrik Nordström
2012-11-25 14:44   ` Luka Perkov
2012-11-25 18:13   ` Marek Vasut
2012-11-25 19:48   ` Wolfgang Denk
2012-11-25 11:40 ` [U-Boot] [PATCH 06/22] ARM sunxi: Basic GPIO driver Henrik Nordström
2012-11-25 14:52   ` Luka Perkov
2012-11-25 18:14   ` Marek Vasut
2012-11-25 19:50   ` Wolfgang Denk
2012-11-25 21:47     ` Marek Vasut
2012-11-25 23:41     ` Henrik Nordström
2012-11-25 11:40 ` [U-Boot] [PATCH 07/22] tools: mksunixboot adding a Allwinner boot header Henrik Nordström
2012-11-25 15:01   ` Luka Perkov
2012-11-25 17:47   ` Wolfgang Denk
2012-11-25 11:41 ` [U-Boot] [PATCH 08/22] net: Add sunxi (Allwinner) wemac driver Henrik Nordström
2013-07-08 15:43   ` Joe Hershberger
2013-07-08 16:16     ` Tom Rini
2013-07-08 16:29       ` Joe Hershberger
2013-07-08 19:03         ` Tom Rini
2012-11-25 11:42 ` [U-Boot] [PATCH 09/22] ARM: sun4i: Enable ethernet support (wemac) on A10 boards Henrik Nordström
2012-11-25 15:05   ` Luka Perkov
2012-11-25 11:43 ` [U-Boot] [PATCH 10/22] sunxi: Add more network commands and netconsole support Henrik Nordström
2012-11-25 15:07   ` Luka Perkov
2012-11-25 11:44 ` [U-Boot] [PATCH 11/22] ARM: sunxi: U-Boot SPL capable of booting directly from MMC Henrik Nordström
2012-11-25 15:11   ` Luka Perkov
2012-11-25 11:44 ` [U-Boot] [PATCH 12/22] ARM sunxi: SPL support for Olimex A13-OLinuXino board Henrik Nordström
2012-11-25 15:17   ` Luka Perkov
2012-11-25 11:44 ` [U-Boot] [PATCH 13/22] ARM sunxi: SPL support for Mele A1000 board Henrik Nordström
2012-11-25 11:45 ` [U-Boot] [PATCH 14/22] ARM sunxi: SPL support for Cubieboard board Henrik Nordström
2012-11-25 11:45 ` [U-Boot] [PATCH 15/22] ARM sunxi: SPL support for Hackberry 1GB board Henrik Nordström
2012-11-25 11:45 ` [U-Boot] [PATCH 16/22] ARM sunxi: SPL support for a13_mid board Henrik Nordström
2012-11-25 11:45 ` [U-Boot] [PATCH 17/22] ARM sunxi: SPL support for Mini-X board Henrik Nordström
2012-11-25 11:46 ` [U-Boot] [PATCH 18/22] ARM sunxi: SPL support for hyundai A7HD board Henrik Nordström
2012-11-25 11:46 ` [U-Boot] [PATCH 19/22] ARM sunxi: SPL support for MK802 board Henrik Nordström
2012-11-25 11:46 ` [U-Boot] [PATCH 20/22] ARM sunxi: SPL support for Rikomagic MK802II board Henrik Nordström
2012-11-25 11:46 ` [U-Boot] [PATCH 21/22] ARM sunxi: SPL support for Mele A3700 board Henrik Nordström
2012-11-25 11:46 ` [U-Boot] [PATCH 22/22] ARM sunxi: SPL support for Olinuxino A13 Micro Henrik Nordström
2012-11-25 11:47 ` [U-Boot] [PATCH 04/22] ARM: sunxi: watchdog support Henrik Nordström
2013-02-02 23:55   ` Albert ARIBAUD

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=201211251906.13698.marex@denx.de \
    --to=marex@denx.de \
    --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