Re: [PATCH v4 09/17] clk: at91: add PMC peripheral clocks

2013-10-17 Thread Nicolas Ferre

On 11/10/2013 11:44, Boris BREZILLON :

This patch adds new at91 peripheral clock implementation using common clk
framework.

Almost all peripherals provided by at91 SoCs need a clock to work properly.
This clock is enabled/disabled using PCER/PCDR resgisters.

Each peripheral is given an id (see atmel's datasheets) which is used to
define and reference peripheral clocks.

Some new SoCs (at91sam9x5 and sama5d3) provide a new register (PCR) where you
can configure the peripheral clock as a division of the master clock.
This will help reducing the peripherals power comsumption.

Signed-off-by: Boris BREZILLON 


Acked-by: Nicolas Ferre 


---
  drivers/clk/at91/Makefile |2 +-
  drivers/clk/at91/clk-peripheral.c |  407 +
  drivers/clk/at91/pmc.c|9 +
  drivers/clk/at91/pmc.h|5 +
  4 files changed, 422 insertions(+), 1 deletion(-)
  create mode 100644 drivers/clk/at91/clk-peripheral.c

diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
index c2b7068..04deba3 100644
--- a/drivers/clk/at91/Makefile
+++ b/drivers/clk/at91/Makefile
@@ -4,4 +4,4 @@

  obj-y += pmc.o
  obj-y += clk-main.o clk-pll.o clk-plldiv.o clk-master.o
-obj-y += clk-system.o
+obj-y += clk-system.o clk-peripheral.o
diff --git a/drivers/clk/at91/clk-peripheral.c 
b/drivers/clk/at91/clk-peripheral.c
new file mode 100644
index 000..2dce2e2
--- /dev/null
+++ b/drivers/clk/at91/clk-peripheral.c
@@ -0,0 +1,407 @@
+/*
+ * drivers/clk/at91/clk-peripheral.c
+ *
+ *  Copyright (C) 2013 Boris BREZILLON 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "pmc.h"
+
+#define PERIPHERAL_MAX 64
+
+#define PERIPHERAL_AT91RM9200  0
+#define PERIPHERAL_AT91SAM9X5  1
+
+#define PERIPHERAL_ID_MIN  2
+#define PERIPHERAL_ID_MAX  31
+#define PERIPHERAL_MASK(id)(1 << ((id) & PERIPHERAL_ID_MAX))
+
+#define PERIPHERAL_RSHIFT_MASK 0x3
+#define PERIPHERAL_RSHIFT(val) (((val) >> 16) & PERIPHERAL_RSHIFT_MASK)
+
+struct clk_peripheral {
+   struct clk_hw hw;
+   struct at91_pmc *pmc;
+   u32 id;
+};
+
+#define to_clk_peripheral(hw) container_of(hw, struct clk_peripheral, hw)
+
+struct clk_sam9x5_peripheral {
+   struct clk_hw hw;
+   struct at91_pmc *pmc;
+   u32 id;
+   u8 div;
+   u8 have_div_support;
+};
+
+#define to_clk_sam9x5_peripheral(hw) \
+   container_of(hw, struct clk_sam9x5_peripheral, hw)
+
+static int clk_peripheral_enable(struct clk_hw *hw)
+{
+   struct clk_peripheral *periph = to_clk_peripheral(hw);
+   struct at91_pmc *pmc = periph->pmc;
+   int offset = AT91_PMC_PCER;
+   u32 id = periph->id;
+
+   if (id < PERIPHERAL_ID_MIN)
+   return 0;
+   if (id > PERIPHERAL_ID_MAX)
+   offset = AT91_PMC_PCER1;
+   pmc_write(pmc, offset, PERIPHERAL_MASK(id));
+   return 0;
+}
+
+static void clk_peripheral_disable(struct clk_hw *hw)
+{
+   struct clk_peripheral *periph = to_clk_peripheral(hw);
+   struct at91_pmc *pmc = periph->pmc;
+   int offset = AT91_PMC_PCDR;
+   u32 id = periph->id;
+
+   if (id < PERIPHERAL_ID_MIN)
+   return;
+   if (id > PERIPHERAL_ID_MAX)
+   offset = AT91_PMC_PCDR1;
+   pmc_write(pmc, offset, PERIPHERAL_MASK(id));
+}
+
+static int clk_peripheral_is_enabled(struct clk_hw *hw)
+{
+   struct clk_peripheral *periph = to_clk_peripheral(hw);
+   struct at91_pmc *pmc = periph->pmc;
+   int offset = AT91_PMC_PCSR;
+   u32 id = periph->id;
+
+   if (id < PERIPHERAL_ID_MIN)
+   return 1;
+   if (id > PERIPHERAL_ID_MAX)
+   offset = AT91_PMC_PCSR1;
+   return !!(pmc_read(pmc, offset) & PERIPHERAL_MASK(id));
+}
+
+static const struct clk_ops peripheral_ops = {
+   .enable = clk_peripheral_enable,
+   .disable = clk_peripheral_disable,
+   .is_enabled = clk_peripheral_is_enabled,
+};
+
+static struct clk * __init
+at91_clk_register_peripheral(struct at91_pmc *pmc, const char *name,
+const char *parent_name, u32 id)
+{
+   struct clk_peripheral *periph;
+   struct clk *clk = NULL;
+   struct clk_init_data init;
+
+   if (!pmc || !name || !parent_name || id > PERIPHERAL_ID_MAX)
+   return ERR_PTR(-EINVAL);
+
+   periph = kzalloc(sizeof(*periph), GFP_KERNEL);
+   if (!periph)
+   return ERR_PTR(-ENOMEM);
+
+   init.name = name;
+   init.ops = &peripheral_ops;
+   init.parent_names = (parent_name ? &parent_name : NULL);
+   init.num_parents = (parent_name ? 1 : 

Re: [PATCH v4 10/17] clk: at91: add peripheral clk macros for peripheral clk dt bindings

2013-10-17 Thread Nicolas Ferre

On 11/10/2013 11:53, Boris BREZILLON :

This patch adds the peripheral divisors macros (for sam9x5 compatible IPs)
which will be used by peripheral clk dt definitions.

Signed-off-by: Boris BREZILLON 


Acked-by: Nicolas Ferre 


---
  include/dt-bindings/clk/at91.h |6 ++
  1 file changed, 6 insertions(+)

diff --git a/include/dt-bindings/clk/at91.h b/include/dt-bindings/clk/at91.h
index 0b4cb99..a3b07ca 100644
--- a/include/dt-bindings/clk/at91.h
+++ b/include/dt-bindings/clk/at91.h
@@ -19,4 +19,10 @@
  #define AT91_PMC_MOSCRCS  17  /* Main On-Chip RC */
  #define AT91_PMC_CFDEV18  /* Clock Failure 
Detector Event */

+/* sam9x5 peripheral divisors */
+#define AT91SAM9X5_PERIPH_CLK_DIV1 0
+#define AT91SAM9X5_PERIPH_CLK_DIV2 1
+#define AT91SAM9X5_PERIPH_CLK_DIV4 2
+#define AT91SAM9X5_PERIPH_CLK_DIV8 3
+
  #endif




--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 06/17] clk: at91: add PMC pll clocks

2013-10-17 Thread Nicolas Ferre

On 11/10/2013 10:48, Boris BREZILLON :

This patch adds new at91 pll clock implementation using common clk framework.

The pll clock layout describe the PLLX register layout.
There are four pll clock layouts:
- at91rm9200
- at91sam9g20
- at91sam9g45
- sama5d3

PLL clocks are given characteristics:
- min/max clock source rate
- ranges of valid clock output rates
- values to set in out and icpll fields for each supported output range

These characteristics are checked during rate change to avoid
over/underclocking.

These characteristics are described in atmel's SoC datasheet in
"Electrical Characteristics" paragraph.

Signed-off-by: Boris BREZILLON 


Acked-by: Nicolas Ferre 


---
  drivers/clk/at91/Makefile |2 +-
  drivers/clk/at91/clk-pll.c|  545 +
  drivers/clk/at91/clk-plldiv.c |  137 +++
  drivers/clk/at91/pmc.c|   21 ++
  drivers/clk/at91/pmc.h|   11 +
  include/linux/clk/at91_pmc.h  |2 +
  6 files changed, 717 insertions(+), 1 deletion(-)
  create mode 100644 drivers/clk/at91/clk-pll.c
  create mode 100644 drivers/clk/at91/clk-plldiv.c

diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
index 44105bd..902bbf1 100644
--- a/drivers/clk/at91/Makefile
+++ b/drivers/clk/at91/Makefile
@@ -3,4 +3,4 @@
  #

  obj-y += pmc.o
-obj-y += clk-main.o
+obj-y += clk-main.o clk-pll.o clk-plldiv.o
diff --git a/drivers/clk/at91/clk-pll.c b/drivers/clk/at91/clk-pll.c
new file mode 100644
index 000..44caddf
--- /dev/null
+++ b/drivers/clk/at91/clk-pll.c
@@ -0,0 +1,545 @@
+/*
+ * drivers/clk/at91/clk-pll.c
+ *
+ *  Copyright (C) 2013 Boris BREZILLON 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "pmc.h"
+
+#define PLL_STATUS_MASK(id)(1 << (1 + (id)))
+#define PLL_REG(id)(AT91_CKGR_PLLAR + ((id) * 4))
+#define PLL_DIV_MASK   0xff
+#define PLL_DIV_MAXPLL_DIV_MASK
+#define PLL_DIV(reg)   ((reg) & PLL_DIV_MASK)
+#define PLL_MUL(reg, layout)   (((reg) >> (layout)->mul_shift) & \
+(layout)->mul_mask)
+#define PLL_ICPR_SHIFT(id) ((id) * 16)
+#define PLL_ICPR_MASK(id)  (0x << PLL_ICPR_SHIFT(id))
+#define PLL_MAX_COUNT  0x3ff
+#define PLL_COUNT_SHIFT8
+#define PLL_OUT_SHIFT  14
+#define PLL_MAX_ID 1
+
+struct clk_pll_characteristics {
+   struct clk_range input;
+   int num_output;
+   struct clk_range *output;
+   u16 *icpll;
+   u8 *out;
+};
+
+struct clk_pll_layout {
+   u32 pllr_mask;
+   u16 mul_mask;
+   u8 mul_shift;
+};
+
+#define to_clk_pll(hw) container_of(hw, struct clk_pll, hw)
+
+struct clk_pll {
+   struct clk_hw hw;
+   struct at91_pmc *pmc;
+   unsigned int irq;
+   wait_queue_head_t wait;
+   u8 id;
+   u8 div;
+   u8 range;
+   u16 mul;
+   const struct clk_pll_layout *layout;
+   const struct clk_pll_characteristics *characteristics;
+};
+
+static irqreturn_t clk_pll_irq_handler(int irq, void *dev_id)
+{
+   struct clk_pll *pll = (struct clk_pll *)dev_id;
+
+   wake_up(&pll->wait);
+   disable_irq_nosync(pll->irq);
+
+   return IRQ_HANDLED;
+}
+
+static int clk_pll_prepare(struct clk_hw *hw)
+{
+   struct clk_pll *pll = to_clk_pll(hw);
+   struct at91_pmc *pmc = pll->pmc;
+   const struct clk_pll_layout *layout = pll->layout;
+   u8 id = pll->id;
+   u32 mask = PLL_STATUS_MASK(id);
+   int offset = PLL_REG(id);
+   u8 out = 0;
+   u32 pllr, icpr;
+   u8 div;
+   u16 mul;
+
+   pllr = pmc_read(pmc, offset);
+   div = PLL_DIV(pllr);
+   mul = PLL_MUL(pllr, layout);
+
+   if ((pmc_read(pmc, AT91_PMC_SR) & mask) &&
+   (div == pll->div && mul == pll->mul))
+   return 0;
+
+   if (characteristics->out)
+   out = characteristics->out[pll->range];
+   if (characteristics->icpll) {
+   icpr = pmc_read(pmc, AT91_PMC_PLLICPR) & ~PLL_ICPR_MASK(id);
+   icpr |= (characteristics->icpll[pll->range] <<
+   PLL_ICPR_SHIFT(id));
+   pmc_write(pmc, AT91_PMC_PLLICPR, icpr);
+   }
+
+   pllr &= ~layout->pllr_mask;
+   pllr |= layout->pllr_mask &
+  (pll->div | (PLL_MAX_COUNT << PLL_COUNT_SHIFT) |
+   (out << PLL_OUT_SHIFT) |
+   ((pll->mul & layout->mul_mask) << layout->mul_

Re: [PATCH v4 11/17] clk: at91: add PMC programmable clocks

2013-10-17 Thread Nicolas Ferre

On 11/10/2013 11:57, Boris BREZILLON :

This patch adds new at91 programmable clocks implementation using common clk
framework.
A programmable clock is a clock which can be exported on a given pin to clock
external devices.
Each programmable clock is given an id (from 0 to 8).
The number of available programmable clocks depends on the SoC you're using.
Programmable clock driver only implements the clock setting (clock rate and
parent setting). It must be chained to a system clock in order to
enable/disable the generated clock.
The PCKX pins used to output the clock signals must be assigned to the
appropriate peripheral (see atmel's datasheets).

Signed-off-by: Boris BREZILLON 


Acked-by: Nicolas Ferre 


---
  drivers/clk/at91/Makefile   |2 +
  drivers/clk/at91/clk-programmable.c |  423 +++
  drivers/clk/at91/pmc.c  |   15 ++
  drivers/clk/at91/pmc.h  |9 +
  4 files changed, 449 insertions(+)
  create mode 100644 drivers/clk/at91/clk-programmable.c

diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
index 04deba3..3873b62 100644
--- a/drivers/clk/at91/Makefile
+++ b/drivers/clk/at91/Makefile
@@ -5,3 +5,5 @@
  obj-y += pmc.o
  obj-y += clk-main.o clk-pll.o clk-plldiv.o clk-master.o
  obj-y += clk-system.o clk-peripheral.o
+
+obj-$(CONFIG_AT91_PROGRAMMABLE_CLOCKS) += clk-programmable.o
diff --git a/drivers/clk/at91/clk-programmable.c 
b/drivers/clk/at91/clk-programmable.c
new file mode 100644
index 000..b34f80b
--- /dev/null
+++ b/drivers/clk/at91/clk-programmable.c
@@ -0,0 +1,423 @@
+/*
+ * drivers/clk/at91/clk-programmable.c
+ *
+ *  Copyright (C) 2013 Boris BREZILLON 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "pmc.h"
+
+#define PROG_SOURCE_MAX5
+#define PROG_ID_MAX7
+
+#define PROG_STATUS_MASK(id)   (1 << ((id) + 8))
+#define PROG_PRES_MASK 0x7
+#define PROG_MAX_RM9200_CSS3
+
+struct clk_programmable_layout {
+   u8 pres_shift;
+   u8 css_mask;
+   u8 have_slck_mck;
+};
+
+struct clk_programmable {
+   struct clk_hw hw;
+   struct at91_pmc *pmc;
+   unsigned int irq;
+   wait_queue_head_t wait;
+   u8 id;
+   u8 css;
+   u8 pres;
+   u8 slckmck;
+   const struct clk_programmable_layout *layout;
+};
+
+#define to_clk_programmable(hw) container_of(hw, struct clk_programmable, hw)
+
+
+static irqreturn_t clk_programmable_irq_handler(int irq, void *dev_id)
+{
+   struct clk_programmable *prog = (struct clk_programmable *)dev_id;
+
+   wake_up(&prog->wait);
+
+   return IRQ_HANDLED;
+}
+
+static int clk_programmable_prepare(struct clk_hw *hw)
+{
+   u32 tmp;
+   struct clk_programmable *prog = to_clk_programmable(hw);
+   struct at91_pmc *pmc = prog->pmc;
+   const struct clk_programmable_layout *layout = prog->layout;
+   u8 id = prog->id;
+   u32 mask = PROG_STATUS_MASK(id);
+
+   tmp = prog->css | (prog->pres << layout->pres_shift);
+   if (layout->have_slck_mck && prog->slckmck)
+   tmp |= AT91_PMC_CSSMCK_MCK;
+
+   pmc_write(pmc, AT91_PMC_PCKR(id), tmp);
+
+   while (!(pmc_read(pmc, AT91_PMC_SR) & mask))
+   wait_event(prog->wait, pmc_read(pmc, AT91_PMC_SR) & mask);
+
+   return 0;
+}
+
+static int clk_programmable_is_ready(struct clk_hw *hw)
+{
+   struct clk_programmable *prog = to_clk_programmable(hw);
+   struct at91_pmc *pmc = prog->pmc;
+
+   return !!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_PCKR(prog->id));
+}
+
+static unsigned long clk_programmable_recalc_rate(struct clk_hw *hw,
+ unsigned long parent_rate)
+{
+   u32 tmp;
+   struct clk_programmable *prog = to_clk_programmable(hw);
+   struct at91_pmc *pmc = prog->pmc;
+   const struct clk_programmable_layout *layout = prog->layout;
+
+   tmp = pmc_read(pmc, AT91_PMC_PCKR(prog->id));
+   prog->pres = (tmp >> layout->pres_shift) & PROG_PRES_MASK;
+
+   return parent_rate >> prog->pres;
+}
+
+static long clk_programmable_round_rate(struct clk_hw *hw, unsigned long rate,
+   unsigned long *parent_rate)
+{
+   unsigned long best_rate = *parent_rate;
+   unsigned long best_diff;
+   unsigned long new_diff;
+   unsigned long cur_rate;
+   int shift = shift;
+
+   if (rate > *parent_rate)
+   return *parent_rate;
+   else
+   best_diff = 

Re: [PATCH v4 12/17] clk: at91: add PMC utmi clock

2013-10-17 Thread Nicolas Ferre

On 11/10/2013 12:22, Boris BREZILLON :

This adds new at91 utmi clock implementation using common clk framework.

This clock is a pll with a fixed factor (x40).
It is used as a source for usb clock.

Signed-off-by: Boris BREZILLON 


Acked-by: Nicolas Ferre 


---
  arch/arm/mach-at91/Kconfig  |7 ++
  drivers/clk/at91/Makefile   |1 +
  drivers/clk/at91/clk-utmi.c |  162 +++
  drivers/clk/at91/pmc.c  |7 ++
  drivers/clk/at91/pmc.h  |5 ++
  5 files changed, 182 insertions(+)
  create mode 100644 drivers/clk/at91/clk-utmi.c

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 85b53a4..6ad37da 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -1,5 +1,8 @@
  if ARCH_AT91

+config HAVE_AT91_UTMI
+   bool
+
  config HAVE_AT91_DBGU0
bool

@@ -78,6 +81,7 @@ config SOC_SAMA5D3
select HAVE_FB_ATMEL
select HAVE_AT91_DBGU1
select AT91_USE_OLD_CLK
+   select HAVE_AT91_UTMI
help
  Select this if you are using one of Atmel's SAMA5D3 family SoC.
  This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35.
@@ -124,6 +128,7 @@ config SOC_AT91SAM9RL
select HAVE_FB_ATMEL
select SOC_AT91SAM9
select AT91_USE_OLD_CLK
+   select HAVE_AT91_UTMI

  config SOC_AT91SAM9G45
bool "AT91SAM9G45 or AT91SAM9M10 families"
@@ -131,6 +136,7 @@ config SOC_AT91SAM9G45
select HAVE_FB_ATMEL
select SOC_AT91SAM9
select AT91_USE_OLD_CLK
+   select HAVE_AT91_UTMI
help
  Select this if you are using one of Atmel's AT91SAM9G45 family SoC.
  This support covers AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and 
AT91SAM9M11.
@@ -141,6 +147,7 @@ config SOC_AT91SAM9X5
select HAVE_FB_ATMEL
select SOC_AT91SAM9
select AT91_USE_OLD_CLK
+   select HAVE_AT91_UTMI
help
  Select this if you are using one of Atmel's AT91SAM9x5 family SoC.
  This means that your SAM9 name finishes with a '5' (except if it is
diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
index 3873b62..a824883 100644
--- a/drivers/clk/at91/Makefile
+++ b/drivers/clk/at91/Makefile
@@ -7,3 +7,4 @@ obj-y += clk-main.o clk-pll.o clk-plldiv.o clk-master.o
  obj-y += clk-system.o clk-peripheral.o

  obj-$(CONFIG_AT91_PROGRAMMABLE_CLOCKS)+= clk-programmable.o
+obj-$(CONFIG_HAVE_AT91_UTMI)   += clk-utmi.o
diff --git a/drivers/clk/at91/clk-utmi.c b/drivers/clk/at91/clk-utmi.c
new file mode 100644
index 000..9a133df
--- /dev/null
+++ b/drivers/clk/at91/clk-utmi.c
@@ -0,0 +1,162 @@
+/*
+ * drivers/clk/at91/clk-utmi.c
+ *
+ *  Copyright (C) 2013 Boris BREZILLON 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "pmc.h"
+
+#define UTMI_FIXED_MUL 40
+
+struct clk_utmi {
+   struct clk_hw hw;
+   struct at91_pmc *pmc;
+   unsigned int irq;
+   wait_queue_head_t wait;
+};
+
+#define to_clk_utmi(hw) container_of(hw, struct clk_utmi, hw)
+
+static irqreturn_t clk_utmi_irq_handler(int irq, void *dev_id)
+{
+   struct clk_utmi *utmi = (struct clk_utmi *)dev_id;
+
+   wake_up(&utmi->wait);
+   disable_irq_nosync(utmi->irq);
+
+   return IRQ_HANDLED;
+}
+
+static int clk_utmi_prepare(struct clk_hw *hw)
+{
+   struct clk_utmi *utmi = to_clk_utmi(hw);
+   struct at91_pmc *pmc = utmi->pmc;
+   u32 tmp = at91_pmc_read(AT91_CKGR_UCKR) | AT91_PMC_UPLLEN |
+ AT91_PMC_UPLLCOUNT | AT91_PMC_BIASEN;
+
+   pmc_write(pmc, AT91_CKGR_UCKR, tmp);
+
+   while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_LOCKU)) {
+   enable_irq(utmi->irq);
+   wait_event(utmi->wait,
+  pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_LOCKU);
+   }
+
+   return 0;
+}
+
+static int clk_utmi_is_ready(struct clk_hw *hw)
+{
+   struct clk_utmi *utmi = to_clk_utmi(hw);
+   struct at91_pmc *pmc = utmi->pmc;
+
+   return !!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_LOCKU);
+}
+
+static void clk_utmi_disable(struct clk_hw *hw)
+{
+   struct clk_utmi *utmi = to_clk_utmi(hw);
+   struct at91_pmc *pmc = utmi->pmc;
+   u32 tmp = at91_pmc_read(AT91_CKGR_UCKR) & ~AT91_PMC_UPLLEN;
+
+   pmc_write(pmc, AT91_CKGR_UCKR, tmp);
+}
+
+static unsigned long clk_utmi_recalc_rate(struct clk_hw *hw,
+ unsigned long parent_rate)
+{
+   /* UTMI clk is a fixed clk multiplier */
+   return parent_rate * UTMI_FIXED_M

Re: [PATCH v4 13/17] clk: at91: add PMC usb clock

2013-10-17 Thread Nicolas Ferre
t_name(np, 0);
+   if (!parent_name)
+   return;
+
+   of_property_read_string(np, "clock-output-names", &name);
+
+   clk = at91sam9n12_clk_register_usb(pmc, name, parent_name);
+   if (IS_ERR(clk))
+   return;
+
+   of_clk_add_provider(np, of_clk_src_simple_get, clk);
+}
+
+void __init of_at91rm9200_clk_usb_setup(struct device_node *np,
+   struct at91_pmc *pmc)
+{
+   struct clk *clk;
+   const char *parent_name;
+   const char *name = np->name;
+   u32 divisors[4] = {0, 0, 0, 0};
+
+   parent_name = of_clk_get_parent_name(np, 0);
+   if (!parent_name)
+   return;
+
+   of_property_read_u32_array(np, "atmel,clk-divisors", divisors, 4);
+   if (!divisors[0])
+   return;
+
+   of_property_read_string(np, "clock-output-names", &name);
+
+   clk = at91rm9200_clk_register_usb(pmc, name, parent_name, divisors);
+   if (IS_ERR(clk))
+   return;
+
+   of_clk_add_provider(np, of_clk_src_simple_get, clk);
+}
diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
index 8802999..dc0b1b6 100644
--- a/drivers/clk/at91/pmc.c
+++ b/drivers/clk/at91/pmc.c
@@ -279,6 +279,17 @@ static const struct of_device_id pmc_clk_ids[] __initdata 
= {
.data = of_at91sam9x5_clk_utmi_setup,
},
  #endif
+   /* USB clock */
+#if defined(CONFIG_HAVE_AT91_USB_CLK)
+   {
+   .compatible = "atmel,at91rm9200-clk-usb",
+   .data = of_at91rm9200_clk_usb_setup,
+   },
+   {
+   .compatible = "atmel,at91sam9x5-clk-usb",
+   .data = of_at91sam9x5_clk_usb_setup,
+   },


What about of_at91sam9n12_clk_usb_setup() ??

Otherwise, when added, you can add my:

Acked-by: Nicolas Ferre 



+#endif
{ /*sentinel*/ }
  };

diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
index 3ba9503..eba7334 100644
--- a/drivers/clk/at91/pmc.h
+++ b/drivers/clk/at91/pmc.h
@@ -96,4 +96,13 @@ extern void __init of_at91sam9x5_clk_utmi_setup(struct 
device_node *np,
struct at91_pmc *pmc);
  #endif

+#if defined(CONFIG_HAVE_AT91_USB_CLK)
+extern void __init of_at91rm9200_clk_usb_setup(struct device_node *np,
+          struct at91_pmc *pmc);
+extern void __init of_at91sam9x5_clk_usb_setup(struct device_node *np,
+  struct at91_pmc *pmc);
+extern void __init of_at91sam9n12_clk_usb_setup(struct device_node *np,
+   struct at91_pmc *pmc);
+#endif
+
  #endif /* __PMC_H_ */




--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 14/17] clk: at91: add PMC smd clock

2013-10-17 Thread Nicolas Ferre

On 11/10/2013 13:27, Boris BREZILLON :

This patch adds at91 smd (Soft Modem) clock implementation using common clk
framework.

Not used by any driver right now.

Signed-off-by: Boris BREZILLON 


Acked-by: Nicolas Ferre 


---
  arch/arm/mach-at91/Kconfig |5 ++
  drivers/clk/at91/Makefile  |1 +
  drivers/clk/at91/clk-smd.c |  173 
  drivers/clk/at91/pmc.c |7 ++
  drivers/clk/at91/pmc.h |5 ++
  5 files changed, 191 insertions(+)
  create mode 100644 drivers/clk/at91/clk-smd.c

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index b76dc4c..97033f7 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -39,6 +39,9 @@ config AT91_SAM9G45_RESET
  config AT91_SAM9_TIME
bool

+config HAVE_AT91_SMD
+   bool
+
  config SOC_AT91SAM9
bool
select AT91_SAM9_TIME
@@ -85,6 +88,7 @@ config SOC_SAMA5D3
select HAVE_AT91_DBGU1
select AT91_USE_OLD_CLK
select HAVE_AT91_UTMI
+   select HAVE_AT91_SMD
select HAVE_AT91_USB_CLK
help
  Select this if you are using one of Atmel's SAMA5D3 family SoC.
@@ -157,6 +161,7 @@ config SOC_AT91SAM9X5
select SOC_AT91SAM9
select AT91_USE_OLD_CLK
select HAVE_AT91_UTMI
+   select HAVE_AT91_SMD
select HAVE_AT91_USB_CLK
help
  Select this if you are using one of Atmel's AT91SAM9x5 family SoC.
diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
index 61db058..0e92b71 100644
--- a/drivers/clk/at91/Makefile
+++ b/drivers/clk/at91/Makefile
@@ -9,3 +9,4 @@ obj-y += clk-system.o clk-peripheral.o
  obj-$(CONFIG_AT91_PROGRAMMABLE_CLOCKS)+= clk-programmable.o
  obj-$(CONFIG_HAVE_AT91_UTMI)  += clk-utmi.o
  obj-$(CONFIG_HAVE_AT91_USB_CLK)   += clk-usb.o
