[PATCH v3 0/4] mmc: omap_hsmmc: SDIO irq

2013-10-05 Thread Andreas Fenkart
Changes:
- split the subject patch into normal handling and
  workaround for am335x
- rebase

Andreas Fenkart (3):
  mmc: omap_hsmmc: Enable SDIO IRQ.
  mmc: omap_hsmmc: Remux pins to support SDIO interrupt on AM335x
  mmc: omap_hsmmc: debugfs for SDIO IRQ and GPIO remux

Tony Lindgren (1):
  mmc: omap_hsmmc: Fix context save and restore for DT

 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |   42 +++
 drivers/mmc/host/omap_hsmmc.c  |  363 +---
 include/linux/platform_data/mmc-omap.h |4 +
 3 files changed, 357 insertions(+), 52 deletions(-)

-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 1/4] mmc: omap_hsmmc: Fix context save and restore for DT

2013-10-05 Thread Andreas Fenkart
From: Tony Lindgren t...@atomide.com

We want to get rid of the omap specific platform init code
callbacks as they don't play nice with device tree.

Let's convert the context loss check to be based on a
register state detection instead.

Cc: Andreas Fenkart afenk...@gmail.com
Cc: Balaji T K balaj...@ti.com
Signed-off-by: Tony Lindgren t...@atomide.com

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 260cdb4..94d6dc8 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -198,19 +198,19 @@ struct omap_hsmmc_host {
unsigned char   bus_mode;
unsigned char   power_mode;
int suspended;
+   u32 hctl;
+   u32 capa;
int irq;
int use_dma, dma_ch;
struct dma_chan *tx_chan;
struct dma_chan *rx_chan;
int slot_id;
int response_busy;
-   int context_loss;
int protect_card;
int reqs_blocked;
int use_reg;
int req_in_progress;
struct omap_hsmmc_next  next_data;
-
struct  omap_mmc_platform_data  *pdata;
 };
 
