Skip to contentSkip to conversation

Add support for SUNXI boards

PATCH In review GP Orcullo 5 participants 18 messages Apr 16, 2015 – Apr 18, 2015

Subsystems (4)
lore
Share & tools
lore

GP Orcullo

author
#0 lore raw

PATCH 1/1 Add support for SUNXI boards

Tested on a Cubieboard2 with v3.16.7-ckt9 kernel.

---
 arch/arm/mach-sunxi/Kconfig     |    1 +
 drivers/irqchip/irq-sunxi-nmi.c |    7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)
arch/arm/mach-sunxi/Kconfig +1 -0
index 0fbd4f1..96d76da8 100644
@@ -6,6 +6,7 @@ menuconfig ARCH_SUNXI
 	select PINCTRL
 	select PINCTRL_SUNXI
 	select SUN4I_TIMER
+	select IPIPE_ARM_KUSER_TSC if IPIPE
 
 if ARCH_SUNXI
 
drivers/irqchip/irq-sunxi-nmi.c +4 -3
index 12f547a..d3e8da2 100644
@@ -77,8 +77,9 @@ static int sunxi_sc_nmi_set_type(struct irq_data *data, unsigned int flow_type)
 	u32 ctrl_off = ct->regs.type;
 	unsigned int src_type;
 	unsigned int i;
+	unsigned long flags;
 
-	irq_gc_lock(gc);
+	flags = irq_gc_lock(gc);
 
 	switch (flow_type & IRQF_TRIGGER_MASK) {
 	case IRQ_TYPE_EDGE_FALLING:
@@ -95,7 +96,7 @@ static int sunxi_sc_nmi_set_type(struct irq_data *data, unsigned int flow_type)
 		src_type = SUNXI_SRC_TYPE_LEVEL_LOW;
 		break;
 	default:
-		irq_gc_unlock(gc);
+		irq_gc_unlock(gc, flags);
 		pr_err("%s: Cannot assign multiple trigger modes to IRQ %d.\n",
 			__func__, data->irq);
 		return -EBADR;
@@ -113,7 +114,7 @@ static int sunxi_sc_nmi_set_type(struct irq_data *data, unsigned int flow_type)
 	src_type_reg |= src_type;
 	sunxi_sc_nmi_write(gc, ctrl_off, src_type_reg);
 
-	irq_gc_unlock(gc);
+	irq_gc_unlock(gc, flags);
 
 	return IRQ_SET_MASK_OK;
 }
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 1 line · GP Orcullo

Tested on a Cubieboard2 with v3.16.7-ckt9 kernel.

Does not sunxi have GPIO ?

Signature · 1 line
					    Gilles.
author
#2 lore raw
Quoted 7 lines · Gilles Chanteperdrix
Quoted 1 line · GP Orcullo

Tested on a Cubieboard2 with v3.16.7-ckt9 kernel.

Does not sunxi have GPIO ?

--
Gilles.

There's no GPIO driver in the mainline kernel. The original sunxi kernel has incomplete support for GPIOs.

Signature · 1 line
GP Orcullo
#3 lore raw
Quoted 5 lines · GP Orcullo
Quoted 3 lines · Gilles Chanteperdrix
Quoted 1 line · GP Orcullo

Tested on a Cubieboard2 with v3.16.7-ckt9 kernel.

Quoted 7 lines
Quoted 4 lines

Does not sunxi have GPIO ?

--
Gilles.

There's no GPIO driver in the mainline kernel. The original sunxi kernel has incomplete support for GPIOs.

Ok, what about timer and tsc? Basically, you should run through the ARM porting guide and check every modification to be made. And if you have done so, the commit message should mention it.

Signature · 1 line
					    Gilles.
#4 lore raw
Quoted 11 lines · Gilles Chanteperdrix
Quoted 10 lines · GP Orcullo
Quoted 7 lines · Gilles Chanteperdrix
Quoted 1 line · GP Orcullo

Tested on a Cubieboard2 with v3.16.7-ckt9 kernel.

Does not sunxi have GPIO ?

--
Gilles.

Quoted 6 lines
Quoted 2 lines

