Re: AM3517 usb host issue

2015-05-26 Thread Ben Dooks
On 22/05/15 23:13, Ben Dooks wrote:
 On 22/05/15 16:50, Felipe Balbi wrote:
 Hi,
 
 On Fri, May 22, 2015 at 11:04:33AM +0300, Ben Dooks wrote:
 I am trying to get the full-speed USB host working on an custom
 AM3517 device with the 3.18.12 kernel. The hardware works (a
 2.6.37 kernel has been used for testing).

 Does anyone have any experience of 3.18 (or similarly recent
 kernel on an AM3517 system) or have any pointers as where to
 start debugging? The ti-linux-3.14.y does not have any patches
 that aren't applied to the usb on 3.18.13.

 The cpu port 1 is connected by a TI TUSB1106 usb transceiver that
 is directly connected to a full-speed hub (TI USB2046) hub so the
 OHCI driver is the only one in use.

 Note, the ohci-omap3 is loaded as a module as this is how their
 user application expects to be able to shut down usb when it does
 not need it.

 The device tree configuration for the usb host:
 
 and what exactly doesn't work ? That old OHCI driver hasn't been
 touched in years, it's no surprise that it stopped working :-(
 
 Anyway, what exactly doesn't work ? No device enumerates ? Do you
 get any IRQs by plugging a new device in ?
 
 I will check the interrupts when I get back into the office.
 
 There is only one device (the hub) which isn't enumerating and is
 hard-wired on the board.
 
 usbhshost { status = okay;  /* just in case it is started
 disabled */

 port1-mode = ohci-phy-6pin-dpdm; };

 usbhsohci { status = okay; };

 usbhsehci { status = disabled;  /* no ehci on board */ };


 The usb from the logs is as follows. Some extra debugging has
 been added to verify the device-tree settings:

 [0.00] AM3517 ES1.1 (l2cache sgx neon)


 [0.869706] usbcore: registered new interface driver usbfs
  [0.874270] usbcore: registered new interface driver hub
  [0.878592] usbcore: registered new device driver usb
  [1.223199] usbhs_tll 48062000.usbhstll: starting TI HSUSB
 TLL Controller [1.273000] usbhs_omap 48064000.usbhshost:
 ports 0 [1.278291] usbhs_omap 48064000.usbhshost: port 0:
 ohci-phy-6pin-dpdm [1.284476] usbhs_omap
 48064000.usbhshost: port0-mode: ohci-phy-6pin-dpdm -5 [
 1.288689] usbhs_tll 48062000.usbhstll: omap_tll_init()
  [1.293628] usbhs_omap 48064000.usbhshost:
 usbhs_runtime_resume [1.298434] usbhs_omap
 48064000.usbhshost: sysconfig 0x1009 [1.302730]
 usbhs_tll 48062000.usbhstll: omap_tll_enable()
  [1.307668] usbhs_omap 48064000.usbhshost:
 usbhs_runtime_suspend [1.310142] stopping usb controller
  [1.419910] usbhs_tll 48062000.usbhstll: omap_tll_disable()
  [1.423547] usbhs_omap 48064000.usbhshost: 3 ports
  [1.429065] usbhs_omap 48064000.usbhshost: starting TI
 HSUSB Controller [1.433831] usbhs_omap 48064000.usbhshost:
 usbhs_runtime_resume [1.438625] usbhs_omap
 48064000.usbhshost: sysconfig 0x1009 [1.442921]
 usbhs_tll 48062000.usbhstll: omap_tll_enable()
  [1.448548] usbhs_omap 48064000.usbhshost:
 omap_usbhs_rev1_hostconfig = [1.455034] usbhs_omap
 48064000.usbhshost: UHH setup done, uhh_hostconfig=80d [
 1.459918] usbhs_omap 48064000.usbhshost: usbhs_runtime_suspend
  [1.462337] stopping usb controller
  [1.569905] usbhs_tll 48062000.usbhstll: omap_tll_disable()
  [1.575408] usbhs_omap 48064000.usbhshost: populating usb
 sub nodes

 [   77.609168] usbhs_omap 48064000.usbhshost:
 usbhs_runtime_resume [   77.613927] usbhs_omap
 48064000.usbhshost: sysconfig 0x1009 [   77.618374]
 usbhs_tll 48062000.usbhstll: omap_tll_enable()
  [   77.802694] usb usb1: New USB device found, idVendor=1d6b,
 idProduct=0001 [   77.816003] usb usb1: New USB device strings:
 Mfr=3, Product=2, SerialNumber1 [   77.827391] usb usb1:
 Product: OHCI Host Controller [   77.838674] usb usb1:
 Manufacturer: Linux 3.18.13-00203-ga3c52be-dirty ohci_d [
 77.849913] usb usb1: SerialNumber: 48064400.ohci

 
 OK, so this is roothub, what happens when a device is plugged to
 the other end ? Is VBUS charged ? We didn't even enumerate
 TUSB2046, did you look at its datasheet
 (http://www.ti.com/lit/ds/symlink/tusb2046b.pdf) ? What is the
 state of RESETn pin ? Perhaps that's tied to a GPIO and the old TI
 kernel toggles that ? Anything interesting from usbmon ?
 
 I've gone through the schematics and verified the hub's reset line
 is connected where we think it is (will try and check with a 'scope
 on monday that it is being taken high, the boot-loader starts it low).
 
 The root has just the one device connected, and unfortunately the
 hw designer decided to hard-wire the D+ pull-up to 3.3V instead
 of the transceiver's pull pin.
 
 Not tried usbmon yet. However if the hub is not being detected then
 probably won't show anything either.
 
 I am going to install devmem2 into the root image and use it to poke
 around and see the state of the system at run time.
 
 Thanks for looking in to this.

The hub is functioning, 3.3V is up, the ~RESET line is high and the
6MHz crystal is running at 

Re: [PATCH] tty: serial: omap: use mctrl_gpio helpers

2015-05-26 Thread Yegor Yefremov
Hi Tony, Nishanth and Felipe,

On Fri, May 22, 2015 at 7:54 PM, Tony Lindgren t...@atomide.com wrote:
 * Felipe Balbi ba...@ti.com [150522 10:41]:
 On Fri, May 22, 2015 at 09:52:13AM -0700, Tony Lindgren wrote:
  * Nishanth Menon n...@ti.com [150522 08:36]:
   On 05/22/2015 07:16 AM, yegorsli...@googlemail.com wrote:
From: Yegor Yefremov yegorsli...@googlemail.com
   
This patch permits to use GPIOs to control the CTS/RTS/DTR/DSR/DCD/RI
signals.
   
Signed-off-by: Yegor Yefremov yegorsli...@googlemail.com
---
 .../devicetree/bindings/serial/omap_serial.txt |9 +
 drivers/tty/serial/Kconfig |1 +
 drivers/tty/serial/omap-serial.c   |  168 
+++-
 3 files changed, 171 insertions(+), 7 deletions(-)
  
   Would we rather move introducing new features to 8250_omap.c rather
   than doing that to omap-serial and keep feature creeping it such that
   we wont ever be able to switch to 8250_omap ?
 
  Yes please. Also, do we really want to allow mapping
  random GPIO pins to the UART driver? I guess it would be

 See drivers/tty/serial/serial_mctrl_gpio.[ch], these are used for UARTs
 on SoCs with enough GPIOs available whose UART don't have full Modem
 signals. It's pretty handy for BT, GSM, LTE, whatever type of modem-like
 device.

 OK

I need this functionality for a real device having switchable
RS232/422/485 driver. So I need both RS232 signals, that are not all
possible to get via pinmux, and RS485 transmitter switching.

AFAIK RS485 feature is still not implemented in 8250. That's why I
would like this patch to be still included into omap_serial for now.

Yegor
--
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 02/10] ARM: OMAP3: Fix crypto support for HS devices

2015-05-26 Thread Pali Rohár
Hi Paul,

this patch is also for omap2... Can you review it too?

On Saturday 28 February 2015 17:24:36 Pavel Machek wrote:
 On Thu 2015-02-26 14:49:52, Pali Rohár wrote:
  Register crypto hwmod links only if they are not disabled in DT.
  If DT information is missing, enable them only for GP devices.
  
  Before this patch crypto hwmod links were always disabled for all HS devices
  and it was not possible to use omap-aes and omap-sham linux drivers.
  
  Signed-off-by: Pali Rohár pali.ro...@gmail.com
 
 Acked-by: Pavel Machek pa...@ucw.cz
 

-- 
Pali Rohár
pali.ro...@gmail.com
--
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 1/2] of: Add vendor prefix for Toby Churchill Ltd.

2015-05-26 Thread Enric Balletbo i Serra
Toby Churchill Ltd is a global provider of assistive technology.

Signed-off-by: Enric Balletbo i Serra enric.balle...@collabora.com
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 8033919..86e842a 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -189,6 +189,7 @@ ste ST-Ericsson
 stericsson ST-Ericsson
 synology   Synology, Inc.
 tbsTBS Technologies
+tclToby Churchill Ltd.
 thine  THine Electronics, Inc.
 ti Texas Instruments
 tlmTrusted Logic Mobility
-- 
2.1.0

--
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 0/2] Add support for Toby Churchill SL50 board.

2015-05-26 Thread Enric Balletbo i Serra
Hi Tony,

These patches add support for a new board based on AM335x processor. If it
is ok, take in consideration to include in next DT merge window, please.

Best regards,

Enric Balletbo i Serra (2):
  of: Add vendor prefix for Toby Churchill Ltd.
  ARM: dts: am335x-sl50: Add Toby-Churchill SL50 board support.

 .../devicetree/bindings/vendor-prefixes.txt|   1 +
 arch/arm/boot/dts/Makefile |   1 +
 arch/arm/boot/dts/am335x-sl50.dts  | 482 +
 3 files changed, 484 insertions(+)
 create mode 100644 arch/arm/boot/dts/am335x-sl50.dts

-- 
2.1.0

--
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: [PATCHv3 00/27] ARM: OMAP2+: clock code move under clk driver

2015-05-26 Thread Tony Lindgren
* Tero Kristo t-kri...@ti.com [150525 08:01]:
 Hi,
 
 As requested, posting v3 with somewhat changed diff parameters and
 diffstat attached. Just some minor Makefile changes compared to v2,
 these were discussed under that set.
 
 Set has been pushed to:
 - tree: https://github.com/t-kristo/linux-pm.git
 - branch: for-4.2/ti-clk-move

Looks like this causes a build error for at least omap2 only .config:

drivers/clk/ti/dpll3xxx.o:(.rodata+0x1c): multiple definition of 
`clkhwops_omap3_dpll'
drivers/clk/ti/dpll.o:(.rodata+0x0): first defined here

You may want to create a file selecting ARCH_OMAP2PLUS=y, then point
KCONFIG_ALLCONFIG to that file for make randconfig. Then just build
randconfigs :) Usually the issues like this are exposed within few
randconfig builds, some take longer if the options have dependencies.

Regards,

Tony
--
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] serial: 8250_omap: provide complete custom startup shutdown callbacks

2015-05-26 Thread Tony Lindgren
* Peter Hurley pe...@hurleysoftware.com [150526 07:14]:
 On 05/20/2015 04:07 PM, Sebastian Andrzej Siewior wrote:
  The currently in-use port-startup and port-shutdown are okay. The
  startup part for instance does the tiny omap extra part and invokes
  serial8250_do_startup() for the remaining pieces. The workflow in
  serial8250_do_startup() is okay except for the part where UART_RX is
  read without a check if there is something to read. I tried to
  workaround it in commit 0aa525d11859 (tty: serial: 8250_core: read only
  RX if there is something in the FIFO) but then reverted it later in
  commit ca8bb4aefb9 (serial: 8250: Revert tty: serial: 8250_core: read
  only RX if there is something in the FIFO).
  
  This is the second attempt to get it to work on older OMAPs without
  breaking other chips this time
  Peter Hurley suggested to pull in the few needed lines from
  serial8250_do_startup() and drop everything else that is not required
  including making it simpler like using just request_irq() instead the
  chain handler like it is doing now.
  So lets try that.
 
 Thanks, Sebastian.
 
 Reviewed-by: Peter Hurley pe...@hurleysoftware.com

Can we please get this into the v4.1-rc series?

It fixes the following:

Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa06a000 
  
... 
  
[c04217e8] (mem_serial_in) from [c0425480] 
(serial8250_do_startup+0xe4/0x694)
[c0425480] (serial8250_do_startup) from [c0427e48] 
(omap_8250_startup+0x70/0x144)
[c0427e48] (omap_8250_startup) from [c0425a54] 
(serial8250_startup+0x24/0x30)
[c0425a54] (serial8250_startup) from [c04208e4] 
(uart_startup.part.14+0x8c/0x1a0)
[c04208e4] (uart_startup.part.14) from [c0420fec] (uart_open+0xd8/0x134)
[c0420fec] (uart_open) from [c0403e50] (tty_open+0xdc/0x5e0)
[c0403e50] (tty_open) from [c018f008] (chrdev_open+0xac/0x188)

Regards,

Tony
--
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: [PATCHv3 00/27] ARM: OMAP2+: clock code move under clk driver

2015-05-26 Thread Tony Lindgren
* Tony Lindgren t...@atomide.com [150526 09:08]:
 * Tero Kristo t-kri...@ti.com [150525 08:01]:
  Hi,
  
  As requested, posting v3 with somewhat changed diff parameters and
  diffstat attached. Just some minor Makefile changes compared to v2,
  these were discussed under that set.
  
  Set has been pushed to:
  - tree: https://github.com/t-kristo/linux-pm.git
  - branch: for-4.2/ti-clk-move
 
 Looks like this causes a build error for at least omap2 only .config:
 
 drivers/clk/ti/dpll3xxx.o:(.rodata+0x1c): multiple definition of 
 `clkhwops_omap3_dpll'
 drivers/clk/ti/dpll.o:(.rodata+0x0): first defined here
 
 You may want to create a file selecting ARCH_OMAP2PLUS=y, then point
 KCONFIG_ALLCONFIG to that file for make randconfig. Then just build
 randconfigs :) Usually the issues like this are exposed within few
 randconfig builds, some take longer if the options have dependencies.

