[linux-sunxi] Re: [PATCH v9 05/17] ARM: dts: sun4i: Add pin-muxing info for the mmc0 controller

2014-04-29 Thread Hans de Goede
Hi,

On 04/28/2014 09:32 PM, Maxime Ripard wrote:
> Hi Hans,
> 
> On Sat, Apr 26, 2014 at 12:16:09PM +0200, Hans de Goede wrote:
>> mmc0 is the only controller actually being used on boards, so limit the
>> pin-muxing options to that.
>>
>> Signed-off-by: Hans de Goede 
>> ---
>>  arch/arm/boot/dts/sun4i-a10.dtsi | 14 ++
>>  1 file changed, 14 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi 
>> b/arch/arm/boot/dts/sun4i-a10.dtsi
>> index dce074b..29fd4f5 100644
>> --- a/arch/arm/boot/dts/sun4i-a10.dtsi
>> +++ b/arch/arm/boot/dts/sun4i-a10.dtsi
>> @@ -565,6 +565,20 @@
>>  allwinner,drive = <0>;
>>  allwinner,pull = <0>;
>>  };
>> +
>> +mmc0_pins_a: mmc0@0 {
>> +allwinner,pins = 
>> "PF0","PF1","PF2","PF3","PF4","PF5";
>> +allwinner,function = "mmc0";
>> +allwinner,drive = <2>;
>> +allwinner,pull = <0>;
>> +};
>> +
>> +mmc0_cd_pin_a: mmc0_cd_pin@0 {
>> +allwinner,pins = "PH1";
>> +allwinner,function = "gpio_in";
>> +allwinner,drive = <0>;
>> +allwinner,pull = <1>;
>> +};
> 
> Actually, I like very much the reference_pin mention you had in your
> bindings documentation. Could you use it for this and the other
> patches?

Ok will fix this up for the next version.

Regards,

Hans

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] Re: [PATCH v9 03/17] ARM: sunxi: Add driver for SD/MMC hosts found on Allwinner sunxi SoCs

2014-04-29 Thread Hans de Goede
Hi,

On 04/28/2014 09:36 PM, Maxime Ripard wrote:
> On Sat, Apr 26, 2014 at 12:16:07PM +0200, Hans de Goede wrote:
>> From: David Lanzendörfer 
>>
>> The Allwinner sunxi mmc host uses dma in bus-master mode using a built-in
>> designware idmac controller, which is identical to the one found in the 
>> mmc-dw
>> hosts. However the rest of the host is not identical to mmc-dw, it deals with
>> sending stop commands in hardware which makes it significantly different
>> from the mmc-dw devices.
>>
>> HdG: Various cleanups and fixes.
>>
>> Signed-off-by: David Lanzendörfer 
>> Signed-off-by: Hans de Goede 
>> ---
>>  .../devicetree/bindings/mmc/sunxi-mmc.txt  |   43 +
>>  drivers/mmc/host/Kconfig   |7 +
>>  drivers/mmc/host/Makefile  |2 +
>>  drivers/mmc/host/sunxi-mmc.c   | 1125 
>> 
>>  4 files changed, 1177 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/mmc/sunxi-mmc.txt
>>  create mode 100644 drivers/mmc/host/sunxi-mmc.c
>>
>> diff --git a/Documentation/devicetree/bindings/mmc/sunxi-mmc.txt 
>> b/Documentation/devicetree/bindings/mmc/sunxi-mmc.txt
>> new file mode 100644
>> index 000..f0c06e7
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/mmc/sunxi-mmc.txt
>> @@ -0,0 +1,43 @@
>> +* Allwinner sunxi MMC controller
>> +
>> +The highspeed MMC host controller on Allwinner SoCs provides an interface
>> +for MMC, SD and SDIO types of memory cards.
>> +
>> +Supported maximum speeds are the ones of the eMMC standard 4.5 as well
>> +as the speed of SD standard 3.0.
>> +Absolute maximum transfer rate is 200MB/s
>> +
>> +Required properties:
>> + - compatible : "allwinner,sun4i-a10-mmc" or "allwinner,sun5i-a13-mmc"
>> + - reg : mmc controller base registers
>> + - clocks : a list with 2 phandle + clock specifier pairs
>> + - clock-names : must contain "ahb" and "mod"
> 
> Again, this is not a module0 clock, so the clock name is misleading.

Ah, I see what you're getting at, yes giving it a different name here makes
sense I'll change it to mmc in the next version of the patch-set.

Regards,

Hans


-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] Re: [PATCH v9 10/17] ARM: dts: sun6i: Add mmc clocks

2014-04-29 Thread Hans de Goede
Hi,