@@ -624,25 +624,16 @@ static void omap_hsmmc_set_bus_mode(struct 
omap_hsmmc_host *host)
 static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)
 {
struct mmc_ios *ios = host-mmc-ios;
-   struct omap_mmc_platform_data *pdata = host-pdata;
-   int context_loss = 0;
u32 hctl, capa;
unsigned long timeout;
 
-   if (pdata-get_context_loss_count) {
-   context_loss = pdata-get_context_loss_count(host-dev);
-   if (context_loss  0)
-   return 1;
-   }
-
-   dev_dbg(mmc_dev(host-mmc), context was %slost\n,
-   context_loss == host-context_loss ? not  : );
-   if (host-context_loss == context_loss)
-   return 1;
-
if (!OMAP_HSMMC_READ(host-base, SYSSTATUS)  RESETDONE)
return 1;
 
+   if (host-hctl == OMAP_HSMMC_READ(host-base, HCTL) 
+   host-capa == OMAP_HSMMC_READ(host-base, CAPA))
+   return 0;
+
if (host-pdata-controller_flags  OMAP_HSMMC_SUPPORTS_DUAL_VOLT) {
if (host-power_mode != MMC_POWER_OFF 
(1  ios-vdd) = MMC_VDD_23_24)
@@ -682,8 +673,6 @@ static int omap_hsmmc_context_restore(struct 
omap_hsmmc_host *host)
omap_hsmmc_set_bus_mode(host);
 
 out:
-   host-context_loss = context_loss;
-
dev_dbg(mmc_dev(host-mmc), context is restored\n);
return 0;
 }
@@ -693,15 +682,8 @@ out:
  */
 static void omap_hsmmc_context_save(struct omap_hsmmc_host *host)
 {
-   struct omap_mmc_platform_data *pdata = host-pdata;
-   int context_loss;
-
-   if (pdata-get_context_loss_count) {
-   context_loss = pdata-get_context_loss_count(host-dev);
-   if (context_loss  0)
-   return;
-   host-context_loss = context_loss;
-   }
+   host-hctl = OMAP_HSMMC_READ(host-base, HCTL);
+   host-capa = OMAP_HSMMC_READ(host-base, CAPA);
 }
 
 #else
@@ -1662,13 +1644,6 @@ static int omap_hsmmc_regs_show(struct seq_file *s, void 
*data)
 {
struct mmc_host *mmc = s-private;
struct omap_hsmmc_host *host = mmc_priv(mmc);
-   int context_loss = 0;
-
-   if (host-pdata-get_context_loss_count)
-   context_loss = host-pdata-get_context_loss_count(host-dev);
-
-   seq_printf(s, mmc%d:\n ctx_loss:\t%d:%d\n\nregs:\n,
-   mmc-index, host-context_loss, context_loss);
 
if (host-suspended) {
seq_printf(s, host suspended, can't read registers\n);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 4/4] mmc: omap_hsmmc: debugfs entries for SDIO IRQ detection and GPIO remuxing.

2013-10-05 Thread Andreas Fenkart
Update the debugfs related code for the SDIO IRQ support.
Note that PSTATE shows current state of data lines, incl.
SDIO IRQ pending

Signed-off-by: Andreas Fenkart afenk...@gmail.com

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index a8894ee..f7fe06f 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -81,6 +81,7 @@ static void apply_clk_hack(struct device *dev)
 #define OMAP_HSMMC_RSP54   0x0118
 #define OMAP_HSMMC_RSP76   0x011C
 #define OMAP_HSMMC_DATA0x0120
+#define OMAP_HSMMC_PSTATE  0x0124
 #define OMAP_HSMMC_HCTL0x0128
 #define OMAP_HSMMC_SYSCTL  0x012C
 #define OMAP_HSMMC_STAT0x0130
@@ -1812,6 +1813,22 @@ static int omap_hsmmc_regs_show(struct seq_file *s, void 
*data)
 {
struct mmc_host *mmc = s-private;
struct omap_hsmmc_host *host = mmc_priv(mmc);
+   unsigned long flags;
+
+   spin_lock_irqsave(host-irq_lock, flags);
+   seq_puts(s, \n);
+   seq_printf(s, sdio irq\t%s\n, ((host-flags  HSMMC_SDIO_IRQ_ENABLED)
+? enabled : disabled));
+   if (host-flags  HSMMC_SWAKEUP_QUIRK) {
+   seq_printf(s, pinmux config\t%s\n, ((host-flags 
+  HSMMC_RUNTIME_SUSPENDED)
+ ?  gpio : sdio));
+   if (host-flags  HSMMC_RUNTIME_SUSPENDED)
+   seq_printf(s, sdio irq pin\t%s\n,
+  gpio_get_value(mmc_slot(host).gpio_cirq) ?
+  high : low);
+   }
+   spin_unlock_irqrestore(host-irq_lock, flags);
 
if (host-suspended) {
seq_printf(s, host suspended, can't read registers\n);
@@ -1819,9 +1836,11 @@ static int omap_hsmmc_regs_show(struct seq_file *s, void 
*data)
}
 
pm_runtime_get_sync(host-dev);
-
+   seq_puts(s, \nregs:\n);
seq_printf(s, CON:\t\t0x%08x\n,
OMAP_HSMMC_READ(host-base, CON));
+   seq_printf(s, PSTATE:\t\t0x%08x\n,
+  OMAP_HSMMC_READ(host-base, PSTATE));
seq_printf(s, HCTL:\t\t0x%08x\n,
OMAP_HSMMC_READ(host-base, HCTL));
seq_printf(s, SYSCTL:\t\t0x%08x\n,
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 2/4] mmc: omap_hsmmc: Enable SDIO IRQ.

2013-10-05 Thread Andreas Fenkart
For now, only support SDIO interrupt if we are booted with
DT. This is because some platforms need special quirks. And
we don't want to add new legacy mux platform init code
callbacks any longer as we are moving to DT based booting
anyways.

Broken hardware, missing the swakueup line, should fallback
to polling, by setting 'ti,quirk-swakup-missing' in the
device tree. Otherwise pending SDIO IRQ are not detected
while in suspend. This affects am33xx processors.

Signed-off-by: Andreas Fenkart afenk...@gmail.com

diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt 
b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
index ed271fc..1136e6b 100644
--- a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
+++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
@@ -20,6 +20,24 @@ ti,dual-volt: boolean, supports dual voltage cards
 ti,non-removable: non-removable slot (like eMMC)
 ti,needs-special-reset: Requires a special softreset sequence
 ti,needs-special-hs-handling: HSMMC IP needs special setting for handling High 
Speed
+ti,quirk-swakup-missing: SOC missing the swakeup line, will not detect
+SDIO irq while in suspend. Fallback to polling. Affected chips are
+am335x,
+
+--
+| PRCM |
+ --
+  ^ |
+  swakeup | | fclk
+  | v
+  -----   -
+ | card | -- CIRQ --  | hsmmc | -- IRQ --  | CPU |
+  -----   -
+
+In suspend the fclk is off and the module is disfunctional. Even
+register reads will fail. A small logic in the host will request fclk
+restore, when an external event is detected. Once the clock is
+restored, the host detects the event normally.
 
 Example:
mmc1: mmc@0x4809c000 {
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 94d6dc8..53beac4 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -130,6 +130,7 @@ static void apply_clk_hack(struct device *dev)
 #define TC_EN  (1  1)
 #define BWR_EN (1  4)
 #define BRR_EN (1  5)
+#define CIRQ_EN(1  8)
 #define ERR_EN (1  15)
 #define CTO_EN (1  16)
 #define CCRC_EN(1  17)
@@ -210,6 +211,10 @@ struct omap_hsmmc_host {
int reqs_blocked;
int use_reg;
int req_in_progress;
+   int flags;
+#define HSMMC_RUNTIME_SUSPENDED(1  0)/* Runtime suspended */
+#define HSMMC_SDIO_IRQ_ENABLED (1  1)/* SDIO irq enabled */
+
struct omap_hsmmc_next  next_data;
struct  omap_mmc_platform_data  *pdata;
 };
@@ -490,27 +495,40 @@ static void omap_hsmmc_stop_clock(struct omap_hsmmc_host 
*host)
 static void omap_hsmmc_enable_irq(struct omap_hsmmc_host *host,
  struct mmc_command *cmd)
 {
-   unsigned int irq_mask;
+   u32 irq_mask = INT_EN_MASK;
+   unsigned long flags;
 
if (host-use_dma)
-   irq_mask = INT_EN_MASK  ~(BRR_EN | BWR_EN);
-   else
-   irq_mask = INT_EN_MASK;
+   irq_mask = ~(BRR_EN | BWR_EN);
 
/* Disable timeout for erases */
if (cmd-opcode == MMC_ERASE)
irq_mask = ~DTO_EN;
 
+   spin_lock_irqsave(host-irq_lock, flags);
OMAP_HSMMC_WRITE(host-base, STAT, STAT_CLEAR);
OMAP_HSMMC_WRITE(host-base, ISE, irq_mask);
+
+   /* latch pending CIRQ, but don't signal */
+   if (host-flags  HSMMC_SDIO_IRQ_ENABLED)
+   irq_mask |= CIRQ_EN;
OMAP_HSMMC_WRITE(host-base, IE, irq_mask);
+   spin_unlock_irqrestore(host-irq_lock, flags);
 }
 
 static void omap_hsmmc_disable_irq(struct omap_hsmmc_host *host)
 {
-   OMAP_HSMMC_WRITE(host-base, ISE, 0);
-   OMAP_HSMMC_WRITE(host-base, IE, 0);
+   u32 irq_mask = 0;
+   unsigned long flags;
+
+   spin_lock_irqsave(host-irq_lock, flags);
+   /* no transfer running, need to signal cirq if */
+   if (host-flags  HSMMC_SDIO_IRQ_ENABLED)
+   irq_mask |= CIRQ_EN;
+   OMAP_HSMMC_WRITE(host-base, ISE, irq_mask);
+   OMAP_HSMMC_WRITE(host-base, IE, irq_mask);
OMAP_HSMMC_WRITE(host-base, STAT, STAT_CLEAR);
+   spin_unlock_irqrestore(host-irq_lock, flags);
 }
 
 /* Calculate divisor for the given clock frequency */
@@ -1067,8 +1085,12 @@ static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id)
int status;
 
status = OMAP_HSMMC_READ(host-base, STAT);
-   while (status  INT_EN_MASK  host-req_in_progress) {
-   omap_hsmmc_do_irq(host, status);
+   while (status  (INT_EN_MASK | CIRQ_EN)) {
+   if (host-req_in_progress)
+   

[PATCH v3 3/4] mmc: omap_hsmmc: Remux pins to support SDIO interrupt on AM335x

2013-10-05 Thread Andreas Fenkart
The am335x can't detect pending cirq in PM runtime suspend.
This patch reconfigures dat1 as a GPIO before going to suspend.
SDIO interrupts are detected with the GPIO, while in runtime
suspend, standard detection of the module block otherwise.

Signed-off-by: Andreas Fenkart afenk...@gmail.com

diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt 
b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
index 1136e6b..146f3ad 100644
--- a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
+++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
@@ -21,8 +21,11 @@ ti,non-removable: non-removable slot (like eMMC)
 ti,needs-special-reset: Requires a special softreset sequence
 ti,needs-special-hs-handling: HSMMC IP needs special setting for handling High 
Speed
 ti,quirk-swakup-missing: SOC missing the swakeup line, will not detect
-SDIO irq while in suspend. Fallback to polling. Affected chips are
-am335x,
+SDIO irq while in suspend. The workaround is to reconfigure the dat1 line as a
+GPIO upon suspend. Beyond this option and the GPIO config, you also need to set
+named pinctrl states default, active and idle , see example below.  The
+MMC driver will then then toggle between default and idle during the runtime
+Affected chips are am335x,
 
 --
 | PRCM |
@@ -49,3 +52,24 @@ Example:
vmmc-supply = vmmc; /* phandle to regulator node */
ti,non-removable;
};
+
+[am335x with with gpio for sdio irq]
+
+   mmc1_cirq_pin: pinmux_cirq_pin {
+   pinctrl-single,pins = 
+   0x0f8 0x3f  /* MMC0_DAT1 as GPIO2_28 */
+   ;
+   };
+
+   mmc1: mmc@4806 {
+   ti,non-removable;
+   bus-width = 4;
+   vmmc-supply = ldo2_reg;
+   vmmc_aux-supply = vmmc;
+   ti,quirk-swakeup-missing;
+   pinctrl-names = default, active, idle;
+   pinctrl-0 = mmc1_pins;
+   pinctrl-1 = mmc1_pins;
+   pinctrl-2 = mmc1_cirq_pin;
+   ti,cirq-gpio = gpio3 28 0;
+   };
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 53beac4..a8894ee 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -36,6 +36,7 @@
 #include linux/mmc/core.h
 #include linux/mmc/mmc.h
 #include linux/io.h
+#include linux/irq.h
 #include linux/gpio.h
 #include linux/regulator/consumer.h
 #include linux/pinctrl/consumer.h
@@ -214,11 +215,22 @@ struct omap_hsmmc_host {
int flags;
 #define HSMMC_RUNTIME_SUSPENDED(1  0)/* Runtime suspended */
 #define HSMMC_SDIO_IRQ_ENABLED (1  1)/* SDIO irq enabled */
+#define HSMMC_SWAKEUP_QUIRK(1  2)/* SDIO irq enabled */
 
struct omap_hsmmc_next  next_data;
+   struct pinctrl  *pinctrl;
+   struct pinctrl_state*fixed, *active, *idle;
struct  omap_mmc_platform_data  *pdata;
 };
 
+static irqreturn_t omap_hsmmc_cirq(int irq, void *dev_id)
+{
+   struct omap_hsmmc_host *host = dev_id;
+
+   mmc_signal_sdio_irq(host-mmc);
+   return IRQ_HANDLED;
+}
+
 static int omap_hsmmc_card_detect(struct device *dev, int slot)
 {
struct omap_hsmmc_host *host = dev_get_drvdata(dev);
@@ -453,10 +465,31 @@ static int omap_hsmmc_gpio_init(struct 
omap_mmc_platform_data *pdata)
} else
pdata-slots[0].gpio_wp = -EINVAL;
 
+   if (pdata-slots[0].gpio_cirq  0 
+   gpio_is_valid(pdata-slots[0].gpio_cirq)) {
+   pdata-slots[0].sdio_irq =
+   gpio_to_irq(pdata-slots[0].gpio_cirq);
+
+   ret = gpio_request(pdata-slots[0].gpio_cirq, sdio_cirq);
+   if (ret)
+   goto err_free_ro;
+   ret = gpio_direction_input(pdata-slots[0].gpio_cirq);
+   if (ret)
+   goto err_free_cirq;
+
+   } else {
+   pdata-slots[0].gpio_cirq = -EINVAL;
+   }
+
+
return 0;
 
+err_free_cirq:
+   gpio_free(pdata-slots[0].gpio_cirq);
+err_free_ro:
+   if (gpio_is_valid(pdata-slots[0].gpio_wp))
 err_free_wp:
-   gpio_free(pdata-slots[0].gpio_wp);
+   gpio_free(pdata-slots[0].gpio_wp);
 err_free_cd:
if (gpio_is_valid(pdata-slots[0].switch_pin))
 err_free_sp:
@@ -470,6 +503,68 @@ static void omap_hsmmc_gpio_free(struct 
omap_mmc_platform_data *pdata)
gpio_free(pdata-slots[0].gpio_wp);
if (gpio_is_valid(pdata-slots[0].switch_pin))
gpio_free(pdata-slots[0].switch_pin);
+   if (gpio_is_valid(pdata-slots[0].gpio_cirq))
+   gpio_free(pdata-slots[0].gpio_cirq);
+}
+
+static int omap_hsmmc_pin_init(struct omap_hsmmc_host *host)
+{
+   int ret;
+
+   host-pinctrl = devm_pinctrl_get(host-dev);
+   if (IS_ERR(host-pinctrl)) {
+   

Re: [PATCH v2 3/9] ARM: dts: Add SHAM data and documentation for AM33XX

2013-10-05 Thread Joel Fernandes
On 10/04/2013 09:26 AM, Mark Rutland wrote:
 On Mon, Sep 30, 2013 at 04:13:00PM +0100, Joel Fernandes wrote:
 From: Mark A. Greer mgr...@animalcreek.com

 Add the generic AM33XX SHAM module's device tree data and
 enable it for the am335x-evm, am335x-evmsk, and am335x-bone
 platforms.  Also add Documentation file describing the data
 for the SHAM module.

 [jo...@ti.com: Dropped interrupt-parrent property]
 CC: Paul Walmsley p...@pwsan.com
 Signed-off-by: Mark A. Greer mgr...@animalcreek.com
 ---
  .../devicetree/bindings/crypto/omap-sham.txt   | 31 
 ++
  arch/arm/boot/dts/am335x-bone.dts  |  4 +++
  arch/arm/boot/dts/am335x-evm.dts   |  4 +++
  arch/arm/boot/dts/am335x-evmsk.dts |  4 +++
  arch/arm/boot/dts/am33xx.dtsi  |  9 +++
  5 files changed, 52 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/crypto/omap-sham.txt

 diff --git a/Documentation/devicetree/bindings/crypto/omap-sham.txt 
 b/Documentation/devicetree/bindings/crypto/omap-sham.txt
 new file mode 100644
 index 000..b97710f
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/crypto/omap-sham.txt
 @@ -0,0 +1,31 @@
 +OMAP SoC SHA crypto Module
 +
 +Required properties:
 +
 +- compatible : Should contain entries for this and backward compatible
 +  SHAM versions:
 +  - ti,omap2-sham for OMAP2  OMAP3.
 +  - ti,omap4-sham for OMAP4 and AM33XX.
 +  Note that these two versions are incompatible.
 +- ti,hwmods: Name of the hwmod associated with the SHAM module
 +- reg : Offset and length of the register set for the module
 +- interrupt-parent : the phandle for the interrupt controller that
 +  services interrupts for this module.
 
 I don't think this is strictly speaking necessary -- it's mostly going
 to be implicit (it is in the dtsi below). As this is a standard
 property, you don't need to document it here.

Ok, dropping from documentation.

 +- interrupts : the interrupt number for the SHAM module.
 
 Sorry, I missed this last time, but this should be interrupt-specifier
 rather than interrupt number.

Ok, done.

 
 Otherwise, this looks good to me. With the fixups above:
 
 Acked-by: Mark Rutland mark.rutl...@arm.com

Thanks!

-Joel

 
 +
 +Optional properties:
 +- dmas: DMA specifier for the rx dma. See the DMA client binding,
 +Documentation/devicetree/bindings/dma/dma.txt
 +- dma-names: DMA request name. Should be rx if a dma is present.
 +
 +Example:
 +/* AM335x */
 +sham: sham@5310 {
 +compatible = ti,omap4-sham;
 +ti,hwmods = sham;
 +reg = 0x5310 0x200;
 +interrupt-parent = intc;
 +interrupts = 109;
 +dmas = edma 36;
 +dma-names = rx;
 +};
 diff --git a/arch/arm/boot/dts/am335x-bone.dts 
 b/arch/arm/boot/dts/am335x-bone.dts
 index 0d63348..8a9802e 100644
 --- a/arch/arm/boot/dts/am335x-bone.dts
 +++ b/arch/arm/boot/dts/am335x-bone.dts
 @@ -19,3 +19,7 @@
  mmc1 {
  vmmc-supply = ldo3_reg;
  };
 +
 +sham {
 +status = okay;
 +};
 diff --git a/arch/arm/boot/dts/am335x-evm.dts 
 b/arch/arm/boot/dts/am335x-evm.dts
 index 23b0a3e..d59e51c 100644
 --- a/arch/arm/boot/dts/am335x-evm.dts
 +++ b/arch/arm/boot/dts/am335x-evm.dts
 @@ -522,3 +522,7 @@
  status = okay;
  vmmc-supply = vmmc_reg;
  };
 +
 +sham {
 +status = okay;
 +};
 diff --git a/arch/arm/boot/dts/am335x-evmsk.dts 
 b/arch/arm/boot/dts/am335x-evmsk.dts
 index bc93895..d45a330 100644
 --- a/arch/arm/boot/dts/am335x-evmsk.dts
 +++ b/arch/arm/boot/dts/am335x-evmsk.dts
 @@ -424,3 +424,7 @@
  status = okay;
  vmmc-supply = vmmc_reg;
  };
 +
 +sham {
 +status = okay;
 +};
 diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
 index 553adc6..299710b 100644
 --- a/arch/arm/boot/dts/am33xx.dtsi
 +++ b/arch/arm/boot/dts/am33xx.dtsi
 @@ -710,5 +710,14 @@
  #size-cells = 1;
  status = disabled;
  };
 +
 +sham: sham@5310 {
 +compatible = ti,omap4-sham;
 +ti,hwmods = sham;
 +reg = 0x5310 0x200;
 +interrupts = 109;
 +dmas = edma 36;
 +dma-names = rx;
 +};
  };
  };
 -- 
 1.8.1.2



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 4/9] ARM: dts: Add AES data and documentation for AM33XX

2013-10-05 Thread Joel Fernandes
These patches were not authored by me but I'll go ahead and fix them up anyway.

On 10/04/2013 09:33 AM, Mark Rutland wrote:
 On Mon, Sep 30, 2013 at 04:13:01PM +0100, Joel Fernandes wrote:
 From: Mark A. Greer mgr...@animalcreek.com

 Add the generic AM33XX AES module's device tree data and
 enable it for the am335x-evm, am335x-evmsk, and am335x-bone
 platforms.  Also add Documentation file describing the data
 for the AES module.

 [jo...@ti.com: Dropped interrupt-parent propert]

 CC: Paul Walmsley p...@pwsan.com
 Signed-off-by: Mark A. Greer mgr...@animalcreek.com
 ---
  .../devicetree/bindings/crypto/omap-aes.txt| 34 
 ++
  arch/arm/boot/dts/am335x-bone.dts  |  4 +++
  arch/arm/boot/dts/am335x-evm.dts   |  4 +++
  arch/arm/boot/dts/am335x-evmsk.dts |  4 +++
  arch/arm/boot/dts/am33xx.dtsi  | 10 +++
  5 files changed, 56 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/crypto/omap-aes.txt

 diff --git a/Documentation/devicetree/bindings/crypto/omap-aes.txt 
 b/Documentation/devicetree/bindings/crypto/omap-aes.txt
 new file mode 100644
 index 000..4bb1e27
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/crypto/omap-aes.txt
 @@ -0,0 +1,34 @@
 +OMAP SoC AES crypto Module
 +
 +Required properties:
 +
 +- compatible : Should contain entries for this and backward compatible
 +  AES versions:
 +  - ti,omap2-aes for OMAP2.
 +  - ti,omap3-aes for OMAP3.
 +  - ti,omap4-aes for OMAP4 and AM33XX.
 +  Note that the OMAP2 and 3 versions are compatible (OMAP3 supports
 +  more algorithms) but they are incompatible with OMAP4.
 +- ti,hwmods: Name of the hwmod associated with the AES odule
 +- reg : Offset and length of the register set for the module
 +- interrupt-parent : the phandle for the interrupt controller that
 +  services interrupts for this module.
 +- interrupts : the interrupt number for the AES odule.
 
 Similar comments to the SHAM module here:
 
 * s/interrupt number/interrupt-specifier/
 * Drop interrupt-parent.
 * s/AES odule/AES module/

Ok, done.

 +
 +Optional properties:
 +- dmas: DMA specifier for tx and rx dma. See the DMA client binding,
 +Documentation/devicetree/bindings/dma/dma.txt
 
 s/DMA specifier/DMA specifiers/
 
 +- dma-names: DMA request names. Should be 'tx, rx' if dma is present.
 
 Nit: I'd prefer 'Should include tx and rx if present' -- I hope the

Ok, changed to the same.

 driver's requesting these by name rather than relying on a specific
 ordering (it makes future expansion and optional components far easier
 to handle sanely).

Yes, that's the case. Its handled by name using the
dma_request_slave_channel_compat API.

 +
 +Example:
 +/* AM335x */
 +aes: aes@5350 {
 +compatible = ti,omap4-aes;
 +ti,hwmods = aes;
 +reg = 0x5350 0xa0;
 +interrupt-parent = intc;
 +interrupts = 102;
 +dmas = edma 6
 +edma 5;
 +dma-names = tx, rx;
 +};
 
 Minor nit, but for consistency could you bracket the DMAs individually:
 
   dmas = edma 6,
  edma 5;

Ok changed as above.

 
 diff --git a/arch/arm/boot/dts/am335x-bone.dts 
 b/arch/arm/boot/dts/am335x-bone.dts
 index 8a9802e..94ee427 100644
 --- a/arch/arm/boot/dts/am335x-bone.dts
 +++ b/arch/arm/boot/dts/am335x-bone.dts
 @@ -23,3 +23,7 @@
  sham {
  status = okay;
  };
 +
 +aes {
 +status = okay;
 +};
 diff --git a/arch/arm/boot/dts/am335x-evm.dts 
 b/arch/arm/boot/dts/am335x-evm.dts
 index d59e51c..86463fa 100644
 --- a/arch/arm/boot/dts/am335x-evm.dts
 +++ b/arch/arm/boot/dts/am335x-evm.dts
 @@ -526,3 +526,7 @@
  sham {
  status = okay;
  };
 +
 +aes {
 +status = okay;
 +};
 diff --git a/arch/arm/boot/dts/am335x-evmsk.dts 
 b/arch/arm/boot/dts/am335x-evmsk.dts
 index d45a330..f577e65 100644
 --- a/arch/arm/boot/dts/am335x-evmsk.dts
 +++ b/arch/arm/boot/dts/am335x-evmsk.dts
 @@ -428,3 +428,7 @@
  sham {
  status = okay;
  };
 +
 +aes {
 +status = okay;
 +};
 diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
 index 299710b..0daa1b2 100644
 --- a/arch/arm/boot/dts/am33xx.dtsi
 +++ b/arch/arm/boot/dts/am33xx.dtsi
 @@ -719,5 +719,15 @@
  dmas = edma 36;
  dma-names = rx;
  };
 +
 +aes: aes@5350 {
 +compatible = ti,omap4-aes;
 +ti,hwmods = aes;
 +reg = 0x5350 0xa0;
 +interrupts = 102;
 +dmas = edma 6
 +edma 5;
 
 Bracketing here too, please.

Done.

Thanks,

-Joel

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 0/3] AM33XX crypto DTS patches

2013-10-05 Thread Joel Fernandes
These patches are some minor fixups and changes to commit messages to the
AM33XX crypto (aes, sham) patches with reference to the comments at:
http://comments.gmane.org/gmane.linux.drivers.devicetree/45961

Joel Fernandes (1):
  ARM: dts: AM33XX: Fix AES interrupt number

Mark A. Greer (2):
  ARM: dts: AM33XX: Add SHAM data and documentation
  ARM: dts: AM33XX: Add AES data and documentation

 .../devicetree/bindings/crypto/omap-aes.txt| 31 ++
 .../devicetree/bindings/crypto/omap-sham.txt   | 28 +++
 arch/arm/boot/dts/am335x-bone.dts  |  8 ++
 arch/arm/boot/dts/am335x-evm.dts   |  8 ++
 arch/arm/boot/dts/am335x-evmsk.dts |  8 ++
 arch/arm/boot/dts/am33xx.dtsi  | 19 +
 6 files changed, 102 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/crypto/omap-aes.txt
 create mode 100644 Documentation/devicetree/bindings/crypto/omap-sham.txt

-- 
1.8.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 3/3] ARM: dts: AM33XX: Fix AES interrupt number

2013-10-05 Thread Joel Fernandes
AES interrupts were previously not used, but after recent changes to omap-aes
driver, its being used. We correct the interrupt number to have working PIO
mode.

Signed-off-by: Joel Fernandes jo...@ti.com
---
 arch/arm/boot/dts/am33xx.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 2664da9..5c2d6c1 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -724,7 +724,7 @@
compatible = ti,omap4-aes;
ti,hwmods = aes;
reg = 0x5350 0xa0;
-   interrupts = 102;
+   interrupts = 103;
dmas = edma 6,
   edma 5;
dma-names = tx, rx;
-- 
1.8.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 2/3] ARM: dts: AM33XX: Add AES data and documentation

2013-10-05 Thread Joel Fernandes
From: Mark A. Greer mgr...@animalcreek.com

Add the generic AM33XX AES module's device tree data and
enable it for the am335x-evm, am335x-evmsk, and am335x-bone
platforms.  Also add Documentation file describing the data
for the AES module.

[jo...@ti.com: Dropped interrupt-parent propert, documentation fixups]

CC: Paul Walmsley p...@pwsan.com
Signed-off-by: Mark A. Greer mgr...@animalcreek.com
---
 .../devicetree/bindings/crypto/omap-aes.txt| 31 ++
 arch/arm/boot/dts/am335x-bone.dts  |  4 +++
 arch/arm/boot/dts/am335x-evm.dts   |  4 +++
 arch/arm/boot/dts/am335x-evmsk.dts |  4 +++
 arch/arm/boot/dts/am33xx.dtsi  | 10 +++
 5 files changed, 53 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/crypto/omap-aes.txt