+obj-$(CONFIG_HAVE_AT91_SMD)+= clk-smd.o
diff --git a/drivers/clk/at91/clk-smd.c b/drivers/clk/at91/clk-smd.c
new file mode 100644
index 000..9f3fa39
--- /dev/null
+++ b/drivers/clk/at91/clk-smd.c
@@ -0,0 +1,173 @@
+/*
+ * drivers/clk/at91/clk-smd.c
+ *
+ *  Copyright (C) 2013 Boris BREZILLON 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "pmc.h"
+
+#define SMD_SOURCE_MAX 2
+
+#define SMD_DIV_SHIFT  8
+#define SMD_MAX_DIV0xf
+
+struct at91sam9x5_clk_smd {
+   struct clk_hw hw;
+   struct at91_pmc *pmc;
+};
+
+#define to_at91sam9x5_clk_smd(hw) \
+   container_of(hw, struct at91sam9x5_clk_smd, hw)
+
+static unsigned long at91sam9x5_clk_smd_recalc_rate(struct clk_hw *hw,
+   unsigned long parent_rate)
+{
+   u32 tmp;
+   u8 smddiv;
+   struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw);
+   struct at91_pmc *pmc = smd->pmc;
+
+   tmp = pmc_read(pmc, AT91_PMC_SMD);
+   smddiv = (tmp & AT91_PMC_SMD_DIV) >> SMD_DIV_SHIFT;
+   return parent_rate / (smddiv + 1);
+}
+
+static long at91sam9x5_clk_smd_round_rate(struct clk_hw *hw, unsigned long 
rate,
+ unsigned long *parent_rate)
+{
+   unsigned long div;
+   unsigned long bestrate;
+   unsigned long tmp;
+
+   if (rate >= *parent_rate)
+   return *parent_rate;
+
+   div = *parent_rate / rate;
+   if (div > SMD_MAX_DIV)
+   return *parent_rate / (SMD_MAX_DIV + 1);
+
+   bestrate = *parent_rate / div;
+   tmp = *parent_rate / (div + 1);
+   if (bestrate - rate > rate - tmp)
+   bestrate = tmp;
+
+   return bestrate;
+}
+
+static int at91sam9x5_clk_smd_set_parent(struct clk_hw *hw, u8 index)
+{
+   u32 tmp;
+   struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw);
+   struct at91_pmc *pmc = smd->pmc;
+
+   if (index > 1)
+   return -EINVAL;
+   tmp = pmc_read(pmc, AT91_PMC_SMD) & ~AT91_PMC_SMDS;
+   if (index)
+   tmp |= AT91_PMC_SMDS;
+   pmc_write(pmc, AT91_PMC_SMD, tmp);
+   return 0;
+}
+
+static u8 at91sam9x5_clk_smd_get_parent(struct clk_hw *hw)
+{
+   struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw);
+   struct at91_pmc *pmc = smd->pmc;
+
+   return pmc_read(pmc, AT91_PMC_SMD) & AT91_PMC_SMDS;
+}
+
+static int at91sam9x5_clk_smd_set_rate(struct clk_hw *hw, unsigned long rate,
+  unsigned long parent_rate)
+{
+   u32 tmp;
+   struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw);
+   struct at91_pmc *pmc = smd->pmc;
+   unsigned long div = parent_rate / rate;
+
+

Re: [PATCH v4 15/17] clk: at91: add PMC clk device tree binding doc.

2013-10-17 Thread Nicolas Ferre

On 11/10/2013 13:38, Boris BREZILLON :

This patch adds new at91 clks dt bindings documentation.

Signed-off-by: Boris BREZILLON 


It seems good

Acked-by: Nicolas Ferre 


---
  .../devicetree/bindings/clock/at91-clock.txt   |  328 
  1 file changed, 328 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/clock/at91-clock.txt

diff --git a/Documentation/devicetree/bindings/clock/at91-clock.txt 
b/Documentation/devicetree/bindings/clock/at91-clock.txt
new file mode 100644
index 000..360d8fe
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/at91-clock.txt
@@ -0,0 +1,328 @@
+Device Tree Clock bindings for arch-at91
+
+This binding uses the common clock binding[1].
+
+[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+Required properties:
+- compatible : shall be one of the following:
+   "atmel,at91rm9200-pmc" or
+   "atmel,at91sam9g45-pmc" or
+   "atmel,at91sam9n12-pmc" or
+   "atmel,at91sam9x5-pmc" or
+   "atmel,sama5d3-pmc":
+   at91 PMC (Power Management Controller)
+   All at91 specific clocks (clocks defined below) must be child
+   node of the PMC node.
+
+   "atmel,at91rm9200-clk-main":
+   at91 main oscillator
+
+   "atmel,at91rm9200-clk-master" or
+   "atmel,at91sam9x5-clk-master":
+   at91 master clock
+
+   "atmel,at91sam9x5-clk-peripheral" or
+   "atmel,at91rm9200-clk-peripheral":
+   at91 peripheral clocks
+
+   "atmel,at91rm9200-clk-pll" or
+   "atmel,at91sam9g45-clk-pll" or
+   "atmel,at91sam9g20-clk-pllb" or
+   "atmel,sama5d3-clk-pll":
+   at91 pll clocks
+
+   "atmel,at91sam9x5-clk-plldiv":
+   at91 plla divisor
+
+   "atmel,at91rm9200-clk-programmable" or
+   "atmel,at91sam9g45-clk-programmable" or
+   "atmel,at91sam9x5-clk-programmable":
+   at91 programmable clocks
+
+   "atmel,at91sam9x5-clk-smd":
+   at91 SMD (Soft Modem) clock
+
+   "atmel,at91rm9200-clk-system":
+   at91 system clocks
+
+   "atmel,at91rm9200-clk-usb" or
+   "atmel,at91sam9x5-clk-usb" or
+   "atmel,at91sam9n12-clk-usb":
+   at91 usb clock
+
+   "atmel,at91sam9x5-clk-utmi":
+   at91 utmi clock
+
+Required properties for PMC node:
+- reg : defines the IO memory reserved for the PMC.
+- interrupts : shall be set to PMC interrupt line.
+- interrupt-controller : tell that the PMC is an interrupt controller.
+- #interrupt-cells : must be set to 1. The first cell encodes the interrupt id,
+   and reflect the bit position in the PMC_ER/DR/SR registers.
+   You can use the dt macros defined in dt-bindings/clk/at91.h.
+   0 (AT91_PMC_MOSCS) -> main oscillator ready
+   1 (AT91_PMC_LOCKA) -> PLL A ready
+   2 (AT91_PMC_LOCKB) -> PLL B ready
+   3 (AT91_PMC_MCKRDY) -> master clock ready
+   6 (AT91_PMC_LOCKU) -> UTMI PLL clock ready
+   8 .. 15 (AT91_PMC_PCKRDY(id)) -> programmable clock ready
+   16 (AT91_PMC_MOSCSELS) -> main oscillator selected
+   17 (AT91_PMC_MOSCRCS) -> RC main oscillator stabilized
+   18 (AT91_PMC_CFDEV) -> clock failure detected
+
+For example:
+   pmc: pmc@fc00 {
+   compatible = "atmel,sama5d3-pmc";
+   interrupts = <1 4 7>;
+   interrupt-controller;
+   #interrupt-cells = <2>;
+
+   /* put at91 clocks here */
+   };
+
+Required properties for main clock:
+- interrupt-parent : must reference the PMC node.
+- interrupts : shall be set to "<0>".
+- #clock-cells : from common clock binding; shall be set to 0.
+- clocks (optional if clock-frequency is provided) : shall be the slow clock
+   phandle. This clock is used to calculate the main clock rate if
+   "clock-frequency" is not provided.
+- clock-frequency : the main oscillator frequency.Prefer the use of
+   "clock-frequency" over automatic clock rate calculation.
+
+For example:
+   main: mainck {
+   compatible = "atmel,at91rm9200-clk-main";
+   interrupt-parent = <&pmc>;
+   interrupts = <0>;
+   #clock-cells = <0>;
+   clocks = <&ck32k>;
+   clock-frequency = <18432000>;
+   };
+
+Required properties for master clock:
+- interrupt-parent : must reference the PMC node.
+- interrupts : shall be set to "<3>".
+- #clock-cells : from common clock binding; shall be set to 0.
+- clocks : shall be the master clock sources (see atmel datasheet) phandl

Re: [PATCH v5 13/17] clk: at91: add PMC usb clock

2013-10-18 Thread Nicolas Ferre

On 17/10/2013 18:55, Boris BREZILLON :

This patch adds new at91 usb clock implementation using common clk framework.
This clock is used to clock usb ports (ohci, ehci and udc).

Signed-off-by: Boris BREZILLON 
Acked-by: Nicolas Ferre 


Ok, this one is now replacing the older 13/17.

Thanks Boris.

Bye,


---
  arch/arm/mach-at91/Kconfig |   11 ++
  drivers/clk/at91/Makefile  |1 +
  drivers/clk/at91/clk-usb.c |  400 
  drivers/clk/at91/pmc.c |   15 ++
  drivers/clk/at91/pmc.h |9 +
  5 files changed, 436 insertions(+)
  create mode 100644 drivers/clk/at91/clk-usb.c

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 6ad37da..b76dc4c 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -3,6 +3,9 @@ if ARCH_AT91
  config HAVE_AT91_UTMI
bool

+config HAVE_AT91_USB_CLK
+   bool
+
  config HAVE_AT91_DBGU0
bool

@@ -82,6 +85,7 @@ config SOC_SAMA5D3
select HAVE_AT91_DBGU1
select AT91_USE_OLD_CLK
select HAVE_AT91_UTMI
+   select HAVE_AT91_USB_CLK
help
  Select this if you are using one of Atmel's SAMA5D3 family SoC.
  This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35.
@@ -96,12 +100,14 @@ config SOC_AT91RM9200
select MULTI_IRQ_HANDLER
select SPARSE_IRQ
select AT91_USE_OLD_CLK
+   select HAVE_AT91_USB_CLK

  config SOC_AT91SAM9260
bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20"
select HAVE_AT91_DBGU0
select SOC_AT91SAM9
select AT91_USE_OLD_CLK
+   select HAVE_AT91_USB_CLK
help
  Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE
  or AT91SAM9G20 SoC.
@@ -112,6 +118,7 @@ config SOC_AT91SAM9261
select HAVE_FB_ATMEL
select SOC_AT91SAM9
select AT91_USE_OLD_CLK
+   select HAVE_AT91_USB_CLK
help
  Select this if you are using one of Atmel's AT91SAM9261 or 
AT91SAM9G10 SoC.

@@ -121,6 +128,7 @@ config SOC_AT91SAM9263
select HAVE_FB_ATMEL
select SOC_AT91SAM9
select AT91_USE_OLD_CLK
+   select HAVE_AT91_USB_CLK

  config SOC_AT91SAM9RL
bool "AT91SAM9RL"
@@ -137,6 +145,7 @@ config SOC_AT91SAM9G45
select SOC_AT91SAM9
select AT91_USE_OLD_CLK
select HAVE_AT91_UTMI
+   select HAVE_AT91_USB_CLK
help
  Select this if you are using one of Atmel's AT91SAM9G45 family SoC.
  This support covers AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and 
AT91SAM9M11.
@@ -148,6 +157,7 @@ config SOC_AT91SAM9X5
select SOC_AT91SAM9
select AT91_USE_OLD_CLK
select HAVE_AT91_UTMI
+   select HAVE_AT91_USB_CLK
help
  Select this if you are using one of Atmel's AT91SAM9x5 family SoC.
  This means that your SAM9 name finishes with a '5' (except if it is
@@ -161,6 +171,7 @@ config SOC_AT91SAM9N12
select HAVE_FB_ATMEL
select SOC_AT91SAM9
select AT91_USE_OLD_CLK
+   select HAVE_AT91_USB_CLK
help
  Select this if you are using Atmel's AT91SAM9N12 SoC.

diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
index a824883..61db058 100644
--- a/drivers/clk/at91/Makefile
+++ b/drivers/clk/at91/Makefile
@@ -8,3 +8,4 @@ obj-y += clk-system.o clk-peripheral.o

  obj-$(CONFIG_AT91_PROGRAMMABLE_CLOCKS)+= clk-programmable.o
  obj-$(CONFIG_HAVE_AT91_UTMI)  += clk-utmi.o
+obj-$(CONFIG_HAVE_AT91_USB_CLK)+= clk-usb.o
diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c
new file mode 100644
index 000..0454555
--- /dev/null
+++ b/drivers/clk/at91/clk-usb.c
@@ -0,0 +1,400 @@
+/*
+ * drivers/clk/at91/clk-usb.c
+ *
+ *  Copyright (C) 2013 Boris BREZILLON 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "pmc.h"
+
+#define USB_SOURCE_MAX 2
+
+#define SAM9X5_USB_DIV_SHIFT   8
+#define SAM9X5_USB_MAX_DIV 0xf
+
+#define RM9200_USB_DIV_SHIFT   28
+#define RM9200_USB_DIV_TAB_SIZE4
+
+struct at91sam9x5_clk_usb {
+   struct clk_hw hw;
+   struct at91_pmc *pmc;
+};
+
+#define to_at91sam9x5_clk_usb(hw) \
+   container_of(hw, struct at91sam9x5_clk_usb, hw)
+
+struct at91rm9200_clk_usb {
+   struct clk_hw hw;
+   struct at91_pmc *pmc;
+   u32 divisors[4];
+};
+
+#define to_at91rm9200_clk_usb(hw) \
+   container_of(hw, struct at91rm9200_clk_usb, hw)
+
+static unsigned long at91sam9x5_clk_usb_recalc_rate(struct clk_hw *hw,
+   unsigned long parent_rate)
+{
+   

Re: [PATCH v4 00/17] ARM: at91: move to common clk framework

2013-10-18 Thread Nicolas Ferre
s/clk/at91/clk-pll.c |  539 
  drivers/clk/at91/clk-plldiv.c  |  137 +
  drivers/clk/at91/clk-programmable.c|  423 +++
  drivers/clk/at91/clk-smd.c |  173 +++
  drivers/clk/at91/clk-system.c  |  193 +++
  drivers/clk/at91/clk-usb.c |  400 +++
  drivers/clk/at91/clk-utmi.c|  162 ++
  drivers/clk/at91/pmc.c |  372 ++
  drivers/clk/at91/pmc.h |  113 
  drivers/usb/gadget/atmel_usba_udc.c|2 +-
  include/dt-bindings/clk/at91.h |   28 +
  .../include/mach => include/linux/clk}/at91_pmc.h  |4 +-
  36 files changed, 3847 insertions(+), 20 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/clock/at91-clock.txt
  create mode 100644 drivers/clk/at91/Makefile
  create mode 100644 drivers/clk/at91/clk-main.c
  create mode 100644 drivers/clk/at91/clk-master.c
  create mode 100644 drivers/clk/at91/clk-peripheral.c
  create mode 100644 drivers/clk/at91/clk-pll.c
  create mode 100644 drivers/clk/at91/clk-plldiv.c
  create mode 100644 drivers/clk/at91/clk-programmable.c
  create mode 100644 drivers/clk/at91/clk-smd.c
  create mode 100644 drivers/clk/at91/clk-system.c
  create mode 100644 drivers/clk/at91/clk-usb.c
  create mode 100644 drivers/clk/at91/clk-utmi.c
  create mode 100644 drivers/clk/at91/pmc.c
  create mode 100644 drivers/clk/at91/pmc.h
  create mode 100644 include/dt-bindings/clk/at91.h
  rename {arch/arm/mach-at91/include/mach => include/linux/clk}/at91_pmc.h (98%)




--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 3/6] ARM: at91/dt: define sama5d3 clocks

2013-10-18 Thread Nicolas Ferre

On 11/10/2013 14:43, Boris BREZILLON :

Define sama5d3 clocks in sama5d3 device tree.
Add references to the appropriate clocks in each peripheral.

Signed-off-by: Boris BREZILLON 


good:
Acked-by: Nicolas Ferre 


---
  arch/arm/boot/dts/sama5d3.dtsi  |  331 ++-
  arch/arm/boot/dts/sama5d3_can.dtsi  |   18 ++
  arch/arm/boot/dts/sama5d3_emac.dtsi |   10 ++
  arch/arm/boot/dts/sama5d3_gmac.dtsi |   10 ++
  arch/arm/boot/dts/sama5d3_lcd.dtsi  |   15 ++
  arch/arm/boot/dts/sama5d3_mci2.dtsi |   11 ++
  arch/arm/boot/dts/sama5d3_tcb1.dtsi |   12 ++
  arch/arm/boot/dts/sama5d3_uart.dtsi |   19 ++
  8 files changed, 425 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index 5cdaba4..c4dad3b 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -13,6 +13,7 @@
  #include 
  #include 
  #include 
+#include 

  / {
model = "Atmel SAMA5D3 family SoC";
@@ -56,6 +57,14 @@
reg = <0x2000 0x800>;
};

+   clocks {
+   adc_op_clk: adc_op_clk{
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <2000>;
+   };
+   };
+
ahb {
compatible = "simple-bus";
#address-cells = <1>;
@@ -79,6 +88,8 @@
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
+   clocks = <&periph 21>;
+   clock-names = "mci_clk";
};

spi0: spi@f0004000 {
@@ -92,6 +103,8 @@
dma-names = "tx", "rx";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_spi0>;
+   clocks = <&periph 24>;
+   clock-names = "spi_clk";
status = "disabled";
};

@@ -101,6 +114,8 @@
interrupts = <38 IRQ_TYPE_LEVEL_HIGH 4>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
+   clocks = <&periph 38>;
+   clock-names = "pclk";
status = "disabled";
};

@@ -108,6 +123,8 @@
compatible = "atmel,at91sam9x5-tcb";
reg = <0xf001 0x100>;
interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0>;
+   clocks = <&periph 26>;
+   clock-names = "t0_clk";
};

i2c0: i2c@f0014000 {
@@ -121,6 +138,7 @@
pinctrl-0 = <&pinctrl_i2c0>;
#address-cells = <1>;
#size-cells = <0>;
+   clocks = <&periph 18>;
status = "disabled";
};

@@ -135,6 +153,7 @@
pinctrl-0 = <&pinctrl_i2c1>;
#address-cells = <1>;
#size-cells = <0>;
+   clocks = <&periph 19>;
status = "disabled";
};

@@ -144,6 +163,8 @@
interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usart0>;
+   clocks = <&periph 12>;
+   clock-names = "usart";
status = "disabled";
};

@@ -153,6 +174,8 @@
interrupts = <13 IRQ_TYPE_LEVEL_HIGH 5>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usart1>;
+   clocks = <&periph 13>;
+   clock-names = "usart";
status = "disabled";
};

@@ -174,6 +197,8 @@
status = "disabled";
 

Re: [PATCH v2 6/6] ARM: at91/dt: remove old clk material

2013-10-18 Thread Nicolas Ferre

On 11/10/2013 14:43, Boris BREZILLON :

This patch removes the old main clk node which is now useless as sama5d3
SoCs and boards are no longer compatible with the old at91 clk
implementations.

It also remove old clock definitions (clock definitions using at91 old clk
framework).

Signed-off-by: Boris BREZILLON 


Happy to see all these lines removed!
Acked-by: Nicolas Ferre 

I am looking forward the same result on other SoCs.


---
  arch/arm/boot/dts/sama5d3xcm.dtsi |   11 --
  arch/arm/mach-at91/sama5d3.c  |  346 -
  2 files changed, 357 deletions(-)

diff --git a/arch/arm/boot/dts/sama5d3xcm.dtsi 
b/arch/arm/boot/dts/sama5d3xcm.dtsi
index dce5419..f55ed07 100644
--- a/arch/arm/boot/dts/sama5d3xcm.dtsi
+++ b/arch/arm/boot/dts/sama5d3xcm.dtsi
@@ -18,17 +18,6 @@
reg = <0x2000 0x2000>;
};

-   clocks {
-   #address-cells = <1>;
-   #size-cells = <1>;
-   ranges;
-
-   main_clock: clock@0 {
-   compatible = "atmel,osc", "fixed-clock";
-   clock-frequency = <1200>;
-   };
-   };
-
ahb {
apb {
spi0: spi@f0004000 {
diff --git a/arch/arm/mach-at91/sama5d3.c b/arch/arm/mach-at91/sama5d3.c
index 3426098..ae58fea 100644
--- a/arch/arm/mach-at91/sama5d3.c
+++ b/arch/arm/mach-at91/sama5d3.c
@@ -21,349 +21,6 @@
  #include "generic.h"
  #include "sam9_smc.h"

-#if defined(CONFIG_OLD_CLK_AT91)
-#include "clock.h"
-/* 
- *  Clocks
- *  */
-
-/*
- * The peripheral clocks.
- */
-
-static struct clk pioA_clk = {
-   .name   = "pioA_clk",
-   .pid= SAMA5D3_ID_PIOA,
-   .type   = CLK_TYPE_PERIPHERAL,
-};
-static struct clk pioB_clk = {
-   .name   = "pioB_clk",
-   .pid= SAMA5D3_ID_PIOB,
-   .type   = CLK_TYPE_PERIPHERAL,
-};
-static struct clk pioC_clk = {
-   .name   = "pioC_clk",
-   .pid= SAMA5D3_ID_PIOC,
-   .type   = CLK_TYPE_PERIPHERAL,
-};
-static struct clk pioD_clk = {
-   .name   = "pioD_clk",
-   .pid= SAMA5D3_ID_PIOD,
-   .type   = CLK_TYPE_PERIPHERAL,
-};
-static struct clk pioE_clk = {
-   .name   = "pioE_clk",
-   .pid= SAMA5D3_ID_PIOE,
-   .type   = CLK_TYPE_PERIPHERAL,
-};
-static struct clk usart0_clk = {
-   .name   = "usart0_clk",
-   .pid= SAMA5D3_ID_USART0,
-   .type   = CLK_TYPE_PERIPHERAL,
-   .div= AT91_PMC_PCR_DIV2,
-};
-static struct clk usart1_clk = {
-   .name   = "usart1_clk",
-   .pid= SAMA5D3_ID_USART1,
-   .type   = CLK_TYPE_PERIPHERAL,
-   .div= AT91_PMC_PCR_DIV2,
-};
-static struct clk usart2_clk = {
-   .name   = "usart2_clk",
-   .pid= SAMA5D3_ID_USART2,
-   .type   = CLK_TYPE_PERIPHERAL,
-   .div= AT91_PMC_PCR_DIV2,
-};
-static struct clk usart3_clk = {
-   .name   = "usart3_clk",
-   .pid= SAMA5D3_ID_USART3,
-   .type   = CLK_TYPE_PERIPHERAL,
-   .div= AT91_PMC_PCR_DIV2,
-};
-static struct clk uart0_clk = {
-   .name   = "uart0_clk",
-   .pid= SAMA5D3_ID_UART0,
-   .type   = CLK_TYPE_PERIPHERAL,
-   .div= AT91_PMC_PCR_DIV2,
-};
-static struct clk uart1_clk = {
-   .name   = "uart1_clk",
-   .pid= SAMA5D3_ID_UART1,
-   .type   = CLK_TYPE_PERIPHERAL,
-   .div= AT91_PMC_PCR_DIV2,
-};
-static struct clk twi0_clk = {
-   .name   = "twi0_clk",
-   .pid= SAMA5D3_ID_TWI0,
-   .type   = CLK_TYPE_PERIPHERAL,
-   .div= AT91_PMC_PCR_DIV2,
-};
-static struct clk twi1_clk = {
-   .name   = "twi1_clk",
-   .pid= SAMA5D3_ID_TWI1,
-   .type   = CLK_TYPE_PERIPHERAL,
-   .div= AT91_PMC_PCR_DIV2,
-};
-static struct clk twi2_clk = {
-   .name   = "twi2_clk",
-   .pid= SAMA5D3_ID_TWI2,
-   .type   = CLK_TYPE_PERIPHERAL,
-   .div= AT91_PMC_PCR_DIV2,
-};
-static struct clk mmc0_clk = {
-   .name   = "mci0_clk",
-   .pid= SAMA5D3_ID_HSMCI0,
-   .type   = CLK_TYPE_PERIPHERAL,
-};
-static struct clk mmc1_clk = {
-   .name   = "mci1_clk",
-   .pid= SAMA5D3_I

[GIT PULL] at91: cleanup and preparation for the move to common clk #1

2013-10-18 Thread Nicolas Ferre
Arnd, Olof, Kevin,

This is the first AT91 pull-request for 3.13. I delayed the inclusion of
material for AT91 as I wanted to build this "cleanup" series with the patches
for moving AT91 to common clock framerowk. Now that the (big) series is nearly
finished, I can send you the first patches that are targetted at preparing the
landing...

I plan to build another pull-request for the whole move to common clk framework
early next week, if I manage to get the appropiate tags from Mike and the DT
maintainers.

The work that is beginning here is a big step toward AT91 integratin the
multi-arch movement and removal of a bunch of code that bloats the mach-at91
directory.

Thanks, best regards,

The following changes since commit 4a10c2ac2f368583138b774ca41fac4207911983:

  Linux 3.12-rc2 (2013-09-23 15:41:09 -0700)

are available in the git repository at:

  git://github.com/at91linux/linux-at91.git tags/at91-cleanup

for you to fetch changes up to 70e389cc7fedc4c279ef28e970658a39adc7dec7:

  MAINTAINERS: Add patterns for DTS files for AT91 (2013-10-16 16:22:56 +0200)


First cleanup series for 3.13
- a little non-urgent fix
- addition of DT files to MAINTAINERS
- more important, the splitting of .dtsi files
  that allows to precisely choose the peripherals
  that are present for a particular SoC.
  It is useful for upcoming move to common cloks.


Bartlomiej Zolnierkiewicz (1):
  ARM: at91: cam60: fix incorrect placement of __initdata tag

Boris BREZILLON (2):
  ARM: at91/dt: split sam9x5 peripheral definitions
  ARM: at91/dt: split sama5d3 peripheral definitions

Mark Brown (1):
  MAINTAINERS: Add patterns for DTS files for AT91

Nicolas Ferre (1):
  ARM: at91: remove init_machine() as default is suitable

 MAINTAINERS  |   4 +
 arch/arm/boot/dts/at91sam9g25.dtsi   |   2 +
 arch/arm/boot/dts/at91sam9g35.dtsi   |   1 +
 arch/arm/boot/dts/at91sam9x25.dtsi   |  24 +---
 arch/arm/boot/dts/at91sam9x35.dtsi   |   1 +
 arch/arm/boot/dts/at91sam9x5.dtsi|  67 --
 arch/arm/boot/dts/at91sam9x5_macb0.dtsi  |  56 +
 arch/arm/boot/dts/at91sam9x5_macb1.dtsi  |  44 +++
 arch/arm/boot/dts/at91sam9x5_usart3.dtsi |  51 
 arch/arm/boot/dts/sama5d3.dtsi   | 203 ---
 arch/arm/boot/dts/sama5d31.dtsi  |  16 +++
 arch/arm/boot/dts/sama5d31ek.dts |   3 +-
 arch/arm/boot/dts/sama5d33.dtsi  |  14 +++
 arch/arm/boot/dts/sama5d33ek.dts |   3 +-
 arch/arm/boot/dts/sama5d34.dtsi  |  16 +++
 arch/arm/boot/dts/sama5d34ek.dts |   3 +-
 arch/arm/boot/dts/sama5d35.dtsi  |  18 +++
 arch/arm/boot/dts/sama5d35ek.dts |   3 +-
 arch/arm/boot/dts/sama5d3_can.dtsi   |  54 
 arch/arm/boot/dts/sama5d3_emac.dtsi  |  44 +++
 arch/arm/boot/dts/sama5d3_gmac.dtsi  |  77 
 arch/arm/boot/dts/sama5d3_lcd.dtsi   |  55 +
 arch/arm/boot/dts/sama5d3_mci2.dtsi  |  47 +++
 arch/arm/boot/dts/sama5d3_tcb1.dtsi  |  27 
 arch/arm/boot/dts/sama5d3_uart.dtsi  |  53 
 arch/arm/boot/dts/sama5d3xcm.dtsi|   1 -
 arch/arm/mach-at91/board-cam60.c |   2 +-
 arch/arm/mach-at91/board-dt-rm9200.c |   7 --
 arch/arm/mach-at91/board-dt-sam9.c   |   7 --
 29 files changed, 592 insertions(+), 311 deletions(-)
 create mode 100644 arch/arm/boot/dts/at91sam9x5_macb0.dtsi
 create mode 100644 arch/arm/boot/dts/at91sam9x5_macb1.dtsi
 create mode 100644 arch/arm/boot/dts/at91sam9x5_usart3.dtsi
 create mode 100644 arch/arm/boot/dts/sama5d31.dtsi
 create mode 100644 arch/arm/boot/dts/sama5d33.dtsi
 create mode 100644 arch/arm/boot/dts/sama5d34.dtsi
 create mode 100644 arch/arm/boot/dts/sama5d35.dtsi
 create mode 100644 arch/arm/boot/dts/sama5d3_can.dtsi
 create mode 100644 arch/arm/boot/dts/sama5d3_emac.dtsi
 create mode 100644 arch/arm/boot/dts/sama5d3_gmac.dtsi
 create mode 100644 arch/arm/boot/dts/sama5d3_lcd.dtsi
 create mode 100644 arch/arm/boot/dts/sama5d3_mci2.dtsi
 create mode 100644 arch/arm/boot/dts/sama5d3_tcb1.dtsi
 create mode 100644 arch/arm/boot/dts/sama5d3_uart.dtsi

-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] at91: dt for 3.13 #1

2013-10-18 Thread Nicolas Ferre
Arnd, Olof, Kevin,

First AT91 DT-related pull-request for 3.13. These patches will not mess with 
my other
"cleanup" pull-request sent today.
It allows to enable sound on the at91sam9n12ek board.

Thanks, best regards,

The following changes since commit 4a10c2ac2f368583138b774ca41fac4207911983:

  Linux 3.12-rc2 (2013-09-23 15:41:09 -0700)

are available in the git repository at:

  git://github.com/at91linux/linux-at91.git tags/at91-dt

for you to fetch changes up to e483341ce82750a1b526b65b7178213dcf967a7a:

  ARM: at91: remove pinctrl conflict between mmc and SPI for at91sam9g20ek 
(2013-10-18 16:50:13 +0200)


First DT series for 3.13
- addition of sound for at91sam9n12
- a little fix for MMC vs. SPI on at91sam9g20ek


Bo Shen (5):
  ARM: at91: add at91sam9n12 ssc clock in look up table
  ARM: at91: add ssc dma parameter for at91sam9n12
  ARM: at91: enable wm8904 on at91sam9n12ek board
  ARM: at91: enable ssc on at91sam9n12ek board
  ARM: at91: add sound support on at91sam9n12ek board

Jean-Christophe PLAGNIOL-VILLARD (1):
  ARM: at91: remove pinctrl conflict between mmc and SPI for at91sam9g20ek

 arch/arm/boot/dts/at91sam9g20ek_common.dtsi |  1 -
 arch/arm/boot/dts/at91sam9n12.dtsi  |  3 +++
 arch/arm/boot/dts/at91sam9n12ek.dts | 34 +
 arch/arm/mach-at91/at91sam9n12.c|  1 +
 4 files changed, 38 insertions(+), 1 deletion(-)

-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ARM: at91: remove redundant dependency

2013-11-20 Thread Nicolas Ferre

On 20/11/2013 08:23, Michael Opdenacker :

From: Yanis Moreno 

This removes the "depends on SOC_SAM_V7" statement
in a Kconfig section that's under an "if SOC_SAM_V7"
condition (same parameter).

Signed-off-by: Yanis Moreno 
Reviewed-by: Michael Opdenacker 



Acked-by: Nicolas Ferre 

Thanks for this fix. Integrated in at91-3.14-cleanup branch.
Best regards.


---
  arch/arm/mach-at91/Kconfig |1 -
  1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 699b71e..d1b3fe5 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -61,7 +61,6 @@ comment "Atmel AT91 Processor"
  if SOC_SAM_V7
  config SOC_SAMA5D3
bool "SAMA5D3 family"
-   depends on SOC_SAM_V7
select SOC_SAMA5
select HAVE_FB_ATMEL
    select HAVE_AT91_DBGU1




--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RESEND 0/7] crypto: at91/atmel: add Device Tree support

2013-11-20 Thread Nicolas Ferre

On 08/11/2013 16:08, Nicolas Ferre :

This series adds Device Tree support to the Atmel crypto drivers
(AES/[T]DES/SHA). The Device Tree entries are very simple and only
declare the reg/irq values and the link to DMA.


Herbert,

ping?

Could I have your "Acked-by" for taking these patches through the 
arm-soc git tree, or do you want that we split this series so that you 
can take the driver part of it?


Best regards,



Some trivial patches are preceding this move to Device Tree to clean
things up beforehand.

The series has already been sent but a little bit scattered. So I collect
everything, this time.