On 04/28/2014 09:37 PM, Maxime Ripard wrote:
> On Sat, Apr 26, 2014 at 12:16:14PM +0200, Hans de Goede wrote:
>> Add clk-nodes for the mmc clocks.
>>
>> Signed-off-by: Hans de Goede 
>> ---
>>  arch/arm/boot/dts/sun6i-a31.dtsi | 32 
>>  1 file changed, 32 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi 
>> b/arch/arm/boot/dts/sun6i-a31.dtsi
>> index d45efa7..12bcc17 100644
>> --- a/arch/arm/boot/dts/sun6i-a31.dtsi
>> +++ b/arch/arm/boot/dts/sun6i-a31.dtsi
>> @@ -198,6 +198,38 @@
>>  "apb2_uart4", "apb2_uart5";
>>  };
>>  
>> +mmc0_clk: clk@01c20088 {
>> +#clock-cells = <0>;
>> +compatible = "allwinner,sun4i-a10-mod0-clk";
> 
> And this is not misleading but wrong. The MMC clocks have the phase
> control feature that mod0 clock don't have, so they should have a
> compatible of their own.

You said the same thing when I posted v8, and I replied to that, that
this is the exact same construction used as with sun4i, sun5i and sun7i.

I agree this needs to be fixed, but it needs to be fixed for *all* of
them, and IMHO it is best to be consistently "wrong" for now and then
fix them all in one go (and all in the same way) when we've landed a
generic way of dealing with phase-control.

So for now I'm going to keep this as is, iow the same as the clock
bindings for mmc which we already have for sun4i, sun5i and sun7i
which all have the same issue.

Regards,

Hans

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [linux-sunxi] [PATCH 04/10] sunxi: log failure of sunxi_?mac_initialize.

2014-04-29 Thread Ian Campbell
On Tue, 2014-04-29 at 08:08 +0300, Priit Laes wrote:
> > +   printf("sunxi: failed to initiliaze emac\n");
> Typo

Gah! Well spotted.

I'll fix this up tonight, unless a committer beats me to it.

Ian.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] Re: How to unpack and repack the fedor image.

2014-04-29 Thread Puneet B
Hi Sudhir,

i am also doing same thing.

once i copied my uImage and flash it and boot it.

then i am getting fallowing error.

5772656 bytes read
## Booting kernel from Legacy Image at 4800 ...
   Image Name:   Linux-3.4.61+
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:5772592 Bytes = 5.5 MiB
   Load Address: 40008000
   Entry Point:  40008000
   Verifying Checksum ... Bad Data CRC
ERROR: can't get kernel image!
sun7i#

Did any one know how to solve this issue?.

Regards
Punith

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [linux-sunxi] [PATCH u-boot 00/10] more upstream review feedback

2014-04-29 Thread Hans de Goede
Hi Ian,

On 04/28/2014 09:18 PM, Ian Campbell wrote:
> The following patches make some cleanups requested by Marek against the
> upstreaming series. I don't think there is anything controversial. I've
> also pushed to gitorious.
> 
> Ian.

Thanks for your continued work on this. I've applied the entire series,
with the spelling mistake that Priit catched fixed.

Regards,

Hans



> 
> The following changes since commit 06ad4bb62b69e8867087a9ecdffe2cc97817d453:
> 
>   ARM: sunxi: Add A23 based tablet Ippo-q8h (2014-04-26 20:18:41 +0200)
> 
> are available in the git repository at:
> 
>   git://gitorious.org/ijc/u-boot.git sunxi-mainlining-cleanups
> 
> for you to fetch changes up to 2ba9e4503ed7ca35d22032e03c4377066c59d91e:
> 
>   sunxi: mksunxiboot: remove unnecessary casts. (2014-04-27 18:01:43 +0100)
> 
> 
> Ian Campbell (10):
>   sunxi: timer: conform to coding style.
>   sunxi: remove unbounded loops from DRAM setup.
>   sunxi: correct cpu_eth_init ifdeffery
>   sunxi: log failure of sunxi_?mac_initialize.
>   sunxi: move gmac glue under board/sunxi
>   sunxi: remove unnecessary network config items
>   sunxi: mmc: move pinmux configuration to board setup.
>   sunxi: mksunxiboot: use stdint.h types
>   sunxi: mksunxiboot: remove dead code.
>   sunxi: mksunxiboot: remove unnecessary casts.
> 
>  arch/arm/cpu/armv7/sunxi/board.c   | 20 +++--
>  arch/arm/cpu/armv7/sunxi/dram.c| 35 +--
>  arch/arm/cpu/armv7/sunxi/timer.c   |  7 ++-
>  board/sunxi/Makefile   |  1 +
>  board/sunxi/board.c| 59 
> ++
>  drivers/net/sunxi_gmac.c => board/sunxi/gmac.c |  6 +--
>  drivers/mmc/sunxi_mmc.c| 53 ---
>  drivers/net/Makefile   |  1 -
>  include/configs/sunxi-common.h |  9 
>  tools/mksunxiboot.c| 58 ++---
>  10 files changed, 127 insertions(+), 122 deletions(-)
>  rename drivers/net/sunxi_gmac.c => board/sunxi/gmac.c (86%)
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [linux-sunxi] [PATCH u-boot 00/10] more upstream review feedback

2014-04-29 Thread Ian Campbell
On Tue, 2014-04-29 at 14:34 +0200, Hans de Goede wrote:
> Hi Ian,
> 
> On 04/28/2014 09:18 PM, Ian Campbell wrote:
> > The following patches make some cleanups requested by Marek against the
> > upstreaming series. I don't think there is anything controversial. I've
> > also pushed to gitorious.
> > 
> > Ian.
> 
> Thanks for your continued work on this. I've applied the entire series,
> with the spelling mistake that Priit catched fixed.

Perfect, thanks!


-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [linux-sunxi] [PATCH v2] sunxi: Add support for consumer infrared devices

