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

2014-04-30 Thread Александр Берсенев
Thanks for comments.

The IR controllers in A10 and A20 are very similar but not same. The only 
difference I found is a FIFO size.
I'll try to use devm_clk_get to get the time, but now it's not possible to 
add gate clock by name. I've just sent a patch to this mailing list to add 
this possibility.
Also setting clock-frequency via DT is not implenented yet for sunxi 
clocks. I can try to add this functionality too.

The rest are fixed and will be available in the next version of the patch. 
I'll try to split in on smaller patches.

Best,
Alexander Bersenev, Institute of Mathematics and Mechanics

среда, 30 апреля 2014 г., 3:51:31 UTC+6 пользователь Александр Берсенев 
написал:

 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 b...@hackerdom.ru 
 Signed-off-by: Alexsey Shestacov wingr...@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..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
 +++ 

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

2014-04-30 Thread Mauro Carvalho Chehab
Em Tue, 29 Apr 2014 18:14:54 -0700
Maxime Ripard maxime.rip...@free-electrons.com escreveu:

 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 b...@hackerdom.ru 
  Signed-off-by: Alexsey Shestacov wingr...@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..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,family-soc-device, 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.
 
  + 

[linux-sunxi] Re: [PATCH v7] DMA: sun6i: Add driver for the Allwinner A31 DMA controller

2014-04-30 Thread Vinod Koul
On Thu, Apr 24, 2014 at 04:22:44PM +0200, Maxime Ripard wrote:
 The Allwinner A31 has a 16 channels DMA controller that it shares with the
 newer A23. Although sharing some similarities with the DMA controller of the
 older Allwinner SoCs, it's significantly different, I don't expect it to be
 possible to share the driver for these two.
 
 The A31 Controller is able to memory-to-memory or memory-to-device transfers 
 on
 the 16 channels in parallel.

Overall driver looks in good shape, few comments though...

 +This driver follows the generic DMA bindings defined in dma.txt.
 +
 +Required properties:
 +
 +- compatible:Must be allwinner,sun6i-a31-dma
 +- reg:   Should contain the registers base address and length
 +- interrupts:Should contain a reference to the interrupt used by 
 this device
 +- clocks:Should contain a reference to the parent AHB clock
 +- resets:Should contain a reference to the reset controller asserting
 + this device in reset
 +- #dma-cells :   Should be 1, a single cell holding a line request number
 +
 +Example:
 + dma: dma-controller@01c02000 {
 + compatible = allwinner,sun6i-a31-dma;
 + reg = 0x01c02000 0x1000;
 + interrupts = 0 50 4;
 + clocks = ahb1_gates 6;
 + resets = ahb1_rst 6;
 + #dma-cells = 1;
 + };
 +
 +Clients:
 +
 +DMA clients connected to the A31 DMA controller must use the format
 +described in the dma.txt file, using a two-cell specifier for each
 +channel: a phandle plus one integer cells.
 +The two cells in order are:
 +
 +1. A phandle pointing to the DMA controller.
 +2. The port ID as specified in the datasheet
 +
 +Example:
 +spi2: spi@01c6a000 {
 + compatible = allwinner,sun6i-a31-spi;
 + reg = 0x01c6a000 0x1000;
 + interrupts = 0 67 4;
 + clocks = ahb1_gates 22, spi2_clk;
 + clock-names = ahb, mod;
 + dmas = dma 25, dma 25;
 + dma-names = rx, tx;
 + resets = ahb1_rst 22;
 +};