diff --git a/Documentation/devicetree/bindings/crypto/omap-aes.txt 
b/Documentation/devicetree/bindings/crypto/omap-aes.txt
new file mode 100644
index 000..fd97176
--- /dev/null
+++ b/Documentation/devicetree/bindings/crypto/omap-aes.txt
@@ -0,0 +1,31 @@
+OMAP SoC AES crypto Module
+
+Required properties:
+
+- compatible : Should contain entries for this and backward compatible
+  AES versions:
+  - ti,omap2-aes for OMAP2.
+  - ti,omap3-aes for OMAP3.
+  - ti,omap4-aes for OMAP4 and AM33XX.
+  Note that the OMAP2 and 3 versions are compatible (OMAP3 supports
+  more algorithms) but they are incompatible with OMAP4.
+- ti,hwmods: Name of the hwmod associated with the AES module
+- reg : Offset and length of the register set for the module
+- interrupts : the interrupt-specifier for the AES module.
+
+Optional properties:
+- dmas: DMA specifiers for tx and rx dma. See the DMA client binding,
+   Documentation/devicetree/bindings/dma/dma.txt
+- dma-names: DMA request names should include tx and rx if present.
+
+Example:
+   /* AM335x */
+   aes: aes@5350 {
+   compatible = ti,omap4-aes;
+   ti,hwmods = aes;
+   reg = 0x5350 0xa0;
+   interrupts = 102;
+   dmas = edma 6,
+  edma 5;
+   dma-names = tx, rx;
+   };
diff --git a/arch/arm/boot/dts/am335x-bone.dts 
b/arch/arm/boot/dts/am335x-bone.dts
index 8a9802e..94ee427 100644
--- a/arch/arm/boot/dts/am335x-bone.dts
+++ b/arch/arm/boot/dts/am335x-bone.dts
@@ -23,3 +23,7 @@
 sham {
status = okay;
 };