2014-04-29 Thread Александр Берсенев
Thank you for comments, fixes will be in the next version of the patch.

About:
#ifdef CONFIG_ARCH_SUN5I 
#define IR_FIFO_SIZE(64)/* 64Bytes */ 
#else 
#define IR_FIFO_SIZE(16)/* 16Bytes */ 
#endif 

In sun5i datasheet 
at 
http://dl.linux-sunxi.org/A13/A13%20User%20Manual%20-%20v1.2%20%282013-01-08%29.pdf
 
said that sun5i and sun4i has 16 bytes fifo each and sun7i has 64 bytes 
fifo. All sunxi'es should work well with 16 bytes fifo, but 64 bytes fifos 
should be little faster on sun7i.

I hit some unexpected behavior of rc-core logic - if I press buttons very 
quickly(about 10 times per seconds) the latest pressing not shows until I 
press any another button. If I set ir->rc->timeout to very low value this 
problem disappears. I set it to 100 msec like in other ir-drivers instead 
120, but this not fixes problem fully. May be it is because I don't use 
keys mapping and keyup events not generated.  

Also there is a small memory leak during module loading/unloading.

вторник, 29 апреля 2014 г., 10:56:32 UTC+6 пользователь Priit Laes написал:
>
> Ühel kenal päeval, E, 28.04.2014 kell 12:57, kirjutas Александр 
> Берсенев: 
> > This patch introduces Consumer IR(CIR) support for sunxi boards. 
> > 
> > 
> > This is based on Alexsey Shestacov's work based on the original 
> > driver 
> > supplied by Allwinner. 
>
> You need to also CC people/lists in charge of certian parts of the 
> kernel tree this patch touches. There's get_maintainer.pl under scripts 
> directory in kernel tree. 
>
> > Changes since version 1: 
> >  - Fix timer memory leaks 
> >  - Fix race condition when driver unloads while interrupt handler is 
> > active 
> >  - Support Cubieboard 2(need testing) 
> > 
> > 
> > Signed-off-by: Alexander Bersenev > 
> > CC: wing...@linux-sunxi.org  
> > 
> > 
> > diff --git a/Documentation/devicetree/bindings/media/sunxi-ir.txt 
> > b/Documentation/devicetree/bindings/media/sunxi-ir.txt 
> > new file mode 100644 
> > index 000..8181efc 
> > --- /dev/null 
> > +++ b/Documentation/devicetree/bindings/media/sunxi-ir.txt 
> > @@ -0,0 +1,21 @@ 
> > +Device-Tree bindings for SUNXI IR controller found in sunXi SoC 
> > family 
> > + 
> > +Required properties: 
> > +   - compatible: Should be "allwinner,sunxi-ir". 
> > +   - clocks: First clock should constain SoC gate for IR clock 
> > +   second should constain IR feed clock itself. 
> missing before second. 
>
> > +   - interrupts: Should constain IR IRQ number. 
> > +   -reg: Should constain IO map address for IR. 
> s/constain/contain 
>
> > + 
> > +Optional properties: 
> > +   - linux,rc-map-name: Remote control map name. 
> > + 
> > +Example: 
> > + 
> > +   ir0: ir@01c21800 { 
> > +compatible = "allwinner,sunxi-ir"; 
> > +clocks = <&apb0_gates 6>, <&ir0_clk>; 
> > +interrupts = <0 5 1>; 
> > +reg = <0x01C21800 0x40>; 
> > +linux,rc-map-name = "rc-rc6-mce"; 
> > +   }; 
> > diff --git a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts 
> > b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts 
> > index feeff64..01b519c 100644 
> > --- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts 
> > +++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts 
> > @@ -164,6 +164,13 @@ 
> >   reg = <1>; 
> >   }; 
> >   }; 
> > + 
> > + ir0: ir@01c21800 { 
> > + pinctrl-names = "default"; 
> > + pinctrl-0 = <&ir0_pins_a>; 
> > + gpios = <&pio 1 4 0>; 
> > + status = "okay"; 
> > + }; 
> >   }; 
> >   
> >   leds { 
> > diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts 
> > b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts 
> > index e288562..683090f 100644 
> > --- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts 
> > +++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts 
> > @@ -232,6 +232,13 @@ 
> >   reg = <1>; 
> >   }; 
> >   }; 
> > + 
> > + ir0: ir@01c21800 { 
> > + pinctrl-names = "default"; 
> > + pinctrl-0 = <&ir0_pins_a>; 
> > + gpios = <&pio 1 4 0>; 
> > + status = "okay"; 
> > + }; 
> >   }; 
> >   
> >   leds { 
> > diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi 
> > b/arch/arm/boot/dts/sun7i-a20.dtsi 
> > index 0ae2b77..4597731 100644 
> > --- a/arch/arm/boot/dts/sun7i-a20.dtsi 
> > +++ b/arch/arm/boot/dts/sun7i-a20.dtsi 
> > @@ -724,6 +724,19 @@ 
> >   allwinner,drive = <2>; 
> >   allwinner,pull = <0>; 
> >   }; 
> > + 
> > + ir0_pins_a: ir0@0 { 
> > +allwinner,pins = "PB3","PB4"; 
> > +allwinner,function = "ir0"; 
> > +allwinner,drive = <0>; 
> > +allwinner,pull = <0>; 
> > + }; 
> > + ir1_pins_a: ir1@0 { 
> > +allwinner,pins = "PB22","PB23"; 
> > +allwinner,function = "ir1"; 
> > +allwinner,drive = <0>; 
> > +allwinner,pull = <0>; 
> > + }; 
> >   }; 
> >   
> >   timer@01c20c00 { 
> > @@ -937,5 +950,21 @@ 
> >   #interrupt-cells = <3>; 
> >   interrupts = <1 9 0xf04>; 
> >   }; 
> > + 
> > +   ir0: ir@01c21800 { 
> > + compatible = "allwinner,sunxi-ir"; 
> > + clocks = <&apb0_gates 6>, <&ir0_clk>; 
> > + interrupts = <0 5 4>; 
> > 

Re: [linux-sunxi] A10 versus A20 versus A20 , gtkperf result.

2014-04-29 Thread nil

Please forget my negative post, was drunk like shit .

I have compiled ssvb's kernel with bfs, also tried 100/300/1000HZ.
This test, shows 2X+ latency improvements :
https://rt.wiki.kernel.org/index.php/Cyclictest 
gtkperf constantly gives me on A20(1300):
~14,4
Uptime - 3,5 days for now

On X86 machine, in parallel, i've tested ck-sources in Gentoo installed to 
usb3 flashdrive, BFS works fine. 
But not BFQ("deadline" is better for USB/SSD) .
понедельник, 28 апреля 2014 г., 22:15:02 UTC+4 пользователь Siarhei 
Siamashka написал:
>
> On Mon, 28 Apr 2014 11:02:09 -0700 (PDT) 
> nil > wrote: 
>
> > for me BFS performs bad . 
> > tried it on A10/20 & X86. 
> > Effect from nothing to negative. 
>
> Thanks for your feedback. What are the exact steps to reproduce 
> these test results? I would love to see what's going on. 
>
> -- 
> Best regards, 
> Siarhei Siamashka 
>

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [linux-sunxi] [PATCH v2] sunxi: Add support for consumer infrared devices

2014-04-29 Thread Александр Берсенев
The problem with timeouts is with the 
function ir_raw_event_store_with_filter which automerges samples of same 
type. When the packet ends, there is 21504us space(no pulse) in it and this 
function waits for more data to merge. New data arives only when next 
button pressed on ir remote. Function ir_raw_event_store_with_filter has a 
timeout for waiting, but this timeout checked on each call of this 
function(on each interrupt), if user doesn't press buttons, the 
ir-interrups don't occur. 

среда, 30 апреля 2014 г., 0:42:25 UTC+6 пользователь Александр Берсенев 
написал:
>
> Thank you for comments, fixes will be in the next version of the patch.
>
> About:
> #ifdef CONFIG_ARCH_SUN5I 
> #define IR_FIFO_SIZE(64)/* 64Bytes */ 
> #else 
> #define IR_FIFO_SIZE(16)/* 16Bytes */ 
> #endif 
>
> In sun5i datasheet at 
> http://dl.linux-sunxi.org/A13/A13%20User%20Manual%20-%20v1.2%20%282013-01-08%29.pdfsaid
>  that sun5i and sun4i has 16 bytes fifo each and sun7i has 64 bytes 
> fifo. All sunxi'es should work well with 16 bytes fifo, but 64 bytes fifos 
> should be little faster on sun7i.
>
> I hit some unexpected behavior of rc-core logic - if I press buttons very 
> quickly(about 10 times per seconds) the latest pressing not shows until I 
> press any another button. If I set ir->rc->timeout to very low value this 
> problem disappears. I set it to 100 msec like in other ir-drivers instead 
> 120, but this not fixes problem fully. May be it is because I don't use 
> keys mapping and keyup events not generated.  
>
> Also there is a small memory leak during module loading/unloading.
>
> вторник, 29 апреля 2014 г., 10:56:32 UTC+6 пользователь Priit Laes написал:
>>
>> Ühel kenal päeval, E, 28.04.2014 kell 12:57, kirjutas Александр 
>> Берсенев: 
>> > This patch introduces Consumer IR(CIR) support for sunxi boards. 
>> > 
>> > 
>> > This is based on Alexsey Shestacov's work based on the original 
>> > driver 
>> > supplied by Allwinner. 
>>
>> You need to also CC people/lists in charge of certian parts of the 
>> kernel tree this patch touches. There's get_maintainer.pl under scripts 
>> directory in kernel tree. 
>>
>> > Changes since version 1: 
>> >  - Fix timer memory leaks 
>> >  - Fix race condition when driver unloads while interrupt handler is 
>> > active 
>> >  - Support Cubieboard 2(need testing) 
>> > 
>> > 
>> > Signed-off-by: Alexander Bersenev  
>> > CC: wing...@linux-sunxi.org 
>> > 
>> > 
>> > diff --git a/Documentation/devicetree/bindings/media/sunxi-ir.txt 
>> > b/Documentation/devicetree/bindings/media/sunxi-ir.txt 
>> > new file mode 100644 
>> > index 000..8181efc 
>> > --- /dev/null 
>> > +++ b/Documentation/devicetree/bindings/media/sunxi-ir.txt 
>> > @@ -0,0 +1,21 @@ 
>> > +Device-Tree bindings for SUNXI IR controller found in sunXi SoC 
>> > family 
>> > + 
>> > +Required properties: 
>> > +   - compatible: Should be "allwinner,sunxi-ir". 
>> > +   - clocks: First clock should constain SoC gate for IR clock 
>> > +   second should constain IR feed clock itself. 
>> missing before second. 
>>
>> > +   - interrupts: Should constain IR IRQ number. 
>> > +   -reg: Should constain IO map address for IR. 
>> s/constain/contain 
>>
>> > + 
>> > +Optional properties: 
>> > +   - linux,rc-map-name: Remote control map name. 
>> > + 
>> > +Example: 
>> > + 
>> > +   ir0: ir@01c21800 { 
>> > +compatible = "allwinner,sunxi-ir"; 
>> > +clocks = <&apb0_gates 6>, <&ir0_clk>; 
>> > +interrupts = <0 5 1>; 
>> > +reg = <0x01C21800 0x40>; 
>> > +linux,rc-map-name = "rc-rc6-mce"; 
>> > +   }; 
>> > diff --git a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts 
>> > b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts 
>> > index feeff64..01b519c 100644 
>> > --- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts 
>> > +++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts 
>> > @@ -164,6 +164,13 @@ 
>> >   reg = <1>; 
>> >   }; 
>> >   }; 
>> > + 
>> > + ir0: ir@01c21800 { 
>> > + pinctrl-names = "default"; 
>> > + pinctrl-0 = <&ir0_pins_a>; 
>> > + gpios = <&pio 1 4 0>; 
>> > + status = "okay"; 
>> > + }; 
>> >   }; 
>> >   
>> >   leds { 
>> > diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts 
>> > b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts 
>> > index e288562..683090f 100644 
>> > --- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts 
>> > +++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts 
>> > @@ -232,6 +232,13 @@ 
>> >   reg = <1>; 
>> >   }; 
>> >   }; 
>> > + 
>> > + ir0: ir@01c21800 { 
>> > + pinctrl-names = "default"; 
>> > + pinctrl-0 = <&ir0_pins_a>; 
>> > + gpios = <&pio 1 4 0>; 
>> > + status = "okay"; 
>> > + }; 
>> >   }; 
>> >   
>> >   leds { 
>> > diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi 
>> > b/arch/arm/boot/dts/sun7i-a20.dtsi 
>> > index 0ae2b77..4597731 100644 
>> > --- a/arch/arm/boot/dts/sun7i-a20.dtsi 
>> > +++ b/arch/arm/boot/dts/sun7i-a20.dtsi 
>> > @@ -724,6 +724,19 @@ 
>> >   allwinner,d

[linux-sunxi] [PATCH v3] sunxi: Add support for consumer infrared devices

2014-04-29 Thread Александр Берсенев
This patch introduces Consumer IR(CIR) support for sunxi boards.

This is based on Alexsey Shestacov's work based on the original driver 
supplied by Allwinner. 

--- 

Changes since version 1: 
 - Fix timer memory leaks 
 - Fix race condition when driver unloads while interrupt handler is active
 - Support Cubieboard 2(need testing)

 Changes since version 2:
 - More reliable keydown events
 - Documentation fixes
 - Rename registers accurding to A20 user manual
 - Remove some includes, order includes alphabetically
 - Use BIT macro
 - Typo fixes

Signed-off-by: Alexander Bersenev  
Signed-off-by: Alexsey Shestacov   

diff --git a/Documentation/devicetree/bindings/media/sunxi-ir.txt 
b/Documentation/devicetree/bindings/media/sunxi-ir.txt
new file mode 100644
index 000..0d416f4
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/sunxi-ir.txt
@@ -0,0 +1,21 @@
+Device-Tree bindings for SUNXI IR controller found in sunXi SoC family
+
+Required properties:
+   - compatible: Should be "allwinner,sunxi-ir".
+   - clocks: First clock should contain SoC gate for IR clock.
+ Second should contain IR feed clock itself.
+   - interrupts: Should contain IR IRQ number.
+   - reg: Should contain IO map address for IR.
+
+Optional properties:
+   - linux,rc-map-name: Remote control map name.
+
+Example:
+
+   ir0: ir@01c21800 {
+compatible = "allwinner,sunxi-ir";
+clocks = <&apb0_gates 6>, <&ir0_clk>;
+interrupts = <0 5 1>;
+reg = <0x01C21800 0x40>;
+linux,rc-map-name = "rc-rc6-mce";
+   };
diff --git a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts 
b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
index feeff64..01b519c 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
@@ -164,6 +164,13 @@
  reg = <1>;
  };
  };
