* [PATCH v2 0/4] Enable DT support for AT91SAM9263EK
@ 2017-12-31 10:02 Sam Ravnborg
2018-01-01 13:15 ` [PATCH 1/4] arm: at91: move irq_fixup to header file Sam Ravnborg
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Sam Ravnborg @ 2017-12-31 10:02 UTC (permalink / raw)
To: Barebox List; +Cc: Andrey Smirnov, Sam Ravnborg
This is version 2 of a patchset to enable
device tree support for AT91SAM9263EK.
On the quest towards getting so far several drivers was
converted to support DT.
These patches went in around august.
There was also issues with mach-at91 calling code
in the board directory (dependency in the
wrong direction).
This was fixed in "at91: move reset .." which is
pending (already posted).
I have failed to get the bootstrap mode to work.
It stops somewhere - and I have not invested enough
time to figure out where and why things goes wrong.
bootstrap mode was also broken before these patches.
No JTAG debugger available to help me.
And then I have at91bootstrap that works so motivation
was not too high.
I do not think the NAND support works either.
The device tree introduces some nand-controller
stuff that is not supported by barebox (at least I assume so).
And this part I did not look further into.
Next step is to get a proprietary board up and
running (which uses NOR flash).
But I wanted this patchset out in the open first.
Any fedback highly appreciated!
Sam
v1 => v2
Based on feedback from Andrey (thanks!)
Patches reworked and combined as a result of this
- Included two patches that makes some general
improvements to mach-at91.
(Updated since the RFC versions sent yesterday)
- Move irq_fixup, thus allowing us to call this
from board code. This makes it possible to have
less dependencies between board code and the processor
specific files in mach-at91.
- Simplified soc setup. With this change setup.c
no longer requires that at least one of the
processor specific files are built.
- Create a minimal dts file, based on top of the
dts file supplied from the kernel.
- Utilise gpio-hog - to setup gpio for PHY.
- Simpler Makefile logic in board Makefile
It is now obvious that init.c is only used for
bootstrap
- Processor specific files in mach-at91 no longer
used when DT is enabled
- Use IS_ENABLED() when it makes code simpler
Sam Ravnborg (4):
arm: at91: move irq_fixup to header file
arm: at91: simplify soc setup
at91sam9263ek: enable multi-image build
at91sam9263ek: enable DT support
arch/arm/boards/at91sam9263ek/Makefile | 4 +-
arch/arm/boards/at91sam9263ek/lowlevel_init.c | 17 +++--
arch/arm/boards/at91sam9263ek/of_init.c | 93 +++++++++++++++++++++++++++
arch/arm/configs/at91sam9263ek_defconfig | 10 ++-
arch/arm/dts/Makefile | 2 +-
arch/arm/dts/at91sam9263ek.dts | 48 ++++++++++++++
arch/arm/mach-at91/Kconfig | 30 ++++++---
arch/arm/mach-at91/Makefile | 6 +-
arch/arm/mach-at91/at91rm9200.c | 10 +--
arch/arm/mach-at91/at91sam9260.c | 10 +--
arch/arm/mach-at91/at91sam9260_devices.c | 1 +
arch/arm/mach-at91/at91sam9261.c | 10 +--
arch/arm/mach-at91/at91sam9261_devices.c | 1 +
arch/arm/mach-at91/at91sam9263.c | 10 +--
arch/arm/mach-at91/at91sam9263_devices.c | 1 +
arch/arm/mach-at91/at91sam9g45.c | 10 +--
arch/arm/mach-at91/at91sam9g45_devices.c | 1 +
arch/arm/mach-at91/at91sam9n12.c | 10 +--
arch/arm/mach-at91/generic.h | 11 +++-
arch/arm/mach-at91/include/mach/at91_rtt.h | 16 +++++
arch/arm/mach-at91/irq_fixup.c | 22 -------
arch/arm/mach-at91/sama5d3.c | 10 +--
arch/arm/mach-at91/sama5d4.c | 10 +--
arch/arm/mach-at91/setup.c | 26 ++------
arch/arm/mach-at91/soc.h | 76 ----------------------
images/Makefile.at91 | 4 ++
26 files changed, 277 insertions(+), 172 deletions(-)
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/4] arm: at91: move irq_fixup to header file
2017-12-31 10:02 [PATCH v2 0/4] Enable DT support for AT91SAM9263EK Sam Ravnborg
@ 2018-01-01 13:15 ` Sam Ravnborg
2018-01-01 13:15 ` [PATCH 2/4] arm: at91: simplify soc setup Sam Ravnborg
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Sam Ravnborg @ 2018-01-01 13:15 UTC (permalink / raw)
To: Barebox List; +Cc: Sam Ravnborg
This allows at91_rtt_irq_fixup() to be used outside
of the mach-at91/ directory.
Adjust all call sites to include the at91_rtt header.
Deleting one .c file is another nice side effect of this move.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
arch/arm/mach-at91/Makefile | 2 +-
arch/arm/mach-at91/at91sam9260_devices.c | 1 +
arch/arm/mach-at91/at91sam9261_devices.c | 1 +
arch/arm/mach-at91/at91sam9263_devices.c | 1 +
arch/arm/mach-at91/at91sam9g45_devices.c | 1 +
arch/arm/mach-at91/generic.h | 2 --
arch/arm/mach-at91/include/mach/at91_rtt.h | 16 ++++++++++++++++
arch/arm/mach-at91/irq_fixup.c | 22 ----------------------
8 files changed, 21 insertions(+), 25 deletions(-)
delete mode 100644 arch/arm/mach-at91/irq_fixup.c
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 8462cba60..8adeee9bc 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -1,4 +1,4 @@
-obj-y += setup.o irq_fixup.o
+obj-y += setup.o
ifeq ($(CONFIG_COMMON_CLK_OF_PROVIDER),)
obj-y += clock.o
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 99919b3f8..1cb898351 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -19,6 +19,7 @@
#include <mach/at91_pmc.h>
#include <mach/at91sam9260_matrix.h>
#include <mach/at91sam9_sdramc.h>
+#include <mach/at91_rtt.h>
#include <mach/iomux.h>
#include <mach/io.h>
#include <mach/cpu.h>
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index e63e0e751..6be390937 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -18,6 +18,7 @@
#include <mach/at91_pmc.h>
#include <mach/at91sam9261_matrix.h>
#include <mach/at91sam9_sdramc.h>
+#include <mach/at91_rtt.h>
#include <mach/board.h>
#include <mach/iomux.h>
#include <mach/io.h>
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 559b77e9d..6302684b2 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -18,6 +18,7 @@
#include <mach/at91_pmc.h>
#include <mach/at91sam9263_matrix.h>
#include <mach/at91sam9_sdramc.h>
+#include <mach/at91_rtt.h>
#include <mach/board.h>
#include <mach/iomux.h>
#include <mach/io.h>
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index bc4132040..67ca3590c 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -18,6 +18,7 @@
#include <mach/at91_pmc.h>
#include <mach/at91sam9g45_matrix.h>
#include <mach/at91sam9_ddrsdr.h>
+#include <mach/at91_rtt.h>
#include <mach/board.h>
#include <mach/iomux.h>
#include <mach/io.h>
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index a47bcb2c5..deba01924 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -35,5 +35,3 @@ static inline struct device_d *at91_add_sam9_smc(int id, resource_size_t start,
return add_generic_device("at91sam9-smc", id, NULL, start, size,
IORESOURCE_MEM, NULL);
}
-
-void at91_rtt_irq_fixup(void *base);
diff --git a/arch/arm/mach-at91/include/mach/at91_rtt.h b/arch/arm/mach-at91/include/mach/at91_rtt.h
index 7ec75de8b..ad29df191 100644
--- a/arch/arm/mach-at91/include/mach/at91_rtt.h
+++ b/arch/arm/mach-at91/include/mach/at91_rtt.h
@@ -16,6 +16,8 @@
#ifndef AT91_RTT_H
#define AT91_RTT_H
+#include <io.h>
+
#define AT91_RTT_MR 0x00 /* Real-time Mode Register */
#define AT91_RTT_RTPRES (0xffff << 0) /* Real-time Timer Prescaler Value */
#define AT91_RTT_ALMIEN (1 << 16) /* Alarm Interrupt Enable */
@@ -32,4 +34,18 @@
#define AT91_RTT_ALMS (1 << 0) /* Real-time Alarm Status */
#define AT91_RTT_RTTINC (1 << 1) /* Real-time Timer Increment */
+
+/*
+ * As the RTT is powered by the backup power so if the interrupt
+ * is still on when the kernel start, the kernel will end up with
+ * dead lock interrupt that it can not clear. Because the interrupt line is
+ * shared with the basic timer (PIT) on AT91_ID_SYS.
+ */
+static inline void at91_rtt_irq_fixup(void *base)
+{
+ void __iomem *reg = base + AT91_RTT_MR;
+ u32 mr = readl(reg);
+
+ writel(mr & ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN), reg);
+}
#endif
diff --git a/arch/arm/mach-at91/irq_fixup.c b/arch/arm/mach-at91/irq_fixup.c
deleted file mode 100644
index 9815ac2ca..000000000
--- a/arch/arm/mach-at91/irq_fixup.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2013 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
- *
- * Under GPLv2 only
- */
-
-#include <io.h>
-#include <mach/at91_rtt.h>
-
-/*
- * As the RTT is powered by the backup power so if the interrupt
- * is still on when the kernel start, the kernel will end up with
- * dead lock interrupt that it can not clear. Because the interrupt line is
- * shared with the basic timer (PIT) on AT91_ID_SYS.
- */
-void at91_rtt_irq_fixup(void *base)
-{
- void __iomem *reg = base + AT91_RTT_MR;
- u32 mr = readl(reg);
-
- writel(mr & ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN), reg);
-}
--
2.12.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/4] arm: at91: simplify soc setup
2017-12-31 10:02 [PATCH v2 0/4] Enable DT support for AT91SAM9263EK Sam Ravnborg
2018-01-01 13:15 ` [PATCH 1/4] arm: at91: move irq_fixup to header file Sam Ravnborg
@ 2018-01-01 13:15 ` Sam Ravnborg
2018-01-01 13:15 ` [PATCH 3/4] at91sam9263ek: enable multi-image build Sam Ravnborg
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Sam Ravnborg @ 2018-01-01 13:15 UTC (permalink / raw)
To: Barebox List; +Cc: Sam Ravnborg
The at91 soc support inherited a complex scheme
from the kernel.
This schme did not really give any benefits, and when
migrating at91sam9263ek to use DT it started to
get in the way for a proper way to do things.
Replace the former setup with a simple function
pointer that can be called from setup.c.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
arch/arm/mach-at91/at91rm9200.c | 10 +++---
arch/arm/mach-at91/at91sam9260.c | 10 +++---
arch/arm/mach-at91/at91sam9261.c | 10 +++---
arch/arm/mach-at91/at91sam9263.c | 10 +++---
arch/arm/mach-at91/at91sam9g45.c | 10 +++---
arch/arm/mach-at91/at91sam9n12.c | 10 +++---
arch/arm/mach-at91/generic.h | 9 ++++-
arch/arm/mach-at91/sama5d3.c | 10 +++---
arch/arm/mach-at91/sama5d4.c | 10 +++---
arch/arm/mach-at91/setup.c | 26 +++-----------
arch/arm/mach-at91/soc.h | 76 ----------------------------------------
11 files changed, 60 insertions(+), 131 deletions(-)
delete mode 100644 arch/arm/mach-at91/soc.h
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index d12e8d97b..ba680eb81 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -4,7 +4,6 @@
#include <mach/hardware.h>
#include <mach/at91_pmc.h>
-#include "soc.h"
#include "clock.h"
#include "generic.h"
@@ -235,6 +234,9 @@ static void __init at91rm9200_initialize(void)
at91_add_rm9200_gpio(3, AT91RM9200_BASE_PIOD);
}
-AT91_SOC_START(rm9200)
- .init = at91rm9200_initialize,
-AT91_SOC_END
+static int at91rm9200_setup(void)
+{
+ at91_boot_soc = at91rm9200_initialize;
+ return 0;
+}
+pure_initcall(at91rm9200_setup);
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index fbd788414..8975bf466 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -4,7 +4,6 @@
#include <mach/hardware.h>
#include <mach/at91_pmc.h>
-#include "soc.h"
#include "generic.h"
#include "clock.h"
@@ -236,6 +235,9 @@ static void at91sam9260_initialize(void)
at91_add_sam9_smc(DEVICE_ID_SINGLE, AT91SAM9260_BASE_SMC, 0x200);
}
-AT91_SOC_START(sam9260)
- .init = at91sam9260_initialize,
-AT91_SOC_END
+static int at91sam9260_setup(void)
+{
+ at91_boot_soc = at91sam9260_initialize;
+ return 0;
+}
+pure_initcall(at91sam9260_setup);
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index 37a65ecd3..35aaa9c96 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -4,7 +4,6 @@
#include <mach/hardware.h>
#include <mach/at91_pmc.h>
-#include "soc.h"
#include "generic.h"
#include "clock.h"
@@ -228,6 +227,9 @@ static void at91sam9261_initialize(void)
at91_add_sam9_smc(DEVICE_ID_SINGLE, AT91SAM9261_BASE_SMC, 0x200);
}
-AT91_SOC_START(sam9261)
- .init = at91sam9261_initialize,
-AT91_SOC_END
+static int at91sam9261_setup(void)
+{
+ at91_boot_soc = at91sam9261_initialize;
+ return 0;
+}
+pure_initcall(at91sam9261_setup);
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 35d187b4b..ee48115ea 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -4,7 +4,6 @@
#include <mach/hardware.h>
#include <mach/at91_pmc.h>
-#include "soc.h"
#include "clock.h"
#include "generic.h"
@@ -249,6 +248,9 @@ static void at91sam9263_initialize(void)
at91_add_sam9_smc(1, AT91SAM9263_BASE_SMC1, 0x200);
}
-AT91_SOC_START(sam9263)
- .init = at91sam9263_initialize,
-AT91_SOC_END
+static int at91sam9263_setup(void)
+{
+ at91_boot_soc = at91sam9263_initialize;
+ return 0;
+}
+pure_initcall(at91sam9263_setup);
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index ce6ce90db..c70036b38 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -6,7 +6,6 @@
#include <mach/at91_pmc.h>
#include <mach/cpu.h>
-#include "soc.h"
#include "generic.h"
#include "clock.h"
@@ -264,6 +263,9 @@ static void at91sam9g45_initialize(void)
at91_add_sam9_smc(DEVICE_ID_SINGLE, AT91SAM9G45_BASE_SMC, 0x200);
}
-AT91_SOC_START(sam9g45)
- .init = at91sam9g45_initialize,
-AT91_SOC_END
+static int at91sam9g45_setup(void)
+{
+ at91_boot_soc = at91sam9g45_initialize;
+ return 0;
+}
+pure_initcall(at91sam9g45_setup);
diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c
index c551f9a74..7ab44e496 100644
--- a/arch/arm/mach-at91/at91sam9n12.c
+++ b/arch/arm/mach-at91/at91sam9n12.c
@@ -6,7 +6,6 @@
#include <mach/io.h>
#include <mach/cpu.h>
-#include "soc.h"
#include "generic.h"
#include "clock.h"
@@ -220,6 +219,9 @@ static void at91sam9n12_initialize(void)
at91_add_sam9_smc(DEVICE_ID_SINGLE, AT91SAM9N12_BASE_SMC, 0x200);
}
-AT91_SOC_START(sam9n12)
- .init = at91sam9n12_initialize,
-AT91_SOC_END
+static int at91sam9n12_setup(void)
+{
+ at91_boot_soc = at91sam9n12_initialize;
+ return 0;
+}
+pure_initcall(at91sam9n12_setup);
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index deba01924..d125e5ffd 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -8,8 +8,15 @@
* published by the Free Software Foundation.
*/
- /* Clocks */
+/* function called by setup to perform late init */
+extern void (*at91_boot_soc)(void);
+
+/* Clocks */
+#ifdef CONFIG_COMMON_CLK_OF_PROVIDER
+static inline int __init at91_clock_init(void) { return 0; }
+#else
extern int __init at91_clock_init(void);
+#endif
static inline struct device_d *at91_add_rm9200_gpio(int id, resource_size_t start)
{
diff --git a/arch/arm/mach-at91/sama5d3.c b/arch/arm/mach-at91/sama5d3.c
index 85efb2d78..b52c6b49b 100644
--- a/arch/arm/mach-at91/sama5d3.c
+++ b/arch/arm/mach-at91/sama5d3.c
@@ -7,7 +7,6 @@
#include <mach/cpu.h>
#include <linux/clk.h>
-#include "soc.h"
#include "generic.h"
#include "clock.h"
@@ -391,6 +390,9 @@ static void sama5d3_initialize(void)
at91_add_sam9_smc(DEVICE_ID_SINGLE, SAMA5D3_BASE_HSMC + 0x600, 0xa0);
}
-AT91_SOC_START(sama5d3)
- .init = sama5d3_initialize,
-AT91_SOC_END
+static int sama5d3_setup(void)
+{
+ at91_boot_soc = sama5d3_initialize;
+ return 0;
+}
+pure_initcall(sama5d3_setup);
diff --git a/arch/arm/mach-at91/sama5d4.c b/arch/arm/mach-at91/sama5d4.c
index 4d380ed88..d6b18fca2 100644
--- a/arch/arm/mach-at91/sama5d4.c
+++ b/arch/arm/mach-at91/sama5d4.c
@@ -16,7 +16,6 @@
#include <mach/cpu.h>
#include <linux/clk.h>
-#include "soc.h"
#include "generic.h"
#include "clock.h"
@@ -299,6 +298,9 @@ static void sama5d4_initialize(void)
at91_add_sam9_smc(DEVICE_ID_SINGLE, SAMA5D4_BASE_HSMC + 0x600, 0xa0);
}
-AT91_SOC_START(sama5d4)
- .init = sama5d4_initialize,
-AT91_SOC_END
+static int sama5d4_setup(void)
+{
+ at91_boot_soc = sama5d4_initialize;
+ return 0;
+}
+pure_initcall(sama5d4_setup);
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 8f32af043..7a19c45ea 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -14,10 +14,10 @@
#include <mach/cpu.h>
#include <mach/at91_dbgu.h>
-#include "soc.h"
#include "generic.h"
-struct at91_init_soc __initdata at91_boot_soc;
+/* function called by at91_detect() - if assigned */
+void __initdata (*at91_boot_soc)(void);
struct at91_socinfo at91_soc_initdata;
EXPORT_SYMBOL(at91_soc_initdata);
@@ -48,39 +48,32 @@ static void __init soc_detect(u32 dbgu_base)
at91_soc_initdata.type = AT91_SOC_RM9200;
if (at91_soc_initdata.subtype == AT91_SOC_SUBTYPE_NONE)
at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
- at91_boot_soc = at91rm9200_soc;
break;
case ARCH_ID_AT91SAM9260:
at91_soc_initdata.type = AT91_SOC_SAM9260;
- at91_boot_soc = at91sam9260_soc;
break;
case ARCH_ID_AT91SAM9261:
at91_soc_initdata.type = AT91_SOC_SAM9261;
- at91_boot_soc = at91sam9261_soc;
break;
case ARCH_ID_AT91SAM9263:
at91_soc_initdata.type = AT91_SOC_SAM9263;
- at91_boot_soc = at91sam9263_soc;
break;
case ARCH_ID_AT91SAM9G20:
at91_soc_initdata.type = AT91_SOC_SAM9G20;
- at91_boot_soc = at91sam9260_soc;
break;
case ARCH_ID_AT91SAM9G45:
at91_soc_initdata.type = AT91_SOC_SAM9G45;
if (cidr == ARCH_ID_AT91SAM9G45ES)
at91_soc_initdata.subtype = AT91_SOC_SAM9G45ES;
- at91_boot_soc = at91sam9g45_soc;
break;
case ARCH_ID_AT91SAM9RL64:
at91_soc_initdata.type = AT91_SOC_SAM9RL;
- at91_boot_soc = at91sam9rl_soc;
break;
case ARCH_ID_AT91SAM9X5:
@@ -89,17 +82,14 @@ static void __init soc_detect(u32 dbgu_base)
case ARCH_ID_AT91SAM9N12:
at91_soc_initdata.type = AT91_SOC_SAM9N12;
- at91_boot_soc = at91sam9n12_soc;
break;
case ARCH_ID_SAMA5:
if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D3) {
at91_soc_initdata.type = AT91_SOC_SAMA5D3;
- at91_boot_soc = at91sama5d3_soc;
} else {
if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D4) {
at91_soc_initdata.type = AT91_SOC_SAMA5D4;
- at91_boot_soc = at91sama5d4_soc;
}
}
break;
@@ -108,13 +98,11 @@ static void __init soc_detect(u32 dbgu_base)
/* at91sam9g10 */
if ((socid & ~AT91_CIDR_EXT) == ARCH_ID_AT91SAM9G10) {
at91_soc_initdata.type = AT91_SOC_SAM9G10;
- at91_boot_soc = at91sam9261_soc;
}
/* at91sam9xe */
else if ((cidr & AT91_CIDR_ARCH) == ARCH_FAMILY_AT91SAM9XE) {
at91_soc_initdata.type = AT91_SOC_SAM9260;
at91_soc_initdata.subtype = AT91_SOC_SAM9XE;
- at91_boot_soc = at91sam9260_soc;
}
if (!at91_soc_is_detected())
@@ -283,17 +271,11 @@ static int at91_detect(void)
pr_info("AT91: Detected soc subtype: %s\n",
at91_get_soc_subtype(&at91_soc_initdata));
- if (IS_ENABLED(CONFIG_COMMON_CLK_OF_PROVIDER))
- return 0;
-
- if (!at91_soc_is_enabled())
- panic("AT91: Soc not enabled");
-
/* Init clock subsystem */
at91_clock_init();
- if (at91_boot_soc.init)
- at91_boot_soc.init();
+ if (at91_boot_soc != NULL)
+ at91_boot_soc();
return 0;
}
diff --git a/arch/arm/mach-at91/soc.h b/arch/arm/mach-at91/soc.h
deleted file mode 100644
index 76e4621f8..000000000
--- a/arch/arm/mach-at91/soc.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
- *
- * Under GPLv2
- */
-
-struct at91_init_soc {
- int builtin;
- void (*init)(void);
-};
-
-extern struct at91_init_soc at91_boot_soc;
-extern struct at91_init_soc at91rm9200_soc;
-extern struct at91_init_soc at91sam9260_soc;
-extern struct at91_init_soc at91sam9261_soc;
-extern struct at91_init_soc at91sam9263_soc;
-extern struct at91_init_soc at91sam9g45_soc;
-extern struct at91_init_soc at91sam9rl_soc;
-extern struct at91_init_soc at91sam9x5_soc;
-extern struct at91_init_soc at91sam9n12_soc;
-extern struct at91_init_soc at91sama5d3_soc;
-extern struct at91_init_soc at91sama5d4_soc;
-
-#define AT91_SOC_START(_name) \
-struct at91_init_soc __initdata at91##_name##_soc \
- __used \
- = { \
- .builtin = 1, \
-
-#define AT91_SOC_END \
-};
-
-static inline int at91_soc_is_enabled(void)
-{
- return at91_boot_soc.builtin;
-}
-
-#if !defined(CONFIG_SOC_AT91RM9200)
-#define at91rm9200_soc at91_boot_soc
-#endif
-
-#if !defined(CONFIG_SOC_AT91SAM9260)
-#define at91sam9260_soc at91_boot_soc
-#endif
-
-#if !defined(CONFIG_SOC_AT91SAM9261)
-#define at91sam9261_soc at91_boot_soc
-#endif
-
-#if !defined(CONFIG_SOC_AT91SAM9263)
-#define at91sam9263_soc at91_boot_soc
-#endif
-
-#if !defined(CONFIG_SOC_AT91SAM9G45)
-#define at91sam9g45_soc at91_boot_soc
-#endif
-
-#if !defined(CONFIG_SOC_AT91SAM9RL)
-#define at91sam9rl_soc at91_boot_soc
-#endif
-
-#if !defined(CONFIG_SOC_AT91SAM9X5)
-#define at91sam9x5_soc at91_boot_soc
-#endif
-
-#if !defined(CONFIG_SOC_AT91SAM9N12)
-#define at91sam9n12_soc at91_boot_soc
-#endif
-
-#if !defined(CONFIG_ARCH_SAMA5D3)
-#define at91sama5d3_soc at91_boot_soc
-#endif
-
-#if !defined(CONFIG_ARCH_SAMA5D4)
-#define at91sama5d4_soc at91_boot_soc
-#endif
--
2.12.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/4] at91sam9263ek: enable multi-image build
2017-12-31 10:02 [PATCH v2 0/4] Enable DT support for AT91SAM9263EK Sam Ravnborg
2018-01-01 13:15 ` [PATCH 1/4] arm: at91: move irq_fixup to header file Sam Ravnborg
2018-01-01 13:15 ` [PATCH 2/4] arm: at91: simplify soc setup Sam Ravnborg
@ 2018-01-01 13:15 ` Sam Ravnborg
2018-01-01 13:15 ` [PATCH 4/4] at91sam9263ek: enable DT support Sam Ravnborg
2018-01-04 16:45 ` [PATCH v2 0/4] Enable DT support for AT91SAM9263EK Andrey Smirnov
4 siblings, 0 replies; 8+ messages in thread
From: Sam Ravnborg @ 2018-01-01 13:15 UTC (permalink / raw)
To: Barebox List; +Cc: Sam Ravnborg
Convert at91sam9263ek to multi-image build as we already do
for many of the i.MX based boards and recently for
the at91sam9x5ek board.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
arch/arm/boards/at91sam9263ek/lowlevel_init.c | 2 +-
arch/arm/configs/at91sam9263ek_defconfig | 4 +++-
arch/arm/mach-at91/Kconfig | 20 ++++++++++++--------
images/Makefile.at91 | 4 ++++
4 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/arch/arm/boards/at91sam9263ek/lowlevel_init.c b/arch/arm/boards/at91sam9263ek/lowlevel_init.c
index 70e0da3b1..3138bc7ca 100644
--- a/arch/arm/boards/at91sam9263ek/lowlevel_init.c
+++ b/arch/arm/boards/at91sam9263ek/lowlevel_init.c
@@ -115,7 +115,7 @@ static void __bare_init at91sam9263ek_init(void)
NULL);
}
-void __naked __bare_init barebox_arm_reset_vector(void)
+ENTRY_FUNCTION(start_at91sam9263ek, r0, r1, r2)
{
arm_cpu_lowlevel_init();
diff --git a/arch/arm/configs/at91sam9263ek_defconfig b/arch/arm/configs/at91sam9263ek_defconfig
index b28614d43..fc92615eb 100644
--- a/arch/arm/configs/at91sam9263ek_defconfig
+++ b/arch/arm/configs/at91sam9263ek_defconfig
@@ -1,10 +1,12 @@
CONFIG_ARCH_AT91SAM9263=y
+CONFIG_AT91_MULTI_BOARDS=y
+CONFIG_MACH_AT91SAM9263EK=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
-CONFIG_PBL_IMAGE=y
CONFIG_MMU=y
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
+CONFIG_RELOCATABLE=y
CONFIG_PROMPT="9263-EK:"
CONFIG_GLOB=y
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index b877c269d..f5160ade1 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -228,6 +228,8 @@ config SUPPORT_CALAO_DAB_MMX
config SUPPORT_CALAO_MOB_TNY_MD2
bool
+if !AT91_MULTI_BOARDS
+
# ----------------------------------------------------------
if ARCH_AT91RM9200
@@ -399,14 +401,6 @@ if ARCH_AT91SAM9263
choice
prompt "AT91SAM9263 Board Type"
-config MACH_AT91SAM9263EK
- bool "Atmel AT91SAM9263-EK"
- select HAVE_NAND_ATMEL_BUSWIDTH_16
- select HAVE_AT91_BOOTSTRAP
- select AT91SAM926X_BOARD_INIT
- help
- Say y here if you are using Atmel's AT91SAM9263-EK Evaluation board
-
config MACH_MMCCPU
bool "Bucyrus MMC-CPU"
help
@@ -523,6 +517,7 @@ config MACH_SAMA5D4_XPLAINED
endchoice
endif
+endif
# ----------------------------------------------------------
@@ -533,6 +528,15 @@ config AT91_MULTI_BOARDS
if AT91_MULTI_BOARDS
+config MACH_AT91SAM9263EK
+ bool "Atmel AT91SAM9263-EK"
+ depends on ARCH_AT91SAM9263
+ select HAVE_NAND_ATMEL_BUSWIDTH_16
+ select HAVE_AT91_BOOTSTRAP
+ select AT91SAM926X_BOARD_INIT
+ help
+ Say y here if you are using Atmel's AT91SAM9263-EK Evaluation board
+
config MACH_AT91SAM9X5EK
bool "Atmel AT91SAM9x5 Series Evaluation Kit"
depends on ARCH_AT91SAM9X5
diff --git a/images/Makefile.at91 b/images/Makefile.at91
index dc6c1db4b..c7d86563a 100644
--- a/images/Makefile.at91
+++ b/images/Makefile.at91
@@ -5,3 +5,7 @@
pblx-$(CONFIG_MACH_AT91SAM9X5EK) += start_at91sam9x5ek
FILE_barebox-at91sam9x5ek.img = start_at91sam9x5ek.pblx
image-$(CONFIG_MACH_AT91SAM9X5EK) += barebox-at91sam9x5ek.img
+
+pblx-$(CONFIG_MACH_AT91SAM9263EK) += start_at91sam9263ek
+FILE_barebox-at91sam9263ek.img = start_at91sam9263ek.pblx
+image-$(CONFIG_MACH_AT91SAM9263EK) += barebox-at91sam9263ek.img
--
2.12.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 4/4] at91sam9263ek: enable DT support
2017-12-31 10:02 [PATCH v2 0/4] Enable DT support for AT91SAM9263EK Sam Ravnborg
` (2 preceding siblings ...)
2018-01-01 13:15 ` [PATCH 3/4] at91sam9263ek: enable multi-image build Sam Ravnborg
@ 2018-01-01 13:15 ` Sam Ravnborg
2018-01-07 22:11 ` Sam Ravnborg
2018-01-04 16:45 ` [PATCH v2 0/4] Enable DT support for AT91SAM9263EK Andrey Smirnov
4 siblings, 1 reply; 8+ messages in thread
From: Sam Ravnborg @ 2018-01-01 13:15 UTC (permalink / raw)
To: Barebox List; +Cc: Sam Ravnborg
Add at91sam9263ek.dts to build.
Include mmc1 in at91sam9263ek.dts, as mmc1 is what the evaluation
kit uses for the SD card.
Add DT specific of_init
Adjust build to drop non-DT files from mach-at91
RomBOOT
>AT91Bootstrap 3.0.1
patch-0.8 64MB Ram
Load from SD-Card
Loading from SD-Card
Open: u-boot.bin
Loading from SD-Card - Success
barebox 2017.12.0-00036-gda46de29e #23 Sun Dec 31 09:15:39 CET 2017
Board: Atmel at91sam9263ek
gpio-at91 fffff200.gpio: AT91 gpio driver registered
gpio-at91 fffff400.gpio: AT91 gpio driver registered
gpio-at91 fffff600.gpio: AT91 gpio driver registered
gpio-at91 fffff800.gpio: AT91 gpio driver registered
gpio-at91 fffffa00.gpio: AT91 gpio driver registered
pinctrl-at91 pinctrl.2: AT91 pinctrl registered
AT91: Detected soc type: at91sam9263
AT91: Detected soc subtype: Unknown
mdio_bus: miibus0: probed
macb fffbc000.ethernet: Cadence MACB at 0xfffbc000
at91_udc fff78000.gadget: at91_udc version 3 May 2006
atmel_mci fff80000.mmc: version: 0x210
atmel_mci fff80000.mmc: registered as fff80000.mmc
atmel_mci fff84000.mmc: version: 0x210
atmel_mci fff84000.mmc: registered as fff84000.mmc
malloc space: 0x239fab00 -> 0x23dfaaff (size 4 MiB)
barebox-environment environment.6: probe failed: No such device
environment load /dev/env0: No such file or directory
Maybe you have to create the partition.
running /env/bin/init...
\e[?25h
Hit any key to stop autoboot: 3
barebox@Atmel at91sam9263ek:/ iomem
0x00000000 - 0xffffffff (size 0x00000000) iomem
0x00300000 - 0x00313fff (size 0x00014000) 300000.sram
0x00500000 - 0x00503fff (size 0x00004000) 500000.sram
0x00700000 - 0x00700fff (size 0x00001000) 700000.fb
0x20000000 - 0x23ffffff (size 0x04000000) ram0
0x239fab00 - 0x23dfaaff (size 0x00400000) malloc space
0x23dfab00 - 0x23dfffe2 (size 0x000054e3) board data
0x23e00000 - 0x23e53cc8 (size 0x00053cc9) barebox
0x23e53cc9 - 0x23e6404f (size 0x00010387) barebox data
0x23e64050 - 0x23e6754b (size 0x000034fc) bss
0x23fe4000 - 0x23fe7fff (size 0x00004000) ttb
0x23fe8000 - 0x23feffff (size 0x00008000) stack
0xfff78000 - 0xfff7bfff (size 0x00004000) fff78000.gadget
0xfff80000 - 0xfff805ff (size 0x00000600) fff80000.mmc
0xfff84000 - 0xfff845ff (size 0x00000600) fff84000.mmc
0xfff8c000 - 0xfff8c1ff (size 0x00000200) fff8c000.serial
0xfffbc000 - 0xfffbc0ff (size 0x00000100) fffbc000.ethernet
0xffffee00 - 0xffffefff (size 0x00000200) ffffee00.serial
0xfffff200 - 0xfffff3ff (size 0x00000200) fffff200.gpio
0xfffff400 - 0xfffff5ff (size 0x00000200) fffff400.gpio
0xfffff600 - 0xfffff7ff (size 0x00000200) fffff600.gpio
0xfffff800 - 0xfffff9ff (size 0x00000200) fffff800.gpio
0xfffffa00 - 0xfffffbff (size 0x00000200) fffffa00.gpio
0xfffffd30 - 0xfffffd3e (size 0x0000000f) fffffd30.timer
barebox@Atmel at91sam9263ek:/ devinfo
`-- global
`-- nv
`-- platform
`-- mem0
`-- 0x00000000-0x03ffffff ( 64 MiB): /dev/ram0
`-- 300000.sram
`-- 0x00000000-0x00013fff ( 80 KiB): /dev/sram0
`-- 500000.sram
`-- 0x00000000-0x00003fff ( 16 KiB): /dev/sram1
`-- ahb.0
`-- apb.1
`-- fffff000.interrupt-controller
`-- fffffc00.pmc
`-- ffffe200.ramc
`-- ffffe400.smc
`-- ffffe800.ramc
`-- ffffea00.smc
`-- ffffec00.matrix
`-- fffffd30.timer
`-- fff7c000.timer
`-- fffffd00.rstc
`-- fffffd10.shdwc
`-- pinctrl.2
`-- fffff200.gpio
`-- fffff400.gpio
`-- fffff600.gpio
`-- fffff800.gpio
`-- fffffa00.gpio
`-- ffffee00.serial
`-- cs0
`-- 0x00000000-0xffffffffffffffff ( 0 Bytes): /dev/cs0
`-- fff8c000.serial
`-- cs1
`-- 0x00000000-0xffffffffffffffff ( 0 Bytes): /dev/cs1
`-- fffbc000.ethernet
`-- miibus0
`-- eth0
`-- fff78000.gadget
`-- usbgadget
`-- fff80000.mmc
`-- mci0
`-- fff84000.mmc
`-- mci1
`-- fffffd40.watchdog
`-- fffa4000.spi
`-- fffac000.can
`-- 700000.fb
`-- a00000.ohci
`-- 10000000.ebi
`-- i2c-gpio-0.3
`-- leds.4
`-- gpio_keys.5
`-- cs2
`-- 0x00000000-0xffffffffffffffff ( 0 Bytes): /dev/cs2
`-- soc
`-- mem1
`-- 0x00000000-0xfffffffe ( 4 GiB): /dev/mem
`-- environment.6
`-- mdio_bus
`-- fs
`-- ramfs0
`-- devfs0
`-- net
`-- udc0
`-- fb0
`-- 0x00000000-0x000257ff ( 150 KiB): /dev/fb0
barebox@Atmel at91sam9263ek:/ drvinfo
Driver Device(s)
--------------------
syscon
at91-pit
fffffd30.timer
gpio-at91
fffff200.gpio
fffff400.gpio
fffff600.gpio
fffff800.gpio
fffffa00.gpio
pinctrl-at91
pinctrl.2
atmel_usart
ffffee00.serial
fff8c000.serial
ramfs
ramfs0
devfs
devfs0
fat
tftp
at91sam9-smc
Generic PHY
macb
fffbc000.ethernet
atmel_nand
cfi_flash
at91_udc
fff78000.gadget
atmel_mci
fff80000.mmc
fff84000.mmc
atmel_lcdfb
700000.fb
gpio-leds
leds.4
gpio_keys
gpio_keys.5
mmio-sram
300000.sram
500000.sram
mem
mem0
mem1
barebox-environment
Use 'devinfo DEVICE' for more information
barebox@Atmel at91sam9263ek:/ gpioinfo
GPIOs 0-31, chip fffff200.gpio:
dir val requested label
GPIO 0: unk hi false
GPIO 1: unk hi false
GPIO 2: in hi false
GPIO 3: unk hi false
GPIO 4: unk hi false
GPIO 5: unk hi false
GPIO 6: unk lo false
GPIO 7: unk hi false
GPIO 8: unk hi false
GPIO 9: unk hi false
GPIO 10: unk hi false
GPIO 11: unk hi false
GPIO 12: unk hi false
GPIO 13: in hi false
GPIO 14: in hi false
GPIO 15: in hi false
GPIO 16: in hi false
GPIO 17: in hi false
GPIO 18: in hi false
GPIO 19: in lo false
GPIO 20: in hi false
GPIO 21: in hi false
GPIO 22: in hi false
GPIO 23: in hi false
GPIO 24: in hi false
GPIO 25: in lo true udc_vbus
GPIO 26: unk hi false
GPIO 27: unk hi false
GPIO 28: unk hi false
GPIO 29: unk hi false
GPIO 30: in lo false
GPIO 31: in hi false
GPIOs 32-63, chip fffff400.gpio:
dir val requested label
GPIO 32: in hi false
GPIO 33: in hi false
GPIO 34: in hi false
GPIO 35: in hi false
GPIO 36: in hi false
GPIO 37: in hi false
GPIO 38: in hi false
GPIO 39: out hi true d3
GPIO 40: in hi false
GPIO 41: unk hi false
GPIO 42: in hi false
GPIO 43: in hi false
GPIO 44: in hi false
GPIO 45: in hi false
GPIO 46: in hi false
GPIO 47: in hi false
GPIO 48: in hi false
GPIO 49: in hi false
GPIO 50: in hi false
GPIO 51: in hi false
GPIO 52: in hi false
GPIO 53: in hi false
GPIO 54: in hi false
GPIO 55: in hi false
GPIO 56: in hi false
GPIO 57: in hi false
GPIO 58: in hi false
GPIO 59: out lo active low PHY 50 MHz oscillator
GPIO 60: in hi false
GPIO 61: in hi false
GPIO 62: in hi false
GPIO 63: in hi false
GPIOs 64-95, chip fffff600.gpio:
dir val requested label
GPIO 64: in hi false
GPIO 65: unk hi false
GPIO 66: unk hi false
GPIO 67: unk hi false
GPIO 68: in hi true gpio_keys
GPIO 69: in hi true gpio_keys
GPIO 70: unk lo false
GPIO 71: unk lo false
GPIO 72: unk lo false
GPIO 73: unk lo false
GPIO 74: unk lo false
GPIO 75: unk lo false
GPIO 76: unk lo false
GPIO 77: in hi false
GPIO 78: unk lo false
GPIO 79: unk lo false
GPIO 80: unk lo false
GPIO 81: unk lo false
GPIO 82: unk lo false
GPIO 83: unk lo false
GPIO 84: in hi false
GPIO 85: in hi false
GPIO 86: unk lo false
GPIO 87: unk lo false
GPIO 88: unk lo false
GPIO 89: unk lo false
GPIO 90: unk lo false
GPIO 91: unk lo false
GPIO 92: in hi false
GPIO 93: in hi true d2
GPIO 94: unk hi false
GPIO 95: unk hi false
GPIOs 96-127, chip fffff800.gpio:
dir val requested label
GPIO 96: in hi false
GPIO 97: in hi false
GPIO 98: in hi false
GPIO 99: in hi false
GPIO 100: in hi false
GPIO 101: in hi false
GPIO 102: in hi false
GPIO 103: in hi false
GPIO 104: in hi false
GPIO 105: in hi false
GPIO 106: in hi false
GPIO 107: in hi false
GPIO 108: unk lo false
GPIO 109: unk lo false
GPIO 110: unk lo false
GPIO 111: in hi false
GPIO 112: unk lo false
GPIO 113: unk hi false
GPIO 114: unk hi false
GPIO 115: unk lo false
GPIO 116: unk hi false
GPIO 117: unk hi false
GPIO 118: unk hi false
GPIO 119: unk hi false
GPIO 120: unk lo false
GPIO 121: unk hi false
GPIO 122: unk hi false
GPIO 123: unk lo false
GPIO 124: unk hi false
GPIO 125: unk hi false
GPIO 126: unk hi false
GPIO 127: unk hi false
GPIOs 128-159, chip fffffa00.gpio:
dir val requested label
GPIO 128: in hi false
GPIO 129: in hi false
GPIO 130: in hi false
GPIO 131: in hi false
GPIO 132: in hi false
GPIO 133: in hi false
GPIO 134: in hi false
GPIO 135: in hi false
GPIO 136: in hi false
GPIO 137: in hi false
GPIO 138: in hi false
GPIO 139: in hi false
GPIO 140: in hi false
GPIO 141: in hi false
GPIO 142: in hi false
GPIO 143: in hi false
GPIO 144: in hi false
GPIO 145: in hi false
GPIO 146: in lo true mci_cd
GPIO 147: in hi false
GPIO 148: in hi false
GPIO 149: unk lo false
GPIO 150: in hi false
GPIO 151: unk lo false
GPIO 152: unk lo false
GPIO 153: unk lo false
GPIO 154: unk lo false
GPIO 155: unk lo false
GPIO 156: unk lo false
GPIO 157: unk lo false
GPIO 158: unk hi false
GPIO 159: in hi false
barebox@Atmel at91sam9263ek:/ clk_dump
slow_xtal (rate 32768, enabled)
prog0 (rate 32768, enabled)
pck0 (rate 32768, disabled)
prog1 (rate 32768, enabled)
pck1 (rate 32768, disabled)
prog2 (rate 32768, enabled)
pck2 (rate 32768, disabled)
prog3 (rate 32768, enabled)
pck3 (rate 32768, disabled)
main_xtal (rate 16367660, enabled)
main_osc (rate 16367660, enabled)
mainck (rate 16367660, enabled)
pllbck (rate 98205960, enabled)
usbck (rate 49102980, enabled)
uhpck (rate 49102980, disabled)
udpck (rate 49102980, disabled)
pllack (rate 204595750, enabled)
masterck (rate 102297875, enabled)
pioA_clk (rate 102297875, enabled)
pioB_clk (rate 102297875, enabled)
pioCDE_clk (rate 102297875, enabled)
usart0_clk (rate 102297875, enabled)
usart1_clk (rate 102297875, disabled)
usart2_clk (rate 102297875, disabled)
mci0_clk (rate 102297875, disabled)
mci1_clk (rate 102297875, disabled)
can_clk (rate 102297875, disabled)
twi0_clk (rate 102297875, disabled)
spi0_clk (rate 102297875, disabled)
spi1_clk (rate 102297875, disabled)
ssc0_clk (rate 102297875, disabled)
ssc1_clk (rate 102297875, disabled)
ac97_clk (rate 102297875, disabled)
tcb_clk (rate 102297875, disabled)
pwm_clk (rate 102297875, disabled)
macb0_clk (rate 102297875, enabled)
g2de_clk (rate 102297875, disabled)
udc_clk (rate 102297875, disabled)
isi_clk (rate 102297875, disabled)
lcd_clk (rate 102297875, enabled)
dma_clk (rate 102297875, disabled)
ohci_clk (rate 102297875, disabled)
barebox@Atmel at91sam9263ek:/ led
registered LEDs:
0 : name: d3 max_value: 1
1 : name: d2 max_value: 1
barebox@Atmel at91sam9263ek:/ led 1 1
barebox@Atmel at91sam9263ek:/ led 0 1
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
arch/arm/boards/at91sam9263ek/Makefile | 4 +-
arch/arm/boards/at91sam9263ek/lowlevel_init.c | 15 ++++-
arch/arm/boards/at91sam9263ek/of_init.c | 93 +++++++++++++++++++++++++++
arch/arm/configs/at91sam9263ek_defconfig | 6 ++
arch/arm/dts/Makefile | 2 +-
arch/arm/dts/at91sam9263ek.dts | 48 ++++++++++++++
arch/arm/mach-at91/Kconfig | 10 +++
arch/arm/mach-at91/Makefile | 4 +-
8 files changed, 176 insertions(+), 6 deletions(-)
create mode 100644 arch/arm/boards/at91sam9263ek/of_init.c
create mode 100644 arch/arm/dts/at91sam9263ek.dts
diff --git a/arch/arm/boards/at91sam9263ek/Makefile b/arch/arm/boards/at91sam9263ek/Makefile
index de4d75690..7af6fab8e 100644
--- a/arch/arm/boards/at91sam9263ek/Makefile
+++ b/arch/arm/boards/at91sam9263ek/Makefile
@@ -1,4 +1,6 @@
-obj-y += init.o
+obj-$(CONFIG_AT91_BOOTSTRAP) += init.o
+obj-$(CONFIG_OF_DEVICE) += of_init.o
lwl-y += lowlevel_init.o
+
bbenv-$(CONFIG_DEFAULT_ENVIRONMENT_GENERIC) += defaultenv-at91sam9263ek
diff --git a/arch/arm/boards/at91sam9263ek/lowlevel_init.c b/arch/arm/boards/at91sam9263ek/lowlevel_init.c
index 3138bc7ca..2004d70cb 100644
--- a/arch/arm/boards/at91sam9263ek/lowlevel_init.c
+++ b/arch/arm/boards/at91sam9263ek/lowlevel_init.c
@@ -99,7 +99,7 @@ static void __bare_init at91sam9263ek_board_config(struct at91sam926x_board_cfg
AT91_RSTC_RSTTYP_WATCHDOG;
}
-static void __bare_init at91sam9263ek_init(void)
+static void __bare_init at91sam9263ek_init(void *fdt)
{
struct at91sam926x_board_cfg cfg;
@@ -112,14 +112,23 @@ static void __bare_init at91sam9263ek_init(void)
at91sam926x_board_init(&cfg);
barebox_arm_entry(AT91_CHIPSELECT_1, at91_get_sdram_size(cfg.sdramc),
- NULL);
+ fdt);
}
+extern char __dtb_at91sam9263ek_start[];
+
ENTRY_FUNCTION(start_at91sam9263ek, r0, r1, r2)
{
+ void *fdt;
+
arm_cpu_lowlevel_init();
arm_setup_stack(AT91SAM9263_SRAM0_BASE + AT91SAM9263_SRAM0_SIZE - 16);
- at91sam9263ek_init();
+ if (IS_ENABLED(CONFIG_MACH_AT91SAM9263EK_DT))
+ fdt = __dtb_at91sam9263ek_start - get_runtime_offset();
+ else
+ fdt = NULL;
+
+ at91sam9263ek_init(fdt);
}
diff --git a/arch/arm/boards/at91sam9263ek/of_init.c b/arch/arm/boards/at91sam9263ek/of_init.c
new file mode 100644
index 000000000..5da808e5c
--- /dev/null
+++ b/arch/arm/boards/at91sam9263ek/of_init.c
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2017 Sam Ravnborg <sam@ravnborg.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <common.h>
+#include <envfs.h>
+#include <init.h>
+#include <gpio.h>
+
+#include <mach/at91sam9263_matrix.h>
+#include <mach/at91sam9_smc.h>
+#include <mach/at91_rtt.h>
+#include <mach/hardware.h>
+#include <mach/iomux.h>
+#include <mach/io.h>
+
+static struct sam9_smc_config ek_nand_smc_config = {
+ .ncs_read_setup = 0,
+ .nrd_setup = 1,
+ .ncs_write_setup = 0,
+ .nwe_setup = 1,
+
+ .ncs_read_pulse = 3,
+ .nrd_pulse = 3,
+ .ncs_write_pulse = 3,
+ .nwe_pulse = 3,
+
+ .read_cycle = 5,
+ .write_cycle = 5,
+
+ .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
+ .tdf_cycles = 2,
+};
+
+/*
+ * Initialize of SMC must come after we
+ * probe the at91sam9_smc_driver.
+ * But is required before we start the other drives.
+ * Use fs_initcall() to maintain this order.
+ */
+static int at91sam9263_smc_init(void)
+{
+ unsigned long csa;
+
+ if (!of_machine_is_compatible("atmel,at91sam9263ek"))
+ return 0;
+
+ /* setup bus-width (8 or 16) */
+ if (IS_ENABLED(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16))
+ ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
+ else
+ ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
+
+ csa = at91_sys_read(AT91_MATRIX_EBI0CSA);
+ csa |= AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA;
+ at91_sys_write(AT91_MATRIX_EBI0CSA, csa);
+
+ /* configure chip-select 3 (NAND) */
+ sam9_smc_configure(0, 3, &ek_nand_smc_config);
+
+ add_generic_device("at91sam9-smc", 0, NULL, AT91SAM9263_BASE_SMC0, 0x200,
+ IORESOURCE_MEM, NULL);
+ add_generic_device("at91sam9-smc", 1, NULL, AT91SAM9263_BASE_SMC1, 0x200,
+ IORESOURCE_MEM, NULL);
+
+ return 0;
+}
+fs_initcall(at91sam9263_smc_init);
+
+static int at91sam9263ek_env_init(void)
+{
+ if (!of_machine_is_compatible("atmel,at91sam9263ek"))
+ return 0;
+
+ at91_rtt_irq_fixup(IOMEM(AT91SAM9263_BASE_RTT0));
+ at91_rtt_irq_fixup(IOMEM(AT91SAM9263_BASE_RTT1));
+
+ if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT_GENERIC))
+ defaultenv_append_directory(defaultenv_at91sam9263ek);
+
+ return 0;
+}
+late_initcall(at91sam9263ek_env_init);
diff --git a/arch/arm/configs/at91sam9263ek_defconfig b/arch/arm/configs/at91sam9263ek_defconfig
index fc92615eb..e8ad841fa 100644
--- a/arch/arm/configs/at91sam9263ek_defconfig
+++ b/arch/arm/configs/at91sam9263ek_defconfig
@@ -20,6 +20,7 @@ CONFIG_CONSOLE_ACTIVATE_ALL=y
CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
# CONFIG_CMD_ARM_CPUINFO is not set
CONFIG_LONGHELP=y
+CONFIG_CMD_IOMEM=y
CONFIG_CMD_MEMINFO=y
# CONFIG_CMD_BOOTU is not set
CONFIG_CMD_GO=y
@@ -38,6 +39,7 @@ CONFIG_CMD_EDIT=y
CONFIG_CMD_SPLASH=y
CONFIG_CMD_READLINE=y
CONFIG_CMD_TIMEOUT=y
+CONFIG_CMD_CLK=y
CONFIG_CMD_FLASH=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_LED=y
@@ -45,6 +47,7 @@ CONFIG_CMD_LED_TRIGGER=y
CONFIG_CMD_OFTREE=y
CONFIG_NET=y
CONFIG_NET_NFS=y
+CONFIG_OF_BAREBOX_DRIVERS=y
CONFIG_DRIVER_NET_MACB=y
# CONFIG_SPI is not set
CONFIG_MTD=y
@@ -64,9 +67,12 @@ CONFIG_VIDEO=y
CONFIG_DRIVER_VIDEO_ATMEL=y
CONFIG_MCI=y
CONFIG_MCI_ATMEL=y
+CONFIG_SRAM=y
CONFIG_LED=y
CONFIG_LED_GPIO=y
+CONFIG_LED_GPIO_OF=y
CONFIG_LED_TRIGGERS=y
+CONFIG_KEYBOARD_GPIO=y
CONFIG_FS_TFTP=y
CONFIG_FS_FAT=y
CONFIG_FS_FAT_LFN=y
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 4f13d4e37..0526a6f40 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -104,7 +104,7 @@ pbl-dtb-$(CONFIG_MACH_ZII_VF610_DEV) += \
vf610-zii-cfu1-rev-a.dtb.o \
vf610-zii-spu3-rev-a.dtb.o \
vf610-zii-scu4-aib-rev-c.dtb.o
-
+pbl-dtb-$(CONFIG_MACH_AT91SAM9263EK_DT) += at91sam9263ek.dtb.o
pbl-dtb-$(CONFIG_MACH_AT91SAM9X5EK) += at91sam9x5ek.dtb.o
clean-files := *.dtb *.dtb.S .*.dtc .*.pre .*.dts *.dtb.lzo
diff --git a/arch/arm/dts/at91sam9263ek.dts b/arch/arm/dts/at91sam9263ek.dts
new file mode 100644
index 000000000..3681b845d
--- /dev/null
+++ b/arch/arm/dts/at91sam9263ek.dts
@@ -0,0 +1,48 @@
+#include <arm/at91sam9263ek.dts>
+/ {
+ chosen {
+ environment@0 {
+ compatible = "barebox,environment";
+ device-path = &nand_controller, "partname:bareboxenv";
+ };
+ };
+
+ ahb {
+ apb {
+ mmc1: mmc@fff84000 {
+ pinctrl-0 = <
+ &pinctrl_board_mmc1
+ &pinctrl_mmc1_clk
+ &pinctrl_mmc1_slot0_cmd_dat0
+ &pinctrl_mmc1_slot0_dat1_3>;
+ cd-gpios = <&pioE 18 GPIO_ACTIVE_HIGH>;
+ status = "okay";
+ slot@0 {
+ reg = <0>;
+ bus-width = <4>;
+ cd-gpios = <&pioE 18 GPIO_ACTIVE_HIGH>;
+ wp-gpios = <&pioE 19 GPIO_ACTIVE_HIGH>;
+ };
+ };
+ };
+ };
+
+
+ pinctrl@fffff200 {
+ pinctrl_board_mmc1: mmc1-board {
+ atmel,pins =
+ <AT91_PIOE 18 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH /* PE18 gpio CD pin pull up and deglitch */
+ AT91_PIOE 19 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>; /* PE19 gpio WP pin pull up */
+ };
+ };
+};
+
+&pioB {
+ /* Enable the 50MHz oscillator for Ethernet PHY */
+ phy_50mhz {
+ gpio-hog;
+ gpios = <27 GPIO_ACTIVE_LOW>;
+ output-high;
+ line-name = "PHY 50 MHz oscillator";
+ };
+};
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index f5160ade1..a4fc024c1 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -20,6 +20,13 @@ config COMMON_CLK_AT91
select COMMON_CLK
select MFD_SYSCON
+config MACH_AT91SAM9263EK_DT
+ def_bool y
+ depends on MACH_AT91SAM9263EK && OFDEVICE
+ help
+ Enabled for at91sam9263ek - evaluation kit.
+ But only if we need the device tree (bootstrap do not use DT)
+
config HAVE_AT91_SMD
bool
@@ -531,6 +538,9 @@ if AT91_MULTI_BOARDS
config MACH_AT91SAM9263EK
bool "Atmel AT91SAM9263-EK"
depends on ARCH_AT91SAM9263
+ select OFDEVICE
+ select COMMON_CLK_OF_PROVIDER
+ select HAVE_AT91_USB_CLK
select HAVE_NAND_ATMEL_BUSWIDTH_16
select HAVE_AT91_BOOTSTRAP
select AT91SAM926X_BOARD_INIT
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 8adeee9bc..664201ceb 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -17,8 +17,10 @@ obj-$(CONFIG_AT91SAM9_SMC) += sam9_smc.o
obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200.o at91rm9200_time.o at91rm9200_devices.o
obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260.o at91sam9260_devices.o
obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam9261_devices.o
-obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam9263_devices.o
obj-$(CONFIG_ARCH_AT91SAM9G10) += at91sam9261.o at91sam9261_devices.o
+ifeq ($(CONFIG_OFDEVICE),)
+obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam9263_devices.o
+endif
obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam9260_devices.o
obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45.o at91sam9g45_devices.o
obj-$(CONFIG_ARCH_AT91SAM9X5) += at91sam9x5_devices.o
--
2.12.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/4] Enable DT support for AT91SAM9263EK
2017-12-31 10:02 [PATCH v2 0/4] Enable DT support for AT91SAM9263EK Sam Ravnborg
` (3 preceding siblings ...)
2018-01-01 13:15 ` [PATCH 4/4] at91sam9263ek: enable DT support Sam Ravnborg
@ 2018-01-04 16:45 ` Andrey Smirnov
2018-01-04 17:52 ` Sam Ravnborg
4 siblings, 1 reply; 8+ messages in thread
From: Andrey Smirnov @ 2018-01-04 16:45 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: Barebox List
On Sun, Dec 31, 2017 at 2:02 AM, Sam Ravnborg <sam@ravnborg.org> wrote:
> This is version 2 of a patchset to enable
> device tree support for AT91SAM9263EK.
>
> On the quest towards getting so far several drivers was
> converted to support DT.
> These patches went in around august.
>
> There was also issues with mach-at91 calling code
> in the board directory (dependency in the
> wrong direction).
> This was fixed in "at91: move reset .." which is
> pending (already posted).
>
> I have failed to get the bootstrap mode to work.
> It stops somewhere - and I have not invested enough
> time to figure out where and why things goes wrong.
> bootstrap mode was also broken before these patches.
> No JTAG debugger available to help me.
> And then I have at91bootstrap that works so motivation
> was not too high.
>
> I do not think the NAND support works either.
> The device tree introduces some nand-controller
> stuff that is not supported by barebox (at least I assume so).
> And this part I did not look further into.
>
> Next step is to get a proprietary board up and
> running (which uses NOR flash).
> But I wanted this patchset out in the open first.
>
> Any fedback highly appreciated!
>
> Sam
>
> v1 => v2
> Based on feedback from Andrey (thanks!)
> Patches reworked and combined as a result of this
>
> - Included two patches that makes some general
> improvements to mach-at91.
> (Updated since the RFC versions sent yesterday)
>
> - Move irq_fixup, thus allowing us to call this
> from board code. This makes it possible to have
> less dependencies between board code and the processor
> specific files in mach-at91.
>
> - Simplified soc setup. With this change setup.c
> no longer requires that at least one of the
> processor specific files are built.
>
> - Create a minimal dts file, based on top of the
> dts file supplied from the kernel.
>
> - Utilise gpio-hog - to setup gpio for PHY.
>
> - Simpler Makefile logic in board Makefile
> It is now obvious that init.c is only used for
> bootstrap
>
> - Processor specific files in mach-at91 no longer
> used when DT is enabled
>
> - Use IS_ENABLED() when it makes code simpler
>
Didn't see anything unreasonable in this series, so:
Reviewed-by: Andrey Smirnov <andrew.smirnov@gmail.com>
One note though, Sam, I can see re-roll count in the subject of the
cover letter, but not in the subject of the patches that follow. Would
you mind using "git format-patche" with --reroll-count (-v) going
forward? It's way easier to figure out the version of a given patch in
a series if you can see that in the header.
Thanks,
Andrey Smirnov
>
>
>
> Sam Ravnborg (4):
> arm: at91: move irq_fixup to header file
> arm: at91: simplify soc setup
> at91sam9263ek: enable multi-image build
> at91sam9263ek: enable DT support
>
> arch/arm/boards/at91sam9263ek/Makefile | 4 +-
> arch/arm/boards/at91sam9263ek/lowlevel_init.c | 17 +++--
> arch/arm/boards/at91sam9263ek/of_init.c | 93 +++++++++++++++++++++++++++
> arch/arm/configs/at91sam9263ek_defconfig | 10 ++-
> arch/arm/dts/Makefile | 2 +-
> arch/arm/dts/at91sam9263ek.dts | 48 ++++++++++++++
> arch/arm/mach-at91/Kconfig | 30 ++++++---
> arch/arm/mach-at91/Makefile | 6 +-
> arch/arm/mach-at91/at91rm9200.c | 10 +--
> arch/arm/mach-at91/at91sam9260.c | 10 +--
> arch/arm/mach-at91/at91sam9260_devices.c | 1 +
> arch/arm/mach-at91/at91sam9261.c | 10 +--
> arch/arm/mach-at91/at91sam9261_devices.c | 1 +
> arch/arm/mach-at91/at91sam9263.c | 10 +--
> arch/arm/mach-at91/at91sam9263_devices.c | 1 +
> arch/arm/mach-at91/at91sam9g45.c | 10 +--
> arch/arm/mach-at91/at91sam9g45_devices.c | 1 +
> arch/arm/mach-at91/at91sam9n12.c | 10 +--
> arch/arm/mach-at91/generic.h | 11 +++-
> arch/arm/mach-at91/include/mach/at91_rtt.h | 16 +++++
> arch/arm/mach-at91/irq_fixup.c | 22 -------
> arch/arm/mach-at91/sama5d3.c | 10 +--
> arch/arm/mach-at91/sama5d4.c | 10 +--
> arch/arm/mach-at91/setup.c | 26 ++------
> arch/arm/mach-at91/soc.h | 76 ----------------------
> images/Makefile.at91 | 4 ++
> 26 files changed, 277 insertions(+), 172 deletions(-)
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/4] Enable DT support for AT91SAM9263EK
2018-01-04 16:45 ` [PATCH v2 0/4] Enable DT support for AT91SAM9263EK Andrey Smirnov
@ 2018-01-04 17:52 ` Sam Ravnborg
0 siblings, 0 replies; 8+ messages in thread
From: Sam Ravnborg @ 2018-01-04 17:52 UTC (permalink / raw)
To: Andrey Smirnov, Sascha Hauer; +Cc: Barebox List
Hi Andrey.
> Didn't see anything unreasonable in this series, so:
>
> Reviewed-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Thanks for the review!
> One note though, Sam, I can see re-roll count in the subject of the
> cover letter, but not in the subject of the patches that follow. Would
> you mind using "git format-patche" with --reroll-count (-v) going
> forward? It's way easier to figure out the version of a given patch in
> a series if you can see that in the header.
I have somehow missed this option - will use it in the future.
@Sascha - let me know if you want me to re-submit this
and the other patch-set with Andrey's ack.
Sam
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 4/4] at91sam9263ek: enable DT support
2018-01-01 13:15 ` [PATCH 4/4] at91sam9263ek: enable DT support Sam Ravnborg
@ 2018-01-07 22:11 ` Sam Ravnborg
0 siblings, 0 replies; 8+ messages in thread
From: Sam Ravnborg @ 2018-01-07 22:11 UTC (permalink / raw)
To: Barebox List
On Mon, Jan 01, 2018 at 02:15:23PM +0100, Sam Ravnborg wrote:
> Add at91sam9263ek.dts to build.
> Include mmc1 in at91sam9263ek.dts, as mmc1 is what the evaluation
> kit uses for the SD card.
...
This patch is buggy and needs an update.
The call to sam9_smc_configure() happens before the device are
registered - so probe is not done.
I will respin the patch in the coming week - needs to test it a bit more.
The first three patches are OK.
Sam
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-01-07 22:12 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-31 10:02 [PATCH v2 0/4] Enable DT support for AT91SAM9263EK Sam Ravnborg
2018-01-01 13:15 ` [PATCH 1/4] arm: at91: move irq_fixup to header file Sam Ravnborg
2018-01-01 13:15 ` [PATCH 2/4] arm: at91: simplify soc setup Sam Ravnborg
2018-01-01 13:15 ` [PATCH 3/4] at91sam9263ek: enable multi-image build Sam Ravnborg
2018-01-01 13:15 ` [PATCH 4/4] at91sam9263ek: enable DT support Sam Ravnborg
2018-01-07 22:11 ` Sam Ravnborg
2018-01-04 16:45 ` [PATCH v2 0/4] Enable DT support for AT91SAM9263EK Andrey Smirnov
2018-01-04 17:52 ` Sam Ravnborg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox