[linux-sunxi] Re: [PATCH v2 12/25] mtd: nand: use the mtd instance embedded in struct nand_chip

2015-12-01 Thread Brian Norris
Hi Boris,

On Tue, Dec 01, 2015 at 12:03:09PM +0100, Boris Brezillon wrote:
> struct nand_chip now embeds an mtd device. Patch all drivers to make use
> of this mtd instance instead of using the instance embedded in their
> private struct or dynamically allocated.
> 
> Signed-off-by: Boris Brezillon 
> Cc: Julia Lawall 
> ---
> Most of those changes were generated with the coccinelle script added
> in commit c671312 "coccinelle: nand: detect and correct drivers embedding
> an mtd_info object"
> ---
>  drivers/mtd/nand/ams-delta.c   | 13 ++--
>  drivers/mtd/nand/atmel_nand.c  | 13 ++--
>  drivers/mtd/nand/au1550nd.c| 19 ++---
>  drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h |  1 -
>  drivers/mtd/nand/bcm47xxnflash/main.c  |  8 ++-
>  drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c   |  2 +-
>  drivers/mtd/nand/bf5xx_nand.c  | 12 ++--
>  drivers/mtd/nand/brcmnand/brcmnand.c   | 13 ++--
>  drivers/mtd/nand/cafe_nand.c   |  8 +--
>  drivers/mtd/nand/cmx270_nand.c | 11 ++-
>  drivers/mtd/nand/cs553x_nand.c | 13 ++--
>  drivers/mtd/nand/davinci_nand.c| 30 
>  drivers/mtd/nand/denali.c  | 68 ++
>  drivers/mtd/nand/denali.h  |  1 -
>  drivers/mtd/nand/diskonchip.c  | 11 ++-
>  drivers/mtd/nand/docg4.c   | 16 ++---
>  drivers/mtd/nand/fsl_elbc_nand.c   | 26 ---
>  drivers/mtd/nand/fsl_ifc_nand.c| 28 
>  drivers/mtd/nand/fsl_upm.c | 28 
>  drivers/mtd/nand/fsmc_nand.c   | 56 ---
>  drivers/mtd/nand/gpio.c| 20 +++---
>  drivers/mtd/nand/gpmi-nand/gpmi-lib.c  |  2 +-
>  drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 20 +++---
>  drivers/mtd/nand/gpmi-nand/gpmi-nand.h |  1 -
>  drivers/mtd/nand/hisi504_nand.c| 13 ++--
>  drivers/mtd/nand/jz4740_nand.c |  9 ++-
>  drivers/mtd/nand/lpc32xx_mlc.c |  7 +-
>  drivers/mtd/nand/lpc32xx_slc.c |  7 +-
>  drivers/mtd/nand/mpc5121_nfc.c |  3 +-
>  drivers/mtd/nand/mxc_nand.c|  5 +-
>  drivers/mtd/nand/nandsim.c | 12 ++--
>  drivers/mtd/nand/ndfc.c| 24 ---
>  drivers/mtd/nand/nuc900_nand.c | 24 +++
>  drivers/mtd/nand/omap2.c   | 98 
> +++---
>  drivers/mtd/nand/orion_nand.c  |  4 +-
>  drivers/mtd/nand/pasemi_nand.c | 12 ++--
>  drivers/mtd/nand/plat_nand.c   | 15 ++--
>  drivers/mtd/nand/pxa3xx_nand.c | 33 -
>  drivers/mtd/nand/r852.c| 34 -
>  drivers/mtd/nand/r852.h|  1 -
>  drivers/mtd/nand/s3c2410.c | 23 +++---

^^ some errors in this one

>  drivers/mtd/nand/sh_flctl.c|  8 +--
>  drivers/mtd/nand/sharpsl.c | 22 +++---
>  drivers/mtd/nand/socrates_nand.c   |  5 +-
>  drivers/mtd/nand/sunxi_nand.c  | 13 ++--
>  drivers/mtd/nand/tmio_nand.c   | 10 +--
>  drivers/mtd/nand/txx9ndfmc.c   |  3 +-
>  drivers/mtd/nand/vf610_nfc.c   |  8 ++-
>  include/linux/mtd/sh_flctl.h   |  3 +-
>  49 files changed, 426 insertions(+), 390 deletions(-)
> 

[...]

> diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
> index e658b29..3f29734 100644
> --- a/drivers/mtd/nand/s3c2410.c
> +++ b/drivers/mtd/nand/s3c2410.c
> @@ -104,7 +104,6 @@ struct s3c2410_nand_info;
>   * @scan_res: The result from calling nand_scan_ident().
>  */
>  struct s3c2410_nand_mtd {
> - struct mtd_info mtd;
>   struct nand_chipchip;
>   struct s3c2410_nand_set *set;
>   struct s3c2410_nand_info*info;
> @@ -168,7 +167,8 @@ struct s3c2410_nand_info {
>  
>  static struct s3c2410_nand_mtd *s3c2410_nand_mtd_toours(struct mtd_info *mtd)
>  {
> - return container_of(mtd, struct s3c2410_nand_mtd, mtd);
> + return container_of(mtd_to_nand(mtd), struct s3c2410_nand_mtd,
> + chip);
>  }
>  
>  static struct s3c2410_nand_info *s3c2410_nand_mtd_toinfo(struct mtd_info 
> *mtd)
> @@ -745,7 +745,7 @@ static int s3c24xx_nand_remove(struct platform_device 
> *pdev)
>  
>   for (mtdno = 0; mtdno < info->mtd_count; mtdno++, ptr++) {
>   pr_debug("releasing mtd %d (%p)\n", mtdno, ptr);
> - nand_release(>mtd);
> + nand_release(nand_to_mtd(>chip));
>   }
>   }
>  
> @@ -762,9 +762,11 @@ static int s3c2410_nand_add_partition(struct 
> 

[linux-sunxi] Re: [PATCH v3] touchscreen: pixcir_i2c: Add support for wake and enable gpios

2015-12-01 Thread Dmitry Torokhov
On Sun, Nov 22, 2015 at 04:19:50PM -0600, Rob Herring wrote:
> On Sun, Nov 22, 2015 at 04:57:33PM +0100, Hans de Goede wrote:
> > From: Sander Vermin 
> > 
> > On some devices the wake and enable pins of the pixcir touchscreen
> > controller are connected to gpios and these must be controlled by the
> > driver for the device to operate properly.
> > 
> > Signed-off-by: Sander Vermin 
> > Signed-off-by: Hans de Goede 
> > ---
> > Changes in v2 (Hans de Goede):
> > -Split the changes for dealing with inverted / swapped axis out into a
> >  separate patch
> > -Remove a bunch of dev_info calls to make the driver less chatty
> > -Use devm_gpiod_get_optional as these new gpios are optional
> > -Only msleep after setting enable high if we have an enable pin
> > Changes in v3 (Hans de Goede):
> > -Use "if (ts->gpio_foo)" instead of "if (!IS_ERR_OR_NULL(ts->foo))"
> > -No need to set gpio-s to 1 after requesting them with GPIOD_OUT_HIGH
> > ---
> >  .../bindings/input/touchscreen/pixcir_i2c_ts.txt   |  2 ++
> 
> For the binding:
> 
> Acked-by: Rob Herring 

Applied, thank you.

> 
> >  drivers/input/touchscreen/pixcir_i2c_ts.c  | 40 
> > ++
> >  2 files changed, 42 insertions(+)
> > 
> > diff --git 
> > a/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt 
> > b/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
> > index 8eb240a..72ca5ec 100644
> > --- a/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
> > +++ b/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
> > @@ -10,6 +10,8 @@ Required properties:
> >  
> >  Optional properties:
> >  - reset-gpio: GPIO connected to the RESET line of the chip
> > +- enable-gpios: GPIO connected to the ENABLE line of the chip
> > +- wake-gpios: GPIO connected to the WAKE line of the chip
> >  
> >  Example:
> >  
> > diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c 
> > b/drivers/input/touchscreen/pixcir_i2c_ts.c
> > index 211408c..22a67c6 100644
> > --- a/drivers/input/touchscreen/pixcir_i2c_ts.c
> > +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
> > @@ -38,6 +38,8 @@ struct pixcir_i2c_ts_data {
> > struct input_dev *input;
> > struct gpio_desc *gpio_attb;
> > struct gpio_desc *gpio_reset;
> > +   struct gpio_desc *gpio_enable;
> > +   struct gpio_desc *gpio_wake;
> > const struct pixcir_i2c_chip_data *chip;
> > int max_fingers;/* Max fingers supported in this instance */
> > bool running;
> > @@ -208,6 +210,11 @@ static int pixcir_set_power_mode(struct 
> > pixcir_i2c_ts_data *ts,
> > struct device *dev = >client->dev;
> > int ret;
> >  
> > +   if (mode == PIXCIR_POWER_ACTIVE || mode == PIXCIR_POWER_IDLE) {
> > +   if (ts->gpio_wake)
> > +   gpiod_set_value_cansleep(ts->gpio_wake, 1);
> > +   }
> > +
> > ret = i2c_smbus_read_byte_data(ts->client, PIXCIR_REG_POWER_MODE);
> > if (ret < 0) {
> > dev_err(dev, "%s: can't read reg 0x%x : %d\n",
> > @@ -228,6 +235,11 @@ static int pixcir_set_power_mode(struct 
> > pixcir_i2c_ts_data *ts,
> > return ret;
> > }
> >  
> > +   if (mode == PIXCIR_POWER_HALT) {
> > +   if (ts->gpio_wake)
> > +   gpiod_set_value_cansleep(ts->gpio_wake, 0);
> > +   }
> > +
> > return 0;
> >  }
> >  
> > @@ -302,6 +314,11 @@ static int pixcir_start(struct pixcir_i2c_ts_data *ts)
> > struct device *dev = >client->dev;
> > int error;
> >  
> > +   if (ts->gpio_enable) {
> > +   gpiod_set_value_cansleep(ts->gpio_enable, 1);
> > +   msleep(100);
> > +   }
> > +
> > /* LEVEL_TOUCH interrupt with active low polarity */
> > error = pixcir_set_int_mode(ts, PIXCIR_INT_LEVEL_TOUCH, 0);
> > if (error) {
> > @@ -343,6 +360,9 @@ static int pixcir_stop(struct pixcir_i2c_ts_data *ts)
> > /* Wait till running ISR is complete */
> > synchronize_irq(ts->client->irq);
> >  
> > +   if (ts->gpio_enable)
> > +   gpiod_set_value_cansleep(ts->gpio_enable, 0);
> > +
> > return 0;
> >  }
> >  
> > @@ -534,6 +554,26 @@ static int pixcir_i2c_ts_probe(struct i2c_client 
> > *client,
> > return error;
> > }
> >  
> > +   tsdata->gpio_wake = devm_gpiod_get_optional(dev, "wake",
> > +   GPIOD_OUT_HIGH);
> > +   if (IS_ERR(tsdata->gpio_wake)) {
> > +   error = PTR_ERR(tsdata->gpio_wake);
> > +   if (error != -EPROBE_DEFER)
> > +   dev_err(dev, "Failed to get wake gpio: %d\n", error);
> > +   return error;
> > +   }
> > +
> > +   tsdata->gpio_enable = devm_gpiod_get_optional(dev, "enable",
> > + GPIOD_OUT_HIGH);
> > +   if (IS_ERR(tsdata->gpio_enable)) {
> > +   error = PTR_ERR(tsdata->gpio_enable);
> > +   if (error != -EPROBE_DEFER)
> > +   

Re: [linux-sunxi] Banana Pi M3 (A83T based) soon ready to donate

2015-12-01 Thread Thomas Kaiser
Luc Verhaegen wrote:

>Keep it

Nope, this device is completely useless (at least for me). I already
finished my "review" (a severe warning regarding the board's manufacturer
combined with a few technical details I was able to collect).

http://forum.armbian.com/index.php/topic/474-quick-review-of-banana-pi-m3/

I will keep it the next 2 weeks but then it's free for anyone working on
A83T. Just drop me a note. Preferably from within Europe due to shipping
costs.

But if I understand correctly, A83T is already gone and replaced by 'R58'
instead? http://www.allwinnertech.com/uploads/150529/7-1505291G22Y25.jpg

Anyway, @Vishnu, can you please comment on the question whether the A83T
contains a SGX544MP1 or MP2? According to the fex files used for the
BPi-M3 it should be 2 CPU cores.

Thx,

Thomas


-- 
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 v2 17/25] mtd: nand: remove useless mtd->priv = chip assignments

2015-12-01 Thread Brian Norris
On Tue, Dec 01, 2015 at 12:03:14PM +0100, Boris Brezillon wrote:
> mtd_to_nand() now uses the container_of() approach to transform an
> mtd_info pointer into a nand_chip one. Drop useless mtd->priv
> assignments from NAND controller drivers.
> 
> Signed-off-by: Boris Brezillon 
> ---
> Patch generated with the following coccinelle script:
> 
> ---8<
> virtual patch
> 
> @@
> struct mtd_info m;
> struct mtd_info *mp;
> struct nand_chip *c;
> @@
> (
> -(m).priv = c;
> |
> -(mp)->priv = c;
> |
> -(mp)->priv = (void *)c;
> )
> ---8<
> ---

...

> diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
> index 3f29734..ed4184c 100644
> --- a/drivers/mtd/nand/s3c2410.c
> +++ b/drivers/mtd/nand/s3c2410.c
> @@ -834,7 +834,6 @@ static void s3c2410_nand_init_chip(struct 
> s3c2410_nand_info *info,
>   chip->IO_ADDR_R = chip->IO_ADDR_W;
>  
>   nmtd->info = info;
> - mtd->priv  = chip;

After this one, we have:

drivers/mtd/nand/s3c2410.c: In function ‘s3c2410_nand_init_chip’:
drivers/mtd/nand/s3c2410.c:791:19: warning: unused variable ‘mtd’ 
[-Wunused-variable]


>   nmtd->set  = set;
>  
>  #ifdef CONFIG_MTD_NAND_S3C2410_HWECC
 
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 v2 12/25] mtd: nand: use the mtd instance embedded in struct nand_chip

2015-12-01 Thread Brian Norris
On Tue, Dec 01, 2015 at 12:03:09PM +0100, Boris Brezillon wrote:
> struct nand_chip now embeds an mtd device. Patch all drivers to make use
> of this mtd instance instead of using the instance embedded in their
> private struct or dynamically allocated.
> 
> Signed-off-by: Boris Brezillon 
> Cc: Julia Lawall 
> ---
> Most of those changes were generated with the coccinelle script added
> in commit c671312 "coccinelle: nand: detect and correct drivers embedding
> an mtd_info object"
> ---
>  drivers/mtd/nand/ams-delta.c   | 13 ++--
>  drivers/mtd/nand/atmel_nand.c  | 13 ++--
>  drivers/mtd/nand/au1550nd.c| 19 ++---
>  drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h |  1 -
>  drivers/mtd/nand/bcm47xxnflash/main.c  |  8 ++-
>  drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c   |  2 +-
>  drivers/mtd/nand/bf5xx_nand.c  | 12 ++--
>  drivers/mtd/nand/brcmnand/brcmnand.c   | 13 ++--
>  drivers/mtd/nand/cafe_nand.c   |  8 +--
>  drivers/mtd/nand/cmx270_nand.c | 11 ++-
>  drivers/mtd/nand/cs553x_nand.c | 13 ++--
>  drivers/mtd/nand/davinci_nand.c| 30 
>  drivers/mtd/nand/denali.c  | 68 ++
>  drivers/mtd/nand/denali.h  |  1 -
>  drivers/mtd/nand/diskonchip.c  | 11 ++-
>  drivers/mtd/nand/docg4.c   | 16 ++---

^^ some errors here too

>  drivers/mtd/nand/fsl_elbc_nand.c   | 26 ---
>  drivers/mtd/nand/fsl_ifc_nand.c| 28 
>  drivers/mtd/nand/fsl_upm.c | 28 
>  drivers/mtd/nand/fsmc_nand.c   | 56 ---
>  drivers/mtd/nand/gpio.c| 20 +++---
>  drivers/mtd/nand/gpmi-nand/gpmi-lib.c  |  2 +-
>  drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 20 +++---
>  drivers/mtd/nand/gpmi-nand/gpmi-nand.h |  1 -
>  drivers/mtd/nand/hisi504_nand.c| 13 ++--
>  drivers/mtd/nand/jz4740_nand.c |  9 ++-
>  drivers/mtd/nand/lpc32xx_mlc.c |  7 +-
>  drivers/mtd/nand/lpc32xx_slc.c |  7 +-
>  drivers/mtd/nand/mpc5121_nfc.c |  3 +-
>  drivers/mtd/nand/mxc_nand.c|  5 +-
>  drivers/mtd/nand/nandsim.c | 12 ++--
>  drivers/mtd/nand/ndfc.c| 24 ---
>  drivers/mtd/nand/nuc900_nand.c | 24 +++
>  drivers/mtd/nand/omap2.c   | 98 
> +++---
>  drivers/mtd/nand/orion_nand.c  |  4 +-
>  drivers/mtd/nand/pasemi_nand.c | 12 ++--
>  drivers/mtd/nand/plat_nand.c   | 15 ++--
>  drivers/mtd/nand/pxa3xx_nand.c | 33 -
>  drivers/mtd/nand/r852.c| 34 -
>  drivers/mtd/nand/r852.h|  1 -
>  drivers/mtd/nand/s3c2410.c | 23 +++---
>  drivers/mtd/nand/sh_flctl.c|  8 +--
>  drivers/mtd/nand/sharpsl.c | 22 +++---
>  drivers/mtd/nand/socrates_nand.c   |  5 +-
>  drivers/mtd/nand/sunxi_nand.c  | 13 ++--
>  drivers/mtd/nand/tmio_nand.c   | 10 +--
>  drivers/mtd/nand/txx9ndfmc.c   |  3 +-
>  drivers/mtd/nand/vf610_nfc.c   |  8 ++-
>  include/linux/mtd/sh_flctl.h   |  3 +-
>  49 files changed, 426 insertions(+), 390 deletions(-)
> 

...

> diff --git a/drivers/mtd/nand/docg4.c b/drivers/mtd/nand/docg4.c
> index da93d7f..f8d5e27 100644
> --- a/drivers/mtd/nand/docg4.c
> +++ b/drivers/mtd/nand/docg4.c
> @@ -1305,14 +1305,13 @@ static int __init probe_docg4(struct platform_device 
> *pdev)
>   return -EIO;
>   }
>  
> - len = sizeof(struct mtd_info) + sizeof(struct nand_chip) +
> - sizeof(struct docg4_priv);
> - mtd = kzalloc(len, GFP_KERNEL);
> - if (mtd == NULL) {
> + len = sizeof(struct nand_chip) + sizeof(struct docg4_priv);
> + nand = kzalloc(len, GFP_KERNEL);
> + if (nand == NULL) {
>   retval = -ENOMEM;
>   goto fail;
>   }
> - nand = (struct nand_chip *) (mtd + 1);
> + mtd = nand_to_mtd(nand);
>   doc = (struct docg4_priv *) (nand + 1);
>   mtd->priv = nand;
>   nand->priv = doc;
> @@ -1355,13 +1354,12 @@ static int __init probe_docg4(struct platform_device 
> *pdev)
>  
>   fail:
>   iounmap(virtadr);
> - if (mtd) {
> + if (nand) {
>   /* re-declarations avoid compiler warning */
> - struct nand_chip *nand = mtd_to_nand(mtd);
>   struct docg4_priv *doc = nand->priv;
>   nand_release(mtd); /* deletes partitions and mtd devices */

drivers/mtd/nand/docg4.c: In function ‘probe_docg4’:

[linux-sunxi] [PATCH 3/3] sunxi-tools: README: Cross-compilation examples

2015-12-01 Thread Justin Swartz
The meminfo example has been corrected to match the Makefile's
"sunxi-meminfo" target, and an example has been added for the
"sunxi-script_extractor" target.

Signed-off-by: Justin Swartz 
---
 README | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/README b/README
index 073b3ba..27742be 100644
--- a/README
+++ b/README
@@ -57,15 +57,17 @@ phoenix_info:
phoenixcard utility and optionally extracts the embedded boot
code & firmware file from their hidden partitions.
 
-meminfo:
+sunxi-meminfo:
Tool for reading DRAM settings from registers. Compiled as a
static binary for use on android and other OSes. To build this,
get a toolchain, and run:
-   make CROSS_COMPILE=arm-linux-gnueabihf- meminfo
+   make CROSS_COMPILE=arm-linux-gnueabihf- sunxi-meminfo
 
-script-extractor:
+sunxi-script_extractor:
A simple tool, which can be executed on a rooted Android device
to dump the script.bin blob from RAM via reading /dev/mem.
+   To build this, get a toolchain, and run:
+   make CROSS_COMPILE=arm-linux-gnueabihf- sunxi-script_extractor
 
 This software is licensed under the terms of GPLv2+ as defined by the
 Free Software Foundation, details can be read in the COPYING file.
-- 
2.1.4

-- 
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 1/3] sunxi-tools: script_extractor: bug fixes

2015-12-01 Thread Justin Swartz
Script size argument detection: argc should be greater than one,
rather than not equal to zero.

Output loop termination: the index variable should be compared against
the value of the size variable, as opposed to the default SCRIPT_SIZE
definition.

munmap: the mapping returned by mmap, addr, should be unmapped instead
of NULL.

Signed-off-by: Justin Swartz 
---
 script_extractor.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/script_extractor.c b/script_extractor.c
index 52d817f..bc67b7a 100644
--- a/script_extractor.c
+++ b/script_extractor.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -34,13 +35,13 @@ int main(int argc, char *argv[]) {
fd = open("/dev/mem", O_RDONLY);
 
size = SCRIPT_SIZE;
-   if (argc)
+   if (argc > 1)
size = atoi(argv[1]);
 
addr = (char *)mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 
SCRIPT_START);
-   for (i = 0; i < SCRIPT_SIZE; i++)
+   for (i = 0; i < size; i++)
putchar(addr[i]);
-   munmap(NULL, SCRIPT_SIZE);
+   munmap(addr, size);
close(fd);
 
return 0;
-- 
2.1.4

-- 
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 2/3] sunxi-tools: Makefile: Add sunxi-script_extractor target

2015-12-01 Thread Justin Swartz
Signed-off-by: Justin Swartz 
---
 Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Makefile b/Makefile
index 53d6a0d..df7085a 100644
--- a/Makefile
+++ b/Makefile
@@ -145,6 +145,9 @@ sunxi-bootinfo: bootinfo.c
 sunxi-meminfo: meminfo.c
$(CROSS_COMPILE)gcc -g -O0 -Wall -static -o $@ $^
 
+sunxi-script_extractor: script_extractor.c
+   $(CROSS_COMPILE)gcc -g -O0 -Wall -static -o $@ $^
+
 .gitignore: Makefile
@for x in $(TOOLS) $(FEXC_LINKS) $(TARGET_TOOLS) '*.o' '*.swp'; do \
echo "$$x"; \
-- 
2.1.4

-- 
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] Add fex file for Inet D70 A33 tablet

2015-12-01 Thread Justin Swartz
Signed-off-by: Justin Swartz 
---
 sys_config/a33/inet_d70_a33.fex | 971 
 1 file changed, 971 insertions(+)
 create mode 100644 sys_config/a33/inet_d70_a33.fex

diff --git a/sys_config/a33/inet_d70_a33.fex b/sys_config/a33/inet_d70_a33.fex
new file mode 100644
index 000..a143d76
--- /dev/null
+++ b/sys_config/a33/inet_d70_a33.fex
@@ -0,0 +1,971 @@
+[product]
+version = "100"
+machine = "U708HC"
+
+[platform]
+eraseflag = 1
+next_work = 0
+
+[target]
+boot_clock = 1008
+storage_type = 0
+burn_key = 1
+
+[key_detect_en]
+keyen_flag = 1
+
+[power_sply]
+dcdc1_vol = 3000
+dcdc2_vol = 1100
+dcdc3_vol = 1200
+dcdc4_vol = 0
+dcdc5_vol = 1500
+aldo2_vol = 2500
+aldo3_vol = 3000
+
+[card_boot]
+logical_start = 40960
+sprite_gpio0 =
+next_work = 3
+
+[card0_boot_para]
+card_ctrl = 0
+card_high_speed = 1
+card_line = 4
+sdc_d1 = port:PF00<2><1><2>
+sdc_d0 = port:PF01<2><1><2>
+sdc_clk = port:PF02<2><1><2>
+sdc_cmd = port:PF03<2><1><2>
+sdc_d3 = port:PF04<2><1><2>
+sdc_d2 = port:PF05<2><1><2>
+
+[card2_boot_para]
+card_ctrl = 2
+card_high_speed = 1
+card_line = 4
+sdc_2xmode = 1
+sdc_clk = port:PC05<3><1><2>
+sdc_cmd = port:PC06<3><1><2>
+sdc_d0 = port:PC08<3><1><2>
+sdc_d1 = port:PC09<3><1><2>
+sdc_d2 = port:PC10<3><1><2>
+sdc_d3 = port:PC11<3><1><2>
+
+[twi_para]
+twi_port = 0
+twi_scl = port:PH02<2>
+twi_sda = port:PH03<2>
+
+[uart_para]
+uart_debug_port = 0
+uart_debug_tx = port:PF02<3><1>
+uart_debug_rx = port:PF04<3><1>
+
+[force_uart_para]
+force_uart_port = 0
+force_uart_tx = port:PF02<3><1>
+force_uart_rx = port:PF04<3><1>
+
+[jtag_para]
+jtag_enable = 0
+jtag_ms = port:PF00<3>
+jtag_ck = port:PF05<3>
+jtag_do = port:PF03<3>
+jtag_di = port:PF01<3>
+
+[clock]
+pll3 = 297
+pll4 = 300
+pll6 = 600
+pll8 = 408
+pll9 = 480
+pll10 = 297
+pll_cpupat = 0
+pll_gpupat = -1002379674
+pll_videopat = 0
+pll_vepat = 0
+pll_hsicpat = 0
+pll_depat = 0
+pll_mipipat = 0
+pll_mipitun = -1979703288
+pll_mipibias = -133168128
+
+[pm_para]
+standby_mode = 1
+
+[dram_para]
+dram_clk = 480
+dram_type = 3
+dram_zq = 0x7bbb
+dram_odt_en = 1
+dram_para1 = 284295680
+dram_para2 = 0
+dram_mr0 = 7280
+dram_mr1 = 64
+dram_mr2 = 24
+dram_mr3 = 0
+dram_tpr0 = 0x46210c
+dram_tpr1 = 0x1c2210a
+dram_tpr2 = 0x5403a
+dram_tpr3 = 0x0
+dram_tpr4 = 0x0
+dram_tpr5 = 0x0
+dram_tpr6 = 0x0
+dram_tpr7 = 0x0
+dram_tpr8 = 0x0
+dram_tpr9 = 0x0
+dram_tpr10 = 0x0
+dram_tpr11 = 0x0
+dram_tpr12 = 0xa8
+dram_tpr13 = 0x101
+
+[pm_para]
+standby_mode = 1
+
+[wakeup_src_para]
+cpu_en = 0
+cpu_freq = 48
+pll_ratio = 273
+dram_selfresh_en = 1
+dram_freq = 36
+wakeup_src_wl = port:PL07<4><0>
+
+[twi0]
+twi_used = 1
+twi_scl = port:PH02<2>
+twi_sda = port:PH03<2>
+
+[twi1]
+twi_used = 1
+twi_scl = port:PH04<2>
+twi_sda = port:PH05<2>
+
+[twi2]
+twi_used = 1
+twi_scl = port:PE12<3>
+twi_sda = port:PE13<3>
+
+[uart0]
+uart_used = 1
+uart_port = 0
+uart_type = 2
+uart_tx = port:PF02<3><1>
+uart_rx = port:PF04<3><1>
+
+[uart1]
+uart_used = 1
+uart_type = 4
+uart_tx = port:PG06<2><1>
+uart_rx = port:PG07<2><1>
+uart_rts = port:PG08<2><1>
+uart_cts = port:PG09<2><1>
+
+[uart2]
+uart_used = 0
+uart_type = 4
+uart_tx = port:PB00<2><1>
+uart_rx = port:PB01<2><1>
+uart_rts = port:PB02<2><1>
+uart_cts = port:PB03<2><1>
+
+[uart3]
+uart_used = 0
+uart_type = 4
+uart_tx = port:PH06<3><1>
+uart_rx = port:PH07<3><1>
+uart_rts = port:PH08<3><1>
+uart_cts = port:PH09<3><1>
+
+[uart4]
+uart_used = 0
+uart_port = 4
+uart_type = 2
+uart_tx = port:PA04<2><1>
+uart_rx = port:PA05<2><1>
+uart_rts = port:PA06<2><1>
+uart_cts = port:PA07<2><1>
+
+[spi0]
+spi_used = 0
+spi_cs_bitmap = 1
+spi_mosi = port:PC00<3>
+spi_miso = port:PC01<3>
+spi_sclk = port:PC02<3>
+spi_cs0 = port:PC03<3><1>
+
+[spi1]
+spi_used = 0
+spi_cs_bitmap = 1
+spi_cs0 = port:PA00<2><1>
+spi_sclk = port:PA01<2>
+spi_mosi = port:PA02<2>
+spi_miso = port:PA03<2>
+
+[spi_devices]
+spi_dev_num = 1
+
+[spi_board0]
+modalias = "at25df641"
+max_speed_hz = 5000
+bus_num = 0
+chip_select = 0
+mode = 0
+
+[ctp_para]
+ctp_used = 1
+ctp_twi_id = 0
+ctp_twi_addr = 0x5d
+ctp_screen_max_x = 1024
+ctp_screen_max_y = 600
+ctp_revert_x_flag = 0
+ctp_revert_y_flag = 0
+ctp_exchange_x_y_flag = 0
+ctp_cob_gslX680_old = 0
+ctp_cob_gslX680 = 8601
+ctp_int_port = port:PB05<4>
+ctp_wakeup = port:PH01<1><1>
+ctp_power_ldo = "axp22_ldoio1"
+ctp_power_ldo_vol = 3300
+ctp_power_io =
+
+[ctp_list_para]
+ctp_det_used = 1
+ft5x_ts = 0
+gt82x = 0
+gslX680 = 0
+gslX680new = 1
+gt9xx_ts = 0
+gt9xxf_ts = 1
+tu_ts = 0
+gt818_ts = 0
+zet622x = 0
+aw5306_ts = 0
+icn83xx_ts = 0
+
+[tkey_para]
+tkey_used = 0
+tkey_twi_id =
+tkey_twi_addr =
+tkey_int =
+
+[motor_para]
+motor_used = 0
+motor_shake = port:power3<1><1>
+motor_ldo = ""
+motor_ldo_voltage = 3300
+
+[ths_para]
+ths_used = 1
+ths_trip1_count = 3
+ths_trip1_0 = 75
+ths_trip1_1 = 90
+ths_trip1_2 = 110
+ths_trip1_0_min = 0
+ths_trip1_0_max = 1
+ths_trip1_1_min = 1
+ths_trip1_1_max = 3
+ths_trip1_2_min = 0
+ths_trip1_2_max = 0
+

[linux-sunxi] [PATCH 3.4 4/9] sunxi: mali: Handle both framebuffers in the Mali validation code

2015-12-01 Thread Siarhei Siamashka
The Mali kernel driver allows the userland code to map a buffer
in physical memory (via the MALI_IOC_MEM_MAP_EXT ioctl). This is
normally used for mapping the framebuffer in the userland Mali
blob and directly accessing it for rendering graphics. Because
of security reasons, the kernel driver has a validation check,
which only permits one chunk of physical memory to be mapped
this way. And the Mali driver initialization code configures the
address and the size of this chunk.

Now the problem is that the sunxi hardware has not just one, but
up to two framebuffers (for example, one VGA and one HDMI monitor).
Previously both framebuffers were allocated from the disp reservation
area. So the Mali validation code was just allowing access to the
whole disp reservation area. But with CMA support, the framebuffers
may be allocated anywhere in the CMA area. And now we have two
disconnected chunks of physical memory, which should be both
supported by the MALI_IOC_MEM_MAP_EXT ioctl.

This patch modifies the MALI_IOC_MEM_MAP_EXT validation code to
support both of the sunxi disp framebuffers.

PS. If the kernel driver does not allow to map physical memory via
the MALI_IOC_MEM_MAP_EXT ioctl at all, then the Mali userland blob
still can work and is able to render 3D graphics. However this
is done by using memcpy to copy data into the framebuffer for each
frame and the performance becomes ridiculously bad.

Signed-off-by: Siarhei Siamashka 
---
 arch/arm/plat-sunxi/core.c | 12 +++
 drivers/gpu/mali/mali/common/mali_mem_validation.c | 22 +--
 .../mali/mali/platform/mali400-pmu/mali_platform.c | 25 --
 drivers/video/sunxi/disp/dev_fb.c  | 22 +++
 4 files changed, 54 insertions(+), 27 deletions(-)

diff --git a/arch/arm/plat-sunxi/core.c b/arch/arm/plat-sunxi/core.c
index e7da395..89f3187 100644
--- a/arch/arm/plat-sunxi/core.c
+++ b/arch/arm/plat-sunxi/core.c
@@ -135,6 +135,18 @@ static int __init reserve_fb_param(char *s)
 early_param("sunxi_fb_mem_reserve", reserve_fb_param);
 #endif
 
+/*
+ * Physical addresses and sizes of two framebuffers.
+ */
+unsigned long fb0_start;
+unsigned long fb0_size;
+unsigned long fb1_start;
+unsigned long fb1_size;
+EXPORT_SYMBOL(fb0_start);
+EXPORT_SYMBOL(fb0_size);
+EXPORT_SYMBOL(fb1_start);
+EXPORT_SYMBOL(fb1_size);
+
 #if IS_ENABLED(CONFIG_SUNXI_G2D)
 /* The G2D block is used by:
  *
diff --git a/drivers/gpu/mali/mali/common/mali_mem_validation.c 
b/drivers/gpu/mali/mali/common/mali_mem_validation.c
index 2f57459..4a5b88c 100644
--- a/drivers/gpu/mali/mali/common/mali_mem_validation.c
+++ b/drivers/gpu/mali/mali/common/mali_mem_validation.c
@@ -14,6 +14,11 @@
 
 #define MALI_INVALID_MEM_ADDR 0x
 
+extern unsigned long fb0_start;
+extern unsigned long fb0_size;
+extern unsigned long fb1_start;
+extern unsigned long fb1_size;
+
 typedef struct
 {
u32 phys_base;/**< Mali physical base of the memory, page 
aligned */
@@ -47,7 +52,8 @@ _mali_osk_errcode_t mali_mem_validation_add_range(const 
_mali_osk_resource_t *re
return _MALI_OSK_ERR_OK;
 }
 
-_mali_osk_errcode_t mali_mem_validation_check(u32 phys_addr, u32 size)
+static _mali_osk_errcode_t validation_check_helper(u32 phys_addr, u32 size,
+  _mali_mem_validation_t 
mali_mem_validator)
 {
if (phys_addr < (phys_addr + size)) /* Don't allow overflow (or zero 
size) */
{
@@ -65,7 +71,19 @@ _mali_osk_errcode_t mali_mem_validation_check(u32 phys_addr, 
u32 size)
}
}
 
-   MALI_PRINT_ERROR(("MALI PHYSICAL RANGE VALIDATION ERROR: The range 
supplied was: phys_base=0x%08X, size=0x%08X\n", phys_addr, size));
+   return _MALI_OSK_ERR_FAULT;
+}
 
+_mali_osk_errcode_t mali_mem_validation_check(u32 phys_addr, u32 size)
+{
+   _mali_mem_validation_t fb0 = { fb0_start, fb0_size };
+   _mali_mem_validation_t fb1 = { fb1_start, fb1_size };
+
+   if (validation_check_helper(phys_addr, size, fb0) == _MALI_OSK_ERR_OK ||
+   validation_check_helper(phys_addr, size, fb1) == _MALI_OSK_ERR_OK ||
+   validation_check_helper(phys_addr, size, mali_mem_validator) == 
_MALI_OSK_ERR_OK)
+   return _MALI_OSK_ERR_OK;
+
+   MALI_PRINT_ERROR(("MALI PHYSICAL RANGE VALIDATION ERROR: The range 
supplied was: phys_base=0x%08X, size=0x%08X\n", phys_addr, size));
return _MALI_OSK_ERR_FAULT;
 }
diff --git a/drivers/gpu/mali/mali/platform/mali400-pmu/mali_platform.c 
b/drivers/gpu/mali/mali/platform/mali400-pmu/mali_platform.c
index 290c1f9..d43bde0 100644
--- a/drivers/gpu/mali/mali/platform/mali400-pmu/mali_platform.c
+++ b/drivers/gpu/mali/mali/platform/mali400-pmu/mali_platform.c
@@ -24,13 +24,6 @@
 #include 
 #include 
 
-#ifdef CONFIG_FB_SUNXI_RESERVED_MEM
-extern unsigned long fb_start;
-extern unsigned long fb_size;
-static int fb_validation_range_added;
-#endif
-
-
 

[linux-sunxi] [PATCH 3.4 1/9] sunxi: defconfig: Use performance cpufreq governor by default

2015-12-01 Thread Siarhei Siamashka
A rather popular problem reported by new users on irc is very
laggy performance out of the box. The default ondemand governor
is too slow to react on increased demand for processing power
without extra tuning. This extra tuning needs extra efforts
from the users and prior knowledge that such tuning might be
necessary.

The most important defconfigs are sun4i_defconfig, sun5i_defconfig
and sun7i_defconfig because they are mentioned in
http://linux-sunxi.org/Linux_Kernel#Compilation

This patch changes defconfigs to have the following set of governors:
  1. 'performance' (default)
  2. 'userspace' (for benchmarking purposes)
  3. 'interactive' (a replacement for 'ondemand' with more sane
 default behavior)

One more reason not to use the 'ondemand' governor by default is
that the power saving provided by it is not particularly good:
https://www.mail-archive.com/linux-sunxi@googlegroups.com/msg00492.html
https://www.mail-archive.com/linux-sunxi@googlegroups.com/msg00678.html
http://www.cubieforums.com/index.php/topic,1413.msg8745.html#msg8745

It basically wastes a lot of performance for almost nothing.

Signed-off-by: Siarhei Siamashka 
---
 arch/arm/configs/sun4i_defconfig | 4 ++--
 arch/arm/configs/sun5i_defconfig | 4 
 arch/arm/configs/sun7i_defconfig | 4 ++--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/configs/sun4i_defconfig b/arch/arm/configs/sun4i_defconfig
index feef899..dcd586d 100644
--- a/arch/arm/configs/sun4i_defconfig
+++ b/arch/arm/configs/sun4i_defconfig
@@ -53,8 +53,8 @@ CONFIG_COMPACTION=y
 CONFIG_KSM=y
 CONFIG_CMDLINE="mem=448M@0x4000 console=ttyS0,115200"
 CONFIG_CPU_FREQ=y
-CONFIG_CPU_FREQ_STAT=m
-CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
+CONFIG_CPU_FREQ_GOV_USERSPACE=y
+CONFIG_CPU_FREQ_GOV_INTERACTIVE=y
 CONFIG_CPU_FREQ_DVFS=y
 CONFIG_CPU_IDLE=y
 CONFIG_VFP=y
diff --git a/arch/arm/configs/sun5i_defconfig b/arch/arm/configs/sun5i_defconfig
index 18845db..7b0d01d 100644
--- a/arch/arm/configs/sun5i_defconfig
+++ b/arch/arm/configs/sun5i_defconfig
@@ -51,6 +51,10 @@ CONFIG_HIGHMEM=y
 CONFIG_COMPACTION=y
 CONFIG_KSM=y
 CONFIG_CMDLINE="mem=448M@0x4000 console=ttyS0,115200"
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_GOV_USERSPACE=y
+CONFIG_CPU_FREQ_GOV_INTERACTIVE=y
+CONFIG_CPU_FREQ_DVFS=y
 CONFIG_VFP=y
 CONFIG_NEON=y
 CONFIG_BINFMT_MISC=y
diff --git a/arch/arm/configs/sun7i_defconfig b/arch/arm/configs/sun7i_defconfig
index 0bf0811..b463645 100644
--- a/arch/arm/configs/sun7i_defconfig
+++ b/arch/arm/configs/sun7i_defconfig
@@ -54,8 +54,8 @@ CONFIG_COMPACTION=y
 CONFIG_KSM=y
 CONFIG_CMDLINE="mem=448M@0x4000 console=ttyS0,115200"
 CONFIG_CPU_FREQ=y
-CONFIG_CPU_FREQ_STAT=m
-CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
+CONFIG_CPU_FREQ_GOV_USERSPACE=y
+CONFIG_CPU_FREQ_GOV_INTERACTIVE=y
 CONFIG_CPU_FREQ_DVFS=y
 CONFIG_CPU_IDLE=y
 CONFIG_VFP=y
-- 
2.4.10

-- 
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 3.4 0/9] Better out of the box behavior for sunxi-3.4

2015-12-01 Thread Siarhei Siamashka
This patch set moves more of the buffer allocation work to CMA.
So that we don't waste RAM unnecessarily and ensure that the
graphics/multimedia drivers (Mali and Cedar) have exactly as
much memory as needed for enabling all the features and optimal
performance.

Or in other words, the kernel parts releated to 3D graphics and
hardware video decoding just work out of the box and do not
require any error prone kernel cmdline parameters selection
for memory reservation or tweaking FEX files.

Also ROOT_NFS is enabled and the cpufreq settings are unified
for sun4i/sun5i/sun7i. These are the old patches that I have
been using for ages. They serve exactly the same purpose: make
things work out of the box in a reasonable way.


These patches are also available in the following git branch:
   https://github.com/ssvb/linux-sunxi/commits/20151202-more-cma-for-sunxi-3.4


Siarhei Siamashka (9):
  sunxi: defconfig: Use performance cpufreq governor by default
  sunxi: defconfig: Enable ROOT_NFS support
  sunxi: disp: Allocate framebuffers from the CMA area
  sunxi: mali: Handle both framebuffers in the Mali validation code
  sunxi: disp: Tweak framebuffer size for best X11 GLES/DRI2 performance
  sunxi: mali: Fix problems with a static build of the Mali driver
  sunxi: defconfig: Build the Mali driver statically
  sunxi: cedar: Allow only one /dev/cedar_dev user at a time
  sunxi: cedar: Allocate memory buffer only when /dev/cedar_dev is open

 arch/arm/configs/sun4i_defconfig   | 18 +++--
 arch/arm/configs/sun5i_defconfig   | 17 -
 arch/arm/configs/sun7i_defconfig   | 20 +++---
 arch/arm/plat-sunxi/core.c | 12 
 drivers/gpu/mali/Kconfig   |  2 +-
 drivers/gpu/mali/mali/common/mali_mem_validation.c | 22 ++-
 drivers/gpu/mali/mali/linux/mali_osk_atomics.c | 14 ++--
 drivers/gpu/mali/mali/linux/mali_osk_locks.c   | 14 ++--
 drivers/gpu/mali/mali/linux/mali_osk_math.c|  2 +-
 drivers/gpu/mali/mali/linux/mali_osk_memory.c  | 16 ++---
 drivers/gpu/mali/mali/linux/mali_osk_misc.c| 12 ++--
 .../mali/mali/platform/mali400-pmu/mali_platform.c | 25 ---
 drivers/gpu/mali/ump/linux/ump_kernel_linux.c  |  2 +-
 drivers/media/video/sunxi/sunxi_cedar.c| 70 +---
 drivers/video/Kconfig  |  3 +-
 drivers/video/sunxi/disp/dev_fb.c  | 76 ++
 16 files changed, 209 insertions(+), 116 deletions(-)

-- 
2.4.10

-- 
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 3.4 2/9] sunxi: defconfig: Enable ROOT_NFS support

2015-12-01 Thread Siarhei Siamashka
This patch ensures that default configs allow multiple sun4i,
sun5i and sun7i devices boot and work nicely with the same NFS
root. Tested with Cubietruck, Cubieboard2 and A10-Lime.

ROOT_NFS is enabled in sun4i_defconfig. GMAC is enabled in
sun7i_defconfig for Cubietruck support. USB_NET is enabled
for sun5i because it can allow to use USB ethernet dongles.
Also different localversion identifiers are set for in the
config files to avoid a possible clash between the names of
directories with kernel modules.

Signed-off-by: Siarhei Siamashka 
---
 arch/arm/configs/sun4i_defconfig | 6 ++
 arch/arm/configs/sun5i_defconfig | 7 +++
 arch/arm/configs/sun7i_defconfig | 8 +++-
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/arch/arm/configs/sun4i_defconfig b/arch/arm/configs/sun4i_defconfig
index dcd586d..38a6073 100644
--- a/arch/arm/configs/sun4i_defconfig
+++ b/arch/arm/configs/sun4i_defconfig
@@ -1,4 +1,5 @@
 CONFIG_EXPERIMENTAL=y
+CONFIG_LOCALVERSION="-sun4i"
 CONFIG_SYSVIPC=y
 CONFIG_BSD_PROCESS_ACCT=y
 CONFIG_BSD_PROCESS_ACCT_V3=y
@@ -69,6 +70,10 @@ CONFIG_XFRM_USER=y
 CONFIG_NET_KEY=y
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_IP_PNP_BOOTP=y
+CONFIG_IP_PNP_RARP=y
 CONFIG_NET_IPIP=y
 CONFIG_IP_MROUTE=y
 CONFIG_IP_PIMSM_V1=y
@@ -286,6 +291,7 @@ CONFIG_CONFIGFS_FS=y
 CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
 CONFIG_NFS_V4=y
+CONFIG_ROOT_NFS=y
 CONFIG_CIFS=y
 CONFIG_NLS_DEFAULT="utf8"
 CONFIG_NLS_CODEPAGE_437=y
diff --git a/arch/arm/configs/sun5i_defconfig b/arch/arm/configs/sun5i_defconfig
index 7b0d01d..c01d2f4 100644
--- a/arch/arm/configs/sun5i_defconfig
+++ b/arch/arm/configs/sun5i_defconfig
@@ -1,4 +1,5 @@
 CONFIG_EXPERIMENTAL=y
+CONFIG_LOCALVERSION="-sun5i"
 CONFIG_SYSVIPC=y
 CONFIG_BSD_PROCESS_ACCT=y
 CONFIG_BSD_PROCESS_ACCT_V3=y
@@ -66,6 +67,10 @@ CONFIG_XFRM_USER=y
 CONFIG_NET_KEY=y
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_IP_PNP_BOOTP=y
+CONFIG_IP_PNP_RARP=y
 CONFIG_NET_IPIP=y
 CONFIG_IP_MROUTE=y
 CONFIG_IP_PIMSM_V1=y
@@ -104,6 +109,7 @@ CONFIG_SCSI_MULTI_LUN=y
 CONFIG_NETDEVICES=y
 CONFIG_SUNXI_EMAC=y
 CONFIG_PHYLIB=y
+CONFIG_USB_USBNET=y
 CONFIG_INPUT_FF_MEMLESS=y
 CONFIG_INPUT_POLLDEV=y
 # CONFIG_INPUT_MOUSEDEV_PSAUX is not set
@@ -217,6 +223,7 @@ CONFIG_CONFIGFS_FS=y
 CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
 CONFIG_NFS_V4=y
+CONFIG_ROOT_NFS=y
 CONFIG_CIFS=y
 CONFIG_NLS_DEFAULT="utf8"
 CONFIG_NLS_CODEPAGE_437=y
diff --git a/arch/arm/configs/sun7i_defconfig b/arch/arm/configs/sun7i_defconfig
index b463645..a7c8d94 100644
--- a/arch/arm/configs/sun7i_defconfig
+++ b/arch/arm/configs/sun7i_defconfig
@@ -1,4 +1,5 @@
 CONFIG_EXPERIMENTAL=y
+CONFIG_LOCALVERSION="-sun7i"
 CONFIG_SYSVIPC=y
 CONFIG_BSD_PROCESS_ACCT=y
 CONFIG_BSD_PROCESS_ACCT_V3=y
@@ -70,6 +71,10 @@ CONFIG_XFRM_USER=y
 CONFIG_NET_KEY=y
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_IP_PNP_BOOTP=y
+CONFIG_IP_PNP_RARP=y
 CONFIG_NET_IPIP=y
 CONFIG_IP_MROUTE=y
 CONFIG_IP_PIMSM_V1=y
@@ -119,7 +124,7 @@ CONFIG_SATA_AHCI_PLATFORM=y
 CONFIG_SW_SATA_AHCI_PLATFORM=y
 CONFIG_NETDEVICES=y
 CONFIG_SUNXI_EMAC=y
-CONFIG_PHYLIB=y
+CONFIG_SUNXI_GMAC=y
 CONFIG_RTL8192CU_SW=m
 CONFIG_INPUT_FF_MEMLESS=y
 CONFIG_INPUT_POLLDEV=y
@@ -286,6 +291,7 @@ CONFIG_CONFIGFS_FS=y
 CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
 CONFIG_NFS_V4=y
+CONFIG_ROOT_NFS=y
 CONFIG_CIFS=y
 CONFIG_NLS_DEFAULT="utf8"
 CONFIG_NLS_CODEPAGE_437=y
-- 
2.4.10

-- 
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 3.4 5/9] sunxi: disp: Tweak framebuffer size for best X11 GLES/DRI2 performance

2015-12-01 Thread Siarhei Siamashka
Zero-copy buffer swaps can be used in xf86-video-fbturbo for GLES/DRI2
applications only when a certain minimal framebuffer size is available.
In order to make everything easier for the end users, just override
the fb0_framebuffer_num/fb1_framebuffer_num settings from FEX and
increase them when necessary.

Do it only when CMA is enabled. Otherwise this may be dangerous when
the user controls the size of disp framebuffer reservation via kernel
cmdline.

Signed-off-by: Siarhei Siamashka 
---
 drivers/video/sunxi/disp/dev_fb.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/drivers/video/sunxi/disp/dev_fb.c 
b/drivers/video/sunxi/disp/dev_fb.c
index 6946222..aae088e 100644
--- a/drivers/video/sunxi/disp/dev_fb.c
+++ b/drivers/video/sunxi/disp/dev_fb.c
@@ -339,6 +339,27 @@ parser_disp_init_para(__disp_init_t *init_para)
}
init_para->scaler_mode[1] = value;
 
+#if defined(CONFIG_MALI) && defined(CONFIG_FB_SUNXI_UMP) && defined(CONFIG_CMA)
+   /*
+* It is best to ensure that the offscreen framebuffer area has
+* enough space for two more frames with 32-bit color depth. This
+* is needed for zero-copy buffer swaps in xf86-video-fbturbo DDX.
+*/
+   for (i = 0; i < 2; i++) {
+   if (init_para->format[i] == DISP_FORMAT_ARGB ||
+   init_para->format[i] == DISP_FORMAT_ARGB888) {
+   init_para->buffer_num[i] =
+   max(init_para->buffer_num[i], 3U);
+   } else if (init_para->format[i] == DISP_FORMAT_RGB888) {
+   init_para->buffer_num[i] =
+   max(init_para->buffer_num[i], 4U);
+   } else {
+   init_para->buffer_num[i] =
+   max(init_para->buffer_num[i], 5U);
+   }
+   }
+#endif
+
__inf("display init para begin\n");
__inf("b_init:%d\n", init_para->b_init);
__inf("disp_mode:%d\n\n", init_para->disp_mode);
-- 
2.4.10

-- 
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 3.4 3/9] sunxi: disp: Allocate framebuffers from the CMA area

2015-12-01 Thread Siarhei Siamashka
This allows to get rid of the fragile boot time memory reservation.
Now the amount of required framebuffer memory is calculated at
runtime, depending on the screen resolution (which may come from
FEX or from EDID).

Signed-off-by: Siarhei Siamashka 
---
 drivers/video/Kconfig |  3 +--
 drivers/video/sunxi/disp/dev_fb.c | 33 +
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index df63338..ba43686 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -275,7 +275,6 @@ config FB_GRVGA
 config FB_SUNXI
 tristate "DISP Driver Support(sunxi)"
 depends on FB && (ARCH_SUN4I || ARCH_SUN5I || ARCH_SUN7I)
-   select FB_SUNXI_RESERVED_MEM if MALI
select FB_MODE_HELPERS
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
@@ -286,7 +285,7 @@ config FB_SUNXI
 config FB_SUNXI_RESERVED_MEM
bool "Reserve memory block for sunxi/fb"
depends on FB_SUNXI
-   default y
+   default !CMA
 
 config FB_SUNXI_UMP
bool "Enable FB/UMP Integration"
diff --git a/drivers/video/sunxi/disp/dev_fb.c 
b/drivers/video/sunxi/disp/dev_fb.c
index a453b6f..7500764 100644
--- a/drivers/video/sunxi/disp/dev_fb.c
+++ b/drivers/video/sunxi/disp/dev_fb.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #ifdef CONFIG_FB_SUNXI_UMP
 #include 
@@ -463,8 +464,35 @@ fb_draw_gray_pictures(__u32 base, __u32 width, __u32 
height,
 }
 #endif /* UNUSED */
 
+#ifdef CONFIG_CMA
+static int Fb_map_cma_video_memory(__u32 fb_id, struct fb_info *info)
+{
+   resource_size_t pa;
+   g_fbi.malloc_screen_base[fb_id] = dma_alloc_coherent(NULL, 
info->fix.smem_len, ,
+   GFP_KERNEL | GFP_DMA);
+   if (g_fbi.malloc_screen_base[fb_id] == NULL)
+   return -ENOMEM;
+   info->fix.smem_start = pa;
+   info->screen_base = g_fbi.malloc_screen_base[fb_id];
+   memset(info->screen_base, 0, info->fix.smem_len);
+   return 0;
+}
+
+static void Fb_unmap_cma_video_memory(__u32 fb_id, struct fb_info *info)
+{
+   if (g_fbi.malloc_screen_base[fb_id] != NULL) {
+   dma_free_coherent(NULL, info->fix.smem_len,
+ g_fbi.malloc_screen_base[fb_id], 
info->fix.smem_start);
+   g_fbi.malloc_screen_base[fb_id] = NULL;
+   }
+}
+#endif
+
 static int __init Fb_map_video_memory(__u32 fb_id, struct fb_info *info)
 {
+#ifdef CONFIG_CMA
+   return Fb_map_cma_video_memory(fb_id, info);
+#else
unsigned map_size = PAGE_ALIGN(info->fix.smem_len);
struct page *page;
 
@@ -507,10 +535,14 @@ use_reserved_mem:
 
return 0;
 #endif
+#endif
 }
 
 static inline void Fb_unmap_video_memory(__u32 fb_id, struct fb_info *info)
 {
+#ifdef CONFIG_CMA
+   Fb_unmap_cma_video_memory(fb_id, info);
+#else
unsigned map_size = PAGE_ALIGN(info->fix.smem_len);
 #ifdef CONFIG_FB_SUNXI_RESERVED_MEM
if (fb_size) {
@@ -527,6 +559,7 @@ static inline void Fb_unmap_video_memory(__u32 fb_id, 
struct fb_info *info)
 #endif
free_pages((unsigned long)info->screen_base,
   get_order(map_size));
+#endif
 }
 
 /*
-- 
2.4.10

-- 
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 3.4 9/9] sunxi: cedar: Allocate memory buffer only when /dev/cedar_dev is open

2015-12-01 Thread Siarhei Siamashka
Previously the 80MB memory buffer was allocated from CMA when the
cedar module is loaded and kept in use until the module is removed.
Now the buffer is only allocated when /dev/cedar_dev is opened and
deallocated when it is closed.

Additionally, the kernel cmdline parameter 'sunxi_ve_mem_reserve'
can be used to change the cedar memory buffer size to something
larger than 80MB. Since libvdpau-sunxi implemented subtitles
support, it needs more memory and 80MB may be not enough.

Signed-off-by: Siarhei Siamashka 
---
 drivers/media/video/sunxi/sunxi_cedar.c | 61 -
 1 file changed, 29 insertions(+), 32 deletions(-)

diff --git a/drivers/media/video/sunxi/sunxi_cedar.c 
b/drivers/media/video/sunxi/sunxi_cedar.c
index 64f4151..b0374ad 100644
--- a/drivers/media/video/sunxi/sunxi_cedar.c
+++ b/drivers/media/video/sunxi/sunxi_cedar.c
@@ -790,6 +790,9 @@ long cedardev_ioctl(struct file *filp, unsigned int cmd, 
unsigned long arg)
 
 static int cedardev_open(struct inode *inode, struct file *filp)
 {
+#ifdef CONFIG_CMA
+   resource_size_t pa;
+#endif
struct cedar_dev *devp;
devp = container_of(inode->i_cdev, struct cedar_dev, cdev);
filp->private_data = devp;
@@ -797,6 +800,29 @@ static int cedardev_open(struct inode *inode, struct file 
*filp)
return -ERESTARTSYS;
}
/* init other resource here */
+#ifdef CONFIG_CMA
+   ve_size = max(ve_size, 80UL * SZ_1M);
+   ve_start_virt = dma_alloc_coherent(NULL, ve_size, ,
+   GFP_KERNEL | GFP_DMA);
+   if (!ve_start_virt) {
+   printk(KERN_NOTICE "cedar: failed to allocate memory buffer\n");
+   up(>sem);
+   return -ENOMEM;
+   }
+   ve_start = pa;
+   if (ve_start + ve_size > SW_PA_SDRAM_START + SZ_256M) {
+   printk(KERN_NOTICE "cedar: buffer is above 256MB limit\n");
+   dma_free_coherent(NULL, ve_size, ve_start_virt, ve_start);
+   up(>sem);
+   return -ENOMEM;
+   }
+#else
+   if (ve_size == 0) {
+   printk("[cedar dev]: not installed! ve_mem_reserve=0\n");
+   up(>sem);
+   return -ENOMEM;
+   }
+#endif
devp->irq_flag = 0;
nonseekable_open(inode, filp);
return 0;
@@ -810,6 +836,9 @@ static int cedardev_release(struct inode *inode, struct 
file *filp)
 
/* release other resource here */
devp->irq_flag = 1;
+#ifdef CONFIG_CMA
+   dma_free_coherent(NULL, ve_size, ve_start_virt, ve_start);
+#endif
up(>sem);
return 0;
 }
@@ -925,30 +954,6 @@ static int __init cedardev_init(void)
unsigned int val;
dev_t dev = 0;
 
-#ifdef CONFIG_CMA
-   /* If having CMA enabled, just rely on CMA for memory allocation */
-   resource_size_t pa;
-   ve_size = 80 * SZ_1M;
-   ve_start_virt = dma_alloc_coherent(NULL, ve_size, ,
-   GFP_KERNEL | GFP_DMA);
-   if (!ve_start_virt) {
-   printk(KERN_NOTICE "cedar: failed to allocate memory buffer\n");
-   return -ENODEV;
-   }
-   ve_start = pa;
-   if (ve_start + ve_size > SW_PA_SDRAM_START + SZ_256M) {
-   printk(KERN_NOTICE "cedar: buffer is above 256MB limit\n");
-   dma_free_coherent(NULL, ve_size, ve_start_virt, ve_start);
-   ve_start_virt = 0;
-   ve_size = 0;
-   return -ENODEV;
-   }
-#else
-   if (ve_size == 0) {
-   printk("[cedar dev]: not installed! ve_mem_reserve=0\n");
-   return -ENODEV;
-   }
-#endif
 
printk("[cedar dev]: install start!!!\n");
if((platform_device_register(_device_cedar))<0)
@@ -1094,14 +1099,6 @@ static void __exit cedardev_exit(void)
if (cedar_devp) {
kfree(cedar_devp);
}
-
-#ifdef CONFIG_CMA
-   if (ve_start_virt) {
-   dma_free_coherent(NULL, ve_size, ve_start_virt, ve_start);
-   ve_start_virt = 0;
-   ve_size = 0;
-   }
-#endif
 }
 module_exit(cedardev_exit);
 
-- 
2.4.10

-- 
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 3.4 8/9] sunxi: cedar: Allow only one /dev/cedar_dev user at a time