+
+ ir0: ir@01c21800 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&ir0_pins_a>;
+ gpios = <&pio 1 4 0>;
+ status = "okay";
+ };
  };
 
  leds {
diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts 
b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
index e288562..683090f 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
@@ -232,6 +232,13 @@
  reg = <1>;
  };
  };
+
+ ir0: ir@01c21800 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&ir0_pins_a>;
+ gpios = <&pio 1 4 0>;
+ status = "okay";
+ };
  };
 
  leds {
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi 
b/arch/arm/boot/dts/sun7i-a20.dtsi
index 0ae2b77..4597731 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -724,6 +724,19 @@
  allwinner,drive = <2>;
  allwinner,pull = <0>;
  };
+
+ ir0_pins_a: ir0@0 {
+allwinner,pins = "PB3","PB4";
+allwinner,function = "ir0";
+allwinner,drive = <0>;
+allwinner,pull = <0>;
+ };
+ ir1_pins_a: ir1@0 {
+allwinner,pins = "PB22","PB23";
+allwinner,function = "ir1";
+allwinner,drive = <0>;
+allwinner,pull = <0>;
+ };
  };
 
  timer@01c20c00 {
@@ -937,5 +950,21 @@
  #interrupt-cells = <3>;
  interrupts = <1 9 0xf04>;
  };