There's no GPIO driver in the mainline kernel. The original sunxi kernel has incomplete support for GPIOs.

Ok, what about timer and tsc? Basically, you should run through the ARM porting guide and check every modification to be made. And if you have done so, the commit message should mention it.

sunxi is pretty generic ARMv7-class in that regard, but double-checking is surely better.

If time permits, I will give things a try on our Banana Pi - provided it is fine with such an old kernel (I only started with 3.19 on it).

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
#5 lore raw
Quoted 15 lines · Jan Kiszka
Quoted 14 lines · Gilles Chanteperdrix
Quoted 12 lines · GP Orcullo
Quoted 7 lines · Gilles Chanteperdrix
Quoted 1 line · GP Orcullo

Tested on a Cubieboard2 with v3.16.7-ckt9 kernel.

Does not sunxi have GPIO ?

--
Gilles.

There's no GPIO driver in the mainline kernel. The original sunxi kernel has incomplete support for GPIOs.

Quoted 6 lines
Quoted 3 lines

Ok, what about timer and tsc? Basically, you should run through the ARM porting guide and check every modification to be made. And if you have done so, the commit message should mention it.

sunxi is pretty generic ARMv7-class in that regard, but double-checking is surely better.

armv7 does not mean a particular timer. Cortex A9 or cortex A15 do, but different ones, and Cortex A8 does not for instance. The processor we are talking about is probably not a cortex A9 since on I-pipe, there is no timer or tsc defined on A9 when booting in UP mode (and GP Orcullo is booting in UP mode). So my question is not about "double-checking", it is rather the first check.

Quoted 3 lines

If time permits, I will give things a try on our Banana Pi - provided it is fine with such an old kernel (I only started with 3.19 on it).

Signature · 1 line
					    Gilles.
#6 lore raw
Quoted 23 lines · Gilles Chanteperdrix
Quoted 15 lines · Jan Kiszka
Quoted 14 lines · Gilles Chanteperdrix
Quoted 12 lines · GP Orcullo
Quoted 7 lines · Gilles Chanteperdrix
Quoted 1 line · GP Orcullo

Tested on a Cubieboard2 with v3.16.7-ckt9 kernel.

Does not sunxi have GPIO ?

--
Gilles.

There's no GPIO driver in the mainline kernel. The original sunxi kernel has incomplete support for GPIOs.

Quoted 6 lines
Quoted 3 lines

Ok, what about timer and tsc? Basically, you should run through the ARM porting guide and check every modification to be made. And if you have done so, the commit message should mention it.

sunxi is pretty generic ARMv7-class in that regard, but double-checking is surely better.

Quoted 6 lines

armv7 does not mean a particular timer. Cortex A9 or cortex A15 do, but different ones, and Cortex A8 does not for instance. The processor we are talking about is probably not a cortex A9 since on I-pipe, there is no timer or tsc defined on A9 when booting in UP mode (and GP Orcullo is booting in UP mode). So my question is not about "double-checking", it is rather the first check.

The A20 is a dual-core Cortex A7.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
#7 lore raw
Quoted 24 lines · Jan Kiszka
Quoted 23 lines · Gilles Chanteperdrix
Quoted 21 lines · Jan Kiszka
Quoted 11 lines · Gilles Chanteperdrix
Quoted 10 lines · GP Orcullo
Quoted 7 lines · Gilles Chanteperdrix
Quoted 1 line · GP Orcullo

Tested on a Cubieboard2 with v3.16.7-ckt9 kernel.

Does not sunxi have GPIO ?

--
Gilles.

Quoted 6 lines
Quoted 2 lines

There's no GPIO driver in the mainline kernel. The original sunxi kernel has incomplete support for GPIOs.

Ok, what about timer and tsc? Basically, you should run through the ARM porting guide and check every modification to be made. And if you have done so, the commit message should mention it.

sunxi is pretty generic ARMv7-class in that regard, but double-checking is surely better.

Quoted 8 lines
Quoted 6 lines

armv7 does not mean a particular timer. Cortex A9 or cortex A15 do, but different ones, and Cortex A8 does not for instance. The processor we are talking about is probably not a cortex A9 since on I-pipe, there is no timer or tsc defined on A9 when booting in UP mode (and GP Orcullo is booting in UP mode). So my question is not about "double-checking", it is rather the first check.