+
+aes {
+   status = okay;
+};
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
index d59e51c..86463fa 100644
--- a/arch/arm/boot/dts/am335x-evm.dts
+++ b/arch/arm/boot/dts/am335x-evm.dts
@@ -526,3 +526,7 @@
 sham {
status = okay;
 };
+
+aes {
+   status = okay;
+};
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts 
b/arch/arm/boot/dts/am335x-evmsk.dts
index d45a330..f577e65 100644
--- a/arch/arm/boot/dts/am335x-evmsk.dts
+++ b/arch/arm/boot/dts/am335x-evmsk.dts
@@ -428,3 +428,7 @@
 sham {
status = okay;
 };
+
+aes {
+   status = okay;
+};
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 299710b..2664da9 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -719,5 +719,15 @@
dmas = edma 36;
dma-names = rx;
};
+
+   aes: aes@5350 {
+   compatible = ti,omap4-aes;
+   ti,hwmods = aes;
+   reg = 0x5350 0xa0;
+   interrupts = 102;
+   dmas = edma 6,
+  edma 5;
+   dma-names = tx, rx;
+   };
};
 };
-- 
1.8.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 1/3] ARM: dts: AM33XX: Add SHAM data and documentation

2013-10-05 Thread Joel Fernandes
From: Mark A. Greer mgr...@animalcreek.com