Found more similar issues for omap3 only and omap4 only configs:

drivers/built-in.o: In function `omap2_clkops_enable_clkdm':
omap-gpmc.c:(.text+0x202e0): undefined reference to `ti_clk_get_features'
drivers/built-in.o: In function `omap2_clkops_disable_clkdm':
omap-gpmc.c:(.text+0x20374): undefined reference to `ti_clk_get_features'
drivers/built-in.o: In function `_omap2_dpll_is_in_bypass':
omap-gpmc.c:(.text+0x21678): undefined reference to `ti_clk_get_features'
drivers/built-in.o: In function `omap2_dpll_round_rate':
omap-gpmc.c:(.text+0x218ac): undefined reference to `ti_clk_get_features'
omap-gpmc.c:(.text+0x218ec): undefined reference to `ti_clk_get_features'

drivers/built-in.o: In function `omap3xxx_dt_clk_init':
omap-gpmc.c:(.init.text+0x4d60): undefined reference to 
`omap2_clk_enable_init_clocks'
arch/arm/mach-omap2/built-in.o: In function `ti_clk_init_features':

arch/arm/mach-omap2/built-in.o: In function `ti_clk_init_features':
dss-common.c:(.init.text+0x4368): undefined reference to `ti_clk_setup_features'

Regards,

Tony
--
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: [PATCHv3 00/27] ARM: OMAP2+: clock code move under clk driver