Nicolas Ferre (7):
   ARM: at91/dt/trivial: use macro for AES irq type
   ARM: at91/dt/trivial: before sama5d3, Atmel MPU were using at91 prefix
   ARM: at91/dt/sama5d3: add DMA information to SHA/AES/TDES nodes
   crypto: atmel-aes - add support for Device Tree
   crypto: atmel-tdes - add support for Device Tree
   crypto: atmel-sha - add support for Device Tree
   crypto: atmel-sha - add sha information to the log

  .../devicetree/bindings/crypto/atmel-crypto.txt|  68 ++
  arch/arm/boot/dts/sama5d3.dtsi |  16 ++-
  drivers/crypto/atmel-aes.c | 143 ++---
  drivers/crypto/atmel-sha.c | 103 +++
  drivers/crypto/atmel-tdes.c| 143 ++---
  5 files changed, 346 insertions(+), 127 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/crypto/atmel-crypto.txt




--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 8/9] ARM: at91/dt: add new at91rm9200ek_mmc board

2013-11-21 Thread Nicolas Ferre

On 20/11/2013 18:27, Jean-Christophe PLAGNIOL-VILLARD :

On 17:31 Wed 20 Nov , boris brezillon wrote:

On 20/11/2013 16:02, Jean-Christophe PLAGNIOL-VILLARD wrote:

On 14:37 Wed 28 Aug , Boris BREZILLON wrote:

Add a new at91rm9200ek_mmc board (based on at91rm9200ek board) which enables
mmc0/slot0.

no for multiple dts

this need to handle at user space level


You mean, by controlling the regulator using the sysfs interface, or
by loading
only the appropriate driver ?

load the partial dts via userspace


Right, but Jean-Christophe, we know that DT fragments are not available 
in mainline yet (even if the effort is ongoing). So what should we do in 
the meantime?



What if both drivers are loaded (or not compiled as modules) ?
This will lead to one device being unusable (and maybe even worst)...


this will never be the case


Can you please elaborate? It is a bit frustrating to have to ask you 
again and again to explain more your thoughts...


Bye,


Best Regards,
J.

Please explain what you had in mind ?



Best Regards,
J.

Signed-off-by: Boris BREZILLON 
---
  arch/arm/boot/dts/at91rm9200ek_mmc.dts |   23 +++
  1 file changed, 23 insertions(+)
  create mode 100644 arch/arm/boot/dts/at91rm9200ek_mmc.dts

diff --git a/arch/arm/boot/dts/at91rm9200ek_mmc.dts 
b/arch/arm/boot/dts/at91rm9200ek_mmc.dts
new file mode 100644
index 000..c87a861
--- /dev/null
+++ b/arch/arm/boot/dts/at91rm9200ek_mmc.dts
@@ -0,0 +1,23 @@
+/*
+ * at91rm9200ek.dts - Device Tree file for Atmel AT91RM9200 evaluation kit with
+ *an MMC slot
+ *
+ *  Copyright (C) 2013 Boris BREZILLON 
+ *
+ * Licensed under GPLv2 only
+ */
+/dts-v1/;
+#include "at91rm9200ek.dts"
+
+/ {
+   model = "Atmel AT91RM9200 evaluation kit with MMC slot";
+   compatible = "atmel,at91rm9200ek-mmc", "atmel,at91rm9200ek", 
"atmel,at91rm9200";
+
+   ahb {
+   apb {
+   mmc0: mmc@fffb4000 {
+   status = "okay";
+   };
+       };
+   };
+};
--
1.7.9.5








--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ARM: at91: remove init_machine() as default is suitable

2013-10-11 Thread Nicolas Ferre
Since 883a106b0866ca8d75b5520bdb3ca1cf8e3730ba (ARM: default
machine descriptor for multiplatform) we can remove the SoC-specific
callback init_machine() to use the default code.
This cleans up the code and reduces the number of lines.

Signed-off-by: Nicolas Ferre 
---
 arch/arm/mach-at91/board-dt-rm9200.c | 7 ---
 arch/arm/mach-at91/board-dt-sam9.c   | 7 ---
 2 files changed, 14 deletions(-)

diff --git a/arch/arm/mach-at91/board-dt-rm9200.c 
b/arch/arm/mach-at91/board-dt-rm9200.c
index 3fcb662..3a185fa 100644
--- a/arch/arm/mach-at91/board-dt-rm9200.c
+++ b/arch/arm/mach-at91/board-dt-rm9200.c
@@ -14,7 +14,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -36,11 +35,6 @@ static void __init at91rm9200_dt_init_irq(void)
of_irq_init(irq_of_match);
 }
 
-static void __init at91rm9200_dt_device_init(void)
-{
-   of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-}
-
 static const char *at91rm9200_dt_board_compat[] __initdata = {
"atmel,at91rm9200",
NULL
@@ -52,6 +46,5 @@ DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device 
Tree)")
.handle_irq = at91_aic_handle_irq,
.init_early = at91rm9200_dt_initialize,
.init_irq   = at91rm9200_dt_init_irq,
-   .init_machine   = at91rm9200_dt_device_init,
.dt_compat  = at91rm9200_dt_board_compat,
 MACHINE_END
diff --git a/arch/arm/mach-at91/board-dt-sam9.c 
b/arch/arm/mach-at91/board-dt-sam9.c
index 8db3013..3dab868 100644
--- a/arch/arm/mach-at91/board-dt-sam9.c
+++ b/arch/arm/mach-at91/board-dt-sam9.c
@@ -13,7 +13,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -37,11 +36,6 @@ static void __init at91_dt_init_irq(void)
of_irq_init(irq_of_match);
 }
 
-static void __init at91_dt_device_init(void)
-{
-   of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-}
-
 static const char *at91_dt_board_compat[] __initdata = {
"atmel,at91sam9",
NULL
@@ -54,6 +48,5 @@ DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM (Device Tree)")
.handle_irq = at91_aic_handle_irq,
.init_early = at91_dt_initialize,
.init_irq   = at91_dt_init_irq,
-   .init_machine   = at91_dt_device_init,
.dt_compat  = at91_dt_board_compat,
 MACHINE_END
-- 
1.8.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/5] ARM:at91:enable sound on at91sam9n12ek board

2013-10-14 Thread Nicolas Ferre

On 14/10/2013 07:38, Bo Shen :

This patch series enable sound on at91sam9n12ek board with wm8904 codec


Bo Shen (5):
   ARM: at91: add at91sam9n12 ssc clock in look up table
   ARM: at91: add ssc dma parameter for at91sam9n12
   ARM: at91: enable wm8904 on at91sam9n12ek board
   ARM: at91: enable ssc on at91sam9n12ek board
   ARM: at91: add sound support on at91sam9n12ek board


Great!

And on the whole patch series:

Acked-by: Nicolas Ferre 

I stack it on at91-3.13-dt branch.

Thanks.



  arch/arm/boot/dts/at91sam9n12.dtsi  |3 +++
  arch/arm/boot/dts/at91sam9n12ek.dts |   34 ++
  arch/arm/mach-at91/at91sam9n12.c|1 +
  3 files changed, 38 insertions(+)




--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] crypto: atmel-aes - add support for Device Tree

2013-10-14 Thread Nicolas Ferre
Add support for Device Tree and use of the DMA DT API to
get the needed channels.
Documentation is added for these DT nodes.

Initial code by: Nicolas Royer and Eukrea.

Signed-off-by: Nicolas Ferre 
---
 .../devicetree/bindings/crypto/atmel-crypto.txt|  23 
 drivers/crypto/atmel-aes.c | 143 ++---
 2 files changed, 117 insertions(+), 49 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/crypto/atmel-crypto.txt

diff --git a/Documentation/devicetree/bindings/crypto/atmel-crypto.txt 
b/Documentation/devicetree/bindings/crypto/atmel-crypto.txt
new file mode 100644
index 000..d273f0b
--- /dev/null
+++ b/Documentation/devicetree/bindings/crypto/atmel-crypto.txt
@@ -0,0 +1,23 @@
+* Atmel HW cryptographic accelerators
+
+These are the HW cryptographic accelerators found on some Atmel products.
+
+* Advanced Encryption Standard (AES)
+
+Required properties:
+- compatible : Should be "atmel,at91sam9g46-aes".
+- reg: Should contain AES registers location and length.
+- interrupts: Should contain the IRQ line for the AES.
+- dmas: List of two DMA specifiers as described in
+atmel-dma.txt and dma.txt files.
+- dma-names: Contains one identifier string for each DMA specifier
+ in the dmas property.
+
+Example:
+aes@f8038000 {
+   compatible = "atmel,at91sam9g46-aes";
+   reg = <0xf8038000 0x100>;
+   interrupts = <43 4 0>;
+   dmas = <&dma1 2 18>,
+  <&dma1 2 19>;
+   dma-names = "tx", "rx";
diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c
index c1efd91..d7c9e31 100644
--- a/drivers/crypto/atmel-aes.c
+++ b/drivers/crypto/atmel-aes.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -39,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "atmel-aes-regs.h"
 
 #define CFB8_BLOCK_SIZE1
@@ -747,59 +749,50 @@ static int atmel_aes_dma_init(struct atmel_aes_dev *dd,
struct crypto_platform_data *pdata)
 {
int err = -ENOMEM;
-   dma_cap_mask_t mask_in, mask_out;
+   dma_cap_mask_t mask;
+
+   dma_cap_zero(mask);
+   dma_cap_set(DMA_SLAVE, mask);
+
+   /* Try to grab 2 DMA channels */
+   dd->dma_lch_in.chan = dma_request_slave_channel_compat(mask,
+   atmel_aes_filter, &pdata->dma_slave->rxdata, dd->dev, 
"tx");
+   if (!dd->dma_lch_in.chan)
+   goto err_dma_in;
+
+   dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV;
+   dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base +
+   AES_IDATAR(0);
+   dd->dma_lch_in.dma_conf.src_maxburst = dd->caps.max_burst_size;
+   dd->dma_lch_in.dma_conf.src_addr_width =
+   DMA_SLAVE_BUSWIDTH_4_BYTES;
+   dd->dma_lch_in.dma_conf.dst_maxburst = dd->caps.max_burst_size;
+   dd->dma_lch_in.dma_conf.dst_addr_width =
+   DMA_SLAVE_BUSWIDTH_4_BYTES;
+   dd->dma_lch_in.dma_conf.device_fc = false;
+
+   dd->dma_lch_out.chan = dma_request_slave_channel_compat(mask,
+   atmel_aes_filter, &pdata->dma_slave->txdata, dd->dev, 
"rx");
+   if (!dd->dma_lch_out.chan)
+   goto err_dma_out;
+
+   dd->dma_lch_out.dma_conf.direction = DMA_DEV_TO_MEM;
+   dd->dma_lch_out.dma_conf.src_addr = dd->phys_base +
+   AES_ODATAR(0);
+   dd->dma_lch_out.dma_conf.src_maxburst = dd->caps.max_burst_size;
+   dd->dma_lch_out.dma_conf.src_addr_width =
+   DMA_SLAVE_BUSWIDTH_4_BYTES;
+   dd->dma_lch_out.dma_conf.dst_maxburst = dd->caps.max_burst_size;
+   dd->dma_lch_out.dma_conf.dst_addr_width =
+   DMA_SLAVE_BUSWIDTH_4_BYTES;
+   dd->dma_lch_out.dma_conf.device_fc = false;
 
-   if (pdata && pdata->dma_slave->txdata.dma_dev &&
-   pdata->dma_slave->rxdata.dma_dev) {
-
-   /* Try to grab 2 DMA channels */
-   dma_cap_zero(mask_in);
-   dma_cap_set(DMA_SLAVE, mask_in);
-
-   dd->dma_lch_in.chan = dma_request_channel(mask_in,
-   atmel_aes_filter, &pdata->dma_slave->rxdata);
-
-   if (!dd->dma_lch_in.chan)
-   goto err_dma_in;
-
-   dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV;
-   dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base +
-   AES_IDATAR(0);
-   dd->dma_lch_in.dma_conf.src_maxburst = dd->caps.max_burst_size;
-   dd->dma_lch_in.dma_conf.src_addr_width =
-   DMA_SLAVE_BUSWIDTH_4_BYTES;
-   dd->dma_lch_in.dma_conf.dst_maxburst = dd->caps.max_burst_size;
-   dd->dma_l

[PATCH 1/3] ARM: at91/dt/trivial: use macro for AES irq type

2013-10-14 Thread Nicolas Ferre
Signed-off-by: Nicolas Ferre 
---
 arch/arm/boot/dts/sama5d3.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index ca956b6..b2aabff 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -350,7 +350,7 @@
aes@f8038000 {
compatible = "atmel,sam9g46-aes";
reg = <0xf8038000 0x100>;
-   interrupts = <43 4 0>;
+   interrupts = <43 IRQ_TYPE_LEVEL_HIGH 0>;
};
 
tdes@f803c000 {
-- 
1.8.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/3] ARM: at91/dt/trivial: before sama5d3, Atmel MPU were using at91 prefix

2013-10-14 Thread Nicolas Ferre
Change the sha/aes/tdes compatibility string to match common
case for the at91sam9g45 family which is to keep the at91 prefix.

Signed-off-by: Nicolas Ferre 
---
 arch/arm/boot/dts/sama5d3.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index b2aabff..99bd4a6 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -342,19 +342,19 @@
};
 
sha@f8034000 {
-   compatible = "atmel,sam9g46-sha";
+   compatible = "atmel,at91sam9g46-sha";
reg = <0xf8034000 0x100>;
interrupts = <42 IRQ_TYPE_LEVEL_HIGH 0>;
};
 
aes@f8038000 {
-   compatible = "atmel,sam9g46-aes";
+   compatible = "atmel,at91sam9g46-aes";
reg = <0xf8038000 0x100>;
interrupts = <43 IRQ_TYPE_LEVEL_HIGH 0>;
};
 
tdes@f803c000 {
-   compatible = "atmel,sam9g46-tdes";
+   compatible = "atmel,at91sam9g46-tdes";
reg = <0xf803c000 0x100>;
interrupts = <44 IRQ_TYPE_LEVEL_HIGH 0>;
};
-- 
1.8.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] ARM: at91/dt/sama5d3: add DMA information to SHA/AES/TDES nodes

2013-10-14 Thread Nicolas Ferre
Signed-off-by: Nicolas Ferre 
---
 arch/arm/boot/dts/sama5d3.dtsi | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index 99bd4a6..aca3893 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -345,18 +345,26 @@
compatible = "atmel,at91sam9g46-sha";
reg = <0xf8034000 0x100>;
interrupts = <42 IRQ_TYPE_LEVEL_HIGH 0>;
+   dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(17)>;
+   dma-names = "tx";
};
 
aes@f8038000 {
compatible = "atmel,at91sam9g46-aes";
reg = <0xf8038000 0x100>;
interrupts = <43 IRQ_TYPE_LEVEL_HIGH 0>;
+   dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(18)>,
+  <&dma1 2 AT91_DMA_CFG_PER_ID(19)>;
+   dma-names = "tx", "rx";
};
 
tdes@f803c000 {
compatible = "atmel,at91sam9g46-tdes";
reg = <0xf803c000 0x100>;
interrupts = <44 IRQ_TYPE_LEVEL_HIGH 0>;
+   dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(20)>,
+  <&dma1 2 AT91_DMA_CFG_PER_ID(21)>;
+   dma-names = "tx", "rx";
};
 
dma0: dma-controller@e600 {
-- 
1.8.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC 1/5] net: macb: Migrate to dev_pm_ops

2013-10-15 Thread Nicolas Ferre

On 15/10/2013 01:58, Soren Brinkmann :

Migrate the suspend/resume functions to use the dev_pm_ops PM interface.

Signed-off-by: Soren Brinkmann 


Acked-by: Nicolas Ferre 


---
  drivers/net/ethernet/cadence/macb.c | 14 +++---
  1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb.c 
b/drivers/net/ethernet/cadence/macb.c
index 92578690f6de..389ccf1362d5 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -1946,8 +1946,9 @@ static int __exit macb_remove(struct platform_device 
*pdev)
  }

  #ifdef CONFIG_PM
-static int macb_suspend(struct platform_device *pdev, pm_message_t state)
+static int macb_suspend(struct device *dev)
  {
+   struct platform_device *pdev = to_platform_device(dev);
struct net_device *netdev = platform_get_drvdata(pdev);
struct macb *bp = netdev_priv(netdev);

@@ -1960,8 +1961,9 @@ static int macb_suspend(struct platform_device *pdev, 
pm_message_t state)
return 0;
  }

-static int macb_resume(struct platform_device *pdev)
+static int macb_resume(struct device *dev)
  {
+   struct platform_device *pdev = to_platform_device(dev);
struct net_device *netdev = platform_get_drvdata(pdev);
struct macb *bp = netdev_priv(netdev);

@@ -1972,19 +1974,17 @@ static int macb_resume(struct platform_device *pdev)

return 0;
  }
-#else
-#define macb_suspend   NULL
-#define macb_resumeNULL
  #endif

+static SIMPLE_DEV_PM_OPS(macb_pm_ops, macb_suspend, macb_resume);
+
  static struct platform_driver macb_driver = {
.remove = __exit_p(macb_remove),
-   .suspend= macb_suspend,
-   .resume = macb_resume,
.driver = {
.name   = "macb",
.owner  = THIS_MODULE,
.of_match_table = of_match_ptr(macb_dt_ids),
+   .pm = &macb_pm_ops,
},
  };





--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC 2/5] net: macb: Migrate to devm clock interface

2013-10-15 Thread Nicolas Ferre

On 15/10/2013 01:58, Soren Brinkmann :

Migrate to using the device managed intreface for clocks and clean up
the associated error paths.

Signed-off-by: Soren Brinkmann 


Acked-by: Nicolas Ferre 


---
  drivers/net/ethernet/cadence/macb.c | 32 
  1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb.c 
b/drivers/net/ethernet/cadence/macb.c
index 389ccf1362d5..62aa136889a4 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -1790,19 +1790,31 @@ static int __init macb_probe(struct platform_device 
*pdev)
spin_lock_init(&bp->lock);
INIT_WORK(&bp->tx_error_task, macb_tx_error_task);

-   bp->pclk = clk_get(&pdev->dev, "pclk");
+   bp->pclk = devm_clk_get(&pdev->dev, "pclk");
if (IS_ERR(bp->pclk)) {
-   dev_err(&pdev->dev, "failed to get macb_clk\n");
+   err = PTR_ERR(bp->pclk);
+   dev_err(&pdev->dev, "failed to get macb_clk (%u)\n", err);
goto err_out_free_dev;
}
-   clk_prepare_enable(bp->pclk);

-   bp->hclk = clk_get(&pdev->dev, "hclk");
+   bp->hclk = devm_clk_get(&pdev->dev, "hclk");
if (IS_ERR(bp->hclk)) {
-   dev_err(&pdev->dev, "failed to get hclk\n");
-   goto err_out_put_pclk;
+   err = PTR_ERR(bp->hclk);
+   dev_err(&pdev->dev, "failed to get hclk (%u)\n", err);
+   goto err_out_free_dev;
+   }
+
+   err = clk_prepare_enable(bp->pclk);
+   if (err) {
+   dev_err(&pdev->dev, "failed to enable pclk (%u)\n", err);
+   goto err_out_free_dev;
+   }
+
+   err = clk_prepare_enable(bp->hclk);
+   if (err) {
+   dev_err(&pdev->dev, "failed to enable hclk (%u)\n", err);
+   goto err_out_disable_pclk;
}
-   clk_prepare_enable(bp->hclk);

bp->regs = ioremap(regs->start, resource_size(regs));
if (!bp->regs) {
@@ -1908,10 +1920,8 @@ err_out_iounmap:
iounmap(bp->regs);
  err_out_disable_clocks:
clk_disable_unprepare(bp->hclk);
-   clk_put(bp->hclk);
+err_out_disable_pclk:
clk_disable_unprepare(bp->pclk);
-err_out_put_pclk:
-   clk_put(bp->pclk);
  err_out_free_dev:
free_netdev(dev);
  err_out:
@@ -1936,9 +1946,7 @@ static int __exit macb_remove(struct platform_device 
*pdev)
free_irq(dev->irq, dev);
    iounmap(bp->regs);
clk_disable_unprepare(bp->hclk);
-   clk_put(bp->hclk);
clk_disable_unprepare(bp->pclk);
-   clk_put(bp->pclk);
free_netdev(dev);
}





--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC 3/5] net: macb: Use devm_ioremap()

2013-10-15 Thread Nicolas Ferre

On 15/10/2013 01:58, Soren Brinkmann :

Use the device managed version of ioremap to remap IO memory,
simplifying error paths.

Signed-off-by: Soren Brinkmann 


Acked-by: Nicolas Ferre 


---
  drivers/net/ethernet/cadence/macb.c | 8 +++-
  1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb.c 
b/drivers/net/ethernet/cadence/macb.c
index 62aa136889a4..436aecc31732 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -17,6 +17,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  #include 
@@ -1816,7 +1817,7 @@ static int __init macb_probe(struct platform_device *pdev)
goto err_out_disable_pclk;
}

-   bp->regs = ioremap(regs->start, resource_size(regs));
+   bp->regs = devm_ioremap(&pdev->dev, regs->start, resource_size(regs));
if (!bp->regs) {
dev_err(&pdev->dev, "failed to map registers, aborting.\n");
err = -ENOMEM;
@@ -1828,7 +1829,7 @@ static int __init macb_probe(struct platform_device *pdev)
if (err) {
dev_err(&pdev->dev, "Unable to request IRQ %d (error %d)\n",
dev->irq, err);
-   goto err_out_iounmap;
+   goto err_out_disable_clocks;
}

dev->netdev_ops = &macb_netdev_ops;
@@ -1916,8 +1917,6 @@ err_out_unregister_netdev:
unregister_netdev(dev);
  err_out_free_irq:
free_irq(dev->irq, dev);
-err_out_iounmap:
-   iounmap(bp->regs);
  err_out_disable_clocks:
clk_disable_unprepare(bp->hclk);
  err_out_disable_pclk:
@@ -1944,7 +1943,6 @@ static int __exit macb_remove(struct platform_device 
*pdev)
mdiobus_free(bp->mii_bus);
unregister_netdev(dev);
free_irq(dev->irq, dev);
-   iounmap(bp->regs);
clk_disable_unprepare(bp->hclk);
        clk_disable_unprepare(bp->pclk);
free_netdev(dev);




--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC 4/5] net: macb: Use devm_request_irq()

2013-10-15 Thread Nicolas Ferre

On 15/10/2013 01:58, Soren Brinkmann :

Use the device managed interface to request the IRQ, simplifying error
paths.

Signed-off-by: Soren Brinkmann 


Acked-by: Nicolas Ferre 


---
  drivers/net/ethernet/cadence/macb.c | 8 +++-
  1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb.c 
b/drivers/net/ethernet/cadence/macb.c
index 436aecc31732..603844b1d483 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -1825,7 +1825,8 @@ static int __init macb_probe(struct platform_device *pdev)
}

dev->irq = platform_get_irq(pdev, 0);
-   err = request_irq(dev->irq, macb_interrupt, 0, dev->name, dev);
+   err = devm_request_irq(&pdev->dev, dev->irq, macb_interrupt, 0,
+   dev->name, dev);
if (err) {
dev_err(&pdev->dev, "Unable to request IRQ %d (error %d)\n",
dev->irq, err);
@@ -1892,7 +1893,7 @@ static int __init macb_probe(struct platform_device *pdev)
err = register_netdev(dev);
if (err) {
dev_err(&pdev->dev, "Cannot register net device, aborting.\n");
-   goto err_out_free_irq;
+   goto err_out_disable_clocks;
}

err = macb_mii_init(bp);
@@ -1915,8 +1916,6 @@ static int __init macb_probe(struct platform_device *pdev)

  err_out_unregister_netdev:
unregister_netdev(dev);
-err_out_free_irq:
-   free_irq(dev->irq, dev);
  err_out_disable_clocks:
clk_disable_unprepare(bp->hclk);
  err_out_disable_pclk:
@@ -1942,7 +1941,6 @@ static int __exit macb_remove(struct platform_device 
*pdev)
kfree(bp->mii_bus->irq);
mdiobus_free(bp->mii_bus);
unregister_netdev(dev);
-   free_irq(dev->irq, dev);
clk_disable_unprepare(bp->hclk);
    clk_disable_unprepare(bp->pclk);
free_netdev(dev);




--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC 5/5] net: macb: Adjust tx_clk when link speed changes

2013-10-15 Thread Nicolas Ferre
pare_enable(bp->tx_clk);

netif_device_attach(netdev);

diff --git a/drivers/net/ethernet/cadence/macb.h 
b/drivers/net/ethernet/cadence/macb.h
index f4076155bed7..51c02442160a 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -572,6 +572,7 @@ struct macb {
struct platform_device  *pdev;
struct clk  *pclk;
    struct clk  *hclk;
+   struct clk  *tx_clk;
struct net_device   *dev;
struct napi_struct  napi;
struct work_struct  tx_error_task;




--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] ARM: at91/dt/trivial: before sama5d3, Atmel MPU were using at91 prefix

2013-10-15 Thread Nicolas Ferre

On 14/10/2013 19:09, Jean-Christophe PLAGNIOL-VILLARD :

On 18:46 Mon 14 Oct , Nicolas Ferre wrote:

Change the sha/aes/tdes compatibility string to match common
case for the at91sam9g45 family which is to keep the at91 prefix.

Signed-off-by: Nicolas Ferre 
---
  arch/arm/boot/dts/sama5d3.dtsi | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index b2aabff..99bd4a6 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -342,19 +342,19 @@
};

sha@f8034000 {
-   compatible = "atmel,sam9g46-sha";
+   compatible = "atmel,at91sam9g46-sha";
reg = <0xf8034000 0x100>;
interrupts = <42 IRQ_TYPE_LEVEL_HIGH 0>;
};

aes@f8038000 {
-   compatible = "atmel,sam9g46-aes";
+   compatible = "atmel,at91sam9g46-aes";
reg = <0xf8038000 0x100>;
interrupts = <43 IRQ_TYPE_LEVEL_HIGH 0>;
};

tdes@f803c000 {
-   compatible = "atmel,sam9g46-tdes";
+   compatible = "atmel,at91sam9g46-tdes";
reg = <0xf803c000 0x100>;
interrupts = <44 IRQ_TYPE_LEVEL_HIGH 0>;

you keep the previous compatible in the driver too for backword compatiblity


No, as the consumer of the old compatibility string has never been sent 
to mainline (or even mailing-list) and as the "dma" property is not 
compatible with the one existing on our 3.6.9-based kernel.


So, anyway the DT has to be changed for a move from 3.6.9 => 3.10. As I 
do not want to bloat the DT forever, let's stick with this new 
compatibility string.


Bye,



};
--
1.8.2.2


___
linux-arm-kernel mailing list
linux-arm-ker...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel





--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] tty/serial: at91: fix uart/usart selection for older products

2013-10-15 Thread Nicolas Ferre

On 14/10/2013 15:58, Jean-Christophe PLAGNIOL-VILLARD :

On 10:43 Thu 10 Oct , Nicolas Ferre wrote:

Since commit 055560b04a8cd063aea916fd083b7aec02c2adb8 (serial: at91:
distinguish usart and uart) the older products which do not have a
name field in their register map are unable to use their serial output.
As the main console output is usually the serial interface (aka DBGU) it
is pretty unfortunate.
So, instead of failing during probe() we just silently configure the serial
peripheral as an uart. It allows us to use these serial outputs.
The proper solution is proposed in another patch.

Signed-off-by: Nicolas Ferre 
---
  drivers/tty/serial/atmel_serial.c | 9 ++---
  1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/serial/atmel_serial.c 
b/drivers/tty/serial/atmel_serial.c
index d067285..6b0f75e 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1499,7 +1499,7 @@ static void atmel_set_ops(struct uart_port *port)
  /*
   * Get ip name usart or uart
   */
-static int atmel_get_ip_name(struct uart_port *port)
+static void atmel_get_ip_name(struct uart_port *port)
  {
struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
int name = UART_GET_IP_NAME(port);
@@ -1518,10 +1518,7 @@ static int atmel_get_ip_name(struct uart_port *port)
atmel_port->is_usart = false;
} else {

a dev_warn here maybe

usefull to known when we will have a new ip name and not yet wupported


No, not here: next patch is oveloading this if/else directive.


dev_err(port->dev, "Not supported ip name, set to uart\n");
-   return -EINVAL;
}
-
-   return 0;
  }

  /*
@@ -2405,9 +2402,7 @@ static int atmel_serial_probe(struct platform_device 
*pdev)
/*
 * Get port name of usart or uart
 */
-   ret = atmel_get_ip_name(&port->uart);
-   if (ret < 0)
-   goto err_add_port;
+   atmel_get_ip_name(&port->uart);

    return 0;

--
1.8.2.2







--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] tty/serial: at91: add a fallback option to determine uart/usart property

2013-10-15 Thread Nicolas Ferre

On 14/10/2013 15:59, Jean-Christophe PLAGNIOL-VILLARD :

On 10:43 Thu 10 Oct , Nicolas Ferre wrote:

On older SoC, the "name" field is not filled in the register map.
Fix the way to figure out if the serial port is an uart or an usart for these
older products (with corresponding properties).

Signed-off-by: Nicolas Ferre 
---
  drivers/tty/serial/atmel_serial.c | 19 ++-
  include/linux/atmel_serial.h  |  1 +
  2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/atmel_serial.c 
b/drivers/tty/serial/atmel_serial.c
index 6b0f75e..c7d99af 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -99,6 +99,7 @@ static void atmel_stop_rx(struct uart_port *port);
  #define UART_PUT_RTOR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_RTOR)
  #define UART_PUT_TTGR(port, v)__raw_writel(v, (port)->membase + 
ATMEL_US_TTGR)
  #define UART_GET_IP_NAME(port)__raw_readl((port)->membase + 
ATMEL_US_NAME)
+#define UART_GET_IP_VERSION(port) __raw_readl((port)->membase + 
ATMEL_US_VERSION)

   /* PDC registers */
  #define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + 
