]> rtime.felk.cvut.cz Git - zynq/linux.git/log
zynq/linux.git
4 years agonet: macb: Change interrupt and napi enable order in open xlnx_rebase_v4.19_2019.1
Harini Katakam [Tue, 7 May 2019 14:07:24 +0000 (19:37 +0530)]
net: macb: Change interrupt and napi enable order in open

Current order in open:
-> Enable interrupts (macb_init_hw)
-> Enable NAPI
-> Start PHY

Sequence of RX handling:
-> RX interrupt occurs
-> Interrupt is cleared and interrupt bits disabled in handler
-> NAPI is scheduled
-> In NAPI, RX budget is processed and RX interrupts are re-enabled

With the above, on QEMU or fixed link setups (where PHY state doesn't
matter), there's a chance macb RX interrupt occurs before NAPI is
enabled. This will result in NAPI being scheduled before it is enabled.
Fix this macb open by changing the order.

Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agospi: spi-xilinx: Fixed kernel booting issue when startup block is enabled
Amit Kumar Mahapatra [Mon, 6 May 2019 11:52:13 +0000 (17:22 +0530)]
spi: spi-xilinx: Fixed kernel booting issue when startup block is enabled

In AXI SPI when startup block is enabled in the hardware the driver
performs a dummy Read ID by selecting one of the connected SPI slave
device.

The dummy read operation will fail if the design has only cs0, as the
driver was always using cs1 and causing the kernel to hang while
booting.
So this patch reads the chip select number from devicetree and uses
the same for startup block.

Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
Acked-by: Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agogpio: gpio-xilinx: consider -ve return values from of_irq_to_resource
Sai Pavan Boddu [Fri, 3 May 2019 14:04:17 +0000 (19:34 +0530)]
gpio: gpio-xilinx: consider -ve return values from of_irq_to_resource

of_irq_to_resource returns 0 or -ve value on failing to map irq.

Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
Signed-off-by: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
Acked-by: Harini Katakam <harini.katakam@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoclk: clk-fixed-factor: Return EPROBE_DEFER to wait for dependent drivers
Shubhrajyoti Datta [Sat, 30 Mar 2019 11:59:33 +0000 (17:29 +0530)]
clk: clk-fixed-factor: Return EPROBE_DEFER to wait for dependent drivers

In case the provider clock is not yet probed the fixed factor does not
find the name of the parent clock. This is because the parent clock is
not yet probed and in case of zynqmp the output-names is omitted.

This is a temporary solution however the critical components
like firmware probe should happen early.
Fixes a probe failure.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agospi: cadence: Correct initialisation of runtime PM
Charles Keepax [Thu, 25 Apr 2019 12:59:49 +0000 (18:29 +0530)]
spi: cadence: Correct initialisation of runtime PM

Currently the driver calls pm_runtime_put_autosuspend but without ever
having done a pm_runtime_get, this causes the reference count in the pm
runtime core to become -1. The bad reference count causes the core to
sometimes suspend whilst an active SPI transfer is in progress.

arizona spi0.1: SPI transfer timed out
spi_master spi0: failed to transfer one message from queue

The correct proceedure is to do all the initialisation that requires the
hardware to be powered up before enabling the PM runtime, then enable
the PM runtime having called pm_runtime_set_active to inform it that the
hardware is currently powered up. The core will then power it down at
it's leisure and no explicit pm_runtime_put is required.

Fixes: d36ccd9 ("spi: cadence: Runtime pm adaptation")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoRevert "net: xilinx: axiethernet: Increase TX and RX BD count"
Radhey Shyam Pandey [Wed, 17 Apr 2019 15:16:58 +0000 (20:46 +0530)]
Revert "net: xilinx: axiethernet: Increase TX and RX BD count"

This reverts commit ce37bfc2d48a94c5938838f5befbb48336f556e6.

In 10G + mcdma(32-bit) zcu102 design we are seeing swiotlb buffer full
error when MTU is set to 9000. The reason is default software IO TLB
64MB size is not sufficient. Hence in order to make all configurations
work with the default kernel parameters, reverting BD count increase.

Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: zynqmp: Rename zc1285 to zcu1285
Michal Simek [Tue, 23 Apr 2019 10:45:07 +0000 (12:45 +0200)]
arm64: zynqmp: Rename zc1285 to zcu1285

zcu1285 is released to public that's why name has changed.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoserial: uartps: Add support for cts-override
Shubhrajyoti Datta [Mon, 15 Apr 2019 08:52:25 +0000 (14:22 +0530)]
serial: uartps: Add support for cts-override

Having flow is configurable. Add support for the same by
checking for cts-override.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodt-bindings: xilinx-uartps: Add support for cts-override
Shubhrajyoti Datta [Mon, 15 Apr 2019 08:52:24 +0000 (14:22 +0530)]
dt-bindings: xilinx-uartps: Add support for cts-override

Flow control is configurable in xilinx-uartps
Add a dt binding to check for the same.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agov4l: xilinx: m2m: Fix buftype for s_selection ioctl
Satish Kumar Nagireddy [Wed, 17 Apr 2019 01:30:37 +0000 (18:30 -0700)]
v4l: xilinx: m2m: Fix buftype for s_selection ioctl

In current implementstion, driver is checking against _MPLANE buffer
types, but the type field in struct v4l2_selection is supposed to never
use the _MPLANE variants.