Ideally binding should be a separate patch

 +static inline u8 convert_burst(u8 maxburst)
 +{
 + if (maxburst == 1 || maxburst  16)
 + return 0;
are these valid configurations?

 +
 + return fls(maxburst) - 1;
 +}
 +
 +static inline u8 convert_buswidth(enum dma_slave_buswidth addr_width)
 +{
 + switch (addr_width) {
 + case DMA_SLAVE_BUSWIDTH_2_BYTES:
 + return 1;
 + case DMA_SLAVE_BUSWIDTH_4_BYTES:
 + return 2;
return (addr_width  1); ..??
since DMA_SLAVE_BUSWIDTH_2_BYTES is numeric 2 and DMA_SLAVE_BUSWIDTH_4_BYTES
numeric 4. 
 + default:
 + return 0;
error?

 +static inline void sun6i_dma_cfg_lli(struct sun6i_dma_lli *lli,
 +  dma_addr_t src,
 +  dma_addr_t dst, u32 len,
 +  struct dma_slave_config *config)
 +{
 + u32 src_width, dst_width, src_burst, dst_burst;
 +
 + if (!config)
 + return;
 +
 + src_burst = convert_burst(config-src_maxburst);
 + dst_burst = convert_burst(config-dst_maxburst);
 +
 + src_width = convert_buswidth(config-src_addr_width);
 + dst_width = convert_buswidth(config-dst_addr_width);
is 0 a valid case then?

 +
 +static int sun6i_dma_terminate_all(struct sun6i_vchan *vchan)
 +{
 + struct sun6i_dma_dev *sdev = to_sun6i_dma_dev(vchan-vc.chan.device);
 + struct sun6i_pchan *pchan = vchan-phy;
 + unsigned long flags;
 + LIST_HEAD(head);
 +
 + spin_lock(sdev-lock);
 + list_del_init(vchan-node);
 + spin_unlock(sdev-lock);
 +
 + spin_lock_irqsave(vchan-vc.lock, flags);
 +
 + vchan_get_all_descriptors(vchan-vc, head);
 +
 + if (pchan) {
 + writel(DMA_CHAN_ENABLE_STOP, pchan-base + DMA_CHAN_ENABLE);
 + writel(DMA_CHAN_PAUSE_RESUME, pchan-base + DMA_CHAN_PAUSE);
 +
 + vchan-phy = NULL;
 + pchan-vchan = NULL;
 + pchan-desc = NULL;
 + pchan-done = NULL;
 + }
 +
 + spin_unlock_irqrestore(vchan-vc.lock, flags);
 +
 + vchan_dma_desc_free_list(vchan-vc, head);

shouldn't you kill the tasklet as well here?

 +static inline void sun6i_dma_free(struct sun6i_dma_dev *sdc)
 +{
 + int i;
 +
 + for (i = 0; i  NR_MAX_VCHANS; i++) {
 + struct sun6i_vchan *vchan = sdc-vchans[i];
 +
 + list_del(vchan-vc.chan.device_node);
 + tasklet_kill(vchan-vc.task);
 + }
 +
 + tasklet_kill(sdc-task);
This is again not good. see http://lwn.net/Articles/588457/
At this point HW can still generate interrupts or you can have irq running!

 +
 +static int sun6i_dma_probe(struct platform_device *pdev)
 +{
 + struct sun6i_dma_dev *sdc;
 + struct resource *res;
 + struct clk *mux, *pll6;
 + int irq;
 + int ret, i;
 +
 + sdc = devm_kzalloc(pdev-dev, sizeof(*sdc), GFP_KERNEL);
 + if (!sdc)
 + return -ENOMEM;
 +
 + res = 

[linux-sunxi] Re: [PATCH v4 01/03] ARM: sunxi: Add documentation for sunxi consumer infrared devices

2014-04-30 Thread Александр Берсенев
[PATCH v4 01/03] ARM: sunxi: Add documentation for sunxi consumer infrared 
devices

This patch adds documentation for Device-Tree bindings for sunxi IR 
controller. 

Signed-off-by: Alexander Bersenev b...@hackerdom.ru
Signed-off-by: Alexsey Shestacov wingr...@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..d502cf4
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/sunxi-ir.txt
@@ -0,0 +1,23 @@
+Device-Tree bindings for SUNXI IR controller found in sunXi SoC family
+
+Required properties:
+- compatible: should be allwinner,sun7i-a20-ir;
+- clocks: list of clock specifiers, corresponding to
+  entries in clock-names property;
+- clock-names: should contain apb0_ir0 and ir0 entries;
+- 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,sun7i-a20-ir;
+   clocks = apb0_gates 6, ir0_clk;
+   clock-names = apb0_ir0, ir0;
+   interrupts = 0 5 1;
+   reg = 0x01C21800 0x40;
+   linux,rc-map-name = rc-rc6-mce;
+};


среда, 30 апреля 2014 г., 16:51:12 UTC+6 пользователь Александр Берсенев 
написал:

 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 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 v4 02/03] ARM: sunxi: Add driver for sunxi IR controller

2014-04-30 Thread Александр Берсенев
[PATCH v4 02/03] ARM: sunxi: Add driver for sunxi IR controller

This patch adds driver for sunxi IR controller.
It is based on Alexsey Shestacov's work based on the original driver 
supplied by Allwinner.

Signed-off-by: Alexander Bersenev b...@hackerdom.ru
Signed-off-by: Alexsey Shestacov wingr...@linux-sunxi.org

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..f051d94
--- /dev/null
+++ b/drivers/media/rc/sunxi-ir.c
@@ -0,0 +1,303 @@
+/*
+ * Driver for Allwinner sunXi IR controller
+ *
+ * Copyright (C) 2014 Alexsey Shestacov wingr...@linux-sunxi.org
+ * Copyright (C) 2014 Alexander Bersenev b...@hackerdom.ru
+ *
+ * Based on sun5i-ir.c:
+ * Copyright (C) 2007-2012 Daniel Wang
+ * Allwinner Technology Co., Ltd. www.allwinnertech.com
+ *
+ * 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 linux/clk.h
+#include linux/interrupt.h
+#include linux/module.h
+#include linux/of_platform.h
+#include media/rc-core.h
+
+#define SUNXI_IR_DEV sunxi-ir
+
+/* Registers */
+/* IR Control */
+#define SUNXI_IR_CTL_REG  0x00
+/* Rx Config */
+#define SUNXI_IR_RXCTL_REG0x10
+/* Rx Data */
+#define SUNXI_IR_RXFIFO_REG   0x20
+/* Rx Interrupt Enable */
+#define SUNXI_IR_RXINT_REG0x2C
+/* Rx Interrupt Status */
+#define SUNXI_IR_RXSTA_REG0x30
+/* IR Sample Config */
+#define SUNXI_IR_CIR_REG  0x34
+
+/* Bit Definition of IR_RXINTS_REG Register */
+#define SUNXI_IR_RXINTS_RXOF  BIT(0) /* Rx FIFO Overflow */
+#define SUNXI_IR_RXINTS_RXPE  BIT(1) /* Rx Packet End */
+#define SUNXI_IR_RXINTS_RXDA  BIT(4) /* Rx FIFO Data Available */
+/* Hardware supported fifo size */
+#define SUNXI_IR_FIFO_SIZE16
+/* How much messages in fifo triggers IRQ */
+#define SUNXI_IR_FIFO_TRIG8
+/* Required frequency for IR0 or IR1 clock in CIR mode */
+#define SUNXI_IR_BASE_CLK 800
+/* Frequency after IR internal divider  */
+#define SUNXI_IR_CLK  (SUNXI_IR_BASE_CLK / 64)
+/* Sample period in ns */
+#define SUNXI_IR_SAMPLE   (10ul / SUNXI_IR_CLK)
+/* Filter threshold in samples  */
+#define SUNXI_IR_RXFILT   1
+/* Idle Threshold in samples */
+#define SUNXI_IR_RXIDLE   20
+/* Time after which device stops sending data in ms */
+#define SUNXI_IR_TIMEOUT  120
+
+struct sunxi_ir {
+ spinlock_t  ir_lock;
+ struct rc_dev   *rc;
+ void __iomem*base;
+ int irq;
+ struct clk  *clk;
+ struct clk  *apb_clk;
+ const char  *map_name;
+};
+
+static irqreturn_t sunxi_ir_irq(int irqno, void *dev_id)
+{
+ unsigned long status;
+ unsigned char dt;
+ unsigned int cnt, rc;
+ struct sunxi_ir *ir = dev_id;
+ DEFINE_IR_RAW_EVENT(rawir);
+
+ spin_lock_irq(ir-ir_lock);
+
+ status = readl(ir-base + SUNXI_IR_RXSTA_REG);
+
+ /* clean all pending statuses */
+ writel(status | 0xff, ir-base + SUNXI_IR_RXSTA_REG);
+
+ if (status  SUNXI_IR_RXINTS_RXDA) {
+ /* How much messages in fifo */
+ rc  = (status  8)  0x3f;
+ /* Sanity check */
+ rc = rc  SUNXI_IR_FIFO_SIZE ? SUNXI_IR_FIFO_SIZE : rc;
+ /* if we have data */
+ for (cnt = 0; cnt  rc; cnt++) {
+ /* for each bit in fifo */
+ dt = readb(ir-base + SUNXI_IR_RXFIFO_REG);
+ rawir.pulse = (dt  0x80) != 0;
+ rawir.duration = (dt  0x7f) * SUNXI_IR_SAMPLE;
+ ir_raw_event_store_with_filter(ir-rc, rawir);
+ }
+ }
+
+ if (status  SUNXI_IR_RXINTS_RXOF)
+ ir_raw_event_reset(ir-rc);
+ else if (status  SUNXI_IR_RXINTS_RXPE) {
+ ir_raw_event_set_idle(ir-rc, true);
+ ir_raw_event_handle(ir-rc);
+ }
+
+ spin_unlock_irq(ir-ir_lock);
+
+ return IRQ_HANDLED;
+}
+
+
+static int sunxi_ir_probe(struct 

[linux-sunxi] Re: [PATCH v4 03/03] ARM: sunxi: Add IR controller support in DT on A20

2014-04-30 Thread Александр Берсенев
This patch adds IR controller in A20 Device-Tree:
- Two IR devices found in A20 user manual
- Pins for two devices
- One IR device physically found on Cubieboard 2 
- One IR device physically found on Cubietruck 

Signed-off-by: Alexander Bersenev b...@hackerdom.ru
Signed-off-by: Alexsey Shestacov wingr...@linux-sunxi.org

diff --git a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts 
b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
index feeff64..2564e8c 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
@@ -164,6 +164,12 @@
  reg = 1;
  };
  };
+
+ ir0: ir@01c21800 {
+ pinctrl-names = default;
+ pinctrl-0 = ir0_pins_a;
+ 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..e375e89 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
@@ -232,6 +232,12 @@
  reg = 1;
  };
  };
+
+ ir0: ir@01c21800 {
+ pinctrl-names = default;
+ pinctrl-0 = ir0_pins_a;
+ status = okay;
+ };
  };
 
  leds {
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi 
b/arch/arm/boot/dts/sun7i-a20.dtsi
index 0ae2b77..bb655a5 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,23 @@
  #interrupt-cells = 3;
  interrupts = 1 9 0xf04;
  };
+
+   ir0: ir@01c21800 {
+ compatible = allwinner,sun7i-a20-ir;
+ clocks = apb0_gates 6, ir0_clk;
+ clock-names = apb, ir;
+ interrupts = 0 5 4;
+ reg = 0x01c21800 0x40;
+ status = disabled;
+ };
+
+   ir1: ir@01c21c00 {
+ compatible = allwinner,sun7i-a20-ir;
+ clocks = apb0_gates 7, ir1_clk;
+ clock-names = apb, ir;
+ interrupts = 0 6 4;
+ reg = 0x01C21c00 0x40;
+ status = disabled;
+ };
  };
 };