+
+   ir0: ir@01c21800 {
+ compatible = "allwinner,sunxi-ir";
+ clocks = <&apb0_gates 6>, <&ir0_clk>;
+ interrupts = <0 5 4>;
+ reg = <0x01C21800 0x40>;
+ status = "disabled";
+ };
+
+   ir1: ir@01c21c00 {
+ compatible = "allwinner,sunxi-ir";
+ clocks = <&apb0_gates 7>, <&ir1_clk>;
+ interrupts = <0 6 4>;
+ reg = <0x01C21c00 0x40>;
+ status = "disabled";
+ };
  };
 };
diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig
index 8fbd377..9427fad 100644
--- a/drivers/media/rc/Kconfig
+++ b/drivers/media/rc/Kconfig
@@ -343,4 +343,14 @@ config RC_ST
 
  If you're not sure, select N here.
 
+config IR_SUNXI
+tristate "SUNXI IR remote control"
+depends on RC_CORE
+depends on ARCH_SUNXI
+---help---
+  Say Y if you want to use sunXi internal IR Controller
+
+  To compile this driver as a module, choose M here: the module will
+  be called sunxi-ir.
+
 endif #RC_DEVICES
diff --git a/drivers/media/rc/Makefile b/drivers/media/rc/Makefile
index f8b54ff..93cdbe9 100644
--- a/drivers/media/rc/Makefile
+++ b/drivers/media/rc/Makefile
@@ -32,4 +32,5 @@ obj-$(CONFIG_IR_GPIO_CIR) += gpio-ir-recv.o
 obj-$(CONFIG_IR_IGUANA) += iguanair.o
 obj-$(CONFIG_IR_TTUSBIR) += ttusbir.o
 obj-$(CONFIG_RC_ST) += st_rc.o