ATMEL_PDC_PTCR)
@@ -1503,6 +1504,7 @@ static void atmel_get_ip_name(struct uart_port *port)
  {
struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
int name = UART_GET_IP_NAME(port);
+   u32 version;
int usart, uart;
/* usart and uart ascii */
usart = 0x55534152;
@@ -1517,7 +1519,22 @@ static void atmel_get_ip_name(struct uart_port *port)
dev_dbg(port->dev, "This is uart\n");
atmel_port->is_usart = false;
} else {
-   dev_err(port->dev, "Not supported ip name, set to uart\n");
+   /* fallback for older SoCs: use version field */
+   version = UART_GET_IP_VERSION(port);
+   switch (version) {
+   case 0x302:
+   case 0x10213:
+   dev_dbg(port->dev, "This version is usart\n");
+   atmel_port->is_usart = true;
+   break;
+   case 0x203:
+   case 0x10202:
+   dev_dbg(port->dev, "This version is uart\n");
+   atmel_port->is_usart = false;
+   break;
+   default:
+   dev_err(port->dev, "Not supported ip name nor version, set 
to uart\n");


it's not really an error a dev_warn is more oppropriate


As we are already in -rc5 and that these fixes are critical for at91 
platforms, I will not re-spin another patch just for this.


Moreover, I have the feeling that if we end up in this case, it means 
that we are in big troubles because the usart/uart included in the 
product triggering this log is not known (I recall that newer products 
do not have to hit these lines of code).


With these 2 reasons, I prefer to keep my patch like it is.

Greg, can you consider taking these two patches as regression fixes for 
3.12 (with Tested-by tag from Thomas)?


Thanks, bye,


+   }
}
  }

diff --git a/include/linux/atmel_serial.h b/include/linux/atmel_serial.h
index be201ca..00beddf 100644
--- a/include/linux/atmel_serial.h
+++ b/include/linux/atmel_serial.h
@@ -125,5 +125,6 @@
  #define ATMEL_US_IF   0x4c/* IrDA Filter Register 
*/

  #define ATMEL_US_NAME 0xf0/* Ip Name */
+#define ATMEL_US_VERSION   0xfc/* Ip Version */

  #endif
--
1.8.2.2







--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] crypto: atmel-tdes - add support for Device Tree

2013-10-15 Thread Nicolas Ferre
Add support for Device Tree and use of the DMA DT API to
get the channels if needed.
Documentation is added for these DT nodes.

Initial code by: Nicolas Royer and Eukrea.

Signed-off-by: Nicolas Ferre 
---
 .../devicetree/bindings/crypto/atmel-crypto.txt|  23 
 drivers/crypto/atmel-tdes.c| 143 ++---
 2 files changed, 117 insertions(+), 49 deletions(-)

diff --git a/Documentation/devicetree/bindings/crypto/atmel-crypto.txt 
b/Documentation/devicetree/bindings/crypto/atmel-crypto.txt
index d273f0b..9a24fd9 100644
--- a/Documentation/devicetree/bindings/crypto/atmel-crypto.txt
+++ b/Documentation/devicetree/bindings/crypto/atmel-crypto.txt
@@ -21,3 +21,26 @@ aes@f8038000 {
dmas = <&dma1 2 18>,
   <&dma1 2 19>;
dma-names = "tx", "rx";
+
+* Triple Data Encryption Standard (Triple DES)
+
+Required properties:
+- compatible : Should be "atmel,at91sam9g46-tdes".
+- reg: Should contain TDES registers location and length.
+- interrupts: Should contain the IRQ line for the TDES.
+
+Optional properties:
+- dmas: List of two DMA specifiers as described in
+atmel-dma.txt and dma.txt files.
+- dma-names: Contains one identifier string for each DMA specifier
+ in the dmas property.
+
+Example:
+tdes@f803c000 {
+   compatible = "atmel,at91sam9g46-tdes";
+   reg = <0xf803c000 0x100>;
+   interrupts = <44 4 0>;
+   dmas = <&dma1 2 20>,
+  <&dma1 2 21>;
+   dma-names = "tx", "rx";
+};
diff --git a/drivers/crypto/atmel-tdes.c b/drivers/crypto/atmel-tdes.c
index 4a99564..6cde5b5 100644
--- a/drivers/crypto/atmel-tdes.c
+++ b/drivers/crypto/atmel-tdes.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -716,59 +717,50 @@ static int atmel_tdes_dma_init(struct atmel_tdes_dev *dd,
struct crypto_platform_data *pdata)
 {
int err = -ENOMEM;
-   dma_cap_mask_t mask_in, mask_out;
+   dma_cap_mask_t mask;
+
+   dma_cap_zero(mask);
+   dma_cap_set(DMA_SLAVE, mask);
+
+   /* Try to grab 2 DMA channels */
+   dd->dma_lch_in.chan = dma_request_slave_channel_compat(mask,
+   atmel_tdes_filter, &pdata->dma_slave->rxdata, dd->dev, 
"tx");
+   if (!dd->dma_lch_in.chan)
+   goto err_dma_in;
+
+   dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV;
+   dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base +
+   TDES_IDATA1R;
+   dd->dma_lch_in.dma_conf.src_maxburst = 1;
+   dd->dma_lch_in.dma_conf.src_addr_width =
+   DMA_SLAVE_BUSWIDTH_4_BYTES;
+   dd->dma_lch_in.dma_conf.dst_maxburst = 1;
+   dd->dma_lch_in.dma_conf.dst_addr_width =
+   DMA_SLAVE_BUSWIDTH_4_BYTES;
+   dd->dma_lch_in.dma_conf.device_fc = false;
+
+   dd->dma_lch_out.chan = dma_request_slave_channel_compat(mask,
+   atmel_tdes_filter, &pdata->dma_slave->txdata, dd->dev, 
"rx");
+   if (!dd->dma_lch_out.chan)
+   goto err_dma_out;
+
+   dd->dma_lch_out.dma_conf.direction = DMA_DEV_TO_MEM;
+   dd->dma_lch_out.dma_conf.src_addr = dd->phys_base +
+   TDES_ODATA1R;
+   dd->dma_lch_out.dma_conf.src_maxburst = 1;
+   dd->dma_lch_out.dma_conf.src_addr_width =
+   DMA_SLAVE_BUSWIDTH_4_BYTES;
+   dd->dma_lch_out.dma_conf.dst_maxburst = 1;
+   dd->dma_lch_out.dma_conf.dst_addr_width =
+   DMA_SLAVE_BUSWIDTH_4_BYTES;
+   dd->dma_lch_out.dma_conf.device_fc = false;
 
-   if (pdata && pdata->dma_slave->txdata.dma_dev &&
-   pdata->dma_slave->rxdata.dma_dev) {
-
-   /* Try to grab 2 DMA channels */
-   dma_cap_zero(mask_in);
-   dma_cap_set(DMA_SLAVE, mask_in);
-
-   dd->dma_lch_in.chan = dma_request_channel(mask_in,
-   atmel_tdes_filter, &pdata->dma_slave->rxdata);
-
-   if (!dd->dma_lch_in.chan)
-   goto err_dma_in;
-
-   dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV;
-   dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base +
-   TDES_IDATA1R;
-   dd->dma_lch_in.dma_conf.src_maxburst = 1;
-   dd->dma_lch_in.dma_conf.src_addr_width =
-   DMA_SLAVE_BUSWIDTH_4_BYTES;
-   dd->dma_lch_in.dma_conf.dst_maxburst = 1;
-   dd->dma_lch_in.dma_conf.dst_addr_width =
-   DMA_SLAVE_BUSWIDTH_4_BYTES;
-   dd->dma_lch_in.dma_conf.device_fc = false;
-
-   dma_cap_zero(mask_out);
-   dma_cap_set(DMA_SLAVE, mask_out);
-

[PATCH 2/3] crypto: atmel-sha - add support for Device Tree

2013-10-15 Thread Nicolas Ferre
Add support for Device Tree and use of the DMA DT API to
get the channels if needed.
Documentation is added for these DT nodes.

Initial code by: Nicolas Royer and Eukrea.

Signed-off-by: Nicolas Ferre 
---
 .../devicetree/bindings/crypto/atmel-crypto.txt| 22 +
 drivers/crypto/atmel-sha.c | 99 --
 2 files changed, 97 insertions(+), 24 deletions(-)

diff --git a/Documentation/devicetree/bindings/crypto/atmel-crypto.txt 
b/Documentation/devicetree/bindings/crypto/atmel-crypto.txt
index 9a24fd9..f2aab3d 100644
--- a/Documentation/devicetree/bindings/crypto/atmel-crypto.txt
+++ b/Documentation/devicetree/bindings/crypto/atmel-crypto.txt
@@ -44,3 +44,25 @@ tdes@f803c000 {
   <&dma1 2 21>;
dma-names = "tx", "rx";
 };
+
+* Secure Hash Algorithm (SHA)
+
+Required properties:
+- compatible : Should be "atmel,at91sam9g46-sha".
+- reg: Should contain SHA registers location and length.
+- interrupts: Should contain the IRQ line for the SHA.
+
+Optional properties:
+- dmas: One DMA specifiers as described in
+atmel-dma.txt and dma.txt files.
+- dma-names: Contains one identifier string for each DMA specifier
+ in the dmas property. Only one "tx" string needed.
+
+Example:
+sha@f8034000 {
+   compatible = "atmel,at91sam9g46-sha";
+   reg = <0xf8034000 0x100>;
+   interrupts = <42 4 0>;
+   dmas = <&dma1 2 17>;
+   dma-names = "tx";
+};
diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
index eaed8bf..ecfdf72 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1263,32 +1264,29 @@ static int atmel_sha_dma_init(struct atmel_sha_dev *dd,
int err = -ENOMEM;
dma_cap_mask_t mask_in;
 
-   if (pdata && pdata->dma_slave->rxdata.dma_dev) {
-   /* Try to grab DMA channel */
-   dma_cap_zero(mask_in);
-   dma_cap_set(DMA_SLAVE, mask_in);
+   /* Try to grab DMA channel */
+   dma_cap_zero(mask_in);
+   dma_cap_set(DMA_SLAVE, mask_in);
 
-   dd->dma_lch_in.chan = dma_request_channel(mask_in,
-   atmel_sha_filter, &pdata->dma_slave->rxdata);
-
-   if (!dd->dma_lch_in.chan)
-   return err;
-
-   dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV;
-   dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base +
-   SHA_REG_DIN(0);
-   dd->dma_lch_in.dma_conf.src_maxburst = 1;
-   dd->dma_lch_in.dma_conf.src_addr_width =
-   DMA_SLAVE_BUSWIDTH_4_BYTES;
-   dd->dma_lch_in.dma_conf.dst_maxburst = 1;
-   dd->dma_lch_in.dma_conf.dst_addr_width =
-   DMA_SLAVE_BUSWIDTH_4_BYTES;
-   dd->dma_lch_in.dma_conf.device_fc = false;
-
-   return 0;
+   dd->dma_lch_in.chan = dma_request_slave_channel_compat(mask_in,
+   atmel_sha_filter, &pdata->dma_slave->rxdata, dd->dev, 
"tx");
+   if (!dd->dma_lch_in.chan) {
+   dev_warn(dd->dev, "no DMA channel available\n");
+   return err;
}
 
-   return -ENODEV;
+   dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV;
+   dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base +
+   SHA_REG_DIN(0);
+   dd->dma_lch_in.dma_conf.src_maxburst = 1;
+   dd->dma_lch_in.dma_conf.src_addr_width =
+   DMA_SLAVE_BUSWIDTH_4_BYTES;
+   dd->dma_lch_in.dma_conf.dst_maxburst = 1;
+   dd->dma_lch_in.dma_conf.dst_addr_width =
+   DMA_SLAVE_BUSWIDTH_4_BYTES;
+   dd->dma_lch_in.dma_conf.device_fc = false;
+
+   return 0;
 }
 
 static void atmel_sha_dma_cleanup(struct atmel_sha_dev *dd)
@@ -1326,6 +1324,48 @@ static void atmel_sha_get_cap(struct atmel_sha_dev *dd)
}
 }
 
+#if defined(CONFIG_OF)
+static const struct of_device_id atmel_sha_dt_ids[] = {
+   { .compatible = "atmel,at91sam9g46-sha" },
+   { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, atmel_sha_dt_ids);
+
+static struct crypto_platform_data *atmel_sha_of_init(struct platform_device 
*pdev)
+{
+   struct device_node *np = pdev->dev.of_node;
+   struct crypto_platform_data *pdata;
+
+   if (!np) {
+   dev_err(&pdev->dev, "device node not found\n");
+   return ERR_PTR(-EINVAL);
+   }
+
+   pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+   if (!pdata) {
+   dev_err(&pdev->dev, "could not allocate memory for pdata\n");
+   return ERR_PTR(-ENOMEM);
+   

[PATCH 3/3] crypto: atmel-sha - add sha information to the log

2013-10-15 Thread Nicolas Ferre
Depending on peripheral capabilities, print SHA information at the end
of the probe function.

Signed-off-by: Nicolas Ferre 
---
 drivers/crypto/atmel-sha.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
index ecfdf72..0618be0 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -1469,7 +1469,9 @@ static int atmel_sha_probe(struct platform_device *pdev)
if (err)
goto err_algs;
 
-   dev_info(dev, "Atmel SHA1/SHA256\n");
+   dev_info(dev, "Atmel SHA1/SHA256%s%s\n",
+   sha_dd->caps.has_sha224 ? "/SHA224" : "",
+   sha_dd->caps.has_sha_384_512 ? "/SHA384/SHA512" : "");
 
return 0;
 
-- 
1.8.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5] PWM: atmel-pwm: add PWM controller driver

2013-10-28 Thread Nicolas Ferre

On 22/10/2013 12:13, Bo Shen :

Hi All,

On 10/8/2013 21:17, Thierry Reding wrote:

On Mon, Sep 30, 2013 at 05:10:40PM +0800, Bo Shen wrote:

Add Atmel PWM controller driver based on PWM framework.

This is the basic function implementation of Atmel PWM controller.
It can work with PWM based led and backlight.

Signed-off-by: Bo Shen 

---
Changes in v5:
- call clk_disable directly, if so, it won't cause more than one channel
  enabled, the clock can not be disabled.

Changes in v4:
- check the return value of clk_prepare()
- change channel register size as constant

Changes in v3:
- change compatible string from "atmel,sama5-pwm" to "atmel,sama5d3-pwm"
- Add PWM led example in binding documentation
- Using micro replace hard code

Changes in v2:
- Address the comments from Thierry Reding

   .../devicetree/bindings/pwm/atmel-pwm.txt  |   41 +++
   drivers/pwm/Kconfig|9 +
   drivers/pwm/Makefile   |1 +
   drivers/pwm/pwm-atmel.c|  344 

   4 files changed, 395 insertions(+)
   create mode 100644 Documentation/devicetree/bindings/pwm/atmel-pwm.txt
   create mode 100644 drivers/pwm/pwm-atmel.c


I haven't seen an Acked-by from the device tree bindings maintainers on
this. I've Cc'ed them, so hopefully one of them has time to review.


Any comments?


As a recommendation from the recent Kernel Summit stated, you will have 
to separate the binding itself from the driver and associated code.
Simply send the binding documentation to the DT maintainers but still 
keep the two patches linked together in a series (but without putting DT 
maintainers nor the DT mailing-list in CC of the non-documentation patches).


This way you may have more chances to get feedback.

Thanks, bye,
--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] rtc: rtc-at91rm9200: Corrected alarm over day/month wrap:

2013-12-02 Thread Nicolas Ferre

On 18/11/2013 23:37, Andrew Morton :

On Mon, 18 Nov 2013 18:20:54 +0100 Nicolas Ferre  
wrote:


From: Linus Pizunski 

Update month and day of month to the alarm month/day instead
of current day/month when setting the RTC alarm mask.

Signed-off-by: Linus Pizunski 
Acked-by: Nicolas Ferre 


I changed this to signed-off-by, as you were on the patch delivery path.


--- a/drivers/rtc/rtc-at91rm9200.c
+++ b/drivers/rtc/rtc-at91rm9200.c
@@ -220,6 +220,8 @@ static int at91_rtc_setalarm(struct device *dev, struct 
rtc_wkalrm *alrm)

at91_alarm_year = tm.tm_year;

+   tm.tm_mon = alrm->time.tm_mon;
+   tm.tm_mday = alrm->time.tm_mday;
tm.tm_hour = alrm->time.tm_hour;
tm.tm_min = alrm->time.tm_min;
tm.tm_sec = alrm->time.tm_sec;


I queued this for 3.13.  Do we think it warrants a -stable backport?


(I am late, but it seems this one is not sent to Linus yet...)

Well, yes, we can tag this one for "-stable". The patch applies on 
nearly each kernel that I can think about (code is from 2.6.17-ish). But 
this patch applies with an offset...


Best regards,
--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] arm: at91: sama5d3: enable qt1070 as a wakeup source

2013-12-02 Thread Nicolas Ferre

On 02/12/2013 09:29, Bo Shen :

Enable qt1070 keyboard as a wakeup source on sama5d3xek board.

Signed-off-by: Bo Shen 


Acked-by: Nicolas Ferre 

Thanks,


---
  arch/arm/boot/dts/sama5d3xdm.dtsi |1 +
  1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/sama5d3xdm.dtsi 
b/arch/arm/boot/dts/sama5d3xdm.dtsi
index 1c296d6..f9bdde5 100644
--- a/arch/arm/boot/dts/sama5d3xdm.dtsi
+++ b/arch/arm/boot/dts/sama5d3xdm.dtsi
@@ -18,6 +18,7 @@
interrupts = <31 0x0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_qt1070_irq>;
+   wakeup-source;
};
        };





--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ARM: at91: add usart3 alias to dtsi

2013-12-02 Thread Nicolas Ferre
Alias was missing for SoC of the at91sam9x5 familly that embed USART3.
Preripheral node and pinctrl declarations are already in the
at91sam9x5_usart3.dtsi file.

Reported-by: Jiri Prchal 
Signed-off-by: Nicolas Ferre 
---
 arch/arm/boot/dts/at91sam9g25.dtsi | 4 
 arch/arm/boot/dts/at91sam9x25.dtsi | 4 
 2 files changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9g25.dtsi 
b/arch/arm/boot/dts/at91sam9g25.dtsi
index 17b879990914..d4650b4e9ebb 100644
--- a/arch/arm/boot/dts/at91sam9g25.dtsi
+++ b/arch/arm/boot/dts/at91sam9g25.dtsi
@@ -14,6 +14,10 @@
model = "Atmel AT91SAM9G25 SoC";
compatible = "atmel,at91sam9g25", "atmel,at91sam9x5";
 