среда, 30 апреля 2014 г., 16:51:12 UTC+6 пользователь Александр Берсенев 
написал:

 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 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 v4 02/03] ARM: sunxi: Add driver for sunxi IR controller

2014-04-30 Thread Mauro Carvalho Chehab
Em Wed, 30 Apr 2014 03:58:18 -0700 (PDT)
Александр Берсенев b...@hackerdom.ru escreveu:

 [PATCH v4 02/03] ARM: sunxi: Add driver for sunxi IR controller
 
 This patch adds driver for sunxi IR controller.
 It is based on Alexsey Shestacov's work based on the original driver 
 supplied by Allwinner.
 
 Signed-off-by: Alexander Bersenev b...@hackerdom.ru
 Signed-off-by: Alexsey Shestacov wingr...@linux-sunxi.org
 
 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..f051d94
 --- /dev/null
 +++ b/drivers/media/rc/sunxi-ir.c
 @@ -0,0 +1,303 @@
 +/*
 + * Driver for Allwinner sunXi IR controller
 + *
 + * Copyright (C) 2014 Alexsey Shestacov wingr...@linux-sunxi.org
 + * Copyright (C) 2014 Alexander Bersenev b...@hackerdom.ru
 + *
 + * Based on sun5i-ir.c:
 + * Copyright (C) 2007-2012 Daniel Wang
 + * Allwinner Technology Co., Ltd. www.allwinnertech.com
 + *
 + * 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 linux/clk.h
 +#include linux/interrupt.h
 +#include linux/module.h
 +#include linux/of_platform.h
 +#include media/rc-core.h
 +
 +#define SUNXI_IR_DEV sunxi-ir
 +
 +/* Registers */
 +/* IR Control */
 +#define SUNXI_IR_CTL_REG  0x00
 +/* Rx Config */
 +#define SUNXI_IR_RXCTL_REG0x10
 +/* Rx Data */
 +#define SUNXI_IR_RXFIFO_REG   0x20
 +/* Rx Interrupt Enable */
 +#define SUNXI_IR_RXINT_REG0x2C
 +/* Rx Interrupt Status */
 +#define SUNXI_IR_RXSTA_REG0x30
 +/* IR Sample Config */
 +#define SUNXI_IR_CIR_REG  0x34
 +
 +/* Bit Definition of IR_RXINTS_REG Register */
 +#define SUNXI_IR_RXINTS_RXOF  BIT(0) /* Rx FIFO Overflow */
 +#define SUNXI_IR_RXINTS_RXPE  BIT(1) /* Rx Packet End */
 +#define SUNXI_IR_RXINTS_RXDA  BIT(4) /* Rx FIFO Data Available */
 +/* Hardware supported fifo size */
 +#define SUNXI_IR_FIFO_SIZE16
 +/* How much messages in fifo triggers IRQ */
 +#define SUNXI_IR_FIFO_TRIG8
 +/* Required frequency for IR0 or IR1 clock in CIR mode */
 +#define SUNXI_IR_BASE_CLK 800
 +/* Frequency after IR internal divider  */
 +#define SUNXI_IR_CLK  (SUNXI_IR_BASE_CLK / 64)
 +/* Sample period in ns */
 +#define SUNXI_IR_SAMPLE   (10ul / SUNXI_IR_CLK)
 +/* Filter threshold in samples  */
 +#define SUNXI_IR_RXFILT   1
 +/* Idle Threshold in samples */
 +#define SUNXI_IR_RXIDLE   20
 +/* Time after which device stops sending data in ms */
 +#define SUNXI_IR_TIMEOUT  120
 +
 +struct sunxi_ir {
 + spinlock_t  ir_lock;
 + struct rc_dev   *rc;
 + void __iomem*base;
 + int irq;
 + struct clk  *clk;
 + struct clk  *apb_clk;
 + const char  *map_name;
 +};

Still badly indented. Maybe your emailer is mangling whitespaces.

The best is to use git send-email to send the patches.

Also, please c/c linux-media ML for the entire patch series, as, in general,
we generally merge all patches via one tree (typically, the tree to where the
real driver will be merged - in this case, the media tree), after getting
the needed acks from DT and arm subarch maintainers (when applicable).

I'll do a better review after the whitespace fixups.