The A20 is a dual-core Cortex A7.

Strange that GP Orcullo is not running the kernel in SMP mode then. The question still stands, what does this processor/core use as timer/tsc?

Signature · 1 line
					    Gilles.
#8 lore raw
Quoted 32 lines · Gilles Chanteperdrix
Quoted 31 lines · Jan Kiszka
Quoted 29 lines · Gilles Chanteperdrix
Quoted 15 lines · Jan Kiszka
Quoted 14 lines · Gilles Chanteperdrix
Quoted 12 lines · GP Orcullo
Quoted 7 lines · Gilles Chanteperdrix
Quoted 1 line · GP Orcullo

Tested on a Cubieboard2 with v3.16.7-ckt9 kernel.

Does not sunxi have GPIO ?

--
Gilles.

There's no GPIO driver in the mainline kernel. The original sunxi kernel has incomplete support for GPIOs.

Quoted 6 lines
Quoted 3 lines

Ok, what about timer and tsc? Basically, you should run through the ARM porting guide and check every modification to be made. And if you have done so, the commit message should mention it.

sunxi is pretty generic ARMv7-class in that regard, but double-checking is surely better.

armv7 does not mean a particular timer. Cortex A9 or cortex A15 do, but different ones, and Cortex A8 does not for instance. The processor we are talking about is probably not a cortex A9 since on I-pipe, there is no timer or tsc defined on A9 when booting in UP mode (and GP Orcullo is booting in UP mode). So my question is not about "double-checking", it is rather the first check.

Quoted 3 lines
Quoted 1 line

The A20 is a dual-core Cortex A7.

Strange that GP Orcullo is not running the kernel in SMP mode then.

The A20 uses PSCI to implement its SMP ops, which requires some cooperation from the bootloader. Maybe he just has a too ancient bootloader.

Quoted 2 lines

The question still stands, what does this processor/core use as timer/tsc?

ARM's architected timers, mostly.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20150418/54cedb2d/attachment.sig>
#9 lore raw
Quoted 33 lines · Maxime Ripard
Quoted 32 lines · Gilles Chanteperdrix
Quoted 31 lines · Jan Kiszka
Quoted 29 lines · Gilles Chanteperdrix
Quoted 15 lines · Jan Kiszka
Quoted 14 lines · Gilles Chanteperdrix
Quoted 12 lines · GP Orcullo
Quoted 7 lines · Gilles Chanteperdrix
Quoted 1 line · GP Orcullo

Tested on a Cubieboard2 with v3.16.7-ckt9 kernel.

Does not sunxi have GPIO ?

--
Gilles.

There's no GPIO driver in the mainline kernel. The original sunxi kernel has incomplete support for GPIOs.

Quoted 6 lines
Quoted 3 lines

Ok, what about timer and tsc? Basically, you should run through the ARM porting guide and check every modification to be made. And if you have done so, the commit message should mention it.

sunxi is pretty generic ARMv7-class in that regard, but double-checking is surely better.

armv7 does not mean a particular timer. Cortex A9 or cortex A15 do, but different ones, and Cortex A8 does not for instance. The processor we are talking about is probably not a cortex A9 since on I-pipe, there is no timer or tsc defined on A9 when booting in UP mode (and GP Orcullo is booting in UP mode). So my question is not about "double-checking", it is rather the first check.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

The A20 is a dual-core Cortex A7.

Strange that GP Orcullo is not running the kernel in SMP mode then.

The A20 uses PSCI to implement its SMP ops, which requires some cooperation from the bootloader. Maybe he just has a too ancient bootloader.

Recent upstream U-boot is a must, of course. I think the upstream kernel never supported SMP without PSCI, and the now obsolete sunxi U-boot was lacking that feature.

Jan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20150418/b187c19f/attachment.sig>