2015-12-01 Thread Siarhei Siamashka
The existing cedar driver code already has a semaphore, but is
only doing some strange and pointless manipulations with it.
Now use this semaphore to actually protect /dev/cedar_dev from
being simultaneously opened by multiple users.

When the cedar driver is already occupied, any new attempts to
open /dev/cedar_dev just block until the current user closes it.

Signed-off-by: Siarhei Siamashka 
---
 drivers/media/video/sunxi/sunxi_cedar.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/media/video/sunxi/sunxi_cedar.c 
b/drivers/media/video/sunxi/sunxi_cedar.c
index f30d086..64f4151 100644
--- a/drivers/media/video/sunxi/sunxi_cedar.c
+++ b/drivers/media/video/sunxi/sunxi_cedar.c
@@ -797,8 +797,7 @@ static int cedardev_open(struct inode *inode, struct file 
*filp)
return -ERESTARTSYS;
}
/* init other resource here */
-devp->irq_flag = 0;
-   up(>sem);
+   devp->irq_flag = 0;
nonseekable_open(inode, filp);
return 0;
 }
@@ -808,11 +807,9 @@ static int cedardev_release(struct inode *inode, struct 
file *filp)
struct cedar_dev *devp;
 
devp = filp->private_data;
-   if (down_interruptible(>sem)) {
-   return -ERESTARTSYS;
-   }
+
/* release other resource here */
-devp->irq_flag = 1;
+   devp->irq_flag = 1;
up(>sem);
return 0;
 }
-- 
2.4.10

-- 
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 3.4 6/9] sunxi: mali: Fix problems with a static build of the Mali driver

2015-12-01 Thread Siarhei Siamashka
There are a bunch of common functions used in the 'mali' and
'ump' modules. In fact, the the source files with these functions
are even symlinked between 'ump' and 'mali' directories since
commit 08084c4f2351a190b53f3f39f5b35b8821cc11e4 ("sunxi: prevent
mali drivers from building every time").

But if we try to build both 'mali' and 'ump' modules statically,
then the linker complains about duplicated functions. In order
to resolve this problem, just mark the problematic functions
as 'weak'.

Signed-off-by: Siarhei Siamashka 
---
 drivers/gpu/mali/Kconfig   |  2 +-
 drivers/gpu/mali/mali/linux/mali_osk_atomics.c | 14 +++---
 drivers/gpu/mali/mali/linux/mali_osk_locks.c   | 14 +++---
 drivers/gpu/mali/mali/linux/mali_osk_math.c|  2 +-
 drivers/gpu/mali/mali/linux/mali_osk_memory.c  | 16 
 drivers/gpu/mali/mali/linux/mali_osk_misc.c| 12 ++--
 drivers/gpu/mali/ump/linux/ump_kernel_linux.c  |  2 +-
 7 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/mali/Kconfig b/drivers/gpu/mali/Kconfig
index 2c7f9b6..32d1e91 100644
--- a/drivers/gpu/mali/Kconfig
+++ b/drivers/gpu/mali/Kconfig
@@ -1,6 +1,6 @@
 config MALI
tristate "ARM Mali GPU modules"
-   depends on ARM && m
+   depends on ARM
 select UMP
 select MALI400
default n
diff --git a/drivers/gpu/mali/mali/linux/mali_osk_atomics.c 
b/drivers/gpu/mali/mali/linux/mali_osk_atomics.c
index 846fd3b..9dad2e7 100644
--- a/drivers/gpu/mali/mali/linux/mali_osk_atomics.c
+++ b/drivers/gpu/mali/mali/linux/mali_osk_atomics.c
@@ -17,39 +17,39 @@
 #include 
 #include "mali_kernel_common.h"
 
-void _mali_osk_atomic_dec( _mali_osk_atomic_t *atom )
+__weak void _mali_osk_atomic_dec( _mali_osk_atomic_t *atom )
 {
 atomic_dec((atomic_t *)>u.val);
 }
 
-u32 _mali_osk_atomic_dec_return( _mali_osk_atomic_t *atom )
+__weak u32 _mali_osk_atomic_dec_return( _mali_osk_atomic_t *atom )
 {
 return atomic_dec_return((atomic_t *)>u.val);
 }
 
-void _mali_osk_atomic_inc( _mali_osk_atomic_t *atom )
+__weak void _mali_osk_atomic_inc( _mali_osk_atomic_t *atom )
 {
 atomic_inc((atomic_t *)>u.val);
 }
 
-u32 _mali_osk_atomic_inc_return( _mali_osk_atomic_t *atom )
+__weak u32 _mali_osk_atomic_inc_return( _mali_osk_atomic_t *atom )
 {
 return atomic_inc_return((atomic_t *)>u.val);
 }
 
-_mali_osk_errcode_t _mali_osk_atomic_init( _mali_osk_atomic_t *atom, u32 val )
+__weak _mali_osk_errcode_t _mali_osk_atomic_init( _mali_osk_atomic_t *atom, 
u32 val )
 {
 MALI_CHECK_NON_NULL(atom, _MALI_OSK_ERR_INVALID_ARGS);
 atomic_set((atomic_t *)>u.val, val);
 return _MALI_OSK_ERR_OK;
 }
 
-u32 _mali_osk_atomic_read( _mali_osk_atomic_t *atom )
+__weak u32 _mali_osk_atomic_read( _mali_osk_atomic_t *atom )
 {
 return atomic_read((atomic_t *)>u.val);
 }
 
-void _mali_osk_atomic_term( _mali_osk_atomic_t *atom )
+__weak void _mali_osk_atomic_term( _mali_osk_atomic_t *atom )
 {
 MALI_IGNORE(atom);
 }
diff --git a/drivers/gpu/mali/mali/linux/mali_osk_locks.c 
b/drivers/gpu/mali/mali/linux/mali_osk_locks.c
index c3c8d09..34e05ee 100644
--- a/drivers/gpu/mali/mali/linux/mali_osk_locks.c
+++ b/drivers/gpu/mali/mali/linux/mali_osk_locks.c
@@ -73,7 +73,7 @@ struct _mali_osk_lock_t_struct
); /* MALI_DEBUG_CODE */
 };
 
-_mali_osk_lock_t *_mali_osk_lock_init( _mali_osk_lock_flags_t flags, u32 
initial, u32 order )
+__weak _mali_osk_lock_t *_mali_osk_lock_init( _mali_osk_lock_flags_t flags, 
u32 initial, u32 order )
 {
 _mali_osk_lock_t *lock = NULL;
 
@@ -148,23 +148,23 @@ _mali_osk_lock_t *_mali_osk_lock_init( 
_mali_osk_lock_flags_t flags, u32 initial
 }
 
 #ifdef DEBUG
-u32 _mali_osk_lock_get_owner( _mali_osk_lock_t *lock )
+__weak u32 _mali_osk_lock_get_owner( _mali_osk_lock_t *lock )
 {
return lock->owner;
 }
 
-u32 _mali_osk_lock_get_number_owners( _mali_osk_lock_t *lock )
+__weak u32 _mali_osk_lock_get_number_owners( _mali_osk_lock_t *lock )
 {
return lock->nOwners;
 }
 
-u32 _mali_osk_lock_get_mode( _mali_osk_lock_t *lock )
+__weak u32 _mali_osk_lock_get_mode( _mali_osk_lock_t *lock )
 {
return lock->mode;
 }
 #endif /* DEBUG */
 
-_mali_osk_errcode_t _mali_osk_lock_wait( _mali_osk_lock_t *lock, 
_mali_osk_lock_mode_t mode)
+__weak _mali_osk_errcode_t _mali_osk_lock_wait( _mali_osk_lock_t *lock, 
_mali_osk_lock_mode_t mode)
 {
 _mali_osk_errcode_t err = _MALI_OSK_ERR_OK;
 
@@ -247,7 +247,7 @@ _mali_osk_errcode_t _mali_osk_lock_wait( _mali_osk_lock_t 
*lock, _mali_osk_lock_
 return err;
 }
 
-void _mali_osk_lock_signal( _mali_osk_lock_t *lock, _mali_osk_lock_mode_t mode 
)
+__weak void _mali_osk_lock_signal( _mali_osk_lock_t *lock, 
_mali_osk_lock_mode_t mode )
 {
/* Parameter validation */
MALI_DEBUG_ASSERT_POINTER( lock );
@@ -326,7 +326,7 @@ void _mali_osk_lock_signal( _mali_osk_lock_t *lock, 
_mali_osk_lock_mode_t mode )
}
 }
 
-void _mali_osk_lock_term( 

[linux-sunxi] [PATCH 3.4 7/9] sunxi: defconfig: Build the Mali driver statically

2015-12-01 Thread Siarhei Siamashka
Sometimes people are just forgetting to copy their kernel modules
to the device. Building the Mali kernel driver statically ensures
that people can't make this mistake anymore and removes one of the
potential obstacles on the way to getting 3D accelatation up and
running.

It is also convenient to be able to include the lima-memtester
test program into an initrd image without bothering about adding
kernel modules to the initrd image too.

Signed-off-by: Siarhei Siamashka 
---
 arch/arm/configs/sun4i_defconfig | 8 +++-
 arch/arm/configs/sun5i_defconfig | 6 +++---
 arch/arm/configs/sun7i_defconfig | 8 +++-
 3 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/arch/arm/configs/sun4i_defconfig b/arch/arm/configs/sun4i_defconfig
index 38a6073..0679d44 100644
--- a/arch/arm/configs/sun4i_defconfig
+++ b/arch/arm/configs/sun4i_defconfig
@@ -156,7 +156,6 @@ CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_8250_NR_UARTS=8
 CONFIG_SERIAL_8250_RUNTIME_UARTS=8
 # CONFIG_HW_RANDOM is not set
-CONFIG_I2C=y
 CONFIG_I2C_CHARDEV=y
 CONFIG_GPIOLIB=y
 CONFIG_GPIO_SYSFS=y
@@ -206,10 +205,9 @@ CONFIG_CSI_OV5640=m
 # CONFIG_RADIO_ADAPTERS is not set
 CONFIG_AUDIO_ENGINE=y
 CONFIG_PA_CONTROL=y
-CONFIG_DRM=m
-CONFIG_DRM_MALI=m
-CONFIG_MALI=m
-CONFIG_FB=y
+CONFIG_DRM=y
+CONFIG_DRM_MALI=y
+CONFIG_MALI=y
 CONFIG_FB_SUNXI=y
 CONFIG_FB_SUNXI_LCD=y
 CONFIG_FB_SUNXI_HDMI=y
diff --git a/arch/arm/configs/sun5i_defconfig b/arch/arm/configs/sun5i_defconfig
index c01d2f4..1eee7d0 100644
--- a/arch/arm/configs/sun5i_defconfig
+++ b/arch/arm/configs/sun5i_defconfig
@@ -135,7 +135,6 @@ CONFIG_SERIAL_NONSTANDARD=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 # CONFIG_HW_RANDOM is not set
-CONFIG_I2C=y
 CONFIG_I2C_CHARDEV=y
 CONFIG_SPI=y
 CONFIG_GPIOLIB=y
@@ -150,9 +149,10 @@ CONFIG_AXP152=y
 CONFIG_REGULATOR=y
 CONFIG_MEDIA_SUPPORT=y
 CONFIG_PA_CONTROL=y
-CONFIG_MALI=m
+CONFIG_DRM=y
+CONFIG_DRM_MALI=y
+CONFIG_MALI=y
 # CONFIG_UMP_DEBUG is not set
-CONFIG_FB=y
 CONFIG_FB_SUNXI=y
 CONFIG_FB_SUNXI_LCD=y
 CONFIG_FB_SUNXI_HDMI=y
diff --git a/arch/arm/configs/sun7i_defconfig b/arch/arm/configs/sun7i_defconfig
index a7c8d94..f743b66f 100644
--- a/arch/arm/configs/sun7i_defconfig
+++ b/arch/arm/configs/sun7i_defconfig
@@ -156,7 +156,6 @@ CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_8250_NR_UARTS=8
 CONFIG_SERIAL_8250_RUNTIME_UARTS=8
 # CONFIG_HW_RANDOM is not set
-CONFIG_I2C=y
 CONFIG_I2C_CHARDEV=y
 CONFIG_GPIOLIB=y
 CONFIG_GPIO_SYSFS=y
@@ -206,10 +205,9 @@ CONFIG_CSI_OV5640=m
 # CONFIG_RADIO_ADAPTERS is not set
 CONFIG_AUDIO_ENGINE=y
 CONFIG_PA_CONTROL=y
-CONFIG_DRM=m
-CONFIG_DRM_MALI=m
-CONFIG_MALI=m
-CONFIG_FB=y
+CONFIG_DRM=y
+CONFIG_DRM_MALI=y
+CONFIG_MALI=y
 CONFIG_FB_SUNXI=y
 CONFIG_FB_SUNXI_LCD=y
 CONFIG_FB_SUNXI_HDMI=y
-- 
2.4.10

-- 
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] Requesting Help on a USD15, Allwinner Quadcore 1.2Ghz 64-bit A53 Hardware

2015-12-01 Thread KH Goh
Hi Priit Laes,
Thank for the info. Currently we are in the process of sorting out our 
documentation. Will update in the  http://linux-sunxi.org/New_Device_howto 
once it is ready. 

Anyway, the regulator used in Pine64 is AXP803 and the Wifi/BT is Realtek 
RTL-8273.

Regards,
KH Goh

On Sunday, November 29, 2015 at 3:12:21 PM UTC+8, Priit Laes wrote:
>
> On Sat, 2015-11-28 at 17:43 -0800, KH Goh wrote: 
>
> [...] 
> > In terms of the hardware, at the moment we are having 2 unit of 
> > Pine64 Engineering board (Please refer here for the 
> > spec http://pine64.com/product ), and would like to donate it to the 
> > community for further evaluation and testing. Since we are a newcomer 
> > in this community, we would like you to advise us on who and where 
> > should we send the 2 board to. 
>
> You can already start with the new device howto - http://linux-sunxi.or 
> g/New_Device_howto 
>
> This would be a nice second step to working together with community. 
>
> Do you also have access and/or permission to "publish" the datasheets 
> (A53, AXP??? and Wifi/BT) and BSP? 
>
> Also, on http://pine64.com/product#intro could you label all the ports 
> and expansion headers (I can see from the board that there are 
> headers/sockets for TP, CSI, DSI, RTC, VBAT, POWER, UART). And what 
> regulator chip (AXP???) and wifi/bluetooth chip does it use? 
>
> And a typo "muti-channel" on that page. 
>
>
>
> > Thanks for your advise and appreciate your kind assistance. 
> > Regards, 
> > KH Goh 
> > 
> > 
> > On Saturday, November 28, 2015 at 9:01:31 PM UTC+8, Luc Verhaegen 
> > wrote: 
> > > On Sat, Nov 28, 2015 at 12:38:16AM -0800, khg...@gmail.com wrote: 
> > > > Hi, 
> > > > We are a group of people currently trying to come out with a very 
> > > low 
> > > > cost single board computer, by making use of Allwinner Quadcore 
> > > 1.2Ghz 
> > > > 64-bit A53 CPU. The target costing for the single board computer 
> > > is 
> > > > USD15. The hardware will have a 4K HDMI video output and on board 
> > > > ethernet connection. Further more, each board will has its own 
> > > unique 
> > > > MAC address. The objective for this project is to allow 
> > > individual, 
> > > > having the opportunity to learn IT knowledge with a friction of 
> > > the 
> > > > cost. Please refer to pine64.com for more detail on the hardware 
> > > > specification. 
> > > > 
> > > > Currently, the hardware development on the board is almost ready. 
> > > And 
> > > > with us, is the full Linux BSP with the true 64bit compiler. Due 
> > > to 
> > > > budget constrain and our limited know-how in Linux, We would like 
> > > to 
> > > > request the help from this community to bring up the Linux into a 
> > > full 
> > > > function Ubuntu desktop, thus allow the user to truly owning a 
> > > fully 
> > > > function open source computer with just a friction of the cost. 
> > > > 
> > > > As for the hardware itself, currently we are in the mist of 
> > > building 
> > > > some sample board to allow any interested developer to work on 
> > > it. 
> > > > 
> > > > Thanks and Regard, 
> > > > KH Goh 
> > > 
> > > Hi, 
> > > 
> > > Thanks for contacting the canonical source of most things 
> > > sunxi/allwinner before actually launching your kickstarter 
> > > campaign. 
> > > 
> > > This is the first time since the original cubieboard that such a 
> > > thing 
> > > has happened. Many companies with similar products only afterwards 
> > > find 
> > > out to what extent they do depend on the linux-sunxi community, and 
> > > then 
> > > change their story in either direction. Often the work done by the 
> > > people of the linux-sunxi community gets used directly, 
> > > cloned/forked, 
> > > and nothing is ever given back. 
> > > 
> > > As you can see, we (and while i do not speak for all of us, i know 
> > > that 
> > > i am not alone here) are sceptical about whoever approaches us like 
> > > this, especially when one of the first statements is "budget 
> > > constraints". You cannot expect the linux-sunxi community to do 
> > > your 
> > > work for you for free. 
> > > 
> > > You should however donate boards to many known and active linux- 
> > > sunxi 
> > > developers, but for that you must not expect anything in return. 
> > > Whatever then happens, happens, or it doesn't. The results are 
> > > usually 
> > > quite positive, especially given the limited cost of said boards, 
> > > but it 
> > > will hardly ever consist of full support for your product 
> > > (especially 
> > > when based on a new SoC variant). 
> > > 
> > > If you wish to have more complete support, you can always try to 
> > > hire 
> > > known linux-sunxi developers directly, or work with those members 
> > > of our 
> > > community who do contracting. The choice is up to you. 
> > > 
> > > Thanks for reaching out to us before launching your marketing 
> > > campaign, 
> > > i hope that your collaboration with linux-sunxi ends up being just 
> > > as 
> > > fruitful as your 

Re: [linux-sunxi] [PATCH 3.4 0/9] Better out of the box behavior for sunxi-3.4

2015-12-01 Thread Hans de Goede

Hi Siarhei,

On 02-12-15 03:48, Siarhei Siamashka wrote:

This patch set moves more of the buffer allocation work to CMA.
So that we don't waste RAM unnecessarily and ensure that the
graphics/multimedia drivers (Mali and Cedar) have exactly as
much memory as needed for enabling all the features and optimal
performance.

Or in other words, the kernel parts releated to 3D graphics and
hardware video decoding just work out of the box and do not
require any error prone kernel cmdline parameters selection
for memory reservation or tweaking FEX files.

Also ROOT_NFS is enabled and the cpufreq settings are unified
for sun4i/sun5i/sun7i. These are the old patches that I have
been using for ages. They serve exactly the same purpose: make
things work out of the box in a reasonable way.


These patches are also available in the following git branch:
https://github.com/ssvb/linux-sunxi/commits/20151202-more-cma-for-sunxi-3.4


Siarhei Siamashka (9):
   sunxi: defconfig: Use performance cpufreq governor by default
   sunxi: defconfig: Enable ROOT_NFS support
   sunxi: disp: Allocate framebuffers from the CMA area
   sunxi: mali: Handle both framebuffers in the Mali validation code
   sunxi: disp: Tweak framebuffer size for best X11 GLES/DRI2 performance
   sunxi: mali: Fix problems with a static build of the Mali driver
   sunxi: defconfig: Build the Mali driver statically
   sunxi: cedar: Allow only one /dev/cedar_dev user at a time
   sunxi: cedar: Allocate memory buffer only when /dev/cedar_dev is open


I've not tested these patches, but I've given them a quick look and they
look good to me.

Regards,

Hans




  arch/arm/configs/sun4i_defconfig   | 18 +++--
  arch/arm/configs/sun5i_defconfig   | 17 -
  arch/arm/configs/sun7i_defconfig   | 20 +++---
  arch/arm/plat-sunxi/core.c | 12 
  drivers/gpu/mali/Kconfig   |  2 +-
  drivers/gpu/mali/mali/common/mali_mem_validation.c | 22 ++-
  drivers/gpu/mali/mali/linux/mali_osk_atomics.c | 14 ++--
  drivers/gpu/mali/mali/linux/mali_osk_locks.c   | 14 ++--
  drivers/gpu/mali/mali/linux/mali_osk_math.c|  2 +-
  drivers/gpu/mali/mali/linux/mali_osk_memory.c  | 16 ++---
  drivers/gpu/mali/mali/linux/mali_osk_misc.c| 12 ++--
  .../mali/mali/platform/mali400-pmu/mali_platform.c | 25 ---
  drivers/gpu/mali/ump/linux/ump_kernel_linux.c  |  2 +-
  drivers/media/video/sunxi/sunxi_cedar.c| 70 +---
  drivers/video/Kconfig  |  3 +-
  drivers/video/sunxi/disp/dev_fb.c  | 76 ++
  16 files changed, 209 insertions(+), 116 deletions(-)



--
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] Re: [PATCH v2 1/5] ARM: dts: sun8i: Add SID node

2015-12-01 Thread Maxime Ripard
Hi,

On Wed, Nov 25, 2015 at 09:22:56AM +0800, Shuge wrote:
> On Monday, November 23, 2015 at 17:32 UTC+8, Maxime Ripard wrote:
> > On Mon, Nov 23, 2015 at 10:51:15PM -0800, Sugar Wu wrote:
> >> On Monday, November 23, 2015 at 8:43:59 PM UTC+8, Maxime Ripard wrote:
> >>>
> >>> Hi, 
> >>>
> >>> On Mon, Nov 23, 2015 at 09:02:48AM +0100, Josef Gajdusek wrote: 
>  Add a node describing the Security ID memory to the 
>  Allwinner H3 .dtsi file. 
> 
>  Signed-off-by: Josef Gajdusek  
>  --- 
>   arch/arm/boot/dts/sun8i-h3.dtsi | 7 +++ 
>   1 file changed, 7 insertions(+) 
> 
>  diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi 
> >>> b/arch/arm/boot/dts/sun8i-h3.dtsi 
>  index 0faa38a..58de718 100644 
>  --- a/arch/arm/boot/dts/sun8i-h3.dtsi 
>  +++ b/arch/arm/boot/dts/sun8i-h3.dtsi 
>  @@ -359,6 +359,13 @@ 
>   #size-cells = <0>; 
>   }; 
>    
>  +sid: eeprom@01c14000 { 
>  +compatible = "allwinner,sun4i-a10-sid"; 
>  +reg = <0x01c14000 0x400>; 
> >>>
> >>> The datasheet says it's 256 bytes wide, while the size here is of 1kB, 
> >>> is it intentional? 
> >>
> >> SID memory map is 0x01c14000 ~ 0x01c143FF, include 2048bits efuse space.
> >> H3 efuse space is SID_SRAM, its range is  0x01c14200 ~ +0x100.
> > 
> > Interesting, what is below the 0x200 registers?
> >
> Some control register about SID.
> offset: 0x40  SID Program/Read Control Register
> offset: 0x50  SID Program Key Value Register
> offset: 0x60  SID Read Key Value Register
> offset: 0x70  \
> offset: 0x80  SJTAG Attribute 0 Register
> offset: 0x84  SJTAG Attribute 1 Register
> offset: 0x88  SJTAG Select Register
> offset: 0x90  SID Program Ctrol register for burned timing

Thanks!

I guess the layout changed a bit from the A10 and alikes then.

Anyway, we should expose only to the nvmem framework the actual eeprom
space, so from 0x200 to 0x300 from what you're saying (just like we
should only expose the first 4 bytes in the A10 / A20)