Add the generic AM33XX SHAM module's device tree data and
enable it for the am335x-evm, am335x-evmsk, and am335x-bone
platforms.  Also add Documentation file describing the data
for the SHAM module.

[jo...@ti.com: Dropped interrupt-parrent property, documentation fixups]
CC: Paul Walmsley p...@pwsan.com
Signed-off-by: Mark A. Greer mgr...@animalcreek.com
Acked-by: Mark Rutland mark.rutl...@arm.com
---
 .../devicetree/bindings/crypto/omap-sham.txt   | 28 ++
 arch/arm/boot/dts/am335x-bone.dts  |  4 
 arch/arm/boot/dts/am335x-evm.dts   |  4 
 arch/arm/boot/dts/am335x-evmsk.dts |  4 
 arch/arm/boot/dts/am33xx.dtsi  |  9 +++
 5 files changed, 49 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/crypto/omap-sham.txt

diff --git a/Documentation/devicetree/bindings/crypto/omap-sham.txt 
b/Documentation/devicetree/bindings/crypto/omap-sham.txt
new file mode 100644
index 000..f839acd
--- /dev/null
+++ b/Documentation/devicetree/bindings/crypto/omap-sham.txt
@@ -0,0 +1,28 @@
+OMAP SoC SHA crypto Module
+
+Required properties:
+
+- compatible : Should contain entries for this and backward compatible
+  SHAM versions:
+  - ti,omap2-sham for OMAP2  OMAP3.
+  - ti,omap4-sham for OMAP4 and AM33XX.
+  Note that these two versions are incompatible.
+- ti,hwmods: Name of the hwmod associated with the SHAM module
+- reg : Offset and length of the register set for the module
+- interrupts : the interrupt-specifier for the SHAM module.
+
+Optional properties:
+- dmas: DMA specifiers for the rx dma. See the DMA client binding,
+   Documentation/devicetree/bindings/dma/dma.txt
+- dma-names: DMA request name. Should be rx if a dma is present.
+
+Example:
+   /* AM335x */
+   sham: sham@5310 {
+   compatible = ti,omap4-sham;
+   ti,hwmods = sham;
+   reg = 0x5310 0x200;
+   interrupts = 109;
+   dmas = edma 36;
+   dma-names = rx;
+   };
diff --git a/arch/arm/boot/dts/am335x-bone.dts 
b/arch/arm/boot/dts/am335x-bone.dts
index 0d63348..8a9802e 100644
--- a/arch/arm/boot/dts/am335x-bone.dts
+++ b/arch/arm/boot/dts/am335x-bone.dts
@@ -19,3 +19,7 @@
 mmc1 {
vmmc-supply = ldo3_reg;
 };