#10 lore raw
Quoted 38 lines · Jan Kiszka
Quoted 37 lines · Maxime Ripard
Quoted 35 lines · Gilles Chanteperdrix
Quoted 24 lines · Jan Kiszka
Quoted 23 lines · Gilles Chanteperdrix
Quoted 21 lines · Jan Kiszka
Quoted 11 lines · Gilles Chanteperdrix
Quoted 10 lines · GP Orcullo
Quoted 7 lines · Gilles Chanteperdrix
Quoted 1 line · GP Orcullo

Tested on a Cubieboard2 with v3.16.7-ckt9 kernel.

Does not sunxi have GPIO ?

--
Gilles.

Quoted 6 lines
Quoted 2 lines

There's no GPIO driver in the mainline kernel. The original sunxi kernel has incomplete support for GPIOs.

Ok, what about timer and tsc? Basically, you should run through the ARM porting guide and check every modification to be made. And if you have done so, the commit message should mention it.

sunxi is pretty generic ARMv7-class in that regard, but double-checking is surely better.

Quoted 8 lines
Quoted 6 lines

armv7 does not mean a particular timer. Cortex A9 or cortex A15 do, but different ones, and Cortex A8 does not for instance. The processor we are talking about is probably not a cortex A9 since on I-pipe, there is no timer or tsc defined on A9 when booting in UP mode (and GP Orcullo is booting in UP mode). So my question is not about "double-checking", it is rather the first check.

The A20 is a dual-core Cortex A7.

Strange that GP Orcullo is not running the kernel in SMP mode then.

Quoted 7 lines
Quoted 3 lines

The A20 uses PSCI to implement its SMP ops, which requires some cooperation from the bootloader. Maybe he just has a too ancient bootloader.

Recent upstream U-boot is a must, of course. I think the upstream kernel never supported SMP without PSCI, and the now obsolete sunxi U-boot was lacking that feature.

Exactly.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20150418/46187f72/attachment.sig>
author
#11 lore raw
In reply to Jan Kiszka
Quoted 22 lines · Jan Kiszka
Quoted 11 lines · Gilles Chanteperdrix
Quoted 10 lines · GP Orcullo
Quoted 7 lines · Gilles Chanteperdrix
Quoted 1 line · GP Orcullo

Tested on a Cubieboard2 with v3.16.7-ckt9 kernel.

Does not sunxi have GPIO ?

--
Gilles.

Quoted 6 lines
Quoted 2 lines

There's no GPIO driver in the mainline kernel. The original sunxi kernel has incomplete support for GPIOs.

Ok, what about timer and tsc? Basically, you should run through the ARM porting guide and check every modification to be made. And if you have done so, the commit message should mention it.

sunxi is pretty generic ARMv7-class in that regard, but double-checking is surely better.

Quoted 8 lines

If time permits, I will give things a try on our Banana Pi - provided it is fine with such an old kernel (I only started with 3.19 on it).

Jan

--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux

Use the kernel provided by Debian:
https://packages.debian.org/jessie/linux-image-3.16.0-4-armmp-lpae, as most of the sunxi patches were backported.

Signature · 1 line
GP Orcullo
#12 lore raw
Quoted 28 lines · GP Orcullo
Quoted 27 lines · Jan Kiszka
Quoted 11 lines · Gilles Chanteperdrix
Quoted 10 lines · GP Orcullo
Quoted 7 lines · Gilles Chanteperdrix
Quoted 1 line · GP Orcullo

Tested on a Cubieboard2 with v3.16.7-ckt9 kernel.

Does not sunxi have GPIO ?

--
Gilles.

Quoted 6 lines
Quoted 2 lines

There's no GPIO driver in the mainline kernel. The original sunxi kernel has incomplete support for GPIOs.

Ok, what about timer and tsc? Basically, you should run through the ARM porting guide and check every modification to be made. And if you have done so, the commit message should mention it.

sunxi is pretty generic ARMv7-class in that regard, but double-checking is surely better.

If time permits, I will give things a try on our Banana Pi - provided it is fine with such an old kernel (I only started with 3.19 on it).

Jan

Quoted 7 lines
Quoted 3 lines

--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux

Use the kernel provided by Debian:
https://packages.debian.org/jessie/linux-image-3.16.0-4-armmp-lpae, as most of the sunxi patches were backported.

Be careful when using non-mainline kernel, some additional I-pipe changes may be needed on top of the kernel differences with mainline.