Maxime

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

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


signature.asc
Description: Digital signature


Re: [linux-sunxi] Requesting Help on a USD15, Allwinner Quadcore 1.2Ghz 64-bit A53 Hardware

2015-12-01 Thread KH Goh
Hi,
Our first production trial run will be some where around end of Jan 2016. 
After that, we will reserve 20pcs of the boards for the community. 

So, should be able to send the board out on beginning of Feb.

Regards,
KH Goh

On Monday, November 30, 2015 at 12:02:56 AM UTC+8, Luc Verhaegen wrote:
>
> On Sat, Nov 28, 2015 at 05:43:45PM -0800, KH Goh wrote: 
> > Hi Luc Verhaegen, 
> > Thanks for your advise, we get what you are saying. From our side, we 
> are 
> > trying out best to work closely with the open source community and 
> trying 
> > to do our part as much as possibly can.  We are committed to make our 
> > hardware and software as open as possible, but subject to the license 
> > agreement that place upon us by our supplier. But by having a good 
> > relationship between us and the supplier, I think we should be able to 
> iron 
> > out most of the problem. 
> > 
> > In terms of the hardware, at the moment we are having 2 unit of Pine64 
> > Engineering board (Please refer here for the spec 
> http://pine64.com/product 
> > ), and would like to donate it to the community for further evaluation 
> and 
> > testing. Since we are a newcomer in this community, we would like you to 
> > advise us on who and where should we send the 2 board to. 
> > 
> > Thanks for your advise and appreciate your kind assistance. 
> > Regards, 
> > KH Goh 
> > 
> > 
> > On Saturday, November 28, 2015 at 9:01:31 PM UTC+8, Luc Verhaegen wrote: 
> > > 
> > > On Sat, Nov 28, 2015 at 12:38:16AM -0800, khg...@gmail.com 
>  
> > > wrote: 
> > > 
> > > Thanks for contacting the canonical source of most things 
> > > sunxi/allwinner before actually launching your kickstarter campaign. 
> > > 
> > > This is the first time since the original cubieboard that such a thing 
> > > has happened. Many companies with similar products only afterwards 
> find 
> > > out to what extent they do depend on the linux-sunxi community, and 
> then 
> > > change their story in either direction. Often the work done by the 
> > > people of the linux-sunxi community gets used directly, cloned/forked, 
> > > and nothing is ever given back. 
> > > 
> > > As you can see, we (and while i do not speak for all of us, i know 
> that 
> > > i am not alone here) are sceptical about whoever approaches us like 
> > > this, especially when one of the first statements is "budget 
> > > constraints". You cannot expect the linux-sunxi community to do your 
> > > work for you for free. 
> > > 
> > > You should however donate boards to many known and active linux-sunxi 
> > > developers, but for that you must not expect anything in return. 
> > > Whatever then happens, happens, or it doesn't. The results are usually 
> > > quite positive, especially given the limited cost of said boards, but 
> it 
> > > will hardly ever consist of full support for your product (especially 
> > > when based on a new SoC variant). 
> > > 
> > > If you wish to have more complete support, you can always try to hire 
> > > known linux-sunxi developers directly, or work with those members of 
> our 
> > > community who do contracting. The choice is up to you. 
> > > 
> > > Thanks for reaching out to us before launching your marketing 
> campaign, 
> > > i hope that your collaboration with linux-sunxi ends up being just as 
> > > fruitful as your kickstarter. 
> > 
> > Thanks for your advise, we get what you are saying. From our side, we 
> are 
> > trying out best to work closely with the open source community and 
> trying 
> > to do our part as much as possibly can.  We are committed to make our   
> > hardware and software as open as possible, but subject to the license 
> > agreement that place upon us by our supplier. But by having a good 
> > relationship between us and the supplier, I think we should be able to 
> iron 
> > out most of the problem. 
>
> That last sentence reads, to me, as; "we will work out all product 
> support issues with our supplier" (being allwinner). 
>
> That then makes me wonder how far along you are with developing 
> software support for your product. You will be amazed to what extent you 
> do depend on linux-sunxi, for a very broad range of what you would call 
> product support. 
>
> I do wish to warn you though, about the use of the term "open source 
> platform". Be very careful with your marketing there: 
> 1) I see no indication that your product will be "open source hardware" 
> (OSHW), like with Olimex devices. 
> 2) Allwinner is known to ship binary, GPL violating, blobs and to need 
> hard convincing to change this. The status of their ffmpeg LGPL 
> violation is still very questionable, but has entered a dark grey zone 
> now, where legal action is a toss-up. Allwinner, and its customers, had 
> to be forced, hard, and even then did only as much as they could get 
> away with. 
> 3) Due to the hardware you are using, you are going to have non open 
> source software (CedarX, Mali). 
>
> All three of the above make your statement that 

Re: [linux-sunxi] Re: 3.4.104 on A10?

2015-12-01 Thread Igor Pecovnik
https://github.com/igorpecovnik/lib/blob/second/config/linux-sun4i.config

This config that I use for A10 boards.

Dne nedelja, 29. november 2015 09.23.13 UTC+1 je oseba Rudi napisala:
>
> Hi Igor, 
>
> (funny to see the same people in different forums ;) 
>
> > + upgrade all the way to .110 I can confirm it's working fine on 
> Cubieboard 1 Note that patches 
> > not need just work out of the box. I  to fix them. If you want to tray, 
> you can find them 
> > here: https://github.com/igorpecovnik/lib/tree/second/patch/kernel 
> (patch-103-104, 104-105, ...) 
>
> Thanks for the pointer. Maybe I'll try them, but it's all about spare 
> time... 
>
>
> > I use my own configuration and a bundle of patches over it but even 
> without it should work just fine. 
>
> Just out of curiosity: Do you have CONFIG_HAVE_ARCH_SECCOMP_FILTER, 
> CONFIG_SECCOMP_FILTER 
> and CONFIG_SECCOMP enabled? 
>
> Forthermore, does this: 
>
> # CONFIG_KERNEL_GZIP is not set 
> # CONFIG_KERNEL_LZMA is not set 
> # CONFIG_KERNEL_XZ is not set 
> CONFIG_KERNEL_LZO=y 
>
> work for you ? 
>
>
>
> -- 
>
> Ruediger "Rudi" Ihle 
>
>
>

-- 
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 v2 2/3] ARM: dts: sun8i: Add Allwinner A83T dtsi

2015-12-01 Thread Maxime Ripard
Hi!

On Mon, Nov 30, 2015 at 02:09:14AM +0800, Vishnu Patekar wrote:
> >> + reg = <0x01c20800 0x400>;
> >> + clocks = <>;
> >> + gpio-controller;
> >> + interrupt-controller;
> >> + #interrupt-cells = <3>;
> >> + #gpio-cells = <3>;
> >> +
> >> + i2c0_pins_a: i2c0@0 {
> >> + allwinner,pins = "PH0", "PH1";
> >> + allwinner,function = "i2c0";
> >> + allwinner,drive = ;
> >> + allwinner,pull = ;
> >> + };
> >> +
> >> + i2c1_pins_a: i2c1@0 {
> >> + allwinner,pins = "PH2", "PH3";
> >> + allwinner,function = "i2c1";
> >> + allwinner,drive = ;
> >> + allwinner,pull = ;
> >> + };
> >> +
> >> + i2c2_pins_a: i2c2@0 {
> >> + allwinner,pins = "PH4", "PH5";
> >> + allwinner,function = "i2c2";
> >> + allwinner,drive = ;
> >> + allwinner,pull = ;
> >> + };
> >> +
> >> + mmc0_pins_a: mmc0@0 {
> >> + allwinner,pins = "PF0", "PF1", "PF2",
> >> +  "PF3", "PF4", "PF5";
> >> + allwinner,function = "mmc0";
> >> + allwinner,drive = ;
> >> + allwinner,pull = ;
> >> + };
> >> +
> >> + mmc1_pins_a: mmc1@0 {
> >> + allwinner,pins = "PG0", "PG1", "PG2",
> >> +  "PG3", "PG4", "PG5";
> >> + allwinner,function = "mmc1";
> >> + allwinner,drive = ;
> >> + allwinner,pull = ;
> >> + };
> >> +
> >> + mmc2_8bit_pins: mmc2_8bit {
> >> + allwinner,pins = "PC5", "PC6", "PC8",
> >> +  "PC9", "PC10", "PC11",
> >> +  "PC12", "PC13", "PC14",
> >> +  "PC15";
> >> + allwinner,function = "mmc2";
> >> + allwinner,drive = ;
> >> + allwinner,pull = ;
> >> + };
> >> +
> >> + uart0_pins_a: uart0@0 {
> >> + allwinner,pins = "PF2", "PF4";
> >> + allwinner,function = "uart0";
> >> + allwinner,drive = ;
> >> + allwinner,pull = ;
> >> + };
> >> +
> >> + uart0_pins_b: uart0@1 {
> >> + allwinner,pins = "PB9", "PB10";
> >> + allwinner,function = "uart0";
> >> + allwinner,drive = ;
> >> + allwinner,pull = ;
> >> + };
> >
> > Are you going to use all these options?
>
> Not, only uart0_pins_a and uart0_pins_b and mmc0_pins_a will be used for now.
> As, these are not enabled, I don't see any harm in keeping those here.

It bloats the DT for no particular reason.

> Let me know in case you want to remove, I'll do it.

Yes, please.

Thanks!
Maxime

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

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


signature.asc
Description: Digital signature


Re: [linux-sunxi] FYI: Wiki problems

2015-12-01 Thread Luc Verhaegen
On Tue, Dec 01, 2015 at 07:46:01AM +0100, Thomas Kaiser wrote:
> Hi,
> 
> currently it's not possible to edit anything in the wiki. Authentication
> problems due to "Warning: Unknown: write failed: No space left on device
> (28) in Unknown on line 0"
> 
> Best regards,

Fixed, again.

Luc Verhaegen.

-- 
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] clk_out_a usage in mainline

2015-12-01 Thread Maxime Ripard
Hi,

On Fri, Nov 27, 2015 at 10:42:53PM +0100, Danny Milosavljevic wrote:
> Hi,
> 
> I'm trying to use A20 clk_out_a in Linux 4.4-rc1.
> 
> I wrote a kernel module in order to enable the clock:
> http://svn.nomike.com/playground/trunk/Navi/TSS463AA/Linux/tss463aa.c
> 
> However, it does not work, in the following way:
> 
> I connected an oscilloscope to the pin PI12.
> 
> Then I used manual bitbanging to make sure it's the correct pin:
> 
> http://svn.nomike.com/playground/trunk/Navi/WORKING_CLOCK
> 
> When I do that, I see a nice square wave on the 'scope.
> 
> However, when I then load the kernel module, the display on the 'scope
> flatlines.
> 
> On one hand that's a good sign since it means that it at least found
> the clock definition in the device tree file and uses the right pin.
> 
> On the other hand I can't figure out what the problem is.
> 
> Does clk_out_a work for anyone? How to use it (I'd need a clock of
> max 8 MHz for driving a TSS463AA, min 150 kHz)?
> 
> The tss463aa definition in my device tree file is:
> 
>  {
>   status = "okay";
>   spidev0: spidev@1 {
>   compatible = "atmel,tss463aa";
>   reg = <0>;
>   spi-max-frequency = <400>;
>   };
> };

Did you mux the clk_out pin somewhere? Did you enable the clock?

Maxime

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

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


signature.asc
Description: Digital signature


Re: [linux-sunxi] Requesting Help on a USD15, Allwinner Quadcore 1.2Ghz 64-bit A53 Hardware

2015-12-01 Thread KH Goh
Hi,
Will currently in the process of sorting out and finalizing our the 
documentation. Once it is ready we will post up the hardware port and pin 
assignment. Hopefully it will ready in about 2 Weeks time.

Regards,
KH Goh

On Sunday, November 29, 2015 at 3:12:21 PM UTC+8, Priit Laes wrote:
>
> On Sat, 2015-11-28 at 17:43 -0800, KH Goh wrote: 
>
> [...] 
> > In terms of the hardware, at the moment we are having 2 unit of 
> > Pine64 Engineering board (Please refer here for the 
> > spec http://pine64.com/product ), and would like to donate it to the 
> > community for further evaluation and testing. Since we are a newcomer 
> > in this community, we would like you to advise us on who and where 
> > should we send the 2 board to. 
>
> You can already start with the new device howto - http://linux-sunxi.or 
> g/New_Device_howto 
>
> This would be a nice second step to working together with community. 
>
> Do you also have access and/or permission to "publish" the datasheets 
> (A53, AXP??? and Wifi/BT) and BSP? 
>
> Also, on http://pine64.com/product#intro could you label all the ports 
> and expansion headers (I can see from the board that there are 
> headers/sockets for TP, CSI, DSI, RTC, VBAT, POWER, UART). And what 
> regulator chip (AXP???) and wifi/bluetooth chip does it use? 
>
> And a typo "muti-channel" on that page. 
>
>
>
> > Thanks for your advise and appreciate your kind assistance. 
> > Regards, 
> > KH Goh 
> > 
> > 
> > On Saturday, November 28, 2015 at 9:01:31 PM UTC+8, Luc Verhaegen 
> > wrote: 
> > > On Sat, Nov 28, 2015 at 12:38:16AM -0800, khg...@gmail.com wrote: 
> > > > Hi, 
> > > > We are a group of people currently trying to come out with a very 
> > > low 
> > > > cost single board computer, by making use of Allwinner Quadcore 
> > > 1.2Ghz 
> > > > 64-bit A53 CPU. The target costing for the single board computer 
> > > is 
> > > > USD15. The hardware will have a 4K HDMI video output and on board 
> > > > ethernet connection. Further more, each board will has its own 
> > > unique 
> > > > MAC address. The objective for this project is to allow 
> > > individual, 
> > > > having the opportunity to learn IT knowledge with a friction of 
> > > the 
> > > > cost. Please refer to pine64.com for more detail on the hardware 
> > > > specification. 
> > > > 
> > > > Currently, the hardware development on the board is almost ready. 
> > > And 
> > > > with us, is the full Linux BSP with the true 64bit compiler. Due 
> > > to 
> > > > budget constrain and our limited know-how in Linux, We would like 
> > > to 
> > > > request the help from this community to bring up the Linux into a 
> > > full 
> > > > function Ubuntu desktop, thus allow the user to truly owning a 
> > > fully 
> > > > function open source computer with just a friction of the cost. 
> > > > 
> > > > As for the hardware itself, currently we are in the mist of 
> > > building 
> > > > some sample board to allow any interested developer to work on 
> > > it. 
> > > > 
> > > > Thanks and Regard, 
> > > > KH Goh 
> > > 
> > > Hi, 
> > > 
> > > Thanks for contacting the canonical source of most things 
> > > sunxi/allwinner before actually launching your kickstarter 
> > > campaign. 
> > > 
> > > This is the first time since the original cubieboard that such a 
> > > thing 
> > > has happened. Many companies with similar products only afterwards 
> > > find 
> > > out to what extent they do depend on the linux-sunxi community, and 
> > > then 
> > > change their story in either direction. Often the work done by the 
> > > people of the linux-sunxi community gets used directly, 
> > > cloned/forked, 
> > > and nothing is ever given back. 
> > > 
> > > As you can see, we (and while i do not speak for all of us, i know 
> > > that 
> > > i am not alone here) are sceptical about whoever approaches us like 
> > > this, especially when one of the first statements is "budget 
> > > constraints". You cannot expect the linux-sunxi community to do 
> > > your 
> > > work for you for free. 
> > > 
> > > You should however donate boards to many known and active linux- 
> > > sunxi 
> > > developers, but for that you must not expect anything in return. 
> > > Whatever then happens, happens, or it doesn't. The results are 
> > > usually 
> > > quite positive, especially given the limited cost of said boards, 
> > > but it 
> > > will hardly ever consist of full support for your product 
> > > (especially 
> > > when based on a new SoC variant). 
> > > 
> > > If you wish to have more complete support, you can always try to 
> > > hire 
> > > known linux-sunxi developers directly, or work with those members 
> > > of our 
> > > community who do contracting. The choice is up to you. 
> > > 
> > > Thanks for reaching out to us before launching your marketing 
> > > campaign, 
> > > i hope that your collaboration with linux-sunxi ends up being just 
> > > as 
> > > fruitful as your kickstarter. 
> > > 
> > > Luc Verhaegen. 
> > -- 
> > You 

[linux-sunxi] [PATCH v2 11/25] coccinelle: nand: detect and correct drivers embedding an mtd_info object

2015-12-01 Thread Boris Brezillon
Add nand-priv-no-mtd.cocci to detect and correct NAND controller drivers
directly embedding an mtd_info struct in their private struct.

Signed-off-by: Boris Brezillon 
Cc: Julia Lawall 
---
Hi Julia,

Not sure this is the correct way to detect and fix offending drivers,
but I get some warnings when launching coccicheck in org or report mode:

"warning: fix2: inherited metavariable __chipfield not used in the -, +,
or context code"

Note that I don't get those warnings when running in patch mode.

Any idea (feel free to propose a better solution to detect and fix those
offending drivers)?

Best Regards,

Boris
---
 scripts/coccinelle/api/nand-priv-no-mtd.cocci | 91 +++
 1 file changed, 91 insertions(+)
 create mode 100644 scripts/coccinelle/api/nand-priv-no-mtd.cocci

diff --git a/scripts/coccinelle/api/nand-priv-no-mtd.cocci 
b/scripts/coccinelle/api/nand-priv-no-mtd.cocci
new file mode 100644
index 000..b2c0c22
--- /dev/null
+++ b/scripts/coccinelle/api/nand-priv-no-mtd.cocci
@@ -0,0 +1,91 @@
+/// Fix NAND controller drivers declaring their own mtd_info struct instead
+/// of the one provided in struct nand_chip.
+///
+// Confidence: Low
+// Copyright: (C) 2015 Boris Brezillon GPL v2.
+
+virtual patch
+virtual context
+virtual org
+virtual report
+
+@match1@
+identifier __chipfield, __mtdfield;
+type __type;
+@@
+(
+   __type {
+   ...
+   struct nand_chip __chipfield;
+   ...
+   struct mtd_info __mtdfield;
+   ...
+   };
+|
+   __type {
+   ...
+   struct mtd_info __mtdfield;
+   ...
+   struct nand_chip __chipfield;
+   ...
+   };
+)
+
+@fix1 depends on match1 && patch && !context && !org && !report@
+identifier match1.__mtdfield;
+type match1.__type;
+@@
+   __type {
+   ...
+-  struct mtd_info __mtdfield;
+   ...
+   };
+
+@fix2 depends on match1 && patch && !context && !org && !report@
+identifier match1.__chipfield, match1.__mtdfield;
+identifier __subfield;
+type match1.__type;
+__type *__priv;
+@@
+<...
+(
+-  __priv->__mtdfield.__subfield
++  nand_to_mtd(&__priv->__chipfield)->__subfield
+|
+-  &(__priv->__mtdfield)
++  nand_to_mtd(&__priv->__chipfield)
+)
+...>
+
+// 
+
+@fix1_context depends on match1 && !patch && (context || org || report)@
+identifier match1.__mtdfield;
+type match1.__type;
+position j0;
+@@
+
+   __type {
+   ...
+*  struct mtd_info __mtdfield@j0;
+   ...
+   };
+
+// 
+
+@script:python fix1_org depends on org@
+j0 << fix1_context.j0;
+@@
+
+msg = "struct nand_chip already embeds an mtd_info object (use nand_to_mtd())."
+coccilib.org.print_todo(j0[0], msg)
+
+// 
+
+@script:python fix1_report depends on report@
+j0 << fix1_context.j0;
+@@
+
+msg = "struct nand_chip already embeds an mtd_info object (use nand_to_mtd())."
+coccilib.report.print_report(j0[0], msg)
+
-- 
2.1.4

-- 
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 v2 10/25] mtd: nand: add nand_to_mtd() helper

2015-12-01 Thread Boris Brezillon
Add a new helper to retrieve the MTD device attached to a NAND chip.

Signed-off-by: Boris Brezillon 
---
 include/linux/mtd/nand.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index c4e39ff..8ec071e 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -737,6 +737,11 @@ static inline struct nand_chip *mtd_to_nand(struct 
mtd_info *mtd)
return mtd->priv;
 }
 
+static inline struct mtd_info *nand_to_mtd(struct nand_chip *chip)
+{
+   return >mtd;
+}
+
 /*
  * NAND Flash Manufacturer ID Codes
  */
-- 
2.1.4

-- 
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 v2 12/25] mtd: nand: use the mtd instance embedded in struct nand_chip

2015-12-01 Thread Boris Brezillon
struct nand_chip now embeds an mtd device. Patch all drivers to make use
of this mtd instance instead of using the instance embedded in their
private struct or dynamically allocated.