+obj-$(CONFIG_IR_SUNXI) += sunxi-ir.o
 obj-$(CONFIG_IR_IMG) += img-ir/
diff --git a/drivers/media/rc/sunxi-ir.c b/drivers/media/rc/sunxi-ir.c
new file mode 100644
index 000..9b5639e
--- /dev/null
+++ b/drivers/media/rc/sunxi-ir.c
@@ -0,0 +1,314 @@
+/*
+ * Driver for Allwinner sunXi IR controller
+ *
+ * Copyright (C) 2014 Alexsey Shestacov 
+ *
+ * Based on sun5i-ir.c:
+ * Copyright (C) 2007-2012 Daniel Wang
+ * Allwinner Technology Co., Ltd. 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published b

[linux-sunxi] Re: [PATCH v9 05/17] ARM: dts: sun4i: Add pin-muxing info for the mmc0 controller

2014-04-29 Thread David Lanzendörfer
Hi
> Ok will fix this up for the next version.
Be carefull!
I removed redundancies on all the boards I've seen so far, which all had the
same pin assignment, based on the reference design of Allwinners.
Please make sure the boards pin muxing fits onto your board.
Certain boards differ within their muxing.

br
-- 
David Lanzendörfer
OpenSourceSupport GmbH
System engineer and supporter
http://www.o2s.ch/

signature.asc
Description: This is a digitally signed message part.


[linux-sunxi] Re: [PATCH v3] sunxi: Add support for consumer infrared devices

2014-04-29 Thread Maxime Ripard
Hi,

Thanks for contributing this patch.

It seems like you're missing a few mailing lists / maintainers
though. You should use the get_maintainer.pl script, and Cc every
maintainer and mailing lists in there.

On Tue, Apr 29, 2014 at 02:51:31PM -0700, Александр Берсенев wrote:
> This patch introduces Consumer IR(CIR) support for sunxi boards.
> 
> This is based on Alexsey Shestacov's work based on the original driver 
> supplied by Allwinner. 

Your Signed-off-by should be here so that it stays in the commit log,
and not discarded.

Note that you can use git commit -s to make sure it's at the right
place.

> --- 
> 
> Changes since version 1: 
>  - Fix timer memory leaks 
>  - Fix race condition when driver unloads while interrupt handler is active
>  - Support Cubieboard 2(need testing)
> 
>  Changes since version 2:
>  - More reliable keydown events
>  - Documentation fixes
>  - Rename registers accurding to A20 user manual
>  - Remove some includes, order includes alphabetically
>  - Use BIT macro
>  - Typo fixes
> 
> Signed-off-by: Alexander Bersenev  
> Signed-off-by: Alexsey Shestacov   
> 
> diff --git a/Documentation/devicetree/bindings/media/sunxi-ir.txt 
> b/Documentation/devicetree/bindings/media/sunxi-ir.txt
> new file mode 100644
> index 000..0d416f4
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/sunxi-ir.txt
> @@ -0,0 +1,21 @@
> +Device-Tree bindings for SUNXI IR controller found in sunXi SoC family
> +
> +Required properties:
> +   - compatible: Should be "allwinner,sunxi-ir".

We prefer to use "allwinner,--", with the soc and
family being the one where it was first introduced. If this controller
is the same in A10 and A20, it should be "allwinner,sun4i-a10-ir", if
it is a new controller in the A20, "allwinner,sun7i-a20-ir".

> +   - clocks: First clock should contain SoC gate for IR clock.
> + Second should contain IR feed clock itself.

Whenever there's several clocks, using clock-names is to be
preferred. That way, you don't have to request any order, which is a
lot less error prone.

> +   - interrupts: Should contain IR IRQ number.
> +   - reg: Should contain IO map address for IR.
> +
> +Optional properties:
> +   - linux,rc-map-name: Remote control map name.
> +
> +Example:
> +
> +   ir0: ir@01c21800 {
> +compatible = "allwinner,sunxi-ir";
> +clocks = <&apb0_gates 6>, <&ir0_clk>;
> +interrupts = <0 5 1>;
> +reg = <0x01C21800 0x40>;
> +linux,rc-map-name = "rc-rc6-mce";
> +   };
> diff --git a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts 
> b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
> index feeff64..01b519c 100644
> --- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
> +++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
> @@ -164,6 +164,13 @@
>   reg = <1>;
>   };
>   };
> +
> + ir0: ir@01c21800 {
> + pinctrl-names = "default";
> + pinctrl-0 = <&ir0_pins_a>;
> + gpios = <&pio 1 4 0>;

You don't seem to be using that gpios property anywhere.

Plus, your indentation seems completely wrong. Please run
checkpatch.pl on your patches before running it, and make sure there's
no errors or warning.

> + status = "okay";
> + };
>   };
>  
>   leds {
> diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts 
> b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
> index e288562..683090f 100644
> --- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
> +++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
> @@ -232,6 +232,13 @@
>   reg = <1>;
>   };
>   };
> +
> + ir0: ir@01c21800 {
> + pinctrl-names = "default";
> + pinctrl-0 = <&ir0_pins_a>;
> + gpios = <&pio 1 4 0>;

Same here.

> + status = "okay";
> + };
>   };
>  
>   leds {
> diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi 
> b/arch/arm/boot/dts/sun7i-a20.dtsi
> index 0ae2b77..4597731 100644
> --- a/arch/arm/boot/dts/sun7i-a20.dtsi
> +++ b/arch/arm/boot/dts/sun7i-a20.dtsi
> @@ -724,6 +724,19 @@
>   allwinner,drive = <2>;
>   allwinner,pull = <0>;
>   };
> +
> + ir0_pins_a: ir0@0 {
> +allwinner,pins = "PB3","PB4";
> +allwinner,function = "ir0";
> +allwinner,drive = <0>;
> +allwinner,pull = <0>;
> + };
> + ir1_pins_a: ir1@0 {
> +allwinner,pins = "PB22","PB23";
> +allwinner,function = "ir1";
> +allwinner,drive = <0>;
> +allwinner,pull = <0>;
> + };
>   };
>  
>   timer@01c20c00 {
> @@ -937,5 +950,21 @@
>   #interrupt-cells = <3>;
>   interrupts = <1 9 0xf04>;
>   };
> +
> +   ir0: ir@01c21800 {
> + compatible = "allwinner,sunxi-ir";
> + clocks = <&apb0_gates 6>, <&ir0_clk>;
> + interrupts = <0 5 4>;
> + reg = <0x01C21800 0x40>;

Please use lower-case for the address here.

> + status = "disabled";
> + };
> +
> +   ir1: ir@01c21c00 {
> + compatible = "allwinner,sunxi-ir";
> + clocks = <&apb0_gates 7>, <&ir1_clk>;
> + interrupts = <0 6 4>;
> + reg = <0x01C21c00 0x40>;

... or at least be consistent.

> + status = "disabled";
> + };
>   };
>  };
> diff --git a/drivers/media/rc/Kconfig b/drivers/medi

Re: [linux-sunxi] [RFC PATCH u-boot 2/2] sunxi: dram: Fix autorefresh timing setup

2014-04-29 Thread Siarhei Siamashka
On Sun, 06 Apr 2014 11:49:22 +0200
Jens Kuske  wrote:

> 
> On 06/04/14 04:19, Siarhei Siamashka wrote:
> > On Wed, 26 Mar 2014 17:40:50 +0100
> > Jens Kuske  wrote:
> > 
> >> This patch unifies sun4i and sun[5,7]i autorefresh setup functions
> >> and adds proper tRFC calculation.
> >>
> >> tRFC (REF command to ACT time) depends on DDR type and chip density.
> >>
> >> On sun4i there were two steps, 127.5ns for <=1Gb density and 327.5ns
> >> for the rest. This fits DDR2 specification for 1Gb and 4Gb chips
> >> and shouldn't be a problems with DDR3 chips <8Gb either, but it will
> >> waste some performance.
> >>
> >> On sun[5,7]i however, tRFC was hardcoded to 131 clock cycles, which
> >> seems to come from 4Gb DDR2 chips at 400MHz (327.5ns * 400MHz = 131).
> >> For 4Gb DDR3 chips, like those on cubieboard2 and cubietruck, this
> >> means the memory frequency was limited to ~435MHz if one doesn't want
> >> to fall below the minimum specified tRFC for these chips.
> >>
> >> Signed-off-by: Jens Kuske 
> >> ---
> >>  arch/arm/cpu/armv7/sunxi/dram.c| 70 
> >> --
> >>  arch/arm/include/asm/arch-sunxi/dram.h |  4 ++
> >>  2 files changed, 28 insertions(+), 46 deletions(-)
> >>
> >> diff --git a/arch/arm/cpu/armv7/sunxi/dram.c 
> >> b/arch/arm/cpu/armv7/sunxi/dram.c
> >> index 957db59..921f683 100644
> >> --- a/arch/arm/cpu/armv7/sunxi/dram.c
> >> +++ b/arch/arm/cpu/armv7/sunxi/dram.c
> >> @@ -412,53 +412,30 @@ static void dramc_clock_output_en(u32 on)
> >>  #endif
> >>  }
> >>  
> >> -#ifdef CONFIG_SUN4I
> >> -static void dramc_set_autorefresh_cycle(u32 clk)
> >> -{
> >> -  struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
> >> -  u32 reg_val;
> >> -  u32 tmp_val;
> >> -  u32 reg_dcr;
> >> -
> >> -  if (clk < 600) {
> >> -  reg_dcr = readl(&dram->dcr);
> >> -  if ((reg_dcr & DRAM_DCR_CHIP_DENSITY_MASK) <=
> >> -  DRAM_DCR_CHIP_DENSITY(DRAM_DCR_CHIP_DENSITY_1024M))
> >> -  reg_val = (131 * clk) >> 10;
> >> -  else
> >> -  reg_val = (336 * clk) >> 10;
> >> -
> >> -  tmp_val = (7987 * clk) >> 10;
> >> -  tmp_val = tmp_val * 9 - 200;
> >> -  reg_val |= tmp_val << 8;
> >> -  reg_val |= 0x8 << 24;
> >> -  writel(reg_val, &dram->drr);
> >> -  } else {
> >> -  writel(0x0, &dram->drr);
> >> -  }
> >> -}
> >> -#endif /* SUN4I */
> >> +static const u16 tRFC_table[2][6] = {
> >> +  /*   256Mb512Mb1Gb  2Gb  4Gb  8Gb  */
> >> +  /* DDR2  75ns 105ns127.5ns  195ns327.5ns  invalid  */
> >> +  {77,  108, 131, 200, 336, 336 },
> >> +  /* DDR3  invalid  90ns 110ns160ns300ns350ns*/
> >> +  {93,  93,  113, 164, 308, 359 }
> >> +};
> >>  
> >> -#if defined(CONFIG_SUN5I) || defined(CONFIG_SUN7I)
> >> -static void dramc_set_autorefresh_cycle(u32 clk)
> >> +static void dramc_set_autorefresh_cycle(u32 clk, u32 type, u32 density)
> >>  {
> >>struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
> >> -  u32 reg_val;
> >> -  u32 tmp_val;
> >> -  reg_val = 0x83;
> >> -
> >> -  tmp_val = (7987 * clk) >> 10;
> >> -  tmp_val = tmp_val * 9 - 200;
> >> -  reg_val |= tmp_val << 8;
> >> -  reg_val |= 0x8 << 24;
> >> -  writel(reg_val, &dram->drr);
> >> +  u32 tRFC, tREFI;
> >> +
> >> +  tRFC = (tRFC_table[type][density] * clk + 1023) >> 10;
> >> +  tREFI = (7987 * clk) >> 10; /* <= 7.8us */
> > 
> > Maybe I'm missing something, but what has happened to the "tmp_val =
> > tmp_val * 9 - 200" part of the old code? 
> > 
> > Also looks like there was an intention to replace "reg_val |= 0x8 <<
> > 24" with the use of the new DRAM_DRR_BURST macro, but I can't see it
> > anywhere either.
> > 
> 
> I forgot to explain that, I removed the burst refresh. Don't know
> whether this was a good idea, but there are some resources stating burst
> refreshes reduce power consumption at the expense of increased latency.
> Normally there is a tRFC-long refresh every tREFI, with burst there are
> 9*tRFC breaks every 9*tREFI. This leads to dram "hangs" of up to 3us
> every ~70us.
> 
> "reg_val |= 0x8 << 24" made the controller issue 9 refresh commands in
> burst, and thus the period between refresh had to be multiplied by 9.
> I don't know why they subtract 200, but it looks like some safety
> margin. Maybe I shouldn't have removed that...
> 
> This patch was a RFC to discuss such things, so thanks for the comments.
> Maybe it should be added again, but I don't think they originally wasted
> any thoughts on this, they simply took the default values (reset-value
> for burst is 0x8).

I have found a very interesting document, which seems to describe some
aspects of our dram controller:
http://www.ti.com/lit/pdf/spruhn7 (TI KeyStone II Architecture
   DDR3 Memory Controller)

Texas Instruments has apparently licensed the