Regards,
Mauro

 +
 +static irqreturn_t sunxi_ir_irq(int irqno, void *dev_id)
 +{
 + unsigned long status;
 + unsigned char dt;
 + unsigned int cnt, rc;
 + struct sunxi_ir *ir = dev_id;
 + DEFINE_IR_RAW_EVENT(rawir);
 +
 + spin_lock_irq(ir-ir_lock);
 +
 + status = readl(ir-base + SUNXI_IR_RXSTA_REG);
 +
 + /* clean all pending statuses */
 + writel(status | 0xff, ir-base + SUNXI_IR_RXSTA_REG);
 +
 + if (status  

[linux-sunxi] [PATCH] i2c-sunxi: Fix support for TWI3 and TWI4 on A20

2014-04-30 Thread Emilio López
From: Emilio López t...@linux-sunxi.org

Although Hans had introduced support for TWI3 and TWI4, the functions
handling the clocks and pins were limited to only TWI0-2. Let's fix the
clock lists to include the new A20 names, as well as generalize the pin
functions to handle all 5 buses.

Reported-by: Sertac Tüllük stul...@gmail.com
Signed-off-by: Emilio López t...@linux-sunxi.org
---
 drivers/i2c/busses/i2c-sunxi.c | 58 ++
 1 file changed, 19 insertions(+), 39 deletions(-)

diff --git a/drivers/i2c/busses/i2c-sunxi.c b/drivers/i2c/busses/i2c-sunxi.c
index 184d878..85345e0 100644
--- a/drivers/i2c/busses/i2c-sunxi.c
+++ b/drivers/i2c/busses/i2c-sunxi.c
@@ -373,31 +373,19 @@ static void aw_twi_disable_sys_clk(struct sunxi_i2c *i2c)
 
 static int aw_twi_request_gpio(struct sunxi_i2c *i2c)
 {
-   if(i2c-bus_num == 0) {
-   /* pb0-pb1 TWI0 SDA,SCK */
-   i2c_dbg(config i2c gpio with gpio_config api \n);
-
-   i2c-gpio_hdle = gpio_request_ex(twi0_para, NULL);
-   if(!i2c-gpio_hdle) {
-   pr_warning(twi0 request gpio fail!\n);
-   return -1;
-   }
-   }
-   else if(i2c-bus_num == 1) {
-   /* pb18-pb19 TWI1 scl,sda */
-   i2c-gpio_hdle = gpio_request_ex(twi1_para, NULL);
-   if(!i2c-gpio_hdle) {
-   pr_warning(twi1 request gpio fail!\n);
-   return -1;
-   }
-   }
-   else if(i2c-bus_num == 2) {
-   /* pb20-pb21 TWI2 scl,sda */
-   i2c-gpio_hdle = gpio_request_ex(twi2_para, NULL);
-   if(!i2c-gpio_hdle) {
-   pr_warning(twi2 request gpio fail!\n);
-   return -1;
-   }
+   char name[] = twi%d_para;
+
+   if (i2c-bus_num  4)
+   return 0;
+
+   sprintf(name, twi%d_para, i2c-bus_num);
+
+   i2c_dbg(config i2c gpio with gpio_config api\n);
+
+   i2c-gpio_hdle = gpio_request_ex(name, NULL);
+   if(!i2c-gpio_hdle) {
+   pr_warning(twi%d request gpio fail!\n, i2c-bus_num);
+   return -1;
}
 
return 0;
@@ -405,18 +393,10 @@ static int aw_twi_request_gpio(struct sunxi_i2c *i2c)
 
 static void aw_twi_release_gpio(struct sunxi_i2c *i2c)
 {
-   if(i2c-bus_num == 0) {
-   /* pb0-pb1 TWI0 SDA,SCK */
-   gpio_release(i2c-gpio_hdle, 0);
-   }
-   else if(i2c-bus_num == 1) {
-   /* pb18-pb19 TWI1 scl,sda */
-   gpio_release(i2c-gpio_hdle, 0);
-   }
-   else if(i2c-bus_num == 2) {
-   /* pb20-pb21 TWI2 scl,sda */
-   gpio_release(i2c-gpio_hdle, 0);
-   }
+   if (i2c-bus_num  4)
+   return;
+
+   gpio_release(i2c-gpio_hdle, 0);
 }
 
 
@@ -1006,8 +986,8 @@ static int i2c_sunxi_probe(struct platform_device *dev)
struct sunxi_i2c *i2c = NULL;
struct resource *res = NULL;
struct sunxi_i2c_platform_data *pdata = NULL;
-   char *i2c_clk[] ={twi0,twi1,twi2};
-   char *i2c_pclk[] ={apb_twi0,apb_twi1,apb_twi2};
+   char *i2c_clk[] = {twi0, twi1, twi2, twi3, twi4};
+   char *i2c_pclk[] = {apb_twi0, apb_twi1, apb_twi2, apb_twi3, 
apb_twi4};
int ret;
int irq;
 
-- 
1.9.2

-- 
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] Using usbtv driver on A20

2014-04-30 Thread info
Hi Julian,
i tryed to build using:

debian@debian:~/Scaricati/backports-3.11.8-1$ make ARCH=arm 
CROSS_COMPILE=arm-linux-gnueabihf- LINUXDIR=~/a20_kernel_3.4/linux-sunxi
/usr/src/linux-headers-3.2.0-4-common/arch/x86/Makefile:81: stack protector 
enabled but no compiler support
  CC [M]  /home/debian/Scaricati/backports-3.11.8-1/compat/main.o
cc1: error: unrecognized command line option ‘-m64’
cc1: error: unrecognized command line option ‘-mno-red-zone’
cc1: error: unrecognized command line option ‘-mcmodel=kernel’
cc1: error: unrecognized command line option ‘-maccumulate-outgoing-args’
make[8]: *** [/home/debian/Scaricati/backports-3.11.8-1/compat/main.o] Error 1
make[7]: *** [/home/debian/Scaricati/backports-3.11.8-1/compat] Error 2
make[6]: *** [_module_/home/debian/Scaricati/backports-3.11.8-1] Error 2
make[5]: *** [sub-make] Error 2
make[4]: *** [all] Error 2
make[3]: *** [modules] Error 2
make[2]: *** [modules] Error 2
make[1]: *** [modules] Error 2
make: *** [default] Error 2


could you help me ?

-- 
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] [PATCH v5 0/3] ARM: sunxi: Add support for consumer infrared devices

2014-04-30 Thread Alexander Bersenev
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.

Signed-off-by: Alexander Bersenev b...@hackerdom.ru
Signed-off-by: Alexsey Shestacov wingr...@linux-sunxi.org

---
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

Changes since version 3:
- Split the patch on smaller parts
- More documentation fixes
- Add clock-names in DT
- Use devm_clk_get function to get the clocks
- Removed gpios property from ir's DT
- Changed compatible from allwinner,sunxi-ir to allwinner,sun7i-a20-ir in DT
- Use spin_lock_irq instead spin_lock_irqsave in interrupt handler
- Add myself in the copyright ;)
- Coding style and indentation fixes

Changes since version 4:
- Try to fix indentation errors by sending patches with git send-mail

Alexander Bersenev (3):
  ARM: sunxi: Add documentation for sunxi consumer infrared devices
  ARM: sunxi: Add driver for sunxi IR controller
  ARM: sunxi: Add IR controller support in DT on A20

 .../devicetree/bindings/media/sunxi-ir.txt |  23 ++
 arch/arm/boot/dts/sun7i-a20-cubieboard2.dts|   6 +
 arch/arm/boot/dts/sun7i-a20-cubietruck.dts |   6 +
 arch/arm/boot/dts/sun7i-a20.dtsi   |  31 +++
 drivers/media/rc/Kconfig   |  10 +
 drivers/media/rc/Makefile  |   1 +
 drivers/media/rc/sunxi-ir.c| 303 +
 7 files changed, 380 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/sunxi-ir.txt
 create mode 100644 drivers/media/rc/sunxi-ir.c

-- 
1.9.2

-- 
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] [PATCH v5 3/3] ARM: sunxi: Add IR controller support in DT on A20

2014-04-30 Thread Alexander Bersenev
This patch adds IR controller in A20 Device-Tree:
- Two IR devices found in A20 user manual
- Pins for two devices
- One IR device physically found on Cubieboard 2
- One IR device physically found on Cubietruck

Signed-off-by: Alexander Bersenev b...@hackerdom.ru
Signed-off-by: Alexsey Shestacov wingr...@linux-sunxi.org
---
 arch/arm/boot/dts/sun7i-a20-cubieboard2.dts |  6 ++
 arch/arm/boot/dts/sun7i-a20-cubietruck.dts  |  6 ++
 arch/arm/boot/dts/sun7i-a20.dtsi| 31 +
 3 files changed, 43 insertions(+)

diff --git a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts 
b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
index feeff64..2564e8c 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
@@ -164,6 +164,12 @@
reg = 1;
};
};
+
+   ir0: ir@01c21800 {
+   pinctrl-names = default;
+   pinctrl-0 = ir0_pins_a;
+   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..e375e89 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
@@ -232,6 +232,12 @@
reg = 1;
};
};
+
+   ir0: ir@01c21800 {
+   pinctrl-names = default;
+   pinctrl-0 = ir0_pins_a;
+   status = okay;
+   };
};
 