+   aliases {
+   serial4 = &usart3;
+   };
+
ahb {
apb {
pinctrl@f400 {
diff --git a/arch/arm/boot/dts/at91sam9x25.dtsi 
b/arch/arm/boot/dts/at91sam9x25.dtsi
index c2554219f7a4..aceee86f60eb 100644
--- a/arch/arm/boot/dts/at91sam9x25.dtsi
+++ b/arch/arm/boot/dts/at91sam9x25.dtsi
@@ -15,6 +15,10 @@
model = "Atmel AT91SAM9X25 SoC";
compatible = "atmel,at91sam9x25", "atmel,at91sam9x5";
 
+   aliases {
+   serial4 = &usart3;
+   };
+
ahb {
apb {
pinctrl@f400 {
-- 
1.8.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ARM: at91: add usart3 alias to dtsi

2013-12-02 Thread Nicolas Ferre

On 02/12/2013 12:36, boris brezillon :

Hi Nicolas,

Le 02/12/2013 11:13, Nicolas Ferre a écrit :

Alias was missing for SoC of the at91sam9x5 familly that embed USART3.
Preripheral node and pinctrl declarations are already in the
at91sam9x5_usart3.dtsi file.

Reported-by: Jiri Prchal 
Signed-off-by: Nicolas Ferre 
---
   arch/arm/boot/dts/at91sam9g25.dtsi | 4 
   arch/arm/boot/dts/at91sam9x25.dtsi | 4 
   2 files changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9g25.dtsi 
b/arch/arm/boot/dts/at91sam9g25.dtsi
index 17b879990914..d4650b4e9ebb 100644
--- a/arch/arm/boot/dts/at91sam9g25.dtsi
+++ b/arch/arm/boot/dts/at91sam9g25.dtsi
@@ -14,6 +14,10 @@
model = "Atmel AT91SAM9G25 SoC";
compatible = "atmel,at91sam9g25", "atmel,at91sam9x5";

+   aliases {
+   serial4 = &usart3;
+   };
+


Shouldn't this go into at91sam9x5_usart3.dtsi ?
This way you would have the same alias for all the SoCs supporting usart3.


Indeed, I was focused on the product itself but it definitively makes 
sense to move it in the at91sam9x5_usart3.dtsi


Thanks, bye,



ahb {
apb {
pinctrl@f400 {
diff --git a/arch/arm/boot/dts/at91sam9x25.dtsi 
b/arch/arm/boot/dts/at91sam9x25.dtsi
index c2554219f7a4..aceee86f60eb 100644
--- a/arch/arm/boot/dts/at91sam9x25.dtsi
+++ b/arch/arm/boot/dts/at91sam9x25.dtsi
@@ -15,6 +15,10 @@
model = "Atmel AT91SAM9X25 SoC";
compatible = "atmel,at91sam9x25", "atmel,at91sam9x5";

+   aliases {
+   serial4 = &usart3;
+   };
+
ahb {
        apb {
pinctrl@f400 {







--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] ARM: at91: add usart3 alias to dtsi

2013-12-02 Thread Nicolas Ferre
Alias was missing for SoC of the at91sam9x5 familly that embed USART3.

Reported-by: Jiri Prchal 
Signed-off-by: Nicolas Ferre 
Cc: Boris Brezillon 
---
 arch/arm/boot/dts/at91sam9x5_usart3.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9x5_usart3.dtsi 
b/arch/arm/boot/dts/at91sam9x5_usart3.dtsi
index 2347e9563cef..6801106fa1f8 100644
--- a/arch/arm/boot/dts/at91sam9x5_usart3.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5_usart3.dtsi
@@ -11,6 +11,10 @@
 #include 
 
 / {
+   aliases {
+   serial4 = &usart3;
+   };
+
ahb {
apb {
pinctrl@f400 {
-- 
1.8.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 00/16] ARM: at91: move to common clk framework

2013-12-02 Thread Nicolas Ferre
 |2 +-
  arch/arm/mach-at91/at91sam9n12.c   |2 +-
  arch/arm/mach-at91/at91sam9rl.c|2 +-
  arch/arm/mach-at91/at91sam9x5.c|2 +-
  arch/arm/mach-at91/clock.c |7 +-
  arch/arm/mach-at91/generic.h   |3 +-
  arch/arm/mach-at91/pm.c|2 +-
  arch/arm/mach-at91/pm_slowclock.S  |2 +-
  arch/arm/mach-at91/sama5d3.c   |2 +-
  arch/arm/mach-at91/setup.c |8 +-
  drivers/clk/Makefile   |1 +
  drivers/clk/at91/Makefile  |   12 +
  drivers/clk/at91/clk-main.c|  187 +++
  drivers/clk/at91/clk-master.c  |  270 ++
  drivers/clk/at91/clk-peripheral.c  |  410 +++
  drivers/clk/at91/clk-pll.c |  531 
  drivers/clk/at91/clk-plldiv.c  |  135 +
  drivers/clk/at91/clk-programmable.c|  366 ++
  drivers/clk/at91/clk-smd.c |  171 +++
  drivers/clk/at91/clk-system.c  |  135 +
  drivers/clk/at91/clk-usb.c |  398 +++
  drivers/clk/at91/clk-utmi.c|  159 ++
  drivers/clk/at91/pmc.c |  397 +++
  drivers/clk/at91/pmc.h |  116 +
  drivers/usb/gadget/atmel_usba_udc.c|2 +-
  include/dt-bindings/clk/at91.h |   22 +
  .../include/mach => include/linux/clk}/at91_pmc.h  |4 +-
  36 files changed, 3741 insertions(+), 20 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/clock/at91-clock.txt
  create mode 100644 drivers/clk/at91/Makefile
  create mode 100644 drivers/clk/at91/clk-main.c
  create mode 100644 drivers/clk/at91/clk-master.c
  create mode 100644 drivers/clk/at91/clk-peripheral.c
  create mode 100644 drivers/clk/at91/clk-pll.c
  create mode 100644 drivers/clk/at91/clk-plldiv.c
  create mode 100644 drivers/clk/at91/clk-programmable.c
  create mode 100644 drivers/clk/at91/clk-smd.c
  create mode 100644 drivers/clk/at91/clk-system.c
  create mode 100644 drivers/clk/at91/clk-usb.c
  create mode 100644 drivers/clk/at91/clk-utmi.c
  create mode 100644 drivers/clk/at91/pmc.c
  create mode 100644 drivers/clk/at91/pmc.h
  create mode 100644 include/dt-bindings/clk/at91.h
  rename {arch/arm/mach-at91/include/mach => include/linux/clk}/at91_pmc.h (98%)

--
1.7.9.5





--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] at91: fixes 3.13 #2

2013-12-02 Thread Nicolas Ferre
Arnd, Olof, Kevin,

A second round of fixes for 3.13 on top of 3.13-rc1. The main fix of this
series is the one that reduces the frequency of the i2c IP and avoid to hit
some nasty hardware bugs. It actually allows to save a little power as well...

Thanks, best regards,

The following changes since commit 6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae:

  Linux 3.13-rc1 (2013-11-22 11:30:55 -0800)

are available in the git repository at:

  git://github.com/at91linux/linux-at91.git tags/at91-fixes

for you to fetch changes up to 7093bf2b7195541281cb711e31c027a8d826c6df:

  ARM: at91: fixed unresolved symbol "at91_pm_set_standby" when built without 
CONFIG_PM (2013-12-02 14:24:40 +0100)


AT91: second round of fixes for 3.13
- reduce IP frequency for I2C on sama5d3
- missing aliases directive for USART3 on 9x5 family
- a PM symbol is missing if !CONFIG_PM


Brent Taylor (1):
  ARM: at91: fixed unresolved symbol "at91_pm_set_standby" when built 
without CONFIG_PM

Ludovic Desroches (1):
  ARM: at91: sama5d3: reduce TWI internal clock frequency

Nicolas Ferre (1):
  ARM: at91: add usart3 alias to dtsi

 arch/arm/boot/dts/at91sam9x5_usart3.dtsi | 4 
 arch/arm/mach-at91/pm.h  | 4 
 arch/arm/mach-at91/sama5d3.c | 6 +++---
 3 files changed, 11 insertions(+), 3 deletions(-)

-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 0/6] ARM: at91: use new at91 clks for samad3 SoCs

2013-12-02 Thread Nicolas Ferre

On 28/11/2013 15:49, Boris BREZILLON :

Hello,

This patch series moves sama5d3 SoCs and boards to the new at91 clk framework
(based on common clk framework).

Best Regards,


Whole series:
Acked-by: Nicolas Ferre 

and added on top of CCF one for at91-3.14-cleanup

Bye,


Boris

Changes since v3:
  - fix prog clks declaration

Changes since v2:
  - rework dt bindings:
* replace "atmel,clk-id" property by the standard "reg" property
* reference system, peripheral and programmable clks using the direct
  clk node instead of the parent node plus a clk id
  - add usb_clk to usb ehci controller node

Changes since v1:
  - remove references to peripheral id macros
  - remove old clk definitions after moving to new clk framework

Boris BREZILLON (6):
   ARM: at91: prepare sama5 dt boards transition to common clk
   ARM: at91: prepare common clk transition for sama5d3 SoC
   ARM: at91/dt: define sama5d3 clocks
   ARM: at91/dt: define sama5d3xek's main clk frequency
   ARM: at91: move sama5d3 SoC to common clk
   ARM: at91/dt: remove old clk material

  arch/arm/boot/dts/sama5d3.dtsi  |  379 ++-
  arch/arm/boot/dts/sama5d3_can.dtsi  |   20 ++
  arch/arm/boot/dts/sama5d3_emac.dtsi |   11 +
  arch/arm/boot/dts/sama5d3_gmac.dtsi |   11 +
  arch/arm/boot/dts/sama5d3_lcd.dtsi  |   17 ++
  arch/arm/boot/dts/sama5d3_mci2.dtsi |   12 ++
  arch/arm/boot/dts/sama5d3_tcb1.dtsi |   12 ++
  arch/arm/boot/dts/sama5d3_uart.dtsi |   21 ++
  arch/arm/boot/dts/sama5d3xcm.dtsi   |   17 +-
  arch/arm/mach-at91/Kconfig  |1 -
  arch/arm/mach-at91/board-dt-sama5.c |   10 +-
  arch/arm/mach-at91/sama5d3.c|  342 ---
  12 files changed, 497 insertions(+), 356 deletions(-)




--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ARM: at91: add uart aliases to sama5d3 dtsi

2013-12-02 Thread Nicolas Ferre
Signed-off-by: Nicolas Ferre 
---
 arch/arm/boot/dts/sama5d3_uart.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/sama5d3_uart.dtsi 
b/arch/arm/boot/dts/sama5d3_uart.dtsi
index 49d4d76ca6f4..a9fa75e41652 100644
--- a/arch/arm/boot/dts/sama5d3_uart.dtsi
+++ b/arch/arm/boot/dts/sama5d3_uart.dtsi
@@ -12,6 +12,11 @@
 #include 
 
 / {
+   aliases {
+   serial5 = &uart0;
+   serial6 = &uart1;
+   };
+
ahb {
apb {
pinctrl@f200 {
-- 
1.8.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ARM: at91: add i2c2 pinctrl speficifation to sama5d3 DT

2013-12-02 Thread Nicolas Ferre
Signed-off-by: Nicolas Ferre 
---
 arch/arm/boot/dts/sama5d3.dtsi | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index f520b0236671..f5fd111b5ee6 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -304,6 +304,8 @@
dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(11)>,
   <&dma1 2 AT91_DMA_CFG_PER_ID(12)>;
dma-names = "tx", "rx";
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_i2c2>;
#address-cells = <1>;
#size-cells = <0>;
clocks = <&twi2_clk>;
@@ -494,6 +496,14 @@
};
};
 
+   i2c2 {
+   pinctrl_i2c2: i2c2-0 {
+   atmel,pins =
+   ; /* TWCK2 pin, conflicts with LCDDAT19, ISI_D3 
*/
+   };
+   };
+
isi {
pinctrl_isi: isi-0 {
atmel,pins =
-- 
1.8.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] at91: cleanup for 3.14 #1 (aka move to CCF)

2013-12-02 Thread Nicolas Ferre
k/at91/clk-programmable.c| 366 ++
 drivers/clk/at91/clk-smd.c | 171 +++
 drivers/clk/at91/clk-system.c  | 135 ++
 drivers/clk/at91/clk-usb.c | 398 +++
 drivers/clk/at91/clk-utmi.c| 159 ++
 drivers/clk/at91/pmc.c | 397 +++
 drivers/clk/at91/pmc.h | 116 +
 drivers/usb/gadget/atmel_usba_udc.c|   2 +-
 include/dt-bindings/clk/at91.h |  22 +
 .../include/mach => include/linux/clk}/at91_pmc.h  |   4 +-
 46 files changed, 4237 insertions(+), 375 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/at91-clock.txt
 create mode 100644 drivers/clk/at91/Makefile
 create mode 100644 drivers/clk/at91/clk-main.c
 create mode 100644 drivers/clk/at91/clk-master.c
 create mode 100644 drivers/clk/at91/clk-peripheral.c
 create mode 100644 drivers/clk/at91/clk-pll.c
 create mode 100644 drivers/clk/at91/clk-plldiv.c
 create mode 100644 drivers/clk/at91/clk-programmable.c
 create mode 100644 drivers/clk/at91/clk-smd.c
 create mode 100644 drivers/clk/at91/clk-system.c
 create mode 100644 drivers/clk/at91/clk-usb.c
 create mode 100644 drivers/clk/at91/clk-utmi.c
 create mode 100644 drivers/clk/at91/pmc.c
 create mode 100644 drivers/clk/at91/pmc.h
 create mode 100644 include/dt-bindings/clk/at91.h
 rename {arch/arm/mach-at91/include/mach => include/linux/clk}/at91_pmc.h (98%)

-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] atmel_lcdfb: fix module autoload

2013-12-02 Thread Nicolas Ferre

On 22/10/2013 18:36, Johan Hovold :

Add missing module device table which is needed for module autoloading.

Signed-off-by: Johan Hovold 


Acked-by: Nicolas Ferre 

Jean-Christophe, Tomi,

Can you please take this patch?

Best regards,



---
  drivers/video/atmel_lcdfb.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 088511a..67b339c 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -94,6 +94,7 @@ static const struct platform_device_id atmel_lcdfb_devtypes[] 
= {
/* terminator */
}
  };
+MODULE_DEVICE_TABLE(platform, atmel_lcdfb_devtypes);

  static struct atmel_lcdfb_config *
  atmel_lcdfb_get_config(struct platform_device *pdev)




--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] usb: ohci-at91: replace request_mem_region + ioremap by devm_request_and_ioremap

2013-12-03 Thread Nicolas Ferre

On 03/12/2013 15:07, Boris BREZILLON :

Replace the request_mem_region + ioremap calls by the
devm_request_and_ioremap call which does the same things but with device
managed resources.

Signed-off-by: Boris BREZILLON 
Tested-by: Robert Nelson 


Acked-by: Nicolas Ferre 


---
  drivers/usb/host/ohci-at91.c |   24 +---
  1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 7aec6ca..c406f1e 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -157,24 +157,18 @@ static int usb_hcd_at91_probe(const struct hc_driver 
*driver,
hcd->rsrc_start = mem_r->start;
hcd->rsrc_len = resource_size(mem_r);

-   if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
-   pr_debug("request_mem_region failed\n");
-   retval = -EBUSY;
-   goto err1;
-   }
-
-   hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
+   hcd->regs = devm_request_and_ioremap(&pdev->dev, mem_r);
if (!hcd->regs) {
-   pr_debug("ioremap failed\n");
+   dev_dbg(dev, "devm_request_and_ioremap failed\n");
retval = -EIO;
-   goto err2;
+   goto err;
}

iclk = clk_get(&pdev->dev, "ohci_clk");
if (IS_ERR(iclk)) {
dev_err(&pdev->dev, "failed to get ohci_clk\n");
retval = PTR_ERR(iclk);
-   goto err3;
+   goto err;
}
fclk = clk_get(&pdev->dev, "uhpck");
if (IS_ERR(fclk)) {
@@ -218,13 +212,7 @@ static int usb_hcd_at91_probe(const struct hc_driver 
*driver,
   err4:
clk_put(iclk);

- err3:
-   iounmap(hcd->regs);
-
- err2:
-   release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
-
- err1:
+ err:
usb_put_hcd(hcd);
return retval;
  }
@@ -247,8 +235,6 @@ static void usb_hcd_at91_remove(struct usb_hcd *hcd,
  {
usb_remove_hcd(hcd);
at91_stop_hc(pdev);
-   iounmap(hcd->regs);
-   release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
usb_put_hcd(hcd);

if (IS_ENABLED(CONFIG_COMMON_CLK))




--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] usb: ohci-at91: fix irq and iomem resource retrieval

2013-12-03 Thread Nicolas Ferre

On 03/12/2013 15:07, Boris BREZILLON :

When using dt resources retrieval (interrupts and reg properties) there is
no predefined order for these resources in the platform dev resource
table.

Retrieve resources using the platform_get_resource function instead of
direct resource table entries to avoid resource type mismatch.

Signed-off-by: Boris BREZILLON 
Tested-by: Robert Nelson 


Acked-by: Nicolas Ferre 


---
  drivers/usb/host/ohci-at91.c |   19 +++
  1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 418444e..7aec6ca 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -136,23 +136,26 @@ static int usb_hcd_at91_probe(const struct hc_driver 
*driver,
struct ohci_hcd *ohci;
int retval;
struct usb_hcd *hcd = NULL;
+   struct device *dev = &pdev->dev;
+   struct resource *mem_r, *irq_r;

-   if (pdev->num_resources != 2) {
-   pr_debug("hcd probe: invalid num_resources");
+   mem_r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   if (!mem_r) {
+   dev_dbg(dev, "hcd probe: missing memory resource\n");
return -ENODEV;
}

-   if ((pdev->resource[0].flags != IORESOURCE_MEM)
-   || (pdev->resource[1].flags != IORESOURCE_IRQ)) {
-   pr_debug("hcd probe: invalid resource type\n");
+   irq_r = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+   if (!irq_r) {
+   dev_dbg(dev, "hcd probe: missing irq resource\n");
return -ENODEV;
}

hcd = usb_create_hcd(driver, &pdev->dev, "at91");
if (!hcd)
return -ENOMEM;
-   hcd->rsrc_start = pdev->resource[0].start;
-   hcd->rsrc_len = resource_size(&pdev->resource[0]);
+   hcd->rsrc_start = mem_r->start;
+   hcd->rsrc_len = resource_size(mem_r);

if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
pr_debug("request_mem_region failed\n");
@@ -199,7 +202,7 @@ static int usb_hcd_at91_probe(const struct hc_driver 
*driver,
ohci->num_ports = board->ports;
at91_start_hc(pdev);

-   retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_SHARED);
+   retval = usb_add_hcd(hcd, irq_r->start, IRQF_SHARED);
if (retval == 0)
return retval;





--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/3] usb: ohci-at91: use device managed clk retrieval

2013-12-03 Thread Nicolas Ferre

On 03/12/2013 15:07, Boris BREZILLON :

Replace clk_get calls by devm_clk_get calls.

Signed-off-by: Boris BREZILLON 
Tested-by: Robert Nelson 


Acked-by: Nicolas Ferre 

Thanks Boris for these fixes.

Alan, Greg, can you take the whole series as fixes for 3.13?

Thanks, best regards,


---
  drivers/usb/host/ohci-at91.c |   32 
  1 file changed, 8 insertions(+), 24 deletions(-)

diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index c406f1e..3652962 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -164,30 +164,30 @@ static int usb_hcd_at91_probe(const struct hc_driver 
*driver,
goto err;
}

-   iclk = clk_get(&pdev->dev, "ohci_clk");
+   iclk = devm_clk_get(dev, "ohci_clk");
if (IS_ERR(iclk)) {
-   dev_err(&pdev->dev, "failed to get ohci_clk\n");
+   dev_err(dev, "failed to get ohci_clk\n");
retval = PTR_ERR(iclk);
goto err;
}
-   fclk = clk_get(&pdev->dev, "uhpck");
+   fclk = devm_clk_get(dev, "uhpck");
if (IS_ERR(fclk)) {
dev_err(&pdev->dev, "failed to get uhpck\n");
retval = PTR_ERR(fclk);
-   goto err4;
+   goto err;
}
-   hclk = clk_get(&pdev->dev, "hclk");
+   hclk = devm_clk_get(dev, "hclk");
if (IS_ERR(hclk)) {
dev_err(&pdev->dev, "failed to get hclk\n");
retval = PTR_ERR(hclk);
-   goto err5;
+   goto err;
}
if (IS_ENABLED(CONFIG_COMMON_CLK)) {
-   uclk = clk_get(&pdev->dev, "usb_clk");
+   uclk = devm_clk_get(&pdev->dev, "usb_clk");
if (IS_ERR(uclk)) {
dev_err(&pdev->dev, "failed to get uclk\n");
retval = PTR_ERR(uclk);
-   goto err6;
+   goto err;
}
}

@@ -203,15 +203,6 @@ static int usb_hcd_at91_probe(const struct hc_driver 
*driver,
/* Error handling */
at91_stop_hc(pdev);

-   if (IS_ENABLED(CONFIG_COMMON_CLK))
-   clk_put(uclk);
- err6:
-   clk_put(hclk);
- err5:
-   clk_put(fclk);
- err4:
-   clk_put(iclk);
-
   err:
usb_put_hcd(hcd);
return retval;
@@ -236,13 +227,6 @@ static void usb_hcd_at91_remove(struct usb_hcd *hcd,
usb_remove_hcd(hcd);
at91_stop_hc(pdev);
usb_put_hcd(hcd);
-
-   if (IS_ENABLED(CONFIG_COMMON_CLK))
-   clk_put(uclk);
-   clk_put(hclk);
-   clk_put(fclk);
-   clk_put(iclk);
-   fclk = iclk = hclk = NULL;
  }

  /*-*/




--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/5] net: macb updates

2013-12-12 Thread Nicolas Ferre

On 12/12/2013 08:00, Olof Johansson :

Hi Soren,

On Tue, Dec 10, 2013 at 4:07 PM, Soren Brinkmann
 wrote:


Soren Brinkmann (5):
   net: macb: Adjust tx_clk when link speed changes


This patch causes build issues on some at91 platforms, namely
at91sam9263 that lacks programmable clocks. So it doesn't implement
clk_set_rate() and clk_round_rate().

I don't know if there's any reasonable config option to check for
(that wouldn't add at91-specific stuff to the driver which we don't
want). So I suspect the best way would be to implement dummy versions
for at91 when CONFIG_AT91_PROGRAMMABLE_CLOCKS isn't set.

Nicolas, you OK with that? It'd be something like the below
(copy-paste, whitespace damage, just RFC):


Well, in fact I am thinking about simply removing this 
AT91_PROGRAMMABLE_CLOCKS option out of the AT91 Kconfig.


After all, when not specified, it only removes a few lines of code... 
and that's it! For a so little benefit, I suspect it is sensible to 
remove this option.

I continue to discuss with AT91 active developers and write a patch soon.

Thanks for the heads-up on this issue Olof.

Bye,



diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 6b2630a..17c52a7 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -459,6 +459,22 @@ static void __init init_programmable_clock(struct clk *clk)
 clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr);
  }

+#else  /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
+
+int clk_set_rate(struct clk *clk, unsigned long rate)
+{
+   if (rate == clk_get_rate(clk))
+   return 0;
+
+   return -EINVAL;
+}
+
+long clk_round_rate(struct clk *clk, unsigned long rate)
+{
+   /* There's really nothing sane to return here. */
+   return clk_get_rate(clk);
+}
+
  #endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */




--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ARM: at91: remove AT91_PROGRAMMABLE_CLOCKS configuration option

2013-12-12 Thread Nicolas Ferre
This AT91 specific Kconfig option removed the code that dealt with
programmable clocks. Each AT91 SoC embeds programmable clocks and
there is little gain to remove this code in case that such a clock
is not used.
If this option is not selected, it causes certain drivers to fail
to build. We simply remove this option instead of adding code just
to build a workaround.

Signed-off-by: Nicolas Ferre 
---
Olof, Kevin,

This patch goes on top of the AT91 "cleanup" branch.

Bye,


 arch/arm/configs/at91_dt_defconfig  | 1 -
 arch/arm/configs/at91rm9200_defconfig   | 1 -
 arch/arm/configs/at91sam9260_9g20_defconfig | 1 -
 arch/arm/configs/at91sam9261_9g10_defconfig | 1 -
 arch/arm/configs/at91sam9g45_defconfig  | 1 -
 arch/arm/configs/at91sam9rl_defconfig   | 1 -
 arch/arm/configs/sama5_defconfig| 1 -
 arch/arm/mach-at91/Kconfig  | 6 --
 arch/arm/mach-at91/clock.c  | 6 --
 arch/arm/mach-at91/pm.c | 3 ---
 drivers/clk/at91/Makefile   | 3 +--
 drivers/clk/at91/pmc.c  | 2 --
 drivers/clk/at91/pmc.h  | 2 --
 sound/soc/atmel/Kconfig | 2 +-
 14 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/arch/arm/configs/at91_dt_defconfig 
b/arch/arm/configs/at91_dt_defconfig
index 690e89273230..0b4e9b5210d8 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -22,7 +22,6 @@ CONFIG_SOC_AT91SAM9X5=y
 CONFIG_SOC_AT91SAM9N12=y
 CONFIG_MACH_AT91RM9200_DT=y
 CONFIG_MACH_AT91SAM9_DT=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AT91_TIMER_HZ=128
 CONFIG_AEABI=y
 # CONFIG_OABI_COMPAT is not set
diff --git a/arch/arm/configs/at91rm9200_defconfig 
b/arch/arm/configs/at91rm9200_defconfig
index 75502c4d222c..bf057719dab0 100644
--- a/arch/arm/configs/at91rm9200_defconfig
+++ b/arch/arm/configs/at91rm9200_defconfig
@@ -31,7 +31,6 @@ CONFIG_MACH_YL9200=y
 CONFIG_MACH_CPUAT91=y
 CONFIG_MACH_ECO920=y
 CONFIG_MTD_AT91_DATAFLASH_CARD=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AT91_TIMER_HZ=100
 # CONFIG_ARM_THUMB is not set
 CONFIG_PCCARD=y
diff --git a/arch/arm/configs/at91sam9260_9g20_defconfig 
b/arch/arm/configs/at91sam9260_9g20_defconfig
index 69b6928d3d9d..955dc480f3ee 100644
--- a/arch/arm/configs/at91sam9260_9g20_defconfig
+++ b/arch/arm/configs/at91sam9260_9g20_defconfig
@@ -28,7 +28,6 @@ CONFIG_MACH_PCONTROL_G20=y
 CONFIG_MACH_GSIA18S=y
 CONFIG_MACH_SNAPPER_9260=y
 CONFIG_MACH_AT91SAM9_DT=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AT91_SLOW_CLOCK=y
 # CONFIG_ARM_THUMB is not set
 CONFIG_AEABI=y
diff --git a/arch/arm/configs/at91sam9261_9g10_defconfig 
b/arch/arm/configs/at91sam9261_9g10_defconfig
index 9d35cd81c611..f80e993b04ce 100644
--- a/arch/arm/configs/at91sam9261_9g10_defconfig
+++ b/arch/arm/configs/at91sam9261_9g10_defconfig
@@ -18,7 +18,6 @@ CONFIG_ARCH_AT91=y
 CONFIG_ARCH_AT91SAM9261=y
 CONFIG_MACH_AT91SAM9261EK=y
 CONFIG_MACH_AT91SAM9G10EK=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 # CONFIG_ARM_THUMB is not set
 CONFIG_AEABI=y
 # CONFIG_OABI_COMPAT is not set
diff --git a/arch/arm/configs/at91sam9g45_defconfig 
b/arch/arm/configs/at91sam9g45_defconfig
index 08166cd4e7d6..e181a50fd65a 100644
--- a/arch/arm/configs/at91sam9g45_defconfig
+++ b/arch/arm/configs/at91sam9g45_defconfig
@@ -18,7 +18,6 @@ CONFIG_ARCH_AT91=y
 CONFIG_ARCH_AT91SAM9G45=y
 CONFIG_MACH_AT91SAM9M10G45EK=y
 CONFIG_MACH_AT91SAM9_DT=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AT91_SLOW_CLOCK=y
 CONFIG_AEABI=y
 # CONFIG_OABI_COMPAT is not set
diff --git a/arch/arm/configs/at91sam9rl_defconfig 
b/arch/arm/configs/at91sam9rl_defconfig
index 7cf87856d63c..7b6f131cecd6 100644
--- a/arch/arm/configs/at91sam9rl_defconfig
+++ b/arch/arm/configs/at91sam9rl_defconfig
@@ -13,7 +13,6 @@ CONFIG_MODULE_UNLOAD=y
 CONFIG_ARCH_AT91=y
 CONFIG_ARCH_AT91SAM9RL=y
 CONFIG_MACH_AT91SAM9RLEK=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 # CONFIG_ARM_THUMB is not set
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index f6e78f83c3c3..dc3881e07630 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -20,7 +20,6 @@ CONFIG_ARCH_AT91=y
 CONFIG_SOC_SAM_V7=y
 CONFIG_SOC_SAMA5D3=y
 CONFIG_MACH_SAMA5_DT=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AEABI=y
 # CONFIG_OABI_COMPAT is not set
 CONFIG_UACCESS_WITH_MEMCPY=y
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index aac7814db4f9..f1bf952da747 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -214,12 +214,6 @@ config MACH_SAMA5_DT
 
 comment "AT91 Feature Selections"
 
-config AT91_PROGRAMMABLE_CLOCKS
-   bool "Programmable Clocks"
-   help
- Select this if you need to program one or more of the PCK0..PCK3
- programmable clock outputs.
-
 config AT91_SLOW_CLOCK
bool "Suspend-to-RAM disables main oscillat

Re: [PATCH 3/3] pinctrl: at91: implement at91_pinconf_dbg_show

2013-12-13 Thread Nicolas Ferre

On 07/12/2013 14:08, Alexandre Belloni :

This allows to get the pin configuration by using debugfs. On my system:
  # cat /sys/kernel/debug/pinctrl/pinctrl.3/pinconf-pins

Signed-off-by: Alexandre Belloni 


I am fine with these helpers:

Acked-by: Nicolas Ferre 

But still a little disappointed that Laurent announced that he wouldn't 
review the whole kernel ;-)


Bye guys and thanks a lot!


---
  drivers/pinctrl/pinctrl-at91.c | 25 +
  1 file changed, 25 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index b0b78f3468ae..bcfc8a2eebca 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -784,10 +784,35 @@ static int at91_pinconf_set(struct pinctrl_dev *pctldev,
return 0;
  }

+#define DBG_SHOW_FLAG(flag) do {   \
+   if (config & flag) {\
+   if (num_conf)   \
+   seq_puts(s, "|"); \
+   seq_puts(s, #flag); \
+   num_conf++; \
+   }   \
+} while (0)
+
  static void at91_pinconf_dbg_show(struct pinctrl_dev *pctldev,
   struct seq_file *s, unsigned pin_id)
  {
+   unsigned long config;
+   int ret, val, num_conf = 0;
+
+   ret = at91_pinconf_get(pctldev, pin_id, &config);
+
+   DBG_SHOW_FLAG(MULTI_DRIVE);
+   DBG_SHOW_FLAG(PULL_UP);
+   DBG_SHOW_FLAG(PULL_DOWN);
+   DBG_SHOW_FLAG(DIS_SCHMIT);
+   DBG_SHOW_FLAG(DEGLITCH);
+   DBG_SHOW_FLAG(DEBOUNCE);
+   if (config & DEBOUNCE) {
+   val = config >> DEBOUNCE_VAL_SHIFT;
+   seq_printf(s, "(%d)", val);
+   }

+   return;
  }

  static void at91_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,




--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] at91: drivers for 3.14 #1

2013-12-13 Thread Nicolas Ferre
Arnd, Olof, Kevin,

This is a "drivers" series that adds Device Tree support to 
Atmel crypto drivers (AES/[T]DES/SHA). As the DT part of this
addition is in at91-3.14-dt I thought it would be simpler to take
this series through arm-soc. I asked and got Herbert's blessing.

The Device Tree entries documented in these patches are very simple
and only declare the reg/irq values and the link to DMA.

Thanks, best regards,

The following changes since commit b46e837d8ef1f3c777bbf9513e2cdb5d87d6c374:

  ARM: at91/dt: remove old clk material (2013-12-02 15:31:29 +0100)

are available in the git repository at:

  git://github.com/at91linux/linux-at91.git tags/at91-drivers

for you to fetch changes up to 1ca5b7d95315c42cf0b78d33cd316e404a9f137c:

  crypto: atmel-sha - add sha information to the log (2013-12-12 18:39:36 +0100)


AT91 crypto drivers DT support:
- add DT to sha/des/aes existing drivers
- add DMA DT
- all documentation added to crypto/atmel-crypto.txt file

--------
Nicolas Ferre (4):
  crypto: atmel-aes - add support for Device Tree
  crypto: atmel-tdes - add support for Device Tree
  crypto: atmel-sha - add support for Device Tree
  crypto: atmel-sha - add sha information to the log

 .../devicetree/bindings/crypto/atmel-crypto.txt|  68 ++
 drivers/crypto/atmel-aes.c | 143 ++---
 drivers/crypto/atmel-sha.c | 103 +++
 drivers/crypto/atmel-tdes.c| 143 ++---
 4 files changed, 334 insertions(+), 123 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/crypto/atmel-crypto.txt

-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] devicetree: macb: Document clock properties

2013-12-16 Thread Nicolas Ferre
On 13/12/2013 23:03, Soren Brinkmann :
> The macb driver uses the clock bindings. Document the required
> properties, especially the driver specific clock-names.
> 
> Signed-off-by: Soren Brinkmann 

Acked-by: Nicolas Ferre 

Thanks.

> ---
>  Documentation/devicetree/bindings/net/macb.txt | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/net/macb.txt 
> b/Documentation/devicetree/bindings/net/macb.txt
> index 4ff65047bb9a..70af2ec12b09 100644
> --- a/Documentation/devicetree/bindings/net/macb.txt
> +++ b/Documentation/devicetree/bindings/net/macb.txt
> @@ -10,6 +10,10 @@ Required properties:
>  - interrupts: Should contain macb interrupt
>  - phy-mode: String, operation mode of the PHY interface.
>Supported values are: "mii", "rmii", "gmii", "rgmii".
> +- clock-names: Tuple listing input clock names.
> + Required elements: 'pclk', 'hclk'
> + Optional elements: 'tx_clk'
> +- clocks: Phandles to input clocks.
>  
>  Optional properties:
>  - local-mac-address: 6 bytes, mac address
> @@ -22,4 +26,6 @@ Examples:
>   interrupts = <21>;
>   phy-mode = "rmii";
>   local-mac-address = [3a 0e 03 04 05 06];
> + clock-names = "pclk", "hclk", "tx_clk";
> + clocks = <&clkc 30>, <&clkc 30>, <&clkc 13>;
>   };
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] pinctrl: at91: replace clk_prepare + clk_enable by clk_prepare_enable

2013-12-16 Thread Nicolas Ferre
On 15/12/2013 19:30, Boris BREZILLON :
> Replace the clk_prepare and clk_enable calls by a single
> clk_prepare_enable call.
> 
> Signed-off-by: Boris BREZILLON 

Acked-by: Nicolas Ferre 

> ---
>  drivers/pinctrl/pinctrl-at91.c |6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
> index 82f6301..4deb9cb 100644
> --- a/drivers/pinctrl/pinctrl-at91.c
> +++ b/drivers/pinctrl/pinctrl-at91.c
> @@ -1359,10 +1359,8 @@ void at91_pinctrl_gpio_resume(void)
>  
>   pio = gpio_chips[i]->regbase;
>  
> - if (!wakeups[i]) {
> - if (clk_prepare(gpio_chips[i]->clock) == 0)
> - clk_enable(gpio_chips[i]->clock);
> - }
> + if (!wakeups[i])
> + clk_prepare_enable(gpio_chips[i]->clock);
>  
>   __raw_writel(wakeups[i], pio + PIO_IDR);
>   __raw_writel(backups[i], pio + PIO_IER);
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] pinctrl: at91: fix clk_unprepare and clk_disable order

2013-12-16 Thread Nicolas Ferre
On 15/12/2013 19:30, Boris BREZILLON :
> clk_unprepare shall be called before clk_disable.
> Fix the issue by replacing the clk_unprepare and clk_disable calls by a
> single clk_disable_unprepare call.
> 
> Signed-off-by: Boris BREZILLON 

Acked-by: Nicolas Ferre 

Thanks.

> ---
>  drivers/pinctrl/pinctrl-at91.c |8 +++-
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
> index a7549c4..82f6301 100644
> --- a/drivers/pinctrl/pinctrl-at91.c
> +++ b/drivers/pinctrl/pinctrl-at91.c
> @@ -1339,13 +1339,11 @@ void at91_pinctrl_gpio_suspend(void)
>   __raw_writel(backups[i], pio + PIO_IDR);
>   __raw_writel(wakeups[i], pio + PIO_IER);
>  
> - if (!wakeups[i]) {
> - clk_unprepare(gpio_chips[i]->clock);
> - clk_disable(gpio_chips[i]->clock);
> - } else {
> + if (!wakeups[i])
> + clk_disable_unprepare(gpio_chips[i]->clock);
> + else
>   printk(KERN_DEBUG "GPIO-%c may wake for %08x\n",
>      'A'+i, wakeups[i]);
> - }
>   }
>  }
>  
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: manual merge of the renesas tree with the arm-soc tree

2013-12-16 Thread Nicolas Ferre
On 16/12/2013 00:47, Stephen Rothwell :
> Hi Simon,
> 
> Today's linux-next merge of the renesas tree got a conflict in
> drivers/clk/Makefile between commit 0ad6125b1579 ("clk: at91: add PMC
> base support") from the arm-soc tree and commit 10cdfe9f327a ("clk:
> shmobile: Add R-Car Gen2 clocks support") from the renesas tree.
> 
> I fixed it up (see below) and can carry the fix as necessary (no action
> is required).

Fine for me.

Thanks. Bye,
-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] clk: at91: fix pmc_clk_ids data type attriubte

2013-12-17 Thread Nicolas Ferre
On 16/12/2013 22:25, Boris BREZILLON :
> Fix pmc_clk_ids data type attribute (__initdata -> __initconst).
> 
> Signed-off-by: Boris BREZILLON 
> Reported-by: Fengguang Wu 

Acked-by: Nicolas Ferre 

I take it in at91-3.14-cleanup2 branch and send it upstream through
arm-soc like any other CCF material for AT91 for the 3.14 release.

I guess that even without Mike Acked-by, this little fix can follow this
path.

Bye,

> ---
>  drivers/clk/at91/pmc.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
> index 7b9db60..4c03eda 100644
> --- a/drivers/clk/at91/pmc.c
> +++ b/drivers/clk/at91/pmc.c
> @@ -228,7 +228,7 @@ out_free_pmc:
>   return NULL;
>  }
>  
> -static const struct of_device_id pmc_clk_ids[] __initdata = {
> +static const struct of_device_id pmc_clk_ids[] __initconst = {
>   /* Main clock */
>   {
>       .compatible = "atmel,at91rm9200-clk-main",
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ARM: at91: at91sam9x5: correct typo error for ohci clock

2014-07-18 Thread Nicolas Ferre
On 14/07/2014 08:14, Boris BREZILLON :
> On Mon, 14 Jul 2014 11:08:14 +0800
> Bo Shen  wrote:
> 
>> Correct the typo error for the second "uhphs_clk".
>>
>> Signed-off-by: Bo Shen 
> 
> Acked-by: Boris Brezillon 

Acked-by: Nicolas Ferre 

> sam9n12 dtsi has the same bug, I'll fix it

Ok, thanks to Voice and you: I try to queue them for 3.16-fixes.

Bye,

> And sorry for the mess when moving sam9n12 and sam9x5 to the CCF, I
> should have checked my clock definitions more carefully :-(.

I admit that these values are pretty hard to read: the eye get bored
quite quickly ;-)

Bye,


>> ---
>>  arch/arm/boot/dts/at91sam9x5.dtsi | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi 
>> b/arch/arm/boot/dts/at91sam9x5.dtsi
>> index 2ebc421..727d3a4 100644
>> --- a/arch/arm/boot/dts/at91sam9x5.dtsi
>> +++ b/arch/arm/boot/dts/at91sam9x5.dtsi
>> @@ -1155,8 +1155,7 @@
>>  compatible = "atmel,at91rm9200-ohci", "usb-ohci";
>>  reg = <0x0060 0x10>;
>>  interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>;
>> -clocks = <&usb>, <&uhphs_clk>, <&udphs_clk>,
>> - <&uhpck>;
>> +        clocks = <&usb>, <&uhphs_clk>, <&uhphs_clk>, <&uhpck>;
>>  clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck";
>>  status = "disabled";
>>  };
> 
> 
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] at91: fixes for 3.16 #2

2014-07-18 Thread Nicolas Ferre
Arnd, Olof, Kevin,

This is the latest regressions that we found while testing the at91sam9n12 and
at91sam9x5 platforms following our move to CCF.
I created a pull-request this time because I have 3 patches: there should be
no conflict anyway. This tag does not contain the fix that Olof had taken during
previous -rc cycle on purpose: this way it won't appear twice in the history.

Thanks, best regards,

The following changes since commit 971dc9ce106110745f246337f229013589354536:

  ARM: at91/dt: sam9261: remove slow RC osc (2014-06-25 18:00:17 +0200)

are available in the git repository at:

  git://github.com/at91linux/linux-at91.git tags/at91-fixes

for you to fetch changes up to e0d69e119fc6bf7cc3c9f791478108c1b925bb2e:

  ARM: at91/dt: add missing clocks property to pwm node in sam9x5.dtsi 
(2014-07-18 15:56:35 +0200)


Second AT91 fixes series for 3.16
- fix clock definitions after the move to CCF for:
  - at91sam9n12 (ohci)
  - at91sam9x5 (ohci, pwm)


Bo Shen (1):
  ARM: at91: at91sam9x5: correct typo error for ohci clock

Boris BREZILLON (2):
  ARM: at91/dt: fix usb0 clocks definition in sam9n12 dtsi
  ARM: at91/dt: add missing clocks property to pwm node in sam9x5.dtsi

 arch/arm/boot/dts/at91sam9n12.dtsi | 2 +-
 arch/arm/boot/dts/at91sam9x5.dtsi  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 1/2] ARM: at91/dt: describe rgmii ethernet phy connected to sama5d3xek boards

2014-07-18 Thread Nicolas Ferre
On 10/07/2014 21:59, Boris BREZILLON :
> Add ethernet-phy nodes and specify phy interrupt (connected to pin PB25)
> and board specific timing configs.
> 
> Atmel has two different HW designs for its CPU modules: the first one
> (produced by Embest) is connecting PHYAD[0-2] pins to pull up resistors
> and the other one (produced by Ronetix) is connecting PHYAD0 to a pull up
> resistor and PHYAD[1-2] to pull down resistors.
> As a result, Ronetix design will have its PHY available at address 0x1 and
> Embest design at 0x7.
> By defining both phys we're letting the phy core detect the one actually
> available on the MDIO bus.
> 
> Signed-off-by: Boris BREZILLON 
> ---
> 
> Florian, I dropped your Reviewed-by tag because this patch has slightly
> changed.

Hi Florian,

I would like to have your Ack on this one as we discussed this solution
with you.

Thanks, bye,


>  arch/arm/boot/dts/sama5d3xcm.dtsi | 30 ++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sama5d3xcm.dtsi 
> b/arch/arm/boot/dts/sama5d3xcm.dtsi
> index b0b1331..755369e 100644
> --- a/arch/arm/boot/dts/sama5d3xcm.dtsi
> +++ b/arch/arm/boot/dts/sama5d3xcm.dtsi
> @@ -34,6 +34,36 @@
>  
>   macb0: ethernet@f0028000 {
>   phy-mode = "rgmii";
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + ethernet-phy@1 {
> + reg = <0x1>;
> + interrupt-parent = <&pioB>;
> + interrupts = <25 IRQ_TYPE_EDGE_FALLING>;
> + txen-skew-ps = <800>;
> + txc-skew-ps = <3000>;
> + rxdv-skew-ps = <400>;
> + rxc-skew-ps = <3000>;
> + rxd0-skew-ps = <400>;
> + rxd1-skew-ps = <400>;
> + rxd2-skew-ps = <400>;
> + rxd3-skew-ps = <400>;
> + };
> +
> + ethernet-phy@7 {
> + reg = <0x7>;
> + interrupt-parent = <&pioB>;
> + interrupts = <25 IRQ_TYPE_EDGE_FALLING>;
> + txen-skew-ps = <800>;
> + txc-skew-ps = <3000>;
> + rxdv-skew-ps = <400>;
> + rxc-skew-ps = <3000>;
> + rxd0-skew-ps = <400>;
> + rxd1-skew-ps = <400>;
> + rxd2-skew-ps = <400>;
> + rxd3-skew-ps = <400>;
> + };
>   };
>  
>   pmc: pmc@fc00 {
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 0/2] ARM: at91: remove phy fixup for sama5d3xek boards

2014-07-18 Thread Nicolas Ferre
On 10/07/2014 21:59, Boris BREZILLON :
> Hello,
> 
> This patch removes a board specific hook for sama5d3xek boards from the
> sama5d3 generic DT board file.
> 
> This hook (which register a phy fixup configuring board specific delays
> in the ksz9021 ethernet phy) is now replaced by the appropriate DT
> properties definitions in the sama5d3xcm.dtsi file.
> 
> Best Regards,

On the whole series:


Acked-by: Nicolas Ferre 


> Changes since v2:
>  - define 2 phy nodes to handle Ronetix and Embest HW designs
> 
> Changes since v1:
>  - fix txc-skew-ps and rxc-skew-ps delays
>  - remove phy address info to handle Ronetix and Embest HW designs
> 
> Boris BREZILLON (2):
>   ARM: at91/dt: describe rgmii ethernet phy connected to sama5d3xek
> boards
>   ARM: at91: remove phy fixup for sama5d3xek boards
> 
>  arch/arm/boot/dts/sama5d3xcm.dtsi   | 30 ++
>  arch/arm/mach-at91/board-dt-sama5.c | 22 ------
>  2 files changed, 30 insertions(+), 22 deletions(-)
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] ARM: at91: at91sam9g45: change at91_adc name

2014-04-22 Thread Nicolas Ferre
On 15/03/2014 16:33, Jonathan Cameron :
> On 10/03/14 13:26, Nicolas Ferre wrote:
>> On 06/03/2014 20:16, Jonathan Cameron :
>>> On 05/03/14 16:57, Alexandre Belloni wrote:
>>>> We can't use "at91_adc" to refer to the at91_adc driver anymore as the 
>>>> name is
>>>> used to match an id_table.
>>>>
>>>> Signed-off-by: Alexandre Belloni 
>>> As stated in previous email, I'll take this along with the fix that 'broke'
>>> this, if I get an Ack from one of the at91 maintainers.
>>
>> Jonathan,
>>
>> It is maybe more clear if I answer here:
>> - so, yes, you can take the 3 patches yourself (if you do not mind)
>> - you have, for the whole series::
>>
>> Acked-by: Nicolas Ferre 
> Applied to the fixes-togreg branch of iio.git
> 
> Timing wise, these will now hit immediately after the merge window closes.

Greg, Jonathan,

I saw the IIO pull request a week ago ([PULL] IIO fixes for 3.15 round
1) but I do not see it in Linus' tree for the moment:
http://article.gmane.org/gmane.linux.kernel.iio/11764

(sorry, I can't reply to the pull-request itself as I am not subscriber
to iio mailing-list)

As the series contains a fix for a kernel Oops and that is was already
delayed at the end of 3.14 cycle, will it be possible to include it
pretty soon in 3.15 cycle?

Thanks for your help, bye.

> Jonathan
>>
>> Thanks for your help with this issue.
>>
>> Bye,
>>
>>>> ---
>>>>arch/arm/mach-at91/at91sam9g45_devices.c | 2 +-
>>>>1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c 
>>>> b/arch/arm/mach-at91/at91sam9g45_devices.c
>>>> index cb36fa872d30..88554024eb2d 100644
>>>> --- a/arch/arm/mach-at91/at91sam9g45_devices.c
>>>> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c
>>>> @@ -1203,7 +1203,7 @@ static struct resource adc_resources[] = {
>>>>};
>>>>
>>>>static struct platform_device at91_adc_device = {
>>>> -  .name   = "at91_adc",
>>>> +  .name   = "at91sam9g45-adc",
>>>>.id = -1,
>>>>.dev= {
>>>>.platform_data  = &adc_data,
>>>>
>>>
>>>
>>
>>
> 
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ARM: at91: add pull-up to i2c[02] on SAMA5D3 Xplained

2014-04-22 Thread Nicolas Ferre
As there are no pull-up resistors on the board itself it can be useful to
use the SoC pad pull-up to be able to easily connect usual i2c devices.

Signed-off-by: Nicolas Ferre 
---
 arch/arm/boot/dts/at91-sama5d3_xplained.dts | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/at91-sama5d3_xplained.dts 
b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
index ce1375595e5f..ff8a159bb600 100644
--- a/arch/arm/boot/dts/at91-sama5d3_xplained.dts
+++ b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
@@ -43,6 +43,7 @@
};
 
i2c0: i2c@f0014000 {
+   pinctrl-0 = <&pinctrl_i2c0_pu>;
status = "okay";
};
 
@@ -102,6 +103,7 @@
 
i2c2: i2c@f801c000 {
dmas = <0>, <0>;/* Do not use DMA for 
i2c2 */
+   pinctrl-0 = <&pinctrl_i2c2_pu>;
status = "okay";
};
 
@@ -116,6 +118,18 @@
 
pinctrl@f200 {
board {
+   pinctrl_i2c0_pu: i2c0_pu {
+   atmel,pins =
+   ,
+   ;
+   };
+
+   pinctrl_i2c2_pu: i2c2_pu {
+   atmel,pins =
+   ,
+   ;
+   };
+
pinctrl_mmc0_cd: mmc0_cd {
atmel,pins =
;
-- 
1.8.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ARM: at91: sama5d3xek: reserve dma channel for audio

2014-09-18 Thread Nicolas Ferre
From: Bo Shen 

We set the DMA configuration on USARTs in the SoC DT in (ARM: at91: sama5d3:
add usart dma configurations). As the audio must work with DMA channels, we
reserve some dma channels for audio, or else audio won't work.

Signed-off-by: Bo Shen 
[nicolas.fe...@atmel.com: move to the sama5d3xmb.dtsi to cover all board 
variants]
Signed-off-by: Nicolas Ferre 
---
 arch/arm/boot/dts/sama5d3xmb.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi 
b/arch/arm/boot/dts/sama5d3xmb.dtsi
index b8c6f20e780c..49c10d33df30 100644
--- a/arch/arm/boot/dts/sama5d3xmb.dtsi
+++ b/arch/arm/boot/dts/sama5d3xmb.dtsi
@@ -25,6 +25,8 @@
};
 
spi0: spi@f0004000 {
+   dmas = <0>, <0>;/*  Do not use DMA for 
spi0 */
+
m25p80@0 {
compatible = "atmel,at25df321a";
spi-max-frequency = <5000>;
@@ -51,6 +53,7 @@
};
 
usart1: serial@f002 {
+   dmas = <0>, <0>;/*  Do not use DMA for 
usart1 */
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usart1 
&pinctrl_usart1_rts_cts>;
status = "okay";
@@ -132,6 +135,7 @@
};
 
dbgu: serial@ee00 {
+   dmas = <0>, <0>;/*  Do not use DMA for 
dbgu */
status = "okay";
};
 
-- 
1.8.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ARM: at91/dt: sama5d3: add the nfc clock

2014-09-18 Thread Nicolas Ferre
On 16/09/2014 10:43, Alexandre Belloni :
> The atmel_nand driver is now able to handle the nfc clock, add it to sama5d3.
> 
> Signed-off-by: Alexandre Belloni 

Acked-by: Nicolas Ferre 

Stacked on at91-3.18-dt3 branch.

Thanks,

> ---
>  arch/arm/boot/dts/sama5d3.dtsi | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
> index 7702a0d120cb..cd36c76fd4e3 100644
> --- a/arch/arm/boot/dts/sama5d3.dtsi
> +++ b/arch/arm/boot/dts/sama5d3.dtsi
> @@ -1005,6 +1005,11 @@
>   reg = <2>;
>   };
>  
> + hsmc_clk: hsmc_clk {
> + #clock-cells = <0>;
> + reg = <5>;
> + };
> +
>   pioA_clk: pioA_clk {
>   #clock-cells = <0>;
>   reg = <6>;
> @@ -1405,6 +1410,7 @@
>   0xc000 0x0070   /* NFC HSMC 
> regs */
>   0x0020 0x0010   /* NFC SRAM 
> banks */
>   >;
> +     clocks = <&hsmc_clk>;
>   };
>   };
>   };
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ARM: at91/dt: declare sckc node on at91sam9g45

2014-09-18 Thread Nicolas Ferre
On 09/09/2014 12:14, Boris BREZILLON :
> Declare the SCKC (Slow Clock Configuration) block and its clks.
> Make use of the clk32k clk instead of slow_osc where appropriate.
> 
> Signed-off-by: Boris BREZILLON 

Acked-by: Nicolas Ferre 

Stacked on top of at91-3.18-dt3.

Thanks, best regards,

> ---
>  arch/arm/boot/dts/at91sam9g45.dtsi | 30 --
>  1 file changed, 28 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi 
> b/arch/arm/boot/dts/at91sam9g45.dtsi
> index 9d4d0a1..68a457b 100644
> --- a/arch/arm/boot/dts/at91sam9g45.dtsi
> +++ b/arch/arm/boot/dts/at91sam9g45.dtsi
> @@ -159,7 +159,7 @@
>   compatible = 
> "atmel,at91rm9200-clk-master";
>   #clock-cells = <0>;
>   interrupts-extended = <&pmc 
> AT91_PMC_MCKRDY>;
> - clocks = <&slow_xtal>, <&main>, 
> <&plladiv>, <&utmi>;
> + clocks = <&clk32k>, <&main>, 
> <&plladiv>, <&utmi>;
>   atmel,clk-output-range = <0 1>;
>   atmel,clk-divisors = <1 2 4 3>;
>   };
> @@ -175,7 +175,7 @@
>   #address-cells = <1>;
>   #size-cells = <0>;
>   interrupt-parent = <&pmc>;
> - clocks = <&slow_xtal>, <&main>, 
> <&plladiv>, <&utmi>, <&mck>;
> + clocks = <&clk32k>, <&main>, 
> <&plladiv>, <&utmi>, <&mck>;
>  
>   prog0: prog0 {
>   #clock-cells = <0>;
> @@ -1160,6 +1160,32 @@
>   };
>   };
>  
> + sckc@fd50 {
> + compatible = "atmel,at91sam9x5-sckc";
> + reg = <0xfd50 0x4>;
> +
> + slow_osc: slow_osc {
> + compatible = 
> "atmel,at91sam9x5-clk-slow-osc";
> + #clock-cells = <0>;
> + atmel,startup-time-usec = <120>;
> + clocks = <&slow_xtal>;
> + };
> +
> + slow_rc_osc: slow_rc_osc {
> + compatible = 
> "atmel,at91sam9x5-clk-slow-rc-osc";
> + #clock-cells = <0>;
> + atmel,startup-time-usec = <75>;
> + clock-frequency = <32768>;
> + clock-accuracy = <5000>;
> + };
> +
> + clk32k: slck {
> + compatible = 
> "atmel,at91sam9x5-clk-slow";
> + #clock-cells = <0>;
> + clocks = <&slow_rc_osc &slow_osc>;
> + };
> + };
> +
>   rtc@fdb0 {
>   compatible = "atmel,at91rm9200-rtc";
>   reg = <0xfdb0 0x10>;
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ARM: at91/dt: at91sam9m10g45ek add rtc node

2014-09-18 Thread Nicolas Ferre
On 02/09/2014 12:52, Erik van Luijk :
> Signed-off-by: Erik van Luijk 

Acked-by: Nicolas Ferre 

and added to the at91-3.18-dt3 branch.

I also sent your remarks to the Documentation department in Atmel:
thanks a lot for your help.

> ---
>  arch/arm/boot/dts/at91sam9g45.dtsi | 7 +++
>  arch/arm/boot/dts/at91sam9m10g45ek.dts | 3 +++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi 
> b/arch/arm/boot/dts/at91sam9g45.dtsi
> index 932a669..bf62c18 100644
> --- a/arch/arm/boot/dts/at91sam9g45.dtsi
> +++ b/arch/arm/boot/dts/at91sam9g45.dtsi
> @@ -1070,6 +1070,13 @@
>   status = "disabled";
>   };
>  
> + rtc@fdb0 {
> + compatible = "atmel,at91rm9200-rtc";
> + reg = <0xfdb0 0x30>;
> + interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
> + status = "disabled";
> + };
> +
>   spi0: spi@fffa4000 {
>   #address-cells = <1>;
>   #size-cells = <0>;
> diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts 
> b/arch/arm/boot/dts/at91sam9m10g45ek.dts
> index 96ccc7d..2dd2347 100644
> --- a/arch/arm/boot/dts/at91sam9m10g45ek.dts
> +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts
> @@ -70,6 +70,9 @@
>  
>   watchdog@fd40 {
>   status = "okay";

BTW, there was an issue here: "};" missing..

I corrected it.

> +
> + rtc@fdb0 {
> + status = "okay";
>   };
>  
>   mmc0: mmc@fff8 {
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] at91: dt for 3.18 #3

2014-09-18 Thread Nicolas Ferre
Arnd, Olof, Kevin,

A third DT update for AT91 during this 3.18 dev. phase. Interesting updates and
also new features used: the NFC clock and the changes in pinctrl new the driver
updates that are already queued in mtd and pinctrl trees. No build dependency
but the NFC clock need the modification in the driver to be able to actually
boot: a kind of "runtime" dependency. But I don't know if you want to pull the
mtd or l2-mtd trees... Tell me if I need to do something for this.

It is on top of what you already have in at91/dt2.

Thanks, best regards,

The following changes since commit 5f8157309624929e05ece846d3ca8a3a64988378:

  ARM: at91: remove phy fixup for sama5d3xek boards (2014-09-01 19:30:44 +0200)

are available in the git repository at:

  git://github.com/at91linux/linux-at91.git tags/at91-dt3

for you to fetch changes up to 4dd7933ad606af457bc85b1afdaaac68aa993abf:

  ARM: at91/dt: at91sam9m10g45ek add rtc node (2014-09-18 18:14:48 +0200)


More AT91 DT material for 3.18:
- specify DMA channels for USART on sama5d3 and choose peripherals
  that will use them on the EK boards
- SSC update for audio on at91sam9rl and at91sam9g20
- addition of the NFC clock and new pinctrl compatible string
  to use enhancements that will land in drivers during this release
- several new nodes and fixes


Alexandre Belloni (1):
  ARM: at91/dt: sama5d3: add the nfc clock

Bo Shen (3):
  ARM: at91: sama5d3xek: reserve dma channel for audio
  ARM: at91/dt: at91sam9rl: switch ssc compatible string
  ARM: at91/dt: at91sam9g20: switch ssc compatible string

Boris BREZILLON (1):
  ARM: at91/dt: declare sckc node on at91sam9g45

David Dueck (1):
  ARM: at91/dt: Fix typo regarding can0_clk

Erik van Luijk (1):
  ARM: at91/dt: at91sam9m10g45ek add rtc node

Ludovic Desroches (1):
  ARM: at91: sama5d3: add usart dma configurations

Marek Roszko (1):
  ARM: at91/dt: sama5d3: use new pinctrl compatible string

 arch/arm/boot/dts/at91sam9g20.dtsi |  4 
 arch/arm/boot/dts/at91sam9g45.dtsi | 37 --
 arch/arm/boot/dts/at91sam9m10g45ek.dts |  4 
 arch/arm/boot/dts/at91sam9rl.dtsi  |  4 ++--
 arch/arm/boot/dts/sama5d3.dtsi | 23 -
 arch/arm/boot/dts/sama5d3_can.dtsi |  2 +-
 arch/arm/boot/dts/sama5d3xmb.dtsi  |  4 
 7 files changed, 72 insertions(+), 6 deletions(-)

-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv3 5/7] ARM: at91: dt: add device tree file for SAMA5D4ek board

2014-09-19 Thread Nicolas Ferre
On 15/09/2014 18:15, Alexandre Belloni :
> From: Nicolas Ferre 
> 
> Add reference SAMA5D4-EK platform DT file.
> 
> Signed-off-by: Nicolas Ferre 
> Signed-off-by: Josh Wu 
> Signed-off-by: Alexandre Belloni 
> ---
>  arch/arm/boot/dts/Makefile   |   2 +
>  arch/arm/boot/dts/at91-sama5d4ek.dts | 308 
> +++
>  2 files changed, 310 insertions(+)
>  create mode 100644 arch/arm/boot/dts/at91-sama5d4ek.dts
> 
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index 75c7b7425c79..a7df6aeb5a1a 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -48,6 +48,8 @@ dtb-$(CONFIG_ARCH_AT91) += sama5d33ek.dtb
>  dtb-$(CONFIG_ARCH_AT91)  += sama5d34ek.dtb
>  dtb-$(CONFIG_ARCH_AT91)  += sama5d35ek.dtb
>  dtb-$(CONFIG_ARCH_AT91)  += sama5d36ek.dtb
> +# sama5d4
> +dtb-$(CONFIG_ARCH_AT91)  += at91-sama5d4ek.dtb
>  
>  dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb
>  dtb-$(CONFIG_ARCH_AXXIA) += axm5516-amarillo.dtb
> diff --git a/arch/arm/boot/dts/at91-sama5d4ek.dts 
> b/arch/arm/boot/dts/at91-sama5d4ek.dts
> new file mode 100644
> index ..aa01c2610c6d
> --- /dev/null
> +++ b/arch/arm/boot/dts/at91-sama5d4ek.dts
> @@ -0,0 +1,308 @@
> +/*
> + * sama5d4ek.dts - Device Tree file for SAMA5D4 Evaluation Kit
> + *
> + *  Copyright (C) 2014 Atmel,
> + *2014 Nicolas Ferre 
> + *
> + * This file is dual-licensed: you can use it either under the terms
> + * of the GPL or the X11 license, at your option. Note that this dual
> + * licensing only applies to this file, and not this project as a
> + * whole.
> + *
> + *  a) This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of the
> + * License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * Or, alternatively,
> + *
> + *  b) Permission is hereby granted, free of charge, to any person
> + * obtaining a copy of this software and associated documentation
> + * files (the "Software"), to deal in the Software without
> + * restriction, including without limitation the rights to use,
> + * copy, modify, merge, publish, distribute, sublicense, and/or
> + * sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following
> + * conditions:
> + *
> + * The above copyright notice and this permission notice shall be
> + * included in all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
> + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
> + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
> + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + * OTHER DEALINGS IN THE SOFTWARE.
> + */
> +/dts-v1/;
> +#include "sama5d4.dtsi"
> +
> +/ {
> + model = "Atmel SAMA5D4-EK";
> + compatible = "atmel,sama5d4ek", "atmel,sama5d4", "atmel,sama5";
> +
> + chosen {
> + bootargs = "console=ttyS0,115200 ignore_loglevel earlyprintk";
> + };
> +
> + memory {
> + reg = <0x2000 0x2000>;
> + };
> +
> + clocks {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + ranges;
> +
> + main_clock: clock@0 {
> + compatible = "atmel,osc", "fixed-clock";
> + clock-frequency = <1200>;
> + };
> +
> + slow_xtal {
> + clock-frequency = <32768>;
> + };
> +
> + main_xtal {
> + clock-frequency = <1200>;
> + };
> + };
> +
> + ahb {
> + apb {
> + lcd_bus@f000 {
> + status = "okay";
> +
> + lc

Re: [PATCHv3 1/7] clk: at91: add a driver for the h32mx clock

2014-09-19 Thread Nicolas Ferre
On 15/09/2014 18:15, Alexandre Belloni :
> Newer SoCs have two different AHB interconnect. The AHB 32 bits Matrix
> interconnect (h32mx) has a clock that can be setup at the half of the h64mx
> clock (which is mck). The h32mx clock can not exceed 90 MHz.
> 
> Signed-off-by: Alexandre Belloni 

Okay on my side:

Acked-by: Nicolas Ferre 


> ---
> Cc:Mike Turquette 

Mike,

I guess that you didn't get this v3. Can you "Ack" this one of should we
re-sent to you?

I would like to take this patch with the rest of the SAMA5D4 series: is
it okay for you?

Bye,


>  .../devicetree/bindings/clock/at91-clock.txt   |  15 +++
>  arch/arm/mach-at91/Kconfig |   3 +
>  drivers/clk/at91/Makefile  |   1 +
>  drivers/clk/at91/clk-h32mx.c   | 123 
> +
>  drivers/clk/at91/pmc.c |   6 +
>  drivers/clk/at91/pmc.h |   5 +
>  include/linux/clk/at91_pmc.h   |   1 +
>  7 files changed, 154 insertions(+)
>  create mode 100644 drivers/clk/at91/clk-h32mx.c
> 
> diff --git a/Documentation/devicetree/bindings/clock/at91-clock.txt 
> b/Documentation/devicetree/bindings/clock/at91-clock.txt
> index b3d544ca522a..40dc2405de7c 100644
> --- a/Documentation/devicetree/bindings/clock/at91-clock.txt
> +++ b/Documentation/devicetree/bindings/clock/at91-clock.txt
> @@ -74,6 +74,9 @@ Required properties:
>   "atmel,at91sam9x5-clk-utmi":
>   at91 utmi clock
>  
> + "atmel,sama5d4-clk-h32mx":
> + at91 h32mx clock
> +
>  Required properties for SCKC node:
>  - reg : defines the IO memory reserved for the SCKC.
>  - #size-cells : shall be 0 (reg is used to encode clk id).
> @@ -447,3 +450,15 @@ For example:
>   #clock-cells = <0>;
>   clocks = <&main>;
>   };
> +
> +Required properties for 32 bits bus Matrix clock (h32mx clock):
> +- #clock-cells : from common clock binding; shall be set to 0.
> +- clocks : shall be the master clock source phandle.
> +
> +For example:
> + h32ck: h32mxck {
> + #clock-cells = <0>;
> + compatible = "atmel,sama5d4-clk-h32mx";
> + clocks = <&mck>;
> + };
> +
> diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
> index 6eb3c658761d..fd177956dd56 100644
> --- a/arch/arm/mach-at91/Kconfig
> +++ b/arch/arm/mach-at91/Kconfig
> @@ -39,6 +39,9 @@ config AT91_SAM9_TIME
>  config HAVE_AT91_SMD
>   bool
>  
> +config HAVE_AT91_H32MX
> + bool
> +
>  config SOC_AT91SAM9
>   bool
>   select AT91_SAM9_TIME
> diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
> index 4998aee59267..89a48a7bd5df 100644
> --- a/drivers/clk/at91/Makefile
> +++ b/drivers/clk/at91/Makefile
> @@ -9,3 +9,4 @@ obj-y += clk-system.o clk-peripheral.o clk-programmable.o
>  obj-$(CONFIG_HAVE_AT91_UTMI) += clk-utmi.o
>  obj-$(CONFIG_HAVE_AT91_USB_CLK)  += clk-usb.o
>  obj-$(CONFIG_HAVE_AT91_SMD)  += clk-smd.o
> +obj-$(CONFIG_HAVE_AT91_H32MX)+= clk-h32mx.o
> diff --git a/drivers/clk/at91/clk-h32mx.c b/drivers/clk/at91/clk-h32mx.c
> new file mode 100644
> index ..152dcb3f7b5f
> --- /dev/null
> +++ b/drivers/clk/at91/clk-h32mx.c
> @@ -0,0 +1,123 @@
> +/*
> + * clk-h32mx.c
> + *
> + *  Copyright (C) 2014 Atmel
> + *
> + * Alexandre Belloni 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "pmc.h"
> +
> +#define H32MX_MAX_FREQ   9000
> +
> +struct clk_sama5d4_h32mx {
> + struct clk_hw hw;
> + struct at91_pmc *pmc;
> +};
> +
> +#define to_clk_sama5d4_h32mx(hw) container_of(hw, struct clk_sama5d4_h32mx, 
> hw)
> +
> +static unsigned long clk_sama5d4_h32mx_recalc_rate(struct clk_hw *hw,
> +  unsigned long parent_rate)
> +{
> + struct clk_sama5d4_h32mx *h32mxclk = to_clk_sama5d4_h32mx(hw);
> +
> + if (pmc_read(h32mxclk->pmc, AT91_PMC_MCKR) & AT91_PMC_H32MXDIV)
> + return parent_rate / 2;
> +
> + if (parent_rate > H32MX_MAX_FREQ)
> + 

Re: [PATCHv3 7/7] ARM: at91: document Atmel SMART compatibles

2014-09-19 Thread Nicolas Ferre
On 15/09/2014 18:15, Alexandre Belloni :
> Document all the available compatibles for Atmel "SMART" SoCs.
> 
> Signed-off-by: Alexandre Belloni 

Acked-by: Nicolas Ferre 

Thanks

> ---
>  .../devicetree/bindings/arm/atmel-at91.txt | 37 
> ++
>  1 file changed, 37 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt 
> b/Documentation/devicetree/bindings/arm/atmel-at91.txt
> index 6e3e3e5c611f..562cda9d86d9 100644
> --- a/Documentation/devicetree/bindings/arm/atmel-at91.txt
> +++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt
> @@ -1,6 +1,43 @@
>  Atmel AT91 device tree bindings.
>  
>  
> +Boards with a SoC of the Atmel AT91 or SMART family shall have the following
> +properties:
> +
> +Required root node properties:
> +compatible: must be one of:
> + * "atmel,at91rm9200"
> +
> + * "atmel,at91sam9" for SoCs using an ARM926EJ-S core, shall be extended with
> +   the specific SoC family or compatible:
> +o "atmel,at91sam9260"
> +o "atmel,at91sam9261"
> +o "atmel,at91sam9263"
> +o "atmel,at91sam9x5" for the 5 series, shall be extended with the 
> specific
> +  SoC compatible:
> +   - "atmel,at91sam9g15"
> +   - "atmel,at91sam9g25"
> +   - "atmel,at91sam9g35"
> +   - "atmel,at91sam9x25"
> +   - "atmel,at91sam9x35"
> +o "atmel,at91sam9g20"
> +o "atmel,at91sam9g45"
> +o "atmel,at91sam9n12"
> +o "atmel,at91sam9rl"
> + * "atmel,sama5" for SoCs using a Cortex-A5, shall be extended with the 
> specific
> +   SoC family:
> +o "atmel,sama5d3" shall be extended with the specific SoC compatible:
> +   - "atmel,sama5d31"
> +   - "atmel,sama5d33"
> +   - "atmel,sama5d34"
> +   - "atmel,sama5d35"
> +   - "atmel,sama5d36"
> +o "atmel,sama5d4" shall be extended with the specific SoC compatible:
> +   - "atmel,sama5d41"
> +   - "atmel,sama5d42"
> +   - "atmel,sama5d43"
> +   - "atmel,sama5d44"
> +
>  PIT Timer required properties:
>  - compatible: Should be "atmel,at91sam9260-pit"
>  - reg: Should contain registers location and length
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] at91: soc 3.18 #1

2014-09-19 Thread Nicolas Ferre
Arnd, Olof, Kevin,

A little SoC pull-request before the bigger one with SAMA5D4 support. This one
is just beginning the removal of board files in arch/arm/mach-at91 directory.

Thanks, best regards,

The following changes since commit 7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9:

  Linux 3.17-rc1 (2014-08-16 10:40:26 -0600)

are available in the git repository at:

  git://github.com/at91linux/linux-at91.git tags/at91-soc

for you to fetch changes up to 5db722eeba0051c68e638114f6720e715b03cd2c:

  ARM: at91: Remove the support for the RSI EWS board (2014-09-19 13:13:23 
+0200)


First AT91 SoC batch for 3.18:
- removal of 2 board C files in mach-at91


Josef Holzmayr (1):
  ARM: at91: Remove the support for the RSI EWS board

Nicolas Ferre (1):
  ARM: at91: remove board file for Acme Systems Fox G20

 arch/arm/mach-at91/Kconfig.non_dt  |  12 --
 arch/arm/mach-at91/Makefile|   2 -
 arch/arm/mach-at91/board-foxg20.c  | 272 ---
 arch/arm/mach-at91/board-rsi-ews.c | 232 --
 4 files changed, 518 deletions(-)
 delete mode 100644 arch/arm/mach-at91/board-foxg20.c
 delete mode 100644 arch/arm/mach-at91/board-rsi-ews.c

-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] USB: at91: fix the number of endpoint parameter

2014-01-17 Thread Nicolas Ferre
On 17/01/2014 03:59, Bo Shen :
> In sama5d3 SoC, there are 16 endpoints. As the USBA_NR_ENDPOINTS
> is only 7. So, fix it for sama5d3 SoC using the udc->num_ep.
> 
> Signed-off-by: Bo Shen 

Acked-by: Nicolas Ferre 

> ---
> 
>  drivers/usb/gadget/atmel_usba_udc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/atmel_usba_udc.c 
> b/drivers/usb/gadget/atmel_usba_udc.c
> index 2cb52e0..7e67a81 100644
> --- a/drivers/usb/gadget/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/atmel_usba_udc.c
> @@ -1670,7 +1670,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
>   if (ep_status) {
>   int i;
>  
> - for (i = 0; i < USBA_NR_ENDPOINTS; i++)
> + for (i = 0; i < udc->num_ep; i++)
>   if (ep_status & (1 << i)) {
>   if (ep_is_control(&udc->usba_ep[i]))
>   usba_control_irq(udc, &udc->usba_ep[i]);
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] USB: at91: using USBA_NR_DMAS for DMA channels

2014-01-17 Thread Nicolas Ferre
On 17/01/2014 03:59, Bo Shen :
> When the SoC is earlier than sama5d3 SoC, which have the same number
> endpoints and DMAs. However for sama5d3 SoC, it has different number
> for endpoints and DMAs. So, define USBA_NR_DMAs for DMA channels
> 
> Signed-off-by: Bo Shen 

Acked-by: Nicolas Ferre 

> ---
> 
>  drivers/usb/gadget/atmel_usba_udc.c | 2 +-
>  drivers/usb/gadget/atmel_usba_udc.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/atmel_usba_udc.c 
> b/drivers/usb/gadget/atmel_usba_udc.c
> index 7e67a81..5cded1c 100644
> --- a/drivers/usb/gadget/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/atmel_usba_udc.c
> @@ -1661,7 +1661,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
>   if (dma_status) {
>   int i;
>  
> - for (i = 1; i < USBA_NR_ENDPOINTS; i++)
> + for (i = 1; i < USBA_NR_DMAS; i++)
>   if (dma_status & (1 << i))
>   usba_dma_irq(udc, &udc->usba_ep[i]);
>   }
> diff --git a/drivers/usb/gadget/atmel_usba_udc.h 
> b/drivers/usb/gadget/atmel_usba_udc.h
> index 2922db5..a70706e 100644
> --- a/drivers/usb/gadget/atmel_usba_udc.h
> +++ b/drivers/usb/gadget/atmel_usba_udc.h
> @@ -210,7 +210,7 @@
>  #define USBA_FIFO_BASE(x)((x) << 16)
>  
>  /* Synth parameters */
> -#define USBA_NR_ENDPOINTS7
> +#define USBA_NR_DMAS 7
>  
>  #define EP0_FIFO_SIZE64
>  #define EP0_EPT_SIZE USBA_EPT_SIZE_64
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] USB: at91: fix the number of endpoint parameter

2014-01-21 Thread Nicolas Ferre
On 21/01/2014 09:12, Bo Shen :
> Hi J,
> 
> On 01/21/2014 01:49 PM, Jean-Christophe PLAGNIOL-VILLARD wrote:
>> On 11:39 Mon 20 Jan , Bo Shen wrote:
>>> Hi J,
>>>
>>> On 01/18/2014 01:20 PM, Jean-Christophe PLAGNIOL-VILLARD wrote:
>>>> On 10:59 Fri 17 Jan , Bo Shen wrote:
>>>>> In sama5d3 SoC, there are 16 endpoints. As the USBA_NR_ENDPOINTS
>>>>> is only 7. So, fix it for sama5d3 SoC using the udc->num_ep.
>>>>>
>>>>> Signed-off-by: Bo Shen 
>>>>> ---
>>>>>
>>>>>   drivers/usb/gadget/atmel_usba_udc.c | 2 +-
>>>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/usb/gadget/atmel_usba_udc.c 
>>>>> b/drivers/usb/gadget/atmel_usba_udc.c
>>>>> index 2cb52e0..7e67a81 100644
>>>>> --- a/drivers/usb/gadget/atmel_usba_udc.c
>>>>> +++ b/drivers/usb/gadget/atmel_usba_udc.c
>>>>> @@ -1670,7 +1670,7 @@ static irqreturn_t usba_udc_irq(int irq, void 
>>>>> *devid)
>>>>>   if (ep_status) {
>>>>>   int i;
>>>>>
>>>>> - for (i = 0; i < USBA_NR_ENDPOINTS; i++)
>>>>> + for (i = 0; i < udc->num_ep; i++)
>>>>
>>>> no the limit need to specified in the driver as a checkpoint by the 
>>>> compatible
>>>> or platform driver id
>>>
>>> You mean, we should not trust the data passed from dt node or
>>> platform data? Or do you think we should do double confirm?
>>
>> no base on the driver name or the compatible you will known the MAX EP
>>
>> not based on the dt ep description
>>
>> as we do on pinctrl-at91
> 
> I am sorry, I am not fully get it after reading the code of 
> pinctrl-at91.c, can you give the example code in pinctrl-at91.c?
> 
> Btw, the udc->num_ep is get from the following code.
> for dt
> --->8---
>   while ((pp = of_get_next_child(np, pp)))
>   udc->num_ep++;
> ---<8---
> 
> for non-dt
> --->8---
>   udc->num_ep = pdata->num_ep;
> ---8<---

It seems to me pretty valid to use num_ep in this driver and not have to
rely on another compatibility string just for this.
The information is here, it is retrieved pretty cleanly so I vote for a
simple use of it: if we introduce another information we will have to
double check the cross errors that would happen...

Bye,

>>>>>   if (ep_status & (1 << i)) {
>>>>>   if (ep_is_control(&udc->usba_ep[i]))
>>>>>   usba_control_irq(udc, 
>>>>> &udc->usba_ep[i]);
>>>>> --
>>>>> 1.8.5.2
>>>>>
>>>
>>> Best Regards,
>>> Bo Shen
> 
> Best Regards,
> Bo Shen
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] at91: soc for 3.18 #2

2014-09-22 Thread Nicolas Ferre
Arnd, Olof, Kevin,

This is the second SoC pull-request for AT91 and it's dedicated to the addition
of our new SAMA5D4: C-A5+neon+L2CC+vdec (in sort). The AT91 SoC support is now
pretty simple in relation with the enhancements done recently.
The patches go on top of the previous tag at91-soc and has no dependency.

The merge with other AT91 branches can lead to little conflicts that I resolved
for you in the at91-3.18-resolved2 branch that you can take as an example.

Thanks, best regards,

The following changes since commit 5db722eeba0051c68e638114f6720e715b03cd2c:

  ARM: at91: Remove the support for the RSI EWS board (2014-09-19 13:13:23 
+0200)

are available in the git repository at:

  git://github.com/at91linux/linux-at91.git tags/at91-soc2

for you to fetch changes up to 02037a9719fa89b7e5dc25cb22afc06c4eae406e:

  ARM: at91: document Atmel SMART compatibles (2014-09-22 14:42:40 +0200)


Second SoC batch for 3.18:
- introduction of the new SAMA5D4 SoC and associated Evaluation Kit
- low level soc detection and early printk code
- taking advantage of this, documentation of all AT91 SoC DT strings


Alexandre Belloni (3):
  clk: at91: add a driver for the h32mx clock
  ARM: at91: add sama5d4 support to sama5_defconfig
  ARM: at91: document Atmel SMART compatibles

Nicolas Ferre (4):
  ARM: at91: introduce basic SAMA5D4 support
  ARM: at91: SAMA5D4 SoC detection code and low level routines
  ARM: at91: dt: add device tree file for SAMA5D4 SoC
  ARM: at91: dt: add device tree file for SAMA5D4ek board

 .../devicetree/bindings/arm/atmel-at91.txt |   37 +
 .../devicetree/bindings/clock/at91-clock.txt   |   14 +
 arch/arm/Kconfig.debug |4 +
 arch/arm/boot/dts/Makefile |2 +
 arch/arm/boot/dts/at91-sama5d4ek.dts   |  260 
 arch/arm/boot/dts/sama5d4.dtsi | 1240 
 arch/arm/configs/sama5_defconfig   |1 +
 arch/arm/mach-at91/Kconfig |   21 +
 arch/arm/mach-at91/Makefile|1 +
 arch/arm/mach-at91/board-dt-sama5.c|   16 +-
 arch/arm/mach-at91/generic.h   |1 +
 arch/arm/mach-at91/include/mach/cpu.h  |   22 +-
 arch/arm/mach-at91/include/mach/debug-macro.S  |5 +-
 arch/arm/mach-at91/include/mach/hardware.h |   19 +-
 arch/arm/mach-at91/include/mach/sama5d4.h  |   33 +
 arch/arm/mach-at91/include/mach/uncompress.h   |   21 +-
 arch/arm/mach-at91/sama5d4.c   |   64 +
 arch/arm/mach-at91/setup.c |   97 +-
 arch/arm/mach-at91/soc.h   |5 +
 drivers/clk/at91/Makefile  |1 +
 drivers/clk/at91/clk-h32mx.c   |  123 ++
 drivers/clk/at91/pmc.c |6 +
 drivers/clk/at91/pmc.h |5 +
 include/linux/clk/at91_pmc.h   |1 +
 24 files changed, 1987 insertions(+), 12 deletions(-)
 create mode 100644 arch/arm/boot/dts/at91-sama5d4ek.dts
 create mode 100644 arch/arm/boot/dts/sama5d4.dtsi
 create mode 100644 arch/arm/mach-at91/include/mach/sama5d4.h
 create mode 100644 arch/arm/mach-at91/sama5d4.c
 create mode 100644 drivers/clk/at91/clk-h32mx.c

-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 1/9] rtc: at91sam9: remove references to mach specific headers

2014-09-23 Thread Nicolas Ferre
On 22/09/2014 17:42, Boris BREZILLON :
> In order to support multi platform kernel drivers should not include
> machine specific headers.
> Copy RTT macros in the driver code and remove any machine specific
> headers.
> 
> Signed-off-by: Boris BREZILLON 
> Acked-by: Alexandre Belloni 

Acked-by: Nicolas Ferre 

> ---
>  drivers/rtc/rtc-at91sam9.c | 22 ++
>  1 file changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
> index 5963743..51f0038 100644
> --- a/drivers/rtc/rtc-at91sam9.c
> +++ b/drivers/rtc/rtc-at91sam9.c
> @@ -22,10 +22,6 @@
>  #include 
>  #include 
>  
> -#include 
> -#include 
> -#include 
> -
>  /*
>   * This driver uses two configurable hardware resources that live in the
>   * AT91SAM9 backup power domain (intended to be powered at all times)
> @@ -47,6 +43,24 @@
>   * registers available, likewise usable for more than "RTC" support.
>   */
>  
> +#define AT91_RTT_MR  0x00/* Real-time Mode 
> Register */
> +#define AT91_RTT_RTPRES  (0x << 0)   /* Real-time 
> Timer Prescaler Value */
> +#define AT91_RTT_ALMIEN  (1 << 16)   /* Alarm 
> Interrupt Enable */
> +#define AT91_RTT_RTTINCIEN   (1 << 17)   /* Real Time Timer 
> Increment Interrupt Enable */
> +#define AT91_RTT_RTTRST  (1 << 18)   /* Real Time 
> Timer Restart */
> +
> +#define AT91_RTT_AR  0x04/* Real-time Alarm 
> Register */
> +#define AT91_RTT_ALMV(0x)/* Alarm Value 
> */
> +
> +#define AT91_RTT_VR  0x08/* Real-time Value 
> Register */
> +#define AT91_RTT_CRTV(0x)/* Current 
> Real-time Value */
> +
> +#define AT91_RTT_SR  0x0c/* Real-time Status 
> Register */
> +#define AT91_RTT_ALMS(1 << 0)/* Real-time 
> Alarm Status */
> +#define AT91_RTT_RTTINC  (1 << 1)/* Real-time 
> Timer Increment */
> +
> +#define AT91_SLOW_CLOCK  32768
> +
>  /*
>   * We store ALARM_DISABLED in ALMV to record that no alarm is set.
>   * It's also the reset value for that field.
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 2/9] rtc: at91sam9: use standard readl/writel functions instead of raw versions

2014-09-23 Thread Nicolas Ferre
Can be good to know why... here.

Otherwise, you can add my:
Acked-by: Nicolas Ferre 


On 22/09/2014 17:42, Boris BREZILLON :
> Signed-off-by: Boris BREZILLON 
> Acked-by: Alexandre Belloni 
> ---
>  drivers/rtc/rtc-at91sam9.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
> index 51f0038..74a9ca0 100644
> --- a/drivers/rtc/rtc-at91sam9.c
> +++ b/drivers/rtc/rtc-at91sam9.c
> @@ -77,14 +77,14 @@ struct sam9_rtc {
>  };
>  
>  #define rtt_readl(rtc, field) \
> - __raw_readl((rtc)->rtt + AT91_RTT_ ## field)
> + readl((rtc)->rtt + AT91_RTT_ ## field)
>  #define rtt_writel(rtc, field, val) \
> - __raw_writel((val), (rtc)->rtt + AT91_RTT_ ## field)
> + writel((val), (rtc)->rtt + AT91_RTT_ ## field)
>  
>  #define gpbr_readl(rtc) \
> - __raw_readl((rtc)->gpbr)
> + readl((rtc)->gpbr)
>  #define gpbr_writel(rtc, val) \
> - __raw_writel((val), (rtc)->gpbr)
> + writel((val), (rtc)->gpbr)
>  
>  /*
>   * Read current time and date in RTC
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 4/9] rtc: at91sam9: add DT support

2014-09-23 Thread Nicolas Ferre
On 22/09/2014 17:42, Boris BREZILLON :
> Add of_match_table to the existing driver so that rtt nodes defined in at91
> DTs can be attached to this driver.
> 
> Signed-off-by: Boris BREZILLON 
> Acked-by: Alexandre Belloni 
Acked-by: Nicolas Ferre 

> ---
>  drivers/rtc/rtc-at91sam9.c | 9 +
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
> index 38a2693..d72c34d 100644
> --- a/drivers/rtc/rtc-at91sam9.c
> +++ b/drivers/rtc/rtc-at91sam9.c
> @@ -445,6 +445,14 @@ static int at91_rtc_resume(struct device *dev)
>  
>  static SIMPLE_DEV_PM_OPS(at91_rtc_pm_ops, at91_rtc_suspend, at91_rtc_resume);
>  
> +#ifdef CONFIG_OF
> +static const struct of_device_id at91_rtc_dt_ids[] = {
> + { .compatible = "atmel,at91sam9260-rtt" },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, at91_rtc_dt_ids);
> +#endif
> +
>  static struct platform_driver at91_rtc_driver = {
>   .probe  = at91_rtc_probe,
>   .remove = at91_rtc_remove,
> @@ -453,6 +461,7 @@ static struct platform_driver at91_rtc_driver = {
>   .name   = "rtc-at91sam9",
>   .owner  = THIS_MODULE,
>   .pm = &at91_rtc_pm_ops,
> + .of_match_table = of_match_ptr(at91_rtc_dt_ids),
>   },
>  };
>  
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 3/9] rtc: at91sam9: replace devm_ioremap by devm_ioremap_resource

2014-09-23 Thread Nicolas Ferre
On 22/09/2014 17:42, Boris BREZILLON :
> Replace devm_ioremap calls by devm_ioremap_resource which already check
> resource consistency (resource != NULL) and print an error in case of
> failure.
> 
> Signed-off-by: Boris BREZILLON 
> Acked-by: Alexandre Belloni 
Acked-by: Nicolas Ferre 

> ---
>  drivers/rtc/rtc-at91sam9.c | 29 ++---
>  1 file changed, 10 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
> index 74a9ca0..38a2693 100644
> --- a/drivers/rtc/rtc-at91sam9.c
> +++ b/drivers/rtc/rtc-at91sam9.c
> @@ -306,18 +306,11 @@ static const struct rtc_class_ops at91_rtc_ops = {
>   */
>  static int at91_rtc_probe(struct platform_device *pdev)
>  {
> - struct resource *r, *r_gpbr;
> + struct resource *r;
>   struct sam9_rtc *rtc;
>   int ret, irq;
>   u32 mr;
>  
> - r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - r_gpbr = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> - if (!r || !r_gpbr) {
> - dev_err(&pdev->dev, "need 2 ressources\n");
> - return -ENODEV;
> - }
> -
>   irq = platform_get_irq(pdev, 0);
>   if (irq < 0) {
>   dev_err(&pdev->dev, "failed to get interrupt resource\n");
> @@ -335,18 +328,16 @@ static int at91_rtc_probe(struct platform_device *pdev)
>   device_init_wakeup(&pdev->dev, 1);
>  
>   platform_set_drvdata(pdev, rtc);
> - rtc->rtt = devm_ioremap(&pdev->dev, r->start, resource_size(r));
> - if (!rtc->rtt) {
> - dev_err(&pdev->dev, "failed to map registers, aborting.\n");
> - return -ENOMEM;
> - }
>  
> - rtc->gpbr = devm_ioremap(&pdev->dev, r_gpbr->start,
> - resource_size(r_gpbr));
> - if (!rtc->gpbr) {
> - dev_err(&pdev->dev, "failed to map gpbr registers, 
> aborting.\n");
> - return -ENOMEM;
> - }
> + r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + rtc->rtt = devm_ioremap_resource(&pdev->dev, r);
> + if (IS_ERR(rtc->rtt))
> +     return PTR_ERR(rtc->rtt);
> +
> + r = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> + rtc->gpbr = devm_ioremap_resource(&pdev->dev, r);
> + if (IS_ERR(rtc->gpbr))
> + return PTR_ERR(rtc->rtt);
>  
>   mr = rtt_readl(rtc, MR);
>  
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 7/9] rtc: at91sam9: use clk API instead of relying on AT91_SLOW_CLOCK

2014-09-23 Thread Nicolas Ferre
On 22/09/2014 17:42, Boris BREZILLON :
> The RTT block is using the slow clock which is accessible through the clk
> API.
> Use the clk API to retrieve, enable and get the slow clk rate instead of
> the AT91_SLOW_CLOCK macro (which hardcodes the slow clk rate).
> Doing this allows us to reference the clk thus preventing the CCF from
> disabling it during the "disable unused" phase.
> 
> Signed-off-by: Boris BREZILLON 
> Acked-by: Alexandre Belloni 
Acked-by: Nicolas Ferre 

> ---
>  drivers/rtc/rtc-at91sam9.c | 28 
>  1 file changed, 24 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
> index 902cd01..d20e118 100644
> --- a/drivers/rtc/rtc-at91sam9.c
> +++ b/drivers/rtc/rtc-at91sam9.c
> @@ -23,6 +23,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  /*
>   * This driver uses two configurable hardware resources that live in the
> @@ -61,8 +62,6 @@
>  #define AT91_RTT_ALMS(1 << 0)/* Real-time 
> Alarm Status */
>  #define AT91_RTT_RTTINC  (1 << 1)/* Real-time 
> Timer Increment */
>  
> -#define AT91_SLOW_CLOCK  32768
> -
>  /*
>   * We store ALARM_DISABLED in ALMV to record that no alarm is set.
>   * It's also the reset value for that field.
> @@ -77,6 +76,7 @@ struct sam9_rtc {
>   struct regmap   *gpbr;
>   unsigned intgpbr_offset;
>   int irq;
> + struct clk  *sclk;
>  };
>  
>  #define rtt_readl(rtc, field) \
> @@ -328,6 +328,7 @@ static int at91_rtc_probe(struct platform_device *pdev)
>   struct sam9_rtc *rtc;
>   int ret, irq;
>   u32 mr;
> + unsigned intsclk_rate;
>  
>   irq = platform_get_irq(pdev, 0);
>   if (irq < 0) {
> @@ -385,11 +386,27 @@ static int at91_rtc_probe(struct platform_device *pdev)
>   return -ENOMEM;
>   }
>  
> + rtc->sclk = devm_clk_get(&pdev->dev, NULL);
> + if (IS_ERR(rtc->sclk))
> + return PTR_ERR(rtc->sclk);
> +
> + sclk_rate = clk_get_rate(rtc->sclk);
> + if (!sclk_rate || sclk_rate > AT91_RTT_RTTRST) {
> + dev_err(&pdev->dev, "Invalid slow clock rate");
> + return -EINVAL;
> + }
> +
> + ret = clk_prepare_enable(rtc->sclk);
> + if (ret) {
> + dev_err(&pdev->dev, "Could not enable slow clock");
> + return ret;
> + }
> +
>   mr = rtt_readl(rtc, MR);
>  
>   /* unless RTT is counting at 1 Hz, re-initialize it */
> - if ((mr & AT91_RTT_RTPRES) != AT91_SLOW_CLOCK) {
> - mr = AT91_RTT_RTTRST | (AT91_SLOW_CLOCK & AT91_RTT_RTPRES);
> + if ((mr & AT91_RTT_RTPRES) != sclk_rate) {
> + mr = AT91_RTT_RTTRST | (sclk_rate & AT91_RTT_RTPRES);
>   gpbr_writel(rtc, 0);
>   }
>  
> @@ -434,6 +451,9 @@ static int at91_rtc_remove(struct platform_device *pdev)
>   /* disable all interrupts */
>   rtt_writel(rtc, MR, mr & ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN));
>  
> + if (!IS_ERR(rtc->sclk))
> + clk_disable_unprepare(rtc->sclk);
> +
>   return 0;
>  }
>  
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 9/9] mfd: syscon: add Atmel GPBR DT bindings documention

2014-09-23 Thread Nicolas Ferre
On 22/09/2014 17:42, Boris BREZILLON :
> The GPBR block provides a set of battery-backed registers that can be used
> to save data which need to be kept when the system is powered down and
> VDD-core is maintained by an external battery.
> 
> A typical usage is the RTT block (when used as an RTC) which needs one of
> those registers to save the current time.
> 
> Signed-off-by: Boris BREZILLON 
Acked-by: Nicolas Ferre 

> ---
>  Documentation/devicetree/bindings/mfd/atmel,gpbr.txt | 15 +++
>  1 file changed, 15 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/atmel,gpbr.txt
> 
> diff --git a/Documentation/devicetree/bindings/mfd/atmel,gpbr.txt 
> b/Documentation/devicetree/bindings/mfd/atmel,gpbr.txt
> new file mode 100644
> index 000..a285695
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/atmel,gpbr.txt
> @@ -0,0 +1,15 @@
> +* Device tree bindings for Atmel GPBR (General Purpose Backup Registers)
> +
> +The GPBR are a set of battery-backed registers.
> +
> +Required properties:
> +- compatible:"atmel,at91sam9260-gpbr", "syscon"
> +- reg:   contains offset/length value of the GPBR memory
> + region.
> +
> +Example:
> +
> +gpbr: gpbr@fd50 {
> + compatible = "atmel,at91sam9260-gpbr", "syscon";
> + reg = <0xfd50 0x10>;
> +};
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 6/9] ARM: at91: add clk_lookup entry for RTT devices

2014-09-23 Thread Nicolas Ferre
On 22/09/2014 17:42, Boris BREZILLON :
> First export the clk32k clk.
> Then add clk_lookup entries for RTT devices so that rtc-at91sam9 driver
> can retrieve and manipulate the slow clk.
> 
> Signed-off-by: Boris BREZILLON 
> Acked-by: Alexandre Belloni 

Ok until we remove the !CCF for the sam9's:

Acked-by: Nicolas Ferre 


> ---
>  arch/arm/mach-at91/at91sam9260.c | 2 ++
>  arch/arm/mach-at91/at91sam9261.c | 2 ++
>  arch/arm/mach-at91/at91sam9263.c | 4 
>  arch/arm/mach-at91/at91sam9g45.c | 2 ++
>  arch/arm/mach-at91/at91sam9rl.c  | 2 ++
>  arch/arm/mach-at91/clock.c   | 2 +-
>  arch/arm/mach-at91/clock.h   | 1 +
>  7 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-at91/at91sam9260.c 
> b/arch/arm/mach-at91/at91sam9260.c
> index 3477ba9..a853d4c 100644
> --- a/arch/arm/mach-at91/at91sam9260.c
> +++ b/arch/arm/mach-at91/at91sam9260.c
> @@ -217,6 +217,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>   CLKDEV_CON_DEV_ID("pclk", "fffbc000.ssc", &ssc_clk),
>   CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9260.0", &twi_clk),
>   CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.0", &twi_clk),
> + CLKDEV_CON_DEV_ID(NULL, "rtc-at91sam9.0", &clk32k),
>   /* more usart lookup table for DT entries */
>   CLKDEV_CON_DEV_ID("usart", "f200.serial", &mck),
>   CLKDEV_CON_DEV_ID("usart", "fffb.serial", &usart0_clk),
> @@ -237,6 +238,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>   CLKDEV_CON_DEV_ID("mci_clk", "fffa8000.mmc", &mmc_clk),
>   CLKDEV_CON_DEV_ID("spi_clk", "fffc8000.spi", &spi0_clk),
>   CLKDEV_CON_DEV_ID("spi_clk", "fffcc000.spi", &spi1_clk),
> + CLKDEV_CON_DEV_ID(NULL, "fd20.rtc", &clk32k),
>   /* fake hclk clock */
>   CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
>   CLKDEV_CON_ID("pioA", &pioA_clk),
> diff --git a/arch/arm/mach-at91/at91sam9261.c 
> b/arch/arm/mach-at91/at91sam9261.c
> index fb164a5..3f5a299 100644
> --- a/arch/arm/mach-at91/at91sam9261.c
> +++ b/arch/arm/mach-at91/at91sam9261.c
> @@ -192,6 +192,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>   CLKDEV_CON_ID("pioA", &pioA_clk),
>   CLKDEV_CON_ID("pioB", &pioB_clk),
>   CLKDEV_CON_ID("pioC", &pioC_clk),
> + CLKDEV_CON_DEV_ID(NULL, "rtc-at91sam9.0", &clk32k),
>   /* more lookup table for DT entries */
>   CLKDEV_CON_DEV_ID("usart", "f200.serial", &mck),
>   CLKDEV_CON_DEV_ID("usart", "fffb.serial", &usart0_clk),
> @@ -209,6 +210,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>   CLKDEV_CON_DEV_ID(NULL, "f400.gpio", &pioA_clk),
>   CLKDEV_CON_DEV_ID(NULL, "f600.gpio", &pioB_clk),
>   CLKDEV_CON_DEV_ID(NULL, "f800.gpio", &pioC_clk),
> + CLKDEV_CON_DEV_ID(NULL, "fd20.rtc", &clk32k),
>  };
>  
>  static struct clk_lookup usart_clocks_lookups[] = {
> diff --git a/arch/arm/mach-at91/at91sam9263.c 
> b/arch/arm/mach-at91/at91sam9263.c
> index 810fa5f..bef5b96 100644
> --- a/arch/arm/mach-at91/at91sam9263.c
> +++ b/arch/arm/mach-at91/at91sam9263.c
> @@ -201,6 +201,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
>   CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
>   CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9260.0", &twi_clk),
>   CLKDEV_CON_DEV_ID(NULL, "at91sam9rl-pwm", &pwm_clk),
> + CLKDEV_CON_DEV_ID(NULL, "rtc-at91sam9.0", &clk32k),
> + CLKDEV_CON_DEV_ID(NULL, "rtc-at91sam9.1", &clk32k),
>   /* fake hclk clock */
>   CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
>   CLKDEV_CON_ID("pioA", &pioA_clk),
> @@ -227,6 +229,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
>   CLKDEV_CON_DEV_ID(NULL, "f800.gpio", &pioCDE_clk),
>   CLKDEV_CON_DEV_ID(NULL, "fa00.gpio", &pioCDE_clk),
>   CLKDEV_CON_DEV_ID(NULL, "fffb8000.pwm", &pwm_clk),
> + CLKDEV_CON_DEV_ID(NULL, "fd20.rtc", &clk32k),
> + CLKDEV_CON_DEV_ID(NULL, "fd50.rtc", &clk32k),
>  };
>  
>  static struct clk_lookup usart_clocks_lookups[] = {
> diff --git a/arch/arm/mach-at91/at91sam9g45.c 
> b/arch/arm/mach-at91/at91sam9g45.c
> index 9d45496..69fdfcc 100644
&

Re: [PATCH v6 8/9] rtc: at91sam9: add DT bindings documentation

2014-09-23 Thread Nicolas Ferre
On 22/09/2014 17:42, Boris BREZILLON :
> Signed-off-by: Boris BREZILLON 

Yes, it's good for me:
Acked-by: Nicolas Ferre 

Thanks, bye,

> ---
>  .../devicetree/bindings/rtc/atmel,at91sam9-rtc.txt | 23 
> ++
>  1 file changed, 23 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.txt
> 
> diff --git a/Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.txt 
> b/Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.txt
> new file mode 100644
> index 000..e94e2ee
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/atmel,at91sam9-rtc.txt
> @@ -0,0 +1,23 @@
> +Atmel AT91SAM9260 Real Time Timer
> +
> +Required properties:
> +- compatible: should be: "atmel,at91sam9260-rtt"
> +- reg: should encode the memory region of the RTT controller
> +- interrupts: rtt alarm/event interrupt
> +- clocks: should contain one clock pointing the the slow clk
> +- atmel,rtt-rtc-time-reg: should encode the GPBR register used to store
> + the time base when the RTT is used as an RTC.
> + The first cell should point to the GPBR node and the second one
> + encode the offset within the GPBR block (or in other words, the
> + GPBR register used to store the current time value).
> +
> +
> +Example:
> +
> +rtt@fe00 {
> + compatible = "atmel,at91sam9260-rtt";
> + reg = <0xfd20 0x10>;
> + interrupts = <1 4 7>;
> + clocks = <&clk32k>;
> + atmel,rtt-rtc-time-reg = <&gpbr 0x0>;
> +};
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 5/9] rtc: at91sam9: make use of syscon/regmap to access GPBR registers

2014-09-23 Thread Nicolas Ferre
ode,
> + "atmel,rtt-rtc-time-reg", 1, 0,
> +     &args);
> + if (ret)
> + return ret;
> +
> + rtc->gpbr = syscon_node_to_regmap(args.np);
> + rtc->gpbr_offset = args.args[0];
> + }
> +
> + if (IS_ERR(rtc->gpbr)) {
> + dev_err(&pdev->dev, "failed to retrieve gpbr regmap, 
> aborting.\n");
> + return -ENOMEM;
> + }
>  
>   mr = rtt_readl(rtc, MR);
>  
> 

Okay: look pretty good: thanks for having handling this Boris!


Acked-by: Nicolas Ferre 

Bye,

-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v7 06/10] rtc: at91sam9: rework the Kconfig description