Signed-off-by: Boris Brezillon 
Cc: Julia Lawall 
---
Most of those changes were generated with the coccinelle script added
in commit c671312 "coccinelle: nand: detect and correct drivers embedding
an mtd_info object"
---
 drivers/mtd/nand/ams-delta.c   | 13 ++--
 drivers/mtd/nand/atmel_nand.c  | 13 ++--
 drivers/mtd/nand/au1550nd.c| 19 ++---
 drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h |  1 -
 drivers/mtd/nand/bcm47xxnflash/main.c  |  8 ++-
 drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c   |  2 +-
 drivers/mtd/nand/bf5xx_nand.c  | 12 ++--
 drivers/mtd/nand/brcmnand/brcmnand.c   | 13 ++--
 drivers/mtd/nand/cafe_nand.c   |  8 +--
 drivers/mtd/nand/cmx270_nand.c | 11 ++-
 drivers/mtd/nand/cs553x_nand.c | 13 ++--
 drivers/mtd/nand/davinci_nand.c| 30 
 drivers/mtd/nand/denali.c  | 68 ++
 drivers/mtd/nand/denali.h  |  1 -
 drivers/mtd/nand/diskonchip.c  | 11 ++-
 drivers/mtd/nand/docg4.c   | 16 ++---
 drivers/mtd/nand/fsl_elbc_nand.c   | 26 ---
 drivers/mtd/nand/fsl_ifc_nand.c| 28 
 drivers/mtd/nand/fsl_upm.c | 28 
 drivers/mtd/nand/fsmc_nand.c   | 56 ---
 drivers/mtd/nand/gpio.c| 20 +++---
 drivers/mtd/nand/gpmi-nand/gpmi-lib.c  |  2 +-
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 20 +++---
 drivers/mtd/nand/gpmi-nand/gpmi-nand.h |  1 -
 drivers/mtd/nand/hisi504_nand.c| 13 ++--
 drivers/mtd/nand/jz4740_nand.c |  9 ++-
 drivers/mtd/nand/lpc32xx_mlc.c |  7 +-
 drivers/mtd/nand/lpc32xx_slc.c |  7 +-
 drivers/mtd/nand/mpc5121_nfc.c |  3 +-
 drivers/mtd/nand/mxc_nand.c|  5 +-
 drivers/mtd/nand/nandsim.c | 12 ++--
 drivers/mtd/nand/ndfc.c| 24 ---
 drivers/mtd/nand/nuc900_nand.c | 24 +++
 drivers/mtd/nand/omap2.c   | 98 +++---
 drivers/mtd/nand/orion_nand.c  |  4 +-
 drivers/mtd/nand/pasemi_nand.c | 12 ++--
 drivers/mtd/nand/plat_nand.c   | 15 ++--
 drivers/mtd/nand/pxa3xx_nand.c | 33 -
 drivers/mtd/nand/r852.c| 34 -
 drivers/mtd/nand/r852.h|  1 -
 drivers/mtd/nand/s3c2410.c | 23 +++---
 drivers/mtd/nand/sh_flctl.c|  8 +--
 drivers/mtd/nand/sharpsl.c | 22 +++---
 drivers/mtd/nand/socrates_nand.c   |  5 +-
 drivers/mtd/nand/sunxi_nand.c  | 13 ++--
 drivers/mtd/nand/tmio_nand.c   | 10 +--
 drivers/mtd/nand/txx9ndfmc.c   |  3 +-
 drivers/mtd/nand/vf610_nfc.c   |  8 ++-
 include/linux/mtd/sh_flctl.h   |  3 +-
 49 files changed, 426 insertions(+), 390 deletions(-)

diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index b2b49c4..0f638c6 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -183,19 +183,16 @@ static int ams_delta_init(struct platform_device *pdev)
return -ENXIO;
 
/* Allocate memory for MTD device structure and private data */
-   ams_delta_mtd = kzalloc(sizeof(struct mtd_info) +
-   sizeof(struct nand_chip), GFP_KERNEL);
-   if (!ams_delta_mtd) {
+   this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
+   if (!this) {
printk (KERN_WARNING "Unable to allocate E3 NAND MTD device 
structure.\n");
err = -ENOMEM;
goto out;
}
 
+   ams_delta_mtd = nand_to_mtd(this);
ams_delta_mtd->owner = THIS_MODULE;
 
-   /* Get pointer to private data */
-   this = (struct nand_chip *) (_delta_mtd[1]);
-
/* Link the private data with the MTD structure */
ams_delta_mtd->priv = this;
 
@@ -256,7 +253,7 @@ out_gpio:
gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB);
iounmap(io_base);
 out_free:
-   kfree(ams_delta_mtd);
+   kfree(this);
  out:
return err;
 }
@@ -276,7 +273,7 @@ static int ams_delta_cleanup(struct platform_device *pdev)
iounmap(io_base);
 
/* Free the MTD device structure */
-   kfree(ams_delta_mtd);
+   kfree(mtd_to_nand(ams_delta_mtd));
 
return 0;
 }
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index edd191a..9ba2831 

[linux-sunxi] [PATCH v2 01/25] ARM: nand: make use of mtd_to_nand() where appropriate

2015-12-01 Thread Boris Brezillon
mtd_to_nand() was recently introduced to avoid direct accesses to the
mtd->priv field. Update all ARM specific implementations to use this
helper.

Signed-off-by: Boris Brezillon 
---
 arch/arm/mach-ep93xx/snappercl15.c   | 4 ++--
 arch/arm/mach-ep93xx/ts72xx.c| 4 ++--
 arch/arm/mach-imx/mach-qong.c| 2 +-
 arch/arm/mach-ixp4xx/ixdp425-setup.c | 2 +-
 arch/arm/mach-omap1/board-nand.c | 2 +-
 arch/arm/mach-orion5x/ts78xx-setup.c | 6 +++---
 arch/arm/mach-pxa/balloon3.c | 2 +-
 arch/arm/mach-pxa/em-x270.c  | 2 +-
 arch/arm/mach-pxa/palmtx.c   | 2 +-
 9 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-ep93xx/snappercl15.c 
b/arch/arm/mach-ep93xx/snappercl15.c
index c490426..b2db791 100644
--- a/arch/arm/mach-ep93xx/snappercl15.c
+++ b/arch/arm/mach-ep93xx/snappercl15.c
@@ -49,7 +49,7 @@
 static void snappercl15_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
  unsigned int ctrl)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
static u16 nand_state = SNAPPERCL15_NAND_WPN;
u16 set;
 
@@ -76,7 +76,7 @@ static void snappercl15_nand_cmd_ctrl(struct mtd_info *mtd, 
int cmd,
 
 static int snappercl15_nand_dev_ready(struct mtd_info *mtd)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
 
return !!(__raw_readw(NAND_CTRL_ADDR(chip)) & SNAPPERCL15_NAND_RDY);
 }
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 61f4b5d..45b81a2 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -74,7 +74,7 @@ static void __init ts72xx_map_io(void)
 static void ts72xx_nand_hwcontrol(struct mtd_info *mtd,
  int cmd, unsigned int ctrl)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
 