leds {
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 0ae2b77..bb655a5 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,23 @@
#interrupt-cells = 3;
interrupts = 1 9 0xf04;
};
+
+   ir0: ir@01c21800 {
+   compatible = allwinner,sun7i-a20-ir;
+   clocks = apb0_gates 6, ir0_clk;
+   clock-names = apb, ir;
+   interrupts = 0 5 4;
+   reg = 0x01c21800 0x40;
+   status = disabled;
+   };
+
+   ir1: ir@01c21c00 {
+   compatible = allwinner,sun7i-a20-ir;
+   clocks = apb0_gates 7, ir1_clk;
+   clock-names = apb, ir;
+   interrupts = 0 6 4;
+   reg = 0x01C21c00 0x40;
+   status = disabled;
+   };
};
 };
-- 
1.9.2

-- 
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] Using usbtv driver on A20

2014-04-30 Thread Julian Calaby
Hi,

On Thu, May 1, 2014 at 1:00 AM,  i...@integrazioneweb.com wrote:
 Hi Julian,
 i tryed to build using:

 debian@debian:~/Scaricati/backports-3.11.8-1$ make ARCH=arm 
 CROSS_COMPILE=arm-linux-gnueabihf- LINUXDIR=~/a20_kernel_3.4/linux-sunxi
 /usr/src/linux-headers-3.2.0-4-common/arch/x86/Makefile:81: stack protector 
 enabled but no compiler support
   CC [M]  /home/debian/Scaricati/backports-3.11.8-1/compat/main.o
 cc1: error: unrecognized command line option ‘-m64’
 cc1: error: unrecognized command line option ‘-mno-red-zone’
 cc1: error: unrecognized command line option ‘-mcmodel=kernel’
 cc1: error: unrecognized command line option ‘-maccumulate-outgoing-args’
 make[8]: *** [/home/debian/Scaricati/backports-3.11.8-1/compat/main.o] Error 1
 make[7]: *** [/home/debian/Scaricati/backports-3.11.8-1/compat] Error 2
 make[6]: *** [_module_/home/debian/Scaricati/backports-3.11.8-1] Error 2
 make[5]: *** [sub-make] Error 2
 make[4]: *** [all] Error 2
 make[3]: *** [modules] Error 2
 make[2]: *** [modules] Error 2
 make[1]: *** [modules] Error 2
 make: *** [default] Error 2


 could you help me ?

I linked to a particular page in my last email. Have you read all of
it? There are instructions on how to cross-compile there.

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/

-- 
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 v3 1/9] mtd: nand: define struct nand_timings

2014-04-30 Thread Brian Norris
Hi Boris,

On Wed, Mar 12, 2014 at 07:07:36PM +0100, Boris BREZILLON wrote:
 Define a struct containing the standard NAND timings as described in NAND
 datasheets.
 
 Signed-off-by: Boris BREZILLON b.brezillon@gmail.com
 ---
  include/linux/mtd/nand.h |   49 
 ++
  1 file changed, 49 insertions(+)
 
 diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
 index 389b3c5..f3ff3a3 100644
 --- a/include/linux/mtd/nand.h
 +++ b/include/linux/mtd/nand.h
 @@ -846,4 +846,53 @@ static inline bool nand_is_slc(struct nand_chip *chip)
  {
   return chip-bits_per_cell == 1;
  }
 +
 +/**
 + * struct nand_sdr_timings - SDR NAND chip timings
 + *
 + * This struct defines the timing requirements of a SDR NAND chip.
 + * These informations can be found in every NAND datasheets and the timings
 + * meaning are described in the ONFI specifications:
 + * www.onfi.org/~/media/ONFI/specs/onfi_3_1_spec.pdf‎ (chapter 4.15 Timing

Can you remove the unicode U+200E character?

 + * Parameters)

Please document the units for these fields here. It looks like you're
using picoseconds.

 + *
 + */
 +

Extra blank line.

 +struct nand_sdr_timings {
 + u32 tALH_min;
 + u32 tADL_min;
 + u32 tALS_min;
 + u32 tAR_min;
 + u32 tCEA_max;
 + u32 tCEH_min;
 + u32 tCH_min;
 + u32 tCHZ_max;
 + u32 tCLH_min;
 + u32 tCLR_min;
 + u32 tCLS_min;
 + u32 tCOH_min;
 + u32 tCS_min;
 + u32 tDH_min;
 + u32 tDS_min;
 + u32 tFEAT_max;
 + u32 tIR_min;
 + u32 tITC_max;
 + u32 tRC_min;
 + u32 tREA_max;
 + u32 tREH_min;
 + u32 tRHOH_min;
 + u32 tRHW_min;
 + u32 tRHZ_max;
 + u32 tRLOH_min;
 + u32 tRP_min;
 + u32 tRR_min;
 + u64 tRST_max;
 + u32 tWB_max;
 + u32 tWC_min;
 + u32 tWH_min;
 + u32 tWHR_min;
 + u32 tWP_min;
 + u32 tWW_min;
 +};
 +
  #endif /* __LINUX_MTD_NAND_H */

Brian

-- 
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 v3 2/9] mtd: nand: add ONFI timing mode to nand_timings converter

2014-04-30 Thread Brian Norris
Hi,

On Wed, Mar 12, 2014 at 07:07:37PM +0100, Boris BREZILLON wrote:
 Add a converter to retrieve NAND timings from an ONFI NAND timing mode.
 This only support SDR NAND timings for now.
 
 Signed-off-by: Boris BREZILLON b.brezillon@gmail.com
 ---
  drivers/mtd/nand/Makefile   |2 +-
  drivers/mtd/nand/nand_timings.c |  248 
 +++
  include/linux/mtd/nand.h|4 +
  3 files changed, 253 insertions(+), 1 deletion(-)
  create mode 100644 drivers/mtd/nand/nand_timings.c
 
 diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
 index c970ce7..0b8a822 100644
 --- a/drivers/mtd/nand/Makefile
 +++ b/drivers/mtd/nand/Makefile
 @@ -2,7 +2,7 @@
  # linux/drivers/nand/Makefile
  #
  
 -obj-$(CONFIG_MTD_NAND)   += nand.o
 +obj-$(CONFIG_MTD_NAND)   += nand.o nand_timings.o
  obj-$(CONFIG_MTD_NAND_ECC)   += nand_ecc.o
  obj-$(CONFIG_MTD_NAND_BCH)   += nand_bch.o
  obj-$(CONFIG_MTD_NAND_IDS)   += nand_ids.o nand_hynix.o