+
+sham {
+   status = okay;
+};
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
index 23b0a3e..d59e51c 100644
--- a/arch/arm/boot/dts/am335x-evm.dts
+++ b/arch/arm/boot/dts/am335x-evm.dts
@@ -522,3 +522,7 @@
status = okay;
vmmc-supply = vmmc_reg;
 };
+
+sham {
+   status = okay;
+};
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts 
b/arch/arm/boot/dts/am335x-evmsk.dts
index bc93895..d45a330 100644
--- a/arch/arm/boot/dts/am335x-evmsk.dts
+++ b/arch/arm/boot/dts/am335x-evmsk.dts
@@ -424,3 +424,7 @@
status = okay;
vmmc-supply = vmmc_reg;
 };
+
+sham {
+   status = okay;
+};
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 553adc6..299710b 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -710,5 +710,14 @@
#size-cells = 1;
status = disabled;
};
+
+   sham: sham@5310 {
+   compatible = ti,omap4-sham;
+   ti,hwmods = sham;
+   reg = 0x5310 0x200;
+   interrupts = 109;
+   dmas = edma 36;
+   dma-names = rx;
+   };
};
 };
-- 
1.8.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RandText,uborka_temi: Specified TextBlock does not exists!]

2013-10-05 Thread arapov74