if (ctrl & NAND_CTRL_CHANGE) {
void __iomem *addr = chip->IO_ADDR_R;
@@ -96,7 +96,7 @@ static void ts72xx_nand_hwcontrol(struct mtd_info *mtd,
 
 static int ts72xx_nand_device_ready(struct mtd_info *mtd)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
void __iomem *addr = chip->IO_ADDR_R;
 
addr += (1 << TS72XX_NAND_BUSY_ADDR_LINE);
diff --git a/arch/arm/mach-imx/mach-qong.c b/arch/arm/mach-imx/mach-qong.c
index a213e7b..5c27646 100644
--- a/arch/arm/mach-imx/mach-qong.c
+++ b/arch/arm/mach-imx/mach-qong.c
@@ -131,7 +131,7 @@ static void qong_init_nor_mtd(void)
  */
 static void qong_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int 
ctrl)
 {
-   struct nand_chip *nand_chip = mtd->priv;
+   struct nand_chip *nand_chip = mtd_to_nand(mtd);
 
if (cmd == NAND_CMD_NONE)
return;
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c 
b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index e7b8bef..333b0f9 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -76,7 +76,7 @@ static struct mtd_partition ixdp425_partitions[] = {
 static void
 ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
 {
-   struct nand_chip *this = mtd->priv;
+   struct nand_chip *this = mtd_to_nand(mtd);
int offset = (int)this->priv;
 
if (ctrl & NAND_CTRL_CHANGE) {
diff --git a/arch/arm/mach-omap1/board-nand.c b/arch/arm/mach-omap1/board-nand.c
index 4d08353..7684f92 100644
--- a/arch/arm/mach-omap1/board-nand.c
+++ b/arch/arm/mach-omap1/board-nand.c
@@ -22,7 +22,7 @@
 
 void omap1_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
 {
-   struct nand_chip *this = mtd->priv;
+   struct nand_chip *this = mtd_to_nand(mtd);
unsigned long mask;
 
if (cmd == NAND_CMD_NONE)
diff --git a/arch/arm/mach-orion5x/ts78xx-setup.c 
b/arch/arm/mach-orion5x/ts78xx-setup.c
index 1b704d3..96cf6b5 100644
--- a/arch/arm/mach-orion5x/ts78xx-setup.c
+++ b/arch/arm/mach-orion5x/ts78xx-setup.c
@@ -176,7 +176,7 @@ static void ts78xx_ts_rtc_unload(void)
 static void ts78xx_ts_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
unsigned int ctrl)
 {
-   struct nand_chip *this = mtd->priv;
+   struct nand_chip *this = mtd_to_nand(mtd);
 
if (ctrl & NAND_CTRL_CHANGE) {
unsigned char bits;
@@ -200,7 +200,7 @@ static int ts78xx_ts_nand_dev_ready(struct mtd_info *mtd)
 static void ts78xx_ts_nand_write_buf(struct mtd_info *mtd,
const uint8_t *buf, int len)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
void __iomem *io_base = chip->IO_ADDR_W;
unsigned long off = ((unsigned long)buf & 3);
int sz;
@@ -227,7 +227,7 @@ static void ts78xx_ts_nand_write_buf(struct mtd_info *mtd,
 static void ts78xx_ts_nand_read_buf(struct mtd_info *mtd,

[linux-sunxi] [PATCH v2 18/25] cris: nand: remove useless mtd->priv = chip assignments

2015-12-01 Thread Boris Brezillon
mtd_to_nand() now uses the container_of() approach to transform an
mtd_info pointer into a nand_chip one. Drop useless mtd->priv
assignments from NAND controller drivers.

Signed-off-by: Boris Brezillon 
---
Patch generated with the following coccinelle script:

---8<
virtual patch

@@
struct mtd_info m;
struct mtd_info *mp;
struct nand_chip *c;
@@
(
-(m).priv = c;
|
-(mp)->priv = c;
|
-(mp)->priv = (void *)c;
)
---8<
---
 arch/cris/arch-v32/drivers/mach-a3/nandflash.c | 3 ---
 arch/cris/arch-v32/drivers/mach-fs/nandflash.c | 3 ---
 2 files changed, 6 deletions(-)

diff --git a/arch/cris/arch-v32/drivers/mach-a3/nandflash.c 
b/arch/cris/arch-v32/drivers/mach-a3/nandflash.c
index ee74e45..5aa3f51 100644
--- a/arch/cris/arch-v32/drivers/mach-a3/nandflash.c
+++ b/arch/cris/arch-v32/drivers/mach-a3/nandflash.c
@@ -149,9 +149,6 @@ struct mtd_info *__init crisv32_nand_flash_probe(void)
this = >chip;
crisv32_mtd = nand_to_mtd(this);
 
-   /* Link the private data with the MTD structure */
-   crisv32_mtd->priv = this;
-
/* Set address of NAND IO lines */
this->IO_ADDR_R = read_cs;
this->IO_ADDR_W = write_cs;
diff --git a/arch/cris/arch-v32/drivers/mach-fs/nandflash.c 
b/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
index 5626297..a7c17b0 100644
--- a/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
+++ b/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
@@ -140,9 +140,6 @@ struct mtd_info *__init crisv32_nand_flash_probe(void)
bif_cfg.gated_csp1 = regk_bif_core_wr;
REG_WR(bif_core, regi_bif_core, rw_grp3_cfg, bif_cfg);
 
-   /* Link the private data with the MTD structure */
-   crisv32_mtd->priv = this;
-
/* Set address of NAND IO lines */
this->IO_ADDR_R = read_cs;
this->IO_ADDR_W = write_cs;
-- 
2.1.4

-- 
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 v2 05/25] sh: nand: make use of mtd_to_nand() where appropriate

2015-12-01 Thread Boris Brezillon
mtd_to_nand() was recently introduced to avoid direct accesses to the
mtd->priv field. Update all SH specific implementations to use this
helper.

Signed-off-by: Boris Brezillon 
---
 arch/sh/boards/mach-migor/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sh/boards/mach-migor/setup.c 
b/arch/sh/boards/mach-migor/setup.c
index 29b7c0d..8673f91 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -167,7 +167,7 @@ static struct mtd_partition migor_nand_flash_partitions[] = 
{
 static void migor_nand_flash_cmd_ctl(struct mtd_info *mtd, int cmd,
 unsigned int ctrl)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
 
if (cmd == NAND_CMD_NONE)
return;
-- 
2.1.4

-- 
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 v2 04/25] mips: nand: make use of mtd_to_nand() where appropriate

2015-12-01 Thread Boris Brezillon
mtd_to_nand() was recently introduced to avoid direct accesses to the
mtd->priv field. Update all MIPS specific implementations to use this
helper.

Signed-off-by: Boris Brezillon 
---
 arch/mips/alchemy/devboards/db1200.c | 2 +-
 arch/mips/alchemy/devboards/db1300.c | 2 +-
 arch/mips/alchemy/devboards/db1550.c | 2 +-
 arch/mips/pnx833x/common/platform.c  | 2 +-
 arch/mips/rb532/devices.c| 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/mips/alchemy/devboards/db1200.c 
b/arch/mips/alchemy/devboards/db1200.c
index 8c13675..992442a 100644
--- a/arch/mips/alchemy/devboards/db1200.c
+++ b/arch/mips/alchemy/devboards/db1200.c
@@ -200,7 +200,7 @@ static struct i2c_board_info db1200_i2c_devs[] __initdata = 
{
 static void au1200_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
 unsigned int ctrl)
 {
-   struct nand_chip *this = mtd->priv;
+   struct nand_chip *this = mtd_to_nand(mtd);
unsigned long ioaddr = (unsigned long)this->IO_ADDR_W;
 
ioaddr &= 0xff00;
diff --git a/arch/mips/alchemy/devboards/db1300.c 
b/arch/mips/alchemy/devboards/db1300.c
index b580770..d3c087f 100644
--- a/arch/mips/alchemy/devboards/db1300.c
+++ b/arch/mips/alchemy/devboards/db1300.c
@@ -150,7 +150,7 @@ static void __init db1300_gpio_config(void)
 static void au1300_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
 unsigned int ctrl)
 {
-   struct nand_chip *this = mtd->priv;
+   struct nand_chip *this = mtd_to_nand(mtd);
unsigned long ioaddr = (unsigned long)this->IO_ADDR_W;
 
ioaddr &= 0xff00;
diff --git a/arch/mips/alchemy/devboards/db1550.c 
b/arch/mips/alchemy/devboards/db1550.c
index 5740bcf..b518f02 100644
--- a/arch/mips/alchemy/devboards/db1550.c
+++ b/arch/mips/alchemy/devboards/db1550.c
@@ -128,7 +128,7 @@ static struct i2c_board_info db1550_i2c_devs[] __initdata = 
{
 static void au1550_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
 unsigned int ctrl)
 {
-   struct nand_chip *this = mtd->priv;
+   struct nand_chip *this = mtd_to_nand(mtd);
unsigned long ioaddr = (unsigned long)this->IO_ADDR_W;
 
ioaddr &= 0xff00;
diff --git a/arch/mips/pnx833x/common/platform.c 
b/arch/mips/pnx833x/common/platform.c
index b4b774b..3cd3577 100644
--- a/arch/mips/pnx833x/common/platform.c
+++ b/arch/mips/pnx833x/common/platform.c
@@ -180,7 +180,7 @@ static struct platform_device pnx833x_sata_device = {
 static void
 pnx833x_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
 {
-   struct nand_chip *this = mtd->priv;
+   struct nand_chip *this = mtd_to_nand(mtd);
unsigned long nandaddr = (unsigned long)this->IO_ADDR_W;
 
if (cmd == NAND_CMD_NONE)
diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c
index 9bd7a2d..0966adc 100644
--- a/arch/mips/rb532/devices.c
+++ b/arch/mips/rb532/devices.c
@@ -148,7 +148,7 @@ static int rb532_dev_ready(struct mtd_info *mtd)
 
 static void rb532_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
unsigned char orbits, nandbits;
 
if (ctrl & NAND_CTRL_CHANGE) {
-- 
2.1.4

-- 
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 v2 07/25] mtd: nand: make use of mtd_to_nand() in NAND drivers

2015-12-01 Thread Boris Brezillon
mtd_to_nand() was recently introduced to avoid direct accesses to the
mtd->priv field. Update all NAND drivers to use it.

Signed-off-by: Boris Brezillon 
---
Patch generated with the following coccinelle script:

--->8---
virtual patch

@@
struct nand_chip *c;
struct mtd_info *m;
@@
(
-c = (m)->priv
+c = mtd_to_nand(m)
)

@@
struct mtd_info *m;
identifier c;
@@
(
-struct nand_chip *c = (m)->priv;
+struct nand_chip *c = mtd_to_nand(m);
)
--->8---
---
 drivers/mtd/nand/ams-delta.c |  4 +-
 drivers/mtd/nand/atmel_nand.c| 50 ++---
 drivers/mtd/nand/au1550nd.c  | 22 +-
 drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c | 16 +++
 drivers/mtd/nand/bf5xx_nand.c| 12 ++---
 drivers/mtd/nand/brcmnand/brcmnand.c | 12 ++---
 drivers/mtd/nand/cafe_nand.c | 18 
 drivers/mtd/nand/cmx270_nand.c   |  8 ++--
 drivers/mtd/nand/cs553x_nand.c   | 18 
 drivers/mtd/nand/davinci_nand.c  |  8 ++--
 drivers/mtd/nand/diskonchip.c| 66 ++--
 drivers/mtd/nand/docg4.c | 34 +++---
 drivers/mtd/nand/fsl_elbc_nand.c | 14 +++---
 drivers/mtd/nand/fsl_ifc_nand.c  | 18 
 drivers/mtd/nand/fsl_upm.c   |  4 +-
 drivers/mtd/nand/fsmc_nand.c | 10 ++---
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c   | 18 
 drivers/mtd/nand/hisi504_nand.c  | 16 +++
 drivers/mtd/nand/jz4740_nand.c   |  4 +-
 drivers/mtd/nand/lpc32xx_mlc.c   |  6 +--
 drivers/mtd/nand/lpc32xx_slc.c   | 14 +++---
 drivers/mtd/nand/mpc5121_nfc.c   | 24 +-
 drivers/mtd/nand/mxc_nand.c  | 34 +++---
 drivers/mtd/nand/ndfc.c  | 14 +++---
 drivers/mtd/nand/nuc900_nand.c   |  2 +-
 drivers/mtd/nand/omap2.c | 12 ++---
 drivers/mtd/nand/orion_nand.c|  4 +-
 drivers/mtd/nand/pasemi_nand.c   |  8 ++--
 drivers/mtd/nand/pxa3xx_nand.c   | 18 
 drivers/mtd/nand/r852.c  |  2 +-
 drivers/mtd/nand/s3c2410.c   |  6 +--
 drivers/mtd/nand/sharpsl.c   |  2 +-
 drivers/mtd/nand/sm_common.c |  2 +-
 drivers/mtd/nand/socrates_nand.c |  8 ++--
 drivers/mtd/nand/sunxi_nand.c| 26 +--
 drivers/mtd/nand/tmio_nand.c |  2 +-
 drivers/mtd/nand/txx9ndfmc.c | 12 ++---
 drivers/mtd/nand/xway_nand.c |  4 +-
 38 files changed, 276 insertions(+), 276 deletions(-)

diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 842f8fe..b2b49c4 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -64,7 +64,7 @@ static struct mtd_partition partition_info[] = {
 
 static void ams_delta_write_byte(struct mtd_info *mtd, u_char byte)
 {
-   struct nand_chip *this = mtd->priv;
+   struct nand_chip *this = mtd_to_nand(mtd);
void __iomem *io_base = this->priv;
 
writew(0, io_base + OMAP_MPUIO_IO_CNTL);
@@ -77,7 +77,7 @@ static void ams_delta_write_byte(struct mtd_info *mtd, u_char 
byte)
 static u_char ams_delta_read_byte(struct mtd_info *mtd)
 {
u_char res;
-   struct nand_chip *this = mtd->priv;
+   struct nand_chip *this = mtd_to_nand(mtd);
void __iomem *io_base = this->priv;
 
gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NRE, 0);
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index f4e1f91..edd191a 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -182,7 +182,7 @@ static void atmel_nand_disable(struct atmel_nand_host *host)
  */
 static void atmel_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int 
ctrl)
 {
-   struct nand_chip *nand_chip = mtd->priv;
+   struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = nand_chip->priv;
 
if (ctrl & NAND_CTRL_CHANGE) {
@@ -205,7 +205,7 @@ static void atmel_nand_cmd_ctrl(struct mtd_info *mtd, int 
cmd, unsigned int ctrl
  */
 static int atmel_nand_device_ready(struct mtd_info *mtd)
 {
-   struct nand_chip *nand_chip = mtd->priv;
+   struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = nand_chip->priv;
 
return gpio_get_value(host->board.rdy_pin) ^
@@ -215,7 +215,7 @@ static int atmel_nand_device_ready(struct mtd_info *mtd)
 /* Set up for hardware ready pin and enable pin. */
 static int atmel_nand_set_enable_ready_pins(struct mtd_info *mtd)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = chip->priv;
int res = 0;
 
@@ -267,7 +267,7 @@ static int 

[linux-sunxi] [PATCH v2 00/25] mtd: nand: refactor the NAND subsystem (part 1)

2015-12-01 Thread Boris Brezillon
Hello,

This huge series aims at clarifying the relationship between the mtd and
nand_chip structures and hiding NAND framework internals to NAND
controller drivers.

The first part of the series provide an mtd_to_nand() helper to hide the
way mtd and nand_chip are linked together.

The second part of the series embeds the mtd structure into the nand_chip
one so that NAND controller drivers don't have to bother allocating the
MTD device and linking it with the NAND chip.

The last part of the series hides accesses to the chip->priv field behind
two helper functions.

This allows removal of some of the boilerplate code done in all NAND
controller drivers, but most importantly, it unifies a bit the way NAND
chip structures are instantiated (even though we still have two different
kinds of drivers: those embedding the nand_chip struct into their private
nand chip representation, and those allocating two different structures
and linking them together with the chip->priv field).

As said in the title, this refactoring is only the first step. I plan to
rework the NAND controller / NAND chip separation for pretty much the same
reasons: clarifying the separation between the two concepts, and getting
rid of more boilerplate code in NAND controller drivers.

Stay tuned ;-).

Best Regards,

Boris

Changes since v1:
- dropped already applied patches
- fixed some typos
- manually fixed some modifications omitted by the coccinelle scripts
- manually reworked modifactions done by coccinelle scripts to improve
  readability and fix coding style issues

Boris Brezillon (25):
  ARM: nand: make use of mtd_to_nand() where appropriate
  blackfin: nand: make use of mtd_to_nand() where appropriate
  cris: nand: make use of mtd_to_nand() where appropriate
  mips: nand: make use of mtd_to_nand() where appropriate
  sh: nand: make use of mtd_to_nand() where appropriate
  mtd: nand: make use of mtd_to_nand() in NAND core code
  mtd: nand: make use of mtd_to_nand() in NAND drivers
  staging: mt29f_spinand: make use of mtd_to_nand()
  mtd: nand: embed an mtd_info structure into nand_chip
  mtd: nand: add nand_to_mtd() helper
  coccinelle: nand: detect and correct drivers embedding an mtd_info
object
  mtd: nand: use the mtd instance embedded in struct nand_chip
  mtd: nand: update the documentation to reflect framework changes
  staging: mt29f_spinand: use the mtd instance embedded in struct
nand_chip
  cris: nand: use the mtd instance embedded in struct nand_chip
  mtd: nand: update mtd_to_nand()
  mtd: nand: remove useless mtd->priv = chip assignments
  cris: nand: remove useless mtd->priv = chip assignments
  staging: mt29f_spinand: remove useless mtd->priv = chip assignment
  mtd: nand: simplify nand_dt_init() usage
  mtd: nand: kill the chip->flash_node field
  mtd: nand: add helpers to access ->priv
  ARM: make use of nand_set/get_controller_data() helpers
  mtd: nand: make use of nand_set/get_controller_data() helpers
  staging: mt29f_spinand: make use of nand_set/get_controller_data()
helpers

 Documentation/DocBook/mtdnand.tmpl |  31 +++---
 arch/arm/mach-ep93xx/snappercl15.c |   4 +-
 arch/arm/mach-ep93xx/ts72xx.c  |   4 +-
 arch/arm/mach-imx/mach-qong.c  |   2 +-
 arch/arm/mach-ixp4xx/ixdp425-setup.c   |   6 +-
 arch/arm/mach-omap1/board-nand.c   |   2 +-
 arch/arm/mach-orion5x/ts78xx-setup.c   |   6 +-
 arch/arm/mach-pxa/balloon3.c   |   2 +-
 arch/arm/mach-pxa/em-x270.c|   2 +-
 arch/arm/mach-pxa/palmtx.c |   2 +-
 arch/blackfin/mach-bf537/boards/stamp.c|   2 +-
 arch/blackfin/mach-bf561/boards/acvilon.c  |   2 +-
 arch/cris/arch-v32/drivers/mach-a3/nandflash.c |   8 +-
 arch/cris/arch-v32/drivers/mach-fs/nandflash.c |   8 +-
 arch/mips/alchemy/devboards/db1200.c   |   2 +-
 arch/mips/alchemy/devboards/db1300.c   |   2 +-
 arch/mips/alchemy/devboards/db1550.c   |   2 +-
 arch/mips/pnx833x/common/platform.c|   2 +-
 arch/mips/rb532/devices.c  |   2 +-
 arch/sh/boards/mach-migor/setup.c  |   2 +-
 drivers/mtd/nand/ams-delta.c   |  26 ++---
 drivers/mtd/nand/atmel_nand.c  | 118 ++--
 drivers/mtd/nand/au1550nd.c|  40 +++
 drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h |   1 -
 drivers/mtd/nand/bcm47xxnflash/main.c  |   9 +-
 drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c   |  34 +++---
 drivers/mtd/nand/bf5xx_nand.c  |  25 ++---
 drivers/mtd/nand/brcmnand/brcmnand.c   |  54 +
 drivers/mtd/nand/cafe_nand.c   |  51 +
 drivers/mtd/nand/cmx270_nand.c |  20 ++--
 drivers/mtd/nand/cs553x_nand.c |  30 +++--
 drivers/mtd/nand/davinci_nand.c|  37 ---
 drivers/mtd/nand/denali.c  |  67 ++-
 

[linux-sunxi] [PATCH v2 03/25] cris: nand: make use of mtd_to_nand() where appropriate

2015-12-01 Thread Boris Brezillon
mtd_to_nand() was recently introduced to avoid direct accesses to the
mtd->priv field. Update all CRIS specific implementations to use this
helper.

Signed-off-by: Boris Brezillon 
---
 arch/cris/arch-v32/drivers/mach-a3/nandflash.c | 2 +-
 arch/cris/arch-v32/drivers/mach-fs/nandflash.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/cris/arch-v32/drivers/mach-a3/nandflash.c 
b/arch/cris/arch-v32/drivers/mach-a3/nandflash.c
index 7fb5212..db953cf 100644
--- a/arch/cris/arch-v32/drivers/mach-a3/nandflash.c
+++ b/arch/cris/arch-v32/drivers/mach-a3/nandflash.c
@@ -52,7 +52,7 @@ static void crisv32_hwcontrol(struct mtd_info *mtd, int cmd,
 {
unsigned long flags;
reg_pio_rw_dout dout;
-   struct nand_chip *this = mtd->priv;
+   struct nand_chip *this = mtd_to_nand(mtd);
 
local_irq_save(flags);
 
diff --git a/arch/cris/arch-v32/drivers/mach-fs/nandflash.c 
b/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
index e032384..22a6467 100644
--- a/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
+++ b/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
@@ -51,7 +51,7 @@ static void crisv32_hwcontrol(struct mtd_info *mtd, int cmd,
 {
unsigned long flags;
reg_gio_rw_pa_dout dout;
-   struct nand_chip *this = mtd->priv;
+   struct nand_chip *this = mtd_to_nand(mtd);
 
local_irq_save(flags);
 
-- 
2.1.4

-- 
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 v2 02/25] blackfin: nand: make use of mtd_to_nand() where appropriate

2015-12-01 Thread Boris Brezillon
mtd_to_nand() was recently introduced to avoid direct accesses to the
mtd->priv field. Update all blackfin specific implementations to use
this helper.

Signed-off-by: Boris Brezillon 
---
 arch/blackfin/mach-bf537/boards/stamp.c   | 2 +-
 arch/blackfin/mach-bf561/boards/acvilon.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/blackfin/mach-bf537/boards/stamp.c 
b/arch/blackfin/mach-bf537/boards/stamp.c
index 88a19fc..c181543 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -404,7 +404,7 @@ static struct mtd_partition bfin_plat_nand_partitions[] = {
 #define BFIN_NAND_PLAT_ALE 1
 static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned 
int ctrl)
 {
-   struct nand_chip *this = mtd->priv;
+   struct nand_chip *this = mtd_to_nand(mtd);
 
if (cmd == NAND_CMD_NONE)
return;
diff --git a/arch/blackfin/mach-bf561/boards/acvilon.c 
b/arch/blackfin/mach-bf561/boards/acvilon.c
index 6ab9515..37f8f25 100644
--- a/arch/blackfin/mach-bf561/boards/acvilon.c
+++ b/arch/blackfin/mach-bf561/boards/acvilon.c
@@ -267,7 +267,7 @@ static struct mtd_partition bfin_plat_nand_partitions[] = {
 static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
unsigned int ctrl)
 {
-   struct nand_chip *this = mtd->priv;
+   struct nand_chip *this = mtd_to_nand(mtd);
 
if (cmd == NAND_CMD_NONE)
return;
-- 
2.1.4

-- 
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 v2 14/25] staging: mt29f_spinand: use the mtd instance embedded in struct nand_chip

2015-12-01 Thread Boris Brezillon
struct nand_chip now embeds an mtd device, use it instead of allocating
a new one.

Signed-off-by: Boris Brezillon 
---
 drivers/staging/mt29f_spinand/mt29f_spinand.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c 
b/drivers/staging/mt29f_spinand/mt29f_spinand.c
index 8924a96..8171b74 100644
--- a/drivers/staging/mt29f_spinand/mt29f_spinand.c
+++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c
@@ -903,9 +903,7 @@ static int spinand_probe(struct spi_device *spi_nand)
chip->options   |= NAND_CACHEPRG;
chip->select_chip = spinand_select_chip;
 
-   mtd = devm_kzalloc(_nand->dev, sizeof(struct mtd_info), GFP_KERNEL);
-   if (!mtd)
-   return -ENOMEM;
+   mtd = nand_to_mtd(chip);
 
dev_set_drvdata(_nand->dev, mtd);
 
-- 
2.1.4

-- 
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 v2 24/25] mtd: nand: make use of nand_set/get_controller_data() helpers

2015-12-01 Thread Boris Brezillon
New helpers have been added to avoid directly accessing chip->field. Use
them where appropriate.

Signed-off-by: Boris Brezillon 
---
 drivers/mtd/nand/ams-delta.c |  6 +--
 drivers/mtd/nand/atmel_nand.c| 54 ++---
 drivers/mtd/nand/bcm47xxnflash/main.c|  2 +-
 drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c | 16 +++
 drivers/mtd/nand/bf5xx_nand.c|  2 +-
 drivers/mtd/nand/brcmnand/brcmnand.c | 30 ++--
 drivers/mtd/nand/cafe_nand.c | 24 +-
 drivers/mtd/nand/diskonchip.c| 70 ++--
 drivers/mtd/nand/docg4.c | 42 -
 drivers/mtd/nand/fsl_elbc_nand.c | 22 -
 drivers/mtd/nand/fsl_ifc_nand.c  | 26 +--
 drivers/mtd/nand/fsmc_nand.c |  2 +-
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c   | 28 +--
 drivers/mtd/nand/hisi504_nand.c  | 20 
 drivers/mtd/nand/lpc32xx_mlc.c   | 18 +++
 drivers/mtd/nand/lpc32xx_slc.c   | 20 
 drivers/mtd/nand/mpc5121_nfc.c   | 24 +-
 drivers/mtd/nand/mxc_nand.c  | 36 +++---
 drivers/mtd/nand/nandsim.c   |  4 +-
 drivers/mtd/nand/ndfc.c  | 16 +++
 drivers/mtd/nand/orion_nand.c|  4 +-
 drivers/mtd/nand/plat_nand.c |  2 +-
 drivers/mtd/nand/pxa3xx_nand.c   | 22 -
 drivers/mtd/nand/r852.c  |  6 +--
 drivers/mtd/nand/s3c2410.c   |  4 +-
 drivers/mtd/nand/socrates_nand.c | 10 ++--
 drivers/mtd/nand/txx9ndfmc.c |  8 ++--
 27 files changed, 259 insertions(+), 259 deletions(-)

diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 1a18938..68b58c8 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -65,7 +65,7 @@ static struct mtd_partition partition_info[] = {
 static void ams_delta_write_byte(struct mtd_info *mtd, u_char byte)
 {
struct nand_chip *this = mtd_to_nand(mtd);
-   void __iomem *io_base = this->priv;
+   void __iomem *io_base = (void __iomem *)nand_get_controller_data(this);
 
writew(0, io_base + OMAP_MPUIO_IO_CNTL);
writew(byte, this->IO_ADDR_W);
@@ -78,7 +78,7 @@ static u_char ams_delta_read_byte(struct mtd_info *mtd)
 {
u_char res;
struct nand_chip *this = mtd_to_nand(mtd);
-   void __iomem *io_base = this->priv;
+   void __iomem *io_base = (void __iomem *)nand_get_controller_data(this);
 
gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NRE, 0);
ndelay(40);
@@ -206,7 +206,7 @@ static int ams_delta_init(struct platform_device *pdev)
goto out_free;
}
 
-   this->priv = io_base;
+   nand_set_controller_data(this, (void *)io_base);
 
/* Set address of NAND IO lines */
this->IO_ADDR_R = io_base + OMAP_MPUIO_INPUT_LATCH;
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 18c4e14..8f5701a 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -182,7 +182,7 @@ static void atmel_nand_disable(struct atmel_nand_host *host)
 static void atmel_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int 
ctrl)
 {
struct nand_chip *nand_chip = mtd_to_nand(mtd);
-   struct atmel_nand_host *host = nand_chip->priv;
+   struct atmel_nand_host *host = nand_get_controller_data(nand_chip);
 
if (ctrl & NAND_CTRL_CHANGE) {
if (ctrl & NAND_NCE)
@@ -205,7 +205,7 @@ static void atmel_nand_cmd_ctrl(struct mtd_info *mtd, int 
cmd, unsigned int ctrl
 static int atmel_nand_device_ready(struct mtd_info *mtd)
 {
struct nand_chip *nand_chip = mtd_to_nand(mtd);
-   struct atmel_nand_host *host = nand_chip->priv;
+   struct atmel_nand_host *host = nand_get_controller_data(nand_chip);
 
return gpio_get_value(host->board.rdy_pin) ^
 !!host->board.rdy_pin_active_low;
@@ -215,7 +215,7 @@ static int atmel_nand_device_ready(struct mtd_info *mtd)
 static int atmel_nand_set_enable_ready_pins(struct mtd_info *mtd)
 {
struct nand_chip *chip = mtd_to_nand(mtd);
-   struct atmel_nand_host *host = chip->priv;
+   struct atmel_nand_host *host = nand_get_controller_data(chip);
int res = 0;
 
if (gpio_is_valid(host->board.rdy_pin)) {
@@ -267,7 +267,7 @@ static int atmel_nand_set_enable_ready_pins(struct mtd_info 
*mtd)
 static void atmel_read_buf8(struct mtd_info *mtd, u8 *buf, int len)
 {
struct nand_chip*nand_chip = mtd_to_nand(mtd);
-   struct atmel_nand_host *host = nand_chip->priv;
+   struct atmel_nand_host *host = nand_get_controller_data(nand_chip);
 
if (host->nfc && host->nfc->use_nfc_sram && host->nfc->data_in_sram) {

[linux-sunxi] [PATCH v2 20/25] mtd: nand: simplify nand_dt_init() usage

2015-12-01 Thread Boris Brezillon
nand_dt_init() function requires 3 arguments where it actually needs one
(dn and mtd can both be retrieved from chip). Drop these parameters.

Testing for dn != NULL inside nand_dt_init() also helps simplifying the
caller code.

Signed-off-by: Boris Brezillon 
---
 drivers/mtd/nand/nand_base.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 5aec154..ae3fd2a 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3937,11 +3937,17 @@ ident_done:
return type;
 }
 
-static int nand_dt_init(struct mtd_info *mtd, struct nand_chip *chip,
-   struct device_node *dn)
+static int nand_dt_init(struct nand_chip *chip)
 {
+   struct device_node *dn = nand_get_flash_node(chip);
int ecc_mode, ecc_strength, ecc_step;
 
+   if (!dn)
+   return 0;
+
+   /* MTD can automatically handle DT partitions, etc. */
+   mtd_set_of_node(nand_to_mtd(chip), dn);
+
if (of_get_nand_bus_width(dn) == 16)
chip->options |= NAND_BUSWIDTH_16;
 
@@ -3989,14 +3995,9 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
struct nand_flash_dev *type;
int ret;
 
-   if (nand_get_flash_node(chip)) {
-   /* MTD can automatically handle DT partitions, etc. */
-   mtd_set_of_node(mtd, nand_get_flash_node(chip));
-
-   ret = nand_dt_init(mtd, chip, nand_get_flash_node(chip));
-   if (ret)
-   return ret;
-   }
+   ret = nand_dt_init(chip);
+   if (ret)
+   return ret;
 
/* Set the default functions */
nand_set_defaults(chip, chip->options & NAND_BUSWIDTH_16);
-- 
2.1.4

-- 
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 v2 06/25] mtd: nand: make use of mtd_to_nand() in NAND core code

2015-12-01 Thread Boris Brezillon
mtd_to_nand() was recently introduced to avoid direct access to the
mtd->priv field. Update core code to use mtd_to_nand().

Signed-off-by: Boris Brezillon 
---
 drivers/mtd/nand/nand_base.c | 84 ++--
 drivers/mtd/nand/nand_bbt.c  | 32 -
 drivers/mtd/nand/nand_bch.c  |  4 +--
 drivers/mtd/nand/nand_ecc.c  |  4 +--
 drivers/mtd/nand/nandsim.c   | 18 +-
 5 files changed, 71 insertions(+), 71 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 0748a13..5aec154 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -106,7 +106,7 @@ DEFINE_LED_TRIGGER(nand_led_trigger);
 static int check_offs_len(struct mtd_info *mtd,
loff_t ofs, uint64_t len)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
int ret = 0;
 
/* Start address must align on block boundary */
@@ -132,7 +132,7 @@ static int check_offs_len(struct mtd_info *mtd,
  */
 static void nand_release_device(struct mtd_info *mtd)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
 
/* Release the controller and the chip */
spin_lock(>controller->lock);
@@ -150,7 +150,7 @@ static void nand_release_device(struct mtd_info *mtd)
  */
 static uint8_t nand_read_byte(struct mtd_info *mtd)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
return readb(chip->IO_ADDR_R);
 }
 
@@ -163,7 +163,7 @@ static uint8_t nand_read_byte(struct mtd_info *mtd)
  */
 static uint8_t nand_read_byte16(struct mtd_info *mtd)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
return (uint8_t) cpu_to_le16(readw(chip->IO_ADDR_R));
 }
 
@@ -175,7 +175,7 @@ static uint8_t nand_read_byte16(struct mtd_info *mtd)
  */
 static u16 nand_read_word(struct mtd_info *mtd)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
return readw(chip->IO_ADDR_R);
 }
 
@@ -188,7 +188,7 @@ static u16 nand_read_word(struct mtd_info *mtd)
  */
 static void nand_select_chip(struct mtd_info *mtd, int chipnr)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
 
switch (chipnr) {
case -1:
@@ -211,7 +211,7 @@ static void nand_select_chip(struct mtd_info *mtd, int 
chipnr)
  */
 static void nand_write_byte(struct mtd_info *mtd, uint8_t byte)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
 
chip->write_buf(mtd, , 1);
 }
@@ -225,7 +225,7 @@ static void nand_write_byte(struct mtd_info *mtd, uint8_t 
byte)
  */
 static void nand_write_byte16(struct mtd_info *mtd, uint8_t byte)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
uint16_t word = byte;
 
/*
@@ -257,7 +257,7 @@ static void nand_write_byte16(struct mtd_info *mtd, uint8_t 
byte)
  */
 static void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
 
iowrite8_rep(chip->IO_ADDR_W, buf, len);
 }
@@ -272,7 +272,7 @@ static void nand_write_buf(struct mtd_info *mtd, const 
uint8_t *buf, int len)
  */
 static void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
 
ioread8_rep(chip->IO_ADDR_R, buf, len);
 }
@@ -287,7 +287,7 @@ static void nand_read_buf(struct mtd_info *mtd, uint8_t 
*buf, int len)
  */
 static void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
u16 *p = (u16 *) buf;
 
iowrite16_rep(chip->IO_ADDR_W, p, len >> 1);
@@ -303,7 +303,7 @@ static void nand_write_buf16(struct mtd_info *mtd, const 
uint8_t *buf, int len)
  */
 static void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len)
 {
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
u16 *p = (u16 *) buf;
 
ioread16_rep(chip->IO_ADDR_R, p, len >> 1);
@@ -320,7 +320,7 @@ static void nand_read_buf16(struct mtd_info *mtd, uint8_t 
*buf, int len)
 static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
 {
int page, chipnr, res = 0, i = 0;
-   struct nand_chip *chip = mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
u16 bad;
 
if (chip->bbt_options & NAND_BBT_SCANLASTPAGE)
@@ -380,7 +380,7 @@ static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, 
int getchip)
  */
 static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
 {
-   

[linux-sunxi] [PATCH v2 19/25] staging: mt29f_spinand: remove useless mtd->priv = chip assignment

2015-12-01 Thread Boris Brezillon
mtd_to_nand() now uses the container_of() approach to transform an
mtd_info pointer into a nand_chip one. Drop useless mtd->priv
assignments from NAND controller drivers.

Signed-off-by: Boris Brezillon 
---
Patch generated with the following coccinelle script:

---8<
virtual patch

@@
struct mtd_info m;
struct mtd_info *mp;
struct nand_chip *c;
@@
(
-(m).priv = c;
|
-(mp)->priv = c;
|
-(mp)->priv = (void *)c;
)
---8<
---
 drivers/staging/mt29f_spinand/mt29f_spinand.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c 
b/drivers/staging/mt29f_spinand/mt29f_spinand.c
index 8171b74..b7d429d 100644
--- a/drivers/staging/mt29f_spinand/mt29f_spinand.c
+++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c
@@ -907,7 +907,6 @@ static int spinand_probe(struct spi_device *spi_nand)
 
dev_set_drvdata(_nand->dev, mtd);
 
-   mtd->priv = chip;
mtd->dev.parent = _nand->dev;
mtd->oobsize = 64;
 
-- 
2.1.4

-- 
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 v2 13/25] mtd: nand: update the documentation to reflect framework changes

2015-12-01 Thread Boris Brezillon
The MTD device is now directly embedded in the nand_chip struct. Update the
mtdnand documentation to mention this aspect and fix the different
examples.

Signed-off-by: Boris Brezillon 
---
 Documentation/DocBook/mtdnand.tmpl | 31 +++
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/Documentation/DocBook/mtdnand.tmpl 
b/Documentation/DocBook/mtdnand.tmpl
index 403a7ab..b442921 100644
--- a/Documentation/DocBook/mtdnand.tmpl
+++ b/Documentation/DocBook/mtdnand.tmpl
@@ -162,12 +162,15 @@

Basic defines

-   At least you have to provide a mtd structure and
-   a storage for the ioremap'ed chip address.
-   You can allocate the mtd structure using kmalloc
-   or you can allocate it statically.
-   In case of static allocation you have to allocate
-   a nand_chip structure too.
+   At least you have to provide a nand_chip structure
+   and a storage for the ioremap'ed chip address.
+   You can allocate the nand_chip structure using
+   kmalloc or you can allocate it statically.
+   The NAND chip structure embeds an mtd structure
+   which will be registered to the MTD subsystem.
+   You can extract a pointer to the mtd structure
+   from a nand_chip pointer using the nand_to_mtd()
+   helper.


Kmalloc based example
@@ -180,7 +183,6 @@ static void __iomem *baseaddr;
Static example


-static struct mtd_info board_mtd;
 static struct nand_chip board_chip;
 static void __iomem *baseaddr;

@@ -274,13 +276,15 @@ static int __init board_init (void)
int err = 0;
 
/* Allocate memory for MTD device structure and private data */
-   board_mtd = kzalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), 
GFP_KERNEL);
-   if (!board_mtd) {
+   this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
+   if (!this) {
printk ("Unable to allocate NAND MTD device structure.\n");
err = -ENOMEM;
goto out;
}
 
+   board_mtd = nand_to_mtd(this);
+
/* map physical address */
baseaddr = ioremap(CHIP_PHYSICAL_ADDRESS, 1024);
if (!baseaddr) {
@@ -289,11 +293,6 @@ static int __init board_init (void)
goto out_mtd;
}
 
-   /* Get pointer to private data */
-   this = (struct nand_chip *) ();
-   /* Link the private data with the MTD structure */
-   board_mtd->priv = this;
-
/* Set address of NAND IO lines */
this->IO_ADDR_R = baseaddr;
this->IO_ADDR_W = baseaddr;
@@ -317,7 +316,7 @@ static int __init board_init (void)
 out_ior:
iounmap(baseaddr);
 out_mtd:
-   kfree (board_mtd);
+   kfree (this);
 out:
return err;
 }
@@ -343,7 +342,7 @@ static void __exit board_cleanup (void)
iounmap(baseaddr);

/* Free the MTD device structure */
-   kfree (board_mtd);
+   kfree (mtd_to_nand(board_mtd));
 }
 module_exit(board_cleanup);
 #endif
-- 
2.1.4

-- 
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 v2 09/25] mtd: nand: embed an mtd_info structure into nand_chip

2015-12-01 Thread Boris Brezillon
Currently all NAND controller drivers are providing both the mtd_info and
nand_chip struct and then let the NAND subsystem to initialize a few
things before registering the mtd instance to the MTD layer.
Embed an mtd_info field into nand_chip to add some consistency to all NAND
controller drivers.
This change will also help factorizing boilerplate code copied in all NAND
drivers.

Signed-off-by: Boris Brezillon 
---
 include/linux/mtd/nand.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 056d165..c4e39ff 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -540,6 +540,7 @@ struct nand_buffers {
 
 /**
  * struct nand_chip - NAND Private Flash Chip Data
+ * @mtd:   MTD device registered to the MTD framework
  * @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of the
  * flash device
  * @IO_ADDR_W: [BOARDSPECIFIC] address to write the 8 I/O lines of the
@@ -640,6 +641,7 @@ struct nand_buffers {
  */
 
 struct nand_chip {
+   struct mtd_info mtd;
void __iomem *IO_ADDR_R;
void __iomem *IO_ADDR_W;
 
-- 
2.1.4

-- 
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 v2 16/25] mtd: nand: update mtd_to_nand()

2015-12-01 Thread Boris Brezillon
Now that all drivers are using the mtd instance embedded in the nand_chip
struct we can safely update the mtd_to_nand() implementation to use
the container_of macro instead of returning the content of mtd->priv.
This will allow us to remove mtd->priv = chip assignments done in all
NAND controller drivers.

Signed-off-by: Boris Brezillon 
---
 include/linux/mtd/nand.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 8ec071e..873646d 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -734,7 +734,7 @@ static inline struct device_node 
*nand_get_flash_node(struct nand_chip *chip)
 
 static inline struct nand_chip *mtd_to_nand(struct mtd_info *mtd)
 {
-   return mtd->priv;
+   return container_of(mtd, struct nand_chip, mtd);
 }
 
 static inline struct mtd_info *nand_to_mtd(struct nand_chip *chip)
-- 
2.1.4

-- 
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 v2 15/25] cris: nand: use the mtd instance embedded in struct nand_chip

2015-12-01 Thread Boris Brezillon
struct nand_chip now embeds an mtd device. Patch all drivers to make use
of this mtd instance instead of using the instance embedded in their
private struct or dynamically allocated.

Signed-off-by: Boris Brezillon 
---
Most of those changes were generated with the coccinelle script added
in commit c671312 "coccinelle: nand: detect and correct drivers embedding
an mtd_info object"
---
 arch/cris/arch-v32/drivers/mach-a3/nandflash.c | 3 +--
 arch/cris/arch-v32/drivers/mach-fs/nandflash.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/cris/arch-v32/drivers/mach-a3/nandflash.c 
b/arch/cris/arch-v32/drivers/mach-a3/nandflash.c
index db953cf..ee74e45 100644
--- a/arch/cris/arch-v32/drivers/mach-a3/nandflash.c
+++ b/arch/cris/arch-v32/drivers/mach-a3/nandflash.c
@@ -36,7 +36,6 @@
 #define CE_BIT 12
 
 struct mtd_info_wrapper {
-   struct mtd_info info;
struct nand_chip chip;
 };
 
@@ -148,7 +147,7 @@ struct mtd_info *__init crisv32_nand_flash_probe(void)
 
/* Get pointer to private data */
this = >chip;
-   crisv32_mtd = >info;
+   crisv32_mtd = nand_to_mtd(this);
 
/* Link the private data with the MTD structure */
crisv32_mtd->priv = this;
diff --git a/arch/cris/arch-v32/drivers/mach-fs/nandflash.c 
b/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
index 22a6467..5626297 100644
--- a/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
+++ b/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
@@ -31,7 +31,6 @@
 #define BY_BIT 7
 
 struct mtd_info_wrapper {
-   struct mtd_info info;
struct nand_chip chip;
 };
 
@@ -129,7 +128,7 @@ struct mtd_info *__init crisv32_nand_flash_probe(void)
 
/* Get pointer to private data */
this = >chip;
-   crisv32_mtd = >info;
+   crisv32_mtd = nand_to_mtd(this);
 
pa_oe.oe |= 1 << CE_BIT;
pa_oe.oe |= 1 << ALE_BIT;
-- 
2.1.4

-- 
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 v2 22/25] mtd: nand: add helpers to access ->priv

2015-12-01 Thread Boris Brezillon
Add two helpers to access the field reserved for private controller data.
This makes it clearer what this field is reserved for and ease future
refactoring.

Signed-off-by: Boris Brezillon 
---
 include/linux/mtd/nand.h | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index f12efe1..4afa263 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -739,6 +739,16 @@ static inline struct mtd_info *nand_to_mtd(struct 
nand_chip *chip)
return >mtd;
 }
 
+static inline void *nand_get_controller_data(struct nand_chip *chip)
+{
+   return chip->priv;
+}
+
+static inline void nand_set_controller_data(struct nand_chip *chip, void *priv)
+{
+   chip->priv = priv;
+}
+
 /*
  * NAND Flash Manufacturer ID Codes
  */
-- 
2.1.4

-- 
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 v2 21/25] mtd: nand: kill the chip->flash_node field

2015-12-01 Thread Boris Brezillon
Now that the nand_chip struct directly embeds an mtd_info struct we can
get rid of the ->flash_node field and forward set/get_flash_node requests
to the MTD layer.

As a side effect, we no longer need the mtd_set_of_node() call done in
nand_dt_init().

Signed-off-by: Boris Brezillon 
---
 drivers/mtd/nand/nand_base.c | 3 ---
 include/linux/mtd/nand.h | 7 ++-
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index ae3fd2a..8bb8ebd6 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3945,9 +3945,6 @@ static int nand_dt_init(struct nand_chip *chip)
if (!dn)
return 0;
 
-   /* MTD can automatically handle DT partitions, etc. */
-   mtd_set_of_node(nand_to_mtd(chip), dn);
-
if (of_get_nand_bus_width(dn) == 16)
chip->options |= NAND_BUSWIDTH_16;
 
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 873646d..f12efe1 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -545,7 +545,6 @@ struct nand_buffers {
  * flash device
  * @IO_ADDR_W: [BOARDSPECIFIC] address to write the 8 I/O lines of the
  * flash device.
- * @flash_node:[BOARDSPECIFIC] device node describing this 
instance
  * @read_byte: [REPLACEABLE] read one byte from the chip
  * @read_word: [REPLACEABLE] read one word from the chip
  * @write_byte:[REPLACEABLE] write a single byte to the chip 
on the
@@ -645,8 +644,6 @@ struct nand_chip {
void __iomem *IO_ADDR_R;
void __iomem *IO_ADDR_W;
 
-   struct device_node *flash_node;
-
uint8_t (*read_byte)(struct mtd_info *mtd);
u16 (*read_word)(struct mtd_info *mtd);
void (*write_byte)(struct mtd_info *mtd, uint8_t byte);
@@ -724,12 +721,12 @@ struct nand_chip {
 static inline void nand_set_flash_node(struct nand_chip *chip,
   struct device_node *np)
 {
-   chip->flash_node = np;
+   mtd_set_of_node(>mtd, np);
 }
 
 static inline struct device_node *nand_get_flash_node(struct nand_chip *chip)
 {
-   return chip->flash_node;
+   return mtd_get_of_node(>mtd);
 }
 
 static inline struct nand_chip *mtd_to_nand(struct mtd_info *mtd)
-- 
2.1.4

-- 
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 v2 25/25] staging: mt29f_spinand: make use of nand_set/get_controller_data() helpers

2015-12-01 Thread Boris Brezillon
New helpers have been added to avoid directly accessing chip->field. Use
them where appropriate.

Signed-off-by: Boris Brezillon 
---
 drivers/staging/mt29f_spinand/mt29f_spinand.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c 
b/drivers/staging/mt29f_spinand/mt29f_spinand.c
index b7d429d..5b3027a 100644
--- a/drivers/staging/mt29f_spinand/mt29f_spinand.c
+++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c
@@ -32,7 +32,7 @@
 static inline struct spinand_state *mtd_to_state(struct mtd_info *mtd)
 {
struct nand_chip *chip = mtd_to_nand(mtd);
-   struct spinand_info *info = (struct spinand_info *)chip->priv;
+   struct spinand_info *info = (struct spinand_info 
*)nand_get_controller_data(chip);
struct spinand_state *state = (struct spinand_state *)info->priv;
 
return state;
@@ -633,7 +633,7 @@ static int spinand_read_page_hwecc(struct mtd_info *mtd, 
struct nand_chip *chip,
u8 *p = buf;
int eccsize = chip->ecc.size;
int eccsteps = chip->ecc.steps;
-   struct spinand_info *info = (struct spinand_info *)chip->priv;
+   struct spinand_info *info = (struct spinand_info 
*)nand_get_controller_data(chip);
 
enable_read_hw_ecc = 1;
 
@@ -679,7 +679,7 @@ static u8 spinand_read_byte(struct mtd_info *mtd)
 
 static int spinand_wait(struct mtd_info *mtd, struct nand_chip *chip)
 {
-   struct spinand_info *info = (struct spinand_info *)chip->priv;
+   struct spinand_info *info = (struct spinand_info 
*)nand_get_controller_data(chip);
 
unsigned long timeo = jiffies;
int retval, state = chip->state;
@@ -745,7 +745,7 @@ static void spinand_cmdfunc(struct mtd_info *mtd, unsigned 
int command,
int column, int page)
 {
struct nand_chip *chip = mtd_to_nand(mtd);
-   struct spinand_info *info = (struct spinand_info *)chip->priv;
+   struct spinand_info *info = (struct spinand_info 
*)nand_get_controller_data(chip);
struct spinand_state *state = (struct spinand_state *)info->priv;
 
switch (command) {
@@ -894,7 +894,7 @@ static int spinand_probe(struct spi_device *spi_nand)
 #endif
 
nand_set_flash_node(chip, spi_nand->dev.of_node);
-   chip->priv  = info;
+   nand_set_controller_data(chip, info);
chip->read_buf  = spinand_read_buf;
chip->write_buf = spinand_write_buf;
chip->read_byte = spinand_read_byte;
-- 
2.1.4

-- 
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 v2 08/25] staging: mt29f_spinand: make use of mtd_to_nand()

2015-12-01 Thread Boris Brezillon
mtd_to_nand() was recently introduced to avoid direct accesses to the
mtd->priv field. Use it where appropriate.

Signed-off-by: Boris Brezillon 
---
 drivers/staging/mt29f_spinand/mt29f_spinand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c 
b/drivers/staging/mt29f_spinand/mt29f_spinand.c
index 6536066..8924a96 100644
--- a/drivers/staging/mt29f_spinand/mt29f_spinand.c
+++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c
@@ -31,7 +31,7 @@
 
 static inline struct spinand_state *mtd_to_state(struct mtd_info *mtd)
 {
-   struct nand_chip *chip = (struct nand_chip *)mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
struct spinand_info *info = (struct spinand_info *)chip->priv;
struct spinand_state *state = (struct spinand_state *)info->priv;
 
@@ -744,7 +744,7 @@ static void spinand_reset(struct spi_device *spi_nand)
 static void spinand_cmdfunc(struct mtd_info *mtd, unsigned int command,
int column, int page)
 {
-   struct nand_chip *chip = (struct nand_chip *)mtd->priv;
+   struct nand_chip *chip = mtd_to_nand(mtd);
struct spinand_info *info = (struct spinand_info *)chip->priv;
struct spinand_state *state = (struct spinand_state *)info->priv;
 
-- 
2.1.4

-- 
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] clk_out_a usage in mainline

2015-12-01 Thread Chen-Yu Tsai
On Tue, Dec 1, 2015 at 11:01 PM, Danny Milosavljevic
 wrote:
> Hi Maxime,
>
> On Tue, 1 Dec 2015 10:47:37 +0100
> Maxime Ripard  wrote:
>> Did you mux the clk_out pin somewhere?
>
> Not manually, no. Is that not done by the sunxi clock driver when
> preparing/enabling the clock?

You mux the clock output on the output pin by adding a pinctrl phandle
in whatever device node you are using it for.

> Also since the signal flatlined, I think clk_prepare_enable did
> *something*. (it probably switched away from the GPIO function; a
> shell script to simulate a poor-mans clock using GPIO was still running
> but the scope didn't show it anymore afterwards)

AFAIK the clock code does no such thing.

>
> (I thought clk_out_a was initially introduced by Chen-Yu
> Tsai for the Cubietruck Wifi but I can't find where the Wifi driver|dts
> muxes clk_out_a in 4.4-rc2 either)

It was supposed to be part of the Bluetooth support. The BT part of the
combo chip needs the clock signal, while the WiFi part doesn't. I've not
updated any of it yet.


ChenYu

>> Did you enable the clock?
>
> Back then, I enabled it very directly in
> ,
> search for "clk_prepare_enable". (I used the low clock rate so I could
> have seen it on my cheap scope if it worked)
>
> (Now it's nicer (but still doesn't work),
> 
> - and it needs extra device tree attributes now)
>
> Thanks,
>Danny
>
> --
> 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.

-- 
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 v3 2/2] phy-sun4i-usb: Add support for the host usb-phys found on the H3 SoC

2015-12-01 Thread Priit Laes
On Wed, 2015-11-25 at 17:50 +0100, Hans de Goede wrote:
> From: Reinder de Haan 
> 
> Note this commit only adds support for phys 1-3, phy 0, the otg phy,
> is
> not yet (fully) supported after this commit.
> 
> Signed-off-by: Reinder de Haan 
> Signed-off-by: Hans de Goede 
> ---
> Changes in v2:
> -Change break; after dev_err() to return, as intended, fixing a
> compiler
>  warning (the dev_err case should never be reached)
> Changes in v3:
> -Use of_match_node to get model specific config data
> ---
>  .../devicetree/bindings/phy/sun4i-usb-phy.txt  |  1 +
>  drivers/phy/phy-sun4i-usb.c| 46
> +-
>  2 files changed, 38 insertions(+), 9 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt
> b/Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt
> index 0cebf74..95736d7 100644
> --- a/Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt
> @@ -9,6 +9,7 @@ Required properties:
>    * allwinner,sun7i-a20-usb-phy
>    * allwinner,sun8i-a23-usb-phy
>    * allwinner,sun8i-a33-usb-phy
> +  * allwinner,sun8i-h3-usb-phy
>  - reg : a list of offset + length pairs
>  - reg-names :
>    * "phy_ctrl"
> diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-
> usb.c
> index 1d8f85d..2aed482 100644
> --- a/drivers/phy/phy-sun4i-usb.c
> +++ b/drivers/phy/phy-sun4i-usb.c
> @@ -46,6 +46,9 @@
>  #define REG_PHYBIST  0x08
>  #define REG_PHYTUNE  0x0c
>  #define REG_PHYCTL_A33   0x10
> +#define REG_PHY_UNK_H3   0x20
> +
> +#define REG_PMU_UNK_H3   0x10
>  
>  #define PHYCTL_DATA  BIT(7)
>  
> @@ -79,7 +82,7 @@
>  #define PHY_DISCON_TH_SEL0x2a
>  #define PHY_SQUELCH_DETECT   0x3c
>  
> -#define MAX_PHYS 3
> +#define MAX_PHYS 4
>  
>  /*
>   * Note do not raise the debounce time, we must report Vusb high
> within 100ms
> @@ -91,6 +94,7 @@
>  enum sun4i_usb_phy_type {
>   sun4i_a10_phy,
>   sun8i_a33_phy,
> + sun8i_h3_phy,
>  };
>  
>  struct sun4i_usb_phy_cfg {
> @@ -101,6 +105,7 @@ struct sun4i_usb_phy_cfg {
>  };
>  
>  struct sun4i_usb_phy_data {
> + struct device *dev;
>   void __iomem *base;
>   const struct sun4i_usb_phy_cfg *cfg;
>   struct mutex mutex;
> @@ -183,6 +188,9 @@ static void sun4i_usb_phy_write(struct
> sun4i_usb_phy *phy, u32 addr, u32 data,
>   /* A33 needs us to set phyctl to 0 explicitly */
>   writel(0, phyctl);
>   break;
> + case sun8i_h3_phy:
> + dev_err(phy_data->dev, "H3 usb_phy_write is not
> supported\n");

You should unlock the mutex here.

> + return;

Also, it might make sense to add default case what WARN's on invalid
enum.

>   }
>  
>   for (i = 0; i < len; i++) {
> @@ -243,6 +251,7 @@ static int sun4i_usb_phy_init(struct phy *_phy)
>   struct sun4i_usb_phy *phy = phy_get_drvdata(_phy);
>   struct sun4i_usb_phy_data *data =
> to_sun4i_usb_phy_data(phy);
>   int ret;
> + u32 val;
>  
>   ret = clk_prepare_enable(phy->clk);
>   if (ret)
> @@ -254,16 +263,26 @@ static int sun4i_usb_phy_init(struct phy *_phy)
>   return ret;
>   }
>  
> - /* Enable USB 45 Ohm resistor calibration */
> - if (phy->index == 0)
> - sun4i_usb_phy_write(phy, PHY_RES45_CAL_EN, 0x01, 1);
> + if (data->cfg->type == sun8i_h3_phy) {
> + if (phy->index == 0) {
> + val = readl(data->base + REG_PHY_UNK_H3);
> + writel(val & ~1, data->base +
> REG_PHY_UNK_H3);
> + }
>  
> - /* Adjust PHY's magnitude and rate */
> - sun4i_usb_phy_write(phy, PHY_TX_AMPLITUDE_TUNE, 0x14, 5);
> + val = readl(phy->pmu + REG_PMU_UNK_H3);
> + writel(val & ~2, phy->pmu + REG_PMU_UNK_H3);
> + } else {
> + /* Enable USB 45 Ohm resistor calibration */
> + if (phy->index == 0)
> + sun4i_usb_phy_write(phy, PHY_RES45_CAL_EN,
> 0x01, 1);
>  
> - /* Disconnect threshold adjustment */
> - sun4i_usb_phy_write(phy, PHY_DISCON_TH_SEL,
> - data->cfg->disc_thresh, 2);
> + /* Adjust PHY's magnitude and rate */
> + sun4i_usb_phy_write(phy, PHY_TX_AMPLITUDE_TUNE,
> 0x14, 5);
> +
> + /* Disconnect threshold adjustment */
> + sun4i_usb_phy_write(phy, PHY_DISCON_TH_SEL,
> + data->cfg->disc_thresh, 2);
> + }
>  
>   sun4i_usb_phy_passby(phy, 1);
>  
> @@ -555,6 +574,13 @@ static const struct sun4i_usb_phy_cfg
> sun8i_a33_cfg = {
>   .dedicated_clocks = true,
>  };
>  
> +static const struct sun4i_usb_phy_cfg sun8i_h3_cfg = {
> + .num_phys = 4,
> + 

[linux-sunxi] Re: [PATCH v4 2/5] clk: sunxi: Add sun9i A80 apbs gates support

2015-12-01 Thread Maxime Ripard
On Mon, Nov 30, 2015 at 11:14:06AM -0600, Rob Herring wrote:
> On Sun, Nov 29, 2015 at 11:03:07AM +0800, Chen-Yu Tsai wrote:
> > This patch adds support for the PRCM apbs clock gates found on the
> > Allwinner A80 SoC.
> > 
> > Signed-off-by: Chen-Yu Tsai 
> 
> Acked-by: Rob Herring 

Applied, thanks!

Maxime

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

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


signature.asc
Description: Digital signature


[linux-sunxi] Re: [PATCH v2 12/25] mtd: nand: use the mtd instance embedded in struct nand_chip

2015-12-01 Thread kbuild test robot
Hi Boris,

[auto build test ERROR on next-20151127]
[cannot apply to mtd/master v4.4-rc3 v4.4-rc2 v4.4-rc1 v4.4-rc3]

url:
https://github.com/0day-ci/linux/commits/Boris-Brezillon/mtd-nand-refactor-the-NAND-subsystem-part-1/20151201-190822
config: arm-imx_v6_v7_defconfig (attached as .config)
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   drivers/mtd/nand/gpmi-nand/gpmi-nand.c: In function 
'set_geometry_by_ecc_info':
>> drivers/mtd/nand/gpmi-nand/gpmi-nand.c:142:39: error: 'mtd' undeclared 
>> (first use in this function)
 struct nand_chip *chip = mtd_to_nand(mtd);
  ^
   drivers/mtd/nand/gpmi-nand/gpmi-nand.c:142:39: note: each undeclared 
identifier is reported only once for each function it appears in
   drivers/mtd/nand/gpmi-nand/gpmi-nand.c: In function 'gpmi_init_last':
   drivers/mtd/nand/gpmi-nand/gpmi-nand.c:1840:39: error: 'mtd' undeclared 
(first use in this function)
 struct nand_chip *chip = mtd_to_nand(mtd);
  ^
   drivers/mtd/nand/gpmi-nand/gpmi-nand.c:1841:19: warning: unused variable 
'mtd' [-Wunused-variable]
 struct mtd_info *mtd = nand_to_mtd(chip);
  ^

vim +/mtd +142 drivers/mtd/nand/gpmi-nand/gpmi-nand.c

2febcdf84 Huang Shijie2013-05-17  136   *
2febcdf84 Huang Shijie2013-05-17  137   * We may have available oob space 
in this case.
2febcdf84 Huang Shijie2013-05-17  138   */
2febcdf84 Huang Shijie2013-05-17  139  static bool 
set_geometry_by_ecc_info(struct gpmi_nand_data *this)
2febcdf84 Huang Shijie2013-05-17  140  {
2febcdf84 Huang Shijie2013-05-17  141   struct bch_geometry *geo = 
>bch_geometry;
6bdedcfa5 Boris Brezillon 2015-12-01 @142   struct nand_chip *chip = 
mtd_to_nand(mtd);
4864cfd67 Boris Brezillon 2015-12-01  143   struct mtd_info *mtd = 
nand_to_mtd(chip);
2febcdf84 Huang Shijie2013-05-17  144   struct nand_oobfree *of = 
gpmi_hw_ecclayout.oobfree;
2febcdf84 Huang Shijie2013-05-17  145   unsigned int 
block_mark_bit_offset;

:: The code at line 142 was first introduced by commit
:: 6bdedcfa57b52f471682054a599855677b1b132c mtd: nand: make use of 
mtd_to_nand() in NAND drivers

:: TO: Boris Brezillon <boris.brezil...@free-electrons.com>
:: CC: 0day robot <fengguang...@intel.com>

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation

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


.config.gz
Description: Binary data


[linux-sunxi] Re: [PATCH v4 1/5] clk: sunxi: Add CLK_OF_DECLARE support for sun8i-a23-apb0-clk driver

2015-12-01 Thread Maxime Ripard
On Tue, Dec 01, 2015 at 07:54:06PM +0800, Chen-Yu Tsai wrote:
> On Tue, Dec 1, 2015 at 6:04 PM, Maxime Ripard
>  wrote:
> > Hi,
> >
> > On Sun, Nov 29, 2015 at 11:03:06AM +0800, Chen-Yu Tsai wrote:
> >> The APBS clock on sun9i is the same as the APB0 clock on sun8i. With
> >> sun9i we are supporting the PRCM clocks by using CLK_OF_DECLARE,
> >> instead of through a PRCM mfd device and subdevices for each clock
> >> and reset control. As such we need a CLK_OF_DECLARE version of
> >> the sun8i-a23-apb0-clk driver.
> >>
> >> Also, build it for sun9i/A80, and not just for configurations with
> >> MFD_SUN6I_PRCM enabled.
> >>
> >> Signed-off-by: Chen-Yu Tsai 
> >> ---
> >>  drivers/clk/sunxi/Makefile |  5 +--
> >>  drivers/clk/sunxi/clk-sun8i-apb0.c | 71 
> >> +++---
> >>  2 files changed, 62 insertions(+), 14 deletions(-)
> >>
> >> diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile
> >> index cb4c299214ce..c55d5cd1c0e5 100644
> >> --- a/drivers/clk/sunxi/Makefile
> >> +++ b/drivers/clk/sunxi/Makefile
> >> @@ -15,6 +15,7 @@ obj-y += clk-sun9i-core.o
> >>  obj-y += clk-sun9i-mmc.o
> >>  obj-y += clk-usb.o
> >>
> >> +obj-$(CONFIG_MACH_SUN9I) += clk-sun8i-apb0.o
> >> +
> >
> > So sun8i doesn't use it?
> 
> Shit... I messed up. clk-sun8i-apb0.o should also be under
> CONFIG_MFD_SUN6I_PRCM.
> 
> I'll send a new version of this patch. No need to keep spamming
> people with the whole series.

Ok.

> >>  obj-$(CONFIG_MFD_SUN6I_PRCM) += \
> >> - clk-sun6i-ar100.o clk-sun6i-apb0.o clk-sun6i-apb0-gates.o \
> >> - clk-sun8i-apb0.o
> >> + clk-sun6i-ar100.o clk-sun6i-apb0.o clk-sun6i-apb0-gates.o
> >> diff --git a/drivers/clk/sunxi/clk-sun8i-apb0.c 
> >> b/drivers/clk/sunxi/clk-sun8i-apb0.c
> >> index 7ae5d2c2cde1..c1e2ac8f4b0d 100644
> >> --- a/drivers/clk/sunxi/clk-sun8i-apb0.c
> >> +++ b/drivers/clk/sunxi/clk-sun8i-apb0.c
> >> @@ -17,13 +17,68 @@
> >>  #include 
> >>  #include 
> >>  #include 
> >> +#include 
> >>  #include 
> >>
> >> +static struct clk *sun8i_a23_apb0_register(struct device_node *node,
> >> +void __iomem *reg)
> >> +{
> >> + const char *clk_name = node->name;
> >> + const char *clk_parent;
> >> + struct clk *clk;
> >> + int ret;
> >> +
> >> + clk_parent = of_clk_get_parent_name(node, 0);
> >> + if (!clk_parent)
> >> + return ERR_PTR(-EINVAL);
> >> +
> >> + of_property_read_string(node, "clock-output-names", _name);
> >> +
> >> + /* The A23 APB0 clock is a standard 2 bit wide divider clock */
> >> + clk = clk_register_divider(NULL, clk_name, clk_parent, 0, reg,
> >> +0, 2, CLK_DIVIDER_POWER_OF_TWO, NULL);
> >> + if (IS_ERR(clk))
> >> + return clk;
> >> +
> >> + ret = of_clk_add_provider(node, of_clk_src_simple_get, clk);
> >> + if (ret)
> >> + goto err_unregister;
> >> +
> >> + return clk;
> >> +
> >> +err_unregister:
> >> + clk_unregister_divider(clk);
> >> +
> >> + return ERR_PTR(ret);
> >> +}
> >> +
> >> +static void sun8i_a23_apb0_setup(struct device_node *node)
> >> +{
> >> + void __iomem *reg;
> >> + struct resource res;
> >> + struct clk *clk;
> >> +
> >> + reg = of_io_request_and_map(node, 0, of_node_full_name(node));
> >> + if (IS_ERR(reg))
> >> + return;
> >> +
> >> + clk = sun8i_a23_apb0_register(node, reg);
> >> + if (IS_ERR(clk))
> >> + goto err_unmap;
> >> +
> >> + return;
> >> +
> >> +err_unmap:
> >> + iounmap(reg);
> >> + of_address_to_resource(node, 0, );
> >> + release_mem_region(res.start, resource_size());
> >> +}
> >> +CLK_OF_DECLARE(sun8i_a23_apb0, "allwinner,sun8i-a23-apb0-clk",
> >> +sun8i_a23_apb0_setup);
> >> +
> >>  static int sun8i_a23_apb0_clk_probe(struct platform_device *pdev)
> >>  {
> >>   struct device_node *np = pdev->dev.of_node;
> >> - const char *clk_name = np->name;
> >> - const char *clk_parent;
> >>   struct resource *r;
> >>   void __iomem *reg;
> >>   struct clk *clk;
> >> @@ -33,19 +88,11 @@ static int sun8i_a23_apb0_clk_probe(struct 
> >> platform_device *pdev)
> >>   if (IS_ERR(reg))
> >>   return PTR_ERR(reg);
> >>
> >> - clk_parent = of_clk_get_parent_name(np, 0);
> >> - if (!clk_parent)
> >> - return -EINVAL;
> >> -
> >> - of_property_read_string(np, "clock-output-names", _name);
> >> -
> >> - /* The A23 APB0 clock is a standard 2 bit wide divider clock */
> >> - clk = clk_register_divider(>dev, clk_name, clk_parent, 0, reg,
> >> -0, 2, CLK_DIVIDER_POWER_OF_TWO, NULL);
> >> + clk = sun8i_a23_apb0_register(np, reg);
> >>   if (IS_ERR(clk))
> >>   return PTR_ERR(clk);
> >>
> >> - return of_clk_add_provider(np, of_clk_src_simple_get, clk);
> >> + return 0;
> >>  }
> >
> 

[linux-sunxi] Re: [PATCH 2/7] ARM: dts: sun9i: Add A80 R_PIO pin controller device node

2015-12-01 Thread Maxime Ripard
On Tue, Dec 01, 2015 at 01:47:20PM +0800, Chen-Yu Tsai wrote:
> The A80 has a secondary pin controller. Add a device node for it.
> 
> Signed-off-by: Chen-Yu Tsai 

Applied, thanks!
Maxime

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

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


signature.asc
Description: Digital signature


[linux-sunxi] Re: [PATCH 3/7] ARM: dts: sun9i: optimus: Enable LED3

2015-12-01 Thread Maxime Ripard
On Tue, Dec 01, 2015 at 01:47:21PM +0800, Chen-Yu Tsai wrote:
> LED3 is connected to pin PM15 on R_PIO.
> 
> Signed-off-by: Chen-Yu Tsai 

Applied, thanks!
Maxime

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

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


signature.asc
Description: Digital signature


[linux-sunxi] Re: [PATCH v2 11/25] coccinelle: nand: detect and correct drivers embedding an mtd_info object

2015-12-01 Thread Julia Lawall


On Tue, 1 Dec 2015, Boris Brezillon wrote:

> Add nand-priv-no-mtd.cocci to detect and correct NAND controller drivers
> directly embedding an mtd_info struct in their private struct.
>
> Signed-off-by: Boris Brezillon 
> Cc: Julia Lawall 
> ---
> Hi Julia,
>
> Not sure this is the correct way to detect and fix offending drivers,
> but I get some warnings when launching coccicheck in org or report mode:
>
> "warning: fix2: inherited metavariable __chipfield not used in the -, +,
> or context code"
>
> Note that I don't get those warnings when running in patch mode.
>
> Any idea (feel free to propose a better solution to detect and fix those
> offending drivers)?

Hi,

Is this code generated with sgen?  If so, could you send me the original
semantic patch?

Another thing that is immediately apparent is that you have <... ...> on
the outside of one of the rules.  This should never be needed.

The warning suggests that your org and report versions are not doing as
much as the patch version.  If you have used sgen to generate the semantic
patch then that would be strange.  If you have hand written the whole
thing, then maybe you could simplify it to just do the patch version, and
then I can check it and run sgen on it to make a complete version.

julia

>
> Best Regards,
>
> Boris
> ---
>  scripts/coccinelle/api/nand-priv-no-mtd.cocci | 91 
> +++
>  1 file changed, 91 insertions(+)
>  create mode 100644 scripts/coccinelle/api/nand-priv-no-mtd.cocci
>
> diff --git a/scripts/coccinelle/api/nand-priv-no-mtd.cocci 
> b/scripts/coccinelle/api/nand-priv-no-mtd.cocci
> new file mode 100644
> index 000..b2c0c22
> --- /dev/null
> +++ b/scripts/coccinelle/api/nand-priv-no-mtd.cocci
> @@ -0,0 +1,91 @@
> +/// Fix NAND controller drivers declaring their own mtd_info struct instead
> +/// of the one provided in struct nand_chip.
> +///
> +// Confidence: Low
> +// Copyright: (C) 2015 Boris Brezillon GPL v2.
> +
> +virtual patch
> +virtual context
> +virtual org
> +virtual report
> +
> +@match1@
> +identifier __chipfield, __mtdfield;
> +type __type;
> +@@
> +(
> + __type {
> + ...
> + struct nand_chip __chipfield;
> + ...
> + struct mtd_info __mtdfield;
> + ...
> + };
> +|
> + __type {
> + ...
> + struct mtd_info __mtdfield;
> + ...
> + struct nand_chip __chipfield;
> + ...
> + };
> +)
> +
> +@fix1 depends on match1 && patch && !context && !org && !report@
> +identifier match1.__mtdfield;
> +type match1.__type;
> +@@
> + __type {
> + ...
> +-struct mtd_info __mtdfield;
> + ...
> + };
> +
> +@fix2 depends on match1 && patch && !context && !org && !report@
> +identifier match1.__chipfield, match1.__mtdfield;
> +identifier __subfield;
> +type match1.__type;
> +__type *__priv;
> +@@
> +<...
> +(
> +-__priv->__mtdfield.__subfield
> ++nand_to_mtd(&__priv->__chipfield)->__subfield
> +|
> +-&(__priv->__mtdfield)
> ++nand_to_mtd(&__priv->__chipfield)
> +)
> +...>
> +
> +// 
> 
> +
> +@fix1_context depends on match1 && !patch && (context || org || report)@
> +identifier match1.__mtdfield;
> +type match1.__type;
> +position j0;
> +@@
> +
> + __type {
> + ...
> +*struct mtd_info __mtdfield@j0;
> + ...
> + };
> +
> +// 
> 
> +
> +@script:python fix1_org depends on org@
> +j0 << fix1_context.j0;
> +@@
> +
> +msg = "struct nand_chip already embeds an mtd_info object (use 
> nand_to_mtd())."
> +coccilib.org.print_todo(j0[0], msg)
> +
> +// 
> 
> +
> +@script:python fix1_report depends on report@
> +j0 << fix1_context.j0;
> +@@
> +
> +msg = "struct nand_chip already embeds an mtd_info object (use 
> nand_to_mtd())."
> +coccilib.report.print_report(j0[0], msg)
> +
> --
> 2.1.4
>
>


[linux-sunxi] [PATCH v3 12/25] mtd: nand: use the mtd instance embedded in struct nand_chip

2015-12-01 Thread Boris Brezillon
struct nand_chip now embeds an mtd device. Patch all drivers to make use
of this mtd instance instead of using the instance embedded in their
private struct or dynamically allocated.

Signed-off-by: Boris Brezillon 
Cc: Julia Lawall 
---
Most of those changes were generated with the coccinelle script added
in commit c671312 "coccinelle: nand: detect and correct drivers embedding
an mtd_info object"
---
Changes since v2:
- fix a compilation error in the gpmi-nand driver

 drivers/mtd/nand/ams-delta.c   | 13 ++--
 drivers/mtd/nand/atmel_nand.c  | 13 ++--
 drivers/mtd/nand/au1550nd.c| 19 ++---
 drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h |  1 -
 drivers/mtd/nand/bcm47xxnflash/main.c  |  8 ++-
 drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c   |  2 +-
 drivers/mtd/nand/bf5xx_nand.c  | 12 ++--
 drivers/mtd/nand/brcmnand/brcmnand.c   | 13 ++--
 drivers/mtd/nand/cafe_nand.c   |  8 +--
 drivers/mtd/nand/cmx270_nand.c | 11 ++-
 drivers/mtd/nand/cs553x_nand.c | 13 ++--
 drivers/mtd/nand/davinci_nand.c| 30 
 drivers/mtd/nand/denali.c  | 68 ++
 drivers/mtd/nand/denali.h  |  1 -
 drivers/mtd/nand/diskonchip.c  | 11 ++-
 drivers/mtd/nand/docg4.c   | 16 ++---
 drivers/mtd/nand/fsl_elbc_nand.c   | 26 ---
 drivers/mtd/nand/fsl_ifc_nand.c| 28 
 drivers/mtd/nand/fsl_upm.c | 28 
 drivers/mtd/nand/fsmc_nand.c   | 56 ---
 drivers/mtd/nand/gpio.c| 20 +++---
 drivers/mtd/nand/gpmi-nand/gpmi-lib.c  |  2 +-
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 24 +++
 drivers/mtd/nand/gpmi-nand/gpmi-nand.h |  1 -
 drivers/mtd/nand/hisi504_nand.c| 13 ++--
 drivers/mtd/nand/jz4740_nand.c |  9 ++-
 drivers/mtd/nand/lpc32xx_mlc.c |  7 +-
 drivers/mtd/nand/lpc32xx_slc.c |  7 +-
 drivers/mtd/nand/mpc5121_nfc.c |  3 +-
 drivers/mtd/nand/mxc_nand.c|  5 +-
 drivers/mtd/nand/nandsim.c | 12 ++--
 drivers/mtd/nand/ndfc.c| 24 ---
 drivers/mtd/nand/nuc900_nand.c | 24 +++
 drivers/mtd/nand/omap2.c   | 98 +++---
 drivers/mtd/nand/orion_nand.c  |  4 +-
 drivers/mtd/nand/pasemi_nand.c | 12 ++--
 drivers/mtd/nand/plat_nand.c   | 15 ++--
 drivers/mtd/nand/pxa3xx_nand.c | 33 -
 drivers/mtd/nand/r852.c| 34 -
 drivers/mtd/nand/r852.h|  1 -
 drivers/mtd/nand/s3c2410.c | 23 +++---
 drivers/mtd/nand/sh_flctl.c|  8 +--
 drivers/mtd/nand/sharpsl.c | 22 +++---
 drivers/mtd/nand/socrates_nand.c   |  5 +-
 drivers/mtd/nand/sunxi_nand.c  | 13 ++--
 drivers/mtd/nand/tmio_nand.c   | 10 +--
 drivers/mtd/nand/txx9ndfmc.c   |  3 +-
 drivers/mtd/nand/vf610_nfc.c   |  8 ++-
 include/linux/mtd/sh_flctl.h   |  3 +-
 49 files changed, 428 insertions(+), 392 deletions(-)

diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index b2b49c4..0f638c6 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -183,19 +183,16 @@ static int ams_delta_init(struct platform_device *pdev)
return -ENXIO;
 
/* Allocate memory for MTD device structure and private data */
-   ams_delta_mtd = kzalloc(sizeof(struct mtd_info) +
-   sizeof(struct nand_chip), GFP_KERNEL);
-   if (!ams_delta_mtd) {
+   this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
+   if (!this) {
printk (KERN_WARNING "Unable to allocate E3 NAND MTD device 
structure.\n");
err = -ENOMEM;
goto out;
}
 
+   ams_delta_mtd = nand_to_mtd(this);
ams_delta_mtd->owner = THIS_MODULE;
 
-   /* Get pointer to private data */
-   this = (struct nand_chip *) (_delta_mtd[1]);
-
/* Link the private data with the MTD structure */
ams_delta_mtd->priv = this;
 
@@ -256,7 +253,7 @@ out_gpio:
gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB);
iounmap(io_base);
 out_free:
-   kfree(ams_delta_mtd);
+   kfree(this);
  out:
return err;
 }
@@ -276,7 +273,7 @@ static int ams_delta_cleanup(struct platform_device *pdev)
iounmap(io_base);
 
/* Free the MTD device structure */
-   kfree(ams_delta_mtd);
+   kfree(mtd_to_nand(ams_delta_mtd));
 
return 0;
 }
diff --git 

[linux-sunxi] Re: [PATCH v4 5/5] ARM: dts: sun9i: Add TODO comments for the main and low power clocks

2015-12-01 Thread Maxime Ripard
On Sun, Nov 29, 2015 at 11:03:10AM +0800, Chen-Yu Tsai wrote:
> The main (24MHz) clock on the A80 is configurable via the PRCM address
> space. The low power/speed (32kHz) clock is from an external chip, the
> AC100.
> 
> Signed-off-by: Chen-Yu Tsai 

Applied 4 and 5, thanks!
Maxime

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

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


signature.asc
Description: Digital signature


[linux-sunxi] Re: [PATCH v4 3/5] clk: sunxi: Add sun9i A80 cpus (cpu special) clock support

2015-12-01 Thread Maxime Ripard
On Mon, Nov 30, 2015 at 11:13:25AM -0600, Rob Herring wrote:
> On Sun, Nov 29, 2015 at 11:03:08AM +0800, Chen-Yu Tsai wrote:
> > The "cpus" clock is the clock for the embedded processor in the A80.
> > It is also part of the PRCM clock tree. This clock includes a pre-
> > divider on one of its inputs. For now we are using a custom clock
> > driver for it. In the future we may want to develop a generalized
> > driver for these types of clocks, which also includes the AHB clock
> > driver on sun[5678]i.
> > 
> > Signed-off-by: Chen-Yu Tsai 
> > ---
> >  Documentation/devicetree/bindings/clock/sunxi.txt |   1 +
> 
> For the binding:
> 
> Acked-by: Rob Herring 

Applied, thanks!

Maxime

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

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


signature.asc
Description: Digital signature


[linux-sunxi] Re: [PATCH 4/7] ARM: dts: sun9i: Add consumer IR receiver device node and pinmux settings

2015-12-01 Thread Maxime Ripard
On Tue, Dec 01, 2015 at 01:47:22PM +0800, Chen-Yu Tsai wrote:
> The Allwinner A80 SoC has a consumer IR receiver, which is the same as
> older SoCs.
> 
> Signed-off-by: Chen-Yu Tsai 

Applied, thanks!
Maxime

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

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


signature.asc
Description: Digital signature


[linux-sunxi] Re: [PATCH 5/7] ARM: dts: sun9i: optimus: Enable consumer IR receiver

2015-12-01 Thread Maxime Ripard
On Tue, Dec 01, 2015 at 01:47:23PM +0800, Chen-Yu Tsai wrote:
> The A80 Optimus board has a consumer IR receiver. Enable it in the DT.
> 
> Signed-off-by: Chen-Yu Tsai 

Applied, thanks!
Maxime

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

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


signature.asc
Description: Digital signature


[linux-sunxi] Re: [PATCH 6/7] ARM: dts: sun9i: Add Reduced Serial Bus controller device node to A80 dtsi

2015-12-01 Thread Maxime Ripard
On Tue, Dec 01, 2015 at 01:47:24PM +0800, Chen-Yu Tsai wrote:
> This patch adds a device node for the Reduced Serial Bus (RSB)
> controller and the defacto pinmux setting to the A80 dtsi.
> 
> Since there is only one possible pinmux setting for RSB, just
> set it in the dtsi.
> 
> Signed-off-by: Chen-Yu Tsai 

Applied, thanks!
Maxime

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

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


signature.asc
Description: Digital signature


[linux-sunxi] Re: [PATCH v4 1/5] clk: sunxi: Add CLK_OF_DECLARE support for sun8i-a23-apb0-clk driver

2015-12-01 Thread Chen-Yu Tsai
On Tue, Dec 1, 2015 at 6:04 PM, Maxime Ripard
 wrote:
> Hi,
>
> On Sun, Nov 29, 2015 at 11:03:06AM +0800, Chen-Yu Tsai wrote:
>> The APBS clock on sun9i is the same as the APB0 clock on sun8i. With
>> sun9i we are supporting the PRCM clocks by using CLK_OF_DECLARE,
>> instead of through a PRCM mfd device and subdevices for each clock
>> and reset control. As such we need a CLK_OF_DECLARE version of
>> the sun8i-a23-apb0-clk driver.
>>
>> Also, build it for sun9i/A80, and not just for configurations with
>> MFD_SUN6I_PRCM enabled.
>>
>> Signed-off-by: Chen-Yu Tsai 
>> ---
>>  drivers/clk/sunxi/Makefile |  5 +--
>>  drivers/clk/sunxi/clk-sun8i-apb0.c | 71 
>> +++---
>>  2 files changed, 62 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile
>> index cb4c299214ce..c55d5cd1c0e5 100644
>> --- a/drivers/clk/sunxi/Makefile
>> +++ b/drivers/clk/sunxi/Makefile
>> @@ -15,6 +15,7 @@ obj-y += clk-sun9i-core.o
>>  obj-y += clk-sun9i-mmc.o
>>  obj-y += clk-usb.o
>>
>> +obj-$(CONFIG_MACH_SUN9I) += clk-sun8i-apb0.o
>> +
>
> So sun8i doesn't use it?

Shit... I messed up. clk-sun8i-apb0.o should also be under
CONFIG_MFD_SUN6I_PRCM.

I'll send a new version of this patch. No need to keep spamming
people with the whole series.

>>  obj-$(CONFIG_MFD_SUN6I_PRCM) += \
>> - clk-sun6i-ar100.o clk-sun6i-apb0.o clk-sun6i-apb0-gates.o \
>> - clk-sun8i-apb0.o
>> + clk-sun6i-ar100.o clk-sun6i-apb0.o clk-sun6i-apb0-gates.o
>> diff --git a/drivers/clk/sunxi/clk-sun8i-apb0.c 
>> b/drivers/clk/sunxi/clk-sun8i-apb0.c
>> index 7ae5d2c2cde1..c1e2ac8f4b0d 100644
>> --- a/drivers/clk/sunxi/clk-sun8i-apb0.c
>> +++ b/drivers/clk/sunxi/clk-sun8i-apb0.c
>> @@ -17,13 +17,68 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>>  #include 
>>
>> +static struct clk *sun8i_a23_apb0_register(struct device_node *node,
>> +void __iomem *reg)
>> +{
>> + const char *clk_name = node->name;
>> + const char *clk_parent;
>> + struct clk *clk;
>> + int ret;
>> +
>> + clk_parent = of_clk_get_parent_name(node, 0);
>> + if (!clk_parent)
>> + return ERR_PTR(-EINVAL);
>> +
>> + of_property_read_string(node, "clock-output-names", _name);
>> +
>> + /* The A23 APB0 clock is a standard 2 bit wide divider clock */
>> + clk = clk_register_divider(NULL, clk_name, clk_parent, 0, reg,
>> +0, 2, CLK_DIVIDER_POWER_OF_TWO, NULL);
>> + if (IS_ERR(clk))
>> + return clk;
>> +
>> + ret = of_clk_add_provider(node, of_clk_src_simple_get, clk);
>> + if (ret)
>> + goto err_unregister;
>> +
>> + return clk;
>> +
>> +err_unregister:
>> + clk_unregister_divider(clk);
>> +
>> + return ERR_PTR(ret);
>> +}
>> +
>> +static void sun8i_a23_apb0_setup(struct device_node *node)
>> +{
>> + void __iomem *reg;
>> + struct resource res;
>> + struct clk *clk;
>> +
>> + reg = of_io_request_and_map(node, 0, of_node_full_name(node));
>> + if (IS_ERR(reg))
>> + return;
>> +
>> + clk = sun8i_a23_apb0_register(node, reg);
>> + if (IS_ERR(clk))
>> + goto err_unmap;
>> +
>> + return;
>> +
>> +err_unmap:
>> + iounmap(reg);
>> + of_address_to_resource(node, 0, );
>> + release_mem_region(res.start, resource_size());
>> +}
>> +CLK_OF_DECLARE(sun8i_a23_apb0, "allwinner,sun8i-a23-apb0-clk",
>> +sun8i_a23_apb0_setup);
>> +
>>  static int sun8i_a23_apb0_clk_probe(struct platform_device *pdev)
>>  {
>>   struct device_node *np = pdev->dev.of_node;
>> - const char *clk_name = np->name;
>> - const char *clk_parent;
>>   struct resource *r;
>>   void __iomem *reg;
>>   struct clk *clk;
>> @@ -33,19 +88,11 @@ static int sun8i_a23_apb0_clk_probe(struct 
>> platform_device *pdev)
>>   if (IS_ERR(reg))
>>   return PTR_ERR(reg);
>>
>> - clk_parent = of_clk_get_parent_name(np, 0);
>> - if (!clk_parent)
>> - return -EINVAL;
>> -
>> - of_property_read_string(np, "clock-output-names", _name);
>> -
>> - /* The A23 APB0 clock is a standard 2 bit wide divider clock */
>> - clk = clk_register_divider(>dev, clk_name, clk_parent, 0, reg,
>> -0, 2, CLK_DIVIDER_POWER_OF_TWO, NULL);
>> + clk = sun8i_a23_apb0_register(np, reg);
>>   if (IS_ERR(clk))
>>   return PTR_ERR(clk);
>>
>> - return of_clk_add_provider(np, of_clk_src_simple_get, clk);
>> + return 0;
>>  }
>
> Won't this probe twice now? First the CLK_OF_DECLARE will register a
> clock, and then the device model will call probe a second time.

AFAIK it will.

> I guess then request_mem_region will catch it, but then you return an
> error code, which is probably an error success, since the clock is
> registered :)

Indeed. clk-mod0.c actually has a 

[linux-sunxi] Re: [PATCH v2 11/25] coccinelle: nand: detect and correct drivers embedding an mtd_info object

2015-12-01 Thread Boris Brezillon
Hi,

On Tue, 1 Dec 2015 12:17:44 +0100 (CET)
Julia Lawall  wrote:

> 
> 
> On Tue, 1 Dec 2015, Boris Brezillon wrote:
> 
> > Add nand-priv-no-mtd.cocci to detect and correct NAND controller drivers
> > directly embedding an mtd_info struct in their private struct.
> >
> > Signed-off-by: Boris Brezillon 
> > Cc: Julia Lawall 
> > ---
> > Hi Julia,
> >
> > Not sure this is the correct way to detect and fix offending drivers,
> > but I get some warnings when launching coccicheck in org or report mode:
> >
> > "warning: fix2: inherited metavariable __chipfield not used in the -, +,
> > or context code"
> >
> > Note that I don't get those warnings when running in patch mode.
> >
> > Any idea (feel free to propose a better solution to detect and fix those
> > offending drivers)?
> 
> Hi,
> 
> Is this code generated with sgen?  If so, could you send me the original
> semantic patch?

Nope, it's been hand written, which might explain the warnings :-/.
Didn't know about sgen, I thought those scripts were all hand written.

> 
> Another thing that is immediately apparent is that you have <... ...> on
> the outside of one of the rules.  This should never be needed.
> 
> The warning suggests that your org and report versions are not doing as
> much as the patch version.  If you have used sgen to generate the semantic
> patch then that would be strange.  If you have hand written the whole
> thing, then maybe you could simplify it to just do the patch version, and
> then I can check it and run sgen on it to make a complete version.

Sure, here it is:

--->8---
virtual patch

@fix1@
identifier __chipfield, __mtdfield;
type __type;
@@
(
__type {
...
struct nand_chip __chipfield;
...
-   struct mtd_info __mtdfield;
...
};
|
__type {
...
-   struct mtd_info __mtdfield;
...
struct nand_chip __chipfield;
...
};
)

@fix2 depends on fix1@
identifier fix1.__chipfield, fix1.__mtdfield;
identifier __subfield;
type fix1.__type;
__type *__priv;
@@
(
-   __priv->__mtdfield.__subfield
+   nand_to_mtd(&__priv->__chipfield)->__subfield
|
-   &(__priv->__mtdfield)
+   nand_to_mtd(&__priv->__chipfield)
)
--->8---

Thanks,

Boris

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
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 1/5] clk: sunxi: Add CLK_OF_DECLARE support for sun8i-a23-apb0-clk driver

2015-12-01 Thread Chen-Yu Tsai
On Tue, Dec 1, 2015 at 8:50 PM, Maxime Ripard
 wrote:
> On Tue, Dec 01, 2015 at 07:54:06PM +0800, Chen-Yu Tsai wrote:
>> On Tue, Dec 1, 2015 at 6:04 PM, Maxime Ripard
>>  wrote:
>> > Hi,
>> >
>> > On Sun, Nov 29, 2015 at 11:03:06AM +0800, Chen-Yu Tsai wrote:
>> >> The APBS clock on sun9i is the same as the APB0 clock on sun8i. With
>> >> sun9i we are supporting the PRCM clocks by using CLK_OF_DECLARE,
>> >> instead of through a PRCM mfd device and subdevices for each clock
>> >> and reset control. As such we need a CLK_OF_DECLARE version of
>> >> the sun8i-a23-apb0-clk driver.
>> >>
>> >> Also, build it for sun9i/A80, and not just for configurations with
>> >> MFD_SUN6I_PRCM enabled.
>> >>
>> >> Signed-off-by: Chen-Yu Tsai 
>> >> ---
>> >>  drivers/clk/sunxi/Makefile |  5 +--
>> >>  drivers/clk/sunxi/clk-sun8i-apb0.c | 71 
>> >> +++---
>> >>  2 files changed, 62 insertions(+), 14 deletions(-)
>> >>
>> >> diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile
>> >> index cb4c299214ce..c55d5cd1c0e5 100644
>> >> --- a/drivers/clk/sunxi/Makefile
>> >> +++ b/drivers/clk/sunxi/Makefile
>> >> @@ -15,6 +15,7 @@ obj-y += clk-sun9i-core.o
>> >>  obj-y += clk-sun9i-mmc.o
>> >>  obj-y += clk-usb.o
>> >>
>> >> +obj-$(CONFIG_MACH_SUN9I) += clk-sun8i-apb0.o
>> >> +
>> >
>> > So sun8i doesn't use it?
>>
>> Shit... I messed up. clk-sun8i-apb0.o should also be under
>> CONFIG_MFD_SUN6I_PRCM.
>>
>> I'll send a new version of this patch. No need to keep spamming
>> people with the whole series.
>
> Ok.
>
>> >>  obj-$(CONFIG_MFD_SUN6I_PRCM) += \
>> >> - clk-sun6i-ar100.o clk-sun6i-apb0.o clk-sun6i-apb0-gates.o \
>> >> - clk-sun8i-apb0.o
>> >> + clk-sun6i-ar100.o clk-sun6i-apb0.o clk-sun6i-apb0-gates.o
>> >> diff --git a/drivers/clk/sunxi/clk-sun8i-apb0.c 
>> >> b/drivers/clk/sunxi/clk-sun8i-apb0.c
>> >> index 7ae5d2c2cde1..c1e2ac8f4b0d 100644
>> >> --- a/drivers/clk/sunxi/clk-sun8i-apb0.c
>> >> +++ b/drivers/clk/sunxi/clk-sun8i-apb0.c
>> >> @@ -17,13 +17,68 @@
>> >>  #include 
>> >>  #include 
>> >>  #include 
>> >> +#include 
>> >>  #include 
>> >>
>> >> +static struct clk *sun8i_a23_apb0_register(struct device_node *node,
>> >> +void __iomem *reg)
>> >> +{
>> >> + const char *clk_name = node->name;
>> >> + const char *clk_parent;
>> >> + struct clk *clk;
>> >> + int ret;
>> >> +
>> >> + clk_parent = of_clk_get_parent_name(node, 0);
>> >> + if (!clk_parent)
>> >> + return ERR_PTR(-EINVAL);
>> >> +
>> >> + of_property_read_string(node, "clock-output-names", _name);
>> >> +
>> >> + /* The A23 APB0 clock is a standard 2 bit wide divider clock */
>> >> + clk = clk_register_divider(NULL, clk_name, clk_parent, 0, reg,
>> >> +0, 2, CLK_DIVIDER_POWER_OF_TWO, NULL);
>> >> + if (IS_ERR(clk))
>> >> + return clk;
>> >> +
>> >> + ret = of_clk_add_provider(node, of_clk_src_simple_get, clk);
>> >> + if (ret)
>> >> + goto err_unregister;
>> >> +
>> >> + return clk;
>> >> +
>> >> +err_unregister:
>> >> + clk_unregister_divider(clk);
>> >> +
>> >> + return ERR_PTR(ret);
>> >> +}
>> >> +
>> >> +static void sun8i_a23_apb0_setup(struct device_node *node)
>> >> +{
>> >> + void __iomem *reg;
>> >> + struct resource res;
>> >> + struct clk *clk;
>> >> +
>> >> + reg = of_io_request_and_map(node, 0, of_node_full_name(node));
>> >> + if (IS_ERR(reg))
>> >> + return;
>> >> +
>> >> + clk = sun8i_a23_apb0_register(node, reg);
>> >> + if (IS_ERR(clk))
>> >> + goto err_unmap;
>> >> +
>> >> + return;
>> >> +
>> >> +err_unmap:
>> >> + iounmap(reg);
>> >> + of_address_to_resource(node, 0, );
>> >> + release_mem_region(res.start, resource_size());
>> >> +}
>> >> +CLK_OF_DECLARE(sun8i_a23_apb0, "allwinner,sun8i-a23-apb0-clk",
>> >> +sun8i_a23_apb0_setup);
>> >> +
>> >>  static int sun8i_a23_apb0_clk_probe(struct platform_device *pdev)
>> >>  {
>> >>   struct device_node *np = pdev->dev.of_node;
>> >> - const char *clk_name = np->name;
>> >> - const char *clk_parent;
>> >>   struct resource *r;
>> >>   void __iomem *reg;
>> >>   struct clk *clk;
>> >> @@ -33,19 +88,11 @@ static int sun8i_a23_apb0_clk_probe(struct 
>> >> platform_device *pdev)
>> >>   if (IS_ERR(reg))
>> >>   return PTR_ERR(reg);
>> >>
>> >> - clk_parent = of_clk_get_parent_name(np, 0);
>> >> - if (!clk_parent)
>> >> - return -EINVAL;
>> >> -
>> >> - of_property_read_string(np, "clock-output-names", _name);
>> >> -
>> >> - /* The A23 APB0 clock is a standard 2 bit wide divider clock */
>> >> - clk = clk_register_divider(>dev, clk_name, clk_parent, 0, reg,
>> >> -0, 2, CLK_DIVIDER_POWER_OF_TWO, NULL);
>> 

[linux-sunxi] Stability Issues with A33 & Mainline

2015-12-01 Thread wens Tsai
Hi,

I'm having some weird stability issues with my SinA33.

After idling a while (a few hours ~ a day) it becomes non-responsive
and just keeps outputting the same message:

[53418.712180] Task dump for CPU 0:
[53418.715403] cronR running  0  1131  1 0x0003
[53418.721780] [] (__schedule) from [<2013>] (0x2013)
[53496.741465] INFO: rcu_sched detected stalls on CPUs/tasks:
[53496.746963]  0-...: (2 GPs behind) idle=ba3/141/0
softirq=127599/127600 fqs=369299
[53496.755646]  (detected by 1, t=369437 jiffies, g=78644, c=78643, q=67)

Maybe something is not getting enough power.

Wondering if anyone else has seen similar problems?

Regards,
ChenYu

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