This patch doesn't apply to l2-mtd.git. Are you basing this on your
Hynix patches? I thought some (all?) of them were determined
unnecessary. Anyway, please rebase on l2-mtd.git, since there are a
couple of other bits that don't apply properly.

 diff --git a/drivers/mtd/nand/nand_timings.c b/drivers/mtd/nand/nand_timings.c
 new file mode 100644
 index 000..f66fe95
 --- /dev/null
 +++ b/drivers/mtd/nand/nand_timings.c
 @@ -0,0 +1,248 @@
 +/*
 + *  Copyright (C) 2014 Boris BREZILLON b.brezillon@gmail.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + *
 + */
 +#include linux/mtd/nand.h
 +
 +static const struct nand_sdr_timings onfi_sdr_timings[] = {
 + /* Mode 0 */
 + {
 + .tADL_min = 20,
 + .tALH_min = 2,
 + .tALS_min = 5,
 + .tAR_min = 25000,
 + .tCEA_max = 10,
 + .tCEH_min = 2,
 + .tCH_min = 2,
 + .tCHZ_max = 10,
 + .tCLH_min = 2,
 + .tCLR_min = 2,
 + .tCLS_min = 5,
 + .tCOH_min = 0,
 + .tCS_min = 7,
 + .tDH_min = 2,
 + .tDS_min = 4,
 + .tFEAT_max = 100,
 + .tIR_min = 1,
 + .tITC_max = 100,
 + .tRC_min = 10,
 + .tREA_max = 4,
 + .tREH_min = 3,
 + .tRHOH_min = 0,
 + .tRHW_min = 20,
 + .tRHZ_max = 20,
 + .tRLOH_min = 0,
 + .tRP_min = 5,
 + .tRST_max = 2500,

I was initially wary of potential overflow here, but apparently the C
standard (section 6.4.4.1) ensures that literal constants like this will
be promoted to a sufficiently-large type.

 + .tWB_max = 20,
 + .tRR_min = 4,
 + .tWC_min = 10,
 + .tWH_min = 3,
 + .tWHR_min = 12,
 + .tWP_min = 5,
 + .tWW_min = 10,
 + },
 + /* Mode 1 */
 + {
 + .tADL_min = 10,
 + .tALH_min = 1,
 + .tALS_min = 25000,
 + .tAR_min = 1,
 + .tCEA_max = 45000,
 + .tCEH_min = 2,
 + .tCH_min = 1,
 + .tCHZ_max = 5,
 + .tCLH_min = 1,
 + .tCLR_min = 1,
 + .tCLS_min = 25000,
 + .tCOH_min = 15000,
 + .tCS_min = 35000,
 + .tDH_min = 1,
 + .tDS_min = 2,
 + .tFEAT_max = 100,
 + .tIR_min = 0,
 + .tITC_max = 100,
 + .tRC_min = 5,
 + .tREA_max = 3,
 + .tREH_min = 15000,
 + .tRHOH_min = 15000,
 + .tRHW_min = 10,
 + .tRHZ_max = 10,
 + .tRLOH_min = 0,
 + .tRP_min = 25000,
 + .tRR_min = 2,
 + .tRST_max = 5,
 + .tWB_max = 10,
 + .tWC_min = 45000,
 + .tWH_min = 15000,
 + .tWHR_min = 8,
 + .tWP_min = 25000,
 + .tWW_min = 10,
 + },
 + /* Mode 2 */
 + {
 + .tADL_min = 10,
 + .tALH_min = 1,
 + .tALS_min = 15000,
 + .tAR_min = 1,
 + .tCEA_max = 3,
 + .tCEH_min = 2,
 + .tCH_min = 1,
 + .tCHZ_max = 5,
 + .tCLH_min = 1,
 + .tCLR_min = 1,
 + .tCLS_min = 15000,
 + .tCOH_min = 15000,
 + .tCS_min = 25000,
 + .tDH_min = 5000,
 + .tDS_min = 15000,
 + 

[linux-sunxi] Re: [PATCH v3 3/9] of: mtd: add NAND timing mode retrieval support

2014-04-30 Thread Brian Norris
On Wed, Mar 12, 2014 at 07:07:38PM +0100, Boris BREZILLON wrote:
 Add a function to retrieve NAND timing mode (ONFI timing mode) from a given
 DT node.
 
 Signed-off-by: Boris BREZILLON b.brezillon@gmail.com
 ---
  drivers/of/of_mtd.c|   19 +++
  include/linux/of_mtd.h |8 
  2 files changed, 27 insertions(+)
 
 diff --git a/drivers/of/of_mtd.c b/drivers/of/of_mtd.c
 index b7361ed..8bdaa0b 100644
 --- a/drivers/of/of_mtd.c
 +++ b/drivers/of/of_mtd.c
 @@ -117,3 +117,22 @@ bool of_get_nand_on_flash_bbt(struct device_node *np)
   return of_property_read_bool(np, nand-on-flash-bbt);
  }
  EXPORT_SYMBOL_GPL(of_get_nand_on_flash_bbt);
 +
 +/**
 + * of_get_nand_timings - Get nand timings for the given device_node
 + * @np:  Pointer to the given device_node
 + *
 + * return 0 on success errno other wise
 + */
 +int of_get_nand_onfi_timing_mode(struct device_node *np)
 +{
 + int err;
 + u32 mode;
 +
 + err = of_property_read_u32(np, onfi,nand-timing-mode, mode);
 + if (err)
 + return err;
 +
 + return mode;

To fit the style of the rest of this file (and to save some lines) this
might as well be:

return ret ? ret : mode;

 +}
 +EXPORT_SYMBOL_GPL(of_get_nand_onfi_timing_mode);
 diff --git a/include/linux/of_mtd.h b/include/linux/of_mtd.h
 index e266caa..c8310ae 100644
 --- a/include/linux/of_mtd.h
 +++ b/include/linux/of_mtd.h
 @@ -9,6 +9,8 @@
  #ifndef __LINUX_OF_MTD_H
  #define __LINUX_OF_MTD_H
  
 +#include linux/mtd/nand.h
 +

What's this header used for here? I think you can drop it.

  #ifdef CONFIG_OF_MTD
  
  #include linux/of.h
 @@ -17,6 +19,7 @@ int of_get_nand_ecc_step_size(struct device_node *np);
  int of_get_nand_ecc_strength(struct device_node *np);
  int of_get_nand_bus_width(struct device_node *np);
  bool of_get_nand_on_flash_bbt(struct device_node *np);
 +int of_get_nand_onfi_timing_mode(struct device_node *np);
  
  #else /* CONFIG_OF_MTD */
  
 @@ -45,6 +48,11 @@ static inline bool of_get_nand_on_flash_bbt(struct 
 device_node *np)
   return false;
  }
  
 +static inline int of_get_nand_onfi_timing_mode(struct device_node *np)
 +{
 + return -ENOSYS;
 +}
 +
  #endif /* CONFIG_OF_MTD */
  
  #endif /* __LINUX_OF_MTD_H */

Brian

-- 
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 5/5] ARM: sunxi: Remove sun4i and sun7i machine definitions

2014-04-30 Thread Maxime Ripard
Hi,