2014-09-23 Thread Nicolas Ferre
On 23/09/2014 11:38, Boris BREZILLON :
> Remove all references to AT91CAP9 SoC which has been removed.
> Rework the help message to remove any specific references to AT91SAM9 SoCs.
> 
> Signed-off-by: Boris BREZILLON 
> ---
>  drivers/rtc/Kconfig | 17 +
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index 7d76da8..455f2c3 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -1079,17 +1079,18 @@ config RTC_DRV_AT91RM9200
> this is powered by the backup power supply.
>  
>  config RTC_DRV_AT91SAM9
> - tristate "AT91SAM9x/AT91CAP9 RTT as RTC"
> + tristate "AT91SAM9 RTT as RTC"
>   depends on ARCH_AT91 && !(ARCH_AT91RM9200 || ARCH_AT91X40)
>   select MFD_SYSCON
>   help
> -   RTC driver for the Atmel AT91SAM9x and AT91CAP9 internal RTT
> -   (Real Time Timer). These timers are powered by the backup power
> -   supply (such as a small coin cell battery), but do not need to
> -   be used as RTCs.
> -
> -   (On AT91SAM9rl and AT91SAM9G45 chips you probably want to use the
> -   dedicated RTC module and leave the RTT available for other uses.)
> +   Some AT91SAM9 SoCs provide an RTT (Real Time Timer) block which
> +   can be used as an RTC thanks to the backup power supply (e.g. a
> +   small coin cell battery) which keeps this block and the GPBR
> +   (General Purpose Backup Registers) block powered when the device
> +   is shutdown.
> +   Some AT91SAM9 SoCs provide a real RTC block, on those ones you'd
> +   probably want to use the real RTC block instead of the RTT as an
> +   RTT driver.