The commit eaec420f530d ("[media] v4l2-ioctl/exynos: fix G/S_SELECTION's
type handling") is converging non-mplane and _MPLANE formats to non-mpalne
formats. This is to allow applications to pass _MPLANE and non-mpalne
buffer types, and the driver only handles the non-mplane formats. Fix
this driver accordingly.

Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agodrm: xlnx: mixer: Adding 16 layer support
Venkateshwar Rao Gannavarapu [Tue, 16 Apr 2019 20:40:18 +0000 (13:40 -0700)]
drm: xlnx: mixer: Adding 16 layer support

This patch adds 16 layer support with backward compatibility.

Signed-off-by: Venkateshwar Rao Gannavarapu <venkateshwar.rao.gannavarapu@xilinx.com>
Signed-off-by: Saurabh Sengar <saurabh.singh@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agodt-bindings: display: xlnx: mixer: Updated compatible string
Venkateshwar Rao Gannavarapu [Tue, 16 Apr 2019 20:40:17 +0000 (13:40 -0700)]
dt-bindings: display: xlnx: mixer: Updated compatible string

This patch introduces the compatible string for Mixer4.0.

Signed-off-by: Venkateshwar Rao Gannavarapu <venkateshwar.rao.gannavarapu@xilinx.com>
Signed-off-by: Saurabh Sengar <saurabhs@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agousb: dwc3: gadget: do not issue END_TRANSFER if request list is empty
Anurag Kumar Vulisha [Mon, 15 Apr 2019 15:32:33 +0000 (15:32 +0000)]
usb: dwc3: gadget: do not issue END_TRANSFER if request list is empty

If there are no entry in request list (i.e, both pending_list and
started_list are empty) then do not issue END_TRANSFER instead set
the PENDING flag, so that the END_TRANSFER is issued when an new
entry is added into request list. This patch updates the same.

If the isocronous transfers are started before XFERNOTREADY event,
there are chances of getting BUS_EXPIRY. So, this patch updates the
code to not issue __dwc3_gadget_start_isoc() before XFERNOTREADY
event and wait for dwc3_gadget_endpoint_transfer_not_ready() to
start the isocronous transfers.

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: gadget: check for empty started_list after cleaning completed requests
Anurag Kumar Vulisha [Mon, 15 Apr 2019 15:32:32 +0000 (15:32 +0000)]
usb: dwc3: gadget: check for empty started_list after cleaning completed requests

The code in dwc3_gadget_endpoint_transfer_in_progress() checks for
the empty value in started_list before cleaning up the complted
requests. Since the present working request is not yet cleaned from
started_list, the list_empty(started_list) always returns non-empty.
This patch corrects the code by moving the list_empty(started_list)
check after calling dwc3_gadget_ep_cleanup_completed_requests()

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: gadget: clear DWC3_EP_PENDING_REQUEST flag
Anurag Kumar Vulisha [Mon, 15 Apr 2019 15:32:31 +0000 (15:32 +0000)]
usb: dwc3: gadget: clear DWC3_EP_PENDING_REQUEST flag

This patch modifies the code to clear the DWC3_EP_PENDING_REQUEST
flag once the transfer is started.

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agov4l: xilinx: vip: Add YUV444 12bit and 16bit formats
Satish Kumar Nagireddy [Wed, 10 Apr 2019 22:04:57 +0000 (15:04 -0700)]
v4l: xilinx: vip: Add YUV444 12bit and 16bit formats

This patch adds support for YUV444 12bit and 16bit formats.

Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agomedia: v4l2-ioctl: Add YUV444 12bit and 16bit pixel formats
Satish Kumar Nagireddy [Wed, 10 Apr 2019 22:04:56 +0000 (15:04 -0700)]
media: v4l2-ioctl: Add YUV444 12bit and 16bit pixel formats

This patch adds new fourcc codes for YUV444 12bit and 16bit formats.

Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agomedia: v4l: Add YUV444 12bit and 16bit media bus format
Satish Kumar Nagireddy [Wed, 10 Apr 2019 22:04:55 +0000 (15:04 -0700)]
media: v4l: Add YUV444 12bit and 16bit media bus format

This patch adds new media bus formats for YUV444 12bit and 16bit.

Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: vip: Fix stride calculation
Satish Kumar Nagireddy [Wed, 10 Apr 2019 22:04:54 +0000 (15:04 -0700)]
v4l: xilinx: vip: Fix stride calculation

The stride calculation for RGB 10bit and YUV444 10bit formats are missing
scaling / padding factor and also using wrong bpl factor.

This patch corrects the stride calculation by fixing aforementioned issue.

Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agomedia: v4l2-ioctl: Use correct fourcc for YUV444 10bit format
Satish Kumar Nagireddy [Wed, 10 Apr 2019 22:04:53 +0000 (15:04 -0700)]
media: v4l2-ioctl: Use correct fourcc for YUV444 10bit format

Y_only 10bit and YUV444 10bit pixel formats are using same fourcc. This
patch uses X410 as fourcc for YUV444 10bit format.

 X  -> padding
 4  -> chroma subsampling
 10 -> Bits per component

Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agoASoC: xlnx: revert HDMI audio mclk mutliplier
Maruthi Srinivas Bayyavarapu [Wed, 10 Apr 2019 08:35:38 +0000 (14:05 +0530)]
ASoC: xlnx: revert HDMI audio mclk mutliplier

Mutliplier value of 768 used in latest ACR IP is not providing proper
audio in some test cases. The old value of 512 is tested to be appropriate
with all tests. So, revert back to 512. ACR IP was aleady reverted back
to 512.

Signed-off-by: Maruthi Srinivas Bayyavarapu <maruthi.srinivas.bayyavarapu@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agodrm: xlnx: pl_disp: Added plane atomic check function
Venkateshwar Rao Gannavarapu [Tue, 9 Apr 2019 19:17:57 +0000 (12:17 -0700)]
drm: xlnx: pl_disp: Added plane atomic check function

This patch adds the atomic check helper function to update mode
changed flag and returns error when framebuffer remove functionality
forces to commit without disable crtc.

Without this patch, new DRM framework commits without disable crtc
which leads image corruption and delay in consecutive runs.

Signed-off-by: Venkateshwar Rao Gannavarapu <venkateshwar.rao.gannavarapu@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agowatchdog: of_xilinx_wdt: Wire setting up timeout via module parameter/DT
Srinivas Goud [Tue, 9 Apr 2019 14:29:27 +0000 (19:59 +0530)]
watchdog: of_xilinx_wdt: Wire setting up timeout via module parameter/DT

Add support for setting up timeout via kernel module parameter or read
timeout-sec via device tree.

Signed-off-by: Srinivas Goud <srinivas.goud@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
5 years agowatchdog: of_xilinx_wdt: Add Versal support
Srinivas Goud [Tue, 9 Apr 2019 14:29:26 +0000 (19:59 +0530)]
watchdog: of_xilinx_wdt: Add Versal support

Versal watchdog driver uses generic watchdog mode.
Generic watchdog contains closed and open window of equal timeout.
Generic watchdog will generate reset signal if it is not explicitly
refreshed in second window.

Signed-off-by: Srinivas Goud <srinivas.goud@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
5 years agodt-bindings: watchdog: xilinx: Add binding for Versal watchdog
Srinivas Goud [Tue, 9 Apr 2019 14:29:25 +0000 (19:59 +0530)]
dt-bindings: watchdog: xilinx: Add binding for Versal watchdog

Updated watchdog binding for Versal window watchdog.
Added timeout-sec DT property.
timeout-sec is optional property for Versal window watchdog.

Signed-off-by: Srinivas Goud <srinivas.goud@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
5 years agowatchdog: of_xilinx_wdt: Introduce wdttype enum for identification
Srinivas Goud [Tue, 9 Apr 2019 14:29:24 +0000 (19:59 +0530)]
watchdog: of_xilinx_wdt: Introduce wdttype enum for identification

There is a need to identify watchdog type that's why new enum was
was introduced to cover it. Move functionality valid only for this
watchdog type if statement.

Signed-off-by: Srinivas Goud <srinivas.goud@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
5 years agowatchdog: of_xilinx_wdt: Initialize watchdog via data structure
Srinivas Goud [Tue, 9 Apr 2019 14:29:23 +0000 (19:59 +0530)]
watchdog: of_xilinx_wdt: Initialize watchdog via data structure

This patch is preparation for adding new watchdog based on this driver.
of_id->data is storing link xwdt_devtype_data which stores watchdog
info and ops pointers to structures.

Signed-off-by: Srinivas Goud <srinivas.goud@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
5 years agowatchdog: of_xilinx_wdt: Used dev_dbg()
Srinivas Goud [Tue, 9 Apr 2019 14:29:22 +0000 (19:59 +0530)]
watchdog: of_xilinx_wdt: Used dev_dbg()

This patch removes pr_info in stop function and adds dev_dbg()
in start/stop function to display device specific debug info.

Signed-off-by: Srinivas Goud <srinivas.goud@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
5 years agowatchdog: of_xilinx_wdt: Used BIT macro
Srinivas Goud [Tue, 9 Apr 2019 14:29:21 +0000 (19:59 +0530)]
watchdog: of_xilinx_wdt: Used BIT macro

Used BIT macro instead of mask value.

Signed-off-by: Srinivas Goud <srinivas.goud@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agowatchdog: of_xilinx_wdt: Add comment to spinlock
Srinivas Goud [Tue, 9 Apr 2019 14:29:20 +0000 (19:59 +0530)]
watchdog: of_xilinx_wdt: Add comment to spinlock

Based on checkpatch every spinlock should be documented.
The patch is fixing this issue:
./scripts/checkpatch.pl --strict -f drivers/watchdog/of_xilinx_wdt.c
CHECK: spinlock_t definition without comment
+ spinlock_t spinlock;

Signed-off-by: Srinivas Goud <srinivas.goud@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
5 years agomtd: rawnand: pl353: Allow raw read/write only for on-die ecc flash parts
Naga Sureshkumar Relli [Mon, 8 Apr 2019 13:16:22 +0000 (18:46 +0530)]
mtd: rawnand: pl353: Allow raw read/write only for on-die ecc flash parts

When using HW-ECC, do not assign pl353_read_page_raw() and
pl353_write_page_raw() to ecc->write_page_raw and ecc->read_page_raw
hooks. if we do that read and writes will fail. We came to know this,
when running mtd_nandbiterrs test. This test case uses raw read/writes
when assigned but with hw-ecc, causes failures in data read
and writes.

Signed-off-by: Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoARM: dts: zynq: update smcc properties
Naga Sureshkumar Relli [Mon, 8 Apr 2019 13:16:21 +0000 (18:46 +0530)]
ARM: dts: zynq: update smcc properties

As per the new devicetree documentation, update the compatible and
clock-names properties.
i.e. add "arm,primecell" as another compatibility
and apb_pclk instead of aclk in clock-names.

Signed-off-by: Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agouio: xilinx_ai_engine: Enable platform genirq driver
Hyun Kwon [Thu, 4 Apr 2019 17:03:35 +0000 (10:03 -0700)]
uio: xilinx_ai_engine: Enable platform genirq driver

The NPI can be modeled with the platform genirq driver. Enable
the driver as a part of it. This will require the dts node
for the NPI space.

Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
Reviewed-by: Wendy Liang <wendy.liang@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodt-bindings: soc: xilinx: ai-engine-npi: Add the binding for AIE NPI
Hyun Kwon [Thu, 4 Apr 2019 17:03:34 +0000 (10:03 -0700)]
dt-bindings: soc: xilinx: ai-engine-npi: Add the binding for AIE NPI

This is the binding for AIE NPI space. This is a temporary or
non-standard way by representing privileged NPI space as a device
to non-secure world.

Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
Reviewed-by: Wendy Liang <wendy.liang@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agouio: xilinx_ai_engine: Simulate the irq if no hw irq is available
Hyun Kwon [Thu, 4 Apr 2019 17:03:33 +0000 (10:03 -0700)]
uio: xilinx_ai_engine: Simulate the irq if no hw irq is available

Only when there's no hw irq available and the debugfs is enabled,
simulate the irq. This allows users to trigger the interrupt through
debugfs and helps debug, as some emulation platforms don't even
have the NPI interrupt connected.

Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
Reviewed-by: Wendy Liang <wendy.liang@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agouio: xilinx_ai_engine: Enable the irq
Hyun Kwon [Thu, 4 Apr 2019 17:03:32 +0000 (10:03 -0700)]
uio: xilinx_ai_engine: Enable the irq

Pass the irq info from dt to the uio genirq. For now, only enable
one interrupt, but there's can be up to 3 interrupts assigned.

Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
Reviewed-by: Wendy Liang <wendy.liang@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodt-bindings: soc: xilinx: ai_engine: Add interrupts
Hyun Kwon [Thu, 4 Apr 2019 17:03:31 +0000 (10:03 -0700)]
dt-bindings: soc: xilinx: ai_engine: Add interrupts

Add the interrupts definition.

Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
Reviewed-by: Wendy Liang <wendy.liang@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agouio: xilinx_ai_engine: Unreference correct pdev
Hyun Kwon [Thu, 4 Apr 2019 17:03:30 +0000 (10:03 -0700)]
uio: xilinx_ai_engine: Unreference correct pdev

The correct device should be unreferenced.

Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
Reviewed-by: Wendy Liang <wendy.liang@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agouio: xilinx_ai_engine: Set the uio device as pdev driver data
Hyun Kwon [Thu, 4 Apr 2019 17:03:29 +0000 (10:03 -0700)]
uio: xilinx_ai_engine: Set the uio device as pdev driver data

It's needed when the driver is removed.

Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
Reviewed-by: Wendy Liang <wendy.liang@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agov4l: xilinx: scd: Don't mark channel as disabled in .s_stream(0)
Laurent Pinchart [Wed, 3 Apr 2019 20:01:59 +0000 (13:01 -0700)]
v4l: xilinx: scd: Don't mark channel as disabled in .s_stream(0)

Commit 2e77607047c6 ("xilinx: v4l2: dma: Add multiple output support")
incorrectly calls .s_stream(0) on all channels when one of them gets
disabled, causing all the other channels to hang. Work around this by
not disabling the channel in .s_stream(0). The channel will be disabled
in xscd_dma_terminate_all() which should be safe as long as
dmaengine_terminate_all() is called after xvip_pipeline_set_stream().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Rewrite core start/stop and interrupt handling
Laurent Pinchart [Wed, 3 Apr 2019 20:01:58 +0000 (13:01 -0700)]
v4l: xilinx: scd: Rewrite core start/stop and interrupt handling

The current mechanism to control start/stop of the SCD core and notify
userspace of V4L2 events is racy. Rewrite it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Cleanup the xscd_dma_chan structure
Laurent Pinchart [Wed, 3 Apr 2019 20:01:57 +0000 (13:01 -0700)]
v4l: xilinx: scd: Cleanup the xscd_dma_chan structure

Cleanup the xscd_dma_chan structure by

- Reordering fields to group them by category
- Renaming the en field to enabled
- Removing the unused chan_node field
- Turning the id field from u8 to unsigned int

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Clean up #include statements
Laurent Pinchart [Wed, 3 Apr 2019 20:01:56 +0000 (13:01 -0700)]
v4l: xilinx: scd: Clean up #include statements

xilinx-scenechange.h contains various #include statements not needed by
the header itself but by the multiple .c files that include it. Move
them to the .c files and remove unneeded includes.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Inline the xscd_dma_alloc_tx_descriptor() function
Laurent Pinchart [Wed, 3 Apr 2019 20:01:55 +0000 (13:01 -0700)]
v4l: xilinx: scd: Inline the xscd_dma_alloc_tx_descriptor() function

The function performs a single kzalloc() call, inline it in its caller
to simplify the code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Allocate all channels in one go
Laurent Pinchart [Wed, 3 Apr 2019 20:01:54 +0000 (13:01 -0700)]
v4l: xilinx: scd: Allocate all channels in one go

This eases memory management and channels initialization, we don't have
to iterate over subnodes anymore.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Initialize DMA channels in xilinx-scenechange-dma.c
Laurent Pinchart [Wed, 3 Apr 2019 20:01:53 +0000 (13:01 -0700)]
v4l: xilinx: scd: Initialize DMA channels in xilinx-scenechange-dma.c

Most of the DMA channel initialization is performed in
xilinx-scenechange-dma.c, but a small part is in
xilinx-scenechange-channel.c. Move all the initialization code to
xilinx-scenechange-dma.c, rename the xscd_dma_chan_probe() function to
xscd_dma_chan_init(), and simplify the code as the function can't fail.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Request IRQ after completing initialization
Laurent Pinchart [Wed, 3 Apr 2019 20:01:52 +0000 (13:01 -0700)]
v4l: xilinx: scd: Request IRQ after completing initialization

IRQs can be triggered as soon as they're requested. To ensure a valid
state in the IRQ handler, make sure to request the IRQ after
initializing all components.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Store channel registers address in iomem field
Laurent Pinchart [Wed, 3 Apr 2019 20:01:51 +0000 (13:01 -0700)]
v4l: xilinx: scd: Store channel registers address in iomem field

Store the channel registers address instead of the base offset in the
iomem field of the channel structures. This allows accessing the channel
registers without having to compute the offset each time.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Allocate pads array statically
Laurent Pinchart [Wed, 3 Apr 2019 20:01:50 +0000 (13:01 -0700)]
v4l: xilinx: scd: Allocate pads array statically

Allocating the pads array dynamically doesn't save much memory, if at
all, due to the extra data needed to track the devm allocation, compared
to embedding an array of two pads in the xscd_device structure. Replace
the dynamic allocation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Refactor the xscd_device structure
Laurent Pinchart [Wed, 3 Apr 2019 20:01:49 +0000 (13:01 -0700)]
v4l: xilinx: scd: Refactor the xscd_device structure

Reorder fields to group them by category (system resources,
configuration V4L2 channels, DMA channels), squash the xscd_shared_data
structure with xscd_device and remove duplicated fields.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Compile all SCD source files in a single module
Laurent Pinchart [Wed, 3 Apr 2019 20:01:48 +0000 (13:01 -0700)]
v4l: xilinx: scd: Compile all SCD source files in a single module

The files xilinx-scenechange.c, xilinx-scenechange-dma.c and
xilinx-scenechange-channel.c are part of the same driver. Compile them
as a single module.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Merge the main and DMA IRQ handlers
Laurent Pinchart [Wed, 3 Apr 2019 20:01:47 +0000 (13:01 -0700)]
v4l: xilinx: scd: Merge the main and DMA IRQ handlers

Both the main SCD driver and the DMA support code register an IRQ
handler, for the same IRQ. This is unnecessary, we can just call the DMA
IRQ handling function from the main IRQ handler.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Cleanup the DMA engine at remove() time
Laurent Pinchart [Thu, 4 Apr 2019 11:32:54 +0000 (14:32 +0300)]
v4l: xilinx: scd: Cleanup the DMA engine at remove() time

The resources allocated by the xscd_dma_init() function are never
released. Add a new xscd_dma_cleanup() function to handle the cleanup
and call it at driver remove() time.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Merge the DMA support in the main SCD driver
Laurent Pinchart [Wed, 3 Apr 2019 20:01:46 +0000 (13:01 -0700)]
v4l: xilinx: scd: Merge the DMA support in the main SCD driver

There's no need to create a separate platform_driver and platform_device
for the DMA support. Merge the xscd_dma_device structure into the
xscd_device. This allows removing duplicating fields, as well as
unneeded code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Merge the main and V4L2 IRQ handlers
Laurent Pinchart [Wed, 3 Apr 2019 20:01:45 +0000 (13:01 -0700)]
v4l: xilinx: scd: Merge the main and V4L2 IRQ handlers

Both the main SCD driver and the V4L2 support code register an IRQ
handler, for the same IRQ. This is unnecessary, we can just call the
V4L2 IRQ handling function from the main IRQ handler.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Merge the V4L2 support in the main SCD driver
Laurent Pinchart [Wed, 3 Apr 2019 20:01:44 +0000 (13:01 -0700)]
v4l: xilinx: scd: Merge the V4L2 support in the main SCD driver

There's no need to create a separate platform_driver and platform_device
for the V4L2 support. Call the xilinx-scenechange-channel initialization
function directly from the main driver. This allows removing duplicating
fields, as well as unneeded code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Reorder structure definitions
Laurent Pinchart [Wed, 3 Apr 2019 20:01:43 +0000 (13:01 -0700)]
v4l: xilinx: scd: Reorder structure definitions

This will make it easier to refactor them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Make local functions static
Laurent Pinchart [Wed, 3 Apr 2019 20:01:42 +0000 (13:01 -0700)]
v4l: xilinx: scd: Make local functions static

Several of the xscd_dma_* functions are only used in their compilation
unit. Make them static and remove their declaration from the common
header.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Consolidate structure definitions
Laurent Pinchart [Wed, 3 Apr 2019 20:01:41 +0000 (13:01 -0700)]
v4l: xilinx: scd: Consolidate structure definitions

Move all driver data structures to the xilinx-scenechange.h header. Turn
the cast macros into static inline function and rename them all to
to_<struct name> for consistency.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: scd: Consolidate register definitions
Laurent Pinchart [Wed, 3 Apr 2019 20:01:40 +0000 (13:01 -0700)]
v4l: xilinx: scd: Consolidate register definitions

Move all macros defining register offsets and bits to the
xilinx-scenechange.h header, shared between the three source files that
deal with the SCD.

Rename the XSCD_COLOR_FMT_* macros to XSCD_VID_FMT_*, in order to match
the correspongin register name.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: vipp: Support entity matching on DT subnodes
Laurent Pinchart [Wed, 3 Apr 2019 20:01:39 +0000 (13:01 -0700)]
v4l: xilinx: vipp: Support entity matching on DT subnodes

When the video IP pipeline is parsed in DT, the composite device stores
all entities found in the graph, along with their corresponding DT node.
Later on the DT nodes pointers are used to locate the corresponding V4L2
subdevs by matching them against subdev->dev->of_node.

This mechanism works fine for devices that register a single subdev. For
devices that register multiple subdevs, subdev->dev->of_node points to
the DT node of the device, while the entities parsed from the pipeline
point to child nodes of the device DT node.

The v4l2_subdev structure has a fwnode field that is set to point to the
fwnode corresponding to the device DT node. Drivers that register
multiple subdevs must set the fwnode field manually to the associated
child node of the device DT node. We can thus fix this issue by locating
V4L2 subdevs for an entity based on the subdev fwnode instead of the
dev->of_node.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agofpga: zynqmp-fpga: Fix broken secure bitstream loading use cases
Nava kishore Manne [Wed, 3 Apr 2019 08:01:11 +0000 (13:31 +0530)]
fpga: zynqmp-fpga: Fix broken secure bitstream loading use cases

Device-tree overlay flow the below secure use cases got
broken with 4.19
-Encrypted Bitstream loading
-Authenticated Bitstream loading.
-Authenticated and Encrypted Bitstream loading.

Signed-off-by: Nava kishore Manne <nava.manne@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoASoC: xlnx: change HDMI audio mclk
Maruthi Srinivas Bayyavarapu [Mon, 1 Apr 2019 17:50:07 +0000 (10:50 -0700)]
ASoC: xlnx: change HDMI audio mclk

audio mclk depends on the ACR IP being used. Multiplier value is changed
in updated version of ACR IP. Updated the same in driver.

Signed-off-by: Maruthi Srinivas Bayyavarapu <maruthi.srinivas.bayyavarapu@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agov4l: xilinx: sdirxss: Fix the media bus formats to 10bpc type
Vishal Sagar [Tue, 2 Apr 2019 10:13:08 +0000 (03:13 -0700)]
v4l: xilinx: sdirxss: Fix the media bus formats to 10bpc type

With commit id 563e888fca45a978e4c29b2f5ec5a8a95af60e68, xyavta now
fails to start stream as the media bus format requested is
MEDIA_BUS_FMT_UYVY10_1x20 but the SDI Rx subdev returned media bus
format is MEDIA_BUS_FMT_UYVY8_1x16.

Fix this by updating the driver for correct media bus formats for YUV
422 and 420 10bpc i.e. MEDIA_BUS_FMT_UYVY10_1X20 and
MEDIA_BUS_FMT_VYYUYY10_4X20.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agodt-bindings: power: Add versal power domain bindings
Rajan Vaja [Tue, 2 Apr 2019 17:12:50 +0000 (10:12 -0700)]
dt-bindings: power: Add versal power domain bindings

Define Versal power domain value macros for RTC and ADMA.

Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agov4l: xilinx: tpg: Dynamically modify TPG output format
Vishal Sagar [Fri, 29 Mar 2019 06:23:20 +0000 (23:23 -0700)]
v4l: xilinx: tpg: Dynamically modify TPG output format

The TPG output format was fixed based on the device tree. This patch now
allows the TPG output format to be configured at runtime. This is valid
only for the HLS version of TPG.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Tested-by: Rohan Dhaval Parikh <rohanp@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
5 years agoARM: xilinx: Add zynq defconfig
Michal Simek [Fri, 22 Mar 2019 15:10:45 +0000 (16:10 +0100)]
ARM: xilinx: Add zynq defconfig

Trivial patch.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: xilinx: Add defconfig fragments
Michal Simek [Fri, 22 Mar 2019 15:09:33 +0000 (16:09 +0100)]
arm64: xilinx: Add defconfig fragments

Trivial patch.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agomicroblaze: Sync defconfigs
Michal Simek [Fri, 22 Mar 2019 15:08:50 +0000 (16:08 +0100)]
microblaze: Sync defconfigs

Sync with savedefconfig.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: zynqmp: Add/Update/Sync DTs for xilinx platforms
Michal Simek [Wed, 27 Mar 2019 08:11:14 +0000 (09:11 +0100)]
arm64: zynqmp: Add/Update/Sync DTs for xilinx platforms

Add/Update/Sync device tree descriptions for Xilinx boards.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoARM: zynq: Add/Update/Sync DTs for xilinx platforms
Michal Simek [Wed, 27 Mar 2019 08:07:19 +0000 (09:07 +0100)]
ARM: zynq: Add/Update/Sync DTs for xilinx platforms

Add/Update/Sync device tree descriptions for Xilinx boards.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoMAINTAINERS: Updates entries to cover Xilinx drivers
Michal Simek [Mon, 1 Apr 2019 09:45:42 +0000 (11:45 +0200)]
MAINTAINERS: Updates entries to cover Xilinx drivers

Record responsiblities for Xilinx drivers.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: simple: add runtime suspend/resume support
Anurag Kumar Vulisha [Sat, 30 Mar 2019 10:23:31 +0000 (10:23 +0000)]
usb: dwc3: simple: add runtime suspend/resume support

This patch updates the code to add runtime support
for suspend and resume

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: simple: remove redundant code in dwc3-of-simple.c
Anurag Kumar Vulisha [Mon, 1 Apr 2019 15:58:23 +0000 (15:58 +0000)]
usb: dwc3: simple: remove redundant code in dwc3-of-simple.c

This patch removes the redundant code present in
dwc3-of-simple.c file

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: gadget: export functions which are needed for hibernation
Anurag Kumar Vulisha [Sat, 30 Mar 2019 10:23:29 +0000 (10:23 +0000)]
usb: dwc3: gadget: export functions which are needed for hibernation

This patch exports the functions which are needed for
making hibernation feature work

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: gadget: get irq number for hibernation interrupts
Anurag Kumar Vulisha [Sat, 30 Mar 2019 10:23:28 +0000 (10:23 +0000)]
usb: dwc3: gadget: get irq number for hibernation interrupts

This patch modifies the code to get irq number for
usb hibernation specific interrupts

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: host: xhci: Add xhci_hcd to xhci_ring for use in stream_timeout_function
Anurag Kumar Vulisha [Sat, 30 Mar 2019 10:23:26 +0000 (10:23 +0000)]
usb: host: xhci: Add xhci_hcd to xhci_ring for use in stream_timeout_function

This patch modifies the code to pass xhci_hcd in xhci_ring
which would be used by stream_timeout_function() to send
stop command on the stream ring after stream timer gets
timedout.

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: core: use first_trb_index instead of start_slot
Anurag Kumar Vulisha [Sat, 30 Mar 2019 10:23:23 +0000 (10:23 +0000)]
usb: dwc3: core: use first_trb_index instead of start_slot

start_slot is now renamed to first_trb_index. This patch
adds first_trb_index entry into dwc3_request which is
used by core.c

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: otg: Update Kconfig and Makefile for enabling OTG
Anurag Kumar Vulisha [Sat, 30 Mar 2019 10:23:19 +0000 (10:23 +0000)]
usb: dwc3: otg: Update Kconfig and Makefile for enabling OTG

This patch updates the Kconfig and Makefile for enabling
the OTG driver.

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: gadget: Add new platform_data.h file
Anurag Kumar Vulisha [Sat, 30 Mar 2019 10:23:18 +0000 (10:23 +0000)]
usb: dwc3: gadget: Add new platform_data.h file

This patch adds new platform_data.h file which
can be used for storing the platform specific
information.

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: host: xhci: Replace 0/1 values with boolean
Anurag Kumar Vulisha [Sat, 30 Mar 2019 10:23:17 +0000 (10:23 +0000)]
usb: host: xhci: Replace 0/1 values with boolean

This patch replaces 0/1 values used in xhci-plat.c
with boolean values for ease of understanding

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: otg: Add dependencies required by otg.c and drd.c files
Anurag Kumar Vulisha [Sat, 30 Mar 2019 10:23:16 +0000 (10:23 +0000)]
usb: dwc3: otg: Add dependencies required by otg.c and drd.c files

drd.c file supports the simple OTG role swap feature based on the
ULPI pin status and otg.c file supports the TRUE OTG features like
HNP, SRP and also Role swap based on ULPI ID pin.

This patch adds the dependencies required by drd.c and otg.c files.

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: gadget: remove redundant otg checks from dwc3_gadget_init()
Anurag Kumar Vulisha [Sat, 30 Mar 2019 10:23:15 +0000 (10:23 +0000)]
usb: dwc3: gadget: remove redundant otg checks from dwc3_gadget_init()

otg_set_peripheral() is getting called from dwc3_gadget_init()
at the end, remove the redundant code

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: otg: Pass dummy address instead of value
Anurag Kumar Vulisha [Sat, 30 Mar 2019 10:23:14 +0000 (10:23 +0000)]
usb: dwc3: otg: Pass dummy address instead of value

dwc3_otg_set_host() stops peripheral mode once the
host initialization is done. The present code logic
detects the host init done based on the value sent
in place of  struct usb_bus * ptr. The pointer
value is checked with 0x1 to know whether host is
initialized or not. This patch changes the code
to check against the dummy address value "0xdeadbeef"
instead of value "0x1"

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: otg: Add support for ending HNP session
Anurag Kumar Vulisha [Sat, 30 Mar 2019 10:23:13 +0000 (10:23 +0000)]
usb: dwc3: otg: Add support for ending HNP session

As a part of sucessful HNP session both A-Device and
B-Device swaps their roles from A-Device: Host->Peripheral
and B-Device: Peripheral->Host. Once the B-Device is done
as Host, the HNP session should be ended to restore to their
previous roles i.e, A-Device: Peripheral->Host and B-Device:
Host->Peripheral. This patch adds a sysfs entry which will
end the HNP session and restore to their original roles.

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: replace arguments in __dwc3_gadget_ep_enable with DWC3_DEPCFG_ACTION_INIT
Anurag Kumar Vulisha [Sat, 30 Mar 2019 10:23:12 +0000 (10:23 +0000)]
usb: dwc3: replace arguments in __dwc3_gadget_ep_enable with DWC3_DEPCFG_ACTION_INIT

DWC3_DEPCFG_ACTION_INIT is as equal as passing modify = false
and restore = false in __dwc3_gadget_ep_enable()

This patch updates the code

From:
__dwc3_gadget_ep_enable(dep, false, false);

To:
__dwc3_gadget_ep_enable(dep, DWC3_DEPCFG_ACTION_INIT);

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: route lpd usb traffic through CCI path for making SMMU work
Anurag Kumar Vulisha [Fri, 15 Mar 2019 11:27:41 +0000 (11:27 +0000)]
usb: dwc3: route lpd usb traffic through CCI path for making SMMU work

usb dma traffic by default takes the direct DDR path from LPD switch.
Since SMMU is present before CCI, the usb dma traffic needs to be
routed to take the CCI path for making SMMU work. This can be done
by enabling "coherency" in usb.

This patch modifies the code to enable coherency in usb for below
mentioned cases

1. To route usb dma transactions through CCI path for coherency. This is
   done when "dma-coherent" property is added into dwc3 dts node.
2. To route usb dma transactions through CCI path to make SMMU work with
   usb dma. This is done when "dwc->dev->iommu_group" is populated
   (iommu_group is only populated when sucessfull smmu comtext for usb is
   created).

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoUSB: gadget: f_hid: fix deadlock in f_hidg_write()
Anurag Kumar Vulisha [Thu, 14 Mar 2019 11:45:20 +0000 (11:45 +0000)]
USB: gadget: f_hid: fix deadlock in f_hidg_write()

In f_hidg_write() the write_spinlock is acquired before calling
usb_ep_queue() which causes a deadlock when dummy_hcd is being used.
This is because dummy_queue() callbacks into f_hidg_req_complete() which
tries to acquire the same spinlock. This is (part of) the backtrace when
the deadlock occurs:

  0xffffffffc06b1410 in f_hidg_req_complete
  0xffffffffc06a590a in usb_gadget_giveback_request
  0xffffffffc06cfff2 in dummy_queue
  0xffffffffc06a4b96 in usb_ep_queue
  0xffffffffc06b1eb6 in f_hidg_write
  0xffffffff8127730b in __vfs_write
  0xffffffff812774d1 in vfs_write
  0xffffffff81277725 in SYSC_write

Fix this by releasing the write_spinlock before calling usb_ep_queue()

Signed-off-by: Radoslav Gerganov <rgerganov@vmware.com>
Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodt-bindings: usb: Add description for interrupt-names property used
Anurag Kumar Vulisha [Tue, 5 Mar 2019 15:46:33 +0000 (15:46 +0000)]
dt-bindings: usb: Add description for interrupt-names property used

This patch updates the documentation for "interrupt-names" property used
in dwc3 dts node

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: otg: mask host/device soft reset from affecting the phy
Anurag Kumar Vulisha [Fri, 1 Mar 2019 14:38:36 +0000 (14:38 +0000)]
usb: dwc3: otg: mask host/device soft reset from affecting the phy

Setting OCFG.OTGSFTRSTMASK bit masks reset signal issued
either from host or device soft reset from affecting the
reset signal outputs sent to the phy. This patch sets
programs this bit when starting host or peripheral mode

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: otg: make otg driver work along with drd driver
Anurag Kumar Vulisha [Fri, 1 Mar 2019 14:38:35 +0000 (14:38 +0000)]
usb: dwc3: otg: make otg driver work along with drd driver

There are 2 drivers which can be used for dwc3 otg feature, they are
discussed below

1. drd.c -> This driver supports the basic Host <-> Peripheral role
    swap based on ID PIN sensing. If ID PIN is low the Host
    role is switched. When ID PIN is high Peripheral role is
    switched
2. otg.c -> This driver is internal driver which supports the TRUE OTG
    functionality. Unlike drd.c , this driver supports the OTG
    features like HNP (Host Negotiation Protocol) , SRP (Session
    Request Protocol) and Host <-> Peripheral swapping (same as
    drd.c)

This patch makes the necessary code changes for enabling
otg.c when "CONFIG_USB_DWC3_OTG" is enabled and drd.c when
the "CONFIG_USB_DWC3_DUAL_ROLE" is enabled

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: Fix broken CCI feature with dwc3 usb controller
Anurag Kumar Vulisha [Thu, 14 Feb 2019 11:02:51 +0000 (11:02 +0000)]
usb: dwc3: Fix broken CCI feature with dwc3 usb controller

CCI feature was broken for dwc3 usb controller as
a part of 4.19 kernel merge. This patch fixes the
same

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: Add DRD support for versal
Anurag Kumar Vulisha [Fri, 8 Jun 2018 16:02:19 +0000 (21:32 +0530)]
usb: dwc3: Add DRD support for versal

This patch makes the required changes in dwc3-of-simple.c driver to
enable dwc3 DRD support for Versal platform

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: gadget: Don't kick transfer if LST or SHORT bits are set
Anurag Kumar Vulisha [Tue, 8 Jan 2019 16:03:54 +0000 (21:33 +0530)]
usb: dwc3: gadget: Don't kick transfer if LST or SHORT bits are set

When LST bit is set in event->status, indicates that the
transfer is completed and when SHORT bit is set in
event->status, indicates that the transfer completed with
short transfer.
In dwc3_gadget_ep_cleanup_completed_request(), the transfer
should not be started again if any of LST or SHORT bits are
set in the event.This patch modifies the code to check for
LST & SHORT bits before kick starting the transfer

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: Check MISSED ISOC bit only for ISOC endpoints
Anurag Kumar Vulisha [Tue, 8 Jan 2019 16:03:53 +0000 (21:33 +0530)]
usb: dwc3: Check MISSED ISOC bit only for ISOC endpoints

When streaming is enabled on BULK endpoints and LST bit is set
observed MISSED ISOC bit set in event->status for BULK ep. Since
this bit is only valid for isocronous endpoints, changed the code
to check for isocrnous endpoints when MISSED ISOC bit is set.

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: Check for IOC/LST bit in both event->status and TRB->ctrl fields
Anurag Kumar Vulisha [Tue, 8 Jan 2019 16:03:52 +0000 (21:33 +0530)]
usb: dwc3: Check for IOC/LST bit in both event->status and TRB->ctrl fields

The present code in dwc3_gadget_ep_reclaim_completed_trb() will check
for IOC/LST bit in the event->status and returns if IOC/LST bit is
set. This logic doesn't work if multiple TRBs are queued per
request and the IOC/LST bit is set on the last TRB of that request.
Consider an example where a queued request has multiple queued TRBs
and IOC/LST bit is set only for the last TRB. In this case, the Core
generates XferComplete/XferInProgress events only for the last TRB
(since IOC/LST are set only for the last TRB). As per the logic in
dwc3_gadget_ep_reclaim_completed_trb() event->status is checked for
IOC/LST bit and returns on the first TRB. This makes the remaining
TRBs left unhandled.
To aviod this, changed the code to check for IOC/LST bits in both
event->status & TRB->ctrl. This patch does the same.

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: dwc3: Correct the logic for checking TRB full in __dwc3_prepare_one_trb()
Anurag Kumar Vulisha [Mon, 1 Apr 2019 15:35:59 +0000 (15:35 +0000)]
usb: dwc3: Correct the logic for checking TRB full in __dwc3_prepare_one_trb()

vailability of TRB's is calculated using dwc3_calc_trbs_left(), which
determines total available TRB's based on the HWO bit set in a TRB.

In the present code, __dwc3_prepare_one_trb() is called with a TRB which
needs to be prepared for transfer. This __dwc3_prepare_one_trb() calls
dwc3_calc_trbs_left() to determine total available TRBs and set IOC bit
if the total available TRBs are zero. Since the present working TRB (which
is passed as an argument to __dwc3_prepare_one_trb() )  doesn't yet have
the HWO bit set before calling dwc3_calc_trbs_left(), there are chances
that dwc3_calc_trbs_left() wrongly calculates this present working TRB
as free(since the HWO bit is not yet set) and returns the total available
TRBs as greater than zero (including the present working TRB). This could
be a problem.

This patch corrects the above mentioned problem in __dwc3_prepare_one_trb()
by increementing the dep->trb_enqueue at the last (after preparing the TRB)
instead of increementing at the start and setting the IOC bit only if the
total available TRBs returned by dwc3_calc_trbs_left() is 1 . Since we are
increementing the dep->trb_enqueue at the last, the present working TRB is
also considered as available by dwc3_calc_trbs_left() and non zero value is
returned . So, according to the modified logic, when the total available
TRBs is equal to 1 that means the total available TRBs in the pool are 0.

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Reviewed-by: Thinh Nguyen <thinhn@synopsys.com>
Tested-by: Tejas Joglekar <tejas.joglekar@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodwc3: otg: cancel the hnp_polling work before stopping host
Anurag Kumar Vulisha [Tue, 15 May 2018 13:45:02 +0000 (19:15 +0530)]
dwc3: otg: cancel the hnp_polling work before stopping host

This patch adds the code to cancel the previously queued
HNP polling work before stopping the host.

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodwc3: otg: fix broken OTG HNP feature
Anurag Kumar Vulisha [Tue, 15 May 2018 13:45:01 +0000 (19:15 +0530)]
dwc3: otg: fix broken OTG HNP feature

HNP(Host Negotiation Protocol) is an USB OTG 2.0 feature where the
HOST & DEVICE can swap their roles. Using HNP feature A-device acting
in HOST mode can be role swapped to DEVICE mode and B-device acting in
DEVICE mode can be role swapped to HOST mode.

This feature was broken in earlier releases, so this patch fixes the same
by enabling HNP support before entering into device mode and also avoids
ADevBHostEndEvent getting triggered by waiting for extra time before
enabling events in A-peripheral state, thus giving enough time for HOST
stack on B-device to be loaded.

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: storage: uas: Remove unused variable from uas.c
Anurag Kumar Vulisha [Tue, 15 May 2018 13:55:08 +0000 (19:25 +0530)]
usb: storage: uas: Remove unused variable from uas.c

This patch removes the unused variable from the uas.c driver
to aviod the below mentioned warning

uas.c:288:16: warning: unused variable 'flags' [-Wunused-variable]

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>