On Mon, Apr 28, 2014 at 06:08:53PM -0700, Olof Johansson wrote:
 On Wed, Apr 23, 2014 at 9:02 AM, Arnd Bergmann a...@arndb.de wrote:
  On Wednesday 23 April 2014 17:04:36 Maxime Ripard wrote:
 
  -static void __init sunxi_dt_init(void)
  -{
  -   of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
  -}
  -
  -static const char * const sunxi_board_dt_compat[] = {
  -   allwinner,sun4i-a10,
  -   allwinner,sun5i-a10s,
  -   allwinner,sun5i-a13,
  -   NULL,
  -};
  -
  -DT_MACHINE_START(SUNXI_DT, Allwinner A1X (Device Tree))
  -   .init_machine   = sunxi_dt_init,
  -   .dt_compat  = sunxi_board_dt_compat,
  -MACHINE_END
  -
   static const char * const sun6i_board_dt_compat[] = {
  allwinner,sun6i-a31,
  NULL,
 
  I'd like to hear more opinions on this. We could either rely
  on the generic code, or we could keep the entry with just
  the .dt_compat line and the name, so /proc/cpuinfo contains
  a meaningful platform name.
 
  Either approach works for me, but I think we should do this
  consistent across platforms. Olof, do you have an opinion?
 
 In reality, today, most platforms still need some out-of-tree stuff
 that usually goes into the mach directory on out of tree kernels. It
 also gives a place to stick the Kconfig entries, it's been nice to
 have them split out in per-platform Kconfigs instead of having them
 all modify and conflict the shared one.
 
 I know those aren't strong arguments to keep it, but given that all
 other things are more or less equal, it's a good a reason as any.

I guess the /proc/cpuinfo thing just tip the scales to keeping the
minimal machines. I'll update the patches.

Maxime

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


signature.asc
Description: Digital signature


[linux-sunxi] Re: [PATCH 5/5] ARM: sunxi: Remove sun4i and sun7i machine definitions

2014-04-30 Thread Stefan Monnier
 I guess the /proc/cpuinfo thing just tip the scales to keeping the
 minimal machines. I'll update the patches.

I agree that having this data in cpuinfo is important, but I think this
just begs for a way to get this data (or something equivalent) in
cpuinfo *without* having a machine definition.


Stefan

-- 
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] i2c-sunxi: Fix support for TWI3 and TWI4 on A20

2014-04-30 Thread Alejandro Mery



On 30/04/14 15:27, Emilio López wrote:

From: Emilio López t...@linux-sunxi.org

Although Hans had introduced support for TWI3 and TWI4, the functions
handling the clocks and pins were limited to only TWI0-2. Let's fix the
clock lists to include the new A20 names, as well as generalize the pin
functions to handle all 5 buses.

Reported-by: Sertac Tüllük stul...@gmail.com
Signed-off-by: Emilio López t...@linux-sunxi.org
---
  drivers/i2c/busses/i2c-sunxi.c | 58 ++
  1 file changed, 19 insertions(+), 39 deletions(-)