Signature · 1 line
					    Gilles.
#13 lore raw
In reply to GP Orcullo
Quoted 5 lines · GP Orcullo
Quoted 3 lines · Gilles Chanteperdrix
Quoted 1 line · GP Orcullo

Tested on a Cubieboard2 with v3.16.7-ckt9 kernel.

Quoted 7 lines
Quoted 4 lines

Does not sunxi have GPIO ?

--
Gilles.

There's no GPIO driver in the mainline kernel. The original sunxi kernel has incomplete support for GPIOs.

That's not true.

The GPIO support has been feature complete since 3.11.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20150418/9c8cf63a/attachment.sig>
author
#14 lore raw
Quoted 11 lines · Maxime Ripard
Quoted 10 lines · GP Orcullo
Quoted 7 lines · Gilles Chanteperdrix
Quoted 1 line · GP Orcullo

Tested on a Cubieboard2 with v3.16.7-ckt9 kernel.

Does not sunxi have GPIO ?

--
Gilles.

Quoted 7 lines
Quoted 2 lines

There's no GPIO driver in the mainline kernel. The original sunxi kernel has incomplete support for GPIOs.

That's not true.

The GPIO support has been feature complete since 3.11.

I'm not sure if it supports interrupts though.

Quoted 6 lines

Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

Signature · 1 line
GP Orcullo
#15 lore raw
Quoted 16 lines · GP Orcullo
Quoted 14 lines · Maxime Ripard
Quoted 12 lines · GP Orcullo
Quoted 7 lines · Gilles Chanteperdrix
Quoted 1 line · GP Orcullo

Tested on a Cubieboard2 with v3.16.7-ckt9 kernel.

Does not sunxi have GPIO ?

--
Gilles.

There's no GPIO driver in the mainline kernel. The original sunxi kernel has incomplete support for GPIOs.

Quoted 6 lines
Quoted 4 lines

That's not true.

The GPIO support has been feature complete since 3.11.

I'm not sure if it supports interrupts though.

It does, since 3.11.

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20150418/68aa9327/attachment.sig>
author
#16 lore raw
Quoted 22 lines · Maxime Ripard
Quoted 21 lines · GP Orcullo
Quoted 18 lines · Maxime Ripard
Quoted 5 lines · GP Orcullo
Quoted 3 lines · Gilles Chanteperdrix
Quoted 1 line · GP Orcullo

Tested on a Cubieboard2 with v3.16.7-ckt9 kernel.

Quoted 7 lines
Quoted 4 lines

Does not sunxi have GPIO ?

--
Gilles.

There's no GPIO driver in the mainline kernel. The original sunxi kernel has incomplete support for GPIOs.

That's not true.

The GPIO support has been feature complete since 3.11.

Quoted 8 lines
Quoted 1 line

I'm not sure if it supports interrupts though.

It does, since 3.11.

--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

Attached is the updated patch.

Signature · 8 lines
GP Orcullo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Add-support-for-SUNXI-boards.patch
Type: text/x-patch
Size: 2622 bytes
Desc: not available
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20150418/f648f089/attachment.bin>
#17 lore raw
Quoted 26 lines · GP Orcullo
Quoted 24 lines · Maxime Ripard
Quoted 22 lines · GP Orcullo
Quoted 11 lines · Maxime Ripard
Quoted 10 lines · GP Orcullo
Quoted 7 lines · Gilles Chanteperdrix
Quoted 1 line · GP Orcullo

Tested on a Cubieboard2 with v3.16.7-ckt9 kernel.

Does not sunxi have GPIO ?

--
Gilles.

Quoted 7 lines
Quoted 2 lines

There's no GPIO driver in the mainline kernel. The original sunxi kernel has incomplete support for GPIOs.

That's not true.

The GPIO support has been feature complete since 3.11.

I'm not sure if it supports interrupts though.

Quoted 8 lines
Quoted 6 lines

It does, since 3.11.

--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

Attached is the updated patch.

You sure this is sufficient? Does not that pinctrl stuff use a spinlock? We are not in a hurry, we can afford to be thorough.

Signature · 1 line
					    Gilles.