sunxi: initial upstreamining effort
Subsystems (5)
v2 cover sunxi: initial upstreamining effort
This is my second cut at an upstreamable series based upon the
https://github.com/linux-sunxi/u-boot-sunxi.git#sunxi tree. The intention is to present a minimal starting point for upstreaming to which support for other processors, peripherals, boards etc can be added in the future. Therefore this has been stripped right back and currently supports only sun7i processors AKA Allwinner A20 and the cubietruck board. Supported peripherals are UART, MMC and Ethernet.
The code here is from u-boot-sunxi.git#sunxi[0] changeset d9aa5dd3d15c "sunxi: mmc: checkpatch whitespace fixes" with v2014.04-rc2 merged in and applies to u-boot v2014.04-rc2.
Global changes in v2:
- Use SPDX-License-Identifier
- Resync with u-boot-sunxi.git
- Lot of updates to the individual patches, see the individual commit messages (checkpatch.pl fixes, magic number removal etc).
- Pulled the Ethernet stuff before the MMC and non-FEL boot stuff. The MMC stuff (which non-FEL boot needs) still needs some more cleanup, but the reordering means that the initial part of the series could in principal go in.
This series can also be found at:
git://gitorious.org/ijc/u-boot.git sunxi-mainlining-v2
The merged sunxi tree which it is based on is:
git://gitorious.org/ijc/u-boot.git sunxi-merge-v2014.04-rc2
There is no SMP here, since that relies on the PSCI support from Marc Zyngier which has yet to land in mainline AFAIK.
I've tried to give corect credit and S-o-b based upon:
git log --pretty='%aN' linux-sunxi/sunxi -- [PATHS] | sort -u git log linux-sunxi/sunxi -- [PATHS] | grep -i signed.off.by | sort -u Manual inspection
This will tend to over credit, since it will include folks who contributed code which has since been removed as well as those who contributed code which is not included in this patch set, but I think it is better to be conservative and include too many rather than incorrectly exclude people. Doing better than this would be IMHO too hard to be worth it (e.g. git blame would prefer a recent whitespace cleanup to the actual author of the code and prefer someone did code motion over the original author, so it would be a massive & manual process).
PATCH v2 1/9 sunxi: initial sun7i clocks and timer support.
This has been stripped back for mainlining and supports only sun7i. These changes are not useful by themselves but are split out to make the patch sizes more manageable.
As well as the following signed-off-by the sunxi branch shows commits to these files authored by the following:
Alejandro Mery
Carl van Schaik
Stefan Roese
Tom Cubie
yemao
---
v2: Based on u-boot-sunxi.git#sunxi d9aa5dd3d15c "sunxi: mmc:
checkpatch whitespace fixes" with v2014.04-rc2 merged in:
- define magic numbers
- simplify get_tbclk
- correct clock_set_pll1 prototype
- add CONFIG_SUN7I to simplify future SUN?I support.
- defines for MMC AHB clocks
v1: Based on u-boot-sunxi.git#sunxi commit d854c4de2f57 "arm: Handle .gnu.hash section in ldscripts" vs v2014.01.
--- arch/arm/cpu/armv7/sunxi/Makefile | 11 ++ arch/arm/cpu/armv7/sunxi/clock.c | 180 +++++++++++++++++++++ arch/arm/cpu/armv7/sunxi/timer.c | 102 ++++++++++++ arch/arm/include/asm/arch-sunxi/clock.h | 237 ++++++++++++++++++++++++++++ arch/arm/include/asm/arch-sunxi/sys_proto.h | 17 ++ arch/arm/include/asm/arch-sunxi/timer.h | 88 +++++++++++ 6 files changed, 635 insertions(+) create mode 100644 arch/arm/cpu/armv7/sunxi/Makefile create mode 100644 arch/arm/cpu/armv7/sunxi/clock.c create mode 100644 arch/arm/cpu/armv7/sunxi/timer.c create mode 100644 arch/arm/include/asm/arch-sunxi/clock.h create mode 100644 arch/arm/include/asm/arch-sunxi/sys_proto.h create mode 100644 arch/arm/include/asm/arch-sunxi/timer.h
arch/arm/cpu/armv7/sunxi/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# +# (C) Copyright 2012 Henrik Nordstrom <[email protected]> +# +# Based on some other Makefile +# (C) Copyright 2000-2003 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# SPDX-License-Identifier: GPL-2.0+ +# +obj-y += timer.o +obj-y += clock.o
arch/arm/cpu/armv7/sunxi/clock.c new file +180 -0
180 lines not on this page · raw message
arch/arm/cpu/armv7/sunxi/timer.c new file +102 -0
102 lines not on this page · raw message
arch/arm/include/asm/arch-sunxi/clock.h new file +237 -0
237 lines not on this page · raw message
arch/arm/include/asm/arch-sunxi/sys_proto.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* (C) Copyright 2007-2012 +* Allwinner Technology Co., Ltd. <www.allwinnertech.com> +* Tom Cubie <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef _SYS_PROTO_H_ +#define _SYS_PROTO_H_ + +#include <linux/types.h> + +void sr32 (u32 *,u32 ,u32 ,u32 ); +void sdelay (unsigned long ); + +#endif
arch/arm/include/asm/arch-sunxi/timer.h new file +88 -0
88 lines not on this page · raw message
Signature · 1 line
1.8.5.3
PATCH v2 1/9 sunxi: initial sun7i clocks and timer support.
Quoted 3 lines · Ian Campbell
This has been stripped back for mainlining and supports only sun7i. These changes are not useful by themselves but are split out to make the patch sizes more manageable.
[...]
arch/arm/cpu/armv7/sunxi/clock.c line 57
Quoted 13 lines
arch/arm/cpu/armv7/sunxi/clock.c new file +13
-0+int clock_init (void ) +{ +struct sunxi_ccm_reg *const ccm = + (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ; + +#ifdef CONFIG_SPL_BUILD +clock_init_safe (); +#endif + +/* uart clock source is apb1 */ +sr32 (&ccm->apb1_clk_div_cfg,24 ,2 ,APB1_CLK_SRC_OSC24M ); +sr32 (&ccm->apb1_clk_div_cfg,16 ,2 ,APB1_FACTOR_N ); +sr32 (&ccm->apb1_clk_div_cfg,0 ,5 ,APB1_FACTOR_M );
sr32() is not defined anywhere.
Quoted 8 lines
arch/arm/cpu/armv7/sunxi/clock.c new file +8
-0+/* open the clock for uart */ +sr32 (&ccm->apb1_gate,16 +CONFIG_CONS_INDEX -1 ,1 ,CLK_GATE_OPEN ); + +return 0 ; +} + +/* Return PLL5 frequency in Hz +* Note: Assumes PLL5 reference is 24MHz clock
arch/arm/cpu/armv7/sunxi/clock.c line 76
Quoted 10 lines
arch/arm/cpu/armv7/sunxi/clock.c new file +10
-0+*/ +unsigned int clock_get_pll5 (void ) +{ +struct sunxi_ccm_reg *const ccm = + (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ; +uint32_t rval =readl (&ccm->pll5_cfg); +int n = (rval >>8 ) &0x1f ; +int k = ((rval >>4 ) &3 ) +1 ; +int p =1 << ((rval >>16 ) &3 ); +return 24000000 * n * k / p;
Please fix the magic values here.
[...]
Review
Quoted 2 lines
(quoted diff) +2
-0+#ifdef CONFIG_SPL_BUILD +#define PLL1_CFG(N, K, M, P) (1 << 31 | 0 << 30 | 8 << 26 | 0 << 25 |
\
arch/arm/cpu/armv7/sunxi/clock.c line 96
Quoted 2 lines
arch/arm/cpu/armv7/sunxi/clock.c new file +2
-0+16 <<20 | (P ) <<16 |2 <<13 | (N ) <<8 | \ + (K) << 4 | 0 << 3 | 0 << 2 | (M) << 0)
Here is well.
Quoted 1 line
+#define
RDIV(a, b)((a + (b) - 1) / (b))
This is some kind of DIV_ROUND_UP() from include/common.h ?
[...]
Quoted 10 lines
arch/arm/cpu/armv7/sunxi/clock.c new file +10
-0+/* Map divisors to register values */ + axi = axi -1 ; +if (ahb >4 ) + ahb =3 ; +else if (ahb >2 ) + ahb =2 ; +else if (ahb >1 ) + ahb =1 ; +else + ahb =0 ;
arch/arm/cpu/armv7/sunxi/clock.c line 159
Quoted 10 lines
arch/arm/cpu/armv7/sunxi/clock.c new file +10
-0+ + apb0 = apb0 -1 ; + +/* Switch to 24MHz clock while changing PLL1 */ +writel (AXI_DIV_1 <<AXI_DIV_SHIFT | +AHB_DIV_2 <<AHB_DIV_SHIFT | +APB0_DIV_1 <<APB0_DIV_SHIFT | +CPU_CLK_SRC_OSC24M <<CPU_CLK_SRC_SHIFT , + &ccm->cpu_ahb_apb0_cfg); +sdelay (20 );
What is sdelay() function all about ?
[...]
Quoted 5 lines
arch/arm/cpu/armv7/sunxi/timer.c new file +4
-0+static struct sunxi_timer *timer_base = + &((struct sunxi_timer_reg *)SUNXI_TIMER_BASE )->timer[TIMER_NUM ]; + +/* macro to read the 32 bit timer: since it decrements, we invert read value */ +#define
READ_TIMER()(~readl(&timer_base->val))
This macro has to go, just use ~readl() in place. But still, why do you use that negation in "~readl()" anyway ?
[...]
PATCH v2 1/9 sunxi: initial sun7i clocks and timer support.
Quoted 6 lines · Marek Vasut
Quoted 3 lines · Ian Campbell
This has been stripped back for mainlining and supports only sun7i. These changes are not useful by themselves but are split out to make the patch sizes more manageable.
[...]
Quoted 15 lines
arch/arm/cpu/armv7/sunxi/clock.c line 57
Quoted 13 lines
arch/arm/cpu/armv7/sunxi/clock.c new file +13
-0+int clock_init (void ) +{ +struct sunxi_ccm_reg *const ccm = + (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ; + +#ifdef CONFIG_SPL_BUILD +clock_init_safe (); +#endif + +/* uart clock source is apb1 */ +sr32 (&ccm->apb1_clk_div_cfg,24 ,2 ,APB1_CLK_SRC_OSC24M ); +sr32 (&ccm->apb1_clk_div_cfg,16 ,2 ,APB1_FACTOR_N ); +sr32 (&ccm->apb1_clk_div_cfg,0 ,5 ,APB1_FACTOR_M );
sr32()is not defined anywhere.
it should be defined inarch/arm/include/asm/arch-sunxi/sys_proto.h
and comes fromarch/arm/cpu/armv7/syslib.c
it was added for the ti omap's
I've got a local cleanup patch set where I fixed this already to clrsetbits_le32
Quoted 13 lines
Quoted 13 lines
arch/arm/cpu/armv7/sunxi/clock.c new file +12
-0+/* open the clock for uart */ +sr32 (&ccm->apb1_gate,16 +CONFIG_CONS_INDEX -1 ,1 ,CLK_GATE_OPEN ); + +return 0 ; +} + +/* Return PLL5 frequency in Hz +* Note: Assumes PLL5 reference is 24MHz clock +*/ +unsigned int clock_get_pll5 (void ) +{ + struct sunxi_ccm_reg *const ccm =
Quoted 8 lines
arch/arm/cpu/armv7/sunxi/clock.c line 76
Quoted 6 lines
arch/arm/cpu/armv7/sunxi/clock.c new file +6
-0+ (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ; +uint32_t rval =readl (&ccm->pll5_cfg); +int n = (rval >>8 ) &0x1f ; +int k = ((rval >>4 ) &3 ) +1 ; +int p =1 << ((rval >>16 ) &3 ); +return 24000000 * n * k / p;Please fix the magic values here.
[...]
Same here, got that in my local tree too
Quoted 7 lines
Review
Quoted 3 lines
(quoted diff) +2
-0+#ifdef CONFIG_SPL_BUILD +#define PLL1_CFG(N, K, M, P) (1 << 31 | 0 << 30 | 8 << 26 | 0 << 25 |\
arch/arm/cpu/armv7/sunxi/clock.c line 96
Quoted 2 lines
arch/arm/cpu/armv7/sunxi/clock.c new file +2
-0+16 <<20 | (P ) <<16 |2 <<13 | (N ) <<8 | \ + (K) << 4 | 0 << 3 | 0 << 2 | (M) << 0)Here is well.
dito :)
Quoted 5 lines
Quoted 2 lines
+#define
RDIV(a, b)((a + (b) - 1) / (b))This is some kind of
DIV_ROUND_UP()frominclude/common.h?[...]
That one i didn't have;
Ian, I guess you can verify that generic macro works for here?
Quoted 14 lines
Quoted 14 lines
arch/arm/cpu/armv7/sunxi/clock.c new file +13
-0+/* Map divisors to register values */ + axi = axi -1 ; +if (ahb >4 ) + ahb =3 ; +else if (ahb >2 ) + ahb =2 ; +else if (ahb >1 ) + ahb =1 ; +else + ahb =0 ; + + apb0 = apb0 -1 ; +
Quoted 8 lines
arch/arm/cpu/armv7/sunxi/clock.c line 159
Quoted 7 lines
arch/arm/cpu/armv7/sunxi/clock.c new file +7
-0+/* Switch to 24MHz clock while changing PLL1 */ +writel (AXI_DIV_1 <<AXI_DIV_SHIFT | +AHB_DIV_2 <<AHB_DIV_SHIFT | +APB0_DIV_1 <<APB0_DIV_SHIFT | +CPU_CLK_SRC_OSC24M <<CPU_CLK_SRC_SHIFT , + &ccm->cpu_ahb_apb0_cfg); +sdelay (20 );What is
sdelay()function all about ?
It also is fromarch/arm/include/asm/arch-sunxi/sys_proto.h
and I thought all where replaced with udelays
With the sr32 and sdelays gone everywhere, sunxi/sys_proto.h can even go!
Quoted 11 lines
[...]
Quoted 5 lines
arch/arm/cpu/armv7/sunxi/timer.c new file +4
-0+static struct sunxi_timer *timer_base = + &((struct sunxi_timer_reg *)SUNXI_TIMER_BASE )->timer[TIMER_NUM ]; + +/* macro to read the 32 bit timer: since it decrements, we invert read value */ +#define
READ_TIMER()(~readl(&timer_base->val))This macro has to go, just use ~readl() in place. But still, why do you use that negation in "~readl()" anyway ?
Quoted 1 line
[...]
Olliver
PATCH v2 1/9 sunxi: initial sun7i clocks and timer support.
Quoted 29 lines · Olliver Schinagl
Quoted 7 lines · Marek Vasut
Quoted 3 lines · Ian Campbell
This has been stripped back for mainlining and supports only sun7i. These changes are not useful by themselves but are split out to make the patch sizes more manageable.
[...]
Quoted 15 lines
arch/arm/cpu/armv7/sunxi/clock.c line 57
Quoted 13 lines
arch/arm/cpu/armv7/sunxi/clock.c new file +13
-0+int clock_init (void ) +{ +struct sunxi_ccm_reg *const ccm = + (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ; + +#ifdef CONFIG_SPL_BUILD +clock_init_safe (); +#endif + +/* uart clock source is apb1 */ +sr32 (&ccm->apb1_clk_div_cfg,24 ,2 ,APB1_CLK_SRC_OSC24M ); +sr32 (&ccm->apb1_clk_div_cfg,16 ,2 ,APB1_FACTOR_N ); +sr32 (&ccm->apb1_clk_div_cfg,0 ,5 ,APB1_FACTOR_M );
sr32()is not defined anywhere.it should be defined in
arch/arm/include/asm/arch-sunxi/sys_proto.h
and comes fromarch/arm/cpu/armv7/syslib.c
Quoted 4 lines
it was added for the ti omap's
I've got a local cleanup patch set where I fixed this already to
clrsetbits_le32
It's not part of this patch, but then, use clrsetbits_le32() instead of course.
Quoted 22 lines
Quoted 13 lines
Quoted 13 lines
arch/arm/cpu/armv7/sunxi/clock.c new file +13
-0+/* open the clock for uart */ +sr32 (&ccm->apb1_gate,16 +CONFIG_CONS_INDEX -1 ,1 ,CLK_GATE_OPEN ); + +return 0 ; +} + +/* Return PLL5 frequency in Hz +* Note: Assumes PLL5 reference is 24MHz clock +*/ +unsigned int clock_get_pll5 (void ) +{ +struct sunxi_ccm_reg *const ccm = + (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ;Quoted 8 lines
arch/arm/cpu/armv7/sunxi/clock.c line 76
Quoted 5 lines
arch/arm/cpu/armv7/sunxi/clock.c new file +5
-0+uint32_t rval =readl (&ccm->pll5_cfg); +int n = (rval >>8 ) &0x1f ; +int k = ((rval >>4 ) &3 ) +1 ; +int p =1 << ((rval >>16 ) &3 ); +return 24000000 * n * k / p;Please fix the magic values here.
[...]
Quoted 1 line
Same here, got that in my local tree too
Then make it part of the V3 please.
[...]
PATCH v2 1/9 sunxi: initial sun7i clocks and timer support.
In reply to Olliver SchinaglDear Olliver Schinagl,
Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 2 lines
sr32()is not defined anywhere.it should be defined in
arch/arm/include/asm/arch-sunxi/sys_proto.h
and comes fromarch/arm/cpu/armv7/syslib.c
Please avoid using sr32() alltogether. It is basically only used in a single file (arch/arm/cpu/armv7/omap3/clock.c) [plus a single call in board/ti/panda/panda.c] and should be replaced by standard I/O accessor functions. I will prepare a patch to remove it from mainline soon, so better don't start using it.
Thanks.
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de A metaphor is like a simile.
PATCH v2 1/9 sunxi: initial sun7i clocks and timer support.
In reply to Olliver SchinaglOn Mon, 2014-03-24 at 23:42 +0100, Olliver Schinagl wrote:
[...]
Quoted 4 lines
I've got a local cleanup patch set where I fixed this already to
clrsetbits_le32
[...]
Same here, got that in my local tree too
Could you post what you've got please?
Quoted 8 lines
Quoted 6 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+#ifdef CONFIG_SPL_BUILD +#define PLL1_CFG(N, K, M, P) (1 << 31 | 0 << 30 | 8 << 26 | 0 << 25 |\
arch/arm/cpu/armv7/sunxi/clock.c line 96
Quoted 2 lines
arch/arm/cpu/armv7/sunxi/clock.c new file +2
-0+16 <<20 | (P ) <<16 |2 <<13 | (N ) <<8 | \ + (K) << 4 | 0 << 3 | 0 << 2 | (M) << 0)Here is well.
dito :)
Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
+#define
RDIV(a, b)((a + (b) - 1) / (b))This is some kind of
DIV_ROUND_UP()frominclude/common.h?[...]
That one i didn't have;
Ian, I guess you can verify that generic macro works for here?
Yeah, I'll look into that and all the other feedback from Marek.
Ian.
PATCH v2 1/9 sunxi: initial sun7i clocks and timer support.
In reply to Olliver SchinaglQuoted 9 lines · Olliver Schinagl
Quoted 8 lines · Marek Vasut
arch/arm/cpu/armv7/sunxi/clock.c line 159
Quoted 7 lines
arch/arm/cpu/armv7/sunxi/clock.c new file +7
-0+/* Switch to 24MHz clock while changing PLL1 */ +writel (AXI_DIV_1 <<AXI_DIV_SHIFT | +AHB_DIV_2 <<AHB_DIV_SHIFT | +APB0_DIV_1 <<APB0_DIV_SHIFT | +CPU_CLK_SRC_OSC24M <<CPU_CLK_SRC_SHIFT , + &ccm->cpu_ahb_apb0_cfg); +sdelay (20 );What is
sdelay()function all about ?
Quoted 3 lines
It also is from
arch/arm/include/asm/arch-sunxi/sys_proto.h
and I thought all where replaced with udelays
Since these sdelays() are used while we are frobbing around with the clocks I'm not sure that switching to udelay is possible/wise. sdelay is documented as:
* sdelay() - simple spin loop. Will be constant time as
* its generally used in bypass conditions only. This
* is necessary until timers are accessible.
IOW it sounds like it is designed to be used in exactly these circumstances.
Given the lack of documentation for what is actually required by the hardware when changing these clocks I'm a bit reluctant to go changing things.
Ian.
PATCH v2 1/9 sunxi: initial sun7i clocks and timer support.
Quoted 23 lines · Ian Campbell
Quoted 11 lines · Olliver Schinagl
Quoted 9 lines · Marek Vasut
arch/arm/cpu/armv7/sunxi/clock.c line 159
Quoted 7 lines
arch/arm/cpu/armv7/sunxi/clock.c new file +7
-0+/* Switch to 24MHz clock while changing PLL1 */ +writel (AXI_DIV_1 <<AXI_DIV_SHIFT | +AHB_DIV_2 <<AHB_DIV_SHIFT | +APB0_DIV_1 <<APB0_DIV_SHIFT | +CPU_CLK_SRC_OSC24M <<CPU_CLK_SRC_SHIFT , + &ccm->cpu_ahb_apb0_cfg); +sdelay (20 );What is
sdelay()function all about ?Quoted 3 lines
It also is from
arch/arm/include/asm/arch-sunxi/sys_proto.h
and I thought all where replaced with udelaysSince these
sdelays()are used while we are frobbing around with the clocks I'm not sure that switching to udelay is possible/wise. sdelay is documented as:
*sdelay()- simple spin loop. Will be constant time as
* its generally used in bypass conditions only. This
* is necessary until timers are accessible.
Quoted 6 lines
IOW it sounds like it is designed to be used in exactly these circumstances.
Given the lack of documentation for what is actually required by the hardware when changing these clocks I'm a bit reluctant to go changing things.
Don't you have an clock-agnostic timer in the chip ? If not, well, can't be helped.
Best regards,
Marek Vasut
PATCH v2 1/9 sunxi: initial sun7i clocks and timer support.
In reply to Marek VasutQuoted 6 lines · Marek Vasut
Quoted 3 lines · Ian Campbell
This has been stripped back for mainlining and supports only sun7i. These changes are not useful by themselves but are split out to make the patch sizes more manageable.
[...]
Thanks for all your feedback here and on the other patches, I'll sort it all out.
Ian.
PATCH v2 1/9 sunxi: initial sun7i clocks and timer support.
In reply to Marek VasutQuoted 8 lines · Marek Vasut
Quoted 5 lines
arch/arm/cpu/armv7/sunxi/timer.c new file +4
-0+static struct sunxi_timer *timer_base = + &((struct sunxi_timer_reg *)SUNXI_TIMER_BASE )->timer[TIMER_NUM ]; + +/* macro to read the 32 bit timer: since it decrements, we invert read value */ +#define
READ_TIMER()(~readl(&timer_base->val))This macro has to go, just use ~readl() in place. But still, why do you use that negation in "~readl()" anyway ?
The comment right above it explains why: the timer counts backwards and inverting it accounts for that.
This is subtle enough that I don't think using ~readl() in place in the 3 callers would be an improvement.
Ian.
PATCH v2 1/9 sunxi: initial sun7i clocks and timer support.
Quoted 10 lines · Ian Campbell
Quoted 8 lines · Marek Vasut
Quoted 5 lines
arch/arm/cpu/armv7/sunxi/timer.c new file +4
-0+static struct sunxi_timer *timer_base = + &((struct sunxi_timer_reg *)SUNXI_TIMER_BASE )->timer[TIMER_NUM ]; + +/* macro to read the 32 bit timer: since it decrements, we invert read value */ +#define
READ_TIMER()(~readl(&timer_base->val))This macro has to go, just use ~readl() in place. But still, why do you use that negation in "~readl()" anyway ?
Quoted 5 lines
The comment right above it explains why: the timer counts backwards and inverting it accounts for that.
This is subtle enough that I don't think using ~readl() in place in the 3 callers would be an improvement.
Please do it, we don't want any implementers down the line using this "READ_TIMER()" call and getting hit by "timer_base undefined" . That macro hides the dependency on this symbol, while if you expanded it in-place, the dependency would be explicit. I really do want to see that macro gone, sorry.
Best regards,
Marek Vasut
PATCH v2 1/9 sunxi: initial sun7i clocks and timer support.
Quoted 14 lines · Marek Vasut
Quoted 13 lines · Ian Campbell
Quoted 8 lines · Marek Vasut
Quoted 5 lines
arch/arm/cpu/armv7/sunxi/timer.c new file +4
-0+static struct sunxi_timer *timer_base = + &((struct sunxi_timer_reg *)SUNXI_TIMER_BASE )->timer[TIMER_NUM ]; + +/* macro to read the 32 bit timer: since it decrements, we invert read value */ +#define
READ_TIMER()(~readl(&timer_base->val))This macro has to go, just use ~readl() in place. But still, why do you use that negation in "~readl()" anyway ?
The comment right above it explains why: the timer counts backwards and inverting it accounts for that.
Quoted 7 lines
Quoted 2 lines
This is subtle enough that I don't think using ~readl() in place in the 3 callers would be an improvement.
Please do it, we don't want any implementers down the line using this "
READ_TIMER()" call and getting hit by "timer_baseundefined" . That macro hides the dependency on this symbol, while if you expanded it in-place, the dependency would be explicit. I really do want to see that macro gone, sorry.
How about a static inline instead of the macro? I'm thinking with a body:
{
struct sunxi_timer *timers =
(struct sunxi_timer_reg *)SUNXI_TIMER_BASE;
return timers[TIMER_NUM]->val;
}With something similar in timer_init then both the macro and the static global timer_base can be dropped.
BTW this macro is in arch/arm/cpu/armv7/sunxi/timer.c not a header, so I'm not sure which implementers down the line you were worried about using it in some other context where it breaks.
Ian.
PATCH v2 1/9 sunxi: initial sun7i clocks and timer support.
Quoted 26 lines · Ian Campbell
Quoted 14 lines · Marek Vasut
Quoted 13 lines · Ian Campbell
Quoted 8 lines · Marek Vasut
Quoted 5 lines
(quoted diff) +2
-0+static struct sunxi_timer *timer_base = + &((struct sunxi_timer_reg*)SUNXI_TIMER_BASE)->timer[TIMER_NUM]; +
+/* macro to read the 32 bit timer: since it decrements, we invert read value */ +#defineREAD_TIMER()(~readl(&timer_base->val))This macro has to go, just use ~readl() in place. But still, why do you use that negation in "~readl()" anyway ?
The comment right above it explains why: the timer counts backwards and inverting it accounts for that.
Quoted 8 lines
Quoted 2 lines
This is subtle enough that I don't think using ~readl() in place in the 3 callers would be an improvement.
Please do it, we don't want any implementers down the line using this "
READ_TIMER()" call and getting hit by "timer_baseundefined" . That macro hides the dependency on this symbol, while if you expanded it in-place, the dependency would be explicit. I really do want to see that macro gone, sorry.How about a static inline instead of the macro? I'm thinking with a body:
Quoted 7 lines
{ struct sunxi_timer *timers = (struct sunxi_timer_reg *)SUNXI_TIMER_BASE; return timers[TIMER_NUM]->val; }With something similar in
timer_initthen both the macro and the static globaltimer_basecan be dropped.
That's just wrapping a readl() into another function, which seems unnecessary really.
Quoted 3 lines
BTW this macro is in
arch/arm/cpu/armv7/sunxi/timer.cnot a header, so I'm not sure which implementers down the line you were worried about using it in some other context where it breaks.
People plumbing in the timer.c file who are not aware the macro has a dependency which is not passed as it's parameter.
Best regards,
Marek Vasut
PATCH v2 1/9 sunxi: initial sun7i clocks and timer support.
Quoted 35 lines · Marek Vasut
Quoted 26 lines · Ian Campbell
Quoted 14 lines · Marek Vasut
Quoted 13 lines · Ian Campbell
Quoted 8 lines · Marek Vasut
Quoted 5 lines
(quoted diff) +2
-0+static struct sunxi_timer *timer_base = + &((struct sunxi_timer_reg*)SUNXI_TIMER_BASE)->timer[TIMER_NUM]; +
+/* macro to read the 32 bit timer: since it decrements, we invert read value */ +#defineREAD_TIMER()(~readl(&timer_base->val))This macro has to go, just use ~readl() in place. But still, why do you use that negation in "~readl()" anyway ?
The comment right above it explains why: the timer counts backwards and inverting it accounts for that.
Quoted 8 lines
Quoted 2 lines
This is subtle enough that I don't think using ~readl() in place in the 3 callers would be an improvement.
Please do it, we don't want any implementers down the line using this "
READ_TIMER()" call and getting hit by "timer_baseundefined" . That macro hides the dependency on this symbol, while if you expanded it in-place, the dependency would be explicit. I really do want to see that macro gone, sorry.How about a static inline instead of the macro? I'm thinking with a body:
Quoted 7 lines
{ struct sunxi_timer *timers = (struct sunxi_timer_reg *)SUNXI_TIMER_BASE; return timers[TIMER_NUM]->val; }With something similar in
timer_initthen both the macro and the static globaltimer_basecan be dropped.
Quoted 2 lines
That's just wrapping a
readl()into another function, which seems unnecessary really.
Sorry, but I think inlining the readl (and along with it the interesting/subtle) inverting functionality is a terrible idea, it should be wrapped in some sort of accessor precisely because it is not a raw readl.
I'm going to make it a function as I suggested.
Quoted 6 lines
Quoted 3 lines
BTW this macro is in
arch/arm/cpu/armv7/sunxi/timer.cnot a header, so I'm not sure which implementers down the line you were worried about using it in some other context where it breaks.People plumbing in the
timer.cfile who are not aware the macro has a dependency which is not passed as it's parameter.
What people? What plumbing? I've no idea what you are concerned about here.
Ian.
PATCH v2 1/9 sunxi: initial sun7i clocks and timer support.
Quoted 55 lines · Ian Campbell
Quoted 34 lines · Marek Vasut
Quoted 33 lines · Ian Campbell
Quoted 15 lines · Marek Vasut
Quoted 14 lines · Ian Campbell
Quoted 9 lines · Marek Vasut
Quoted 6 lines
(quoted diff) +2
-0+static struct sunxi_timer *timer_base = + &((struct sunxi_timer_reg*)SUNXI_TIMER_BASE)->timer[TIMER_NUM]; +
+/* macro to read the 32 bit timer: since it decrements, we invert read value */ +#defineREAD_TIMER()(~readl(&timer_base->val))This macro has to go, just use ~readl() in place. But still, why do you use that negation in "~readl()" anyway ?
The comment right above it explains why: the timer counts backwards and inverting it accounts for that.
Quoted 8 lines
Quoted 2 lines
This is subtle enough that I don't think using ~readl() in place in the 3 callers would be an improvement.
Please do it, we don't want any implementers down the line using this "
READ_TIMER()" call and getting hit by "timer_baseundefined" . That macro hides the dependency on this symbol, while if you expanded it in-place, the dependency would be explicit. I really do want to see that macro gone, sorry.How about a static inline instead of the macro? I'm thinking with a body:
{struct
sunxi_timer*timers =(struct
sunxi_timer_reg*)SUNXI_TIMER_BASE;Quoted 8 lines
Quoted 5 lines
return timers[TIMER_NUM]->val;}
With something similar intimer_initthen both the macro and the static globaltimer_basecan be dropped.That's just wrapping a
readl()into another function, which seems unnecessary really.Sorry, but I think inlining the readl (and along with it the interesting/subtle) inverting functionality is a terrible idea, it should be wrapped in some sort of accessor precisely because it is not a raw readl.
I'm going to make it a function as I suggested.
Quoted 4 lines
Quoted 3 lines
BTW this macro is in
arch/arm/cpu/armv7/sunxi/timer.cnot a header, so I'm not sure which implementers down the line you were worried about using it in some other context where it breaks.
Quoted 5 lines
Quoted 2 lines
People plumbing in the
timer.cfile who are not aware the macro has a dependency which is not passed as it's parameter.What people? What plumbing? I've no idea what you are concerned about here.
OK, I will wait for V3 of the patch since this discussion have gone awry . Let's talk about V3 , ok ? :)
Best regards,
Marek Vasut
PATCH v2 1/9 sunxi: initial sun7i clocks and timer support.
In reply to Ian CampbellHi,
Quoted 50 lines · Ian Campbell
Quoted 35 lines · Marek Vasut
Quoted 26 lines · Ian Campbell
Quoted 14 lines · Marek Vasut
Quoted 13 lines · Ian Campbell
Quoted 8 lines · Marek Vasut
Quoted 5 lines
(quoted diff) +2
-0+static struct sunxi_timer *timer_base = + &((struct sunxi_timer_reg*)SUNXI_TIMER_BASE)->timer[TIMER_NUM]; +
+/* macro to read the 32 bit timer: since it decrements, we invert read value */ +#defineREAD_TIMER()(~readl(&timer_base->val))This macro has to go, just use ~readl() in place. But still, why do you use that negation in "~readl()" anyway ?
The comment right above it explains why: the timer counts backwards and inverting it accounts for that.
Quoted 8 lines
Quoted 2 lines
This is subtle enough that I don't think using ~readl() in place in the 3 callers would be an improvement.
Please do it, we don't want any implementers down the line using this "
READ_TIMER()" call and getting hit by "timer_baseundefined" . That macro hides the dependency on this symbol, while if you expanded it in-place, the dependency would be explicit. I really do want to see that macro gone, sorry.How about a static inline instead of the macro? I'm thinking with a body:
Quoted 7 lines
{ struct sunxi_timer *timers = (struct sunxi_timer_reg *)SUNXI_TIMER_BASE; return timers[TIMER_NUM]->val; }With something similar in
timer_initthen both the macro and the static globaltimer_basecan be dropped.Quoted 2 lines
That's just wrapping a
readl()into another function, which seems unnecessary really.Sorry, but I think inlining the readl (and along with it the interesting/subtle) inverting functionality is a terrible idea, it should be wrapped in some sort of accessor precisely because it is not a raw readl.
I'm going to make it a function as I suggested.
Quoted 4 lines
Quoted 3 lines
BTW this macro is in
arch/arm/cpu/armv7/sunxi/timer.cnot a header, so I'm not sure which implementers down the line you were worried about using it in some other context where it breaks.
Quoted 5 lines
Quoted 2 lines
People plumbing in the
timer.cfile who are not aware the macro has a dependency which is not passed as it's parameter.What people? What plumbing? I've no idea what you are concerned about here.
I think what Marek is concerned about is people making some global u-boot change which for some reason requires fixing up a bunch of platform specific files, and they end up touching our timer.c without ever test-compiling it.
These kind of things happen in qemu / the kernel too. In this case they could move a READ_TIMER() somewhere where the timer_base is not defined. Your suggestion of making it a proper function will fix that though, and I think is the best solution.
Regards,
Hans
PATCH v2 1/9 sunxi: initial sun7i clocks and timer support.
Quoted 60 lines · Hans de Goede
Hi,
Quoted 57 lines · Ian Campbell
Quoted 33 lines · Marek Vasut
Quoted 32 lines · Ian Campbell
Quoted 14 lines · Marek Vasut
Quoted 13 lines · Ian Campbell
Quoted 8 lines · Marek Vasut
Quoted 5 lines
(quoted diff) +2
-0+static struct sunxi_timer *timer_base = + &((struct sunxi_timer_reg*)SUNXI_TIMER_BASE)->timer[TIMER_NUM]; +
+/* macro to read the 32 bit timer: since it decrements, we invert read value */ +#defineREAD_TIMER()(~readl(&timer_base->val))This macro has to go, just use ~readl() in place. But still, why do you use that negation in "~readl()" anyway ?
The comment right above it explains why: the timer counts backwards and inverting it accounts for that.
Quoted 8 lines
Quoted 2 lines
This is subtle enough that I don't think using ~readl() in place in the 3 callers would be an improvement.
Please do it, we don't want any implementers down the line using this "
READ_TIMER()" call and getting hit by "timer_baseundefined" . That macro hides the dependency on this symbol, while if you expanded it in-place, the dependency would be explicit. I really do want to see that macro gone, sorry.How about a static inline instead of the macro? I'm thinking with a body:
{struct
sunxi_timer*timers =(struct
sunxi_timer_reg*)SUNXI_TIMER_BASE;Quoted 8 lines
Quoted 5 lines
return timers[TIMER_NUM]->val;}
With something similar intimer_initthen both the macro and the static globaltimer_basecan be dropped.That's just wrapping a
readl()into another function, which seems unnecessary really.Sorry, but I think inlining the readl (and along with it the interesting/subtle) inverting functionality is a terrible idea, it should be wrapped in some sort of accessor precisely because it is not a raw readl.
I'm going to make it a function as I suggested.
Quoted 6 lines
Quoted 3 lines
BTW this macro is in
arch/arm/cpu/armv7/sunxi/timer.cnot a header, so I'm not sure which implementers down the line you were worried about using it in some other context where it breaks.People plumbing in the
timer.cfile who are not aware the macro has a dependency which is not passed as it's parameter.
Quoted 7 lines
Quoted 2 lines
What people? What plumbing? I've no idea what you are concerned about here.
I think what Marek is concerned about is people making some global u-boot change which for some reason requires fixing up a bunch of platform specific files, and they end up touching our
timer.cwithout ever test-compiling it.
We don't do such changes without test-compiling those (most of us don't and those who do ... well ... tsk tsk tsk ! ;-) ).
Quoted 2 lines
These kind of things happen in qemu / the kernel too. In this case they could move a
READ_TIMER()somewhere where thetimer_baseis not defined.
Yeah.
Quoted 2 lines
Your suggestion of making it a proper function will fix that though, and I think is the best solution.
I think wrapping a plain readl() into a function is not necessary, but I will wait for V3 to see it in action and then I will decide .
PATCH v2 2/9 sunxi: initial sun7i pinmux and gpio support
In reply to Ian CampbellThis has been stripped back for mainlining and supports only sun7i. These changes are not useful by themselves but are split out to make the patch sizes more manageable.
As well as the following signed-off-by the sunxi branch shows commits to these files authored by the following:
Carl van Schaik
Henrik Nordstrom
Stefan Roese
Tom Cubie
---
v2: Based on u-boot-sunxi.git#sunxi d9aa5dd3d15c "sunxi: mmc:
checkpatch whitespace fixes" with v2014.04-rc2 merged in:
- Additional pin definitions
v1: Based on u-boot-sunxi.git#sunxi commit d854c4de2f57 "arm: Handle .gnu.hash section in ldscripts" vs v2014.01.
--- arch/arm/cpu/armv7/sunxi/Makefile | 1 + arch/arm/cpu/armv7/sunxi/pinmux.c | 80 ++++++++++++++++++ arch/arm/include/asm/arch-sunxi/gpio.h | 145 +++++++++++++++++++++++++++++++++ 3 files changed, 226 insertions(+) create mode 100644 arch/arm/cpu/armv7/sunxi/pinmux.c create mode 100644 arch/arm/include/asm/arch-sunxi/gpio.h
arch/arm/cpu/armv7/sunxi/Makefile +1 -0
@@ -9,3 +9,4 @@ # obj-y += timer.o obj-y += clock.o +obj-y += pinmux.o
arch/arm/cpu/armv7/sunxi/pinmux.c new file +80 -0
80 lines not on this page · raw message
arch/arm/include/asm/arch-sunxi/gpio.h new file +145 -0
145 lines not on this page · raw message
Signature · 1 line
1.8.5.3
PATCH v2 2/9 sunxi: initial sun7i pinmux and gpio support
On Friday, March 21, 2014 at 10:54:19 PM, Ian Campbell wrote:
[...]
Quoted 22 lines
(quoted diff) +0
-0
b/arch/arm/cpu/armv7/sunxi/pinmux.cnew file mode 100644 index 0000000..8f5cbfearch/arm/cpu/armv7/sunxi/pinmux.c new file +16
-0@@ -0,0 +1,80 @@ +/* +* (C) Copyright 2007-2011 +* Allwinner Technology Co., Ltd. <www.allwinnertech.com> +* Tom Cubie <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/gpio.h> + +int sunxi_gpio_set_cfgpin (u32 pin,u32 val) +{ +u32 cfg; +u32 bank =GPIO_BANK (pin);
arch/arm/cpu/armv7/sunxi/pinmux.c line 26
Quoted 10 lines
arch/arm/cpu/armv7/sunxi/pinmux.c new file +10
-0+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 &= ~(0xf << offset); + cfg |= val << offset; + +writel (cfg, &pio->cfg[0 ] + index);
clrsetbits_le32() here.
Quoted 22 lines
arch/arm/cpu/armv7/sunxi/pinmux.c new file +22
-0+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; + +return cfg &0xf ; +} + +int sunxi_gpio_set_drv (u32 pin,u32 val) +{ +u32 drv; +u32 bank =GPIO_BANK (pin);
arch/arm/cpu/armv7/sunxi/pinmux.c line 59
Quoted 10 lines
arch/arm/cpu/armv7/sunxi/pinmux.c new file +10
-0+u32 index =GPIO_DRV_INDEX (pin); +u32 offset =GPIO_DRV_OFFSET (pin); +struct sunxi_gpio *pio = + &((struct sunxi_gpio_reg *)SUNXI_PIO_BASE )->gpio_bank[bank]; + + drv =readl (&pio->drv[0 ] + index); + drv &= ~(0x3 << offset); + drv |= val << offset; + +writel (drv, &pio->drv[0 ] + index);
Here as well.
Quoted 7 lines
arch/arm/cpu/armv7/sunxi/pinmux.c new file +7
-0+return 0 ; +} + +int sunxi_gpio_set_pull (u32 pin,u32 val) +{ +u32 pull; +u32 bank =GPIO_BANK (pin);
arch/arm/cpu/armv7/sunxi/pinmux.c line 77
Quoted 10 lines
arch/arm/cpu/armv7/sunxi/pinmux.c new file +10
-0+u32 index =GPIO_PULL_INDEX (pin); +u32 offset =GPIO_PULL_OFFSET (pin); +struct sunxi_gpio *pio = + &((struct sunxi_gpio_reg *)SUNXI_PIO_BASE )->gpio_bank[bank]; + + pull =readl (&pio->pull[0 ] + index); + pull &= ~(0x3 << offset); + pull |= val << offset; + +writel (pull, &pio->pull[0 ] + index);
Same here.
Quoted 2 lines
arch/arm/cpu/armv7/sunxi/pinmux.c new file +2
-0+return 0 ; +}
[...]
arch/arm/cpu/armv7/sunxi/pinmux.c
Quoted 6 lines
arch/arm/cpu/armv7/sunxi/pinmux.c new file +6
-0+int sunxi_gpio_set_cfgpin (u32 pin,u32 val); +int sunxi_gpio_get_cfgpin (u32 pin); +int sunxi_gpio_set_drv (u32 pin,u32 val); +int sunxi_gpio_set_pull (u32 pin,u32 val); +int name_to_gpio (const char *name); +#define name_to_gpio name_to_gpio
What is this ugly define doing here ?
PATCH v2 2/9 sunxi: initial sun7i pinmux and gpio support
Quoted 7 lines · Marek Vasut
arch/arm/cpu/armv7/sunxi/pinmux.c line 26
Quoted 5 lines
arch/arm/cpu/armv7/sunxi/pinmux.c new file +5
-0+ cfg =readl (&pio->cfg[0 ] + index); + cfg &= ~(0xf << offset); + cfg |= val << offset; + +writel (cfg, &pio->cfg[0 ] + index);
clrsetbits_le32()here.
I looked at this transform in a few different contexts and one concern I had was that readl and writel have barriers in them (after the read and before the write respectively) while clrsetbits and friends do not. I don't think this will matter for the read/modify/write bit twiddling itself (since there are register dependencies) but I was slightly concerned that the barriers were hiding the lack of explicit barriers which would be required between the various reads/writes.
But I think I am probably being overly cautious here and the obvious transformation can be made. Anyone got any thoughts?
Ian.
PATCH v2 2/9 sunxi: initial sun7i pinmux and gpio support
Quoted 17 lines · Ian Campbell
Quoted 7 lines · Marek Vasut
arch/arm/cpu/armv7/sunxi/pinmux.c line 26
Quoted 5 lines
arch/arm/cpu/armv7/sunxi/pinmux.c new file +5
-0+ cfg =readl (&pio->cfg[0 ] + index); + cfg &= ~(0xf << offset); + cfg |= val << offset; + +writel (cfg, &pio->cfg[0 ] + index);
clrsetbits_le32()here.I looked at this transform in a few different contexts and one concern I had was that readl and writel have barriers in them (after the read and before the write respectively) while clrsetbits and friends do not. I don't think this will matter for the read/modify/write bit twiddling itself (since there are register dependencies) but I was slightly concerned that the barriers were hiding the lack of explicit barriers which would be required between the various reads/writes.
Quoted 2 lines
But I think I am probably being overly cautious here and the obvious transformation can be made. Anyone got any thoughts?
+CC Tom, Albert .
Best regards,
Marek Vasut
PATCH v2 2/9 sunxi: initial sun7i pinmux and gpio support
In reply to Ian CampbellDear Ian,
[Cc: list truncated / changed]
Quoted 4 lines · In message <[email protected]> you wrote:
I looked at this transform in a few different contexts and one concern I had was that readl and writel have barriers in them (after the read and before the write respectively) while clrsetbits and friends do not. I
They are supposed to. They map to the out_##type() / in_##type() standard I/O accessors which are supposed to be suitable to access device registers.
I can see that the ARM implementation maps this to __raw_write##type() / __raw_read##type() and then to __arch_put##type() / __arch_get##type() which indeed do not include MBs.
Quoted 2 lines
But I think I am probably being overly cautious here and the obvious transformation can be made. Anyone got any thoughts?
I'm not an expert for ARM, but this indeed looks suspiscious - thanks for reporting this.
It is conspicuous that Linux does not use out_##type() / in_##type() for ARM, and instead uses iowrite##type() / ioread##type() - which do include MBs.
Albert - what do you think?
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Drun'? 'm not drun'! You woudn' dare call m' drun' if I was sober!
- Terry Pratchett, _Men at Arms_PATCH v2 2/9 sunxi: initial sun7i pinmux and gpio support
Quoted 2 lines · Wolfgang Denk
I'm not an expert for ARM, but this indeed looks suspiscious - thanks for reporting this.
FYI I made the change which prompted this and the resulting code was the same see https://groups.google.com/forum/#!topic/linux-sunxi/REZ18q0wcDY
The barriers were only ever compile barrier() type, not cpu barriers.
So the open coded thing was effectively:
v = read();
barrier();
v = fiddlebits(b)
barrier();
write(v);Whereas the code using clrsetbits is basically:
write(fiddlebits(read()))
Which I think is OK in this case at least. Not sure about the general case.
Ian.
PATCH v2 2/9 sunxi: initial sun7i pinmux and gpio support
In reply to Marek VasutQuoted 8 lines · Marek Vasut
arch/arm/include/asm/arch-sunxi/gpio.h line 143
Quoted 6 lines
arch/arm/include/asm/arch-sunxi/gpio.h new file +6
-0+int sunxi_gpio_set_cfgpin (u32 pin,u32 val); +int sunxi_gpio_get_cfgpin (u32 pin); +int sunxi_gpio_set_drv (u32 pin,u32 val); +int sunxi_gpio_set_pull (u32 pin,u32 val); +int name_to_gpio (const char *name); +#define name_to_gpio name_to_gpioWhat is this ugly define doing here ?
common/cmd_gpio.c uses the #ifndef name_to_gpio pattern to provide (or not) a default fallback implementation. I think this is a reasonably (but not very) common idiom for such cases where the non-default variant is not best expressed as a macro.
Ian.
PATCH v2 2/9 sunxi: initial sun7i pinmux and gpio support
Quoted 10 lines · Ian Campbell
Quoted 8 lines · Marek Vasut
arch/arm/include/asm/arch-sunxi/gpio.h line 143
Quoted 6 lines
arch/arm/include/asm/arch-sunxi/gpio.h new file +6
-0+int sunxi_gpio_set_cfgpin (u32 pin,u32 val); +int sunxi_gpio_get_cfgpin (u32 pin); +int sunxi_gpio_set_drv (u32 pin,u32 val); +int sunxi_gpio_set_pull (u32 pin,u32 val); +int name_to_gpio (const char *name); +#define name_to_gpio name_to_gpioWhat is this ugly define doing here ?
Quoted 4 lines
common/cmd_gpio.cuses the #ifndefname_to_gpiopattern to provide (or not) a default fallback implementation. I think this is a reasonably (but not very) common idiom for such cases where the non-default variant is not best expressed as a macro.
This should be fixed, the name_to_gpio() there should be replaced by a __weak function. (patch is welcome)
Nonetheless, in your case, please don't do #define FOO FOO, but choose some sensible name for the function.
Best regards,
Marek Vasut
PATCH v2 2/9 sunxi: initial sun7i pinmux and gpio support
In reply to Ian CampbellDear Ian Campbell,
Quoted 11 lines · In message <[email protected]> you wrote:
Quoted 8 lines · Marek Vasut
arch/arm/include/asm/arch-sunxi/gpio.h line 143
Quoted 6 lines
arch/arm/include/asm/arch-sunxi/gpio.h new file +6
-0+int sunxi_gpio_set_cfgpin (u32 pin,u32 val); +int sunxi_gpio_get_cfgpin (u32 pin); +int sunxi_gpio_set_drv (u32 pin,u32 val); +int sunxi_gpio_set_pull (u32 pin,u32 val); +int name_to_gpio (const char *name); +#define name_to_gpio name_to_gpioWhat is this ugly define doing here ?
Quoted 4 lines
common/cmd_gpio.cuses the #ifndefname_to_gpiopattern to provide (or not) a default fallback implementation. I think this is a reasonably (but not very) common idiom for such cases where the non-default variant is not best expressed as a macro.
Please add a comment to explain that.
Thanks.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de EMACS belongs in <sys/errno.h>: Editor too big!
PATCH v2 2/9 sunxi: initial sun7i pinmux and gpio support
Quoted 14 lines · Wolfgang Denk
Dear Ian Campbell,
Quoted 11 lines · In message <[email protected]> you wrote:
Quoted 8 lines · Marek Vasut
arch/arm/include/asm/arch-sunxi/gpio.h line 143
Quoted 6 lines
arch/arm/include/asm/arch-sunxi/gpio.h new file +6
-0+int sunxi_gpio_set_cfgpin (u32 pin,u32 val); +int sunxi_gpio_get_cfgpin (u32 pin); +int sunxi_gpio_set_drv (u32 pin,u32 val); +int sunxi_gpio_set_pull (u32 pin,u32 val); +int name_to_gpio (const char *name); +#define name_to_gpio name_to_gpioWhat is this ugly define doing here ?
Quoted 6 lines
Quoted 4 lines
common/cmd_gpio.cuses the #ifndefname_to_gpiopattern to provide (or not) a default fallback implementation. I think this is a reasonably (but not very) common idiom for such cases where the non-default variant is not best expressed as a macro.Please add a comment to explain that.
Unless you object I think I'll do as Marek suggested name the function sunxi_name_to_gpio and make the #define to that, it seems more consistent that way.
Ian.
PATCH v2 2/9 sunxi: initial sun7i pinmux and gpio support
Quoted 19 lines · Ian Campbell
Quoted 18 lines · Wolfgang Denk
Dear Ian Campbell,
Quoted 14 lines · In message <[email protected]> you wrote:
Quoted 8 lines · Marek Vasut
arch/arm/include/asm/arch-sunxi/gpio.h line 143
Quoted 6 lines
arch/arm/include/asm/arch-sunxi/gpio.h new file +6
-0+int sunxi_gpio_set_cfgpin (u32 pin,u32 val); +int sunxi_gpio_get_cfgpin (u32 pin); +int sunxi_gpio_set_drv (u32 pin,u32 val); +int sunxi_gpio_set_pull (u32 pin,u32 val); +int name_to_gpio (const char *name); +#define name_to_gpio name_to_gpioWhat is this ugly define doing here ?
common/cmd_gpio.cuses the #ifndefname_to_gpiopattern to provide (or not) a default fallback implementation. I think this is a reasonably (but not very) common idiom for such cases where the non-default variant is not best expressed as a macro.
Quoted 5 lines
Quoted 1 line
Please add a comment to explain that.
Unless you object I think I'll do as Marek suggested name the function
sunxi_name_to_gpioand make the #define to that, it seems more consistent that way.
I'd suggest you fix cmd_gpio.c while at it too ;-)
Best regards,
Marek Vasut
PATCH v2 2/9 sunxi: initial sun7i pinmux and gpio support
In reply to Ian CampbellDear Ian Campbell,
Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 2 lines
Please add a comment to explain that.
Unless you object I think I'll do as Marek suggested name the function
sunxi_name_to_gpioand make the #define to that, it seems more consistent that way.
That's better, indeed. Thanks.
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
In any group of employed individuals the only naturally early riser
is _always_ the office manager, who will _always_ leave reproachful
little notes ... on the desks of their subordinates.
- Terry Pratchett, _Lords and Ladies_PATCH v2 3/9 sunxi: initial sun7i dram setup support
In reply to Ian CampbellThis has been stripped back for mainlining and supports only sun7i. These changes are not useful by themselves but are split out to make the patch sizes more manageable.
As well as the following signed-off-by the sunxi branch shows commits to these files authored by the following:
Alejandro Mery
Carl van Schaik
Tom Cubie
---
v2: Based on u-boot-sunxi.git#sunxi d9aa5dd3d15c "sunxi: mmc:
checkpatch whitespace fixes" with v2014.04-rc2 merged in:
- remove redundant braces in mctl_ddr3_reset
- remove incorrect call to mctl_ddr3_reset.
- add CONFIG_SUN7I to simplify future SUN?I support.
- add a comment about the magic numbers from the a/w code dumps
- fix a bunch of checkpatch.pl issues
v1: Based on u-boot-sunxi.git#sunxi commit d854c4de2f57 "arm: Handle .gnu.hash section in ldscripts" vs v2014.01.
--- arch/arm/cpu/armv7/sunxi/Makefile | 1 + arch/arm/cpu/armv7/sunxi/dram.c | 548 +++++++++++++++++++++++++++++++++ arch/arm/include/asm/arch-sunxi/dram.h | 175 +++++++++++ 3 files changed, 724 insertions(+) create mode 100644 arch/arm/cpu/armv7/sunxi/dram.c create mode 100644 arch/arm/include/asm/arch-sunxi/dram.h
arch/arm/cpu/armv7/sunxi/Makefile +1 -0
@@ -8,5 +8,6 @@ # SPDX-License-Identifier: GPL-2.0+ # obj-y += timer.o +obj-y += dram.o obj-y += clock.o obj-y += pinmux.o
arch/arm/cpu/armv7/sunxi/dram.c new file +548 -0
548 lines not on this page · raw message
arch/arm/include/asm/arch-sunxi/dram.h new file +175 -0
175 lines not on this page · raw message
Signature · 1 line
1.8.5.3
PATCH v2 4/9 sunxi: initial generic sun7i cpu, board and start of day support
In reply to Ian CampbellThis has been stripped back for mainlining and supports only sun7i. These changes are not useful by themselves but are split out to make the patch sizes more manageable.
As well as the following signed-off-by the sunxi branch shows commits to these files authored by the following:
Almo Nito
Carl van Schaik
FUKAUMI Naoki
hehopmajieh
j
Sergey Lapin
Tom Cubie
---
v2: Based on u-boot-sunxi.git#sunxi d9aa5dd3d15c "sunxi: mmc:
checkpatch whitespace fixes" with v2014.04-rc2 merged in:
- just init dram once
- remove clock ramping until power control is implemented
- add CONFIG_SUN7I to simplify future SUN?I support.
- fix a typo
v1: Based on u-boot-sunxi.git#sunxi commit d854c4de2f57 "arm: Handle .gnu.hash section in ldscripts" vs v2014.01.
--- arch/arm/cpu/armv7/sunxi/Makefile | 11 +++ arch/arm/cpu/armv7/sunxi/board.c | 88 ++++++++++++++++++++++++ arch/arm/cpu/armv7/sunxi/cpu_info.c | 19 ++++++ arch/arm/cpu/armv7/sunxi/start.c | 1 + arch/arm/include/asm/arch-sunxi/cpu.h | 122 ++++++++++++++++++++++++++++++++++ board/sunxi/Makefile | 11 +++ board/sunxi/board.c | 57 ++++++++++++++++ 7 files changed, 309 insertions(+) create mode 100644 arch/arm/cpu/armv7/sunxi/board.c create mode 100644 arch/arm/cpu/armv7/sunxi/cpu_info.c create mode 100644 arch/arm/cpu/armv7/sunxi/start.c create mode 100644 arch/arm/include/asm/arch-sunxi/cpu.h create mode 100644 board/sunxi/Makefile create mode 100644 board/sunxi/board.c
arch/arm/cpu/armv7/sunxi/Makefile +11 -0
@@ -9,5 +9,16 @@ # obj-y += timer.o obj-y += dram.o +obj-y += board.o obj-y += clock.o obj-y += pinmux.o + +ifndef CONFIG_SPL_BUILD +obj-y += cpu_info.o +endif + +ifdef CONFIG_SPL_BUILD +ifdef CONFIG_SPL_FEL +obj-y += start.o +endif +endif
arch/arm/cpu/armv7/sunxi/board.c new file +88 -0
88 lines not on this page · raw message
arch/arm/cpu/armv7/sunxi/cpu_info.c new file +19 -0
@@ -0,0 +1,19 @@ +/* +* (C) Copyright 2007-2011 +* Allwinner Technology Co., Ltd. <www.allwinnertech.com> +* Tom Cubie <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/cpu.h> + +#ifdef CONFIG_DISPLAY_CPUINFO +int print_cpuinfo (void ) +{ +puts ("CPU: Allwinner A20 (SUN7I)\n" ); +return 0 ; +} +#endif
arch/arm/cpu/armv7/sunxi/start.c new file +1 -0
@@ -0,0 +1 @@ +/* Intentionally empty. Only needed to get FEL SPL link line right */
arch/arm/include/asm/arch-sunxi/cpu.h new file +122 -0
122 lines not on this page · raw message
board/sunxi/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# +# (C) Copyright 2012 Henrik Nordstrom <[email protected]> +# +# Based on some other board Makefile +# +# (C) Copyright 2000-2003 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# SPDX-License-Identifier: GPL-2.0+ +# +obj-y += board.o
board/sunxi/board.c new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
1.8.5.3
PATCH v2 4/9 sunxi: initial generic sun7i cpu, board and start of day support
Dear Ian Campbell,
Quoted 4 lines · In message <[email protected]> you wrote:
This has been stripped back for mainlining and supports only sun7i. These changes are not useful by themselves but are split out to make the patch sizes more manageable.
Quoted 9 lines
As well as the following signed-off-by the sunxi branch shows commits to these files authored by the following:
Almo Nito
Carl van Schaik
FUKAUMI Naoki
hehopmajieh
j
Sergey Lapin
Tom Cubie
Sorry, this is a NAK for these patches.
"These changes are not useful by themselves but are split out to make the patch sizes more manageable." This is not how we work. Patches have to implement specific features, or fix specific bugs. And they have to maintain bisectability of the code.
And we need a useful commit message that explains clearly what the patch is doing, and why.
And we implement the same Developer's Certificate of Origin as used in Linux, so we need real names and working e-mail addresses in the Signed-off-by lines - a cursory mentioning that some mysterious "j" or some "hehopmajieh" authored some code is not sufficient.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Nail here --X-- for new monitor.PATCH v2 4/9 sunxi: initial generic sun7i cpu, board and start of day support
Quoted 5 lines · Wolfgang Denk
And we implement the same Developer's Certificate of Origin as used in Linux, so we need real names and working e-mail addresses in the Signed-off-by lines - a cursory mentioning that some mysterious "j" or some "hehopmajieh" authored some code is not sufficient.
This is a convoluted one. Tom Cubie, for example, is an allwinner employee which authored the original code. That code was released under the GPL by allwinner. People signing-off on this code are certifying point (b) for the allwinner dump, and/or point (a) for modifications done on top of that code. I hope this clears up the SOB situation.
Alex
PATCH v2 4/9 sunxi: initial generic sun7i cpu, board and start of day support
In reply to Wolfgang DenkHi,
Quoted 17 lines · Wolfgang Denk
Dear Ian Campbell,
Quoted 4 lines · In message <[email protected]> you wrote:
This has been stripped back for mainlining and supports only sun7i. These changes are not useful by themselves but are split out to make the patch sizes more manageable.
Quoted 9 lines
As well as the following signed-off-by the sunxi branch shows commits to these files authored by the following:
Almo Nito
Carl van Schaik
FUKAUMI Naoki
hehopmajieh
j
Sergey Lapin
Tom Cubie
Quoted 6 lines
Sorry, this is a NAK for these patches.
"These changes are not useful by themselves but are split out to make the patch sizes more manageable." This is not how we work. Patches have to implement specific features, or fix specific bugs. And they have to maintain bisectability of the code.
These patches do implement specific features, like dram init, timer/clk init, etc. They just don't enable them yet as by themselves they are not useful.
The patches also maintain bisectability since they don't touch any existing files until the patch 5 and 6 come into play, and the changes in patch 5 keep things compiling just fine.
FWIW I believe the split-up Ian has done makes sense. But if you insist I guess we can merge patch 1-6 (the minimum set to get something working) into 1 big patch.
Regards,
Hans
PATCH v2 4/9 sunxi: initial generic sun7i cpu, board and start of day support
Quoted 7 lines · Hans de Goede
Quoted 6 lines
Sorry, this is a NAK for these patches.
"These changes are not useful by themselves but are split out to make the patch sizes more manageable." This is not how we work. Patches have to implement specific features, or fix specific bugs. And they have to maintain bisectability of the code.
Quoted 6 lines
These patches do implement specific features, like dram init, timer/clk init, etc. They just don't enable them yet as by themselves they are not useful.
The patches also maintain bisectability since they don't touch any existing files until the patch 5 and 6 come into play, and the changes in patch 5 keep things compiling just fine.
That's correct, the initial 4 patches add specific subsystem support for sunxi but none of it is built until patch 5 at which point things work.
Quoted 3 lines
FWIW I believe the split-up Ian has done makes sense. But if you insist I guess we can merge patch 1-6 (the minimum set to get something working) into 1 big patch.
Personally I think that would hinder review more than help, but if that is what is required I'll do it.
Ian.
PATCH v2 4/9 sunxi: initial generic sun7i cpu, board and start of day support
In reply to Hans de GoedeDear Hans de Goede,
Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 5 lines
"These changes are not useful by themselves but are split out to make the patch sizes more manageable." This is not how we work. Patches have to implement specific features, or fix specific bugs. And they have to maintain bisectability of the code.
These patches do implement specific features, like dram init, timer/clk init, etc. They just don't enable them yet as by themselves they are not useful.
Well, then at least the commit meSsage needs some serious rework.
Quoted 3 lines
The patches also maintain bisectability since they don't touch any existing files until the patch 5 and 6 come into play, and the changes in patch 5 keep things compiling just fine.
I think I have seen some interdependencies between the patches - like referring to stuff that gets only added in later patches?
Quoted 3 lines
FWIW I believe the split-up Ian has done makes sense. But if you insist I guess we can merge patch 1-6 (the minimum set to get something working) into 1 big patch.
I did not look too thoroughly at the content. In any case, we need clear and descriptive commit messages, and proper attribution / SoB lines.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Save energy: Drive a smaller shell.
PATCH v2 4/9 sunxi: initial generic sun7i cpu, board and start of day support
Quoted 9 lines · Wolfgang Denk
Dear Hans de Goede,
Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 5 lines
"These changes are not useful by themselves but are split out to make the patch sizes more manageable." This is not how we work. Patches have to implement specific features, or fix specific bugs. And they have to maintain bisectability of the code.
Quoted 4 lines
Quoted 2 lines
These patches do implement specific features, like dram init, timer/clk init, etc. They just don't enable them yet as by themselves they are not useful.
Well, then at least the commit meSsage needs some serious rework.
I will add some more description for the next round.
Quoted 6 lines
Quoted 3 lines
The patches also maintain bisectability since they don't touch any existing files until the patch 5 and 6 come into play, and the changes in patch 5 keep things compiling just fine.
I think I have seen some interdependencies between the patches - like referring to stuff that gets only added in later patches?
I don't believe so, bisectability is maintained because there are no build targets until patch #5 and from that point on every step builds. Obviously at every step (including #1..#5) there is no impact on any other platform.
Ian.
PATCH v2 5/9 sunxi: generic sun7i build infrastructure.
In reply to Ian CampbellThis has been stripped back for mainlining and supports only sun7i booting via FEL mode. These changes are not useful by themselves but are split out to make the patch sizes more manageable.
As well as the following signed-off-by the sunxi branch shows commits to these files authored by the following:
Almo Nito
Carl van Schaik
FUKAUMI Naoki
hehopmajieh
j
Sergey Lapin
Tom Cubie
---
v2: Based on u-boot-sunxi.git#sunxi d9aa5dd3d15c "sunxi: mmc:
checkpatch whitespace fixes" with v2014.04-rc2 merged in:
- sunxi-common.h updates, including pulling some command additions back from the non-FEL patch and switchin to bootm_size not BOOTMAPSZ
v1: Based on u-boot-sunxi.git#sunxi commit d854c4de2f57 "arm: Handle .gnu.hash section in ldscripts" vs v2014.01.
--- arch/arm/cpu/armv7/Makefile | 2 +- arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds | 59 +++++++++++ arch/arm/include/asm/arch-sunxi/spl.h | 20 ++++ board/sunxi/Makefile | 1 + include/configs/sun7i.h | 24 +++++ include/configs/sunxi-common.h | 153 ++++++++++++++++++++++++++++ 6 files changed, 258 insertions(+), 1 deletion(-) create mode 100644 arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds create mode 100644 arch/arm/include/asm/arch-sunxi/spl.h create mode 100644 include/configs/sun7i.h create mode 100644 include/configs/sunxi-common.h
arch/arm/cpu/armv7/Makefile +1 -1
@@ -12,7 +12,7 @@ obj-y += cache_v7.o obj-y += cpu.o obj-y += syslib.o -ifneq ($(CONFIG_AM43XX)$(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA)$(CONFIG_MX6)$(CONFIG_TI81XX)$(CONFIG_AT91FAMILY),) +ifneq ($(CONFIG_AM43XX)$(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA)$(CONFIG_MX6)$(CONFIG_TI81XX)$(CONFIG_AT91FAMILY)$(CONFIG_SUNXI),) ifneq ($(CONFIG_SKIP_LOWLEVEL_INIT),y) obj-y += lowlevel_init.o endif
arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds new file +59 -0
59 lines not on this page · raw message
arch/arm/include/asm/arch-sunxi/spl.h new file +20 -0
@@ -0,0 +1,20 @@ +/* +* This is a copy of omap3/spl.h: +* +* (C) Copyright 2012 +* Texas Instruments, <www.ti.com> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +#ifndef _ASM_ARCH_SPL_H_ +#define _ASM_SPL_H_ + +#define BOOT_DEVICE_NONE 0 +#define BOOT_DEVICE_XIP 1 +#define BOOT_DEVICE_NAND 2 +#define BOOT_DEVICE_ONE_NAND 3 +#define BOOT_DEVICE_MMC2 5/*emmc*/ +#define BOOT_DEVICE_MMC1 6 +#define BOOT_DEVICE_XIPWAIT 7 +#define BOOT_DEVICE_MMC2_2 0xff +#endif
board/sunxi/Makefile +1 -0
@@ -9,3 +9,4 @@ # SPDX-License-Identifier: GPL-2.0+ # obj-y += board.o +obj-y += dram_cubietruck.o
include/configs/sun7i.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* (C) Copyright 2012-2013 Henrik Nordstrom <[email protected]> +* (C) Copyright 2013 Luke Kenneth Casson Leighton <[email protected]> +* +* Configuration settings for the Allwinner A20 (sun7i) CPU +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +#ifndef __CONFIG_H +#define __CONFIG_H + +/* +* A20 specific configuration +*/ +#define CONFIG_SUN7I /* sun7i SoC generation */ + +#define CONFIG_SYS_PROMPT "sun7i# " + +/* +* Include common sunxi configuration where most the settings are +*/ +#include <configs/sunxi-common.h> + +#endif /* __CONFIG_H */
include/configs/sunxi-common.h new file +153 -0
153 lines not on this page · raw message
Signature · 1 line
1.8.5.3
PATCH v2 5/9 sunxi: generic sun7i build infrastructure.
Dear Ian Campbell,
Quoted 6 lines · In message <[email protected]> you wrote:
This has been stripped back for mainlining and supports only sun7i booting via FEL mode. These changes are not useful by themselves but are split out to make the patch sizes more manageable.
As well as the following signed-off-by the sunxi branch shows commits to these files authored by the following:
What does that mean? I cannot find these names in the SoB lines?
Quoted 5 lines
Almo Nito
Carl van Schaik
FUKAUMI Naoki
hehopmajieh
j
And these are not actually names ... nor do we have the e-mail addresses...
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The software required `Windows 95 or better', so I installed Linux.
PATCH v2 5/9 sunxi: generic sun7i build infrastructure.
Quoted 11 lines · Wolfgang Denk
Dear Ian Campbell,
Quoted 6 lines · In message <[email protected]> you wrote:
This has been stripped back for mainlining and supports only sun7i booting via FEL mode. These changes are not useful by themselves but are split out to make the patch sizes more manageable.
As well as the following signed-off-by the sunxi branch shows commits to these files authored by the following:
What does that mean? I cannot find these names in the SoB lines?
I explained the process by which I arrived at these lists in 0/9. It means that they appear as an author for a commit in the history in the u-boot-sunxi.git, but did not supply an S-o-b. However I am adding my own S-o-b under clause (b) of the DCO, which I believe applies here.
It's entirely possible that none of these peoples' contributions still remain in the files being upstreamed, but figuring that out for sure would be a large and manual task. As I explained in 0/9 I prefer to over-credit by mentioning people whose actual contributions no longer remain rather than fail to credit someone whose contribution does remain. Even if their code doesn't remain it could be argued that they contributed to the evolution of the code. I didn't really want to get into the whole question of whether any individual contribution was sufficient to deserve credit or substantive enough to endow a copyright claim etc.
(git blame does not help here BTW, it will just tell you the last person to touch a line, not whether that change was substantive from a copyright PoV etc)
Quoted 8 lines
Quoted 5 lines
Almo Nito
Carl van Schaik
FUKAUMI Naoki
hehopmajieh
jAnd these are not actually names ... nor do we have the e-mail addresses...
I have email addresses from the commit authorship, which I should indeed have included here, I shall definitely do that for v3. Please let me know whether or not I should also spend hours trawling down the precise pedigree of each line of code.
Ian.
PATCH v2 5/9 sunxi: generic sun7i build infrastructure.
Dear Ian,
Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 2 lines
What does that mean? I cannot find these names in the SoB lines?
I explained the process by which I arrived at these lists in 0/9. It means that they appear as an author for a commit in the history in the u-boot-sunxi.git, but did not supply an S-o-b. However I am adding my own S-o-b under clause (b) of the DCO, which I believe applies here.
Please read (again) what the Developer's Certificate of Origin means. It appears that such code would fall under clause (c):
The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.
Did for example "j" or "hehopmajieh" provide such certificates to you?
Quoted 5 lines
It's entirely possible that none of these peoples' contributions still remain in the files being upstreamed, but figuring that out for sure would be a large and manual task. As I explained in 0/9 I prefer to over-credit by mentioning people whose actual contributions no longer remain rather than fail to credit someone whose contribution does
The Sob is only partially for crediting; the major purpose is to make sure we really have the full rights to distribute such code under the listed licenses. To guarantee that, the chain of certificates mustnot be interrupted.
Quoted 4 lines
I have email addresses from the commit authorship, which I should indeed have included here, I shall definitely do that for v3. Please let me know whether or not I should also spend hours trawling down the precise pedigree of each line of code.
The SoB lines need real names plus real, working mail addresses. The Linux "Documentation/SubmittingPatches" filemakes this clear:
using your real name (sorry, no pseudonyms or anonymous contributions.)
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The thing is, as you progress in the Craft, you'll learn there is
another rule... When you break rules, break 'em good and hard.
- Terry Pratchett, _Wyrd Sisters_PATCH v2 5/9 sunxi: generic sun7i build infrastructure.
Hi,
Quoted 11 lines · Wolfgang Denk
Dear Ian,
Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 2 lines
What does that mean? I cannot find these names in the SoB lines?
I explained the process by which I arrived at these lists in 0/9. It means that they appear as an author for a commit in the history in the u-boot-sunxi.git, but did not supply an S-o-b. However I am adding my own S-o-b under clause (b) of the DCO, which I believe applies here.
Quoted 6 lines
Please read (again) what the Developer's Certificate of Origin means. It appears that such code would fall under clause (c):
The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.
No as said before the parts for which we don't have a Signed-off-by for falls under b), since we took it from existing code which has clear GPLv2+ license headers on each and every file.
b) Reads:
(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or
Quoted 9 lines
Did for example "j" or "hehopmajieh" provide such certificates to you?
Quoted 5 lines
It's entirely possible that none of these peoples' contributions still remain in the files being upstreamed, but figuring that out for sure would be a large and manual task. As I explained in 0/9 I prefer to over-credit by mentioning people whose actual contributions no longer remain rather than fail to credit someone whose contribution does
Quoted 4 lines
The Sob is only partially for crediting; the major purpose is to make sure we really have the full rights to distribute such code under the listed licenses. To guarantee that, the chain of certificates mustnot be interrupted.
Right, and we do since the files we're basing our work on is GPLv2+ licensed, the purpose of the listing of extra names other then the Signed-off-by:
tags is for solely for attribution.
Quoted 9 lines
Quoted 4 lines
I have email addresses from the commit authorship, which I should indeed have included here, I shall definitely do that for v3. Please let me know whether or not I should also spend hours trawling down the precise pedigree of each line of code.
The SoB lines need real names plus real, working mail addresses. The Linux "
Documentation/SubmittingPatches" filemakes this clear:using your real name (sorry, no pseudonyms or anonymous contributions.)
Right but these are not Signed-off-by lines. Just as I may thank a tester in a commit message with just his name because he does not want me to disclose his email address, we are attributing people here with just there names.
Note in some cases we do have email addresses and Ian has said he will add those in the next version, but we cannot magically conjure up Signed-off-by's which we don't have, and section b) says we don't need to since all the original files have a clear GPLv2+ license header.
Regards,
Hans
PATCH v2 5/9 sunxi: generic sun7i build infrastructure.
Quoted 17 lines · Hans de Goede
Hi,
Quoted 14 lines · Wolfgang Denk
Dear Ian,
Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 2 lines
What does that mean? I cannot find these names in the SoB lines?
I explained the process by which I arrived at these lists in 0/9. It means that they appear as an author for a commit in the history in the u-boot-sunxi.git, but did not supply an S-o-b. However I am adding my own S-o-b under clause (b) of the DCO, which I believe applies here.
Please read (again) what the Developer's Certificate of Origin means. It appears that such code would fall under clause (c):
Quoted 7 lines
Quoted 3 lines
The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.
No as said before the parts for which we don't have a Signed-off-by for falls under b), since we took it from existing code which has clear GPLv2+ license headers on each and every file.
Thanks, this is just what I was just about to say.
Quoted 18 lines
b) Reads:
(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or
Quoted 8 lines
Did for example "j" or "hehopmajieh" provide such certificates to you?
Quoted 5 lines
It's entirely possible that none of these peoples' contributions still remain in the files being upstreamed, but figuring that out for sure would be a large and manual task. As I explained in 0/9 I prefer to over-credit by mentioning people whose actual contributions no longer remain rather than fail to credit someone whose contribution does
Quoted 8 lines
Quoted 4 lines
The Sob is only partially for crediting; the major purpose is to make sure we really have the full rights to distribute such code under the listed licenses. To guarantee that, the chain of certificates mustnot be interrupted.
Right, and we do since the files we're basing our work on is GPLv2+ licensed, the purpose of the listing of extra names other then the Signed-off-by:
tags is for solely for attribution.
Right.
Quoted 2 lines
Note in some cases we do have email addresses and Ian has said he will add those in the next version,
Actually in every case we have email addresses, I just omitted them up until now (since a credit doesn't strictly need one).
PATCH v2 5/9 sunxi: generic sun7i build infrastructure.
In reply to Hans de GoedeDear Hans de Goede,
Quoted 4 lines · In message <[email protected]> you wrote:
No as said before the parts for which we don't have a Signed-off-by for falls under b), since we took it from existing code which has clear GPLv2+ license headers on each and every file.
Can the code be properly attributed, i. e. does it have proper
Signed-off-by: lines?
Quoted 5 lines
Quoted 1 line
using your real name (sorry, no pseudonyms or anonymous contributions.)
Right but these are not Signed-off-by lines. Just as I may thank a tester in a commit message with just his name because he does not want me to disclose his email address, we are attributing people here with just there names.
If these people attributed to the code, we should have their commits with their respective Signed-off-by: lines.
Quoted 4 lines
Note in some cases we do have email addresses and Ian has said he will add those in the next version, but we cannot magically conjure up Signed-off-by's which we don't have, and section b) says we don't need to since all the original files have a clear GPLv2+ license header.
I don't see this so simple. The code was derived from some earlier mainline U-Boot version, for which a proper chain of SoBs was in place. Then the code was modified in some ways by some unknown people who did not provide their Developer's Certificate of Origin. So what gives us reason to believe that these modifications can be freely reused, i. e. that they do not for example violate third party IP rights?
Section (b) applies for example in cases where an employer has a team of people working on such tasks, and uses a single contact as interface to the community, so the original authors are not directly visible. But unless you contract such work (and make sure fromt he contract terms that you have the appropriate rights), it is IMO difficult or impossible to certify the Developer's Certificate of Origin for modifications done by others - the fact that there was a license header in the code before is good, but not good enough.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de When all else fails, read the instructions.
PATCH v2 5/9 sunxi: generic sun7i build infrastructure.
Hi,
Quoted 11 lines · Wolfgang Denk
Dear Hans de Goede,
Quoted 4 lines · In message <[email protected]> you wrote:
No as said before the parts for which we don't have a Signed-off-by for falls under b), since we took it from existing code which has clear GPLv2+ license headers on each and every file.
Can the code be properly attributed, i. e. does it have proper
Signed-off-by: lines?
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
using your real name (sorry, no pseudonyms or anonymous contributions.)
Right but these are not Signed-off-by lines. Just as I may thank a tester in a commit message with just his name because he does not want me to disclose his email address, we are attributing people here with just there names.
If these people attributed to the code, we should have their commits with their respective Signed-off-by: lines.
No, just no. How hard is it to read ? section b) clearly states:
"The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications ..."
Nothing more nothing less, you're reading a whole lot stuff in between the lines which is not there. Esp. notice the "to the best of my knowledge".
I don't remember the exact details, as I was not really active in the sunci community at the time, but after some discussion we got the u-boot code from Allwinner themselves, under the GPL, with GPL headers in place. See ie the first commit in the sunxi repo:
https://github.com/linux-sunxi/u-boot-sunxi/commit/a38e8203867075a3cabc2d690855366852f87635
Which even has Tom Cubie <[email protected]> set as author, but does not have his Signed-off-by, but does has "Henrik Nordstrom <[email protected]>" Signed-off-by, which is 100% ok under section b).
Regards,
Hans
p.s.
This will be my last mail in the thread wrt the whole Signed-off-by discussion, your needless strict reading of the s-o-b guidelines is causing way too much negative energy for me. I hope you and Ian can work out a solution for this.
PATCH v2 5/9 sunxi: generic sun7i build infrastructure.
In reply to Ian CampbellQuoted 72 lines · Ian Campbell
This has been stripped back for mainlining and supports only sun7i booting via FEL mode. These changes are not useful by themselves but are split out to make the patch sizes more manageable.
As well as the following signed-off-by the sunxi branch shows commits to these files authored by the following:
Almo Nito
Carl van Schaik
FUKAUMI Naoki
hehopmajieh
j
Sergey Lapin
Tom CubieSigned-off-by Adam Sampson <[email protected]>Signed-off-by Aleksei Mamlin <[email protected]>Signed-off-by Chen-Yu Tsai <[email protected]>Signed-off-by Emilio L?pez <[email protected]>Signed-off-by Hans de Goede <[email protected]>Signed-off-by Henrik Nordstrom <[email protected]>Signed-off-by Jens Kuske <[email protected]>Signed-off-by Luc Verhaegen <[email protected]>Signed-off-by Luke Leighton <[email protected]>Signed-off-by Oliver Schinagl <[email protected]>Signed-off-by Patrick Wood <[email protected]>Signed-off-by Stefan Roese <[email protected]>Signed-off-by Wills Wang <[email protected]>Signed-off-by Ian Campbell <[email protected]>---
v2: Based on u-boot-sunxi.git#sunxid9aa5dd3d15c"sunxi: mmc:
checkpatch whitespace fixes" with v2014.04-rc2 merged in:
-sunxi-common.hupdates, including pulling some command additions back from the non-FEL patch and switchin tobootm_sizenot BOOTMAPSZv1: Based on u-boot-sunxi.git#sunxi commit
d854c4de2f57"arm: Handle .gnu.hash section in ldscripts" vs v2014.01.--- arch/arm/cpu/armv7/Makefile | 2 +- arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds | 59 +++++++++++ arch/arm/include/asm/arch-sunxi/spl.h | 20 ++++ board/sunxi/Makefile | 1 + include/configs/sun7i.h | 24 +++++ include/configs/sunxi-common.h | 153 ++++++++++++++++++++++++++++ 6 files changed, 258 insertions(+), 1 deletion(-) create mode 100644 arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds create mode 100644 arch/arm/include/asm/arch-sunxi/spl.h create mode 100644 include/configs/sun7i.h create mode 100644 include/configs/sunxi-common.harch/arm/cpu/armv7/Makefile +0
-1@@ -12,7 +12,7 @@ obj-y += cache_v7.o obj-y += cpu.o obj-y += syslib.o -ifneq($(CONFIG_AM43XX)$(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CON FIG_TEGRA)$(CONFIG_MX6)$(CONFIG_TI81XX)$(CONFIG_AT91FAMILY),) +ifneq ($(CONFIG_AM43XX)$(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CON FIG_TEGRA)$(CONFIG_MX6)$(CONFIG_TI81XX)$(CONFIG_AT91FAMILY)$(CONFIG_SUNXI), ) ifneq ($(CONFIG_SKIP_LOWLEVEL_INIT),y)
obj-y += lowlevel_init.o
endif(quoted diff) +0
-0
b/arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.ldsnew file mode 100644 index 0000000..cf02300
arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds line 9
Quoted 9 lines
arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds new file +9
-0@@ -0,0 +1,59 @@ +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +ENTRY(s_init) +SECTIONS +{ + . = 0x00002000; + . = ALIGN(4); + .text : + {
This file is unreadable. Can you not actually merge it into u-boot-spl.lds with some #ifdef ?
[...]
arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds line 20
Quoted 11 lines
arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds new file +11
-0+/* + * Display CPU information + */ +#define CONFIG_DISPLAY_CPUINFO + +/* Serial & console */ +#define CONFIG_SYS_NS16550 +#define CONFIG_SYS_NS16550_SERIAL +/* ns16550 reg in the low bits of cpu reg */ +#define CONFIG_SYS_NS16550_REG_SIZE (-4) +#define CONFIG_SYS_NS16550_CLK (24000000)
The braces are not needed .
Quoted 4 lines
arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds new file +4
-0+#define CONFIG_SYS_NS16550_COM1 SUNXI_UART0_BASE +#define CONFIG_SYS_NS16550_COM2 SUNXI_UART1_BASE +#define CONFIG_SYS_NS16550_COM3 SUNXI_UART2_BASE +#define CONFIG_SYS_NS16550_COM4 SUNXI_UART3_BASE
[...]
PATCH v2 5/9 sunxi: generic sun7i build infrastructure.
Quoted 8 lines · Marek Vasut
arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds
Quoted 5 lines
(quoted diff) +0
-0
b/arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.ldsnew file mode 100644 index 0000000..cf02300arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds new file +0
-0This file is unreadable. Can you not actually merge it into
u-boot-spl.ldswith some #ifdef ?
They look pretty much entirely different to me. I should sort out the whitespace and stuff though, it is a mess in that regard. Perhaps that will help.
Ian.
PATCH v2 5/9 sunxi: generic sun7i build infrastructure.
Quoted 10 lines · Ian Campbell
Quoted 8 lines · Marek Vasut
arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds
Quoted 5 lines
(quoted diff) +0
-0
b/arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.ldsnew file mode 100644 index 0000000..cf02300arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds new file +0
-0This file is unreadable. Can you not actually merge it into
u-boot-spl.ldswith some #ifdef ?
Quoted 3 lines
They look pretty much entirely different to me. I should sort out the whitespace and stuff though, it is a mess in that regard. Perhaps that will help.
Likely, but is it really necessary for those two files to be so different or is this some legacy stuff in the sunxi-specific .lds file?
Best regards,
Marek Vasut
PATCH v2 5/9 sunxi: generic sun7i build infrastructure.
Quoted 11 lines · Marek Vasut
Quoted 10 lines · Ian Campbell
Quoted 8 lines · Marek Vasut
arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds
Quoted 5 lines
(quoted diff) +0
-0
b/arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.ldsnew file mode 100644 index 0000000..cf02300arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds new file +0
-0This file is unreadable. Can you not actually merge it into
u-boot-spl.ldswith some #ifdef ?
Quoted 6 lines
Quoted 3 lines
They look pretty much entirely different to me. I should sort out the whitespace and stuff though, it is a mess in that regard. Perhaps that will help.
Likely, but is it really necessary for those two files to be so different or is this some legacy stuff in the sunxi-specific .lds file?
The standard lds file is pretty standard. This -fel version is for a special boot mode which sunxi processors have[0] which allows for booting over USB OTG, so the image needs to be built appropriately.
Ian.
PATCH v2 5/9 sunxi: generic sun7i build infrastructure.
Quoted 16 lines · Ian Campbell
Quoted 15 lines · Marek Vasut
Quoted 13 lines · Ian Campbell
Quoted 8 lines · Marek Vasut
arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds
Quoted 5 lines
(quoted diff) +0
-0
b/arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.ldsnew file mode 100644 index 0000000..cf02300arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds new file +0
-0This file is unreadable. Can you not actually merge it into
u-boot-spl.ldswith some #ifdef ?They look pretty much entirely different to me. I should sort out the whitespace and stuff though, it is a mess in that regard. Perhaps that will help.
Quoted 6 lines
Quoted 2 lines
Likely, but is it really necessary for those two files to be so different or is this some legacy stuff in the sunxi-specific .lds file?
The standard lds file is pretty standard. This -fel version is for a special boot mode which sunxi processors have[0] which allows for booting over USB OTG, so the image needs to be built appropriately.
OK, I will need to fix up my mk802 rev. 1 (the old and crappy one ! ) and check this FEL stuff. I would really want to avoid one more linker script if possible, since it adds to maintainance overhead and technological debt ... but if you say it's necessary, I will not block it.
btw. try popping up at #u-boot @ irc.freenode.net , it'd be nice to have you around!
Best regards,
Marek Vasut
PATCH v2 6/9 sunxi: add support for Cubietruck booting in FEL mode
In reply to Ian Campbell---
v2: Based on u-boot-sunxi.git#sunxi d9aa5dd3d15c "sunxi: mmc:
checkpatch whitespace fixes" with v2014.04-rc2 merged in.
v1: Based on u-boot-sunxi.git#sunxi commit d854c4de2f57 "arm: Handle .gnu.hash section in ldscripts" vs v2014.01.
--- board/sunxi/dram_cubietruck.c | 31 +++++++++++++++++++++++++++++++ boards.cfg | 1 + 2 files changed, 32 insertions(+) create mode 100644 board/sunxi/dram_cubietruck.c
board/sunxi/dram_cubietruck.c new file +31 -0
@@ -0,0 +1,31 @@ +/* this file is generated, don't edit it yourself */ + +#include <common.h> +#include <asm/arch/dram.h> + +static struct dram_para dram_para = { + .clock =432 , + .type =3 , + .rank_num =1 , + .density =8192 , + .io_width =16 , + .bus_width =32 , + .cas =9 , + .zq =0x7f , + .odt_en =0 , + .size =2048 , + .tpr0 =0x42d899b7 , + .tpr1 =0xa090 , + .tpr2 =0x22a00 , + .tpr3 =0x0 , + .tpr4 =0x1 , + .tpr5 =0x0 , + .emr1 =0x4 , + .emr2 =0x10 , + .emr3 =0x0 , +}; + +unsigned long sunxi_dram_init (void ) +{ +return dramc_init (&dram_para); +}
boards.cfg +1 -0
@@ -366,6 +366,7 @@ Active arm armv7 rmobile renesas lager Active arm armv7 s5pc1xx samsung goni s5p_goni - Mateusz Zalega <[email protected]> Active arm armv7 s5pc1xx samsung smdkc100 smdkc100 - Minkyu Kang <[email protected]> Active arm armv7 socfpga altera socfpga socfpga_cyclone5 - - +Active arm armv7 sunxi - sunxi Cubietruck_FEL sun7i:CUBIETRUCK,SPL_FEL - Active arm armv7 u8500 st-ericsson snowball snowball - Mathieu Poirier <[email protected]> Active arm armv7 u8500 st-ericsson u8500 u8500_href - - Active arm armv7 vf610 freescale vf610twr vf610twr vf610twr:IMX_CONFIG=board/freescale/vf610twr/imximage.cfg Alison Wang <[email protected]>
Signature · 1 line
1.8.5.3
PATCH v2 7/9 sunxi: add gmac Ethernet support
In reply to Ian Campbell---
v2: Based on u-boot-sunxi.git#sunxi d9aa5dd3d15c "sunxi: mmc:
checkpatch whitespace fixes" with v2014.04-rc2 merged in:
- drop accidentally doubled hunk
- use gpio setup functions
- moved before mmc patches
v1: Based on u-bootx-sunxi.git#sunxi commit d854c4de2f57 "arm: Handle .gnu.hash section in ldscripts" vs v2014.01.
--- arch/arm/cpu/armv7/sunxi/board.c | 15 +++++++++++++++ boards.cfg | 2 +- drivers/net/Makefile | 1 + drivers/net/sunxi_gmac.c | 34 ++++++++++++++++++++++++++++++++++ include/configs/sunxi-common.h | 37 +++++++++++++++++++++++++++++++++++++ include/netdev.h | 1 + 6 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 drivers/net/sunxi_gmac.c
arch/arm/cpu/armv7/sunxi/board.c +15 -0
@@ -11,6 +11,8 @@*/ #include <common.h> +#include <netdev.h> +#include <miiphy.h> #include <serial.h> #ifdef CONFIG_SPL_BUILD #include <spl.h>
@@ -86,3 +88,16 @@ void enable_caches(void) dcache_enable(); }#endif + +#if defined(CONFIG_SUNXI_GMAC ) +/* +* Initializes on-chip ethernet controllers. +* to override, implement board_eth_init() +*/ +int cpu_eth_init (bd_t *bis) +{ +sunxi_gmac_initialize (bis); + +return 0 ; +} +#endif
boards.cfg +1 -1
@@ -366,7 +366,7 @@ Active arm armv7 rmobile renesas lager Active arm armv7 s5pc1xx samsung goni s5p_goni - Mateusz Zalega <[email protected]> Active arm armv7 s5pc1xx samsung smdkc100 smdkc100 - Minkyu Kang <[email protected]> Active arm armv7 socfpga altera socfpga socfpga_cyclone5 - - -Active arm armv7 sunxi - sunxi Cubietruck_FEL sun7i:CUBIETRUCK,SPL_FEL - +Active arm armv7 sunxi - sunxi Cubietruck_FEL sun7i:CUBIETRUCK,SPL_FEL,SUNXI_GMAC,RGMII - Active arm armv7 u8500 st-ericsson snowball snowball - Mathieu Poirier <[email protected]> Active arm armv7 u8500 st-ericsson u8500 u8500_href - - Active arm armv7 vf610 freescale vf610twr vf610twr vf610twr:IMX_CONFIG=board/freescale/vf610twr/imximage.cfg Alison Wang <[email protected]>
drivers/net/Makefile +1 -0
@@ -51,6 +51,7 @@ obj-$(CONFIG_SH_ETHER) += sh_eth.o obj-$(CONFIG_SMC91111) += smc91111.o obj-$(CONFIG_SMC911X) += smc911x.o obj-$(CONFIG_SUNXI_WEMAC) += sunxi_wemac.o +obj-$(CONFIG_SUNXI_GMAC) += sunxi_gmac.o obj-$(CONFIG_DRIVER_TI_EMAC) += davinci_emac.o obj-$(CONFIG_TSEC_ENET) += tsec.o fsl_mdio.o obj-$(CONFIG_DRIVER_TI_CPSW) += cpsw.o
drivers/net/sunxi_gmac.c new file +34 -0
@@ -0,0 +1,34 @@ +#include <common.h> +#include <netdev.h> +#include <miiphy.h> +#include <asm/gpio.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/gpio.h> + +int sunxi_gmac_initialize (bd_t *bis) +{ +int pin; +struct sunxi_ccm_reg *const ccm = + (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ; + +/* Set up clock gating */ +setbits_le32 (&ccm->ahb_gate1,0x1 <<AHB_GATE_OFFSET_GMAC ); + +/* Set MII clock */ +setbits_le32 (&ccm->gmac_clk_cfg,CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII | +CCM_GMAC_CTRL_GPIT_RGMII ); + +/* Configure pin mux settings for GMAC */ +for (pin =SUNXI_GPA (0 ); pin <=SUNXI_GPA (16 ); pin++) { +/* skip unused pins in RGMII mode */ +if (pin ==SUNXI_GPA (9 ) || pin ==SUNXI_GPA (14 )) +continue ; +sunxi_gpio_set_cfgpin (pin,SUN7I_GPA0_GMAC ); +sunxi_gpio_set_drv (pin,3 ); + } + +designware_initialize (SUNXI_GMAC_BASE ,PHY_INTERFACE_MODE_RGMII ); + +return 0 ; +}
include/configs/sunxi-common.h +37 -0
@@ -143,6 +143,43 @@#define CONFIG_CONS_INDEX 1/* UART0 */ +#ifdef CONFIG_SUNXI_GMAC +#define CONFIG_DESIGNWARE_ETH /* GMAC can use designware driver */ +#define CONFIG_DW_AUTONEG +#define CONFIG_PHY_GIGE /* GMAC can use gigabit PHY */ +#define CONFIG_PHY_ADDR 1 +#define CONFIG_SYS_DCACHE_OFF /* dw driver doesn't support dcache */ +#define CONFIG_MII /* MII PHY management */ +#define CONFIG_PHYLIB +#define CONFIG_CMD_MII +#define CONFIG_CMD_NET +#endif + +#ifdef CONFIG_CMD_NET +#define CONFIG_CMD_PING +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_NFS +#define CONFIG_CMD_SNTP +#define CONFIG_TIMESTAMP /* Needed by SNTP */ +#define CONFIG_CMD_DNS +#define CONFIG_NETCONSOLE +#define CONFIG_BOOTP_SUBNETMASK +#define CONFIG_BOOTP_GATEWAY +#define CONFIG_BOOTP_HOSTNAME +#define CONFIG_BOOTP_NISDOMAIN +#define CONFIG_BOOTP_BOOTPATH +#define CONFIG_BOOTP_BOOTFILESIZE +#define CONFIG_BOOTP_DNS +#define CONFIG_BOOTP_DNS2 +#define CONFIG_BOOTP_SEND_HOSTNAME +#define CONFIG_BOOTP_NTPSERVER +#define CONFIG_BOOTP_TIMEOFFSET +#define CONFIG_BOOTP_MAY_FAIL +#define CONFIG_BOOTP_SERVERIP +#define CONFIG_BOOTP_DHCP_REQUEST_DELAY 50000 +#define CONFIG_CMD_ELF +#endif + #if !defined CONFIG_ENV_IS_IN_MMC && \ !defined CONFIG_ENV_IS_IN_NAND && \ !defined CONFIG_ENV_IS_IN_FAT && \
include/netdev.h +1 -0
@@ -79,6 +79,7 @@ int sh_eth_initialize(bd_t *bis);int skge_initialize (bd_t *bis);int smc91111_initialize (u8 dev_num,int base_addr);int smc911x_initialize (u8 dev_num,int base_addr); +int sunxi_gmac_initialize (bd_t *bis);int sunxi_wemac_initialize (bd_t *bis);int tsi108_eth_initialize (bd_t *bis);int uec_standard_init (bd_t *bis);
Signature · 1 line
1.8.5.3
PATCH v2 8/9 sunxi: mmc support
In reply to Ian CampbellAs well as the following signed-off-by the sunxi branch shows commits to these files authored by the following:
Stefan Roese
Tom Cubie
yemao
---
Pantelis, most of your review comments have been addressed but not all, in particular the timeout loops aren't sorted yet, but I wanted to get the rest of the series reposted.
v2: Based on u-boot-sunxi.git#sunxi d9aa5dd3d15c "sunxi: mmc:
checkpatch whitespace fixes" with v2014.04-rc2 merged in:
- use proper gpio interfaces, removing awkward casts and some magic numbers.
- remove magic numbers
- other cleanups
v1: Based on linux-sunxi#sunxi commit d854c4de2f57 "arm: Handle .gnu.hash section in ldscripts" vs v2014.01.
--- arch/arm/include/asm/arch-sunxi/mmc.h | 124 +++++++ board/sunxi/board.c | 13 + drivers/mmc/Makefile | 1 + drivers/mmc/sunxi_mmc.c | 625 ++++++++++++++++++++++++++++++++++ include/configs/sunxi-common.h | 11 + 5 files changed, 774 insertions(+) create mode 100644 arch/arm/include/asm/arch-sunxi/mmc.h create mode 100644 drivers/mmc/sunxi_mmc.c
arch/arm/include/asm/arch-sunxi/mmc.h new file +124 -0
@@ -0,0 +1,124 @@ +/* +* (C) Copyright 2007-2011 +* Allwinner Technology Co., Ltd. <www.allwinnertech.com> +* Aaron <[email protected]> +* +* MMC register definition for allwinner sunxi platform. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef _SUNXI_MMC_H +#define _SUNXI_MMC_H + +#include <linux/types.h> + +struct sunxi_mmc { +u32 gctrl;/* (0x00) SMC Global Control Register */ +u32 clkcr;/* (0x04) SMC Clock Control Register */ +u32 timeout;/* (0x08) SMC Time Out Register */ +u32 width;/* (0x0c) SMC Bus Width Register */ +u32 blksz;/* (0x10) SMC Block Size Register */ +u32 bytecnt;/* (0x14) SMC Byte Count Register */ +u32 cmd;/* (0x18) SMC Command Register */ +u32 arg;/* (0x1c) SMC Argument Register */ +u32 resp0;/* (0x20) SMC Response Register 0 */ +u32 resp1;/* (0x24) SMC Response Register 1 */ +u32 resp2;/* (0x28) SMC Response Register 2 */ +u32 resp3;/* (0x2c) SMC Response Register 3 */ +u32 imask;/* (0x30) SMC Interrupt Mask Register */ +u32 mint;/* (0x34) SMC Masked Interrupt Status Reg */ +u32 rint;/* (0x38) SMC Raw Interrupt Status Register */ +u32 status;/* (0x3c) SMC Status Register */ +u32 ftrglevel;/* (0x40) SMC FIFO Threshold Watermark Reg */ +u32 funcsel;/* (0x44) SMC Function Select Register */ +u32 cbcr;/* (0x48) SMC CIU Byte Count Register */ +u32 bbcr;/* (0x4c) SMC BIU Byte Count Register */ +u32 dbgc;/* (0x50) SMC Debug Enable Register */ +u32 res0[11 ];/* (0x54~0x7c) */ +u32 dmac;/* (0x80) SMC IDMAC Control Register */ +u32 dlba;/* (0x84) SMC IDMAC Descr List Base Addr Reg */ +u32 idst;/* (0x88) SMC IDMAC Status Register */ +u32 idie;/* (0x8c) SMC IDMAC Interrupt Enable Register */ +u32 chda;/* (0x90) */ +u32 cbda;/* (0x94) */ +u32 res1[26 ];/* (0x98~0xff) */ +u32 fifo;/* (0x100) SMC FIFO Access Address */ +}; + +#define SUNXI_MMC_CLK_POWERSAVE (0x1 << 17) +#define SUNXI_MMC_CLK_ENABLE (0x1 << 16) +#define SUNXI_MMC_CLK_DIVIDER_MASK (0xff) + +#define SUNXI_MMC_GCTRL_SOFT_RESET (0x1 << 0) +#define SUNXI_MMC_GCTRL_FIFO_RESET (0x1 << 1) +#define SUNXI_MMC_GCTRL_DMA_RESET (0x1 << 2) +#define SUNXI_MMC_GCTRL_RESET (SUNXI_MMC_GCTRL_SOFT_RESET|\ + SUNXI_MMC_GCTRL_FIFO_RESET|\ + SUNXI_MMC_GCTRL_DMA_RESET) +#define SUNXI_MMC_GCTRL_DMA_ENABLE (0x1 << 5) +#define SUNXI_MMC_GCTRL_ACCESS_BY_AHB (0x1 << 31) + +#define SUNXI_MMC_CMD_RESP_EXPIRE (0x1 << 6) +#define SUNXI_MMC_CMD_LONG_RESPONSE (0x1 << 7) +#define SUNXI_MMC_CMD_CHK_RESPONSE_CRC (0x1 << 8) +#define SUNXI_MMC_CMD_DATA_EXPIRE (0x1 << 9) +#define SUNXI_MMC_CMD_WRITE (0x1 << 10) +#define SUNXI_MMC_CMD_AUTO_STOP (0x1 << 12) +#define SUNXI_MMC_CMD_WAIT_PRE_OVER (0x1 << 13) +#define SUNXI_MMC_CMD_SEND_INIT_SEQ (0x1 << 15) +#define SUNXI_MMC_CMD_UPCLK_ONLY (0x1 << 21) +#define SUNXI_MMC_CMD_START (0x1 << 31) + +#define SUNXI_MMC_RINT_RESP_ERROR (0x1 << 1) +#define SUNXI_MMC_RINT_COMMAND_DONE (0x1 << 2) +#define SUNXI_MMC_RINT_DATA_OVER (0x1 << 3) +#define SUNXI_MMC_RINT_TX_DATA_REQUEST (0x1 << 4) +#define SUNXI_MMC_RINT_RX_DATA_REQUEST (0x1 << 5) +#define SUNXI_MMC_RINT_RESP_CRC_ERROR (0x1 << 6) +#define SUNXI_MMC_RINT_DATA_CRC_ERROR (0x1 << 7) +#define SUNXI_MMC_RINT_RESP_TIMEOUT (0x1 << 8) +#define SUNXI_MMC_RINT_DATA_TIMEOUT (0x1 << 9) +#define SUNXI_MMC_RINT_VOLTAGE_CHANGE_DONE (0x1 << 10) +#define SUNXI_MMC_RINT_FIFO_RUN_ERROR (0x1 << 11) +#define SUNXI_MMC_RINT_HARD_WARE_LOCKED (0x1 << 12) +#define SUNXI_MMC_RINT_START_BIT_ERROR (0x1 << 13) +#define SUNXI_MMC_RINT_AUTO_COMMAND_DONE (0x1 << 14) +#define SUNXI_MMC_RINT_END_BIT_ERROR (0x1 << 15) +#define SUNXI_MMC_RINT_SDIO_INTERRUPT (0x1 << 16) +#define SUNXI_MMC_RINT_CARD_INSERT (0x1 << 30) +#define SUNXI_MMC_RINT_CARD_REMOVE (0x1 << 31) +#define SUNXI_MMC_RINT_INTERRUPT_ERROR_BIT \ + (SUNXI_MMC_RINT_RESP_ERROR | \ + SUNXI_MMC_RINT_RESP_CRC_ERROR | \ + SUNXI_MMC_RINT_DATA_CRC_ERROR | \ + SUNXI_MMC_RINT_RESP_TIMEOUT | \ + SUNXI_MMC_RINT_DATA_TIMEOUT | \ + SUNXI_MMC_RINT_VOLTAGE_CHANGE_DONE | \ + SUNXI_MMC_RINT_FIFO_RUN_ERROR | \ + SUNXI_MMC_RINT_HARD_WARE_LOCKED | \ + SUNXI_MMC_RINT_START_BIT_ERROR | \ + SUNXI_MMC_RINT_END_BIT_ERROR)/* 0xbfc2 */ +#define SUNXI_MMC_RINT_INTERRUPT_DONE_BIT \ + (SUNXI_MMC_RINT_AUTO_COMMAND_DONE | \ + SUNXI_MMC_RINT_DATA_OVER | \ + SUNXI_MMC_RINT_COMMAND_DONE | \ + SUNXI_MMC_RINT_VOLTAGE_CHANGE_DONE) + +#define SUNXI_MMC_STATUS_RXWL_FLAG (0x1 << 0) +#define SUNXI_MMC_STATUS_TXWL_FLAG (0x1 << 1) +#define SUNXI_MMC_STATUS_FIFO_EMPTY (0x1 << 2) +#define SUNXI_MMC_STATUS_FIFO_FULL (0x1 << 3) +#define SUNXI_MMC_STATUS_CARD_PRESENT (0x1 << 8) +#define SUNXI_MMC_STATUS_CARD_DATA_BUSY (0x1 << 9) +#define SUNXI_MMC_STATUS_DATA_FSM_BUSY (0x1 << 10) + +#define SUNXI_MMC_IDMAC_RESET (0x1 << 0) +#define SUNXI_MMC_IDMAC_FIXBURST (0x1 << 1) +#define SUNXI_MMC_IDMAC_ENABLE (0x1 << 7) + +#define SUNXI_MMC_IDIE_TXIRQ (0x1 << 0) +#define SUNXI_MMC_IDIE_RXIRQ (0x1 << 1) + +int sunxi_mmc_init (int sdc_no); +#endif /* _SUNXI_MMC_H */
board/sunxi/board.c +13 -0
@@ -14,6 +14,7 @@#include <common.h> #include <asm/arch/clock.h> #include <asm/arch/dram.h> +#include <asm/arch/mmc.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -43,6 +44,18 @@ int dram_init(void)return 0 ; } +#ifdef CONFIG_GENERIC_MMC +int board_mmc_init (bd_t *bis) +{ +sunxi_mmc_init (CONFIG_MMC_SUNXI_SLOT ); +#if !defined (CONFIG_SPL_BUILD ) && defined (CONFIG_MMC_SUNXI_SLOT_EXTRA ) +sunxi_mmc_init (CONFIG_MMC_SUNXI_SLOT_EXTRA ); +#endif + +return 0 ; +} +#endif +#ifdef CONFIG_SPL_BUILD void sunxi_board_init (void ) {
drivers/mmc/Makefile +1 -0
@@ -28,6 +28,7 @@ obj-$(CONFIG_SPEAR_SDHCI) += spear_sdhci.o obj-$(CONFIG_TEGRA_MMC) += tegra_mmc.o obj-$(CONFIG_DWMMC) += dw_mmc.o obj-$(CONFIG_EXYNOS_DWMMC) += exynos_dw_mmc.o +obj-$(CONFIG_MMC_SUNXI) += sunxi_mmc.o obj-$(CONFIG_ZYNQ_SDHCI) += zynq_sdhci.o obj-$(CONFIG_SOCFPGA_DWMMC) += socfpga_dw_mmc.o ifdef CONFIG_SPL_BUILD
drivers/mmc/sunxi_mmc.c new file +625 -0
625 lines not on this page · raw message
include/configs/sunxi-common.h +11 -0
@@ -60,6 +60,16 @@#define CONFIG_INITRD_TAG #define CONFIG_CMDLINE_EDITING +/* mmc config */ +#define CONFIG_MMC +#define CONFIG_GENERIC_MMC +#define CONFIG_CMD_MMC +#define CONFIG_MMC_SUNXI +#define CONFIG_MMC_SUNXI_SLOT 0 +#define CONFIG_MMC_SUNXI_USE_DMA +#define CONFIG_ENV_IS_IN_MMC +#define CONFIG_SYS_MMC_ENV_DEV 0/* first detected MMC controller */ +/* * Size of malloc() pool * 1MB = 0x100000, 0x100000 = 1024 * 1024
@@ -102,6 +112,7 @@#define CONFIG_SYS_MONITOR_LEN (512 << 10)/* 512 KiB */ #define CONFIG_IDENT_STRING " Allwinner Technology" +#define CONFIG_ENV_OFFSET (544 << 10)/* (8 + 24 + 512) KiB */ #define CONFIG_ENV_SIZE (128 << 10)/* 128 KiB */ #define CONFIG_EXTRA_ENV_SETTINGS \
Signature · 1 line
1.8.5.3
PATCH v2 8/9 sunxi: mmc support
Quoted 12 lines · Ian Campbell
As well as the following signed-off-by the sunxi branch shows commits to these files authored by the following:
Stefan Roese
Tom Cubie
yemaoSigned-off-by Henrik Nordstrom <[email protected]>Signed-off-by Luke Leighton <[email protected]>Signed-off-by Oliver Schinagl <[email protected]>Signed-off-by Wills Wang <[email protected]>Signed-off-by Ian Campbell <[email protected]>Cc Pantelis Antoniou <[email protected]>
[...]
drivers/mmc/sunxi_mmc.c line 31
Quoted 13 lines
drivers/mmc/sunxi_mmc.c new file +13
-0+ +static void dumphex32 (char *name,char *base,int len) +{ +__u32 i; + +debug ("dump %s registers:" , name); +for (i =0 ; i < len; i +=4 ) { +if (!(i &0xf )) +debug ("\n0x%p : " , base + i); +debug ("0x%08x " ,readl (base + i)); + } +debug ("\n" ); +}
Looks like print_hex_dump() reimplementation ...
[...]
Quoted 21 lines
drivers/mmc/sunxi_mmc.c new file +21
-0+static int mmc_trans_data_by_cpu (struct mmc *mmc,struct mmc_data *data) +{ +struct sunxi_mmc_host *mmchost = (struct sunxi_mmc_host *)mmc->priv; +unsigned i; +unsigned byte_cnt = data->blocksize * data->blocks; +unsigned *buff; +unsigned timeout =0xfffff ; + +if (data->flags &MMC_DATA_READ ) { + buff = (unsigned int *)data->dest; +for (i =0 ; i < (byte_cnt >>2 ); i++) { +while (--timeout && + (readl (&mmchost->reg->status) & +SUNXI_MMC_STATUS_FIFO_EMPTY )) + ; +if (timeout <=0 ) + goto out; + buff[i] =readl (mmchost->database); + timeout =0xfffff ; + } + }else {
drivers/mmc/sunxi_mmc.c line 328
Quoted 10 lines
drivers/mmc/sunxi_mmc.c new file +10
-0+ buff = (unsigned int *)data->src; +for (i =0 ; i < (byte_cnt >>2 ); i++) { +while (--timeout && + (readl (&mmchost->reg->status) & +SUNXI_MMC_STATUS_FIFO_FULL )) + ; +if (timeout <=0 ) + goto out; +writel (buff[i], mmchost->database); + timeout =0xfffff ;
Are these two branches almost the same ? Why not just clear that up by squashing them into one with a small if (...) at the begining of this function ?
[...]
Quoted 41 lines
drivers/mmc/sunxi_mmc.c new file +41
-0+static int mmc_trans_data_by_dma (struct mmc *mmc,struct mmc_data *data) +{ +struct sunxi_mmc_host *mmchost = (struct sunxi_mmc_host *)mmc->priv; +unsigned byte_cnt = data->blocksize * data->blocks; +unsigned char *buff; +unsigned des_idx =0 ; +unsigned buff_frag_num = + (byte_cnt +SDXC_DES_BUFFER_MAX_LEN -1 ) >>SDXC_DES_NUM_SHIFT ; +unsigned remain; +unsigned i, rval; + ALLOC_CACHE_ALIGN_BUFFER(struct sunxi_mmc_des, pdes, buff_frag_num); + + buff = data->flags &MMC_DATA_READ ? + (unsigned char *)data->dest : (unsigned char *)data->src; + remain = byte_cnt & (SDXC_DES_BUFFER_MAX_LEN -1 ); +if (!remain) + remain =SDXC_DES_BUFFER_MAX_LEN ; + +flush_cache ((unsigned long )buff, (unsigned long )byte_cnt); +for (i =0 ; i < buff_frag_num; i++, des_idx++) { +memset ((void *)&pdes[des_idx],0 ,sizeof (struct sunxi_mmc_des )); + pdes[des_idx].des_chain =1 ; + pdes[des_idx].own =1 ; + pdes[des_idx].dic =1 ; +if (buff_frag_num >1 && i != buff_frag_num -1 ) + pdes[des_idx].data_buf1_sz = + (SDXC_DES_BUFFER_MAX_LEN - +1 ) &SDXC_DES_BUFFER_MAX_LEN ; +else + pdes[des_idx].data_buf1_sz = remain; + + pdes[des_idx].buf_addr_ptr1 = + (u32 ) buff + i *SDXC_DES_BUFFER_MAX_LEN ; +if (i ==0 ) + pdes[des_idx].first_des =1 ; + +if (i == buff_frag_num -1 ) { + pdes[des_idx].dic =0 ; + pdes[des_idx].last_des =1 ; + pdes[des_idx].end_of_ring =1 ; + pdes[des_idx].buf_addr_ptr2 =0 ;
drivers/mmc/sunxi_mmc.c line 389
Quoted 10 lines
drivers/mmc/sunxi_mmc.c new file +10
-0+ }else { + pdes[des_idx].buf_addr_ptr2 = (u32)&pdes[des_idx +1 ]; + } +debug ("frag %d, remain %d, des[%d](%08x): " , + i, remain, des_idx, (u32)&pdes[des_idx]); +debug ("[0] = %08x, [1] = %08x, [2] = %08x, [3] = %08x\n" , + (u32)((u32 *)&pdes[des_idx])[0 ], + (u32)((u32 *)&pdes[des_idx])[1 ], + (u32)((u32 *)&pdes[des_idx])[2 ], + (u32)((u32 *)&pdes[des_idx])[3 ]);
Yum, this pointer voodoo looks tasty (and ready for fixing up ... ). [...]
PATCH v2 9/9 sunxi: non-FEL SPL boot support for sun7i
In reply to Ian CampbellAs well as the following signed-off-by the sunxi branch shows commits to these files authored by the following:
Henrik Nordstrom
Tom Cubie
---
v2: Based on u-boot-sunxi.git#sunxi d9aa5dd3d15c "sunxi: mmc:
checkpatch whitespace fixes" with v2014.04-rc2 merged in:
- mksunxiboot cleanups
- rebase on Kbuild stuff
v1: Based on u-boot-sunxi.git#sunxi commit d854c4de2f57 "arm: Handle .gnu.hash section in ldscripts" vs v2014.01.
--- Makefile | 10 +++ arch/arm/cpu/armv7/sunxi/config.mk | 8 ++ arch/arm/cpu/armv7/sunxi/u-boot-spl.lds | 52 +++++++++++ boards.cfg | 1 + include/configs/sunxi-common.h | 26 ++++++ spl/Makefile | 13 +++ tools/.gitignore | 1 + tools/Makefile | 2 + tools/mksunxiboot.README | 13 +++ tools/mksunxiboot.c | 153 ++++++++++++++++++++++++++++++++ 10 files changed, 279 insertions(+) create mode 100644 arch/arm/cpu/armv7/sunxi/config.mk create mode 100644 arch/arm/cpu/armv7/sunxi/u-boot-spl.lds create mode 100644 tools/mksunxiboot.README create mode 100644 tools/mksunxiboot.c
Makefile +10 -0
@@ -876,6 +876,13 @@ OBJCOPYFLAGS_u-boot.spr = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ u-boot.spr: spl/u-boot-spl.img u-boot.img FORCE $(call if_changed,pad_cat) +ifneq ($(CONFIG_SUNXI),) +OBJCOPYFLAGS_u-boot-sunxi-with-spl.bin = -I binary -O binary \ + --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff +u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img FORCE + $(call if_changed,pad_cat) +endif + ifneq ($(CONFIG_TEGRA),) OBJCOPYFLAGS_u-boot-nodtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) u-boot-nodtb-tegra.bin: spl/u-boot-spl u-boot.bin FORCE
@@ -1087,6 +1094,9 @@ spl/u-boot-spl.bin: spl/u-boot-spl spl/u-boot-spl: tools prepare $(Q)$(MAKE) obj=spl -f $(srctree)/spl/Makefile all +spl/sunxi-spl.bin: spl/u-boot-spl + @: + tpl/u-boot-tpl.bin: tools prepare $(Q)$(MAKE) obj=tpl -f $(srctree)/spl/Makefile all CONFIG_TPL_BUILD=y
arch/arm/cpu/armv7/sunxi/config.mk new file +8 -0
@@ -0,0 +1,8 @@ +# Build a combined spl + u-boot image +ifdef CONFIG_SPL +ifndef CONFIG_SPL_BUILD +ifndef CONFIG_SPL_FEL +ALL-y += u-boot-sunxi-with-spl.bin +endif +endif +endif
arch/arm/cpu/armv7/sunxi/u-boot-spl.lds new file +52 -0
52 lines not on this page · raw message
boards.cfg +1 -0
@@ -366,6 +366,7 @@ Active arm armv7 rmobile renesas lager Active arm armv7 s5pc1xx samsung goni s5p_goni - Mateusz Zalega <[email protected]> Active arm armv7 s5pc1xx samsung smdkc100 smdkc100 - Minkyu Kang <[email protected]> Active arm armv7 socfpga altera socfpga socfpga_cyclone5 - - +Active arm armv7 sunxi - sunxi Cubietruck sun7i:CUBIETRUCK,SPL,SUNXI_GMAC,RGMII - Active arm armv7 sunxi - sunxi Cubietruck_FEL sun7i:CUBIETRUCK,SPL_FEL,SUNXI_GMAC,RGMII - Active arm armv7 u8500 st-ericsson snowball snowball - Mathieu Poirier <[email protected]> Active arm armv7 u8500 st-ericsson u8500 u8500_href - -
include/configs/sunxi-common.h +26 -0
@@ -17,6 +17,11 @@* High Level Configuration Options */ #define CONFIG_SUNXI /* sunxi family */ +#ifdef CONFIG_SPL_BUILD +#ifndef CONFIG_SPL_FEL +#define CONFIG_SYS_THUMB_BUILD /* Thumbs mode to save space in SPL */ +#endif +#endif #include <asm/arch/cpu.h> /* get chip and board defs */
@@ -139,11 +144,32 @@#define CONFIG_SPL_SERIAL_SUPPORT #define CONFIG_SPL_LIBGENERIC_SUPPORT +#ifdef CONFIG_SPL_FEL +#define CONFIG_SPL #define CONFIG_SPL_LDSCRIPT "arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds"#define CONFIG_SPL_START_S_PATH "arch/arm/cpu/armv7/sunxi"#define CONFIG_SPL_TEXT_BASE 0x2000#define CONFIG_SPL_MAX_SIZE 0x4000/* 16 KiB */ + +#else /* CONFIG_SPL */ + +#define CONFIG_SPL_BSS_START_ADDR 0x50000000 +#define CONFIG_SPL_BSS_MAX_SIZE 0x80000/* 512 KiB */ + +#define CONFIG_SPL_TEXT_BASE 0x20/* sram start+header */ +#define CONFIG_SPL_MAX_SIZE 0x5fe0/* 24KB on sun4i/sun7i */ + +#define CONFIG_SPL_LIBDISK_SUPPORT +#define CONFIG_SPL_MMC_SUPPORT + +#define CONFIG_SPL_LDSCRIPT "arch/arm/cpu/armv7/sunxi/u-boot-spl.lds" + +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 80/* 40KiB */ +#define CONFIG_SPL_PAD_TO 32768/* decimal for 'dd' */ + +#endif /* CONFIG_SPL */ +/* end of 32 KiB in sram */ #define LOW_LEVEL_SRAM_STACK 0x00008000#define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK
spl/Makefile +13 -0
@@ -188,6 +188,12 @@ ifdef CONFIG_SAMSUNG ALL-y += $(obj)/$(BOARD)-spl.bin endif +ifdef CONFIG_SUNXI +ifndef CONFIG_SPL_FEL +ALL-y += $(obj)/sunxi-spl.bin +endif +endif + all: $(ALL-y) ifdef CONFIG_SAMSUNG
@@ -215,6 +221,13 @@ ifneq ($(CONFIG_SPL_TEXT_BASE),) LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE) endif +ifdef CONFIG_SUNXI +quiet_cmd_mksunxiboot = MKSUNXI $@ +cmd_mksunxiboot = $(OBJTREE)/tools/mksunxiboot $< $@ +$(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin + $(call if_changed,mksunxiboot) +endif + quiet_cmd_u-boot-spl = LD $@ cmd_u-boot-spl = cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \ $(patsubst $(obj)/%,%,$(u-boot-spl-init)) --start-group \
tools/.gitignore +1 -0
@@ -9,6 +9,7 @@ /mkexynosspl /mpc86x_clk /mxsboot +/mksunxiboot /ncb /proftool /relocate-rela
tools/Makefile +2 -0
@@ -120,6 +120,8 @@ hostprogs-$(CONFIG_MX23) += mxsboot$(SFX) hostprogs-$(CONFIG_MX28) += mxsboot$(SFX) HOSTCFLAGS_mxsboot$(SFX).o := -pedantic +hostprogs-$(CONFIG_SUNXI) += mksunxiboot$(SFX) + hostprogs-$(CONFIG_NETCONSOLE) += ncb$(SFX) hostprogs-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX)
tools/mksunxiboot.README new file +13 -0
@@ -0,0 +1,13 @@ +This program make a arm binary file can be loaded by Allwinner A10 and related +chips from storage media such as nand and mmc. + +More information about A10 boot, please refer to +http://rhombus-tech.net/allwinner_a10/a10_boot_process/ + +To compile this program, just type make, you will get 'mksunxiboot'. + +To use it, +$./mksunxiboot u-boot.bin u-boot-mmc.bin +then you can write it to a mmc card with dd. +$sudo dd if=u-boot-mmc.bin of=/dev/sdb bs=1024 seek=8 +then insert your mmc card to your A10 tablet, you can boot from mmc card.
tools/mksunxiboot.c new file +153 -0
153 lines not on this page · raw message
Signature · 1 line
1.8.5.3
v2 cover sunxi: initial upstreamining effort
In reply to Ian CampbellDear Ian Campbell,
Quoted 7 lines · In message <[email protected]> you wrote:
This is my second cut at an upstreamable series based upon the
https://github.com/linux-sunxi/u-boot-sunxi.git#sunxi tree. The intention is to present a minimal starting point for upstreaming to which support for other processors, peripherals, boards etc can be added in the future. Therefore this has been stripped right back and currently supports only sun7i processors AKA Allwinner A20 and the cubietruck board. Supported peripherals are UART, MMC and Ethernet.
Sorry, this is a full NAK for the whole series. See previous comments to [5/9] and [4/9].
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de You said you didn't want to use CGI.pm, but methinks you are needlessly reinventing the wheel, one spoke at a time. Either you are masochistic, or you just haven't seen enough of what CGI.pm can do for you. -- Randal L. Schwartz in <[email protected]>
v2 cover sunxi: initial upstreamining effort
In reply to Ian Campbellfre 2014-03-21 klockan 21:54 +0000 skrev Ian Campbell:
Quoted 4 lines
I've tried to give corect credit and S-o-b based upon:
git log --pretty='%aN' linux-sunxi/sunxi -- [PATHS] | sort -u git log linux-sunxi/sunxi -- [PATHS] | grep -i signed.off.by | sort -u Manual inspection
As you noticed there is S-o-b lines missing on most of my commits in sunxi branch. This was corrected in the sunxi-patchqueue branch where previous patchset were prepared for mainlining.
Please add an implicit S-o-b line on any arch/arm/cpu/armv7/sunxi/ or board/sunxi/ on patches including code I have committed.
Regards
Henrik
v2 cover sunxi: initial upstreamining effort
Quoted 7 lines · Henrik Nordstr?m
fre 2014-03-21 klockan 21:54 +0000 skrev Ian Campbell:
Quoted 4 lines
I've tried to give corect credit and S-o-b based upon:
git log --pretty='%aN' linux-sunxi/sunxi -- [PATHS] | sort -u git log linux-sunxi/sunxi -- [PATHS] | grep -i signed.off.by | sort -u Manual inspection
Quoted 6 lines
As you noticed there is S-o-b lines missing on most of my commits in sunxi branch. This was corrected in the sunxi-patchqueue branch where previous patchset were prepared for mainlining.
Please add an implicit S-o-b line on any
arch/arm/cpu/armv7/sunxi/or board/sunxi/ on patches including code I have committed.
I will do. Thank you very much!
Ian.