diff --git a/drivers/i2c/busses/i2c-sunxi.c b/drivers/i2c/busses/i2c-sunxi.c
index 184d878..85345e0 100644
--- a/drivers/i2c/busses/i2c-sunxi.c
+++ b/drivers/i2c/busses/i2c-sunxi.c
@@ -373,31 +373,19 @@ static void aw_twi_disable_sys_clk(struct sunxi_i2c *i2c)

  static int aw_twi_request_gpio(struct sunxi_i2c *i2c)
  {
-   if(i2c-bus_num == 0) {
-   /* pb0-pb1 TWI0 SDA,SCK */
-   i2c_dbg(config i2c gpio with gpio_config api \n);
-
-   i2c-gpio_hdle = gpio_request_ex(twi0_para, NULL);
-   if(!i2c-gpio_hdle) {
-   pr_warning(twi0 request gpio fail!\n);
-   return -1;
-   }
-   }
-   else if(i2c-bus_num == 1) {
-   /* pb18-pb19 TWI1 scl,sda */
-   i2c-gpio_hdle = gpio_request_ex(twi1_para, NULL);
-   if(!i2c-gpio_hdle) {
-   pr_warning(twi1 request gpio fail!\n);
-   return -1;
-   }
-   }
-   else if(i2c-bus_num == 2) {
-   /* pb20-pb21 TWI2 scl,sda */
-   i2c-gpio_hdle = gpio_request_ex(twi2_para, NULL);
-   if(!i2c-gpio_hdle) {
-   pr_warning(twi2 request gpio fail!\n);
-   return -1;
-   }
+   char name[] = twi%d_para;
+
+   if (i2c-bus_num  4)
+   return 0;
+
+   sprintf(name, twi%d_para, i2c-bus_num);
+
+   i2c_dbg(config i2c gpio with gpio_config api\n);
+
+   i2c-gpio_hdle = gpio_request_ex(name, NULL);
+   if(!i2c-gpio_hdle) {
+   pr_warning(twi%d request gpio fail!\n, i2c-bus_num);
+   return -1;
}

return 0;
@@ -405,18 +393,10 @@ static int aw_twi_request_gpio(struct sunxi_i2c *i2c)

  static void aw_twi_release_gpio(struct sunxi_i2c *i2c)
  {
-   if(i2c-bus_num == 0) {
-   /* pb0-pb1 TWI0 SDA,SCK */
-   gpio_release(i2c-gpio_hdle, 0);
-   }
-   else if(i2c-bus_num == 1) {
-   /* pb18-pb19 TWI1 scl,sda */
-   gpio_release(i2c-gpio_hdle, 0);
-   }
-   else if(i2c-bus_num == 2) {
-   /* pb20-pb21 TWI2 scl,sda */
-   gpio_release(i2c-gpio_hdle, 0);
-   }
+   if (i2c-bus_num  4)
+   return;
+
+   gpio_release(i2c-gpio_hdle, 0);
  }


@@ -1006,8 +986,8 @@ static int i2c_sunxi_probe(struct platform_device *dev)
struct sunxi_i2c *i2c = NULL;
struct resource *res = NULL;
struct sunxi_i2c_platform_data *pdata = NULL;
-   char *i2c_clk[] ={twi0,twi1,twi2};
-   char *i2c_pclk[] ={apb_twi0,apb_twi1,apb_twi2};
+   char *i2c_clk[] = {twi0, twi1, twi2, twi3, twi4};
+   char *i2c_pclk[] = {apb_twi0, apb_twi1, apb_twi2, apb_twi3, 
apb_twi4};
int ret;
int irq;




thank you, applied on stage/sunxi-3.4

cheers,
Alejandro Mery

--
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 v7] DMA: sun6i: Add driver for the Allwinner A31 DMA controller

2014-04-30 Thread Maxime Ripard
Hi Vinod,

On Wed, Apr 30, 2014 at 12:34:08PM +0530, Vinod Koul wrote:
 On Thu, Apr 24, 2014 at 04:22:44PM +0200, Maxime Ripard wrote:
  The Allwinner A31 has a 16 channels DMA controller that it shares with the
  newer A23. Although sharing some similarities with the DMA controller of the
  older Allwinner SoCs, it's significantly different, I don't expect it to be
  possible to share the driver for these two.
  
  The A31 Controller is able to memory-to-memory or memory-to-device 
  transfers on
  the 16 channels in parallel.
 
 Overall driver looks in good shape, few comments though...
 
  +This driver follows the generic DMA bindings defined in dma.txt.
  +
  +Required properties:
  +
  +- compatible:  Must be allwinner,sun6i-a31-dma
  +- reg: Should contain the registers base address and length
  +- interrupts:  Should contain a reference to the interrupt used by 
  this device
  +- clocks:  Should contain a reference to the parent AHB clock
  +- resets:  Should contain a reference to the reset controller asserting
  +   this device in reset
  +- #dma-cells : Should be 1, a single cell holding a line request number
  +
  +Example:
  +   dma: dma-controller@01c02000 {
  +   compatible = allwinner,sun6i-a31-dma;
  +   reg = 0x01c02000 0x1000;
  +   interrupts = 0 50 4;
  +   clocks = ahb1_gates 6;
  +   resets = ahb1_rst 6;
  +   #dma-cells = 1;
  +   };
  +
  +Clients:
  +
  +DMA clients connected to the A31 DMA controller must use the format
  +described in the dma.txt file, using a two-cell specifier for each
  +channel: a phandle plus one integer cells.
  +The two cells in order are:
  +
  +1. A phandle pointing to the DMA controller.
  +2. The port ID as specified in the datasheet
  +
  +Example:
  +spi2: spi@01c6a000 {
  +   compatible = allwinner,sun6i-a31-spi;
  +   reg = 0x01c6a000 0x1000;
  +   interrupts = 0 67 4;
  +   clocks = ahb1_gates 22, spi2_clk;
  +   clock-names = ahb, mod;
  +   dmas = dma 25, dma 25;
  +   dma-names = rx, tx;
  +   resets = ahb1_rst 22;
  +};
 Ideally binding should be a separate patch

Ok

  +static inline u8 convert_burst(u8 maxburst)
  +{
  +   if (maxburst == 1 || maxburst  16)
  +   return 0;
 are these valid configurations?

The only valid burst values are 1 (0) and 8 (2).

  +
  +   return fls(maxburst) - 1;
  +}
  +
  +static inline u8 convert_buswidth(enum dma_slave_buswidth addr_width)
  +{
  +   switch (addr_width) {
  +   case DMA_SLAVE_BUSWIDTH_2_BYTES:
  +   return 1;
  +   case DMA_SLAVE_BUSWIDTH_4_BYTES:
  +   return 2;
 return (addr_width  1); ..??
 since DMA_SLAVE_BUSWIDTH_2_BYTES is numeric 2 and DMA_SLAVE_BUSWIDTH_4_BYTES
 numeric 4. 

Yes, it would work.

  +   default:
  +   return 0;
 error?

Ok.

  +static inline void sun6i_dma_cfg_lli(struct sun6i_dma_lli *lli,
  +dma_addr_t src,
  +dma_addr_t dst, u32 len,
  +struct dma_slave_config *config)
  +{
  +   u32 src_width, dst_width, src_burst, dst_burst;
  +
  +   if (!config)
  +   return;
  +
  +   src_burst = convert_burst(config-src_maxburst);
  +   dst_burst = convert_burst(config-dst_maxburst);
  +
  +   src_width = convert_buswidth(config-src_addr_width);
  +   dst_width = convert_buswidth(config-dst_addr_width);
 is 0 a valid case then?

Yes, it is. 0 is a burst of 1, and a width of a byte.

  +
  +static int sun6i_dma_terminate_all(struct sun6i_vchan *vchan)
  +{
  +   struct sun6i_dma_dev *sdev = to_sun6i_dma_dev(vchan-vc.chan.device);
  +   struct sun6i_pchan *pchan = vchan-phy;
  +   unsigned long flags;
  +   LIST_HEAD(head);
  +
  +   spin_lock(sdev-lock);
  +   list_del_init(vchan-node);
  +   spin_unlock(sdev-lock);
  +
  +   spin_lock_irqsave(vchan-vc.lock, flags);
  +
  +   vchan_get_all_descriptors(vchan-vc, head);
  +
  +   if (pchan) {
  +   writel(DMA_CHAN_ENABLE_STOP, pchan-base + DMA_CHAN_ENABLE);
  +   writel(DMA_CHAN_PAUSE_RESUME, pchan-base + DMA_CHAN_PAUSE);
  +
  +   vchan-phy = NULL;
  +   pchan-vchan = NULL;
  +   pchan-desc = NULL;
  +   pchan-done = NULL;
  +   }
  +
  +   spin_unlock_irqrestore(vchan-vc.lock, flags);
  +
  +   vchan_dma_desc_free_list(vchan-vc, head);
 
 shouldn't you kill the tasklet as well here?

Hmm, yes.

  +static inline void sun6i_dma_free(struct sun6i_dma_dev *sdc)
  +{
  +   int i;
  +
  +   for (i = 0; i  NR_MAX_VCHANS; i++) {
  +   struct sun6i_vchan *vchan = sdc-vchans[i];
  +
  +   list_del(vchan-vc.chan.device_node);
  +   tasklet_kill(vchan-vc.task);
  +   }
  +
  +   tasklet_kill(sdc-task);
 This is again not good. see http://lwn.net/Articles/588457/
 At this point HW can still generate interrupts or you can have irq running!

I'm not sure to fully understand the issue here, but what is not good?
the first or the second tasklet_kill calls, or 

Re: [linux-sunxi] [PATCH v5 0/3] ARM: sunxi: Add support for consumer infrared devices

2014-04-30 Thread Priit Laes
Ühel kenal päeval, K, 30.04.2014 kell 21:16, kirjutas Alexander
Bersenev:
 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.
 
 Signed-off-by: Alexander Bersenev b...@hackerdom.ru
 Signed-off-by: Alexsey Shestacov wingr...@linux-sunxi.org

 ---
 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
 
 Changes since version 3:
 - Split the patch on smaller parts
 - More documentation fixes
 - Add clock-names in DT
 - Use devm_clk_get function to get the clocks
 - Removed gpios property from ir's DT
 - Changed compatible from allwinner,sunxi-ir to allwinner,sun7i-a20-ir in DT
 - Use spin_lock_irq instead spin_lock_irqsave in interrupt handler
 - Add myself in the copyright ;)
 - Coding style and indentation fixes
 
 Changes since version 4:
 - Try to fix indentation errors by sending patches with git send-mail

git am still complains due to mixed tabs-spaces used for indentation
 Alexander Bersenev (3):
   ARM: sunxi: Add documentation for sunxi consumer infrared devices
Applying: ARM: sunxi: Add documentation for sunxi consumer infrared devices
/usr/src/linux/.git/rebase-apply/patch:28: space before tab in indent.
compatible = allwinner,sun7i-a20-ir;
/usr/src/linux/.git/rebase-apply/patch:29: space before tab in indent.
clocks = apb0_gates 6, ir0_clk;
/usr/src/linux/.git/rebase-apply/patch:30: space before tab in indent.
clock-names = apb0_ir0, ir0;
/usr/src/linux/.git/rebase-apply/patch:31: space before tab in indent.
interrupts = 0 5 1;
/usr/src/linux/.git/rebase-apply/patch:32: space before tab in indent.
reg = 0x01C21800 0x40;
   ARM: sunxi: Add driver for sunxi IR controller
OK
   ARM: sunxi: Add IR controller support in DT on A20
Applying: ARM: sunxi: Add IR controller support in DT on A20
/usr/src/linux/.git/rebase-apply/patch:70: space before tab in indent.
ir0: ir@01c21800 {
/usr/src/linux/.git/rebase-apply/patch:71: space before tab in indent.
compatible = allwinner,sun7i-a20-ir;
/usr/src/linux/.git/rebase-apply/patch:79: space before tab in indent.
ir1: ir@01c21c00 {
/usr/src/linux/.git/rebase-apply/patch:80: space before tab in indent.
compatible = allwinner,sun7i-a20-ir;

-- 
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.