You mean:
"instead of the RTT as an RTC"

With that, good description: thanks!

Acked-by: Nicolas Ferre 

So, now we can think of what to do with the series:

- Johan, do you want to "Ack" it?
- may I take it through the arm-soc git tree (likely for the 3.19 dev.
phase).

Your thoughts?

Bye,

>  
>  config RTC_DRV_AT91SAM9_RTT
>   int
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] at91: drivers for 3.18 #2 (bis)

2014-09-24 Thread Nicolas Ferre
On 24/09/2014 06:59, Olof Johansson :
> On Mon, Sep 15, 2014 at 06:12:43PM +0200, Nicolas Ferre wrote:
>> Arnd, Olof, Kevin,
>>
>> I re-send this pull-request with the work done by Maxime to take Arnd's
>> comments into annount: removal of the early_platform devices, and by keeping
>> the old mechanism with a function exported by the PIT timer and called by the
>> board files.
>>
>> Here is the old message that I sent you: just as a reference.
>> "
>> This pull-request is focused on the work that Maxime did for migrating our
>> timer (PIT) to the clocksource sub-system. A big cleanup happened which 
>> allows
>> us to be even closer to the point when we have only the bare minimum in our
>> formerly crowded mach-at91 directory.
>> "
>>
>> This pull-request goes on top of what is already in your at91/drivers branch.
>>
>> Thanks, best regards,
>>
>> The following changes since commit 405a72c5e78b5c560c8b2711d4000fa5eb063e1b:
>>
>>   power: reset: at91-poweroff: fix wakeup status register index (2014-09-01 
>> 18:40:44 +0200)
>>
>> are available in the git repository at:
>>
>>   git://github.com/at91linux/linux-at91.git tags/at91-drivers2
>>
>> for you to fetch changes up to b052ff30cd450c91a32e8e928979bca021462996:
>>
>>   ARM: at91: PIT: Move the driver to drivers/clocksource (2014-09-15 
>> 17:55:48 +0200)
>>
>> 
>> Second drivers series for AT91/3.18:
>> - move of the PIT (basic timer) from mach-at91 to its proper location:
>>   drivers/clocksource
>> - big cleanup of this driver along the way
> 
> Thanks, merged.