2015-05-26 Thread Felipe Balbi
On Tue, May 26, 2015 at 09:32:16AM -0700, Tony Lindgren wrote:
 * Tony Lindgren t...@atomide.com [150526 09:08]:
  * Tero Kristo t-kri...@ti.com [150525 08:01]:
   Hi,
   
   As requested, posting v3 with somewhat changed diff parameters and
   diffstat attached. Just some minor Makefile changes compared to v2,
   these were discussed under that set.
   
   Set has been pushed to:
   - tree: https://github.com/t-kristo/linux-pm.git
   - branch: for-4.2/ti-clk-move
  
  Looks like this causes a build error for at least omap2 only .config:
  
  drivers/clk/ti/dpll3xxx.o:(.rodata+0x1c): multiple definition of 
  `clkhwops_omap3_dpll'
  drivers/clk/ti/dpll.o:(.rodata+0x0): first defined here
  
  You may want to create a file selecting ARCH_OMAP2PLUS=y, then point
  KCONFIG_ALLCONFIG to that file for make randconfig. Then just build
  randconfigs :) Usually the issues like this are exposed within few
  randconfig builds, some take longer if the options have dependencies.

alternatively, just clone the repository at [1] and use the example
script provided in README.md.

[1] https://github.com/felipebalbi/omap-seeds

-- 
balbi


signature.asc
Description: Digital signature


[PATCH 12/13] [media] omap3isp: Support for deferred probing when requesting DMA channel

2015-05-26 Thread Peter Ujfalusi
Switch to use ma_request_slave_channel_compat_reason() to request the DMA
channel. Only fall back to pio mode if the error code returned is not
-EPROBE_DEFER, otherwise return from the probe with the -EPROBE_DEFER.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
CC: Laurent Pinchart laurent.pinch...@ideasonboard.com
CC: Mauro Carvalho Chehab mche...@osg.samsung.com
---
 drivers/media/platform/omap3isp/isphist.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/omap3isp/isphist.c 
b/drivers/media/platform/omap3isp/isphist.c
index 7138b043a4aa..e690ca13af0e 100644
--- a/drivers/media/platform/omap3isp/isphist.c
+++ b/drivers/media/platform/omap3isp/isphist.c
@@ -499,14 +499,20 @@ int omap3isp_hist_init(struct isp_device *isp)
if (res)
sig = res-start;
 
-   hist-dma_ch = dma_request_slave_channel_compat(mask,
+   hist-dma_ch = dma_request_slave_channel_compat_reason(mask,
omap_dma_filter_fn, sig, isp-dev, hist);
-   if (!hist-dma_ch)
+   if (IS_ERR(hist-dma_ch)) {
+   ret = PTR_ERR(hist-dma_ch);
+   if (ret == -EPROBE_DEFER)
+   return ret;
+
+   hist-dma_ch = NULL;
dev_warn(isp-dev,
 hist: DMA channel request failed, using 
PIO\n);
-   else
+   } else {
dev_dbg(isp-dev, hist: using DMA channel %s\n,
dma_chan_name(hist-dma_ch));
+   }
}
 
hist-ops = hist_ops;
-- 
2.3.5

--
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 09/13] crypto: omap-des - Support for deferred probing when requesting DMA channels

2015-05-26 Thread Peter Ujfalusi
Switch to use ma_request_slave_channel_compat_reason() to request the DMA
channels. Only fall back to pio mode if the error code returned is not
-EPROBE_DEFER, otherwise return from the probe with the -EPROBE_DEFER.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
CC: Herbert Xu herb...@gondor.apana.org.au
CC: David S. Miller da...@davemloft.net
CC: Lokesh Vutla lokeshvu...@ti.com
---
 drivers/crypto/omap-des.c | 38 --
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/drivers/crypto/omap-des.c b/drivers/crypto/omap-des.c
index 46307098f8ba..06be02f520da 100644
--- a/drivers/crypto/omap-des.c
+++ b/drivers/crypto/omap-des.c
@@ -340,7 +340,7 @@ static void omap_des_dma_out_callback(void *data)
 
 static int omap_des_dma_init(struct omap_des_dev *dd)
 {
-   int err = -ENOMEM;
+   int err;
dma_cap_mask_t mask;
 
dd-dma_lch_out = NULL;
@@ -349,21 +349,20 @@ static int omap_des_dma_init(struct omap_des_dev *dd)
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
 
-   dd-dma_lch_in = dma_request_slave_channel_compat(mask,
- omap_dma_filter_fn,
- dd-dma_in,
- dd-dev, rx);
-   if (!dd-dma_lch_in) {
+   dd-dma_lch_in = dma_request_slave_channel_compat_reason(mask,
+   omap_dma_filter_fn, dd-dma_in,
+   dd-dev, rx);
+   if (IS_ERR(dd-dma_lch_in)) {
dev_err(dd-dev, Unable to request in DMA channel\n);
-   goto err_dma_in;
+   return PTR_ERR(dd-dma_lch_in);
}
 
-   dd-dma_lch_out = dma_request_slave_channel_compat(mask,
-  omap_dma_filter_fn,
-  dd-dma_out,
-  dd-dev, tx);
-   if (!dd-dma_lch_out) {
+   dd-dma_lch_out = dma_request_slave_channel_compat_reason(mask,
+   omap_dma_filter_fn, dd-dma_out,
+   dd-dev, tx);
+   if (IS_ERR(dd-dma_lch_out)) {
dev_err(dd-dev, Unable to request out DMA channel\n);
+   err = PTR_ERR(dd-dma_lch_out);
goto err_dma_out;
}
 
@@ -371,14 +370,15 @@ static int omap_des_dma_init(struct omap_des_dev *dd)
 
 err_dma_out:
dma_release_channel(dd-dma_lch_in);
-err_dma_in:
-   if (err)
-   pr_err(error: %d\n, err);
+
return err;
 }
 
 static void omap_des_dma_cleanup(struct omap_des_dev *dd)
 {
+   if (dd-pio_only)
+   return;
+
dma_release_channel(dd-dma_lch_out);
dma_release_channel(dd-dma_lch_in);
 }
@@ -1110,7 +1110,9 @@ static int omap_des_probe(struct platform_device *pdev)
tasklet_init(dd-queue_task, omap_des_queue_task, (unsigned long)dd);
 
err = omap_des_dma_init(dd);
-   if (err  DES_REG_IRQ_STATUS(dd)  DES_REG_IRQ_ENABLE(dd)) {
+   if (err == -EPROBE_DEFER) {
+   goto err_irq;
+   } else if (err  DES_REG_IRQ_STATUS(dd)  DES_REG_IRQ_ENABLE(dd)) {
dd-pio_only = 1;
 
irq = platform_get_irq(pdev, 0);
@@ -1154,8 +1156,8 @@ err_algs:
for (j = dd-pdata-algs_info[i].registered - 1; j = 0; j--)
crypto_unregister_alg(
dd-pdata-algs_info[i].algs_list[j]);
-   if (!dd-pio_only)
-   omap_des_dma_cleanup(dd);
+
+   omap_des_dma_cleanup(dd);
 err_irq:
tasklet_kill(dd-done_task);
tasklet_kill(dd-queue_task);
-- 
2.3.5

--
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 02/13] dmaengine: Introduce dma_request_slave_channel_compat_reason()

2015-05-26 Thread Peter Ujfalusi
dma_request_slave_channel_compat() 'eats' up the returned error codes which
prevents drivers using the compat call to be able to do deferred probing.

The new wrapper is identical in functionality but it will return with error
code in case of failure and will pass the -EPROBE_DEFER to the caller in
case dma_request_slave_channel_reason() returned with it.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 include/linux/dmaengine.h | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index abf63ceabef9..6c777394835c 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -1120,4 +1120,26 @@ static inline struct dma_chan
 
return __dma_request_channel(mask, fn, fn_param);
 }
+
+#define dma_request_slave_channel_compat_reason(mask, x, y, dev, name) \
+   __dma_request_slave_channel_compat_reason((mask), x, y, dev, name)
+
+static inline struct dma_chan
+*__dma_request_slave_channel_compat_reason(const dma_cap_mask_t *mask,
+ dma_filter_fn fn, void *fn_param,
+ struct device *dev, char *name)
+{
+   struct dma_chan *chan;
+
+   chan = dma_request_slave_channel_reason(dev, name);
+   /* Try via legacy API if not requesting for deferred probing */
+   if (IS_ERR(chan)  PTR_ERR(chan) != -EPROBE_DEFER)
+   chan = __dma_request_channel(mask, fn, fn_param);
+
+   if (!chan)
+   chan = ERR_PTR(-ENODEV);
+
+   return chan;
+}
+
 #endif /* DMAENGINE_H */
-- 
2.3.5

--
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 07/13] mmc: davinci_mmc: Support for deferred probing when requesting DMA channels

2015-05-26 Thread Peter Ujfalusi
Switch to use ma_request_slave_channel_compat_reason() to request the DMA
channels. Only fall back to pio mode if the error code returned is not
-EPROBE_DEFER, otherwise return from the probe with the -EPROBE_DEFER.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
CC: Ulf Hansson ulf.hans...@linaro.org
---
 drivers/mmc/host/davinci_mmc.c | 26 +++---
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index b2b3f8bbfd8c..df81e4e2f662 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -530,20 +530,20 @@ static int __init davinci_acquire_dma_channels(struct 
mmc_davinci_host *host)
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
 
-   host-dma_tx =
-   dma_request_slave_channel_compat(mask, edma_filter_fn,
-   host-txdma, mmc_dev(host-mmc), tx);
-   if (!host-dma_tx) {
+   host-dma_tx = dma_request_slave_channel_compat_reason(mask,
+   edma_filter_fn, host-txdma,
+   mmc_dev(host-mmc), tx);
+   if (IS_ERR(host-dma_tx)) {
dev_err(mmc_dev(host-mmc), Can't get dma_tx channel\n);
-   return -ENODEV;
+   return PTR_ERR(host-dma_tx);
}
 
-   host-dma_rx =
-   dma_request_slave_channel_compat(mask, edma_filter_fn,
-   host-rxdma, mmc_dev(host-mmc), rx);
-   if (!host-dma_rx) {
+   host-dma_rx = dma_request_slave_channel_compat_reason(mask,
+   edma_filter_fn, host-rxdma,
+   mmc_dev(host-mmc), rx);
+   if (IS_ERR(host-dma_rx)) {
dev_err(mmc_dev(host-mmc), Can't get dma_rx channel\n);
-   r = -ENODEV;
+   r = PTR_ERR(host-dma_rx);
goto free_master_write;
}
 
@@ -1307,8 +1307,12 @@ static int __init davinci_mmcsd_probe(struct 
platform_device *pdev)
host-mmc_irq = irq;
host-sdio_irq = platform_get_irq(pdev, 1);
 
-   if (host-use_dma  davinci_acquire_dma_channels(host) != 0)
+   if (host-use_dma) {
+   ret = davinci_acquire_dma_channels(host);
+   if (ret == -EPROBE_DEFER)
+   goto out;
host-use_dma = 0;
+   }
 
/* REVISIT:  someday, support IRQ-driven card detection.  */
mmc-caps |= MMC_CAP_NEEDS_POLL;
-- 
2.3.5

--
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 04/13] mmc: omap_hsmmc: No need to check DMA channel validity at module remove

2015-05-26 Thread Peter Ujfalusi
The driver will not probe without valid DMA channels so no need to check
if they are valid when the module is removed.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
CC: Ulf Hansson ulf.hans...@linaro.org
---
 drivers/mmc/host/omap_hsmmc.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 2cd828f42151..57bb85930f81 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2190,10 +2190,8 @@ static int omap_hsmmc_remove(struct platform_device 
*pdev)
if (host-use_reg)
omap_hsmmc_reg_put(host);
 
-   if (host-tx_chan)
-   dma_release_channel(host-tx_chan);
-   if (host-rx_chan)
-   dma_release_channel(host-rx_chan);
+   dma_release_channel(host-tx_chan);
+   dma_release_channel(host-rx_chan);
 
pm_runtime_put_sync(host-dev);
pm_runtime_disable(host-dev);
-- 
2.3.5

--
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 RFC v2 4/7] ASoC: hdmi-codec: Add ELD based audio pcm rules DO NOT MERGE

2015-05-26 Thread Jyri Sarha
This patch is mostly just a copy paste from Russel King's generic
patchs[1] for the same thing. The patche is included only for testing
purposes. Do not merge!

[1] http://lists.freedesktop.org/archives/dri-devel/2015-April/080525.html

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 sound/soc/codecs/hdmi-codec.c | 104 +-
 1 file changed, 103 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index c208cef..2d26ce8 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -78,6 +78,103 @@ static int hdmi_codec_new_stream(struct snd_pcm_substream 
*substream,
return ret;
 }
 
+static const uint8_t *eld_sad(const uint8_t *eld)
+{
+   unsigned int ver, mnl;
+
+   ver = (eld[DRM_ELD_VER]  DRM_ELD_VER_MASK)  DRM_ELD_VER_SHIFT;
+   if (ver != 2  ver != 31)
+   return NULL;
+
+   mnl = drm_eld_mnl(eld);
+   if (mnl  16)
+   return NULL;
+
+   return eld + DRM_ELD_CEA_SAD(mnl, 0);
+}
+
+static const unsigned int eld_rates[] = {
+   32000,
+   44100,
+   48000,
+   88200,
+   96000,
+   176400,
+   192000,
+};
+
+static int eld_limit_rates(struct snd_pcm_hw_params *params,
+  struct snd_pcm_hw_rule *rule)
+{
+   struct snd_interval *r = hw_param_interval(params, rule-var);
+   unsigned int rate_mask = 7, i;
+   const u8 *sad, *eld = rule-private;
+
+   sad = eld_sad(eld);
+   if (sad) {
+   for (i = drm_eld_sad_count(eld); i  0; i--, sad += 3) {
+   unsigned channels = 1 + (sad[0]  7);
+
+   /*
+* Exclude SADs which do not include the
+* requested number of channels.
+*/
+   if (params_channels(params) == channels)
+   rate_mask |= sad[1];
+   }
+   }
+
+   return snd_interval_list(r, ARRAY_SIZE(eld_rates), eld_rates,
+rate_mask);
+}
+
+static int eld_limit_channels(struct snd_pcm_hw_params *params,
+ struct snd_pcm_hw_rule *rule)
+{
+   struct snd_interval *var = hw_param_interval(params, rule-var);
+   struct snd_interval t = { .min = 1, .max = 2, .integer = 1, };
+   unsigned int i, j;
+   const u8 *sad, *eld = rule-private;
+   int rate = params_rate(params);
+
+   sad = eld_sad(eld);
+   if (!sad)
+   return 0;
+
+   for (i = drm_eld_sad_count(eld); i  0; i--, sad += 3) {
+   for (j = 0; j  ARRAY_SIZE(eld_rates); j++) {
+   if ((sad[1]  (1j))  rate == eld_rates[j]) {
+   switch (sad[0]  0x78) {
+   case 0x08:
+   t.max = max(t.max, (sad[0]  7) + 1u);
+   break;
+   }
+   }
+   }
+   }
+
+   return snd_interval_refine(var, t);
+}
+
+static int hdmi_codec_constraint_eld(struct snd_pcm_runtime *runtime, void 
*eld)
+{
+   int ret;
+
+   ret = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
+ eld_limit_rates, eld,
+ SNDRV_PCM_HW_PARAM_RATE,
+ SNDRV_PCM_HW_PARAM_CHANNELS, -1);
+   if (ret  0)
+   return ret;
+
+   ret = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
+ eld_limit_channels, eld,
+ SNDRV_PCM_HW_PARAM_CHANNELS,
+ SNDRV_PCM_HW_PARAM_RATE, -1);
+
+   return ret;
+}
+
 static int hdmi_codec_startup(struct snd_pcm_substream *substream,
  struct snd_soc_dai *dai)
 {
@@ -104,7 +201,12 @@ static int hdmi_codec_startup(struct snd_pcm_substream 
*substream,
if (hcp-hcd.ops-get_eld) {
hcp-eld = hcp-hcd.ops-get_eld(hcp-hcd.dev);
 
-   /* Call snd_pcm_hw_constraint_eld here */
+   if (hcp-eld) {
+   ret = hdmi_codec_constraint_eld(substream-runtime,
+   hcp-eld);
+   if (ret)
+   return ret;
+   }
}
return 0;
 }
-- 
1.9.1

--
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 RFC v2 3/7] ASoC: hdmi-codec: Add hdmi-codec for external HDMI-encoders

2015-05-26 Thread Jyri Sarha
The hdmi-codec is a platform device driver to be registered from
drivers of external HDMI encoders with I2S and/or spdif interface. The
driver in turn registers an ASoC codec for the encoder's audio
functionality.

The structures and definitions in the API header are mostly redundant
copies of similar structures in ASoC headers. This is on purpose to
avoid direct dependencies to ASoC structures in video side driver.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 include/sound/hdmi-codec.h|  99 +
 sound/soc/codecs/Kconfig  |   4 +
 sound/soc/codecs/Makefile |   2 +
 sound/soc/codecs/hdmi-codec.c | 458 ++
 4 files changed, 563 insertions(+)
 create mode 100644 include/sound/hdmi-codec.h
 create mode 100644 sound/soc/codecs/hdmi-codec.c

diff --git a/include/sound/hdmi-codec.h b/include/sound/hdmi-codec.h
new file mode 100644
index 000..0632bcb
--- /dev/null
+++ b/include/sound/hdmi-codec.h
@@ -0,0 +1,99 @@
+/*
+ * hdmi-codec.h - HDMI Codec driver API
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Author: Jyri Sarha jsa...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#ifndef __HDMI_CODEC_H__
+#define __HDMI_CODEC_H__
+
+#include linux/hdmi.h
+#include drm/drm_edid.h
+#include sound/asoundef.h
+#include uapi/sound/asound.h
+
+/*
+ * Protocol between ASoC cpu-dai and HDMI-encoder
+ */
+struct hdmi_codec_daifmt {
+   enum {
+   HDMI_I2S,
+   HDMI_RIGHT_J,
+   HDMI_LEFT_J,
+   HDMI_DSP_A,
+   HDMI_DSP_B,
+   HDMI_AC97,
+   HDMI_SPDIF,
+   } fmt;
+   int bit_clk_inv:1;
+   int frame_clk_inv:1;
+   int bit_clk_master:1;
+   int frame_clk_master:1;
+};
+
+/*
+ * HDMI audio parameters
+ */
+struct hdmi_codec_params {
+   struct hdmi_audio_infoframe cea;
+   struct snd_aes_iec958 iec;
+   int sample_rate;
+   int sample_width;
+   int channels;
+};
+
+struct hdmi_codec_ops {
+   /* For runtime clock configuration from ASoC machine driver.
+* A direct forward from set_sysclk in struct snd_soc_dai_ops.
+* Optional */
+   int (*set_clk)(struct device *dev, int clk_id, int freq);
+
+   /* Called when ASoC starts an audio stream setup. The call
+* provides an audio abort callback for stoping an ongoing
+* stream if the HDMI audio becomes unavailable.
+* Optional */
+   int (*audio_startup)(struct device *dev,
+void (*abort_cb)(struct device *dev));
+
+   /* Configures HDMI-encoder for audio stream.
+* Mandatory */
+   int (*hw_params)(struct device *dev,
+struct hdmi_codec_daifmt *fmt,
+struct hdmi_codec_params *hparms);
+
+   /* Shuts down the audio stream.
+* Mandatory */
+   void (*audio_shutdown)(struct device *dev);
+
+   /* Mute/unmute HDMI audio stream.
+* Optional */
+   int (*digital_mute)(struct device *dev, bool enable);
+
+   /* Provides EDID-Like-Data from connected HDMI device.
+* Optional */
+   uint8_t *(*get_eld)(struct device *dev);
+};
+
+/* HDMI codec initalization data */
+struct hdmi_codec_pdata {
+   struct device *dev; /* The HDMI encoder registering the codec */
+   const struct hdmi_codec_ops *ops;
+   uint i2s:1;
+   uint spdif:1;
+   int max_i2s_channels;
+};
+
+#define HDMI_CODEC_DRV_NAME hdmi-audio-codec
+
+#endif /* __HDMI_CODEC_H__ */
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index fb7f978..ef9646f 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -76,6 +76,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_MAX9877 if I2C
select SND_SOC_MC13783 if MFD_MC13XXX
select SND_SOC_ML26124 if I2C
+   select SND_SOC_HDMI_CODEC
select SND_SOC_PCM1681 if I2C
select SND_SOC_PCM1792A if SPI_MASTER
select SND_SOC_PCM3008
@@ -429,6 +430,9 @@ config SND_SOC_BT_SCO
 config SND_SOC_DMIC
tristate
 
+config SND_SOC_HDMI_CODEC
+   tristate
+
 config SND_SOC_ES8328
tristate Everest Semi ES8328 CODEC
 
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 4e5d17c..a128c2b 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -69,6 +69,7 @@ snd-soc-max98925-objs := max98925.o
 snd-soc-max9850-objs := max9850.o
 snd-soc-mc13783-objs := mc13783.o
 snd-soc-ml26124-objs := ml26124.o
+snd-soc-hdmi-codec-objs := hdmi-codec.o

[PATCH RFC v2 6/7] drm/i2c: tda998x: Register ASoC HDMI codec for audio functionality DO NOT MERGE

2015-05-26 Thread Jyri Sarha
This patch is here to demonstrate how to use the ASoC hdmi-codec to
implement ASoC codec API in tda998x driver.

I do not have proper documentation for tda998x family chips so I lack
the necessary information for making a decent binding for audio part
of the chip. In stead I use binding from Jean-Francois Moine's ASoC:
tda998x: add a codec to the HDMI transmitter patch series.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/gpu/drm/i2c/Kconfig   |   1 +
 drivers/gpu/drm/i2c/tda998x_drv.c | 238 ++
 2 files changed, 239 insertions(+)

diff --git a/drivers/gpu/drm/i2c/Kconfig b/drivers/gpu/drm/i2c/Kconfig
index 22c7ed6..088f278 100644
--- a/drivers/gpu/drm/i2c/Kconfig
+++ b/drivers/gpu/drm/i2c/Kconfig
@@ -28,6 +28,7 @@ config DRM_I2C_SIL164
 config DRM_I2C_NXP_TDA998X
tristate NXP Semiconductors TDA998X HDMI encoder
default m if DRM_TILCDC
+   select SND_SOC_HDMI_CODEC if SND_SOC
help
  Support for NXP Semiconductors TDA998X HDMI encoders.
 
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index bcf96f7..3c38911 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -20,6 +20,7 @@
 #include linux/module.h
 #include linux/irq.h
 #include sound/asoundef.h
+#include sound/hdmi-codec.h
 
 #include drm/drmP.h
 #include drm/drm_crtc_helper.h
@@ -45,6 +46,9 @@ struct tda998x_priv {
u8 vip_cntrl_2;
struct tda998x_encoder_params params;
 
+   struct platform_device *audio_pdev;
+   uint8_t eld[MAX_ELD_BYTES];
+
wait_queue_head_t wq_edid;
volatile int wq_edid_wait;
struct drm_encoder *encoder;
@@ -1120,6 +1124,9 @@ tda998x_encoder_get_modes(struct tda998x_priv *priv,
drm_mode_connector_update_edid_property(connector, edid);
n = drm_add_edid_modes(connector, edid);
priv-is_hdmi_sink = drm_detect_hdmi_monitor(edid);
+   drm_edid_to_eld(connector, edid);
+   memcpy(priv-eld, connector-eld, sizeof(priv-eld));
+
kfree(edid);
 
return n;
@@ -1156,6 +1163,9 @@ static void tda998x_destroy(struct tda998x_priv *priv)
}
 
i2c_unregister_device(priv-cec);
+
+   if (priv-audio_pdev)
+   platform_device_unregister(priv-audio_pdev);
 }
 
 /* Slave encoder support */
@@ -1230,6 +1240,230 @@ static struct drm_encoder_slave_funcs 
tda998x_encoder_slave_funcs = {
.set_property = tda998x_encoder_set_property,
 };
 
+static int
+tda998x_configure_audio2(struct tda998x_priv *priv,
+   int mode_clock,
+   int ena_ap,
+   struct hdmi_codec_params *params,
+   struct hdmi_codec_daifmt *daifmt)
+{
+   uint8_t buf[6], clksel_aip, clksel_fs, cts_n, adiv;
+   uint8_t infoframe_buf[HDMI_INFOFRAME_SIZE(AUDIO)];
+   int infoframe_len;
+   uint32_t n;
+
+   infoframe_len = hdmi_audio_infoframe_pack(params-cea, infoframe_buf,
+ sizeof(infoframe_buf));
+   if (infoframe_len  0) {
+   dev_err(priv-hdmi-dev,
+   Failed to pack audio infoframe: %d\n,
+   infoframe_len);
+   return infoframe_len;
+   }
+
+   /* Enable audio ports */
+   reg_write(priv, REG_ENA_AP, ena_ap);
+   reg_write(priv, REG_ENA_ACLK, daifmt-fmt == HDMI_SPDIF ? 0 : 1);
+
+   /* Set audio input source */
+   switch (daifmt-fmt) {
+   case HDMI_SPDIF:
+   reg_write(priv, REG_MUX_AP, MUX_AP_SELECT_SPDIF);
+   clksel_aip = AIP_CLKSEL_AIP_SPDIF;
+   clksel_fs = AIP_CLKSEL_FS_FS64SPDIF;
+   cts_n = CTS_N_M(3) | CTS_N_K(3);
+   break;
+
+   case HDMI_I2S:
+   reg_write(priv, REG_MUX_AP, MUX_AP_SELECT_I2S);
+   clksel_aip = AIP_CLKSEL_AIP_I2S;
+   clksel_fs = AIP_CLKSEL_FS_ACLK;
+   switch (params-sample_width) {
+   case 16:
+   cts_n = CTS_N_M(3) | CTS_N_K(1);
+   break;
+   case 18:
+   case 20:
+   case 24:
+   cts_n = CTS_N_M(3) | CTS_N_K(2);
+   break;
+   default:
+   case 32:
+   cts_n = CTS_N_M(3) | CTS_N_K(3);
+   break;
+   }
+   break;
+
+   default:
+   dev_err(priv-hdmi-dev, Unsupported I2S format\n);
+   return -EINVAL;
+   }
+
+   reg_write(priv, REG_AIP_CLKSEL, clksel_aip);
+   reg_clear(priv, REG_AIP_CNTRL_0, AIP_CNTRL_0_LAYOUT |
+   AIP_CNTRL_0_ACR_MAN);   /* auto CTS */
+   reg_write(priv, REG_CTS_N, cts_n);
+
+   /*
+* Audio input somehow depends on HDMI line rate which is
+* related to pixclk. Testing showed that modes with 

[PATCH RFC v2 0/7] Implement generic ASoC HDMI codec

2015-05-26 Thread Jyri Sarha
Only the first three patches are meant for serious review.

The ASoC part should be ready for review in other respects but the
EDID SADs handling is waiting for Russell King's DRM ELD helper
patches. There is a copy-pasted not-to-be-merged patch with the same
functionality in the patch series.

The tda998x part is not complete and I do not think Jean-Francois'
binding are ready as such either. At least the usage of reg property in
a port node for something that is not an address or even guaranteed to
be unique is not a good idea. Some documentation of how to configure
AP0-AP4 pins (REG_ENA_AP?) would help in making a proper binding for
the tda998x audio configuration.

These patches, my tilcdc refactoring[1], and my latest BCLK fixes for
davinci-mcasp driver [2], can be found in a branch that produces
working HDMI audio on Beaglebone-Black here:

https://github.com/jsarha/linux.git linux-master-bbb-hdmi-20150512

[1] http://lists.freedesktop.org/archives/dri-devel/2015-May/082537.html
[2] http://mailman.alsa-project.org/pipermail/alsa-devel/2015-April/090974.html

Jean-Francois Moine (1):
  drm/i2c: tda998x: Add support of a DT graph of ports DO NOT MERGE

Jyri Sarha (6):
  ASoC: core: If component doesn't have of_node use parent's node
instead
  ASoC: hdmi: Remove obsolete dummy HDMI codec
  ASoC: hdmi-codec: Add hdmi-codec for external HDMI-encoders
  ASoC: hdmi-codec: Add ELD based audio pcm rules DO NOT MERGE
  drm/i2c: tda998x: Register ASoC HDMI codec for audio functionality DO
NOT MERGE
  ARM: dts: am335x-boneblack: Add HDMI audio support DO NOT MERGE

 .../devicetree/bindings/drm/i2c/tda998x.txt|  51 ++
 arch/arm/boot/dts/am335x-boneblack.dts |  78 ++-
 drivers/gpu/drm/i2c/Kconfig|   1 +
 drivers/gpu/drm/i2c/tda998x_drv.c  | 328 +++-
 include/sound/hdmi-codec.h |  99 
 include/sound/tda998x.h|   8 +
 sound/soc/codecs/Kconfig   |   2 +-
 sound/soc/codecs/Makefile  |   4 +-
 sound/soc/codecs/hdmi-codec.c  | 560 +
 sound/soc/codecs/hdmi.c| 109 
 sound/soc/soc-core.c   |  14 +-
 11 files changed, 1129 insertions(+), 125 deletions(-)
 create mode 100644 include/sound/hdmi-codec.h
 create mode 100644 include/sound/tda998x.h
 create mode 100644 sound/soc/codecs/hdmi-codec.c
 delete mode 100644 sound/soc/codecs/hdmi.c

-- 
1.9.1

--
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 RFC v2 1/7] ASoC: core: If component doesn't have of_node use parent's node instead

2015-05-26 Thread Jyri Sarha
If an ASoC component device does not have a device tree node, use its
parent's node instead, when looking for a matching DAI based on a
device tree reference.

This allows video device drivers to register a separate child device
for their ASoC side audio functionality.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 sound/soc/soc-core.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 2373252..b1bcff2 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -904,12 +904,17 @@ static struct snd_soc_dai *snd_soc_find_dai(
 {
struct snd_soc_component *component;
struct snd_soc_dai *dai;
+   struct device_node *component_of_node;
 
lockdep_assert_held(client_mutex);
 
/* Find CPU DAI from registered DAIs*/
list_for_each_entry(component, component_list, list) {
-   if (dlc-of_node  component-dev-of_node != dlc-of_node)
+   component_of_node = component-dev-of_node;
+   if (!component_of_node  component-dev-parent)
+   component_of_node = component-dev-parent-of_node;
+
+   if (dlc-of_node  component_of_node != dlc-of_node)
continue;
if (dlc-name  strcmp(component-name, dlc-name))
continue;
@@ -3488,11 +3493,16 @@ static int snd_soc_get_dai_name(struct of_phandle_args 
*args,
const char **dai_name)
 {
struct snd_soc_component *pos;
+   struct device_node *component_of_node;
int ret = -EPROBE_DEFER;
 
mutex_lock(client_mutex);
list_for_each_entry(pos, component_list, list) {
-   if (pos-dev-of_node != args-np)
+   component_of_node = pos-dev-of_node;
+   if (!component_of_node  pos-dev-parent)
+   component_of_node = pos-dev-parent-of_node;
+
+   if (component_of_node != args-np)
continue;
 
if (pos-driver-of_xlate_dai_name) {
-- 
1.9.1

--
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 RFC v2 2/7] ASoC: hdmi: Remove obsolete dummy HDMI codec

2015-05-26 Thread Jyri Sarha
The hdmi stub codec has not been used since refactoring of OMAP HDMI
audio support.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 sound/soc/codecs/Kconfig  |   4 --
 sound/soc/codecs/Makefile |   2 -
 sound/soc/codecs/hdmi.c   | 109 --
 3 files changed, 115 deletions(-)
 delete mode 100644 sound/soc/codecs/hdmi.c

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 061c465..fb7f978 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -76,7 +76,6 @@ config SND_SOC_ALL_CODECS
select SND_SOC_MAX9877 if I2C
select SND_SOC_MC13783 if MFD_MC13XXX
select SND_SOC_ML26124 if I2C
-   select SND_SOC_HDMI_CODEC
select SND_SOC_PCM1681 if I2C
select SND_SOC_PCM1792A if SPI_MASTER
select SND_SOC_PCM3008
@@ -430,9 +429,6 @@ config SND_SOC_BT_SCO
 config SND_SOC_DMIC
tristate
 
-config SND_SOC_HDMI_CODEC
-   tristate HDMI stub CODEC
-
 config SND_SOC_ES8328
tristate Everest Semi ES8328 CODEC
 
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index abe2d7e..4e5d17c 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -69,7 +69,6 @@ snd-soc-max98925-objs := max98925.o
 snd-soc-max9850-objs := max9850.o
 snd-soc-mc13783-objs := mc13783.o
 snd-soc-ml26124-objs := ml26124.o
-snd-soc-hdmi-codec-objs := hdmi.o
 snd-soc-pcm1681-objs := pcm1681.o
 snd-soc-pcm1792a-codec-objs := pcm1792a.o
 snd-soc-pcm3008-objs := pcm3008.o
@@ -254,7 +253,6 @@ obj-$(CONFIG_SND_SOC_MAX98925)  += snd-soc-max98925.o
 obj-$(CONFIG_SND_SOC_MAX9850)  += snd-soc-max9850.o
 obj-$(CONFIG_SND_SOC_MC13783)  += snd-soc-mc13783.o
 obj-$(CONFIG_SND_SOC_ML26124)  += snd-soc-ml26124.o
-obj-$(CONFIG_SND_SOC_HDMI_CODEC) += snd-soc-hdmi-codec.o
 obj-$(CONFIG_SND_SOC_PCM1681)  += snd-soc-pcm1681.o
 obj-$(CONFIG_SND_SOC_PCM1792A) += snd-soc-pcm1792a-codec.o
 obj-$(CONFIG_SND_SOC_PCM3008)  += snd-soc-pcm3008.o
diff --git a/sound/soc/codecs/hdmi.c b/sound/soc/codecs/hdmi.c
deleted file mode 100644
index bd42ad3..000
--- a/sound/soc/codecs/hdmi.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * ALSA SoC codec driver for HDMI audio codecs.
- * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
- * Author: Ricardo Neri ricardo.n...@ti.com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-#include linux/module.h
-#include sound/soc.h
-#include linux/of.h
-#include linux/of_device.h
-
-#define DRV_NAME hdmi-audio-codec
-
-static const struct snd_soc_dapm_widget hdmi_widgets[] = {
-   SND_SOC_DAPM_INPUT(RX),
-   SND_SOC_DAPM_OUTPUT(TX),
-};
-
-static const struct snd_soc_dapm_route hdmi_routes[] = {
-   { Capture, NULL, RX },
-   { TX, NULL, Playback },
-};
-
-static struct snd_soc_dai_driver hdmi_codec_dai = {
-   .name = hdmi-hifi,
-   .playback = {
-   .stream_name = Playback,
-   .channels_min = 2,
-   .channels_max = 8,
-   .rates = SNDRV_PCM_RATE_32000 |
-   SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
-   SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 |
-   SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000,
-   .formats = SNDRV_PCM_FMTBIT_S16_LE |
-   SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE,
-   .sig_bits = 24,
-   },
-   .capture = {
-   .stream_name = Capture,
-   .channels_min = 2,
-   .channels_max = 2,
-   .rates = SNDRV_PCM_RATE_32000 |
-   SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
-   SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 |
-   SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000,
-   .formats = SNDRV_PCM_FMTBIT_S16_LE |
-   SNDRV_PCM_FMTBIT_S24_LE,
-   },
-
-};
-
-#ifdef CONFIG_OF
-static const struct of_device_id hdmi_audio_codec_ids[] = {
-   { .compatible = linux,hdmi-audio, },
-   { }
-};
-MODULE_DEVICE_TABLE(of, hdmi_audio_codec_ids);
-#endif
-
-static struct snd_soc_codec_driver hdmi_codec = {
-   .dapm_widgets = hdmi_widgets,
-   .num_dapm_widgets = ARRAY_SIZE(hdmi_widgets),
-   .dapm_routes = hdmi_routes,
-   .num_dapm_routes = ARRAY_SIZE(hdmi_routes),
-   .ignore_pmdown_time 

[PATCH RFC v2 5/7] drm/i2c: tda998x: Add support of a DT graph of ports DO NOT MERGE

2015-05-26 Thread Jyri Sarha
From: Jean-Francois Moine moin...@free.fr

Two kinds of ports may be declared in a DT graph of ports: video and audio.
This patch accepts the port value from a video port as an alternative
to the video-ports property.
It also accepts audio ports in the case the transmitter is not used as
a slave encoder.
The new file include/sound/tda998x.h prepares to the definition of
a tda998x CODEC.

Signed-off-by: Jean-Francois Moine moin...@free.fr
Signed-off-by: Jyri Sarha jsa...@ti.com
---
 .../devicetree/bindings/drm/i2c/tda998x.txt| 51 
 drivers/gpu/drm/i2c/tda998x_drv.c  | 90 +++---
 include/sound/tda998x.h|  8 ++
 3 files changed, 140 insertions(+), 9 deletions(-)
 create mode 100644 include/sound/tda998x.h

diff --git a/Documentation/devicetree/bindings/drm/i2c/tda998x.txt 
b/Documentation/devicetree/bindings/drm/i2c/tda998x.txt
index e9e4bce..386b6c3 100644
--- a/Documentation/devicetree/bindings/drm/i2c/tda998x.txt
+++ b/Documentation/devicetree/bindings/drm/i2c/tda998x.txt
@@ -16,6 +16,35 @@ Optional properties:
 
   - video-ports: 24 bits value which defines how the video controller
output is wired to the TDA998x input - default: 0x230145
+   This property is not used when ports are defined.
+
+Optional nodes:
+
+  - port: up to three ports.
+   The ports are defined according to [1].
+
+Video port.
+   There may be only one video port.
+   This one must contain the following property:
+
+   - port-type: must be rgb
+
+   and may contain the optional property:
+
+   - reg: 24 bits value which defines how the video controller
+   output is wired to the TDA998x input (video pins)
+   When absent, the default value is 0x230145.
+
+Audio ports.
+   There may be one or two audio ports.
+   These ones must contain the following properties:
+
+   - port-type: must be i2s or spdif
+
+   - reg: 8 bits value which defines how the audio controller
+   output is wired to the TDA998x input (audio pins)
+
+[1] Documentation/devicetree/bindings/graph.txt
 
 Example:
 
@@ -26,4 +55,26 @@ Example:
interrupts = 27 2;/* falling edge */
pinctrl-0 = pmx_camera;
pinctrl-names = default;
+
+   port at 230145 {
+   port-type = rgb;
+   reg = 0x230145;
+   hdmi_0: endpoint {
+   remote-endpoint = lcd0_0;
+   };
+   };
+   port at 3 { /* AP1 = I2S */
+   port-type = i2s;
+   reg = 0x03;
+   tda998x_i2s: endpoint {
+   remote-endpoint = audio1_i2s;
+   };
+   };
+   port at 4 {  /* AP2 = S/PDIF */
+   port-type = spdif;
+   reg = 0x04;
+   tda998x_spdif: endpoint {
+   remote-endpoint = audio1_spdif1;
+   };
+   };
};
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 5febffd..bcf96f7 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -27,6 +27,7 @@
 #include drm/drm_edid.h
 #include drm/drm_of.h
 #include drm/i2c/tda998x.h
+#include sound/tda998x.h
 
 #define DBG(fmt, ...) DRM_DEBUG(fmt\n, ##__VA_ARGS__)
 
@@ -47,6 +48,8 @@ struct tda998x_priv {
wait_queue_head_t wq_edid;
volatile int wq_edid_wait;
struct drm_encoder *encoder;
+
+   struct tda998x_audio_s audio;
 };
 
 #define to_tda998x_priv(x)  ((struct tda998x_priv 
*)to_encoder_slave(x)-slave_priv)
@@ -771,6 +774,8 @@ static void tda998x_encoder_set_config(struct tda998x_priv 
*priv,
(p-mirr_f ? VIP_CNTRL_2_MIRR_F : 0);
 
priv-params = *p;
+   priv-audio.port_types[0] = p-audio_format;
+   priv-audio.ports[0] = p-audio_cfg;
 }
 
 static void tda998x_encoder_dpms(struct tda998x_priv *priv, int mode)
@@ -1227,9 +1232,57 @@ static struct drm_encoder_slave_funcs 
tda998x_encoder_slave_funcs = {
 
 /* I2C driver functions */
 
+static int tda998x_parse_ports(struct tda998x_priv *priv,
+   struct device_node *np)
+{
+   struct device_node *of_port;
+   const char *port_type;
+   int ret, audio_index, reg, afmt;
+
+   audio_index = 0;
+   for_each_child_of_node(np, of_port) {
+   if (!of_port-name
+|| of_node_cmp(of_port-name, port) != 0)
+   continue;
+   ret = of_property_read_string(of_port, port-type,
+   port_type);
+   if (ret  0)
+   continue;
+   ret = 

[PATCH RFC v2 7/7] ARM: dts: am335x-boneblack: Add HDMI audio support DO NOT MERGE

2015-05-26 Thread Jyri Sarha
This patch is here only to demonstrate HDMI codec functionality on
Beaglebone-Black.

Adds mcasp0_pins, clk_mcasp0_fixed, clk_mcasp0, mcasp0, sound node,
and changes the tda19988 node to follow the new binding.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 arch/arm/boot/dts/am335x-boneblack.dts | 78 +-
 1 file changed, 76 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/am335x-boneblack.dts 
b/arch/arm/boot/dts/am335x-boneblack.dts
index eadbba3..8a8abf5 100644
--- a/arch/arm/boot/dts/am335x-boneblack.dts
+++ b/arch/arm/boot/dts/am335x-boneblack.dts
@@ -64,6 +64,16 @@
0x1b0 0x03  /* xdma_event_intr0, OMAP_MUX_MODE3 | 
AM33XX_PIN_OUTPUT */
;
};
+
+   mcasp0_pins: mcasp0_pins {
+   pinctrl-single,pins = 
+   0x1ac (PIN_INPUT_PULLUP | MUX_MODE0)/* 
mcasp0_ahclkx.mcasp0_ahclkx */
+   0x19c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* 
mcasp0_ahclkr.mcasp0_axr2 */
+   0x194 (PIN_OUTPUT_PULLUP | MUX_MODE0)   /* 
mcasp0_fsx.mcasp0_fsx */
+   0x190 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* 
mcasp0_aclkx.mcasp0_aclkx */
+   0x06c (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* 
gpmc_a11.GPIO1_27 */
+   ;
+   };
 };
 
 lcdc {
@@ -76,21 +86,85 @@
 };
 
 i2c0 {
-   tda19988 {
+   tda19988: tda19988 {
compatible = nxp,tda998x;
reg = 0x70;
+
+   #sound-dai-cells = 0;
+
pinctrl-names = default, off;
pinctrl-0 = nxp_hdmi_bonelt_pins;
pinctrl-1 = nxp_hdmi_bonelt_off_pins;
 
-   port {
+   port@0 {
+   port-type = rgb;
+   reg = 0x230145;
hdmi_0: endpoint@0 {
remote-endpoint = lcdc_0;
};
};
+   port@1 {
+   port-type = i2s;
+   reg = 0x03;
+   tda19988_i2s: endpoint {
+   remote-endpoint = mcasp0_i2s;
+   };
+   };
};
 };
 
 rtc {
system-power-controller;
 };
+
+mcasp0{
+   #sound-dai-cells = 0;
+   pinctrl-names = default;
+   pinctrl-0 = mcasp0_pins;
+   status = okay;
+   op-mode = 0;  /* MCASP_IIS_MODE */
+   tdm-slots = 2;
+   serial-dir =   /* 0: INACTIVE, 1: TX, 2: RX */
+   0 0 1 0
+   ;
+   tx-num-evt = 1;
+   rx-num-evt = 1;
+
+   port {
+   mcasp0_i2s: endpoint {
+   remote-endpoint = tda19988_i2s;
+   };
+   };
+};
+
+/ {
+   clk_mcasp0_fixed: clk_mcasp0_fixed {
+   #clock-cells = 0;
+   compatible = fixed-clock;
+   clock-frequency = 24576000;
+   };
+
+   clk_mcasp0: clk_mcasp0 {
+   #clock-cells = 0;
+   compatible = gpio-gate-clock;
+   clocks = clk_mcasp0_fixed;
+   enable-gpios = gpio1 27 0; /* BeagleBone Black Clk enable on 
GPIO1_27 */
+   };
+
+   sound {
+   compatible = simple-audio-card;
+   simple-audio-card,name = TI BeagleBone Black;
+   simple-audio-card,format = i2s;
+   simple-audio-card,bitclock-master = dailink0_master;
+   simple-audio-card,frame-master = dailink0_master;
+
+   dailink0_master: simple-audio-card,cpu {
+   sound-dai = mcasp0;
+   clocks = clk_mcasp0;
+   };
+
+   simple-audio-card,codec {
+   sound-dai = tda19988;
+   };
+   };
+};
-- 
1.9.1

--
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: simple-framebuffer: ioremap_wc() fails

2015-05-26 Thread Tony Lindgren
* Peter Kuemmel syntheti...@gmx.net [150523 03:51]:
 Hello,
 
 I have a problems when using simple-framebuffer: re-using the memory provided 
 by u-boot fails when calling ioremap_wc() in simplefb.c:
 
 [0.370025] [ cut here ]
 [0.370086] WARNING: CPU: 0 PID: 1 at arch/arm/mm/ioremap.c:301 
 __arm_ioremap_pfn_caller+0x220/0x234()
 [0.370086] Modules linked in:
 [0.370117] CPU: 0 PID: 1 Comm: swapper Not tainted 4.1.0-rc4 #1
 [0.370117] Hardware name: Generic OMAP36xx (Flattened Device Tree)
 [0.370117] Backtrace:
 [0.370178] [c00198a0] (show_stack) from [c04ded24] 
 (dump_stack+0x24/0x28)
 [0.370178]  r5:012d r4:c066b608
 [0.370208] [c04ded00] (dump_stack) from [c003ca7c] 
 (warn_slowpath_null+0x78/0xe0)
 [0.370208] [c003ca04] (warn_slowpath_null) from [c001e07c] 
 (__arm_ioremap_pfn_caller+0x220/0x234)
 [0.370239]  r6:8380 r5: r4:00083800
 [0.370239] [c001de5c] (__arm_ioremap_pfn_caller) from [c001e0e4] 
 (__arm_ioremap_caller+0x54/0x5c)
 [0.370269]  r10:c0653900 r9:c065390c r8:c3b11210 r7:c3aaa264 r6: 
 r5:c3b11200
 [0.370269]  r4:0003 r3:0003
 [0.370300] [c001e090] (__arm_ioremap_caller) from [c001db80] 
 (__arm_ioremap+0x20/0x24)
 [0.370300]  r4:c3aaa000
 [0.370330] [c001db60] (__arm_ioremap) from [c02f2c44] 
 (simplefb_probe+0x1d8/0x82c)
 [0.370361] [c02f2a6c] (simplefb_probe) from [c033e8a8] 
 (platform_drv_probe+0x4c/0xac)
 [0.370361]  r10: r9: r8:c0653740 r7:fdfb r6:c0653740 
 r5:c3b11210
 [0.370391]  r4:c067dcf0
 [0.370391] [c033e85c] (platform_drv_probe) from [c033d068] 
 (driver_probe_device+0x2fc/0x388)
 [0.370422]  r7:c3b11218 r6: r5:c3b11210 r4:c067dcf0
 [0.370452] [c033cd6c] (driver_probe_device) from [c033d13c] 
 (__device_attach+0x48/0x4c)
 [0.370452]  r9:c067dccc r8:c3b11210 r7:c0657a54 r6:c033d0f4 r5:c3b11210 
 r4:c0653740
 [0.370483] [c033d0f4] (__device_attach) from [c033a958] 
 (bus_for_each_drv+0x6c/0xa0)
 [0.370483]  r5:c3b11210 r4:
 [0.370513] [c033a8ec] (bus_for_each_drv) from [c033cacc] 
 (device_attach+0xb0/0x108)
 [0.370513]  r6:c0657d08 r5:c3b11244 r4:c3b11210
 [0.370544] [c033ca1c] (device_attach) from [c033c16c] 
 (bus_probe_device+0x8c/0xb0)
 [0.370544]  r6:c0657d08 r5:c3b11210 r4:c3b11218 r3:c3830f00
 [0.370574] [c033c0e0] (bus_probe_device) from [c03395c4] 
 (device_add+0x574/0x85c)
 [0.370574]  r6: r5:c0657bc8 r4:c3b11218 r3:0001
 [0.370605] [c0339050] (device_add) from [c03dd680] 
 (of_device_add+0x3c/0x44)
 [0.370635]  r10: r9:c06065f0 r8:005f r7:c3b11210 r6:c3e3aad8 
 r5:
 [0.370635]  r4:c3b11200
 [0.370666] [c03dd644] (of_device_add) from [c03de140] 
 (of_platform_device_create+0x84/0xc4)
 [0.370697] [c03de0bc] (of_platform_device_create) from [c06205b8] 
 (simplefb_init+0x5c/0x88)
 [0.370697]  r7:c062055c r6:c3b25400 r5:c067e260 r4:c3e3aad8
 [0.370727] [c062055c] (simplefb_init) from [c0009644] 
 (do_one_initcall+0x94/0x1dc)
 [0.370727]  r5:c063fa98 r4:c063fa98
 [0.370758] [c00095b0] (do_one_initcall) from [c0606dbc] 
 (kernel_init_freeable+0x12c/0x1d0)
 [0.370758]  r10:c06306ac r9:c06065f0 r8:005f r7:c066a640 r6:c066a640 
 r5:0005
 [0.370788]  r4:c063aca8
 [0.370788] [c0606c90] (kernel_init_freeable) from [c04dbee8] 
 (kernel_init+0x10/0x218)
 [0.370819]  r10: r9: r8: r7: r6: 
 r5:c04dbed8
 [0.370819]  r4:
 [0.370849] [c04dbed8] (kernel_init) from [c0016920] 
 (ret_from_fork+0x14/0x34)
 [0.370849]  r5:c04dbed8 r4:
 [0.370910] ---[ end trace 58eeb60b5f9cadf1 ]---
 [0.370941] simple-framebuffer: probe of 8380.framebuffer failed with 
 error -12
 
 I tried with 4.0 and 4.1, also tried with disabled omapfb/dss, but always the 
 same.
 
 dts looks like this:
 
  chosen {
  #address-cells = 1;
  #size-cells = 1;
  ranges;
 
  framebuffer@0 {
  compatible = simple-framebuffer;
  reg = 0x8380 (320 * 240 * 3);
  width = 320;
  height = 240;
  stride = (320 * 3);
  format = r8g8b8;
  display = lcd0;
  };
  };
 
 Is there any special to do in u-boot to make it work?
 u-boot shows a splash screen correctly.
 
 I saw in sunxi code is a workaround if ioremap_wc() fails,
 https://groups.google.com/forum/#!topic/linux-sunxi/C6pKdmKeZKY
 
 Is something similar also needed for the omap?

You need to reserve the memory section early with
memblock_reserve(). Then it's available to the driver to
map with pgprot_noncached or pgprot_writecombine and
vmap.

For an example how it can be done in a Linux generic way,
see fs/pstore/ram_core.c, it handles both the vmap and
ioremap case.

Regards,

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in

[PATCH 01/13] dmaengine: of_dma: Correct return code for of_dma_request_slave_channel in case !CONFIG_OF

2015-05-26 Thread Peter Ujfalusi
of_dma_request_slave_channel should return either pointer for valid
dma_chan or ERR_PTR() error code, NULL is not expected to be returned.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
CC: Grant Likely grant.lik...@linaro.org
CC: Rob Herring robh...@kernel.org
---
 include/linux/of_dma.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/of_dma.h b/include/linux/of_dma.h
index 98ba7525929e..0fd80be152c4 100644
--- a/include/linux/of_dma.h
+++ b/include/linux/of_dma.h
@@ -80,7 +80,7 @@ static inline int of_dma_router_register(struct device_node 
*np,
 static inline struct dma_chan *of_dma_request_slave_channel(struct device_node 
*np,
 const char *name)
 {
-   return NULL;
+   return ERR_PTR(-ENODEV);
 }
 
 static inline struct dma_chan *of_dma_simple_xlate(struct of_phandle_args 
*dma_spec,
-- 
2.3.5

--
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 05/13] mmc: omap_hsmmc: Support for deferred probing when requesting DMA channels

2015-05-26 Thread Peter Ujfalusi
Switch to use ma_request_slave_channel_compat_reason() to request the DMA
channels. In case of error, return the error code we received including
-EPROBE_DEFER

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
CC: Ulf Hansson ulf.hans...@linaro.org
---
 drivers/mmc/host/omap_hsmmc.c | 22 ++
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 57bb85930f81..d252478391ee 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2088,23 +2088,21 @@ static int omap_hsmmc_probe(struct platform_device 
*pdev)
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
 
-   host-rx_chan =
-   dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
-rx_req, pdev-dev, rx);
+   host-rx_chan = dma_request_slave_channel_compat_reason(mask,
+   omap_dma_filter_fn, rx_req, pdev-dev, rx);
 
-   if (!host-rx_chan) {
+   if (IS_ERR(host-rx_chan)) {
dev_err(mmc_dev(host-mmc), unable to obtain RX DMA engine 
channel %u\n, rx_req);
-   ret = -ENXIO;
+   ret = PTR_ERR(host-rx_chan);
goto err_irq;
}
 
-   host-tx_chan =
-   dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
-tx_req, pdev-dev, tx);
+   host-tx_chan = dma_request_slave_channel_compat_reason(mask,
+   omap_dma_filter_fn, tx_req, pdev-dev, tx);
 
-   if (!host-tx_chan) {
+   if (IS_ERR(host-tx_chan)) {
dev_err(mmc_dev(host-mmc), unable to obtain TX DMA engine 
channel %u\n, tx_req);
-   ret = -ENXIO;
+   ret = PTR_ERR(host-tx_chan);
goto err_irq;
}
 
@@ -2166,9 +2164,9 @@ err_slot_name:
if (host-use_reg)
omap_hsmmc_reg_put(host);
 err_irq:
-   if (host-tx_chan)
+   if (!IS_ERR_OR_NULL(host-tx_chan))
dma_release_channel(host-tx_chan);
-   if (host-rx_chan)
+   if (!IS_ERR_OR_NULL(host-rx_chan))
dma_release_channel(host-rx_chan);
pm_runtime_put_sync(host-dev);
pm_runtime_disable(host-dev);
-- 
2.3.5

--
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 03/13] serial: 8250_dma: Support for deferred probing when requesting DMA channels

2015-05-26 Thread Tony Lindgren
* Peter Ujfalusi peter.ujfal...@ti.com [150526 06:28]:
 Switch to use ma_request_slave_channel_compat_reason() to request the DMA
 channels. In case of error, return the error code we received including
 -EPROBE_DEFER
 
 Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
 CC: Greg Kroah-Hartman gre...@linuxfoundation.org
 ---
  drivers/tty/serial/8250/8250_dma.c | 18 --
  1 file changed, 8 insertions(+), 10 deletions(-)
 
 diff --git a/drivers/tty/serial/8250/8250_dma.c 
 b/drivers/tty/serial/8250/8250_dma.c
 index 21d01a491405..a617eca4e97d 100644
 --- a/drivers/tty/serial/8250/8250_dma.c
 +++ b/drivers/tty/serial/8250/8250_dma.c
 @@ -182,21 +182,19 @@ int serial8250_request_dma(struct uart_8250_port *p)
   dma_cap_set(DMA_SLAVE, mask);
  
   /* Get a channel for RX */
 - dma-rxchan = dma_request_slave_channel_compat(mask,
 -dma-fn, dma-rx_param,
 -p-port.dev, rx);
 - if (!dma-rxchan)
 - return -ENODEV;
 + dma-rxchan = dma_request_slave_channel_compat_reason(mask, dma-fn,
 + dma-rx_param, p-port.dev, rx);
 + if (IS_ERR(dma-rxchan))
 + return PTR_ERR(dma-rxchan);
  
   dmaengine_slave_config(dma-rxchan, dma-rxconf);
  
   /* Get a channel for TX */
 - dma-txchan = dma_request_slave_channel_compat(mask,
 -dma-fn, dma-tx_param,
 -p-port.dev, tx);
 - if (!dma-txchan) {
 + dma-txchan = dma_request_slave_channel_compat_reason(mask, dma-fn,
 + dma-tx_param, p-port.dev, tx);
 + if (IS_ERR(dma-txchan)) {
   dma_release_channel(dma-rxchan);
 - return -ENODEV;
 + return PTR_ERR(dma-txchan);
   }
  
   dmaengine_slave_config(dma-txchan, dma-txconf);

In general the drivers need to work just fine also without DMA.

Does this handle the case properly where no DMA channel is configured
for the driver in the dts file?

Regards,

Tony
--
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 03/13] serial: 8250_dma: Support for deferred probing when requesting DMA channels

2015-05-26 Thread Greg Kroah-Hartman
On Tue, May 26, 2015 at 04:25:58PM +0300, Peter Ujfalusi wrote:
 Switch to use ma_request_slave_channel_compat_reason() to request the DMA
 channels. In case of error, return the error code we received including
 -EPROBE_DEFER

I think you typed the function name wrong here :(

--
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 11/13] spi: omap2-mcspi: Support for deferred probing when requesting DMA channels

2015-05-26 Thread Mark Brown
On Tue, May 26, 2015 at 04:26:06PM +0300, Peter Ujfalusi wrote:

 Switch to use ma_request_slave_channel_compat_reason() to request the DMA
 channels. Only fall back to pio mode if the error code returned is not
 -EPROBE_DEFER, otherwise return from the probe with the -EPROBE_DEFER.

I've got two patches from a patch series here with no cover letter...
I'm guessing there's no interdependencies or anything?  Please always
ensure that when sending a patch series everyone getting the patches can
tell what the series as a whole looks like (if there's no dependencies
consider posting as individual patches rather than a series).


signature.asc
Description: Digital signature


Re: [PATCH 2/3] phy: ti-pipe3: i783 workaround for SATA lockup after dpll unlock/relock

2015-05-26 Thread Roger Quadros

Kishon,

On 23/05/15 10:22, Kishon Vijay Abraham I wrote:

Roger,

On Friday 22 May 2015 07:28 PM, Roger Quadros wrote:

Kishon,

On 22/05/15 14:34, Kishon Vijay Abraham I wrote:

Roger,

On Wednesday 20 May 2015 07:17 PM, Roger Quadros wrote:

Kishon,

On 20/05/15 16:19, Kishon Vijay Abraham I wrote:

Hi Roger,

On Tuesday 12 May 2015 09:37 PM, Roger Quadros wrote:

SATA_PLL_SOFT_RESET bit of CTRL_CORE_SMA_SW_0 must be toggled
between a SATA DPLL unlock and re-lock to prevent SATA lockup.

Introduce a new DT parameter 'syscon-pllreset' to provide the syscon
regmap access to this register which sits in the control module.

If the register is not provided we fallback to the old behaviour
i.e. SATA DPLL refclk will not be disabled and we prevent SoC low
power states.

Signed-off-by: Roger Quadros rog...@ti.com
---
Documentation/devicetree/bindings/phy/ti-phy.txt | 16 ++
drivers/phy/phy-ti-pipe3.c   | 67

2 files changed, 74 insertions(+), 9 deletions(-)

diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt
b/Documentation/devicetree/bindings/phy/ti-phy.txt
index 305e3df..f0f5537 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -82,6 +82,9 @@ Optional properties:
 - id: If there are multiple instance of the same type, in order to
   differentiate between each instance id can be used (e.g.,
multi-lane PCIe
   PHY). If id is not provided, it is set to default value of '1'.
+ - syscon-pllreset: Handle to system control region that contains the
+   CTRL_CORE_SMA_SW_0 register and register offset to the
CTRL_CORE_SMA_SW_0
+   register that contains the SATA_PLL_SOFT_RESET bit. Only valid for
sata_phy.

This is usually a subnode of ocp2scp to which it is connected.

@@ -100,3 +103,16 @@ usb3phy@4a084400 {
sysclk,
refclk;
};
+
+sata_phy: phy@4A096000 {
+compatible = ti,phy-pipe3-sata;
+reg = 0x4A096000 0x80, /* phy_rx */
+  0x4A096400 0x64, /* phy_tx */
+  0x4A096800 0x40; /* pll_ctrl */
+reg-names = phy_rx, phy_tx, pll_ctrl;
+ctrl-module = omap_control_sata;
+clocks = sys_clkin1, sata_ref_clk;
+clock-names = sysclk, refclk;
+syscon-pllreset = dra7_ctrl_core 0x3fc;
+#phy-cells = 0;
+};
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index e13a306..d730142 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -28,6 +28,8 @@
#include linux/delay.h
#include linux/phy/omap_control_phy.h
#include linux/of_platform.h
+#include linux/mfd/syscon.h
+#include linux/regmap.h

#definePLL_STATUS0x0004
#definePLL_GO0x0008
@@ -52,6 +54,8 @@
#definePLL_LOCK0x2
#definePLL_IDLE0x1

+#define SATA_PLL_SOFT_RESETBIT(18)
+
/*
 * This is an Empirical value that works, need to confirm the actual
 * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
@@ -82,6 +86,9 @@ struct ti_pipe3 {
struct clk*refclk;
struct clk*div_clk;
struct pipe3_dpll_map*dpll_map;
+struct regmap*dpll_reset_syscon; /* ctrl. reg. acces */
+unsigned intdpll_reset_reg; /* reg. index within syscon */
+boolsata_refclk_enabled;
};

static struct pipe3_dpll_map dpll_map_usb[] = {
@@ -249,11 +256,15 @@ static int ti_pipe3_exit(struct phy *x)
u32 val;
unsigned long timeout;

-/* SATA DPLL can't be powered down due to Errata i783 and PCIe
- * does not have internal DPLL
+/* If dpll_reset_syscon is not present we wont power down SATA DPLL
+ * due to Errata i783
 */
-if (of_device_is_compatible(phy-dev-of_node,
ti,phy-pipe3-sata) ||
-of_device_is_compatible(phy-dev-of_node, ti,phy-pipe3-pcie))
+if (of_device_is_compatible(phy-dev-of_node,
ti,phy-pipe3-sata) 
+!phy-dpll_reset_syscon)
+return 0;
+
+/* PCIe doesn't have DPLL. FIXME: need to disable clocks though */


I think it's better to fix it in this patch itself.. to disable clocks
for PCIe.

+if (of_device_is_compatible(phy-dev-of_node, ti,phy-pipe3-pcie))
return 0;

/* Put DPLL in IDLE mode */
@@ -276,6 +287,14 @@ static int ti_pipe3_exit(struct phy *x)
return -EBUSY;
}

+/* i783: SATA needs control bit toggle after PLL unlock */
+if (of_device_is_compatible(phy-dev-of_node,
ti,phy-pipe3-sata)) {
+regmap_update_bits(phy-dpll_reset_syscon, phy-dpll_reset_reg,
+SATA_PLL_SOFT_RESET, SATA_PLL_SOFT_RESET);
+regmap_update_bits(phy-dpll_reset_syscon, phy-dpll_reset_reg,
+SATA_PLL_SOFT_RESET, 0);
+}
+
ti_pipe3_disable_clocks(phy);

return 0;
@@ -350,6 +369,21 @@ static int ti_pipe3_probe(struct platform_device
*pdev)
}
} else {
   

[PATCH 00/13] dmaengine + omap drivers: support fro deferred probing

2015-05-26 Thread Peter Ujfalusi
Hi,

Vinod: as I promised: https://lkml.org/lkml/2015/5/8/80

With this series it is possible to put omap-dma or edma to even late_initcall
and the drivers will figure out the load order fine(ish).
We need to add dma_request_slave_channel_compat_reason() which is the equivalent
of dma_request_slave_channel_compat() but returning with error codes in case of
failure instead of NULL pointer.
The rest of the series just converts the OMAP/daVinci drivers to use this new
function to get the channel(s) and to handle the deferred probing.

I did not moved the omap-dma, edma or ti-dma-crossbar from arch_initcall. If I
do so UART will only comes up after the DMA driver is loaded since we are using,
or going to use 8250 with DAM support. This delays the kernel messages. Other
issue is the MMC/SD cards. On  board with eMMC and SD card slot the mmcblk0/1
might get swapped due to different probe order for the MMC/SD drivers. For
example in omap5-uevm:
1. omap-dma in arch_initcall the SD card is mmcblk1 (4809c000.mmc) and eMMC is
mmcblk0 (480b4000.mmc)
2. omap-dma in late_initcall the SD card is mmcblk0 (4809c000.mmc) and eMMC is
mmcblk1 (480b4000.mmc)

Because in case 1 the 4809c000.mmc got deferred by missing regulator so
480b4000.mmc got registered first. In case 2 both deferring because of DMA and
at the end 4809c000.mmc get registered first. So far I have not found a way to
bind mmcblk0/1 to a specific node...

Regards,
Peter
---
Peter Ujfalusi (13):
  dmaengine: of_dma: Correct return code for
of_dma_request_slave_channel in case !CONFIG_OF
  dmaengine: Introduce dma_request_slave_channel_compat_reason()
  serial: 8250_dma: Support for deferred probing when requesting DMA
channels
  mmc: omap_hsmmc: No need to check DMA channel validity at module
remove
  mmc: omap_hsmmc: Support for deferred probing when requesting DMA
channels
  mmc: omap: Support for deferred probing when requesting DMA channels
  mmc: davinci_mmc: Support for deferred probing when requesting DMA
channels
  crypto: omap-aes - Support for deferred probing when requesting DMA
channels
  crypto: omap-des - Support for deferred probing when requesting DMA
channels
  crypto: omap-sham - Support for deferred probing when requesting DMA
channel
  spi: omap2-mcspi: Support for deferred probing when requesting DMA
channels
  [media] omap3isp: Support for deferred probing when requesting DMA
channel
  ASoC: omap-pcm: Switch to use
dma_request_slave_channel_compat_reason()

 drivers/crypto/omap-aes.c | 38 ---
 drivers/crypto/omap-des.c | 38 ---
 drivers/crypto/omap-sham.c| 15 
 drivers/media/platform/omap3isp/isphist.c | 12 +++---
 drivers/mmc/host/davinci_mmc.c| 26 -
 drivers/mmc/host/omap.c   | 20 
 drivers/mmc/host/omap_hsmmc.c | 28 ++-
 drivers/spi/spi-omap2-mcspi.c | 36 +
 drivers/tty/serial/8250/8250_dma.c| 18 +++
 include/linux/dmaengine.h | 22 ++
 include/linux/of_dma.h|  2 +-
 sound/soc/omap/omap-pcm.c | 16 -
 12 files changed, 164 insertions(+), 107 deletions(-)

-- 
2.3.5

--
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 03/13] serial: 8250_dma: Support for deferred probing when requesting DMA channels

2015-05-26 Thread Peter Ujfalusi
Switch to use ma_request_slave_channel_compat_reason() to request the DMA
channels. In case of error, return the error code we received including
-EPROBE_DEFER

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
CC: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/tty/serial/8250/8250_dma.c | 18 --
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_dma.c 
b/drivers/tty/serial/8250/8250_dma.c
index 21d01a491405..a617eca4e97d 100644
--- a/drivers/tty/serial/8250/8250_dma.c
+++ b/drivers/tty/serial/8250/8250_dma.c
@@ -182,21 +182,19 @@ int serial8250_request_dma(struct uart_8250_port *p)
dma_cap_set(DMA_SLAVE, mask);
 
/* Get a channel for RX */
-   dma-rxchan = dma_request_slave_channel_compat(mask,
-  dma-fn, dma-rx_param,
-  p-port.dev, rx);
-   if (!dma-rxchan)
-   return -ENODEV;
+   dma-rxchan = dma_request_slave_channel_compat_reason(mask, dma-fn,
+   dma-rx_param, p-port.dev, rx);
+   if (IS_ERR(dma-rxchan))
+   return PTR_ERR(dma-rxchan);
 
dmaengine_slave_config(dma-rxchan, dma-rxconf);
 
/* Get a channel for TX */
-   dma-txchan = dma_request_slave_channel_compat(mask,
-  dma-fn, dma-tx_param,
-  p-port.dev, tx);
-   if (!dma-txchan) {
+   dma-txchan = dma_request_slave_channel_compat_reason(mask, dma-fn,
+   dma-tx_param, p-port.dev, tx);
+   if (IS_ERR(dma-txchan)) {
dma_release_channel(dma-rxchan);
-   return -ENODEV;
+   return PTR_ERR(dma-txchan);
}
 
dmaengine_slave_config(dma-txchan, dma-txconf);
-- 
2.3.5

--
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 06/13] mmc: omap: Support for deferred probing when requesting DMA channels

2015-05-26 Thread Peter Ujfalusi
Switch to use ma_request_slave_channel_compat_reason() to request the DMA
channels. Only fall back to pio mode if the error code returned is not
-EPROBE_DEFER, otherwise return from the probe with the -EPROBE_DEFER.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
CC: Ulf Hansson ulf.hans...@linaro.org
CC: Jarkko Nikula jarkko.nik...@bitmer.com
---
 drivers/mmc/host/omap.c | 20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 68dd6c79c378..29238d0fbc24 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1390,20 +1390,32 @@ static int mmc_omap_probe(struct platform_device *pdev)
res = platform_get_resource_byname(pdev, IORESOURCE_DMA, tx);
if (res)
sig = res-start;
-   host-dma_tx = dma_request_slave_channel_compat(mask,
+   host-dma_tx = dma_request_slave_channel_compat_reason(mask,
omap_dma_filter_fn, sig, pdev-dev, tx);
-   if (!host-dma_tx)
+   if (IS_ERR(host-dma_tx)) {
+   ret = PTR_ERR(host-dma_tx);
+   if (ret == -EPROBE_DEFER)
+   goto err_free_dma;
+
+   host-dma_tx = NULL;
dev_warn(host-dev, unable to obtain TX DMA engine channel 
%u\n,
sig);
+   }
 
res = platform_get_resource_byname(pdev, IORESOURCE_DMA, rx);
if (res)
sig = res-start;
-   host-dma_rx = dma_request_slave_channel_compat(mask,
+   host-dma_rx = dma_request_slave_channel_compat_reason(mask,
omap_dma_filter_fn, sig, pdev-dev, rx);
-   if (!host-dma_rx)
+   if (IS_ERR(host-dma_rx)) {
+   ret = PTR_ERR(host-dma_rx);
+   if (ret == -EPROBE_DEFER)
+   goto err_free_dma;
+
+   host-dma_rx = NULL;
dev_warn(host-dev, unable to obtain RX DMA engine channel 
%u\n,
sig);
+   }
 
ret = request_irq(host-irq, mmc_omap_irq, 0, DRIVER_NAME, host);
if (ret)
-- 
2.3.5

--
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 08/13] crypto: omap-aes - Support for deferred probing when requesting DMA channels

2015-05-26 Thread Peter Ujfalusi
Switch to use ma_request_slave_channel_compat_reason() to request the DMA
channels. Only fall back to pio mode if the error code returned is not
-EPROBE_DEFER, otherwise return from the probe with the -EPROBE_DEFER.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
CC: Herbert Xu herb...@gondor.apana.org.au
CC: David S. Miller da...@davemloft.net
CC: Lokesh Vutla lokeshvu...@ti.com
---
 drivers/crypto/omap-aes.c | 38 --
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
index 9a28b7e07c71..699a14509adb 100644
--- a/drivers/crypto/omap-aes.c
+++ b/drivers/crypto/omap-aes.c
@@ -356,7 +356,7 @@ static void omap_aes_dma_out_callback(void *data)
 
 static int omap_aes_dma_init(struct omap_aes_dev *dd)
 {
-   int err = -ENOMEM;
+   int err;
dma_cap_mask_t mask;
 
dd-dma_lch_out = NULL;
@@ -365,21 +365,20 @@ static int omap_aes_dma_init(struct omap_aes_dev *dd)
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
 
-   dd-dma_lch_in = dma_request_slave_channel_compat(mask,
- omap_dma_filter_fn,
- dd-dma_in,
- dd-dev, rx);
-   if (!dd-dma_lch_in) {
+   dd-dma_lch_in = dma_request_slave_channel_compat_reason(mask,
+   omap_dma_filter_fn, dd-dma_in,
+   dd-dev, rx);
+   if (IS_ERR(dd-dma_lch_in)) {
dev_err(dd-dev, Unable to request in DMA channel\n);
-   goto err_dma_in;
+   return PTR_ERR(dd-dma_lch_in);
}
 
-   dd-dma_lch_out = dma_request_slave_channel_compat(mask,
-  omap_dma_filter_fn,
-  dd-dma_out,
-  dd-dev, tx);
-   if (!dd-dma_lch_out) {
+   dd-dma_lch_out = dma_request_slave_channel_compat_reason(mask,
+   omap_dma_filter_fn, dd-dma_out,
+   dd-dev, tx);
+   if (IS_ERR(dd-dma_lch_out)) {
dev_err(dd-dev, Unable to request out DMA channel\n);
+   err = PTR_ERR(dd-dma_lch_out);
goto err_dma_out;
}
 
@@ -387,14 +386,15 @@ static int omap_aes_dma_init(struct omap_aes_dev *dd)
 
 err_dma_out:
dma_release_channel(dd-dma_lch_in);
-err_dma_in:
-   if (err)
-   pr_err(error: %d\n, err);
+
return err;
 }
 
 static void omap_aes_dma_cleanup(struct omap_aes_dev *dd)
 {
+   if (dd-pio_only)
+   return;
+
dma_release_channel(dd-dma_lch_out);
dma_release_channel(dd-dma_lch_in);
 }
@@ -1218,7 +1218,9 @@ static int omap_aes_probe(struct platform_device *pdev)
tasklet_init(dd-queue_task, omap_aes_queue_task, (unsigned long)dd);
 
err = omap_aes_dma_init(dd);
-   if (err  AES_REG_IRQ_STATUS(dd)  AES_REG_IRQ_ENABLE(dd)) {
+   if (err == -EPROBE_DEFER) {
+   goto err_irq;
+   } else if (err  AES_REG_IRQ_STATUS(dd)  AES_REG_IRQ_ENABLE(dd)) {
dd-pio_only = 1;
 
irq = platform_get_irq(pdev, 0);
@@ -1262,8 +1264,8 @@ err_algs:
for (j = dd-pdata-algs_info[i].registered - 1; j = 0; j--)
crypto_unregister_alg(
dd-pdata-algs_info[i].algs_list[j]);
-   if (!dd-pio_only)
-   omap_aes_dma_cleanup(dd);
+
+   omap_aes_dma_cleanup(dd);
 err_irq:
tasklet_kill(dd-done_task);
tasklet_kill(dd-queue_task);
-- 
2.3.5

--
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 13/13] ASoC: omap-pcm: Switch to use dma_request_slave_channel_compat_reason()

2015-05-26 Thread Peter Ujfalusi
dmaengine provides a wrapper function to handle DT and non DT boots when
requesting DMA channel. Use that instead of checking for of_node in the
platform driver.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
CC: Mark Brown broo...@kernel.org
CC: Jarkko Nikula jarkko.nik...@bitmer.com
CC: Liam Girdwood lgirdw...@gmail.com
---
 sound/soc/omap/omap-pcm.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index 52fd7cbbd1f4..ae04834f4697 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -132,6 +132,7 @@ static int omap_pcm_open(struct snd_pcm_substream 
*substream)
struct snd_dmaengine_dai_dma_data *dma_data;
struct dma_slave_caps dma_caps;
struct dma_chan *chan;
+   dma_cap_mask_t mask;
u32 addr_widths = BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) |
  BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |
  BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
@@ -139,12 +140,15 @@ static int omap_pcm_open(struct snd_pcm_substream 
*substream)
 
dma_data = snd_soc_dai_get_dma_data(rtd-cpu_dai, substream);
 
-   if (rtd-cpu_dai-dev-of_node)
-   chan = dma_request_slave_channel(rtd-cpu_dai-dev,
-dma_data-filter_data);
-   else
-   chan = snd_dmaengine_pcm_request_channel(omap_dma_filter_fn,
-dma_data-filter_data);
+   dma_cap_zero(mask);
+   dma_cap_set(DMA_SLAVE, mask);
+   dma_cap_set(DMA_CYCLIC, mask);
+   chan = dma_request_slave_channel_compat_reason(mask, omap_dma_filter_fn,
+   dma_data-filter_data, rtd-cpu_dai-dev,
+   dma_data-filter_data);
+
+   if (IS_ERR(chan))
+   return PTR_ERR(chan);
 
if (!dma_get_slave_caps(chan, dma_caps)) {
if (substream-stream == SNDRV_PCM_STREAM_PLAYBACK)
-- 
2.3.5

--
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 10/13] crypto: omap-sham - Support for deferred probing when requesting DMA channel

2015-05-26 Thread Peter Ujfalusi
Switch to use ma_request_slave_channel_compat_reason() to request the DMA
channel. Only fall back to polling mode if the error code returned is not
-EPROBE_DEFER, otherwise return from the probe with the -EPROBE_DEFER.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
CC: Herbert Xu herb...@gondor.apana.org.au
CC: David S. Miller da...@davemloft.net
CC: Lokesh Vutla lokeshvu...@ti.com
---
 drivers/crypto/omap-sham.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
index b2024c95a3cf..66bae8288741 100644
--- a/drivers/crypto/omap-sham.c
+++ b/drivers/crypto/omap-sham.c
@@ -1946,9 +1946,14 @@ static int omap_sham_probe(struct platform_device *pdev)
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
 
-   dd-dma_lch = dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
-  dd-dma, dev, rx);
-   if (!dd-dma_lch) {
+   dd-dma_lch = dma_request_slave_channel_compat_reason(mask,
+   omap_dma_filter_fn,
+   dd-dma, dev, rx);
+   if (IS_ERR(dd-dma_lch)) {
+   err = PTR_ERR(dd-dma_lch);
+   if (err == -EPROBE_DEFER)
+   goto data_err;
+
dd-polling_mode = 1;
dev_dbg(dev, using polling mode instead of dma\n);
}
@@ -1995,7 +2000,7 @@ err_algs:
dd-pdata-algs_info[i].algs_list[j]);
 err_pm:
pm_runtime_disable(dev);
-   if (dd-dma_lch)
+   if (!dd-polling_mode)
dma_release_channel(dd-dma_lch);
 data_err:
dev_err(dev, initialization failed.\n);
@@ -2021,7 +2026,7 @@ static int omap_sham_remove(struct platform_device *pdev)
tasklet_kill(dd-done_task);
pm_runtime_disable(pdev-dev);
 
-   if (dd-dma_lch)
+   if (!dd-polling_mode)
dma_release_channel(dd-dma_lch);
 
return 0;
-- 
2.3.5

--
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 11/13] spi: omap2-mcspi: Support for deferred probing when requesting DMA channels

2015-05-26 Thread Peter Ujfalusi
Switch to use ma_request_slave_channel_compat_reason() to request the DMA
channels. Only fall back to pio mode if the error code returned is not
-EPROBE_DEFER, otherwise return from the probe with the -EPROBE_DEFER.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
CC: Mark Brown broo...@kernel.org
---
 drivers/spi/spi-omap2-mcspi.c | 36 +---
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index a7d85c5ab2fa..e6ff937688ff 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -948,6 +948,7 @@ static int omap2_mcspi_request_dma(struct spi_device *spi)
struct omap2_mcspi_dma  *mcspi_dma;
dma_cap_mask_t mask;
unsigned sig;
+   int ret = 0;
 
mcspi = spi_master_get_devdata(master);
mcspi_dma = mcspi-dma_channels + spi-chip_select;
@@ -959,30 +960,35 @@ static int omap2_mcspi_request_dma(struct spi_device *spi)
dma_cap_set(DMA_SLAVE, mask);
sig = mcspi_dma-dma_rx_sync_dev;
 
-   mcspi_dma-dma_rx =
-   dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
-sig, master-dev,
-mcspi_dma-dma_rx_ch_name);
-   if (!mcspi_dma-dma_rx)
+   mcspi_dma-dma_rx = dma_request_slave_channel_compat_reason(mask,
+   omap_dma_filter_fn, sig, master-dev,
+   mcspi_dma-dma_rx_ch_name);
+   if (IS_ERR(mcspi_dma-dma_rx)) {
+   ret = PTR_ERR(mcspi_dma-dma_rx);
+   mcspi_dma-dma_rx = NULL;
+   if (ret != -EPROBE_DEFER)
+   ret = -EAGAIN;
goto no_dma;
+   }
 
sig = mcspi_dma-dma_tx_sync_dev;
-   mcspi_dma-dma_tx =
-   dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
-sig, master-dev,
-mcspi_dma-dma_tx_ch_name);
+   mcspi_dma-dma_tx = dma_request_slave_channel_compat_reason(mask,
+   omap_dma_filter_fn, sig, master-dev,
+   mcspi_dma-dma_tx_ch_name);
 
-   if (!mcspi_dma-dma_tx) {
+   if (IS_ERR(mcspi_dma-dma_tx)) {
+   ret = PTR_ERR(mcspi_dma-dma_tx);
+   mcspi_dma-dma_tx = NULL;
dma_release_channel(mcspi_dma-dma_rx);
mcspi_dma-dma_rx = NULL;
-   goto no_dma;
+   if (ret != -EPROBE_DEFER)
+   ret = -EAGAIN;
}
 
-   return 0;
-
 no_dma:
-   dev_warn(spi-dev, not using DMA for McSPI\n);
-   return -EAGAIN;
+   if (ret  ret != -EPROBE_DEFER)
+   dev_warn(spi-dev, not using DMA for McSPI\n);
+   return ret;
 }
 
 static int omap2_mcspi_setup(struct spi_device *spi)
-- 
2.3.5

--
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 2/2] ARM: dts: am335x-sl50: Add Toby-Churchill SL50 board support.

2015-05-26 Thread Enric Balletbo i Serra
Add support for Lightwriter SL50 series board, a small, robust and portable
Voice Output Communication Aids (VOCA) designed to meet the particular and
changing needs of people with speech loss resulting from a wide range of
acquired, progressive and congenital conditions.

Signed-off-by: Enric Balletbo i Serra enric.balle...@collabora.com
Reviewed-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
Reviewed-by: Andy Simpkins andy.simpk...@toby-churchill.com
---
 arch/arm/boot/dts/Makefile|   1 +
 arch/arm/boot/dts/am335x-sl50.dts | 482 ++
 2 files changed, 483 insertions(+)
 create mode 100644 arch/arm/boot/dts/am335x-sl50.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 86217db..b1c1373 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -409,6 +409,7 @@ dtb-$(CONFIG_SOC_AM33XX) += \
am335x-base0033.dtb \
am335x-bone.dtb \
am335x-boneblack.dtb \
+   am335x-sl50.dtb \
am335x-evm.dtb \
am335x-evmsk.dtb \
am335x-nano.dtb \
diff --git a/arch/arm/boot/dts/am335x-sl50.dts 
b/arch/arm/boot/dts/am335x-sl50.dts
new file mode 100644
index 000..1ee2ddf
--- /dev/null
+++ b/arch/arm/boot/dts/am335x-sl50.dts
@@ -0,0 +1,482 @@
+/*
+ * Copyright (C) 2015 Toby Churchill - http://www.toby-churchill.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+/dts-v1/;
+
+#include am33xx.dtsi
+
+/ {
+   model = Toby Churchill SL50 Series;
+   compatible = tcl,am335x-sl50, ti,am33xx;
+
+   cpus {
+   cpu@0 {
+   cpu0-supply = dcdc2_reg;
+   };
+   };
+
+   leds {
+   compatible = gpio-leds;
+   pinctrl-names = default;
+   pinctrl-0 = led_pins;
+
+   led@0 {
+   label = sl50:green:usr0;
+   gpios = gpio1 21 GPIO_ACTIVE_LOW;
+   default-state = off;
+   };
+
+   led@1 {
+   label = sl50:red:usr1;
+   gpios = gpio1 22 GPIO_ACTIVE_LOW;
+   default-state = off;
+   };
+
+   led@2 {
+   label = sl50:green:usr2;
+   gpios = gpio1 23 GPIO_ACTIVE_LOW;
+   default-state = off;
+   };
+
+   led@3 {
+   label = sl50:red:usr3;
+   gpios = gpio1 24 GPIO_ACTIVE_LOW;
+   default-state = off;
+   };
+   };
+
+   backlight0: disp0 {
+   compatible = pwm-backlight;
+   pwms = ehrpwm1 0 50 0;
+   brightness-levels = 0 10 20 30 40 50 60 70 80 90 99;
+   default-brightness-level = 6;
+   };
+
+   backlight1: disp1 {
+   compatible = pwm-backlight;
+   pwms = ehrpwm1 1 50 0;
+   brightness-levels = 0 10 20 30 40 50 60 70 80 90 99;
+   default-brightness-level = 6;
+   };
+
+   sound {
+   compatible = ti,da830-evm-audio;
+   ti,model = AM335x-SL50;
+   ti,audio-codec = audio_codec;
+   ti,mcasp-controller = mcasp0;
+   ti,codec-clock-rate = 1200;
+   ti,audio-routing =
+   Headphone Jack,   HPLOUT,
+   Headphone Jack,   HPROUT,
+   LINE1R,   Line In,
+   LINE1L,   Line In;
+   };
+
+   emmc_pwrseq: pwrseq@0 {
+   compatible = mmc-pwrseq-emmc;
+   pinctrl-names = default;
+   pinctrl-0 = emmc_pwrseq_pins;
+   reset-gpios = gpio1 20 GPIO_ACTIVE_LOW;
+   };
+
+   vmmcsd_fixed: fixedregulator@0 {
+   compatible = regulator-fixed;
+   regulator-name = vmmcsd_fixed;
+   regulator-min-microvolt = 330;
+   regulator-max-microvolt = 330;
+   };
+};
+
+am33xx_pinmux {
+   pinctrl-names = default;
+   pinctrl-0 = lwb_pins;
+
+   led_pins: pinmux_led_pins {
+   pinctrl-single,pins = 
+   AM33XX_IOPAD(0x854, PIN_OUTPUT | MUX_MODE7) /* 
gpmc_a5.gpio1_21 */
+   AM33XX_IOPAD(0x858, PIN_OUTPUT | MUX_MODE7) /* 
gpmc_a6.gpio1_22 */
+   AM33XX_IOPAD(0x85c, PIN_OUTPUT | MUX_MODE7) /* 
gpmc_a7.gpio1_23 */
+   AM33XX_IOPAD(0x860, PIN_OUTPUT | MUX_MODE7) /* 
gpmc_a8.gpio1_24 */
+   ;
+   };
+
+   uart0_pins: pinmux_uart0_pins {
+   pinctrl-single,pins = 
+   AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)   
/* uart0_rxd.uart0_rxd */

Re: [PATCH] serial: 8250_omap: provide complete custom startup shutdown callbacks

2015-05-26 Thread Peter Hurley
On 05/20/2015 04:07 PM, Sebastian Andrzej Siewior wrote:
 The currently in-use port-startup and port-shutdown are okay. The
 startup part for instance does the tiny omap extra part and invokes
 serial8250_do_startup() for the remaining pieces. The workflow in
 serial8250_do_startup() is okay except for the part where UART_RX is
 read without a check if there is something to read. I tried to
 workaround it in commit 0aa525d11859 (tty: serial: 8250_core: read only
 RX if there is something in the FIFO) but then reverted it later in
 commit ca8bb4aefb9 (serial: 8250: Revert tty: serial: 8250_core: read
 only RX if there is something in the FIFO).
 
 This is the second attempt to get it to work on older OMAPs without
 breaking other chips this time
 Peter Hurley suggested to pull in the few needed lines from
 serial8250_do_startup() and drop everything else that is not required
 including making it simpler like using just request_irq() instead the
 chain handler like it is doing now.
 So lets try that.

Thanks, Sebastian.

Reviewed-by: Peter Hurley pe...@hurleysoftware.com

--
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: [PATCHv3 00/27] ARM: OMAP2+: clock code move under clk driver

2015-05-26 Thread Tero Kristo

On 05/26/2015 07:32 PM, Tony Lindgren wrote:

* Tony Lindgren t...@atomide.com [150526 09:08]:

* Tero Kristo t-kri...@ti.com [150525 08:01]:

Hi,

As requested, posting v3 with somewhat changed diff parameters and
diffstat attached. Just some minor Makefile changes compared to v2,
these were discussed under that set.

Set has been pushed to:
- tree: https://github.com/t-kristo/linux-pm.git
- branch: for-4.2/ti-clk-move


Looks like this causes a build error for at least omap2 only .config:

drivers/clk/ti/dpll3xxx.o:(.rodata+0x1c): multiple definition of 
`clkhwops_omap3_dpll'
drivers/clk/ti/dpll.o:(.rodata+0x0): first defined here