[RandText,uborka-text: Specified TextBlock does not exists!]
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [RFC 00/15] Device Tree schemas and validation

2013-10-05 Thread Chaiken, Alison
Rob Herring in devicetree/msg06598.html
 This is interesting approach using the dts syntax,

Benoit Cousson in devicetree/msg06617.html
 it has the big advantage of re-using the parser already included in DTC for
 free. In term or readability, it avoids to re-defining a brand new syntax for
 people who are already familiar with the DTS one.

Stephen Warren wrote in devicetree/msg06676.html:
 DT is a language for representing data.
 The validation checks described by schemas are rules, or code, and not static
 data.

The syntax of the existing device-tree source is strikingly similar to that of
the widely used JavaScript Object Notation, better known as JSON.  JSON has many
parsers, validators and schemata already in existence.  Assuredly as many coders
know how to program JSON as know C.

JSON makes some sense for representation of device-trees, because, as the
authoritative json.org explains, JSON is a text format that is completely
language independent but uses conventions that are familiar to programmers of
the C-family of languages . . . JSON is a natural representation of data for the
C family of programming languages.

Benoit Cousson remarks in devicetree/msg06617.html:
 The bindings definition being quite open, there is no easy way to
 ensure proper schema / bindings without careful review of the
 schema.

Stephen Warren continues in devicetree/msg06676.html:
 Overall, I believe perhaps the single most important aspect of any DT
 schema is schema inheritance or instancing,

David Gibson comments in devicetree/msg06725.html:
 define the notion of dt patterns or templates.  A dt
 pattern is to a dt node or subtree as a regex is to a string - it
 provides a reasonably expressive way of defining a family of dt
 nodes.  These would be defined in an extension / superset of dt
 syntax.

I violently agree with Stephen and David and believe that inheritance
offers a partial solution to the problem Benoit describes.  What about
improving compliance by explicitly making use of inheritance with
device-tree include files?  Suppose we consider supplementing the ARM
tree's skeleton.dtsi tree-root with board.dtsi, cpu.dtsi,
daughtercard.dtsi . . .  Suppose then we require board-level dts files
to include board.dtsi, and furthermore that the CPU node for the board
to be described in a DTSI file that must itself include cpu.dtsi.
Then the dtc itself could in effect check perform some constraint
checking.  Device vendors could offer arch.dtsi and particular
chip.dtsi that users of those products would be required to include.

A related question: what DTS files will a validator compare against a schema?
Assuredly given the existing ability of nodes and properties in a
hierarchy of include files to override and modify one another, the
post C-preprocessed and compiled single-file is the one wanted, that
is, the output from

   $CC $CPP_FLAGS -o foo.tmp foo.dts
   dtc -O dts -i arch/arm/boot/dts foo.tmp

Some other suggestions:

   Let's not make the documentation derived from schemata and DTS files
tree-structured.Otherwise we end up with GNU info, ahem.

   Stephen Warren previously contributed a useful bindings checklist.  We should
try to roll that checklist into any validator.

Benoit promises in  devicetree/msg06617.html:
 Being the very first one, you might get a free beer... meaning there
 might be such thing as a free beer :-)

I'm presenting a talk about device-tree for Embedded Linux Conference
Europe, http://sched.co/17ozhPE, and hope that some of you come flame
me in person there.  If so, I will actually buy you a free beer, but
not until after the second seminar I must give that afternoon!

-- 
Alison Chaiken
Mentor Embedded Software Division
Fremont, CA
GMT-8
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html