Thanks Olof, but there is a merge issue in the merge commit
58c19114886d5352c019979b84f5375970d81f05 (Merge branch 'next/drivers'
into for-next). In fact the sama5_dt_timer_init() and
ksz9021rn_phy_fixup() functions must be completely removed in this
arch/arm/mach-at91/board-dt-sama5.c file.

This is causing the errors seen in your and Kevin's buildbots:
http://images.armcloud.us/kernel-ci//arm-soc/v3.17-rc4-608-g58bf4da/arm-sama5_defconfig/build.log
and
http://arm-soc.lixom.net/buildlogs/arm-soc/v3.17-rc4-608-g58bf4da/buildall.arm.sama5_defconfig.log.failed

I pushed a branch for conflict resolutions here:
git://github.com/at91linux/linux-at91.git at91-3.18-resolved2
https://github.com/at91linux/linux-at91/commits/at91-3.18-resolved2

Bye,
-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC PATCH] ARM: at91: remove no-MMU at91x40 support

2014-09-24 Thread Nicolas Ferre
As there is currently no-one to take care of this old !MMU target and as its
support in recent kernels is a bit rotten, remove this at91x40 support and the
board file associated with it (at91eb01).
There are modern ARM !MMU in Mainline now so this target is not interesting for
building tests anymore. It would be better to start from these modern ARM !MMU
platforms to reintroduce at91x40 support if needed.

Signed-off-by: Nicolas Ferre 
---
 arch/arm/configs/at91x40_defconfig   | 48 --
 arch/arm/mach-at91/Kconfig   | 25 ++--
 arch/arm/mach-at91/Kconfig.non_dt| 17 -
 arch/arm/mach-at91/Makefile  |  4 --
 arch/arm/mach-at91/at91x40.c | 93 
 arch/arm/mach-at91/at91x40_time.c| 85 -
 arch/arm/mach-at91/board-eb01.c  | 52 
 arch/arm/mach-at91/generic.h |  3 -
 arch/arm/mach-at91/include/mach/at91_dbgu.h  |  3 -
 arch/arm/mach-at91/include/mach/at91x40.h| 60 --
 arch/arm/mach-at91/include/mach/cpu.h|  1 -
 arch/arm/mach-at91/include/mach/hardware.h   |  4 --
 arch/arm/mach-at91/include/mach/uncompress.h |  7 ---
 arch/arm/mach-at91/setup.c   |  2 +-
 drivers/rtc/Kconfig  |  2 +-
 15 files changed, 7 insertions(+), 399 deletions(-)
 delete mode 100644 arch/arm/configs/at91x40_defconfig
 delete mode 100644 arch/arm/mach-at91/at91x40.c
 delete mode 100644 arch/arm/mach-at91/at91x40_time.c
 delete mode 100644 arch/arm/mach-at91/board-eb01.c
 delete mode 100644 arch/arm/mach-at91/include/mach/at91x40.h

diff --git a/arch/arm/configs/at91x40_defconfig 
b/arch/arm/configs/at91x40_defconfig
deleted file mode 100644
index c55e9212fcbb..
--- a/arch/arm/configs/at91x40_defconfig
+++ /dev/null
@@ -1,48 +0,0 @@
-CONFIG_EXPERIMENTAL=y
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_EMBEDDED=y
-# CONFIG_HOTPLUG is not set
-# CONFIG_ELF_CORE is not set
-# CONFIG_FUTEX is not set
-# CONFIG_TIMERFD is not set
-# CONFIG_VM_EVENT_COUNTERS is not set
-# CONFIG_COMPAT_BRK is not set
-CONFIG_SLAB=y
-# CONFIG_LBDAF is not set
-# CONFIG_BLK_DEV_BSG is not set
-# CONFIG_IOSCHED_DEADLINE is not set
-# CONFIG_IOSCHED_CFQ is not set
-# CONFIG_MMU is not set
-CONFIG_ARCH_AT91=y
-CONFIG_ARCH_AT91X40=y
-CONFIG_MACH_AT91EB01=y
-CONFIG_AT91_EARLY_USART0=y
-CONFIG_CPU_ARM7TDMI=y
-CONFIG_SET_MEM_PARAM=y
-CONFIG_DRAM_BASE=0x0100
-CONFIG_DRAM_SIZE=0x0040
-CONFIG_FLASH_MEM_BASE=0x0140
-CONFIG_PROCESSOR_ID=0x1440
-CONFIG_ZBOOT_ROM_TEXT=0x0
-CONFIG_ZBOOT_ROM_BSS=0x0
-CONFIG_BINFMT_FLAT=y
-# CONFIG_SUSPEND is not set
-# CONFIG_FW_LOADER is not set
-CONFIG_MTD=y
-CONFIG_MTD_PARTITIONS=y
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLOCK=y
-CONFIG_MTD_RAM=y
-CONFIG_MTD_ROM=y
-CONFIG_BLK_DEV_RAM=y
-# CONFIG_INPUT is not set
-# CONFIG_SERIO is not set
-# CONFIG_VT is not set
-# CONFIG_DEVKMEM is not set
-# CONFIG_HW_RANDOM is not set
-# CONFIG_HWMON is not set
-# CONFIG_USB_SUPPORT is not set
-CONFIG_EXT2_FS=y
-# CONFIG_DNOTIFY is not set
-CONFIG_ROMFS_FS=y
-# CONFIG_ENABLE_MUST_CHECK is not set
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 807b22dadcb6..f3bd8abd25c0 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -18,26 +18,22 @@ config HAVE_AT91_DBGU2
 config AT91_USE_OLD_CLK
bool
 
-config AT91_PMC_UNIT
-   bool
-   default !ARCH_AT91X40
-
 config COMMON_CLK_AT91
bool
-   default AT91_PMC_UNIT && USE_OF && !AT91_USE_OLD_CLK
+   default USE_OF && !AT91_USE_OLD_CLK
select COMMON_CLK
 
 config OLD_CLK_AT91
bool
-   default AT91_PMC_UNIT && AT91_USE_OLD_CLK
+   default AT91_USE_OLD_CLK
 
 config AT91_SAM9_ALT_RESET
bool
-   default !ARCH_AT91X40
+   default y
 
 config AT91_SAM9G45_RESET
bool
-   default !ARCH_AT91X40
+   default y
 
 config AT91_SAM9_TIME
bool
@@ -71,17 +67,6 @@ choice
 
prompt "Core type"
 
-config ARCH_AT91X40
-   bool "ARM7 AT91X40"
-   depends on !MMU
-   select CPU_ARM7TDMI
-   select ARCH_USES_GETTIMEOFFSET
-   select MULTI_IRQ_HANDLER
-   select SPARSE_IRQ
-
-   help
- Select this if you are using one of Atmel's AT91X40 SoC.
-
 config SOC_SAM_V4_V5
bool "ARM9 AT91SAM9/AT91RM9200"
help
@@ -207,7 +192,7 @@ config SOC_AT91SAM9N12
 endif # SOC_SAM_V4_V5
 
 
-if SOC_SAM_V4_V5 || ARCH_AT91X40
+if SOC_SAM_V4_V5
 source arch/arm/mach-at91/Kconfig.non_dt
 endif
 
diff --git a/arch/arm/mach-at91/Kconfig.non_dt 
b/arch/arm/mach-at91/Kconfig.non_dt
index aa31e556e2e5..2c62a078c1d9 100644
--- a/arch/arm/mach-at91/Kconfig.non_dt
+++ b/arch/arm/mach-at91/Kconfig.non_dt
@@ -5,7 +5,6 @@ config HAVE_AT91_DATAFLASH_CARD
 
 choice
prompt "Atmel AT91 Processor Devices for non DT boards"
-   depends on

Re: [RFC PATCH] ARM: at91: remove no-MMU at91x40 support

2014-09-24 Thread Nicolas Ferre
On 24/09/2014 16:47, Arnd Bergmann :
> On Wednesday 24 September 2014 16:18:01 Nicolas Ferre wrote:
>> As there is currently no-one to take care of this old !MMU target and as its
>> support in recent kernels is a bit rotten, remove this at91x40 support and 
>> the
>> board file associated with it (at91eb01).
>> There are modern ARM !MMU in Mainline now so this target is not interesting 
>> for
>> building tests anymore. It would be better to start from these modern ARM 
>> !MMU
>> platforms to reintroduce at91x40 support if needed.
>>
>> Signed-off-by: Nicolas Ferre 
> 
> Acked-by: Arnd Bergmann 
> 
>> diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
>> index 807b22dadcb6..f3bd8abd25c0 100644
>> --- a/arch/arm/mach-at91/Kconfig
>> +++ b/arch/arm/mach-at91/Kconfig
>> @@ -18,26 +18,22 @@ config HAVE_AT91_DBGU2
>>  config AT91_USE_OLD_CLK
>>  bool
>>  
>> -config AT91_PMC_UNIT
>> -bool
>> -default !ARCH_AT91X40
>> -
>>  config COMMON_CLK_AT91
>>  bool
>> -default AT91_PMC_UNIT && USE_OF && !AT91_USE_OLD_CLK
>> +default USE_OF && !AT91_USE_OLD_CLK
>>  select COMMON_CLK
>>  
>>  config OLD_CLK_AT91
>>  bool
>> -default AT91_PMC_UNIT && AT91_USE_OLD_CLK
>> +default AT91_USE_OLD_CLK
>>  
>>  config AT91_SAM9_ALT_RESET
>>  bool
>> -default !ARCH_AT91X40
>> +default y
>>  
>>  config AT91_SAM9G45_RESET
>>  bool
>> -default !ARCH_AT91X40
>> +default y
>>  
>>  config AT91_SAM9_TIME
>>  bool
> 
> I think these can be simplified further: AT91_SAM9G45_RESET and
> AT91_SAM9_ALT_RESET can just go away and the files put into
> obj-y.

Yes, I had the same idea before realizing that these two directives will
move away in a patch already sent for 3.18. So, as this material is
probably 3.19-ish, I kept them as they are and keep in mind to remove
them when I merge them with 3.18-rc1...

> OLD_CLK_AT91 is the same as AT91_USE_OLD_CLK, so you could
> just use that instead. I suspect the 'USE_OF' dependency for
> COMMON_CLK_AT91 can also go away, since all platforms are
> either board file based and select AT91_USE_OLD_CLK, or they
> are DT based and don't.

Here also, I didn't want to touch more because we need to remove the
arch/arm/mach-at91/Kconfig.non_dt file very soon (3.19) and I don't want
to change this file (or all the SoC files) before the chunks related to
these directives simply go away.

Tell me if it makes sense.

Bye,
-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Revert "net/macb: add pinctrl consumer support"

2014-09-24 Thread Nicolas Ferre
On 23/09/2014 01:49, Soren Brinkmann :
> This reverts commit 8ef29f8aae524bd51298fb10ac6a5ce6c4c5a3d8.
> The driver core already calls pinctrl_get() and claims the default
> state. There is no need to replicate this in the driver.
> ---
> Hi,
> 
> I might be mistaken, but I think the driver core does already take care of
> calling into the pinctrl framework and the driver does not need to do it on 
> its
> own (drivers/base/dd.c:really_probe() calls 'pinctrl_bind_pins() which takes
> care of the pinctrl setup).

True, thanks for your patch:

Acked-by: Nicolas Ferre 


>  drivers/net/ethernet/cadence/macb.c | 11 ---
>  1 file changed, 11 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb.c 
> b/drivers/net/ethernet/cadence/macb.c
> index ca5d7798b265..e1e02fba4fcc 100644
> --- a/drivers/net/ethernet/cadence/macb.c
> +++ b/drivers/net/ethernet/cadence/macb.c
> @@ -30,7 +30,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  
>  #include "macb.h"
>  
> @@ -2071,7 +2070,6 @@ static int __init macb_probe(struct platform_device 
> *pdev)
>   struct phy_device *phydev;
>   u32 config;
>   int err = -ENXIO;
> - struct pinctrl *pinctrl;
>   const char *mac;
>  
>   regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -2080,15 +2078,6 @@ static int __init macb_probe(struct platform_device 
> *pdev)
>   goto err_out;
>   }
>  
> - pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
> - if (IS_ERR(pinctrl)) {
> - err = PTR_ERR(pinctrl);
> - if (err == -EPROBE_DEFER)
> - goto err_out;
> -
> -     dev_warn(&pdev->dev, "No pinctrl provided\n");
> - }
> -
>   err = -ENOMEM;
>   dev = alloc_etherdev(sizeof(*bp));
>   if (!dev)
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RESEND PATCH] misc: atmel-ssc: prepare clock only when request

2014-09-24 Thread Nicolas Ferre
On 24/09/2014 11:33, Bo Shen :
> Prepare SSC clock only when request SSC channel, the clock will be
> enabled when initialize the SSC.
> 
> Signed-off-by: Bo Shen 

okay: it is the driver that uses the ssc that would enable the clock as
it is done in sound/soc/atmel/atmel_ssc_dai.c

Acked-by: Nicolas Ferre 

Bye,

> ---
> Send this patch to driver/misc maintainer as Mark Brown suggested.
> 
>  drivers/misc/atmel-ssc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
> index 60843a2..f9807a7 100644
> --- a/drivers/misc/atmel-ssc.c
> +++ b/drivers/misc/atmel-ssc.c
> @@ -57,7 +57,7 @@ struct ssc_device *ssc_request(unsigned int ssc_num)
>   ssc->user++;
>   spin_unlock(&user_lock);
>  
> - clk_prepare_enable(ssc->clk);
> + clk_prepare(ssc->clk);
>  
>   return ssc;
>  }
> @@ -77,7 +77,7 @@ void ssc_free(struct ssc_device *ssc)
>   spin_unlock(&user_lock);
>  
>   if (disable_clk)
> - clk_disable_unprepare(ssc->clk);
> + clk_unprepare(ssc->clk);
>  }
>  EXPORT_SYMBOL(ssc_free);
>  
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ARM: at91: enable new AIC driver even if the old one is selected

2014-09-24 Thread Nicolas Ferre
On 09/09/2014 11:14, Boris BREZILLON :
> The new AIC driver is currently only selected when only DT board support
> is enabled (and not when both DT and non-DT boards are supported), thus,
> when booting a "DT + non-DT" kernel with a dtb, the irqchip is never
> initialized/registered which then triggers a panic.
> 
> Signed-off-by: Boris BREZILLON 

I'm not taking this right now. The Kconfig file is in flux. I'll try to
queue it during the 3.18-rc phase.

Bye,

> ---
>  arch/arm/mach-at91/Kconfig | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
> index 7df2c9b..cd7c0cb 100644
> --- a/arch/arm/mach-at91/Kconfig
> +++ b/arch/arm/mach-at91/Kconfig
> @@ -51,7 +51,7 @@ config HAVE_AT91_SMD
>  config SOC_AT91SAM9
>   bool
>   select AT91_SAM9_TIME
> - select ATMEL_AIC_IRQ if !OLD_IRQ_AT91
> + select ATMEL_AIC_IRQ
>   select CPU_ARM926T
>   select GENERIC_CLOCKEVENTS
>  
> @@ -111,7 +111,7 @@ endif
>  if SOC_SAM_V4_V5
>  config SOC_AT91RM9200
>   bool "AT91RM9200"
> - select ATMEL_AIC_IRQ if !OLD_IRQ_AT91
> + select ATMEL_AIC_IRQ
>   select CPU_ARM920T
>   select GENERIC_CLOCKEVENTS
>   select HAVE_AT91_DBGU0
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] at91: fixes-non-critical for 3.18 #1

2014-09-24 Thread Nicolas Ferre
Arnd, Olof, Kevin,

If you can still pull thing before 3.18-rc1, here are some non-critical fixes.
Otherwise, they certainly can be applied during 3.18-rc phase.

Thanks, best regards,

The following changes since commit 7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9:

  Linux 3.17-rc1 (2014-08-16 10:40:26 -0600)

are available in the git repository at:

  git://github.com/at91linux/linux-at91.git tags/at91-fixes-non-critical

for you to fetch changes up to cfa1950e6c6b72251e80adc736af3c3d2907ab0e:

  ARM: at91/PMC: don't forget to write PMC_PCDR register to disable clocks 
(2014-09-24 18:00:42 +0200)


Fixes non critical for AT91:
- mmc pinmux for at91sam9263 was missing
- little fix of the old clock implementation


Andreas Henriksson (1):
  ARM: at91: fix at91sam9263ek DT mmc pinmuxing settings

Ludovic Desroches (1):
  ARM: at91/PMC: don't forget to write PMC_PCDR register to disable clocks

 arch/arm/boot/dts/at91sam9263.dtsi | 2 ++
 arch/arm/mach-at91/clock.c | 1 +
 2 files changed, 3 insertions(+)

-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] at91: soc for 3.18 #2

2014-09-26 Thread Nicolas Ferre
On 26/09/2014 12:50, Arnd Bergmann :
> On Monday 22 September 2014, Nicolas Ferre wrote:
> 
>> Nicolas Ferre (4):
>>   ARM: at91: introduce basic SAMA5D4 support
>>   ARM: at91: SAMA5D4 SoC detection code and low level routines
> 
> This resulted in build failures both in at91x40_defconfig and some
> randconfigs with MMU disabled. I've applied the patch below on top
> to fix it.

Ok, I see: sorry for the inconvenience.
What about taking the patch that I sent about removing completely the
at91x40 as it is "Acked" by everybody now? The would prevent from adding
these unneeded values.

> I'm not exactly happy about the soc detection code anyway after I
> had to look at that. Why do you even hardcode the physical register
> location rather than getting it from DT?
>
> Also, why do you care about which SoC version you have for the
> modern SAMA5 chips? All I see is a sama5d4_map_io() callback
> that maps a lot of completely unused registers along with
> the uart that you normally get from the implicit debug_ll_io_init,
> and the SRAM that should probably be turned into a normal driver.

Yes, as said by Alexandre, we are aware of the flaws of AT91 SoC
initialization, but last time I tried, our code was called too early.
Now with the work from Maxime with the timer (in 3.18) it might be
possible to reorder all this.
But please, I would really like to remove all !DT *and* !CCF material
before starting this work, otherwise we will again have a double path
for sam9's and I'd like to avoid this.

Your thoughts?

Bye,

> 8<---
>>From 45aeea29c360551519edd8e041b36d8a4d5f6a23 Mon Sep 17 00:00:00 2001
> From: Arnd Bergmann 
> Date: Fri, 26 Sep 2014 12:27:00 +0200
> Subject: [PATCH] ARM: at91: fix nommu build regression
> 
> The newly introduced support for SAMA5D4 added access to the
> 'AT91_ALT_BASE_SYS' register area, but failed to define the
> symbols in the case when CONFIG_MMU is disabled.
> 
> We really should not hardwire addresses like this any more,
> but as a small fixup, this patch just adds the missing
> definitions for the nommu case, which gets at91x40_defconfig
> and any configuration of sam9 and sama5 with MMU disabled
> back to work.
> 
> Signed-off-by: Arnd Bergmann 
> Fixes: 726d32bf79ef4 ("ARM: at91: SAMA5D4 SoC detection code and low ...")
> 
> diff --git a/arch/arm/mach-at91/include/mach/hardware.h 
> b/arch/arm/mach-at91/include/mach/hardware.h
> index d84776f6b8ac..c13797352688 100644
> --- a/arch/arm/mach-at91/include/mach/hardware.h
> +++ b/arch/arm/mach-at91/include/mach/hardware.h
> @@ -51,11 +51,12 @@
>   */
>  #define AT91_BASE_SYS0xc000
>  
> +#endif
> +
>  /*
>   * On sama5d4 there is no system controller, we map some needed peripherals
>   */
>  #define AT91_ALT_BASE_SYS0xfc069000
> -#endif
>  
>  /*
>   * On all at91 have the Advanced Interrupt Controller starts at address
> @@ -90,6 +91,9 @@
>   */
>  #define AT91_IO_PHYS_BASEAT91_BASE_SYS
>  #define AT91_IO_VIRT_BASEIOMEM(AT91_IO_PHYS_BASE)
> +
> +#define AT91_ALT_IO_PHYS_BASEAT91_ALT_BASE_SYS
> +#define AT91_ALT_IO_VIRT_BASEIOMEM(AT91_ALT_BASE_SYS)
>  #endif
>  
>  #define AT91_IO_SIZE (0x - AT91_IO_PHYS_BASE + 1)
> 
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 0/8] rtc: at91sam9: add DT support

2014-09-11 Thread Nicolas Ferre
On 11/09/2014 12:06, Boris BREZILLON :
> On Thu, 11 Sep 2014 11:39:42 +0200
> Johan Hovold  wrote:
> 
>> On Thu, Sep 11, 2014 at 10:55:59AM +0200, Boris BREZILLON wrote:
>>
>>> Johan, let me know if this version addresses part of your concerns.
>>
>> Looks good to me. I just have a few minor comments on two of the patches.
>>
>>> I'm open to any suggestion/rework to address other previously discussed
>>> issues, as long as it does not end up in a dead-end (like the discussion
>>> you had last year):
>>>  - the fact that the RTT block could be used for something that is not
>>>an RTC
>>>  - the fact that referencing the GPBR node and defining a GPBR register
>>>number to store RTC time info could be considered as an HW config and
>>>not an HW description and thus should not be described in the DT
>>
>> No doubt.
> 
> Okay then. Any suggestion to do otherwise ?
> Alexandre suggested to pass the GPBR register number through a module
> parameter, and retrieve the GPBR syscon by searching for a gpbr node
> (or atmel,at91sam9260-gpbr compatible node) in the device tree.
> 
> I'm not a big fan of this solution, as it implies passing driver
> specific config to the global cmdline (and we'll have to handle the
> 9263 case where 2 RTT blocks are availables).

Nope, I don't like messing with the cmdline for something like that.

atmel,rtt-rtc-time-reg = <&gpbr 0x0>;
is perfectly fine for me.

Bye,
-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/7] irqchip: atmel-aic5: Add sama5d4 support

2014-09-11 Thread Nicolas Ferre
On 11/09/2014 17:54, Alexandre Belloni :
> Add sama5d4 support to irq-atmel-aic5.
> 
> Signed-off-by: Alexandre Belloni 
> ---
> Cc: Jason Cooper 

Supposed to be before the "---" ;-)

>  drivers/irqchip/irq-atmel-aic5.c | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/irqchip/irq-atmel-aic5.c 
> b/drivers/irqchip/irq-atmel-aic5.c
> index dc7d98607a89..a11aae8fb006 100644
> --- a/drivers/irqchip/irq-atmel-aic5.c
> +++ b/drivers/irqchip/irq-atmel-aic5.c
> @@ -295,6 +295,7 @@ static void __init sama5d3_aic_irq_fixup(struct 
> device_node *root)
>  
>  static const struct of_device_id __initdata aic5_irq_fixups[] = {
>   { .compatible = "atmel,sama5d3", .data = sama5d3_aic_irq_fixup },
> + { .compatible = "atmel,sama5d4", .data = sama5d3_aic_irq_fixup },
>   { /* sentinel */ },
>  };
>  
> @@ -349,3 +350,12 @@ static int __init sama5d3_aic5_of_init(struct 
> device_node *node,
>   return aic5_of_init(node, parent, NR_SAMA5D3_IRQS);
>  }
>  IRQCHIP_DECLARE(sama5d3_aic5, "atmel,sama5d3-aic", sama5d3_aic5_of_init);
> +
> +#define NR_SAMA5D4_IRQS  68
> +
> +static int __init sama5d4_aic5_of_init(struct device_node *node,
> +struct device_node *parent)
> +{
> + return aic5_of_init(node, parent, NR_SAMA5D4_IRQS);
> +}
> +IRQCHIP_DECLARE(sama5d4_aic5, "atmel,sama5d4-aic", sama5d4_aic5_of_init);
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 7/7] ARM: at91: add sama5d4 support to sama5_defconfig

2014-09-11 Thread Nicolas Ferre
On 11/09/2014 17:54, Alexandre Belloni :
> Add sama5d4 to sama5_defconfig to build kernel booting on both sama5d3 and
> samad4.
> 
> Note that earlyprintk can only be working for one or the other.
> 
> Signed-off-by: Alexandre Belloni 
> ---
>  arch/arm/configs/sama5_defconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/configs/sama5_defconfig 
> b/arch/arm/configs/sama5_defconfig
> index 96c15b775d57..a6c2409c4e14 100644
> --- a/arch/arm/configs/sama5_defconfig
> +++ b/arch/arm/configs/sama5_defconfig
> @@ -19,6 +19,7 @@ CONFIG_MODULE_FORCE_UNLOAD=y
>  CONFIG_ARCH_AT91=y
>  CONFIG_SOC_SAM_V7=y
>  CONFIG_SOC_SAMA5D3=y
> +CONFIG_SOC_SAMA5D4=y
>  CONFIG_MACH_SAMA5_DT=y
>  CONFIG_AEABI=y
>  CONFIG_UACCESS_WITH_MEMCPY=y
> @@ -66,7 +67,6 @@ CONFIG_MTD=y
>  CONFIG_MTD_CMDLINE_PARTS=y
>  CONFIG_MTD_BLOCK=y
>  CONFIG_MTD_CFI=y
> -CONFIG_MTD_M25P80=y

Well I would keep this one...

>  CONFIG_MTD_NAND=y
>  CONFIG_MTD_NAND_ATMEL=y
>  CONFIG_MTD_SPI_NOR=y
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pinctrl: at91: disable Pull-Down or Pull-Up property before enabling Pull-Up or Pull-Down.

2014-09-11 Thread Nicolas Ferre
On 11/09/2014 16:40, Alexandre Belloni :
> From: Wenyou Yang 
> 
> Because the pin's Pull-Up and Pull-Down property is mutually exclusive.
> 
> Signed-off-by: Wenyou Yang 

Yes, indeed:

Acked-by: Nicolas Ferre 

> ---
>  drivers/pinctrl/pinctrl-at91.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
> index a3d8902438c7..ee9c0b7aad14 100644
> --- a/drivers/pinctrl/pinctrl-at91.c
> +++ b/drivers/pinctrl/pinctrl-at91.c
> @@ -371,6 +371,9 @@ static unsigned at91_mux_get_pullup(void __iomem *pio, 
> unsigned pin)
>  
>  static void at91_mux_set_pullup(void __iomem *pio, unsigned mask, bool on)
>  {
> + if (on)
> + writel_relaxed(mask, pio + PIO_PPDDR);
> +
>   writel_relaxed(mask, pio + (on ? PIO_PUER : PIO_PUDR));
>  }
>  
> @@ -499,6 +502,9 @@ static bool at91_mux_pio3_get_pulldown(void __iomem *pio, 
> unsigned pin)
>  
>  static void at91_mux_pio3_set_pulldown(void __iomem *pio, unsigned mask, 
> bool is_on)
>  {
> + if (is_on)
> + __raw_writel(mask, pio + PIO_PUDR);
> +
>   __raw_writel(mask, pio + (is_on ? PIO_PPDER : PIO_PPDDR));
>  }
>  
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


<    5   6   7   8   9   10   11   12   13   14   >