You may want to create a file selecting ARCH_OMAP2PLUS=y, then point
KCONFIG_ALLCONFIG to that file for make randconfig. Then just build
randconfigs :) Usually the issues like this are exposed within few
randconfig builds, some take longer if the options have dependencies.


Found more similar issues for omap3 only and omap4 only configs:

drivers/built-in.o: In function `omap2_clkops_enable_clkdm':
omap-gpmc.c:(.text+0x202e0): undefined reference to `ti_clk_get_features'
drivers/built-in.o: In function `omap2_clkops_disable_clkdm':
omap-gpmc.c:(.text+0x20374): undefined reference to `ti_clk_get_features'
drivers/built-in.o: In function `_omap2_dpll_is_in_bypass':
omap-gpmc.c:(.text+0x21678): undefined reference to `ti_clk_get_features'
drivers/built-in.o: In function `omap2_dpll_round_rate':
omap-gpmc.c:(.text+0x218ac): undefined reference to `ti_clk_get_features'
omap-gpmc.c:(.text+0x218ec): undefined reference to `ti_clk_get_features'

drivers/built-in.o: In function `omap3xxx_dt_clk_init':
omap-gpmc.c:(.init.text+0x4d60): undefined reference to 
`omap2_clk_enable_init_clocks'
arch/arm/mach-omap2/built-in.o: In function `ti_clk_init_features':

arch/arm/mach-omap2/built-in.o: In function `ti_clk_init_features':
dss-common.c:(.init.text+0x4368): undefined reference to `ti_clk_setup_features'


Argh, that same issue crept back with a merge issue again. I fixed this 
already once.


-Tero

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